diff options
author | Bert <ber.t@gmx.com> | 2011-09-08 20:54:24 +0200 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-09-08 20:54:24 +0200 |
commit | 6e575b0f721e1743fab098004d7dc26de5c7db49 (patch) | |
tree | f3fc170b48a92920fd2fae9b1c0e4302736f85ca /main.c | |
parent | 3a4f3862a7eccc4505f81582f62397c3651dc87f (diff) | |
download | nsxiv-6e575b0f721e1743fab098004d7dc26de5c7db49.tar.zst |
Strict conformance to IEEE Std 1003.1-2001
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -16,6 +16,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define _POSIX_C_SOURCE 200112L + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -430,8 +432,9 @@ int fncmp(const void *a, const void *b) { } int main(int argc, char **argv) { - int i, len, start; + int i, start; size_t n; + ssize_t len; char *filename; struct stat fstats; r_dir_t dir; @@ -460,11 +463,13 @@ int main(int argc, char **argv) { /* build file list: */ if (options->from_stdin) { filename = NULL; - while ((len = getline(&filename, &n, stdin)) > 0) { + while ((len = get_line(&filename, &n, stdin)) > 0) { if (filename[len-1] == '\n') filename[len-1] = '\0'; check_add_file(filename); } + if (filename) + free(filename); } else { for (i = 0; i < options->filecnt; i++) { filename = options->filenames[i]; |