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
Sun version and make install fixes
[unix-history]
/
usr
/
src
/
usr.bin
/
sort
/
sort.c
diff --git
a/usr/src/usr.bin/sort/sort.c
b/usr/src/usr.bin/sort/sort.c
index
e53d5f4
..
5b479f8
100644
(file)
--- a/
usr/src/usr.bin/sort/sort.c
+++ b/
usr/src/usr.bin/sort/sort.c
@@
-1,14
+1,18
@@
-static char *sccsid = "@(#)sort.c 4.
1
(Berkeley) %G%";
+static char *sccsid = "@(#)sort.c 4.
3
(Berkeley) %G%";
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
-#define L
512
+#define L
1024
#define N 7
#define C 20
#define N 7
#define C 20
+#ifdef vax
+#define MEM (64*2048)
+#else
#define MEM (16*2048)
#define MEM (16*2048)
+#endif
#define NF 10
FILE *is, *os;
#define NF 10
FILE *is, *os;
@@
-168,6
+172,8
@@
char *setfil();
char *sbrk();
char *brk();
char *sbrk();
char *brk();
+#define blank(c) ((c) == ' ' || (c) == '\t')
+
main(argc, argv)
char **argv;
{
main(argc, argv)
char **argv;
{
@@
-177,10
+183,7
@@
char **argv;
char *arg;
struct field *p, *q;
int i;
char *arg;
struct field *p, *q;
int i;
- unsigned pid;
- extern char _sobuf[];
- setbuf(stdout, _sobuf);
copyproto();
eargv = argv;
while (--argc > 0) {
copyproto();
eargv = argv;
while (--argc > 0) {
@@
-243,11
+246,13
@@
char **argv;
lspace = (int *)sbrk(0);
while((int)brk(ep) == -1)
ep -= 512;
lspace = (int *)sbrk(0);
while((int)brk(ep) == -1)
ep -= 512;
+#ifndef vax
brk(ep -= 512); /* for recursion */
brk(ep -= 512); /* for recursion */
+#endif
a = ep - (char*)lspace;
nlines = (a-L);
nlines /= (5*(sizeof(char *)/sizeof(char)));
a = ep - (char*)lspace;
nlines = (a-L);
nlines /= (5*(sizeof(char *)/sizeof(char)));
- ntext = nlines
*8
;
+ ntext = nlines
* 4 * (sizeof(char *)/sizeof(char))
;
tspace = (char *)(lspace + nlines);
a = -1;
for(dirs=dirtry; *dirs; dirs++) {
tspace = (char *)(lspace + nlines);
a = -1;
for(dirs=dirtry; *dirs; dirs++) {
@@
-263,11
+268,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();
@@
-563,7
+571,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)
@@
-594,6
+602,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))
@@
-695,7
+709,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++;
@@
-705,7
+720,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];
@@
-813,12
+828,14
@@
char **ppa;
return(n);
}
return(n);
}
+#ifndef blank
blank(c)
{
if(c==' ' || c=='\t')
return(1);
return(0);
}
blank(c)
{
if(c==' ' || c=='\t')
return(1);
return(0);
}
+#endif
#define qsexc(p,q) t= *p;*p= *q;*q=t
#define qstexc(p,q,r) t= *p;*p= *r;*r= *q;*q=t
#define qsexc(p,q) t= *p;*p= *q;*q=t
#define qstexc(p,q,r) t= *p;*p= *r;*r= *q;*q=t