No manual entry for fcntl problem - manual

When I use `man fcntl' got the message:
No manual entry for fcntl
which the pkg is needed to install?
ps. I use debian.

In Debian these man pages are available in manpages-dev package.

This doesn't answer your question directly, but: I myself just use the internet: here is the first search result for "man fcntl" in google.

fcntl is a standard C library function so it should be one of your development packages. However, I long ago gave up on using man on the UNIX boxes themselves, try typing "man fcntl" into Google (with the quotes) to get online versions.
Just don't do this to try and figure out how man itself works. Typing "man man" into Google returns some interesting results (not safe for work).

Related

Cygwin - ypcat command equivalent

I've been trying to find the equivalent command for the UNIX ypcat utility for Cygwin, but there is almost no documentation for it i regards to its presence (if any) for Cygwin. Can anybody help me find or teach me its equivalent, and if they can a brief explanation on how to use it if it differs from ypcat (it happened to me that Cygwin uses aspell for spell checking, replacing ispell or spell, and does not use the same entry format). TIA!
Someone made a port, but the files are no longer available at the specified domain, it seems.
http://www.cygwin.com/ml/cygwin-apps/2003-09/msg00144.html
You may have to contact the owner by e-mail to get a copy.

Show last command with up arrow on a linux c shell

I have implemented a simple linux shell in c. Now, I am adding some features and one I immediately thought about was to be able to show the last commands with the up arrow.
Question 1:
However, I have no idea how to accomplish this. Do you?
Question 2:
Any comment on how to store the "history" commands are also appreciated. I suppose something like a queue which allows access to all elements would be a good idea. Am I wrong? Do I have to implement it or is there already some good implementation out there I should know about?
Thanks.
Build libedit or readline support into your shell.
If you want to be lazy, you can use rlwrap:
rlwrap prog
I wrote the shell for HelenOS. Grab the bzr repo and navigate to uspace/app/bdsh (bdsh stands for the (b)rain (d)ead (sh)ell).
Other contributors have since added line editing / history / tab completion to the functions that handle input. Its written purely in ANSI C, does not link against glibc and implements its own functions. The code (both in the shell and underlying HelenOS libc) is 3 clause BSD, you can use it in anything.
If nothing else, it might help to just examine the implementation to get started.

How can I hook into tcsh's TAB completion on Linux

I have some directories with a number of "hidden" files. One example of this is I'm in a source controlled sandbox and some of the files have not been checked out yet.
When I hit TAB, I'd like the option of seeing these files.
A similar question has been asked before: CVS Tab completion for modules under linux
The answers to that question summarize to: "Ubuntu's got that built in".
I don't have the option of switching to Ubuntu, but surely I can use the same mechanisms.
how can I hook into the TAB-completion feature of tcsh to add additional file Support for CVS, SVN and BitKeeper would all be useful.
More important than support for a specific source control system is the ability to control the returned list myself.
An acceptable solution would also be to use a key-binding other than TAB. (ctrl- perhaps)
From the manpage:
the complete builtin command can be used to tell the shell how to complete words other than filenames, commands and variables
might get you started
I do not know how to program in tcsh. But if you can, then you could look at the file named "bash_completion" from the archive (find the download link here.)
On line 1673 begins CVS completion code - and this might be portable to csh if you are familiar with the differences between bash/tcsh.
On my ubuntu machine, there is also a section for SVN completion (in /etc/bash_completion) that doesn't seem to be present in the maintainer's archive.
That's not Ubuntu-specific behavior, it's the bash-completion project.
You could use that, if you can switch from tcsh to bash.

Finding where Linux functions are defined

Is there a good database for Linux where I can search for a function name and it tells me which header it is defined in? Googling doesn't always work for me and there aren't always man pages.
Using manpages
For basic C functions, the manpages should work.
man 2 read
man 3 printf
Section 2 is for system calls (direct to the kernel), and section 3 is for standard C library calls. You can generally omit the section, and man will figure out what you need on its own.
Note that you may need to take extra steps to get development-related manpages on your system. For example, on my Debian system, I had to do apt-get install manpages-dev glibc-doc.
Using library-specific references
For non-basic C functions, you should check the documentation of the library you're using (e.g., GNU's docs for libstdc++, doc.qt.io for Qt, library.gnome.org for GNOME projects like GTK, and so on).
Using the web
linux.die.net is a good online mirror of web pages.
LSB Navigator (as described in this answer) looks cool. I did not know about that.
Using grep
Sometimes it's just easiest to search /usr/include yourself. grep works for this, but ack is much better. For example, if I'm trying to find the header that contains getRootLogger:
cd /usr/include
# Debian calls 'ack' ack-grep. Your system may differ.
# Add \b before and after to only match a complete word.
ack-grep '\bgetRootLogger\b'
ack will return a nicely formatted and colorized list of matches.
You can wrap this up in a function and put it in your .bashrc file (or equivalent) for easy use:
function findheaderfor() {
ack-grep \\b$1\\b /usr/include /usr/local/include
}
Try the man pages, I use them a lot. You get the files you need to include.
Sometimes you want to pass a section number. Here are some examples :
man 2 socket
man 2 accept
man 3 fopen
man sem_post
2 is for system call related functions
3 is for function from the C library.
If there is no ambiguity, the section number is not needed
If you are looking for kernel function definition or kernel source navigation, you should definitely try lxr.linux.no
Sure, have you tried "man" in Linux?
For C functions, you may want to do "man 3 ".
You could use LSB Navigator (use search field in the top-right corner). However, most functions, about which you will find header information there, have manpages as well.

xls to text converter

Anyone know of a free xls to text converter that can be run from the unix command line?
There is also the package catdoc (Ubuntu link) that includes a xls2csv utility.
A quick search of apt-cache turned up the Ubuntu package python-excelerator for excelerator, which includes py_xls2html, py_xls2csv and py_xls2txt utlities. Will this work for you?
Your question reminded me of anti-word. I looked up and found anti-excel. I have never used it, so I can't vouch for how well it work or whether it makes achievable the task you have at hand. Also, I remember using a utility called 'sc' on linux to created spreadsheets on the console---though, I do not know whether it is capable of interpreting XLS files.
I think gnumeric is better to convert document to csv http://xmodulo.com/2012/06/how-to-convert-xlsx-files-to-xls-or-csv.html

Resources