With the following defined which is the easiest way to get the root of the program name?
progname = argv;
If executed as './foo' or '/home/moo/foo', this would result in progname being set to "./foo" or "/home/moo/foo". However, I would like progname being set to only "foo".
Would strtok be the easiest or is there something else which can be used?