Hi Junio,
On Mon, 4 Jan 2016, Johannes Schindelin wrote:
strbuf_init(&buf, 0);
strbuf_init(&nbuf, 0);
- while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
- if (line_termination && buf.buf[0] == '"') {
+ while ((nul_term_line
+ ? strbuf_getline(&buf, stdin, '\0')
+ : strbuf_getline_crlf(&buf, stdin)) != EOF) {
+ if (!nul_term_line && buf.buf[0] == '"') {
strbuf_reset(&nbuf);
if (unquote_c_style(&nbuf, buf.buf, NULL))
FWIW this is an example of that "abuse" I referred to earlier: the call to
strbuf_getline(..., '\0') is actually *not* interested in a line at all.
So I guess I would suggest to change the name "strbuf_getline" to
"strbuf_getdelim" first, and then re-introduce a different
"strbuf_getline" which is actually your "strbuf_getline_crlf". Because
let's face it, if we are really reading a line of text, CR/LF should be
handled automatically.
Ciao,
Dscho