X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/c3eea81ded78e7803b42f09697bc202e1b1aaf86..4aca08ce404ffaa63000c218e8e042d7b27fbfcc:/sbr/read_line.c diff --git a/sbr/read_line.c b/sbr/read_line.c index 51fa87d9..5f33cac6 100644 --- a/sbr/read_line.c +++ b/sbr/read_line.c @@ -1,6 +1,19 @@ -#include -#include +/* read_line.c -- read a possibly incomplete line from stdin. + * + * This code is Copyright (c) 2017, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. + */ +#include "h/mh.h" +#include "h/utils.h" +#include "read_line.h" + +/* + * Flush standard output, read a line from standard input into a static buffer, + * zero out the newline, and return a pointer to the buffer. + * On error, return NULL. + */ const char * read_line(void) { @@ -9,7 +22,7 @@ read_line(void) fflush(stdout); if (fgets(line, sizeof(line), stdin) == NULL) return NULL; - TrimSuffixC(line, '\n'); + trim_suffix_c(line, '\n'); return line; /* May not be a complete line. */ }