change gets to return \n, to distinguish 0-byte read from empty line
This commit is contained in:
parent
07018064bb
commit
a059f02596
1 changed files with 1 additions and 1 deletions
2
ulib.c
2
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;
|
||||
|
|
Loading…
Reference in a new issue