summaryrefslogtreecommitdiff
path: root/source3/printing/lpq_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing/lpq_parse.c')
-rw-r--r--source3/printing/lpq_parse.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index addf2d14aa..16b9b09fef 100644
--- a/source3/printing/lpq_parse.c
+++ b/source3/printing/lpq_parse.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "printing.h"
static const char *Months[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Err"};
@@ -1150,3 +1151,23 @@ bool parse_lpq_entry(enum printing_types printing_type,char *line,
return ret;
}
+
+/****************************************************************************
+ Parse a file name from the system spooler to generate a jobid.
+****************************************************************************/
+
+uint32_t print_parse_jobid(const char *fname)
+{
+ int jobid;
+ const char *p = strstr_m(fname,PRINT_SPOOL_PREFIX);
+
+ if (!p) {
+ return (uint32_t)-1;
+ }
+ p += strlen(PRINT_SPOOL_PREFIX);
+ jobid = atoi(p);
+ if (jobid <= 0) {
+ return (uint32_t)-1;
+ }
+ return (uint32_t)jobid;
+}