picrin/src/main.c

31 lines
389 B
C
Raw Normal View History

2013-10-09 03:58:35 -04:00
#include <stdio.h>
int
main()
{
char line[256], last_char;
int char_index;
while (1) {
printf("> ");
char_index = 0;
while ((last_char = getchar()) != '\n') {
if (last_char == EOF)
goto eof;
line[char_index++] = last_char;
}
line[char_index] = '\0';
/* echo */
printf("%s", line);
printf("\n");
}
eof:
puts("");
2013-10-09 03:58:35 -04:00
return 0;
}