Changeset 8161


Ignore:
Timestamp:
06/19/20 10:35:17 (3 weeks ago)
Author:
paulf
Message:

updated site.c rtrim() function to handle tabs and newlines in removal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libsrc/util/site.c

    r8155 r8161  
    3232 
    3333/************************************************************************** 
    34  * rtrim()  Trim trailing blanks off a string                             * 
     34 * rtrim()  Trim trailing blanks or tabs or newlines off a string         * 
    3535 **************************************************************************/ 
    3636void rtrim( char *str ) 
     
    3939   int i; 
    4040  
    41    for( i=len-1; i>=0; i-- ) if( str[i]==' ') str[i] = '\0'; 
     41   for( i=len-1; i>=0; i-- ) { 
     42      if( str[i]==' ' || str[i]=='\t' || str[i]=='\n' ) { 
     43         str[i] = '\0'; 
     44      } else { 
     45         break; 
     46      } 
     47   } 
    4248   return; 
    4349} 
Note: See TracChangeset for help on using the changeset viewer.