Module Name: src
Committed By: rillig
Date: Fri Aug 27 17:38:57 UTC 2021
Modified Files:
src/usr.bin/sdiff: sdiff.c
Log Message:
sdiff: fix undefined behavior for ctype functions
lint says: warning: argument to 'function from <ctype.h>' must be cast
to 'unsigned char', not to 'int' [342]
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/sdiff/sdiff.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/sdiff/sdiff.c
diff -u src/usr.bin/sdiff/sdiff.c:1.2 src/usr.bin/sdiff/sdiff.c:1.3
--- src/usr.bin/sdiff/sdiff.c:1.2 Mon Apr 13 07:19:55 2009
+++ src/usr.bin/sdiff/sdiff.c Fri Aug 27 17:38:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sdiff.c,v 1.2 2009/04/13 07:19:55 lukem Exp $ */
+/* $NetBSD: sdiff.c,v 1.3 2021/08/27 17:38:57 rillig Exp $ */
/* $OpenBSD: sdiff.c,v 1.20 2006/09/19 05:52:23 otto Exp $ */
/*
@@ -423,7 +423,7 @@ prompt(const char *s1, const char *s2)
const char *p;
/* Skip leading whitespace. */
- for (p = cmd; isspace((int)(*p)); ++p)
+ for (p = cmd; isspace((unsigned char)(*p)); ++p)
;
switch (*p) {
@@ -579,7 +579,7 @@ parsecmd(FILE *diffpipe, FILE *file1, FI
p = line;
/* Go to character after line number. */
- while (isdigit((int)(*p)))
+ while (isdigit((unsigned char)(*p)))
++p;
c = *p;
*p++ = 0;
@@ -592,7 +592,7 @@ parsecmd(FILE *diffpipe, FILE *file1, FI
q = p;
/* Go to character after file2end. */
- while (isdigit((int)(*p)))
+ while (isdigit((unsigned char)(*p)))
++p;
c = *p;
*p++ = 0;
@@ -612,7 +612,7 @@ parsecmd(FILE *diffpipe, FILE *file1, FI
q = p;
/* Go to character after line number. */
- while (isdigit((int)(*p)))
+ while (isdigit((unsigned char)(*p)))
++p;
c = *p;
*p++ = 0;