Mail Archives: djgpp-workers/1997/11/06/19:26:23
Randy Maas wrote:
>
> >On Thu, 6 Nov 1997, Vik Heyndrickx wrote:
> > fprintf(stderr,"Usage: %s [inputBase] [outputFile]\n", argv[0]);
> >
> >The downside of this is that you (usually) get in argv[0] the whole path
> name of the program, which might be quite long.
>
> maybe, in a not so elegant fashion, this would do a decent job:
[snip]
Better yet, use fnsplit(), which is what I ended up doing after going to
a lot of trouble to break up filenames manually.
char progname[FILENAME_MAX];
fnsplit( argv[0], NULL, NULL, progname, NULL );
fprintf(stderr,"Usage: %s [inputBase] [outputFile]\n", progname);
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com |
| Descent 2: The Infinite Abyss - The greatest Internet game of all |
| time just got better! This time, you're going all the way down...|
---------------------------------------------------------------------
- Raw text -