-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRSSParser.c
More file actions
61 lines (53 loc) · 813 Bytes
/
RSSParser.c
File metadata and controls
61 lines (53 loc) · 813 Bytes
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
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#define SEARCHINGFORITEM 0
#define SEARCHINGFORTITLE 1
#define PRINTINGTITLE 2
int main(int argc, char *argv[])
{
int c;
int state = SEARCHINGFORITEM;
while ((c = getchar()) !=-1)
{
if (c == '<')
{
if (state == PRINTINGTITLE)
{
state = SEARCHINGFORITEM;
putchar('\n');
}
else
{
c = getchar();
if (c == 'i')
{
state = SEARCHINGFORTITLE;
while ((c = getchar()) != '<')
{
//looking for next < character
}
if (c == '<')
{
c = getchar();
if (c == 't')
{
int i;
i = 0;
for(i = 0; i < 5; i++)
{
getchar();
}
state = PRINTINGTITLE;
}
}
}
}
}
else
{
if (state == PRINTINGTITLE)
{
putchar(c);
}
}
}
}