GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
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
}
lib
gis
squeeze.c
Generated on Sun Sep 9 2012 18:55:35 for GRASS Programmer's Manual by
1.8.1.2