cups raw mode, was Re: [Samba] unlink data file in cups_job_submit

2002-09-21 Thread Paul Janzen

Gerald Carter [EMAIL PROTECTED] writes:
 Looks right to me :-)  Applying it now.  Thanks.  I've been meaning to 
 track this one down.

Thanks!

While we are on the subject... :-)

If I am using native printer drivers on Windows clients, I would like
the raw option to get propagated to CUPS.  Otherwise cups does not
pass the data on to the printer.  (If I enable cups's application/
octet-stream raw-data passthrough feature, both cupsomatic and the
Windows driver add PJL headers and footers, which is not what I want
either.) 

With traditional lpr, you can just add -oraw to the print command
line in smb.conf.  With cups, you don't have that alternative.

The result is that to support both unix printing and native-driver
Windows printing from CUPS, you have to have two logical printers per
physical printer: one (cooked) for Unix clients and one (raw) for
Samba to use.

The attached patch allows you to specify an option string for cups
printers in smb.conf.  So, if you want to use native Windows drivers,
all you need is

cups printer options = raw 

in smb.conf.  You can add any other options that cups and the printer
understand.

--- samba-2.2.5/source/printing/print_cups.c.cups   Thu May  2 18:03:31 2002
+++ samba-2.2.5/source/printing/print_cups.cSat Sep 21 10:35:20 2002
@@ -582,6 +582,8 @@
ipp_t   *request,   /* IPP Request */
*response;  /* IPP Response */
cups_lang_t *language;  /* Default language */
+   cups_option_t   *options; 
+   int num_options;
charuri[HTTP_MAX_URI]; /* printer-uri attribute */
 
 
@@ -639,6 +641,17 @@
 
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, job-name, NULL,
 pjob-jobname);
+   
+  /* 
+   * Add Samba-specific CUPS options 
+   */
+   options = (cups_option_t *)NULL; 
+   num_options = 0;
+
+   num_options = cupsParseOptions(lp_cupsprinteroptions(snum),
+  num_options, options);
+   cupsEncodeOptions(request, num_options, options);
+   cupsFreeOptions(num_options, options);
 
   /*
* Do the request and get back a response...
--- samba-2.2.5/source/param/loadparm.c~Tue Jun 18 18:13:45 2002
+++ samba-2.2.5/source/param/loadparm.c Sat Sep 21 10:27:51 2002
@@ -320,6 +320,7 @@
char *szLpresumecommand;
char *szQueuepausecommand;
char *szQueueresumecommand;
+   char *szCupsPrinterOptions;
char *szPrintername;
char *szPrinterDriver;
char *szPrinterDriverLocation;
@@ -441,6 +442,7 @@
NULL,   /* szLpresumecommand */
NULL,   /* szQueuepausecommand */
NULL,   /* szQueueresumecommand */
+   NULL,   /* szCupsPrinterOptions */
NULL,   /* szPrintername */
NULL,   /* szPrinterDriver - this is set in init_globals() */
NULL,   /* szPrinterDriverLocation */
@@ -911,6 +913,7 @@
{lpresume command, P_STRING, P_LOCAL, sDefault.szLpresumecommand, NULL, 
NULL, FLAG_PRINT | FLAG_GLOBAL},
{queuepause command, P_STRING, P_LOCAL, sDefault.szQueuepausecommand, NULL, 
NULL, FLAG_PRINT | FLAG_GLOBAL},
{queueresume command, P_STRING, P_LOCAL, sDefault.szQueueresumecommand, 
NULL, NULL, FLAG_PRINT | FLAG_GLOBAL},
+   {cups printer options, P_STRING, P_LOCAL, sDefault.szCupsPrinterOptions, 
+NULL, NULL, FLAG_PRINT | FLAG_GLOBAL},
 
{enumports command, P_STRING, P_GLOBAL, Globals.szEnumPortsCommand, NULL, 
NULL, 0},
{addprinter command, P_STRING, P_GLOBAL, Globals.szAddPrinterCommand, NULL, 
NULL, 0},
@@ -1119,6 +1122,7 @@
 {
string_set(sDefault.szPrinterDriver, );
string_set(sDefault.szDriverFile, DRIVERFILE);
+   string_set(sDefault.szCupsPrinterOptions, );
 
/* choose defaults depending on the type of printing */
switch (sDefault.iPrinting)
@@ -1714,6 +1718,7 @@
 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
+FN_LOCAL_STRING(lp_cupsprinteroptions, szCupsPrinterOptions)
 static FN_LOCAL_STRING(_lp_printername, szPrintername)
 FN_LOCAL_STRING(lp_driverfile, szDriverFile)
 FN_LOCAL_STRING(lp_printerdriver, szPrinterDriver)


-- Paul
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba



[Samba] unlink data file in cups_job_submit

2002-09-18 Thread Paul Janzen

With samba-2.2.5, cups-1.1.14, and printcap=cups, I find that I have
to explicitly clean up old print data files in /var/spool/samba with a
cron job.

With a traditional LPR, we use -r to tell lpr to remove the file for
us after the file is spooled.  With cups, we send it over ipp, and I
think we should then unlink the data file ourselves.

Does this seem right?

--- print_cups.c~Thu May  2 18:03:31 2002
+++ print_cups.c Wed Sep 18 13:17:08 2002
 -663,6 +663,9 
 ippErrorString(cupsLastError(;
 
httpClose(http);

+   if (ret == 0)
+   unlink(pjob-filename); 
+   /* else print_job_end will do it for us */ 
return (ret);


-- Paul
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba