diff --git a/ulib.c b/ulib.c index 5c8e6f3..decab69 100644 --- a/ulib.c +++ b/ulib.c @@ -67,9 +67,9 @@ gets(char *buf, int max) cc = read(0, &c, 1); if(cc < 1) break; + buf[i++] = c; if(c == '\n' || c == '\r') break; - buf[i++] = c; } buf[i] = '\0'; return buf;