=/^G show total bytes now; document may not always work
[unix-history] / usr / src / usr.bin / ptx / ptx.c
index 6c5e0b9..dbce655 100644 (file)
@@ -1,5 +1,6 @@
-static char *sccsid = "@(#)ptx.c       4.2 (Berkeley) %G%";
-#
+#ifndef lint
+static char *sccsid = "@(#)ptx.c       4.4 (Berkeley) %G%";
+#endif /* not lint */
 
 /*     permuted title index
        ptx [-t] [-i ignore] [-o only] [-w num] [-f] [input] [output]
 
 /*     permuted title index
        ptx [-t] [-i ignore] [-o only] [-w num] [-f] [input] [output]
@@ -14,7 +15,6 @@ static char *sccsid = "@(#)ptx.c      4.2 (Berkeley) %G%";
        the -t flag says the output is for troff and the
        output is then wider.
 
        the -t flag says the output is for troff and the
        output is then wider.
 
-\e      make: cc ptx.c -lS
        */
 
 #include <stdio.h>
        */
 
 #include <stdio.h>
@@ -58,7 +58,7 @@ FILE *inptr = stdin;
 char *outfile;
 FILE *outptr = stdout;
 
 char *outfile;
 FILE *outptr = stdout;
 
-char *sortfile;        /* output of sort program */
+char sortfile[] = "/tmp/ptxsXXXXX";    /* output of sort program */
 char nofold[] = {'-', 'd', 't', TILDE, 0};
 char fold[] = {'-', 'd', 'f', 't', TILDE, 0};
 char *sortopt = nofold;
 char nofold[] = {'-', 'd', 't', TILDE, 0};
 char fold[] = {'-', 'd', 'f', 't', TILDE, 0};
 char *sortopt = nofold;
@@ -216,7 +216,7 @@ char **argv;
 
        /* open output file for sorting */
 
 
        /* open output file for sorting */
 
-       sortfile = mktemp("/tmp/ptxsXXXXX");
+       mktemp(sortfile);
        if((sortptr = fopen(sortfile, "w")) == NULL)
                diag("Cannot open output for sorting:",sortfile);
 
        if((sortptr = fopen(sortfile, "w")) == NULL)
                diag("Cannot open output for sorting:",sortfile);
 
@@ -245,8 +245,7 @@ char **argv;
 
 
        getsort();
 
 
        getsort();
-       if(*sortfile)
-               unlink(sortfile);
+       unlink(sortfile);
        exit(0);
 }
 
        exit(0);
 }
 
@@ -500,8 +499,7 @@ char *strt, *end;
 onintr()
 {
 
 onintr()
 {
 
-       if(*sortfile)
-               unlink(sortfile);
+       unlink(sortfile);
        exit(1);
 }
 
        exit(1);
 }