M
Mark Hobley
In comp.os.linux.development.apps Mark Hobley said:Right. That is just as messy as __dead. I think I will just delete the tag.
Right I have found another doubleunderscore thingybob. This time __progname:
void
usage(void)
{
extern char *__progname;
(void)fprintf(stderr, "usage: %s [-itw] file ...\n", __progname);
exit(1);
}
This was easier to find in google than the last one. I stumbled across:
http://stackoverflow.com/questions/273691/using-progname-instead-of-argv0
This tells me that __progname is a bsdism and getopt() modifies argv[],
which is not available outside of main(). I guess that I need to somehow
capture argv[0] on entry to main. I guess that the following is a fixup for
this:
extern char *progname;
int
main(int argc, char *argv[])
{
extern char *progname;
progname=argv[0];
blah blah blah
}
void
usage(void)
{
extern char *progname;
(void)fprintf(stderr, "usage: %s [-itw] file ...\n", progname);
exit(1);
}
Does that look right?
Mark.