Article View: net.bugs.usg
Article #227Two problems with "ptx" and one with its manual page
From: Guy Harris
Date: Thu, 26 Sep 1985 04:43
Date: Thu, 26 Sep 1985 04:43
116 lines
3089 bytes
3089 bytes
1) "ptx" will mis-sort on occasion, since it sorts the line as a unit when
it's doing its sorting. The 4.2 version sorts the two components of the
line (the "before keyword" portion and the "keyword and after" portion) as
two separate fields.
2) Even if "ptx" executes successfully, it exits with an exit status of 1.
3) The S5 "ptx" manual page makes the claim under BUGS that:
Lines that contain tildes (~) are botched, because *ptx*
uses that character internally.
"ptx" hasn't used "~" internally for quite some time. TILDE is defined as
0177 in both the 4.2 and S5 "ptx" (and was probably so defined in V7).
Here are the fixes to 1) and 2):
*** /arch/s5r2/usr/src/cmd/ptx/ptx.c Wed Sep 21 13:46:51 1983
--- ptx.c Mon Sep 23 13:57:29 1985
***************
*** 59,64
FILE *outptr = stdout;
char *sortfile; /* output of sort program */
FILE *sortptr;
char *bfile; /*contains user supplied break chars */
--- 59,67 -----
FILE *outptr = stdout;
char *sortfile; /* output of sort program */
+ char nofold[] = {'-', 'd', 't', TILDE, 0};
+ char fold[] = {'-', 'd', 'f', 't', TILDE, 0};
+ char *sortopt = nofold;
FILE *sortptr;
char *bfile; /*contains user supplied break chars */
***************
*** 71,77
register int c;
register char *bufp;
int pid;
- int foldf = 0;
char *pend;
extern onintr();
--- 74,79 -----
register int c;
register char *bufp;
int pid;
char *pend;
extern onintr();
***************
*** 96,102
rflag++;
break;
case 'f':
! foldf++;
break;
case 'w':
--- 98,104 -----
rflag++;
break;
case 'f':
! sortopt = fold;
break;
case 'w':
***************
*** 234,243
diag("Cannot fork",empty);
case 0: /* child */
! if(foldf == 0)
! execl(SORT, SORT, "-d", sortfile, "-o", sortfile, 0);
! else
! execl(SORT, SORT, "-df", sortfile, "-o", sortfile, 0);
default: /* parent */
while(wait(&status) != pid);
--- 236,243 -----
diag("Cannot fork",empty);
case 0: /* child */
! execl(SORT, SORT, sortopt, "+0", "-1", "+1",
! sortfile, "-o", sortfile, (char *)0);
default: /* parent */
while(wait(&status) != pid);
***************
*** 245,251
getsort();
! onintr();
}
msg(s,arg)
--- 245,252 -----
getsort();
! unlink(sortfile);
! exit(0);
}
msg(s,arg)
Guy Harris
Technical Details
Message-ID:
<2825@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxr!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!guyShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxr!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.bugs.usg Subject: Two problems with "ptx" and one with its manual page Message-ID: <2825@sun.uucp> Date: Thu, 26-Sep-85 00:43:10 EDT Article-I.D.: sun.2825 Posted: Thu Sep 26 00:43:10 1985 Date-Received: Sun, 29-Sep-85 04:40:46 EDT Distribution: net Organization: Sun Microsystems, Inc. Lines: 116