int main(int argc, char *argv[], char **envp) { char *slash, *basename; struct stub *ep; if (argv[0] == NULL || *argv[0] == '\0') crunched_usage(); slash = strrchr(argv[0], '/'); basename = slash ? slash + 1 : argv[0]; for (ep = entry_points; ep->name != NULL; ep++) if (!strcmp(basename, ep->name)) break; if (ep->name) return ep->f(argc, argv, envp); else { fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, basename); crunched_usage(); } }
int crunched_main(int argc, char **argv, char **envp) { char *slash; struct stub *ep; int columns, len; if(argc <= 1) crunched_usage(); slash = strrchr(argv[1], '/'); __progname = slash? slash+1 : argv[1]; return main(--argc, ++argv, envp); }