rev-parse: read parseopt spec with strbuf_getline()
"rev-parse --parseopt" specification is clearly text and we should anticipate that we may be fed CRLF lines. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 28, 2015 at 13:59 UTC
72e37b6ac851c3926956c9d11a40260f08bf1c5e
1 file changed
+2
-2
builtin/rev-parse.c
+2
-2
@@ -383,7 +383,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
383
384
/* get the usage up to the first line with a -- on it */
385
for (;;) {
386
- if (strbuf_getline_lf(&sb, stdin) == EOF)
386
+ if (strbuf_getline(&sb, stdin) == EOF)
387
die("premature end of input");
388
ALLOC_GROW(usage, unb + 1, usz);
389
if (!strcmp("--", sb.buf)) {
@@ -396,7 +396,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
396
}
397
398
/* parse: (<short>|<short>,<long>|<long>)[*=?!]*<arghint>? SP+ <help> */
399
- while (strbuf_getline_lf(&sb, stdin) != EOF) {
399
+ while (strbuf_getline(&sb, stdin) != EOF) {
400
const char *s;
401
const char *help;
402
struct option *o;