blob: 9c33f7a1e98d5d11c74cbf9771caa7d72df0baed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* field.c
*
* Dave Doolin 12 May, 1995
*
* Turns miscellaneous field separators into just a space separating tokens for
* easy parsing by SSCANF. Eventually, the character separators and
* replacement character will be passed in as strings.
*
*/
#include <stdio.h>
#include <string.h>
#include <strings.h>
#define LINE_BUF 100
void find_comment(char *);
main()
{
char line[LINE_BUF];
char *sep;
int var1, var2;
while (fgets(line, LINE_BUF, stdin))
{
/*
* Check this out: Since SEP is a pointer to type char, when line is
* assigned to sep, really the first address is assigned to sep. LINE
* is the address of the start of the string. In contrast, LINE[0]
* is the first character of the string.
*/
sep = line;
while (sep != 0)
{
sep = strpbrk(line, ";.&:,");
if (sep != 0)
*sep = ' ';
}
fputs(line, stdout);
}
return 0;
}
|