From 1f9cfb09f894d310fbba1b28b7f954a55961b679 Mon Sep 17 00:00:00 2001 From: erh Date: Tue, 2 Nov 2004 00:44:00 +0000 Subject: Merge the usedot and ctype-function changes from src. --- pkgtools/pkg_install/files/info/perform.c | 11 ++++++----- pkgtools/pkg_install/files/lib/ftpio.c | 24 ++++++++++++------------ pkgtools/pkg_install/files/lib/str.c | 16 ++++++++-------- 3 files changed, 26 insertions(+), 25 deletions(-) (limited to 'pkgtools/pkg_install') diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c index cd4734e85fc..6f462544562 100644 --- a/pkgtools/pkg_install/files/info/perform.c +++ b/pkgtools/pkg_install/files/info/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.16 2004/08/20 20:09:53 jlam Exp $ */ +/* $NetBSD: perform.c,v 1.17 2004/11/02 00:44:00 erh Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.16 2004/08/20 20:09:53 jlam Exp $"); +__RCSID("$NetBSD: perform.c,v 1.17 2004/11/02 00:44:00 erh Exp $"); #endif #endif @@ -76,7 +76,7 @@ pkg_do(char *pkg) strlcpy(fname, cp, sizeof(fname)); isTMP = TRUE; } - } else if (fexists(pkg) && isfile(pkg)) { + } else if (usedot && fexists(pkg) && isfile(pkg)) { int len; if (*pkg != '/') { @@ -90,7 +90,7 @@ pkg_do(char *pkg) strlcpy(fname, pkg, sizeof(fname)); } cp = fname; - } else { + } else if (usedot) { if ((cp = fileFindByPath(pkg)) != NULL) { strncpy(fname, cp, FILENAME_MAX); } @@ -179,7 +179,8 @@ pkg_do(char *pkg) } /* No match */ - warnx("can't find package `%s' installed or in a file!", pkg); + warnx("can't find package `%s' installed%s!", pkg, + usedot ? " or in a file" : ""); return 1; } if (chdir(log_dir) == FAIL) { diff --git a/pkgtools/pkg_install/files/lib/ftpio.c b/pkgtools/pkg_install/files/lib/ftpio.c index ed81224e5ff..d5817f7f7f1 100644 --- a/pkgtools/pkg_install/files/lib/ftpio.c +++ b/pkgtools/pkg_install/files/lib/ftpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftpio.c,v 1.11 2004/10/31 02:48:12 grant Exp $ */ +/* $NetBSD: ftpio.c,v 1.12 2004/11/02 00:44:00 erh Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -8,7 +8,7 @@ #include #endif #ifndef lint -__RCSID("$NetBSD: ftpio.c,v 1.11 2004/10/31 02:48:12 grant Exp $"); +__RCSID("$NetBSD: ftpio.c,v 1.12 2004/11/02 00:44:00 erh Exp $"); #endif /*- @@ -281,7 +281,7 @@ expect(int fd, const char *str, int *ftprc) fflush(stdout); #endif /* EXPECT_DEBUG */ - if (ftprc && isdigit(buf[match.rm_so+1])) + if (ftprc && isdigit((unsigned char)buf[match.rm_so+1])) *ftprc = atoi(buf+match.rm_so+1); done=1; @@ -937,14 +937,14 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) state = ST_NONE; else if (p == 'a' || p == 'A') state = ST_LTA; - else if (!isspace(p)) + else if (!isspace((unsigned char)p)) state = ST_TAG; break; case ST_LTA: /* in tag -- "') state = ST_NONE; - else if (isspace(p)) + else if (isspace((unsigned char)p)) state = ST_TAGA; else state = ST_TAG; @@ -960,14 +960,14 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) state = ST_NONE; else if (p == 'h' || p == 'H') state = ST_H; - else if (!isspace(p)) + else if (!isspace((unsigned char)p)) state = ST_TAGAX; break; case ST_TAGAX: /* in unknown keyword in a-tag */ if (p == '>') state = ST_NONE; - else if (isspace(p)) + else if (isspace((unsigned char)p)) state = ST_TAGA; break; case ST_H: @@ -976,7 +976,7 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) state = ST_NONE; else if (p == 'r' || p == 'R') state = ST_R; - else if (isspace(p)) + else if (isspace((unsigned char)p)) state = ST_TAGA; else state = ST_TAGAX; @@ -987,7 +987,7 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) state = ST_NONE; else if (p == 'e' || p == 'E') state = ST_E; - else if (isspace(p)) + else if (isspace((unsigned char)p)) state = ST_TAGA; else state = ST_TAGAX; @@ -998,7 +998,7 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) state = ST_NONE; else if (p == 'f' || p == 'F') state = ST_F; - else if (isspace(p)) + else if (isspace((unsigned char)p)) state = ST_TAGA; else state = ST_TAGAX; @@ -1009,7 +1009,7 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) state = ST_NONE; else if (p == '=') state = ST_HREF; - else if (!isspace(p)) + else if (!isspace((unsigned char)p)) state = ST_TAGAX; break; case ST_HREF: @@ -1018,7 +1018,7 @@ http_extract_fn(char *input, char *outbuf, size_t outbuflen) if (p == '>') state = ST_NONE; /* skip spaces before URL */ - else if (!isspace(p)) + else if (!isspace((unsigned char)p)) state = ST_TAGA; break; /* no default case by purpose */ diff --git a/pkgtools/pkg_install/files/lib/str.c b/pkgtools/pkg_install/files/lib/str.c index 0a53862223f..d12a36e905f 100644 --- a/pkgtools/pkg_install/files/lib/str.c +++ b/pkgtools/pkg_install/files/lib/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.7 2003/10/29 23:00:28 jlam Exp $ */ +/* $NetBSD: str.c,v 1.8 2004/11/02 00:44:00 erh Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp"; #else -__RCSID("$NetBSD: str.c,v 1.7 2003/10/29 23:00:28 jlam Exp $"); +__RCSID("$NetBSD: str.c,v 1.8 2004/11/02 00:44:00 erh Exp $"); #endif #endif @@ -109,7 +109,7 @@ void str_lowercase(char *s) { for (; *s; s++) { - *s = tolower(*s); + *s = tolower((unsigned char)*s); } } @@ -210,8 +210,8 @@ mkcomponent(arr_t *ap, char *num) return 0; } ALLOC(int64_t, ap->v, ap->size, ap->c, 62, "mkver", exit(EXIT_FAILURE)); - if (isdigit(*num)) { - for (cp = num, n = 0 ; isdigit(*num) ; num++) { + if (isdigit((unsigned char)*num)) { + for (cp = num, n = 0 ; isdigit((unsigned char)*num) ; num++) { n = (n * 10) + (*num - '0'); } ap->v[ap->c++] = n; @@ -224,15 +224,15 @@ mkcomponent(arr_t *ap, char *num) } } if (strncasecmp(num, "nb", 2) == 0) { - for (cp = num, num += 2, n = 0 ; isdigit(*num) ; num++) { + for (cp = num, num += 2, n = 0 ; isdigit((unsigned char)*num) ; num++) { n = (n * 10) + (*num - '0'); } ap->netbsd = n; return (int)(num - cp); } - if (isalpha(*num)) { + if (isalpha((unsigned char)*num)) { ap->v[ap->c++] = Dot; - cp = strchr(alphas, tolower(*num)); + cp = strchr(alphas, tolower((unsigned char)*num)); ALLOC(int64_t, ap->v, ap->size, ap->c, 62, "mkver", exit(EXIT_FAILURE)); ap->v[ap->c++] = (int64_t)(cp - alphas) + 1; return 1; -- cgit v1.2.3