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
00016 db_strip  (char *buf)
00017 
00018 {
00019     char *a, *b;
00020 
00021 /* remove leading white space */
00022     for (a = b = buf; *a == ' ' || *a == '\t'; a++)
00023             ;
00024     if (a != b)
00025         while (*b++ = *a++)
00026             ;
00027 /* remove trailing white space */
00028     for (a = buf; *a; a++)
00029             ;
00030     if (a != buf)
00031     {
00032         for (a--; *a == ' ' || *a == '\t'; a--)
00033                 ;
00034         a++;
00035         *a = 0;
00036     }
00037 }

Generated on Sun Apr 6 17:31:38 2008 for GRASS by  doxygen 1.5.5