Refactor cut.1 and cut.c

and reflect recent changes to the role of "delim".
This commit is contained in:
FRIGN 2015-01-24 22:53:37 +01:00
parent eb57becb38
commit c369844ae2
2 changed files with 7 additions and 4 deletions

4
cut.1
View File

@ -53,9 +53,9 @@ delimiters are passed through, unless
.Fl s .Fl s
is specified. is specified.
.It Fl d Ar delim .It Fl d Ar delim
Use first byte of Use
.Ar delim .Ar delim
as field delimiter. Default is \et. as field delimiter, which can be an arbitrary string. Default is '\et'.
.It Fl s .It Fl s
Suppress lines not containing field delimiters. Suppress lines not containing field delimiters.
.El .El

7
cut.c
View File

@ -158,8 +158,11 @@ resolveescapes(char *s, size_t len)
case 'r': s[i] = '\r'; off++; break; case 'r': s[i] = '\r'; off++; break;
case 't': s[i] = '\t'; off++; break; case 't': s[i] = '\t'; off++; break;
case 'v': s[i] = '\v'; off++; break; case 'v': s[i] = '\v'; off++; break;
case '\0': eprintf("cut: null escape sequence in delimiter\n"); case '\0':
default: eprintf("cut: invalid escape sequence '\\%c' in delimiter\n", s[i + 1]); eprintf("cut: null escape sequence in delimiter\n");
default:
eprintf("cut: invalid escape sequence '\\%c' in"
"delimiter\n", s[i + 1]);
} }
for (m = i + 1; m <= len - off; m++) for (m = i + 1; m <= len - off; m++)