Created
April 12, 2018 16:00
-
-
Save caioluders/5ee3637ef7d14387e77b3d50e6e168ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char *argv[]) { | |
int i; | |
char s[MAX_CMD_LINE], c; | |
memset(s, 0, MAX_CMD_LINE); | |
// Loop until Ctrl+C is pressed | |
for (i=0; ; i++) { | |
if ((c = getchar()) == EOF) // End Of File reached when reading from a pipe | |
break; | |
if (c == '\n') { | |
examine(s); | |
memset(s, 0, MAX_CMD_LINE); | |
i=-1; | |
putchar('\n'); | |
} | |
s[i] = c; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment