#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <errno.h>
#include <time.h>
#include <ctype.h>
#include <stdarg.h>
char *line, *new;
size_t len0, len1;
- int eof;
-
- /* Make sure we'll read at least _some_ data. */
-
- if (fs_eof(fin))
- return 0;
line = NULL;
- while (1)
+ while (fs_gets(buff, sizeof (buff), fin))
{
- /* Fill the buffer. */
-
- eof = fs_gets(buff, sizeof (buff), fin) == NULL;
-
/* Append to data read so far. */
if (line)
line = realloc(line, len1 + 1);
break;
}
-
- if (eof)
- break;
}
return (*dst = line) ? 1 : 0;
base = path_last_sep(name);
- strncpy(buf, base ? base + 1 : name, sizeof (buf));
+ strncpy(buf, base ? base + 1 : name, sizeof (buf) - 1);
/* Remove the suffix. */