Originally Posted by
Salem
How about
Code:
strcpy(program_name, argc ? basename(argv[0]) : "");
Wow Salem, it's like you can see into the future. I shouldn't have writen off your comment so quickly. I now use the following for my main function template:
Code:
int main (int argc, char *argv[] __attribute__((unused)))
{
// Check number of arguments.
if(argc != 1)
{
fprintf(stderr, "Usage: %s\n", argc ? program_invocation_short_name : "");
exit(EXIT_FAILURE);
}
// Run process.
run_process();
// Exit cleanly.
exit(EXIT_SUCCESS);
}
Ty.