strip.c

Go to the documentation of this file.
00001 /*******************************************************************
00002  *  G_strip(buf)
00003  *     char *buf         buffer to be worked on
00004  *
00005  *  'buf' is rewritten in place with leading and trailing white
00006  *  space removed.
00007  ******************************************************************/
00008 
00009 int G_strip ( register char *buf)
00010 {
00011     register char *a, *b;
00012 
00013 /* remove leading white space */
00014     for (a = b = buf; *a == ' ' || *a == '\t'; a++)
00015             ;
00016     if (a != b)
00017         while ((*b++ = *a++))
00018             ;
00019 /* remove trailing white space */
00020     for (a = buf; *a; a++)
00021             ;
00022     if (a != buf)
00023     {
00024         for (a--; *a == ' ' || *a == '\t'; a--)
00025                 ;
00026         a++;
00027         *a = 0;
00028     }
00029 
00030     return 0;
00031 }

Generated on Mon Jan 1 19:49:26 2007 for GRASS by  doxygen 1.5.1