diff --git a/usr.bin/cut/cut.1 b/usr.bin/cut/cut.1 index 80d36fa6d72..fd1c92d543b 100644 --- a/usr.bin/cut/cut.1 +++ b/usr.bin/cut/cut.1 @@ -67,11 +67,11 @@ The items specified by can be in terms of column position or in terms of fields delimited by a special character. Column numbering starts from 1. .Pp -.Ar List +.Ar list is a comma or whitespace separated set of increasing numbers and/or number ranges. Number ranges consist of a number, a dash -.Pq Li \- , +.Pq Sq \- , and a second number and select the fields or columns from the first number to the second, inclusive. @@ -109,8 +109,9 @@ Suppresses lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. .El .Pp -.Nm Cut -exits 0 on success, 1 if an error occurred. +The +.Nm cut +utility exits 0 on success or 1 if an error occurred. .Sh SEE ALSO .Xr paste 1 .Sh STANDARDS diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c index 10757296076..11e951364b8 100644 --- a/usr.bin/cut/cut.c +++ b/usr.bin/cut/cut.c @@ -80,7 +80,7 @@ main(argc, argv) /* Since we don't support multi-byte characters, the -c and -b options are equivalent, and the -n option is meaningless. */ - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != EOF) + while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) switch(ch) { case 'b': case 'c': @@ -147,7 +147,7 @@ get_list(list) * overlapping lists. We also handle "-3-5" although there's no * real reason too. */ - for (; (p = strtok(list, ", \t")); list = NULL) { + for (; (p = strsep(&list, ", \t"));) { setautostart = start = stop = 0; if (*p == '-') { ++p; @@ -231,7 +231,7 @@ f_cut(fp, fname) output = 0; for (isdelim = 0, p = lbuf;; ++p) { if (!(ch = *p)) - errx(1, "%s: line too long", fname); + errx(1, "%s: line too long.", fname); /* this should work if newline is delimiter */ if (ch == sep) isdelim = 1;