This source file includes following definitions.
- xmain
#include "a.h"
int vflag;
int sflag;
char *argv0;
static struct {
char *name;
void (*f)(int, char**);
} cmdtab[] = {
{"banner", cmdbanner},
{"bootstrap", cmdbootstrap},
{"clean", cmdclean},
{"env", cmdenv},
{"install", cmdinstall},
{"version", cmdversion},
};
void
xmain(int argc, char **argv)
{
int i;
if(argc <= 1)
usage();
for(i=0; i<nelem(cmdtab); i++) {
if(streq(cmdtab[i].name, argv[1])) {
cmdtab[i].f(argc-1, argv+1);
return;
}
}
xprintf("unknown command %s\n", argv[1]);
usage();
}