mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Improve backwards compatibility with GNU Make
This commit is contained in:
parent
fabf7f9f02
commit
1f2288be6e
18 changed files with 412 additions and 96 deletions
|
@ -25,16 +25,18 @@
|
|||
*
|
||||
* @return allocated line that needs free() and usually chomp() too,
|
||||
* or NULL on ferror() or feof()
|
||||
* @see getline() for a more difficult api
|
||||
* @see getdelim() for a more difficult api
|
||||
* @see chomp()
|
||||
*/
|
||||
char *xgetline(FILE *f) {
|
||||
char *res;
|
||||
size_t n, got;
|
||||
char *p;
|
||||
size_t n;
|
||||
ssize_t m;
|
||||
n = 0;
|
||||
res = NULL;
|
||||
if ((got = getdelim(&res, &n, '\n', f)) <= 0) {
|
||||
free(res);
|
||||
res = NULL;
|
||||
p = 0;
|
||||
if ((m = getdelim(&p, &n, '\n', f)) <= 0) {
|
||||
free(p);
|
||||
p = 0;
|
||||
}
|
||||
return res;
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue