diff options
author | Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com> | 2019-06-05 06:21:58 -0500 |
---|---|---|
committer | Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com> | 2019-06-05 06:21:58 -0500 |
commit | 58c9a4b908c79c0b6183951e7dd68dc69cbf4415 (patch) | |
tree | 1740bfc98bfe3804d10a914e5dc3e237ae169b7f /usr.bin/sort/files.c | |
parent | 0a732af73aa7a2378e6981d3a7443e50fd291d2c (diff) | |
download | userland-58c9a4b908c79c0b6183951e7dd68dc69cbf4415.tar.gz userland-58c9a4b908c79c0b6183951e7dd68dc69cbf4415.tar.bz2 userland-58c9a4b908c79c0b6183951e7dd68dc69cbf4415.tar.xz userland-58c9a4b908c79c0b6183951e7dd68dc69cbf4415.zip |
usr.bin/sort: make buildable with libbsd
Diffstat (limited to 'usr.bin/sort/files.c')
-rw-r--r-- | usr.bin/sort/files.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/usr.bin/sort/files.c b/usr.bin/sort/files.c index 7cb27c5..937a3da 100644 --- a/usr.bin/sort/files.c +++ b/usr.bin/sort/files.c @@ -64,21 +64,19 @@ #include "sort.h" #include "fsort.h" -__RCSID("$NetBSD: files.c,v 1.42 2015/08/05 07:10:03 mrg Exp $"); - #include <string.h> /* Align records in temporary files to avoid misaligned copies */ #define REC_ROUNDUP(n) (((n) + sizeof (long) - 1) & ~(sizeof (long) - 1)) -static ssize_t seq(FILE *, u_char **); +static ssize_t seq(FILE *, unsigned char **); /* * this is called when there is no special key. It's only called * in the first fsort pass. */ -static u_char *opos; +static unsigned char *opos; static size_t osz; void @@ -88,9 +86,9 @@ makeline_copydown(RECHEADER *recbuf) } int -makeline(FILE *fp, RECHEADER *recbuf, u_char *bufend, struct field *dummy2) +makeline(FILE *fp, RECHEADER *recbuf, unsigned char *bufend, struct field *dummy2) { - u_char *pos; + unsigned char *pos; int c; pos = recbuf->data; @@ -141,9 +139,9 @@ makeline(FILE *fp, RECHEADER *recbuf, u_char *bufend, struct field *dummy2) * This generates keys. It's only called in the first fsort pass */ int -makekey(FILE *fp, RECHEADER *recbuf, u_char *bufend, struct field *ftbl) +makekey(FILE *fp, RECHEADER *recbuf, unsigned char *bufend, struct field *ftbl) { - static u_char *line_data; + static unsigned char *line_data; static ssize_t line_size; static int overflow = 0; @@ -171,13 +169,13 @@ makekey(FILE *fp, RECHEADER *recbuf, u_char *bufend, struct field *ftbl) * get a line of input from fp */ static ssize_t -seq(FILE *fp, u_char **line) +seq(FILE *fp, unsigned char **line) { - static u_char *buf; + static unsigned char *buf; static size_t buf_size = DEFLLEN; - u_char *end, *pos; + unsigned char *end, *pos; int c; - u_char *new_buf; + unsigned char *new_buf; if (!buf) { /* one-time initialization */ @@ -254,14 +252,14 @@ putkeydump(const RECHEADER *rec, FILE *fp) * get a record from a temporary file. (Used by merge sort.) */ int -geteasy(FILE *fp, RECHEADER *rec, u_char *end, struct field *dummy2) +geteasy(FILE *fp, RECHEADER *rec, unsigned char *end, struct field *dummy2) { length_t file_len; int i; (void)sizeof (char[offsetof(RECHEADER, length) == 0 ? 1 : -1]); - if ((u_char *)(rec + 1) > end) + if ((unsigned char *)(rec + 1) > end) return (BUFFEND); if (!fread(&rec->length, 1, sizeof rec->length, fp)) { fclose(fp); |