blob: ab1d53c8211c8ade250bdace2068cde2b903343e (
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
|
// toy driver
// Copyright 2005 Red Hat Inc.
// GPL
#include "staptree.h"
#include "parse.h"
#include <iostream>
int main (int argc, char *argv [])
{
int rc = 0;
if (argc > 1)
{
// quietly parse all listed input files
for (int i = 1; i < argc; i ++)
{
parser p (argv[i]);
stapfile* f = p.parse ();
if (f)
cout << "file '" << argv[i] << "' parsed ok." << endl;
else
rc = 1;
}
}
else
{
// parse then print just stdin
parser p (cin);
stapfile* f = p.parse ();
if (f)
f->print (cout);
else
rc = 1;
}
return rc;
}
|