From 010b287963709b666d9b1e7220f9077c20f4d304 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 15 Apr 2004 20:40:26 +0000 Subject: [PATCH] r242: adding 'cups options' parameter to allow raw printing without changing /etc/cups/cupsd.conf -- documentation to follow --- source/include/smb.h | 2 +- source/param/loadparm.c | 4 ++++ source/printing/print_cups.c | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/source/include/smb.h b/source/include/smb.h index 7ed284896df..aab61deaabb 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -539,7 +539,7 @@ enum {LPQ_QUEUED=0,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING,LPQ_ERROR,LPQ_DELETING, typedef struct _print_queue_struct { - int job; /* normally the SMB jobid -- see note in + int job; /* normally the UNIX jobid -- see note in printing.c:traverse_fn_delete() */ int size; int page_count; diff --git a/source/param/loadparm.c b/source/param/loadparm.c index 061af12494a..edd1bc0be78 100644 --- a/source/param/loadparm.c +++ b/source/param/loadparm.c @@ -315,6 +315,7 @@ typedef struct char *szPostExec; char *szRootPreExec; char *szRootPostExec; + char *szCupsOptions; char *szPrintcommand; char *szLpqcommand; char *szLprmcommand; @@ -438,6 +439,7 @@ static service sDefault = { NULL, /* szPostExec */ NULL, /* szRootPreExec */ NULL, /* szRootPostExec */ + NULL, /* szCupsOptions */ NULL, /* szPrintcommand */ NULL, /* szLpqcommand */ NULL, /* szLprmcommand */ @@ -952,6 +954,7 @@ static struct parm_struct parm_table[] = { {"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, {"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_HIDE}, {"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, handle_printing, enum_printing, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, + {"cups options", P_STRING, P_LOCAL, &sDefault.szCupsOptions, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, {"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, {"disable spoolss", P_BOOL, P_GLOBAL, &Globals.bDisableSpoolss, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, {"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, @@ -1800,6 +1803,7 @@ FN_LOCAL_STRING(lp_username, szUsername) FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers) FN_LOCAL_LIST(lp_valid_users, szValidUsers) FN_LOCAL_LIST(lp_admin_users, szAdminUsers) +FN_LOCAL_STRING(lp_cups_options, szCupsOptions) FN_LOCAL_STRING(lp_printcommand, szPrintcommand) FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand) FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand) diff --git a/source/printing/print_cups.c b/source/printing/print_cups.c index f0096a17c2c..9a48296543d 100644 --- a/source/printing/print_cups.c +++ b/source/printing/print_cups.c @@ -683,6 +683,8 @@ cups_job_submit(int snum, struct printjob *pjob) char uri[HTTP_MAX_URI]; /* printer-uri attribute */ char *clientname; /* hostname of client for job-originating-host attribute */ pstring new_jobname; + int num_options = 0; + cups_option_t *options; DEBUG(5,("cups_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob)); @@ -751,6 +753,17 @@ cups_job_submit(int snum, struct printjob *pjob) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, new_jobname); + /* + * add any options defined in smb.conf + */ + + num_options = 0; + options = NULL; + num_options = cupsParseOptions(lp_cups_options(snum), num_options, &options); + + if ( num_options ) + cupsEncodeOptions(request, num_options, options); + /* * Do the request and get back a response... */ @@ -782,7 +795,6 @@ cups_job_submit(int snum, struct printjob *pjob) return (ret); } - /* * 'cups_queue_get()' - Get all the jobs in the print queue. */ -- 2.11.4.GIT