]>
diplodocus.org Git - nmh/blob - sbr/read_line.c
1 /* read_line.c -- read a possibly incomplete line from stdin.
3 * This code is Copyright (c) 2017, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
10 #include "read_line.h"
13 * Flush standard output, read a line from standard input into a static buffer,
14 * zero out the newline, and return a pointer to the buffer.
15 * On error, return NULL.
20 static char line
[BUFSIZ
];
23 if (fgets(line
, sizeof(line
), stdin
) == NULL
)
25 trim_suffix_c(line
, '\n');
27 return line
; /* May not be a complete line. */