diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-30 05:36:19 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-30 05:36:19 +0000 |
commit | e05f8c364b147303329e1254ffd271c59a74ac8c (patch) | |
tree | fb0ec107cc01967aa645fb36f45ddf7fe792fb21 /usr.bin | |
parent | ab026447852af8f27141e98f02890c898f63e6a9 (diff) |
64bit fixes. Some of these are a bit bogus as there were "long"s
meant to be file offsets for fseek(3). However, those values
could never be > an int anyay so it is not a problem.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sort/append.c | 8 | ||||
-rw-r--r-- | usr.bin/sort/extern.h | 18 | ||||
-rw-r--r-- | usr.bin/sort/fields.c | 6 | ||||
-rw-r--r-- | usr.bin/sort/files.c | 18 | ||||
-rw-r--r-- | usr.bin/sort/fsort.c | 20 | ||||
-rw-r--r-- | usr.bin/sort/fsort.h | 4 | ||||
-rw-r--r-- | usr.bin/sort/msort.c | 18 | ||||
-rw-r--r-- | usr.bin/sort/sort.c | 6 | ||||
-rw-r--r-- | usr.bin/sort/sort.h | 4 |
9 files changed, 52 insertions, 50 deletions
diff --git a/usr.bin/sort/append.c b/usr.bin/sort/append.c index 31388c6baa1..055d3e4111d 100644 --- a/usr.bin/sort/append.c +++ b/usr.bin/sort/append.c @@ -1,4 +1,4 @@ -/* $OpenBSD: append.c,v 1.2 1997/06/16 02:21:53 millert Exp $ */ +/* $OpenBSD: append.c,v 1.3 1997/06/30 05:36:15 millert Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)append.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: append.c,v 1.2 1997/06/16 02:21:53 millert Exp $"; +static char rcsid[] = "$OpenBSD: append.c,v 1.3 1997/06/30 05:36:15 millert Exp $"; #endif #endif /* not lint */ @@ -79,7 +79,7 @@ append(keylist, nelem, depth, fp, put, ftbl) register n, odepth; register u_char **cpos, **ppos, **lastkey; register u_char *cend, *pend, *start; - register struct recheader *crec, *prec; + register RECHEADER *crec, *prec; if (*keylist == '\0' && UNIQUE) return; @@ -168,7 +168,7 @@ rd_append(binno, infl0, nfiles, outfp, buffer, bufend) union f_handle infl0; FILE *outfp; { - struct recheader *rec; + RECHEADER *rec; rec = (RECHEADER *) buffer; if (!getnext(binno, infl0, nfiles, (RECHEADER *) buffer, bufend, 0)) { diff --git a/usr.bin/sort/extern.h b/usr.bin/sort/extern.h index 475251cbda5..91776f3cec2 100644 --- a/usr.bin/sort/extern.h +++ b/usr.bin/sort/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.1 1997/01/20 19:39:48 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.2 1997/06/30 05:36:15 millert Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,7 @@ void append __P((u_char **, int, int, FILE *, void (*)(), struct field *)); void concat __P((FILE *, FILE *)); -length_t enterkey __P((struct recheader *, +length_t enterkey __P((RECHEADER *, DBT *, int, struct field *)); void fixit __P((int *, char **)); void fldreset __P((struct field *)); @@ -49,20 +49,20 @@ void fmerge __P((int, union f_handle, int, int (*)(), FILE *, void (*)(), struct field *)); void fsort __P((int, int, union f_handle, int, FILE *, struct field *)); int geteasy __P((int, union f_handle, - int, struct recheader *, u_char *, struct field *)); + int, RECHEADER *, u_char *, struct field *)); int getnext __P((int, union f_handle, - int, struct recheader *, u_char *, struct field *)); + int, RECHEADER *, u_char *, struct field *)); int makekey __P((int, union f_handle, - int, struct recheader *, u_char *, struct field *)); + int, RECHEADER *, u_char *, struct field *)); int makeline __P((int, union f_handle, - int, struct recheader *, u_char *, struct field *)); + int, RECHEADER *, u_char *, struct field *)); void merge __P((int, int, int (*)(), FILE *, void (*)(), struct field *)); void num_init __P((void)); -void onepass __P((u_char **, int, long, long *, u_char *, FILE *)); +void onepass __P((u_char **, int, int, int *, u_char *, FILE *)); int optval __P((int, int)); void order __P((union f_handle, int (*)(), struct field *)); -void putline __P((struct recheader *, FILE *)); -void putrec __P((struct recheader *, FILE *)); +void putline __P((RECHEADER *, FILE *)); +void putrec __P((RECHEADER *, FILE *)); void rd_append __P((int, union f_handle, int, FILE *, u_char *, u_char *)); int seq __P((FILE *, DBT *, DBT *)); int setfield __P((char *, struct field *, int)); diff --git a/usr.bin/sort/fields.c b/usr.bin/sort/fields.c index 812ca00c91b..e7dbf7a9c3d 100644 --- a/usr.bin/sort/fields.c +++ b/usr.bin/sort/fields.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fields.c,v 1.2 1997/06/16 02:21:54 millert Exp $ */ +/* $OpenBSD: fields.c,v 1.3 1997/06/30 05:36:16 millert Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)fields.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: fields.c,v 1.2 1997/06/16 02:21:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: fields.c,v 1.3 1997/06/30 05:36:16 millert Exp $"; #endif #endif /* not lint */ @@ -80,7 +80,7 @@ u_char fnum[NBINS], rnum[NBINS]; */ length_t enterkey(keybuf, line, size, fieldtable) - struct recheader *keybuf; /* pointer to start of key */ + RECHEADER *keybuf; /* pointer to start of key */ DBT *line; int size; struct field fieldtable[]; diff --git a/usr.bin/sort/files.c b/usr.bin/sort/files.c index 2df8f6b0595..35208ff7aee 100644 --- a/usr.bin/sort/files.c +++ b/usr.bin/sort/files.c @@ -1,4 +1,4 @@ -/* $OpenBSD: files.c,v 1.4 1997/06/16 02:21:55 millert Exp $ */ +/* $OpenBSD: files.c,v 1.5 1997/06/30 05:36:16 millert Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)files.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: files.c,v 1.4 1997/06/16 02:21:55 millert Exp $"; +static char rcsid[] = "$OpenBSD: files.c,v 1.5 1997/06/30 05:36:16 millert Exp $"; #endif #endif /* not lint */ @@ -58,13 +58,13 @@ getnext(binno, infl0, nfiles, pos, end, dummy) int binno; union f_handle infl0; int nfiles; - register struct recheader *pos; + register RECHEADER *pos; register u_char *end; struct field *dummy; { register int i; register u_char *hp; - static long nleft = 0; + static int nleft = 0; static int cnt = 0, flag = -1; static u_char maxb = 0; static FILE *fp; @@ -133,7 +133,7 @@ makeline(flno, filelist, nfiles, buffer, bufend, dummy2) int flno; union f_handle filelist; int nfiles; - struct recheader *buffer; + RECHEADER *buffer; u_char *bufend; struct field *dummy2; { @@ -199,7 +199,7 @@ int makekey(flno, filelist, nfiles, buffer, bufend, ftbl) int flno, nfiles; union f_handle filelist; - struct recheader *buffer; + RECHEADER *buffer; u_char *bufend; struct field *ftbl; { @@ -301,7 +301,7 @@ seq(fp, line, key) */ void putrec(rec, fp) - register struct recheader *rec; + register RECHEADER *rec; register FILE *fp; { EWRITE(rec, 1, rec->length + sizeof(TRECHEADER), fp); @@ -312,7 +312,7 @@ putrec(rec, fp) */ void putline(rec, fp) - register struct recheader *rec; + register RECHEADER *rec; register FILE *fp; { EWRITE(rec->data+rec->offset, 1, rec->length - rec->offset, fp); @@ -325,7 +325,7 @@ int geteasy(flno, filelist, nfiles, rec, end, dummy2) int flno, nfiles; union f_handle filelist; - register struct recheader *rec; + register RECHEADER *rec; register u_char *end; struct field *dummy2; { diff --git a/usr.bin/sort/fsort.c b/usr.bin/sort/fsort.c index 9639e737ab6..fb8fe6e5788 100644 --- a/usr.bin/sort/fsort.c +++ b/usr.bin/sort/fsort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsort.c,v 1.4 1997/06/16 02:21:55 millert Exp $ */ +/* $OpenBSD: fsort.c,v 1.5 1997/06/30 05:36:16 millert Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)fsort.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: fsort.c,v 1.4 1997/06/16 02:21:55 millert Exp $"; +static char rcsid[] = "$OpenBSD: fsort.c,v 1.5 1997/06/30 05:36:16 millert Exp $"; #endif #endif /* not lint */ @@ -65,20 +65,21 @@ int PANIC = FSORTMAX; void fsort(binno, depth, infiles, nfiles, outfp, ftbl) - register int binno, depth, nfiles; + register int binno, depth; register union f_handle infiles; + register int nfiles; FILE *outfp; register struct field *ftbl; { register u_char *bufend, **keypos, *tmpbuf; u_char *weights; int ntfiles, mfct = 0, total, i, maxb, lastb, panic = 0; - register int c, nelem; - long sizes [NBINS+1]; + int c, nelem; + int sizes [NBINS+1]; union f_handle tfiles, mstart = {MAXFCT-16}; register int (*get)(int, union f_handle, int, RECHEADER *, u_char *, struct field *); - register struct recheader *crec; + register RECHEADER *crec; struct field tfield[2]; FILE *prevfp, *tailfp[FSORTMAX+1]; @@ -246,11 +247,12 @@ void onepass(a, depth, n, sizes, tr, fp) u_char **a; int depth; - long n, sizes[]; + int n; + int sizes[]; u_char *tr; FILE *fp; { - long tsizes[NBINS+1]; + int tsizes[NBINS+1]; u_char **bin[257], **top[256], ***bp, ***bpmax, ***tp; static histo[256]; int *hp; @@ -284,7 +286,7 @@ onepass(a, depth, n, sizes, tr, fp) n = an - ak; tsizes[c] += n * sizeof(TRECHEADER); /* tell getnext how many elements in this bin, this segment. */ - EWRITE(tsizes+c, sizeof(long), 1, fp); + EWRITE(tsizes+c, sizeof(int), 1, fp); sizes[c] += tsizes[c]; for (; ak < an; ++ak) putrec((RECHEADER *) *ak, fp); diff --git a/usr.bin/sort/fsort.h b/usr.bin/sort/fsort.h index 5c7ba7ebea8..6aec0b19685 100644 --- a/usr.bin/sort/fsort.h +++ b/usr.bin/sort/fsort.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fsort.h,v 1.1 1997/01/20 19:39:51 millert Exp $ */ +/* $OpenBSD: fsort.h,v 1.2 1997/06/30 05:36:17 millert Exp $ */ /*- * Copyright (c) 1993 @@ -57,6 +57,6 @@ struct tempfile { FILE *fp; u_char maxb; u_char lastb; - long max_o; + int max_o; }; extern struct tempfile fstack[MAXFCT]; diff --git a/usr.bin/sort/msort.c b/usr.bin/sort/msort.c index 24f6365a999..5b2e69f3621 100644 --- a/usr.bin/sort/msort.c +++ b/usr.bin/sort/msort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msort.c,v 1.5 1997/06/30 04:24:40 millert Exp $ */ +/* $OpenBSD: msort.c,v 1.6 1997/06/30 05:36:17 millert Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)msort.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: msort.c,v 1.5 1997/06/30 04:24:40 millert Exp $"; +static char rcsid[] = "$OpenBSD: msort.c,v 1.6 1997/06/30 05:36:17 millert Exp $"; #endif #endif /* not lint */ @@ -58,17 +58,17 @@ static char rcsid[] = "$OpenBSD: msort.c,v 1.5 1997/06/30 04:24:40 millert Exp $ typedef struct mfile { u_char *end; short flno; - struct recheader rec[1]; + RECHEADER rec[1]; } MFILE; typedef struct tmfile { u_char *end; short flno; - struct trecheader rec[1]; + TRECHEADER rec[1]; } TMFILE; u_char *wts, *wts1 = 0; struct mfile *cfilebuf; -static int cmp __P((struct recheader *, struct recheader *)); +static int cmp __P((RECHEADER *, RECHEADER *)); static int insert __P((struct mfile **, struct mfile **, int, int)); void @@ -82,7 +82,7 @@ fmerge(binno, files, nfiles, get, outfp, fput, ftbl) { FILE *tout; int i, j, last; - void (*put)(struct recheader *, FILE *); + void (*put)(RECHEADER *, FILE *); extern int geteasy(); struct tempfile *l_fstack; @@ -145,7 +145,7 @@ void merge(infl0, nfiles, get, outfp, put, ftbl) int infl0, nfiles; int (*get)(); - void (*put)(struct recheader *, FILE *); + void (*put)(RECHEADER *, FILE *); FILE *outfp; struct field *ftbl; { @@ -260,7 +260,7 @@ order(infile, get, ftbl) { u_char *end; int c; - struct recheader *crec, *prec, *trec; + RECHEADER *crec, *prec, *trec; if (!SINGL_FLD) linebuf = malloc(MAXLLEN); @@ -294,7 +294,7 @@ order(infile, get, ftbl) static int cmp(rec1, rec2) - struct recheader *rec1, *rec2; + RECHEADER *rec1, *rec2; { register r; register u_char *pos1, *pos2, *end; diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index 5584c09f0a1..5009daea2ff 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sort.c,v 1.5 1997/06/16 02:39:15 millert Exp $ */ +/* $OpenBSD: sort.c,v 1.6 1997/06/30 05:36:18 millert Exp $ */ /*- * Copyright (c) 1993 @@ -46,7 +46,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)sort.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: sort.c,v 1.5 1997/06/16 02:39:15 millert Exp $"; +static char rcsid[] = "$OpenBSD: sort.c,v 1.6 1997/06/30 05:36:18 millert Exp $"; #endif #endif /* not lint */ @@ -101,7 +101,7 @@ main(argc, argv) { int (*get)(); int ch, i, stdinflag = 0, tmp = 0; - char cflag = 0, mflag = 0, nflag = 0; + char cflag = 0, mflag = 0; char *outfile, *outpath = 0; struct field fldtab[ND+2], *ftpos; union f_handle filelist; diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h index acf50fbc4bd..048bfbd9d8f 100644 --- a/usr.bin/sort/sort.h +++ b/usr.bin/sort/sort.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sort.h,v 1.2 1997/06/24 02:37:17 dgregor Exp $ */ +/* $OpenBSD: sort.h,v 1.3 1997/06/30 05:36:18 millert Exp $ */ /*- * Copyright (c) 1993 @@ -84,7 +84,7 @@ /* length of record is currently limited to 2^16 - 1 */ typedef u_short length_t; -#define SALIGN(n) ((n+1) & ~1) +#define SALIGN(n) ((n+(sizeof(length_t)-1)) & ~(sizeof(length_t)-1)) /* a record is a key/line pair starting at rec.data. It has a total length * and an offset to the start of the line half of the pair. |