pith/smkeys.c
/*
 * Remove leading whitespace, trailing whitespace and convert 
 * to lowercase. Also remove slash characters
 *
 * Args: s, -- The string to clean
 *
 * Result: the cleaned string
 */
Remove leading whitespace, trailing whitespace and convert
to lowercase. Also remove slash characters

s, -- The string to clean

the cleaned string
Remove leading whitespace trailing whitespace and convert to lowercase . Also remove slash characters s -- The string to clean the cleaned string
static char *
emailstrclean(char *string)
{
    char *s = string, *sc = NULL, *p = NULL;
    for(; *s; s++){				
	if(!isspace((unsigned char) (*s))){
	    p = NULL;				
	    if(!sc)				
	      sc = string;			
	}
	else if(!p)				
	  p = sc;				
	if(sc && *s!='/' && *s!='\\')		
	  *sc++ = isupper((unsigned char) (*s))
			  ? (unsigned char) tolower((unsigned char) (*s))
			  : (unsigned char) (*s);
    }
    if(p)					
      *p = '\0';				
    else if(!sc)				
      *string = '\0';				
    return(string);
}
static char * emailstrclean ( char * string ) { char * s = string , * sc = NULL , * p = NULL ; for ( ; * s ; s ++ ) { if ( ! isspace ( ( unsigned char ) ( * s ) ) ) { p = NULL ; if ( ! sc ) sc = string ; } else if ( ! p ) p = sc ; if ( sc && * s != ' ' && * s != ' \\ ' ) * sc ++ = isupper ( ( unsigned char ) ( * s ) ) ? ( unsigned char ) tolower ( ( unsigned char ) ( * s ) ) : ( unsigned char ) ( * s ) ; } if ( p ) * p = ' \0 ' ; else if ( ! sc ) * string = ' \0 ' ; return ( string ) ; }
Remove leading whitespace, trailing whitespace and convert
 to lowercase.
Remove leading whitespace trailing whitespace and convert to lowercase .
/* single pass */ /* not start of blanks   */ /* first non-blank? */ /* start copying */ /* it's OK if sc == NULL */ /* start of blanks? */ /* if copying, copy */ /* if ending blanks  */ /* tie off beginning */ /* never saw a non-blank */ /* so tie whole thing off */