Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- static char *end_line(char *line) {
- static const char *end ="end";
- return strstr(line, end);
- }
- int main(void) {
- char line[BUFSIZ];
- const char *prompt = "> ";
- printf("%s", prompt);
- while (fgets(line, BUFSIZ, stdin)) {
- if (end_line(line)) break;
- printf("%s", line);
- printf("%s", prompt);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement