From: Stephen D. <sd...@us...> - 2005-08-19 05:49:46
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/nsd Modified Files: str.c Log Message: * include/ns.h: * nsd/str.c: Untabify and add attributes. Index: str.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/str.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** str.c 13 Jun 2005 01:55:14 -0000 1.3 --- str.c 19 Aug 2005 05:49:34 -0000 1.4 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 32,36 **** * str.c -- * ! * Functions that deal with strings. */ --- 32,36 ---- * str.c -- * ! * Functions that deal with strings. */ *************** *** 45,56 **** * Ns_StrTrim -- * ! * Trim leading and trailing white space from a string. * * Results: ! * A pointer to the trimmed string, which will be in the original ! * string. * * Side effects: ! * May modify passed-in string. * *---------------------------------------------------------------------- --- 45,56 ---- * Ns_StrTrim -- * ! * Trim leading and trailing white space from a string. * * Results: ! * A pointer to the trimmed string, which will be in the original ! * string. * * Side effects: ! * May modify passed-in string. * *---------------------------------------------------------------------- *************** *** 70,81 **** * Ns_StrTrimLeft -- * ! * Trim leading white space from a string. * * Results: ! * A pointer to the trimmed string, which will be in the ! * original string. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 70,81 ---- * Ns_StrTrimLeft -- * ! * Trim leading white space from a string. * * Results: ! * A pointer to the trimmed string, which will be in the ! * original string. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 85,92 **** Ns_StrTrimLeft(char *string) { ! if (string == NULL) ! return NULL; ! while (isspace(UCHAR(*string))) { ! ++string; } return string; --- 85,92 ---- Ns_StrTrimLeft(char *string) { ! if (string != NULL) { ! while (isspace(UCHAR(*string))) { ! ++string; ! } } return string; *************** *** 100,111 **** * Ns_StrTrimRight -- * ! * Trim trailing white space from a string. * * Results: ! * A pointer to the trimmed string, which will be in the ! * original string. * * Side effects: ! * The string will be modified. * *---------------------------------------------------------------------- --- 100,111 ---- * Ns_StrTrimRight -- * ! * Trim trailing white space from a string. * * Results: ! * A pointer to the trimmed string, which will be in the ! * original string. * * Side effects: ! * The string will be modified. * *---------------------------------------------------------------------- *************** *** 117,128 **** int len; ! if (string == NULL) ! return NULL; ! len = strlen(string); ! while ((--len >= 0) && ! (isspace(UCHAR(string[len])) || ! string[len] == '\n')) { ! ! string[len] = '\0'; } return string; --- 117,127 ---- int len; ! if (string != NULL) { ! len = strlen(string); ! while ((--len >= 0) ! && (isspace(UCHAR(string[len])) ! || string[len] == '\n')) { ! string[len] = '\0'; ! } } return string; *************** *** 135,145 **** * Ns_StrToLower -- * ! * All alph. chars in a string will be made to be lowercase. * * Results: ! * Same string as passed in. * * Side effects: ! * Will modify string. * *---------------------------------------------------------------------- --- 134,144 ---- * Ns_StrToLower -- * ! * All alph. chars in a string will be made to be lowercase. * * Results: ! * Same string as passed in. * * Side effects: ! * Will modify string. * *---------------------------------------------------------------------- *************** *** 167,177 **** * Ns_StrToUpper -- * ! * All alph. chars in a string will be made to be uppercase. * * Results: ! * Same string as pssed in. * * Side effects: ! * Will modify string. * *---------------------------------------------------------------------- --- 166,176 ---- * Ns_StrToUpper -- * ! * All alph. chars in a string will be made to be uppercase. * * Results: ! * Same string as pssed in. * * Side effects: ! * Will modify string. * *---------------------------------------------------------------------- *************** *** 199,211 **** * Ns_Match -- * ! * Compare the beginnings of two strings, case insensitively. ! * The comparison stops when the end of the shorter string is ! * reached. * * Results: ! * NULL if no match, b if match. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 198,210 ---- * Ns_Match -- * ! * Compare the beginnings of two strings, case insensitively. ! * The comparison stops when the end of the shorter string is ! * reached. * * Results: ! * NULL if no match, b if match. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 215,222 **** Ns_Match(char *a, char *b) { if (a != NULL && b != NULL) { while (*a != '\0' && *b != '\0') { - char c1, c2; - c1 = islower(UCHAR(*a)) ? *a : tolower(UCHAR(*a)); c2 = islower(UCHAR(*b)) ? *b : tolower(UCHAR(*b)); --- 214,221 ---- Ns_Match(char *a, char *b) { + char c1, c2; + if (a != NULL && b != NULL) { while (*a != '\0' && *b != '\0') { c1 = islower(UCHAR(*a)) ? *a : tolower(UCHAR(*a)); c2 = islower(UCHAR(*b)) ? *b : tolower(UCHAR(*b)); *************** *** 237,248 **** * Ns_NextWord -- * ! * Return a pointer to first character of the next word in a ! * string; words are separated by white space. * * Results: ! * A string pointer in the original string. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 236,247 ---- * Ns_NextWord -- * ! * Return a pointer to first character of the next word in a ! * string; words are separated by white space. * * Results: ! * A string pointer in the original string. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 265,277 **** *---------------------------------------------------------------------- * ! * Ns_StrCaseStr -- * ! * Search for first substring within string, case insensitive. * * Results: ! * A pointer to where substring starts or NULL. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 264,276 ---- *---------------------------------------------------------------------- * ! * Ns_StrCaseFind -- * ! * Search for first substring within string, case insensitive. * * Results: ! * A pointer to where substring starts or NULL. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 288,297 **** { if (strlen(string) > strlen(substring)) { ! while (*string != '\0') { ! if (Ns_Match(string, substring)) { ! return string; ! } ! ++string; ! } } return NULL; --- 287,296 ---- { if (strlen(string) > strlen(substring)) { ! while (*string != '\0') { ! if (Ns_Match(string, substring)) { ! return string; ! } ! ++string; ! } } return NULL; |