summaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1998-11-06 22:40:13 +0000
committerchristos <christos@NetBSD.org>1998-11-06 22:40:13 +0000
commitb239b35fe21bc19fd8c574440349afc36e0340db (patch)
treef89ebe58d2e7700b00b44d9eed92701ad337d78e /usr.bin/patch
parent1a67b18deb29f5d55aff0556838a7216171908a8 (diff)
char -> unsigned char
rindex -> strrchr
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/backupfile.c10
-rw-r--r--usr.bin/patch/inp.c10
-rw-r--r--usr.bin/patch/patch.c16
-rw-r--r--usr.bin/patch/pch.c48
-rw-r--r--usr.bin/patch/util.c10
5 files changed, 47 insertions, 47 deletions
diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c
index cd5d4ae1c6c..a8528a2d5fe 100644
--- a/usr.bin/patch/backupfile.c
+++ b/usr.bin/patch/backupfile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: backupfile.c,v 1.5 1998/02/22 13:33:48 christos Exp $ */
+/* $NetBSD: backupfile.c,v 1.6 1998/11/06 22:40:13 christos Exp $ */
/* backupfile.c -- make Emacs style backup file names
Copyright (C) 1990 Free Software Foundation, Inc.
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: backupfile.c,v 1.5 1998/02/22 13:33:48 christos Exp $");
+__RCSID("$NetBSD: backupfile.c,v 1.6 1998/11/06 22:40:13 christos Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: backupfile.c,v 1.5 1998/02/22 13:33:48 christos Exp $");
#ifndef isascii
#define ISDIGIT(c) (isdigit ((unsigned char) (c)))
#else
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
+#define ISDIGIT(c) (isascii (c) && isdigit ((unsigned char)c))
#endif
#if defined (HAVE_UNISTD_H)
@@ -220,7 +220,7 @@ basename (name)
{
char *base;
- base = rindex (name, '/');
+ base = strrchr (name, '/');
return base ? base + 1 : name;
}
@@ -237,7 +237,7 @@ dirname (path)
char *slash;
int length; /* Length of result, not including NUL. */
- slash = rindex (path, '/');
+ slash = strrchr (path, '/');
if (slash == 0)
{
/* File is in the current directory. */
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index 1ca0aa5d155..8b977dc2b4b 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -1,7 +1,7 @@
-/* $NetBSD: inp.c,v 1.4 1998/02/22 13:33:49 christos Exp $ */
+/* $NetBSD: inp.c,v 1.5 1998/11/06 22:40:13 christos Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: inp.c,v 1.4 1998/02/22 13:33:49 christos Exp $");
+__RCSID("$NetBSD: inp.c,v 1.5 1998/11/06 22:40:13 christos Exp $");
#endif /* not lint */
#include "EXTERN.h"
@@ -348,11 +348,11 @@ char *string;
if (revision == Nullch)
return TRUE;
patlen = strlen(revision);
- if (strnEQ(string,revision,patlen) && isspace(string[patlen]))
+ if (strnEQ(string,revision,patlen) && isspace((unsigned char)string[patlen]))
return TRUE;
for (s = string; *s; s++) {
- if (isspace(*s) && strnEQ(s+1, revision, patlen) &&
- isspace(s[patlen+1] )) {
+ if (isspace((unsigned char)*s) && strnEQ(s+1, revision, patlen) &&
+ isspace((unsigned char)s[patlen+1] )) {
return TRUE;
}
}
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index b069a9441b1..5b828478a5e 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: patch.c,v 1.6 1998/02/22 13:33:49 christos Exp $ */
+/* $NetBSD: patch.c,v 1.7 1998/11/06 22:40:13 christos Exp $ */
/* patch - a program to apply diffs to original files
*
@@ -10,7 +10,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: patch.c,v 1.6 1998/02/22 13:33:49 christos Exp $");
+__RCSID("$NetBSD: patch.c,v 1.7 1998/11/06 22:40:13 christos Exp $");
#endif /* not lint */
#include "INTERN.h"
@@ -308,7 +308,7 @@ char **argv;
Strcpy(rejname, outname);
#ifndef FLEXFILENAMES
{
- char *s = rindex(rejname,'/');
+ char *s = strrchr(rejname,'/');
if (!s)
s = rejname;
@@ -498,7 +498,7 @@ get_some_switches()
do_defines = TRUE;
if (!*++s)
s = nextarg();
- if (!isalpha(*s) && '_' != *s)
+ if (!isalpha((unsigned char)*s) && '_' != *s)
fatal1("argument to -D is not an identifier\n");
Sprintf(if_defined, "#ifdef %s\n", s);
Sprintf(not_defined, "#ifndef %s\n", s);
@@ -894,12 +894,12 @@ Reg2 char *b;
Reg3 int len;
{
while (len) {
- if (isspace(*b)) { /* whitespace (or \n) to match? */
- if (!isspace(*a)) /* no corresponding whitespace? */
+ if (isspace((unsigned char)*b)) {/* whitespace (or \n) to match? */
+ if (!isspace((unsigned char)*a))/* no corresponding whitespace? */
return FALSE;
- while (len && isspace(*b) && *b != '\n')
+ while (len && isspace((unsigned char)*b) && *b != '\n')
b++,len--; /* skip pattern whitespace */
- while (isspace(*a) && *a != '\n')
+ while (isspace((unsigned char)*a) && *a != '\n')
a++; /* skip target whitespace */
if (*a == '\n' || *b == '\n')
return (*a == *b); /* should end in sync */
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index 8547b240d3c..24bdf23646b 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,7 +1,7 @@
-/* $NetBSD: pch.c,v 1.5 1998/02/22 13:33:50 christos Exp $ */
+/* $NetBSD: pch.c,v 1.6 1998/11/06 22:40:13 christos Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: pch.c,v 1.5 1998/02/22 13:33:50 christos Exp $");
+__RCSID("$NetBSD: pch.c,v 1.6 1998/11/06 22:40:13 christos Exp $");
#endif /* not lint */
#include "EXTERN.h"
@@ -234,8 +234,8 @@ intuit_diff_type()
else
indent++;
}
- for (t=s; isdigit(*t) || *t == ','; t++) ;
- this_is_a_command = (isdigit(*s) &&
+ for (t=s; isdigit((unsigned char)*t) || *t == ','; t++) ;
+ this_is_a_command = (isdigit((unsigned char)*s) &&
(*t == 'd' || *t == 'c' || *t == 'a') );
if (first_command_line < 0L && this_is_a_command) {
first_command_line = this_line;
@@ -251,9 +251,9 @@ intuit_diff_type()
else if (strnEQ(s, "Index:", 6))
indtmp = savestr(s+6);
else if (strnEQ(s, "Prereq:", 7)) {
- for (t=s+7; isspace(*t); t++) ;
+ for (t=s+7; isspace((unsigned char)*t); t++) ;
revision = savestr(t);
- for (t=revision; *t && !isspace(*t); t++) ;
+ for (t=revision; *t && !isspace((unsigned char)*t); t++) ;
*t = '\0';
if (!*revision) {
free(revision);
@@ -499,15 +499,15 @@ another_hunk()
p_end--;
return FALSE;
}
- for (s=buf; *s && !isdigit(*s); s++) ;
+ for (s=buf; *s && !isdigit((unsigned char)*s); s++) ;
if (!*s)
malformed ();
if (strnEQ(s,"0,0",3))
strcpy(s,s+2);
p_first = (LINENUM) atol(s);
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
if (*s == ',') {
- for (; *s && !isdigit(*s); s++) ;
+ for (; *s && !isdigit((unsigned char)*s); s++) ;
if (!*s)
malformed ();
p_ptrn_lines = ((LINENUM)atol(s)) - p_first + 1;
@@ -565,13 +565,13 @@ another_hunk()
return FALSE;
}
p_char[p_end] = '=';
- for (s=buf; *s && !isdigit(*s); s++) ;
+ for (s=buf; *s && !isdigit((unsigned char)*s); s++) ;
if (!*s)
malformed ();
p_newfirst = (LINENUM) atol(s);
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
if (*s == ',') {
- for (; *s && !isdigit(*s); s++) ;
+ for (; *s && !isdigit((unsigned char)*s); s++) ;
if (!*s)
malformed ();
p_repl_lines = ((LINENUM)atol(s)) - p_newfirst + 1;
@@ -599,7 +599,7 @@ another_hunk()
change_line:
if (buf[1] == '\n' && canonicalize)
strcpy(buf+1," \n");
- if (!isspace(buf[1]) && buf[1] != '>' && buf[1] != '<' &&
+ if (!isspace((unsigned char)buf[1]) && buf[1] != '>' && buf[1] != '<' &&
repl_beginning && repl_could_be_missing) {
repl_missing = TRUE;
goto hunk_done;
@@ -635,7 +635,7 @@ another_hunk()
}
break;
case ' ':
- if (!isspace(buf[1]) &&
+ if (!isspace((unsigned char)buf[1]) &&
repl_beginning && repl_could_be_missing) {
repl_missing = TRUE;
goto hunk_done;
@@ -759,20 +759,20 @@ another_hunk()
if (!*s)
malformed ();
p_first = (LINENUM) atol(s);
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
if (*s == ',') {
p_ptrn_lines = (LINENUM) atol(++s);
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
} else
p_ptrn_lines = 1;
if (*s == ' ') s++;
if (*s != '+' || !*++s)
malformed ();
p_newfirst = (LINENUM) atol(s);
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
if (*s == ',') {
p_repl_lines = (LINENUM) atol(++s);
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
} else
p_repl_lines = 1;
if (*s == ' ') s++;
@@ -894,15 +894,15 @@ another_hunk()
p_context = 0;
ret = pgets(buf, sizeof buf, pfp);
p_input_line++;
- if (ret == Nullch || !isdigit(*buf)) {
+ if (ret == Nullch || !isdigit((unsigned char)*buf)) {
next_intuit_at(line_beginning,p_input_line);
return FALSE;
}
p_first = (LINENUM)atol(buf);
- for (s=buf; isdigit(*s); s++) ;
+ for (s=buf; isdigit((unsigned char)*s); s++) ;
if (*s == ',') {
p_ptrn_lines = (LINENUM)atol(++s) - p_first + 1;
- while (isdigit(*s)) s++;
+ while (isdigit((unsigned char)*s)) s++;
}
else
p_ptrn_lines = (*s != 'a');
@@ -910,7 +910,7 @@ another_hunk()
if (hunk_type == 'a')
p_first++; /* do append rather than insert */
min = (LINENUM)atol(++s);
- for (; isdigit(*s); s++) ;
+ for (; isdigit((unsigned char)*s); s++) ;
if (*s == ',')
max = (LINENUM)atol(++s);
else
@@ -1244,8 +1244,8 @@ do_ed_script()
break;
}
p_input_line++;
- for (t=buf; isdigit(*t) || *t == ','; t++) ;
- this_line_is_command = (isdigit(*buf) &&
+ for (t=buf; isdigit((unsigned char)*t) || *t == ','; t++) ;
+ this_line_is_command = (isdigit((unsigned char)*buf) &&
(*t == 'd' || *t == 'c' || *t == 'a') );
if (this_line_is_command) {
if (!skip_rest_of_patch)
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index 3a7d4a6bb1e..f51c59f93cd 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -1,7 +1,7 @@
-/* $NetBSD: util.c,v 1.5 1998/02/22 13:33:50 christos Exp $ */
+/* $NetBSD: util.c,v 1.6 1998/11/06 22:40:13 christos Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: util.c,v 1.5 1998/02/22 13:33:50 christos Exp $");
+__RCSID("$NetBSD: util.c,v 1.6 1998/11/06 22:40:13 christos Exp $");
#endif /* not lint */
#include "EXTERN.h"
@@ -78,7 +78,7 @@ char *from, *to;
while (stat(bakname, &filestat) == 0 &&
to_device == filestat.st_dev && to_inode == filestat.st_ino) {
/* Skip initial non-lowercase chars. */
- for (s=simplename; *s && !islower(*s); s++) ;
+ for (s=simplename; *s && !islower((unsigned char)*s); s++) ;
if (*s)
*s = toupper(*s);
else
@@ -449,7 +449,7 @@ int assume_exists;
if (!at)
return Nullch;
- while (isspace(*at))
+ while (isspace((unsigned char)*at))
at++;
#ifdef DEBUGGING
if (debug & 128)
@@ -460,7 +460,7 @@ int assume_exists;
name = fullname = t = savestr(at);
/* Strip off up to `sleading' leading slashes and null terminate. */
- for (; *t && !isspace(*t); t++)
+ for (; *t && !isspace((unsigned char)*t); t++)
if (*t == '/')
if (--sleading >= 0)
name = t+1;