uniq(1) use isspace(3b) instead of isblank(3) to parse field separator.

Issue #109 resolved
Takehiko NOZAKI repo owner created an issue

following code:

       for (nfields = numfields, infield = 0; nfields && *str; ++str)
               if (isspace((unsigned char)*str)) {
                       if (infield) {
                               infield = 0;
               } else if (!infield)
                       infield = 1;                    

but spec says: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/uniq.html

-f  fields
Ignore the first fields fields on each input line when doing comparisons, where fields is a positive decimal integer. A field is the maximal string matched by the basic regular expression:
[[:blank:]]*[^[:blank:]]*

If the fields option-argument specifies more fields than appear on an input line, a null string shall be used for comparison.

Comments (2)

  1. Takehiko NOZAKI reporter

    import new 2-claus BSDL uniq(1) implementation, for following PR: BUGFIX: Issue #108 - uniq(1) doesn't recognize '-' as stdin. BUGFIX: Issue #109 - uniq(1) use isspace(3b) instead of isblank(3) to parse field separator. BUGFIX: Issue #110 - uniq(1) doesn't trap file write error. ENHANCEMENT: Issue #106 - implement GNU uniq(1) extension.

    → <<cset 4d704feba757>>

  2. Log in to comment