efn/main.c

18 lines
523 B
C

int
main(int argc, char **argv) {
static char buf[256];
while(1) {
memset(buf, 0, sizeof(buf));
char *com = fgets(buf, sizeof(buf), stdin);
for (int i = 0; i < sizeof(buf); i++)
if (buf[i] == '\n')
buf[i] = '\0';
if (com != NULL) {
if (commands[com[0]] != NULL) commands[com[0]](buf);
else puts("invalid command.");
}
}
return 0;
}