projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4 release
[unix-history]
/
usr
/
src
/
cmd
/
sort.c
diff --git
a/usr/src/cmd/sort.c
b/usr/src/cmd/sort.c
index
bccb330
..
2be25ee
100644
(file)
--- a/
usr/src/cmd/sort.c
+++ b/
usr/src/cmd/sort.c
@@
-1,3
+1,4
@@
+static char *sccsid = "@(#)sort.c 4.2 (Berkeley) 10/9/80";
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
@@
-176,7
+177,6
@@
char **argv;
char *arg;
struct field *p, *q;
int i;
char *arg;
struct field *p, *q;
int i;
- unsigned pid;
copyproto();
eargv = argv;
copyproto();
eargv = argv;
@@
-260,11
+260,14
@@
char **argv;
exit(1);
}
close(a);
exit(1);
}
close(a);
- signal(SIGHUP, term);
+ unlink(file);
+ if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
+ signal(SIGHUP, term);
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, term);
signal(SIGPIPE,term);
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, term);
signal(SIGPIPE,term);
- signal(SIGTERM,term);
+ if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+ signal(SIGTERM,term);
nfiles = eargc;
if(!mflg && !cflg) {
sort();
nfiles = eargc;
if(!mflg && !cflg) {
sort();
@@
-560,7
+563,7
@@
term()
for(i=eargc; i<=nfiles; i++) { /*<= in case of interrupt*/
unlink(setfil(i)); /*with nfiles not updated*/
}
for(i=eargc; i<=nfiles; i++) { /*<= in case of interrupt*/
unlink(setfil(i)); /*with nfiles not updated*/
}
- exit(error);
+
_
exit(error);
}
cmp(i, j)
}
cmp(i, j)
@@
-591,6
+594,12
@@
char *i, *j;
lb = eol(pb);
}
if(fp->nflg) {
lb = eol(pb);
}
if(fp->nflg) {
+ if(tabchar) {
+ if(pa<la&&*pa==tabchar)
+ pa++;
+ if(pb<lb&&*pb==tabchar)
+ pb++;
+ }
while(blank(*pa))
pa++;
while(blank(*pb))
while(blank(*pa))
pa++;
while(blank(*pb))
@@
-692,7
+701,8
@@
char *pp;
if(*p != '\n')
p++;
else goto ret;
if(*p != '\n')
p++;
else goto ret;
- p++;
+ if(i>0||j==0)
+ p++;
} else {
while(blank(*p))
p++;
} else {
while(blank(*p))
p++;
@@
-702,7
+712,7
@@
char *pp;
else goto ret;
}
}
else goto ret;
}
}
- if(fp->bflg[j])
+ if(
tabchar==0&&
fp->bflg[j])
while(blank(*p))
p++;
i = fp->n[j];
while(blank(*p))
p++;
i = fp->n[j];