Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.6.2.13 $; site uiucdcs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!liberte From: liberte@uiucdcs.UUCP Newsgroups: net.bugs.4bsd Subject: Blanks `sort` of not ignored - (nf) Message-ID: <8200022@uiucdcs.UUCP> Date: Fri, 1-Jun-84 21:11:00 EDT Article-I.D.: uiucdcs.8200022 Posted: Fri Jun 1 21:11:00 1984 Date-Received: Tue, 5-Jun-84 08:28:35 EDT Lines: 61 Nf-ID: #N:uiucdcs:8200022:000:1865 Nf-From: uiucdcs!liberte Jun 1 20:11:00 1984 #N:uiucdcs:8200022:000:1865 uiucdcs!liberte Jun 1 20:11:00 1984 Subject: Sort does not ignore blanks given no tabchar. Index: /usr/src/usr.bin/sort.c 4.2 bsd Description: The behavior of sort is wrong if no tabchar is specified (-t option) and the number of blanks between fields varies. It does not ignore blanks as the manual would lead one to believe it should: "Under the -tx option, fields are strings separated by x; otherwise fields are nonempty nonblank strings separated by blanks." The 4.1 version had a different, though related bug in which the -b option had no effect if the -t option was used. Even now, the -b option is not so useful with the -t option. Nevertheless, there is an ambiguity in the manual regarding the -b option. The way `sort` works, ignoring blanks for -pos2 (the termination position) means include the blanks in the field comparison. The trick of my fix is to stop before those blanks if no tabchar is given. Repeat-By: sort +0 -1 <bflg[j]) while(blank(*p)) p++; i = fp->n[j]; --- 724,730 ----- else goto ret; } } ! if((!j && tabchar==0)||fp->bflg[j]) /* j is the pos #, 0 or 1 */ while(blank(*p)) p++; i = fp->n[j]; Daniel LaLiberte (ihnp4!uiucdcs!liberte) U of Illinois, Urbana-Champaign, Computer Science {moderation in all things - including moderation}