GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
squeeze.c
Go to the documentation of this file.
1 
17 #include <ctype.h>
18 #include <string.h>
19 #include <grass/gis.h>
20 
21 
22 /*
23  * last modification: 12 aug 81, j w hamilton
24  *
25  * 1998-04-04 WBH
26  * Also squeezes out newlines -- easier to use with fgets()
27  *
28  * 1999-19-12 Werner Droege
29  * changed line 37, line 48ff. -- return (strip_NL(line))
30  */
31 
32 
45 char *G_squeeze(char *line)
46 {
47  register char *f = line, *t = line;
48  int l;
49 
50  /* skip over space at the beginning of the line. */
51  while (isspace(*f))
52  f++;
53 
54  while (*f)
55  if (!isspace(*f))
56  *t++ = *f++;
57  else if (*++f)
58  if (!isspace(*f))
59  *t++ = ' ';
60  *t = '\0';
61  l = strlen(line) - 1;
62  if (*(line + l) == '\n')
63  *(line + l) = '\0';
64 
65  return line;
66 }
int l
Definition: dataquad.c:292
char * G_squeeze(char *line)
Remove superfluous white space.
Definition: squeeze.c:45