efn/main.c

18 lines
523 B
C
Raw Normal View History

2022-04-02 11:40:10 +00:00
int
main(int argc, char **argv) {
2022-04-02 12:46:20 +00:00
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';
2022-04-02 11:40:10 +00:00
if (com != NULL) {
2022-04-02 12:46:20 +00:00
if (commands[com[0]] != NULL) commands[com[0]](buf);
else puts("invalid command.");
}
}
return 0;
2022-04-02 11:40:10 +00:00
}
2022-04-02 12:46:20 +00:00