strip.c

Go to the documentation of this file.
00001 
00007 /*  db_strip(buf)
00008  *     char *buf         buffer to be worked on
00009  *
00010  *  'buf' is rewritten in place with leading and trailing white
00011  *  space removed.
00012  */
00013 
00014 
00015 void db_strip(char *buf)
00016 {
00017     char *a, *b;
00018 
00019     /* remove leading white space */
00020     for (a = b = buf; *a == ' ' || *a == '\t'; a++) ;
00021     if (a != b)
00022         while ((*b++ = *a++)) ;
00023 
00024     /* remove trailing white space */
00025     for (a = buf; *a; a++) ;
00026     if (a != buf) {
00027         for (a--; *a == ' ' || *a == '\t'; a--) ;
00028         a++;
00029         *a = 0;
00030     }
00031 }
Generated on Tue Apr 6 13:27:22 2010 for GRASS Programmer's Manual by  doxygen 1.6.3