toupper(), tolower(), isspace(), is..etc..() aren't safe with chars in some

systems, use our own is_...() functions now instead.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2348 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-01-27 20:45:59 +00:00 committed by cras
commit f4897860b5
35 changed files with 112 additions and 95 deletions

View file

@ -17,19 +17,19 @@ static void configLine(poptContext con, char * line) {
if (strncmp(line, con->appName, nameLength)) return;
line += nameLength;
if (!*line || !isspace(*line)) return;
while (*line && isspace(*line)) line++;
if (!*line || !i_isspace(*line)) return;
while (*line && i_isspace(*line)) line++;
entryType = line;
while (!*line || !isspace(*line)) line++;
while (!*line || !i_isspace(*line)) line++;
*line++ = '\0';
while (*line && isspace(*line)) line++;
while (*line && i_isspace(*line)) line++;
if (!*line) return;
opt = line;
while (!*line || !isspace(*line)) line++;
while (!*line || !i_isspace(*line)) line++;
*line++ = '\0';
while (*line && isspace(*line)) line++;
while (*line && i_isspace(*line)) line++;
if (!*line) return;
if (opt[0] == '-' && opt[1] == '-')
@ -92,7 +92,7 @@ int poptReadConfigFile(poptContext con, char * fn) {
case '\n':
*dst = '\0';
dst = buf;
while (*dst && isspace(*dst)) dst++;
while (*dst && i_isspace(*dst)) dst++;
if (*dst && *dst != '#') {
configLine(con, dst);
}

View file

@ -94,15 +94,15 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
helpLength = strlen(help);
while (helpLength > lineLength) {
ch = help + lineLength - 1;
while (ch > help && !isspace(*ch)) ch--;
while (ch > help && !i_isspace(*ch)) ch--;
if (ch == help) break; /* give up */
while (ch > (help + 1) && isspace(*ch)) ch--;
while (ch > (help + 1) && i_isspace(*ch)) ch--;
ch++;
sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
fprintf(f, format, help, " ");
help = ch;
while (isspace(*help) && *help) help++;
while (i_isspace(*help) && *help) help++;
helpLength = strlen(help);
}

View file

@ -45,7 +45,7 @@ int poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
if (*src != quote) *buf++ = '\\';
}
*buf++ = *src;
} else if (isspace(*src)) {
} else if (isspace((int) (unsigned char) *src)) {
if (*argv[argc]) {
buf++, argc++;
if (argc == argvAlloced) {