commit a059f0259612a8c5df71605daad5487c13520405 parent 07018064bbc27a4b8aad99832fbe3a0e608775d9 Author: rsc <rsc> Date: Wed, 8 Aug 2007 08:04:20 +0000 change gets to return \n, to distinguish 0-byte read from empty line Diffstat:
M | ulib.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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;