]> mj.ucw.cz Git - paperjam.git/blobdiff - paperjam.cc
Cleaned up debugging messages
[paperjam.git] / paperjam.cc
index 5aa4c6139fd76814a3d6297ced7a339ebd1201eb..f49fd7cc1e96745b94b695ac0510596b19063fab 100644 (file)
 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);
@@ -54,6 +54,16 @@ void die(const char *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 {
@@ -94,7 +104,7 @@ int main(int argc, char **argv)
        recalc_bbox = 1;
        break;
       case 'd':
-       debug_mode++;
+       debug_level++;
        break;
       case OPT_VERSION:
        printf("This is paperjam with no version yet.\n");      // FIXME