From: Curt M. <we...@us...> - 2005-07-29 19:29:31
|
Update of /cvsroot/xastir/xastir/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11263 Modified Files: util.h util.c Log Message: Added a "remove_all_spaces" function. Index: util.h =================================================================== RCS file: /cvsroot/xastir/xastir/src/util.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** util.h 22 Jul 2005 06:08:23 -0000 1.36 --- util.h 29 Jul 2005 19:29:23 -0000 1.37 *************** *** 38,41 **** --- 38,42 ---- extern void destroy_tactical_hash(void); extern void xastir_debug(int my_debug_level, char *debug_string); + extern char *remove_all_spaces(char *data); extern char *remove_leading_spaces(char *data); extern char *remove_trailing_spaces(char *data); Index: util.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/util.c,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** util.c 22 Jul 2005 19:42:55 -0000 1.170 --- util.c 29 Jul 2005 19:29:23 -0000 1.171 *************** *** 321,324 **** --- 321,344 ---- + char *remove_all_spaces(char *data) { + char *ptr; + int length = strlen(data); + + ptr = data; + while ( (ptr = strpbrk(data, " ")) ) { + memmove(ptr, ptr+1, strlen(ptr)+1); + length--; + } + + // Terminate at the new string length + data[length] = '\0'; + + return(data); + } + + + + + char *remove_leading_spaces(char *data) { int i,j; |