from part 3: > diff --git cl/cl_main.c cl/cl_main.c > index ed4abda..cc48ad3 100644 > --- cl/cl_main.c > +++ cl/cl_main.c > @@ -19,6 +19,7 @@ > #include <err.h> > #include <errno.h> > #include <fcntl.h> > +#include <libgen.h> > #include <paths.h> > #include <signal.h> > #include <stdio.h> > @@ -36,7 +37,7 @@ sigset_t __sigblockset; /* > GLOBAL: Blocked signals. */ > > static void cl_func_std(GS *); > static CL_PRIVATE *cl_init(GS *); > -static GS *gs_init(char *); > +static GS *gs_init(void); > static int setsig(int, struct sigaction *, void (*)(int)); > static void sig_end(GS *); > static void term_init(char *); > @@ -59,8 +60,10 @@ main(int argc, char *argv[]) > if (reenter++) > abort(); > > + /* Set progname for compatibility reasons */ > + setprogname(basename(argv[0]));
I'm a bit confused about this. First, the basename call is unnecessary since setprogname() internally strips everything up to and including the last slash. Second, why is setprogname() necessary at all? The result of getprogname() is the string stored in __progname, which in turn is what follows the last slash in argv[0], see lib/csu/crt0.c:91. So this seems to be a no-op. What am I missing?