summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_multiparser.cc
blob: 46cedee52510da961a34a7f3a81a37c6a37d2112 (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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp

#include <string.h>

#include <iostream>
#include <map>

#include "include/types.h"

#include "rgw_multi.h"

#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);
}