diff options
author | Eric Blake <ebb9@byu.net> | 2009-06-18 12:25:46 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-06-18 12:25:46 +0300 |
commit | cd76915e1cbdbc0608db830a74c4cc70c372b8df (patch) | |
tree | d220cf746210b1b473a05286a6783018043017da /tests | |
parent | fb45630880343afb95c43fcbbb6883119e4e961a (diff) | |
download | paxutils-cd76915e1cbdbc0608db830a74c4cc70c372b8df.tar.gz |
Avoid undefined ctype usage.
* tests/argcv.c (escaped_length, escape_copy, argcv_string): Pass
correct type to ctype macros.
* tests/genfile.c (print_stat, exec_command): Likewise.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/argcv.c | 9 | ||||
-rw-r--r-- | tests/genfile.c | 10 |
2 files changed, 10 insertions, 9 deletions
diff --git a/tests/argcv.c b/tests/argcv.c index c9f2743..dd6fe6c 100644 --- a/tests/argcv.c +++ b/tests/argcv.c @@ -1,5 +1,6 @@ /* argcv.c - simple functions for parsing input based on whitespace - Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2007, 2009 Free Software + Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -153,7 +154,7 @@ escaped_length (const char *str, int *quote) len += 2; *quote = 1; } - else if (isprint (*str)) + else if (isprint ((unsigned char) *str)) len++; else if (argcv_escape_char (*str) != -1) len += 2; @@ -249,7 +250,7 @@ escape_copy (char *dst, const char *src) *dst++ = '\\'; *dst++ = '"'; } - else if (*src != '\t' && isprint(*src)) + else if (*src != '\t' && isprint ((unsigned char) *src)) *dst++ = *src; else { @@ -368,7 +369,7 @@ argcv_string (int argc, char **argv, char **pstring) buffer[j++] = '"'; } - for (; j > 0 && isspace (buffer[j-1]); j--) + for (; j > 0 && isspace ((unsigned char) buffer[j - 1]); j--) ; buffer[j] = 0; if (pstring) diff --git a/tests/genfile.c b/tests/genfile.c index 1b338bc..3cceb02 100644 --- a/tests/genfile.c +++ b/tests/genfile.c @@ -2,7 +2,7 @@ Print statistics for existing files. Copyright (C) 1995, 1996, 1997, 2001, 2003, 2004, 2005, 2006, 2007, - 2008 Free Software Foundation, Inc. + 2008, 2009 Free Software Foundation, Inc. François Pinard <pinard@iro.umontreal.ca>, 1995. Sergey Poznyakoff <gray@mirddin.farlep.net>, 2004, 2005, 2006, 2007, 2008. @@ -574,7 +574,7 @@ print_stat (const char *name) { mode_t mask = ~0; - if (ispunct (p[4])) + if (ispunct ((unsigned char) p[4])) { char *q; @@ -771,12 +771,12 @@ exec_command (void) while ((p = fgets (buf, sizeof buf, fp))) { - while (*p && !isspace (*p) && *p != ':') + while (*p && !isspace ((unsigned char) *p) && *p != ':') p++; if (*p == ':') { - for (p++; *p && isspace (*p); p++) + for (p++; *p && isspace ((unsigned char) *p); p++) ; if (*p @@ -784,7 +784,7 @@ exec_command (void) { char *end; size_t n = strtoul (p + sizeof CHECKPOINT_TEXT - 1, &end, 10); - if (!(*end && !isspace (*end))) + if (!(*end && !isspace ((unsigned char) *end))) { process_checkpoint (n); continue; |