From 38ecd1804b3c2f1854f50bc428daedcaceb8b613 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Fri, 10 Jun 2016 23:26:10 +0200
Subject: [PATCH] Translate command-line arguments passed by CUPS to fake PJL
 options

---
 xcpt.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/xcpt.c b/xcpt.c
index fad78da..deca8dd 100644
--- a/xcpt.c
+++ b/xcpt.c
@@ -70,6 +70,10 @@ static char *xstrdup(const char *x)
 /*** Options ***/
 
 #define OPTIONS \
+	O(JOB_ID, "?") \
+	O(USERNAME, "?") \
+	O(JOB_TITLE, "?") \
+	O(COPIES, "1") \
 	O(LANGUAGE, "?") \
 	O(MEDIASIZE, "A4")
 
@@ -227,15 +231,17 @@ static void parse_pjl(void)
     }
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
   if (argc < 5)
     {
       fprintf(stderr, "Usage: xcpt <job> <user> <title> <num-copies> [<options>]\n");
       return 1;
     }
-
-  (void) argv; // FIXME
+  set_option("JOB_ID", argv[1]);
+  set_option("USERNAME", argv[2]);
+  set_option("JOB_TITLE", argv[3]);
+  set_option("COPIES", argv[4]);
 
   parse_pjl();
 
-- 
GitLab