Re: head.c usage function

2006-05-30 Thread matthew . garman
On Fri, May 26, 2006 at 08:47:15PM +0100, Nick Guenther wrote: least, it should be) in usage() because the proper form is fprintf(stderr, usage: %s [-ks]\n, __progname); where __progname gets filled in automatically with the name of the program. I don't know the details of how it works though,

Re: head.c usage function

2006-05-30 Thread Peter Blair
Be careful -- if you have an application say /usr/local/whatever/foo that is linked from /usr/local/bin/bar then when you call /usr/local/bin/bar it will populate bar as the argv[0] element. This may be what you want, but then again, perhaps you want to know that foo is the application being

Re: head.c usage function

2006-05-30 Thread Peter Blair
Gak! The should was hedged with quotes because I couldn't verify how it behaved. Apparently it's just a quick way to access argv[0]. Thanks! On 30 May 2006 16:29:31 +0200, Artur Grabowski [EMAIL PROTECTED] wrote: Peter Blair [EMAIL PROTECTED] writes: Be careful -- if you have an

head.c usage function

2006-05-30 Thread Arnaud Bergeron
On 5/30/06, Peter Blair [EMAIL PROTECTED] wrote: Be careful -- if you have an application say /usr/local/whatever/foo that is linked from /usr/local/bin/bar then when you call /usr/local/bin/bar it will populate bar as the argv[0] element. Wrong, argv[0] will be whatever was passed to execvp

head.c usage function

2006-05-26 Thread Will H. Backman
Looking at /bin/head source code. The usage function uses: fputs(usage: head [-n line_count] [file ...]\n, stderr); While many other programs use: fprintf(stderr, usage: arch [-ks]\n); Is there a difference? Is one preferred? Yes, I know. I should take a C programming course.

Re: head.c usage function

2006-05-26 Thread Nick Guenther
On 5/26/06, Will H. Backman [EMAIL PROTECTED] wrote: Looking at /bin/head source code. The usage function uses: fputs(usage: head [-n line_count] [file ...]\n, stderr); While many other programs use: fprintf(stderr, usage: arch [-ks]\n); Is there a difference? Is one preferred? Yes, I