From 6e575b0f721e1743fab098004d7dc26de5c7db49 Mon Sep 17 00:00:00 2001 From: Bert Date: Thu, 8 Sep 2011 20:54:24 +0200 Subject: Strict conformance to IEEE Std 1003.1-2001 --- main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index dedd86e..ebb6e7d 100644 --- a/main.c +++ b/main.c @@ -16,6 +16,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define _POSIX_C_SOURCE 200112L + #include #include #include @@ -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]; -- cgit v1.2.3