parseName extracts a file name from the start of a string and returns the name and the index of the first character after the name. If the name is unquoted and term is non-zero, parsing stops at the first occurrence of term. If the name is exactly "/dev/null", no further processing occurs. Otherwis
(s string, term byte, dropPrefix int)
| 421 | // separated by forward slashes are dropped from the name and any duplicate |
| 422 | // slashes are collapsed. |
| 423 | func parseName(s string, term byte, dropPrefix int) (name string, n int, err error) { |
| 424 | if len(s) > 0 && s[0] == '"' { |
| 425 | name, n, err = parseQuotedName(s) |
| 426 | } else { |
| 427 | name, n, err = parseUnquotedName(s, term) |
| 428 | } |
| 429 | if err != nil { |
| 430 | return "", 0, err |
| 431 | } |
| 432 | if name == devNull { |
| 433 | return name, n, nil |
| 434 | } |
| 435 | return cleanName(name, dropPrefix), n, nil |
| 436 | } |
| 437 | |
| 438 | func parseQuotedName(s string) (name string, n int, err error) { |
| 439 | for n = 1; n < len(s); n++ { |