I'm testing to make sure the command is running as it's proper name, if not then fail.
if (strcmp(argv[0], "xinit") != 0) {
fprintf(stdout, "name = %s length = %d\n",argv[0],l);
usage(0);
}
This works if the command is called as /sbin/xinit but fails if it is called as
/xinit. Id like it to also work if called as xinit , /sbin/xinit , or /xinit.
There are intrinsic difficulties in finding the real name of the executable -
for an example see the bottom of Perderabo's second post about arg 0 here:
That works as long as 'xinit' is not in any part of the string. I'm tring to also limit the executable from being executed from other locations. i.e. /usr/joe/xinit -> I would want that to fail.