3 #include "../csm/csm_all.h" 5 int main(
int argc,
const char * argv[]) {
8 const char*input_filename;
9 const char*output_pattern_op;
12 options_string(ops,
"in", &input_filename,
"stdin",
"input file (JSON)");
13 options_string(ops,
"out", &output_pattern_op,
"./ld_split^02d.json",
"output pattern; printf() pattern, but write '^' instead of '%'");
16 fprintf(stderr,
"%s : splits a JSON file into many files." 17 "\n\nOptions:\n", argv[0]);
25 char output_pattern[256]; strcpy(output_pattern, output_pattern_op);
26 char *f = output_pattern;
32 fputs(output_pattern, stderr);
41 sprintf(filename, output_pattern, count);
46 sm_debug(
"Writing to file (%s) %s\n", output_pattern, filename);
void sm_set_program_name(const char *name)
FILE * open_file_for_writing(const char *filename)
struct option * options_allocate(int n)
const char * json_object_to_json_string(struct json_object *this)
FILE * open_file_for_reading(const char *filename)
void options_print_help(struct option *options, FILE *f)
void sm_debug(const char *msg,...)
void options_string(struct option *, const char *name, const char **p, const char *def_balue, const char *desc)
JO json_read_stream(FILE *f)
int main(int argc, const char *argv[])
int options_parse_args(struct option *ops, int argc, const char *argv[])