New answers tagged

0

There are two bugs in your code: write(…, sizeof(char)); will only write "sizeof(char)" bytes (= most likely 1 or 2 bytes) to the FIFO, and not the size of the buffer as you probably intended my_fifo | will not read any data from the FIFO; you'll need to cat it at least. Since the call to writewill block until the script reads the data (and vice versa!), ...


2

Yes, cd - is POSIX mandated: and so is tilda expansion (all it takes is a little of web searching ;-)) Your cd builtin (technically not a "program") will need to do some option parsing too if it wants to be POSIX compliant. As for globbing vs shell expansion, the way I understand it, globbing is a particular case of shell expansion that involves a ...


6

Tilde expansion is part of shell command processing, not part of cd. cd sees the already-expanded path as its argument. POSIX requires cd - to be equivalent to cd "$OLDPWD" && pwd. OLDPWD must be set by cd if PWD exists at the time of running the command.


2

Tilde expansion seems to be standardized (cf. IEEE Std 1003.1, 2004), but is part of the shell expansion, not of cd. cd - must also be supported (cf. IEEE Std 1003.1,2005).


0

Here's a community wiki to collect other distros' equivalent tools for Faheem's method. Feel free to edit, but keep the sort alphabetical for searching. Arch Use pkgfile from the extra repository, passing the header file name as a parameter. Example: $ pkgfile XInput.h extra/libxi extra/nx-headers Debian (and anything Debian-based using dpkg) ...


4

The question is how to determine what linker flag to use from inspection of the source file. The example below will work for Debian. The header files are the relevant items to note here. So, suppose one has a C source file containing the header #include <X11/extensions/XInput.h>. We can do a search for XInput.h using, say apt-file. If you know this ...


1

Assuming the file is syntactically correct, you could format it with indent and make the process for finding and extracting the function much simpler: with indent, you can make the function name in the first column of a line, followed by a left-parenthesis, and after that, the next right-brace '}' appearing in the first column would end the function. ...


1

If you just need the function header, you could use ctags: $ ctags -x foo.c MyFunction 1 foo.c int MyFunction(int i) {


4

As has been said in the comments, the only reliable way to build a single binary which will work on different releases of Debian (or any Linux distribution) is to build it statically. This is well-supported on Debian and elsewhere, including with pkg-config etc. Static binaries can keep working for decades; the kernel's userspace interface is maintained in a ...



Top 50 recent answers are included