From 00d64b8d0d2ed0fe239468a610f9ceba706ff7a8 Mon Sep 17 00:00:00 2001 From: skimo Date: Wed, 19 Jul 2000 20:31:58 +0000 Subject: [PATCH] CHAR_T fixups --- common/conv.c | 9 ++++++--- common/screen.c | 4 ++-- common/seq.c | 4 ++-- common/util.c | 12 +++++++++++- ex/ex_argv.c | 4 ++-- vi/vi.h | 4 ++-- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/common/conv.c b/common/conv.c index 57ca7811..1df4590e 100644 --- a/common/conv.c +++ b/common/conv.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: conv.c,v 1.3 2000/07/19 18:32:58 skimo Exp $ (Berkeley) $Date: 2000/07/19 18:32:58 $"; +static const char sccsid[] = "$Id: conv.c,v 1.4 2000/07/19 20:31:58 skimo Exp $ (Berkeley) $Date: 2000/07/19 20:31:58 $"; #endif /* not lint */ #include @@ -127,9 +127,12 @@ CONV gb_conv = { 0, 0, default_char2int, default_int2char, gb2int, int2gb, default_int2disp }; void -conv_init (SCR *sp) +conv_init (SCR *orig, SCR *sp) { - sp->conv = &default_conv; + if (orig != NULL) + sp->conv = orig->conv; + else + sp->conv = &default_conv; } int diff --git a/common/screen.c b/common/screen.c index cad79c38..c030a608 100644 --- a/common/screen.c +++ b/common/screen.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: screen.c,v 10.18 2000/07/14 14:29:17 skimo Exp $ (Berkeley) $Date: 2000/07/14 14:29:17 $"; +static const char sccsid[] = "$Id: screen.c,v 10.19 2000/07/19 20:31:58 skimo Exp $ (Berkeley) $Date: 2000/07/19 20:31:58 $"; #endif /* not lint */ #include @@ -117,7 +117,7 @@ mem: msgq(orig, M_SYSERR, NULL); if (v_screen_copy(orig, sp)) /* Vi. */ goto err; sp->cl_private = 0; /* XXX */ - conv_init(sp); /* XXX */ + conv_init(orig, sp); /* XXX */ *spp = sp; return (0); diff --git a/common/seq.c b/common/seq.c index 4f005f9a..72487f05 100644 --- a/common/seq.c +++ b/common/seq.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: seq.c,v 10.12 2000/07/16 15:37:24 skimo Exp $ (Berkeley) $Date: 2000/07/16 15:37:24 $"; +static const char sccsid[] = "$Id: seq.c,v 10.13 2000/07/19 20:31:58 skimo Exp $ (Berkeley) $Date: 2000/07/19 20:31:58 $"; #endif /* not lint */ #include @@ -121,7 +121,7 @@ mem1: errno = sv_errno; } /* Set the fast lookup bit. */ - if (qp->input[0] < MAX_BIT_SEQ) + if ((UCHAR_T)qp->input[0] < MAX_BIT_SEQ) bit_set(sp->gp->seqb, qp->input[0]); return (0); diff --git a/common/util.c b/common/util.c index 9cde697c..be817d1f 100644 --- a/common/util.c +++ b/common/util.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: util.c,v 10.16 2000/07/16 20:49:29 skimo Exp $ (Berkeley) $Date: 2000/07/16 20:49:29 $"; +static const char sccsid[] = "$Id: util.c,v 10.17 2000/07/19 20:31:58 skimo Exp $ (Berkeley) $Date: 2000/07/19 20:31:58 $"; #endif /* not lint */ #include @@ -176,6 +176,16 @@ v_strlen(const CHAR_T *str) } /* + * PUBLIC: int v_strcmp __P((const CHAR_T *s1, const CHAR_T *s2)) + */ +int +v_strcmp(const CHAR_T *s1, const CHAR_T *s2) +{ + while (*s1 && *s2 && *s1 == *s2) s1++, s2++; + return *s1 - *s2; +} + +/* * nget_uslong -- * Get an unsigned long, checking for overflow. * diff --git a/ex/ex_argv.c b/ex/ex_argv.c index 16cdfcb8..a7eca40f 100644 --- a/ex/ex_argv.c +++ b/ex/ex_argv.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ex_argv.c,v 10.31 2000/07/16 20:49:31 skimo Exp $ (Berkeley) $Date: 2000/07/16 20:49:31 $"; +static const char sccsid[] = "$Id: ex_argv.c,v 10.32 2000/07/19 20:31:58 skimo Exp $ (Berkeley) $Date: 2000/07/19 20:31:58 $"; #endif /* not lint */ #include @@ -620,7 +620,7 @@ static int argv_comp(a, b) const void *a, *b; { - return (strcmp((char *)(*(ARGS **)a)->bp, (char *)(*(ARGS **)b)->bp)); + return (v_strcmp((*(ARGS **)a)->bp, (*(ARGS **)b)->bp)); } /* diff --git a/vi/vi.h b/vi/vi.h index 5c9c0718..64fd7ef0 100644 --- a/vi/vi.h +++ b/vi/vi.h @@ -6,11 +6,11 @@ * * See the LICENSE file for redistribution information. * - * $Id: vi.h,v 10.25 2000/07/19 19:01:59 skimo Exp $ (Berkeley) $Date: 2000/07/19 19:01:59 $ + * $Id: vi.h,v 10.26 2000/07/19 20:31:59 skimo Exp $ (Berkeley) $Date: 2000/07/19 20:31:59 $ */ /* Definition of a vi "word". */ -#define inword(ch) (ch <= 255 && (isalnum(ch) || (ch) == '_')) +#define inword(ch) ((UCHAR_T)ch <= 255 && (isalnum(ch) || (ch) == '_')) typedef struct _vikeys VIKEYS; -- 2.11.4.GIT