summaryrefslogtreecommitdiff
path: root/usr.bin/sort/fields.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/sort/fields.c')
-rw-r--r--usr.bin/sort/fields.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/usr.bin/sort/fields.c b/usr.bin/sort/fields.c
index 6208a78..29b7682 100644
--- a/usr.bin/sort/fields.c
+++ b/usr.bin/sort/fields.c
@@ -65,8 +65,6 @@
#include "sort.h"
-__RCSID("$NetBSD: fields.c,v 1.33 2013/01/20 10:12:58 apb Exp $");
-
#define SKIP_BLANKS(ptr) { \
if (BLANK & d_mask[*(ptr)]) \
while (BLANK & d_mask[*(++(ptr))]); \
@@ -78,9 +76,9 @@ __RCSID("$NetBSD: fields.c,v 1.33 2013/01/20 10:12:58 apb Exp $");
while ((*(pos+1) != '\0') && !((FLD_D | REC_D_F) & l_d_mask[*++pos]));\
}
-static u_char *enterfield(u_char *, const u_char *, struct field *, int);
-static u_char *number(u_char *, const u_char *, u_char *, u_char *, int);
-static u_char *length(u_char *, const u_char *, u_char *, u_char *, int);
+static unsigned char *enterfield(unsigned char *, const unsigned char *, struct field *, int);
+static unsigned char *number(unsigned char *, const unsigned char *, unsigned char *, unsigned char *, int);
+static unsigned char *length(unsigned char *, const unsigned char *, unsigned char *, unsigned char *, int);
#define DECIMAL_POINT '.'
@@ -89,15 +87,15 @@ static u_char *length(u_char *, const u_char *, u_char *, u_char *, int);
* followed by the original line.
*/
length_t
-enterkey(RECHEADER *keybuf, const u_char *keybuf_end, u_char *line_data,
+enterkey(RECHEADER *keybuf, const unsigned char *keybuf_end, unsigned char *line_data,
size_t line_size, struct field fieldtable[])
/* keybuf: pointer to start of key */
{
int i;
- u_char *l_d_mask;
- u_char *lineend, *pos;
- const u_char *endkey;
- u_char *keypos;
+ unsigned char *l_d_mask;
+ unsigned char *lineend, *pos;
+ const unsigned char *endkey;
+ unsigned char *keypos;
struct coldesc *clpos;
int col = 1;
struct field *ftpos;
@@ -170,13 +168,13 @@ enterkey(RECHEADER *keybuf, const u_char *keybuf_end, u_char *line_data,
/*
* constructs a field (as defined by -k) within a key
*/
-static u_char *
-enterfield(u_char *tablepos, const u_char *endkey, struct field *cur_fld,
+static unsigned char *
+enterfield(unsigned char *tablepos, const unsigned char *endkey, struct field *cur_fld,
int gflags)
{
- u_char *start, *end, *lineend, *mask, *lweight;
+ unsigned char *start, *end, *lineend, *mask, *lweight;
struct column icol, tcol;
- u_int flags;
+ unsigned int flags;
icol = cur_fld->icol;
tcol = cur_fld->tcol;
@@ -247,17 +245,17 @@ enterfield(u_char *tablepos, const u_char *endkey, struct field *cur_fld,
*/
#define MAX_EXP_ENC ((int)sizeof(int))
-static u_char *
-number(u_char *pos, const u_char *bufend, u_char *line, u_char *lineend,
+static unsigned char *
+number(unsigned char *pos, const unsigned char *bufend, unsigned char *line, unsigned char *lineend,
int reverse)
{
int exponent = -1;
int had_dp = 0;
- u_char *tline;
+ unsigned char *tline;
char ch;
unsigned int val;
- u_char *last_nz_pos;
- u_char negate;
+ unsigned char *last_nz_pos;
+ unsigned char negate;
if (reverse & R)
negate = 0xff;
@@ -368,11 +366,11 @@ number(u_char *pos, const u_char *bufend, u_char *line, u_char *lineend,
return (last_nz_pos);
}
-static u_char *
-length(u_char *pos, const u_char *bufend, u_char *line, u_char *lineend,
+static unsigned char *
+length(unsigned char *pos, const unsigned char *bufend, unsigned char *line, unsigned char *lineend,
int flag)
{
- u_char buf[32];
+ unsigned char buf[32];
int l;
SKIP_BLANKS(line);
l = snprintf((char *)buf, sizeof(buf), "%td", lineend - line);