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 know.  I should take a C programming course.


all the printf functions are "formatted printing". If you aren't
formatting then there is no difference. fprintf is more often used (at
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, does anyone
have a link to an explanation?

-Nick

Reply via email to