From 58c9a4b908c79c0b6183951e7dd68dc69cbf4415 Mon Sep 17 00:00:00 2001 From: Kiyoshi Aman Date: Wed, 5 Jun 2019 06:21:58 -0500 Subject: usr.bin/sort: make buildable with libbsd --- usr.bin/sort/msort.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'usr.bin/sort/msort.c') diff --git a/usr.bin/sort/msort.c b/usr.bin/sort/msort.c index 6cbcf90..fd31278 100644 --- a/usr.bin/sort/msort.c +++ b/usr.bin/sort/msort.c @@ -64,12 +64,9 @@ #include "sort.h" #include "fsort.h" -__RCSID("$NetBSD: msort.c,v 1.31 2016/06/01 02:37:55 kre Exp $"); - #include #include #include -#include /* Subroutines using comparisons: merge sort and check order */ #define DELETE (1) @@ -78,7 +75,7 @@ typedef struct mfile { FILE *fp; get_func_t get; RECHEADER *rec; - u_char *end; + unsigned char *end; } MFILE; static int cmp(RECHEADER *, RECHEADER *); @@ -197,7 +194,7 @@ merge_sort_fstack(FILE *outfp, put_func_t put, struct field *ftbl) { struct mfile *flistb[MERGE_FNUM], **flist = flistb, *cfile; RECHEADER *new_rec; - u_char *new_end; + unsigned char *new_end; void *tmp; int c, i, nfiles; size_t sz; @@ -207,7 +204,7 @@ merge_sort_fstack(FILE *outfp, put_func_t put, struct field *ftbl) cfile = &fstack[i]; if (cfile->rec == NULL) { cfile->rec = allocrec(NULL, DEFLLEN); - cfile->end = (u_char *)cfile->rec + DEFLLEN; + cfile->end = (unsigned char *)cfile->rec + DEFLLEN; } rewind(cfile->fp); @@ -218,9 +215,9 @@ merge_sort_fstack(FILE *outfp, put_func_t put, struct field *ftbl) if (c == BUFFEND) { /* Double buffer size */ - sz = (cfile->end - (u_char *)cfile->rec) * 2; + sz = (cfile->end - (unsigned char *)cfile->rec) * 2; cfile->rec = allocrec(cfile->rec, sz); - cfile->end = (u_char *)cfile->rec + sz; + cfile->end = (unsigned char *)cfile->rec + sz; continue; } @@ -246,7 +243,7 @@ merge_sort_fstack(FILE *outfp, put_func_t put, struct field *ftbl) * list. */ new_rec = allocrec(NULL, DEFLLEN); - new_end = (u_char *)new_rec + DEFLLEN; + new_end = (unsigned char *)new_rec + DEFLLEN; for (;;) { cfile = flist[0]; c = cfile->get(cfile->fp, new_rec, new_end, ftbl); @@ -262,9 +259,9 @@ merge_sort_fstack(FILE *outfp, put_func_t put, struct field *ftbl) } if (c == BUFFEND) { /* Buffer not large enough - double in size */ - sz = (new_end - (u_char *)new_rec) * 2; + sz = (new_end - (unsigned char *)new_rec) * 2; new_rec = allocrec(new_rec, sz); - new_end = (u_char *)new_rec +sz; + new_end = (unsigned char *)new_rec +sz; continue; } @@ -369,7 +366,7 @@ order(struct filelist *filelist, struct field *ftbl, int quiet) { get_func_t get = SINGL_FLD ? makeline : makekey; RECHEADER *crec, *prec, *trec; - u_char *crec_end, *prec_end, *trec_end; + unsigned char *crec_end, *prec_end, *trec_end; FILE *fp; int c; -- cgit v1.2.3-60-g2f50