mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Fix some issues and do some code cleanup
This commit is contained in:
parent
1f229e4efc
commit
312ed5c67c
72 changed files with 880 additions and 982 deletions
|
@ -19,7 +19,15 @@
|
|||
#include "libc/stdio/stdio.h"
|
||||
|
||||
/**
|
||||
* Reads line from stream.
|
||||
* Reads line from stream, e.g.
|
||||
*
|
||||
* char *line = NULL;
|
||||
* size_t linesize = 0;
|
||||
* while (getline(&line, &linesize, stdin) > 0) {
|
||||
* _chomp(line);
|
||||
* printf("%s\n", line);
|
||||
* }
|
||||
* free(line);
|
||||
*
|
||||
* This function delegates to getdelim(), which provides further
|
||||
* documentation. Concerning lines, please note the \n or \r\n are
|
||||
|
@ -30,7 +38,7 @@
|
|||
* NUL-termination is guaranteed FTMP
|
||||
* @return number of bytes read, including delim, excluding NUL, or -1
|
||||
* w/ errno on EOF or error; see ferror() and feof()
|
||||
* @see xgetline(), getdelim(), gettok_r()
|
||||
* @see fgetln(), xgetline(), getdelim(), gettok_r()
|
||||
*/
|
||||
ssize_t getline(char **line, size_t *n, FILE *f) {
|
||||
return getdelim(line, n, '\n', f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue