const char *in_name;
const char *out_name;
bool recalc_bbox;
-int debug_mode;
+int debug_level;
int debug_indent;
/*** Messages ***/
void debug(const char *msg, ...)
{
- if (!debug_mode)
+ if (!debug_level)
return;
va_list args;
va_start(args, msg);
exit(1);
}
+void err(const char *msg, ...)
+{
+ va_list args;
+ va_start(args, msg);
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), msg, args);
+ va_end(args);
+ throw paperjam_error(buf);
+}
+
/*** Arguments ***/
enum opt {
-b, --bbox Recalculate bounding boxes\n\
-d, --debug Show debugging messages\n\
\n\
-Commands: (FIXME)\n\
+<command> = <name>(<args>, <named-arg>[=<value>], ...) [<pipeline>]\n\
+<pipeline> = { <stage>, <stage>, ... }\n\
+<stage> = <page> <page> ... [: <commands>]\n\
+\n\
+Commands:\n\
");
parser_help();
}
+static void show_version()
+{
+ printf("PaperJam " VERSION " -- a PDF processor\n");
+ printf("(c) " YEAR " Martin Mares, distributed under GNU GPL 2+\n");
+ printf("Built on " BUILD_DATE " from Git commit " BUILD_COMMIT "\n");
+}
+
int main(int argc, char **argv)
{
int c;
recalc_bbox = 1;
break;
case 'd':
- debug_mode++;
+ debug_level++;
break;
case OPT_VERSION:
- printf("This is paperjam with no version yet.\n"); // FIXME
+ show_version();
return 0;
case OPT_HELP:
usage();