2 * PaperJam -- Main program
4 * (c) 2018 Martin Mares <mj@ucw.cz>
25 void debug(const char *msg, ...)
31 fprintf(stderr, "%*s", debug_indent, "");
32 vfprintf(stderr, msg, args);
37 void warn(const char *msg, ...)
41 fprintf(stderr, "Warning: ");
42 vfprintf(stderr, msg, args);
47 void die(const char *msg, ...)
51 vfprintf(stderr, msg, args);
57 void err(const char *msg, ...)
62 vsnprintf(buf, sizeof(buf), msg, args);
64 throw paperjam_error(buf);
74 static const struct option long_opts[] = {
75 { "debug", 0, 0, 'd' },
76 { "help", 0, 0, OPT_HELP },
77 { "version", 0, 0, OPT_VERSION },
78 { "bbox", 0, 0, 'b' },
82 static const char short_opts[] = "bd";
86 printf("Usage: paperjam [<options>] <commands> <in> <out>\n\
89 -b, --bbox Recalculate bounding boxes\n\
90 -d, --debug Show debugging messages\n\
97 int main(int argc, char **argv)
100 while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) >= 0)
110 printf("This is paperjam with no version yet.\n"); // FIXME
119 if (optind + 3 != argc)
120 die("Exactly three positional parameters should be given");
123 parse(argv[optind], cmds);
124 in_name = argv[optind+1];
125 out_name = argv[optind+2];