summaryrefslogtreecommitdiff
path: root/src/rgw/rgw_multiparser.cc
blob: 1d34243c443be776d56927fb5f5fd8f44d1fc0aa (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
#include "include/types.h"

#include <string.h>
#include <iostream>

#include "rgw_multi.h"

using namespace std;

#define dout_subsys ceph_subsys_rgw
                                  
int main(int argc, char **argv) {
  RGWMultiXMLParser parser;

  if (!parser.init())
    exit(1);

  char buf[1024];

  for (;;) {
    int done;
    int len;

    len = fread(buf, 1, sizeof(buf), stdin);
    if (ferror(stdin)) {
      fprintf(stderr, "Read error\n");
      exit(-1);
    }
    done = feof(stdin);

    bool result = parser.parse(buf, len, done);
    if (!result) {
      cerr << "failed to parse!" << std::endl;
    }

    if (done)
      break;
  }

  exit(0);
}