* Parse one whitespace- or NUL-terminated, possibly C-quoted argument * and append the result to arg. Return a pointer to the terminator. * Die if there is an error in how the argument is C-quoted. This * function is only used if not -z. */
| 41 | * function is only used if not -z. |
| 42 | */ |
| 43 | static const char *parse_arg(const char *next, struct strbuf *arg) |
| 44 | { |
| 45 | if (*next == '"') { |
| 46 | const char *orig = next; |
| 47 | |
| 48 | if (unquote_c_style(arg, next, &next)) |
| 49 | die("badly quoted argument: %s", orig); |
| 50 | if (*next && !isspace(*next)) |
| 51 | die("unexpected character after quoted argument: %s", orig); |
| 52 | } else { |
| 53 | while (*next && !isspace(*next)) |
| 54 | strbuf_addch(arg, *next++); |
| 55 | } |
| 56 | |
| 57 | return next; |
| 58 | } |
| 59 | |
| 60 | /* |
| 61 | * Parse the reference name immediately after "command SP". If not |
no test coverage detected