efn/main.c

21 lines
537 B
C

int
main(int argc, char **argv) {
static char buf[COM_BUF_SIZE];
while(1) {
memset(buf, 0, sizeof(buf));
printf(" > ");
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;
}