CHANGES IN CUPS V1.3.9
- Documentation updates (STR #2904)
+ - The PPD parser was too strict about missing keyword
+ values in "relaxed" mode.
+ - The PostScript filter incorrectly mirrored landscape
+ documents.
- The scheduler did not correctly update the
auth-info-required value(s) if the AuthType was Default.
- The scheduler required Kerberos authentication for
-CHANGES.txt - 2008-08-28
+CHANGES.txt - 2008-09-03
------------------------
CHANGES IN CUPS V1.4b1
+ - The scheduler now supports a DefaultPaperSize directive
+ (STR #2848)
+ - The scheduler now passes the job-originating-host-name
+ value to filters in the options argument (STR #2558)
+ - CUPS now supports job tickets in PDF files (STR #2903)
+ - Added a DBUS notifier (STR #2529)
+ - The LPD mini-daemon now passes the document name when queuing
+ print jobs (STR #2482)
+ - The IPP backend did not relay com.apple.print.recoverable-message
+ values.
- The scheduler now supports a job-media-progress attribute to
track the progress of individual pages.
- The sample HP driver now supports A5 (STR #2798)
CUPSDLIBS = @CUPSDLIBS@
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
+DBUS_NOTIFIER = @DBUS_NOTIFIER@
+DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
+DNSSD_BACKEND = @DNSSD_BACKEND@
DSOFLAGS = -L../cups @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
DNSSDLIBS = @DNSSDLIBS@
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(COMMONLIBS)
-MDNS = @MDNS@
OPTIM = @OPTIM@
OPTIONS =
PAMLIBS = @PAMLIBS@
$(RM) man/cupsd.conf.man man/lpoptions.man
$(RM) packaging/cups.list
$(RM) templates/header.tmpl
+ $(RM) desktop/cups.desktop
+ $(RM) init/cups.xml
-$(RM) doc/*/index.html
-$(RM) templates/*/header.tmpl
-$(RM) -r autom4te*.cache
.PHONY: clang
clang:
- if test ! -d clang; then \
- mkdir clang; \
- else \
- rm -rf clang/*; \
- fi
- $(MAKE) $(MFLAGS) CC="scan-build -o ../clang $(CC)" \
- CXX="scan-build -o ../clang $(CXX)" clean all
- test `ls -1 clang | wc -l` = 0
+ $(RM) -r clang
+ scan-build -k -o `pwd`/clang $(MAKE) $(MFLAGS) \
+ CC=ccc-analyzer CXX=ccc-analyzer clean all
#
include ../Makedefs
-RBACKENDS = ipp lpd $(MDNS)
+RBACKENDS = ipp lpd $(DNSSD_BACKEND)
UBACKENDS = $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
TARGETS = test1284 testbackend testsupplies \
libbackend.a $(RBACKENDS) $(UBACKENDS)
LIBOBJS = ieee1284.o network.o runloop.o snmp-supplies.o
-OBJS = ipp.o lpd.o mdns.o pap.o parallel.o scsi.o serial.o snmp.o \
+OBJS = ipp.o lpd.o dnssd.o pap.o parallel.o scsi.o serial.o snmp.o \
socket.o test1284.o testbackend.o testsupplies.o usb.o
#
clean:
- $(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http
+ $(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http mdns
#
$(RANLIB) $@
+#
+# dnssd
+#
+
+dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
+ $(RM) mdns
+ $(LN) dnssd mdns
+
+
#
# ipp
#
$(CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
-#
-# mdns
-#
-
-mdns: mdns.o ../cups/$(LIBCUPS) libbackend.a
- echo Linking $@...
- $(CC) $(LDFLAGS) -o mdns mdns.o libbackend.a $(LIBS)
-
-
#
# pap
#
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
+ const char *name; /* Backend name */
DNSServiceRef main_ref, /* Main service reference */
fax_ipp_ref, /* IPP fax service reference */
ipp_ref, /* IPP service reference */
exec_backend(argv);
else if (argc != 1)
{
- fputs("Usage: mdns job user title copies options [filename(s)]\n", stderr);
+ fprintf(stderr, "Usage: %s job user title copies options [filename(s)]\n",
+ argv[0]);
return (1);
}
+ /*
+ * Only do discovery when run as "dnssd"...
+ */
+
+ if ((name = strrchr(argv[0], '/')) != NULL)
+ name ++;
+ else
+ name = argv[0];
+
+ if (strcmp(name, "dnssd"))
+ return (0);
+
/*
* Create an array to track devices...
*/
int version; /* IPP version */
static const char * const pattrs[] =
{ /* Printer attributes we want */
+ "com.apple.print.recoverable-message",
"copies-supported",
"document-format-supported",
"marker-colors",
*response; /* IPP response */
static const char * const attrs[] = /* Attributes we want */
{
+ "com.apple.print.recoverable-message",
"marker-colors",
"marker-levels",
"marker-message",
{
int i; /* Looping var */
int count; /* Count of reasons shown... */
- ipp_attribute_t *psm, /* printer-state-message */
+ ipp_attribute_t *caprm, /* com.apple.print.recoverable-message */
+ *psm, /* printer-state-message */
*reasons, /* printer-state-reasons */
*marker; /* marker-* attributes */
const char *reason; /* Current reason */
const char *prefix; /* Prefix for STATE: line */
char state[1024]; /* State string */
cups_lang_t *language; /* Current localization */
+ int saw_caprw; /* Saw com.apple.print.recoverable-warning state */
if ((psm = ippFindAttribute(ipp, "printer-state-message",
IPP_TAG_KEYWORD)) == NULL)
return (0);
- state[0] = '\0';
- prefix = "STATE: ";
- language = cupsLangDefault();
+ saw_caprw = 0;
+ state[0] = '\0';
+ prefix = "STATE: ";
+ language = cupsLangDefault();
for (i = 0, count = 0; i < reasons->num_values; i ++)
{
message = _("Developer almost empty.");
else if (!strncmp(reason, "developer-empty", 15))
message = _("Developer empty!");
+ else if (!strcmp(reason, "com.apple.print.recoverable-warning"))
+ saw_caprw = 1;
else if (strstr(reason, "error") != NULL)
{
message = unknown;
fprintf(stderr, "%s\n", state);
+ /*
+ * Relay com.apple.print.recoverable-message...
+ */
+
+ if ((caprm = ippFindAttribute(ipp, "com.apple.print.recoverable-message",
+ IPP_TAG_TEXT)) != NULL)
+ fprintf(stderr, "WARNING: %s: %s\n",
+ saw_caprw ? "recoverable" : "recovered",
+ caprm->values[0].string.text);
+
/*
* Relay the current marker-* attribute values...
*/
if (errno == ENXIO && offline != 1)
{
- fputs("STATE: +offline-error\n", stderr);
+ fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
offline = 1;
}
{
if (paperout != 1)
{
- fputs("STATE: +media-empty-error\n", stderr);
+ fputs("STATE: +media-empty-warning\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Out of paper!\n"));
paperout = 1;
}
{
if (offline != 1)
{
- fputs("STATE: +offline-error\n", stderr);
+ fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
offline = 1;
}
{
if (paperout)
{
- fputs("STATE: -media-empty-error\n", stderr);
+ fputs("STATE: -media-empty-warning\n", stderr);
paperout = 0;
}
if (offline)
{
- fputs("STATE: -offline-error\n", stderr);
+ fputs("STATE: -offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
offline = 0;
}
(packet.object_value.string[1] & 255);
if (i & CUPS_TC_lowPaper)
- fputs("STATE: +media-low-warning\n", stderr);
+ fputs("STATE: +media-low-report\n", stderr);
else
- fputs("STATE: -media-low-warning\n", stderr);
+ fputs("STATE: -media-low-report\n", stderr);
if (i & (CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty))
- fputs("STATE: +media-empty-error\n", stderr);
+ fputs("STATE: +media-empty-warning\n", stderr);
else
- fputs("STATE: -media-empty-error\n", stderr);
+ fputs("STATE: -media-empty-warning\n", stderr);
if (i & CUPS_TC_lowToner)
- fputs("STATE: +toner-low-warning\n", stderr);
+ fputs("STATE: +toner-low-report\n", stderr);
else
- fputs("STATE: -toner-low-warning\n", stderr);
+ fputs("STATE: -toner-low-report\n", stderr);
if (i & CUPS_TC_noToner)
- fputs("STATE: +toner-empty-error\n", stderr);
+ fputs("STATE: +toner-empty-warning\n", stderr);
else
- fputs("STATE: -toner-empty-error\n", stderr);
+ fputs("STATE: -toner-empty-warning\n", stderr);
if (i & CUPS_TC_doorOpen)
fputs("STATE: +door-open-report\n", stderr);
fputs("STATE: -door-open-report\n", stderr);
if (i & CUPS_TC_jammed)
- fputs("STATE: +media-jam-error\n", stderr);
+ fputs("STATE: +media-jam-warning\n", stderr);
else
- fputs("STATE: -media-jam-error\n", stderr);
+ fputs("STATE: -media-jam-warning\n", stderr);
if (i & CUPS_TC_offline)
fputs("STATE: +offline-report\n", stderr);
fputs("STATE: -offline-report\n", stderr);
if (i & (CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint))
- fputs("STATE: +service-needed-error\n", stderr);
+ fputs("STATE: +service-needed-warning\n", stderr);
else
- fputs("STATE: -service-needed-error\n", stderr);
+ fputs("STATE: -service-needed-warning\n", stderr);
if (i & CUPS_TC_inputTrayMissing)
- fputs("STATE: +input-tray-missing-error\n", stderr);
+ fputs("STATE: +input-tray-missing-warning\n", stderr);
else
- fputs("STATE: -input-tray-missing-error\n", stderr);
+ fputs("STATE: -input-tray-missing-warning\n", stderr);
if (i & CUPS_TC_outputTrayMissing)
- fputs("STATE: +output-tray-missing-error\n", stderr);
+ fputs("STATE: +output-tray-missing-warning\n", stderr);
else
- fputs("STATE: -output-tray-missing-error\n", stderr);
+ fputs("STATE: -output-tray-missing-warning\n", stderr);
if (i & CUPS_TC_markerSupplyMissing)
- fputs("STATE: +marker-supply-missing-error\n", stderr);
+ fputs("STATE: +marker-supply-missing-warning\n", stderr);
else
- fputs("STATE: -marker-supply-missing-error\n", stderr);
+ fputs("STATE: -marker-supply-missing-warning\n", stderr);
if (i & CUPS_TC_outputNearFull)
- fputs("STATE: +output-area-almost-full-warning\n", stderr);
+ fputs("STATE: +output-area-almost-full-report\n", stderr);
else
- fputs("STATE: -output-area-almost-full-warning\n", stderr);
+ fputs("STATE: -output-area-almost-full-report\n", stderr);
if (i & CUPS_TC_outputFull)
- fputs("STATE: +output-area-full-error\n", stderr);
+ fputs("STATE: +output-area-full-warning\n", stderr);
else
- fputs("STATE: -output-area-full-error\n", stderr);
+ fputs("STATE: -output-area-full-warning\n", stderr);
/*
* Get the current printer state...
if (!keepLooking && g.status_timer != NULL)
{
- fputs("STATE: -offline-error\n", stderr);
+ fputs("STATE: -offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
CFRelease(g.status_timer);
static void status_timer_cb(CFRunLoopTimerRef timer,
void *info)
{
- fputs("STATE: +offline-error\n", stderr);
+ fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is offline.\n"));
if (getenv("CLASS") != NULL)
* Get the name, location, and description for a new printer...
*/
+#ifdef __APPLE__
+ if (!strncmp(var, "usb:", 4))
+ cgiSetVariable("printer_is_shared", "1");
+ else
+#endif /* __APPLE__ */
+ cgiSetVariable("printer_is_shared", "0");
+
cgiCopyTemplateLang("add-printer.tmpl");
}
* ppd-name
* device-uri
* printer-is-accepting-jobs
+ * printer-is-shared
* printer-state
*/
ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-accepting-jobs", 1);
+ var = cgiGetVariable("printer_is_shared");
+ ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-shared",
+ var && (!strcmp(var, "1") || !strcmp(var, "on")));
+
ippAddInteger(request, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state",
IPP_PRINTER_IDLE);
# Set the authenticated printer/job policies...
<Policy authenticated>
# Job-related operations must be done by the owner or an administrator...
+ <Limit Create-Job Print-Job Print-URI>
+ AuthType Default
+ Order deny,allow
+ </Limit>
+
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
DBUSDIR="$withval")
+DBUS_NOTIFIER=""
+DBUS_NOTIFIERLIBS=""
+
if test "x$enable_dbus" != xno; then
AC_PATH_PROG(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" != x; then
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
AC_CHECK_LIB(dbus-1,
- dbus_message_iter_init_append,
- AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
- `$PKGCONFIG --libs dbus-1`)
+ dbus_message_iter_init_append,
+ AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
+ `$PKGCONFIG --libs dbus-1`)
+ if $PKGCONFIG --exists glib-2.0 && $PKGCONFIG --exists dbus-glib-1; then
+ DBUS_NOTIFIER="dbus"
+ DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs glib-2.0` `$PKGCONFIG --libs dbus-glib-1` `$PKGCONFIG --libs dbus-1`"
+ CFLAGS="$CFLAGS `$PKGCONFIG --cflags glib-2.0`"
+ fi
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(DBUSDIR)
+AC_SUBST(DBUS_NOTIFIER)
+AC_SUBST(DBUS_NOTIFIERLIBS)
dnl Extra platform-specific libraries...
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
CPPFLAGS="-I$withval $CPPFLAGS",)
DNSSDLIBS=""
-MDNS=""
+DNSSD_BACKEND=""
if test x$enable_dnssd != xno; then
AC_CHECK_HEADER(dns_sd.h, [
AC_DEFINE(HAVE_DNSSD)
AC_DEFINE(HAVE_COREFOUNDATION)
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
- MDNS="mdns"
+ DNSSD_BACKEND="dnssd"
;;
*)
# All others...
fi
AC_SUBST(DNSSDLIBS)
-AC_SUBST(MDNS)
+AC_SUBST(DNSSD_BACKEND)
dnl
dnl End of "$Id: cups-dnssd.m4 7585 2008-05-16 23:13:47Z mike $".
"string=%d chars...", mask, keyword, name, text,
string ? (int)strlen(string) : 0));
- if (strncmp(keyword, "Default", 7) && !string)
+ if (strncmp(keyword, "Default", 7) && !string &&
+ cg->ppd_conform != PPD_CONFORM_RELAXED)
{
/*
* Need a string value!
}
putenv("LANG=fr");
+ putenv("LC_ALL=fr");
+ putenv("LC_CTYPE=fr");
+ putenv("LC_MESSAGES=fr");
fputs("ppdLocalizeIPPReason(fr text): ", stdout);
if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
}
putenv("LANG=zh_TW");
+ putenv("LC_ALL=zh_TW");
+ putenv("LC_CTYPE=zh_TW");
+ putenv("LC_MESSAGES=zh_TW");
fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout);
if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
*/
putenv("LANG=en");
+ putenv("LC_ALL=en");
+ putenv("LC_CTYPE=en");
+ putenv("LC_MESSAGES=en");
fputs("ppdLocalizeMarkerName(bogus): ", stdout);
}
putenv("LANG=fr");
+ putenv("LC_ALL=fr");
+ putenv("LC_CTYPE=fr");
+ putenv("LC_MESSAGES=fr");
fputs("ppdLocalizeMarkerName(fr cyan): ", stdout);
if ((text = ppdLocalizeMarkerName(ppd, "cyan")) != NULL &&
}
putenv("LANG=zh_TW");
+ putenv("LC_ALL=zh_TW");
+ putenv("LC_CTYPE=zh_TW");
+ putenv("LC_MESSAGES=zh_TW");
fputs("ppdLocalizeMarkerName(zh_TW cyan): ", stdout);
if ((text = ppdLocalizeMarkerName(ppd, "cyan")) != NULL &&
ppd_coption_t *coption; /* Custom option */
ppd_cparam_t *cparam; /* Custom parameter */
ppd_const_t *c; /* UIConstraints */
- char lang[255]; /* LANG environment variable */
+ char lang[255], /* LANG environment variable */
+ lc_all[255], /* LC_ALL environment variable */
+ lc_ctype[255], /* LC_CTYPE environment variable */
+ lc_messages[255];/* LC_MESSAGES environment variable */
if (argc > 2)
{
snprintf(lang, sizeof(lang), "LANG=%s", argv[2]);
putenv(lang);
+ snprintf(lc_all, sizeof(lc_all), "LC_ALL=%s", argv[2]);
+ putenv(lc_all);
+ snprintf(lc_ctype, sizeof(lc_ctype), "LC_CTYPE=%s", argv[2]);
+ putenv(lc_ctype);
+ snprintf(lc_messages, sizeof(lc_messages), "LC_MESSAGES=%s", argv[2]);
+ putenv(lc_messages);
}
ppdLocalize(ppd);
*APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
</pre>
+<h3><span class='info'>Mac OS X 10.6</span><a name='APICADriver'>APICADriver</a></h3>
+
+<p class='summary'>*APICADriver: boolean</p>
+
+<p>This attribute specifies whether the device has a matching Image Capture
+Architecture (ICA) driver for scanning. The default is <tt>False</tt>.</p>
+
+<p>Examples:</p>
+
+<pre class='command'>
+*APICADriver: True
+*APScanAppBundleID: "com.apple.ImageCaptureApp"
+</pre>
+
<h3><span class='info'>Mac OS X 10.3</span><a name='APPrinterIconPath'>APPrinterIconPath</a></h3>
<p class='summary'>*APPrinterIconPath: "/Library/Printers/vendor/filename"</p>
<p>Examples:</p>
<pre class='command'>
+*APICADriver: True
*APScanAppBundleID: "com.apple.ImageCaptureApp"
</pre>
<ul>
+ <li>Added <a href='#APICADriver'><tt>APICADriver</tt></a>
+ attribute.</li>
+
<li>Added <a href='#cupsCommands'><tt>cupsCommands</tt></a>
attribute.</li>
if (doc->number_up > 1)
doc_puts(doc, "userdict/ESPsave save put\n");
- if (doc->mirror)
- doc_printf(doc, "%.1f 0.0 translate -1 1 scale\n", PageWidth);
-
pos = (number - 1) % doc->number_up;
pagew = PageRight - PageLeft;
pagel = PageTop - PageBottom;
else if (doc->number_up > 1 || doc->fitplot)
doc_printf(doc, "%.1f %.1f translate\n", PageLeft, PageBottom);
+ if (doc->mirror)
+ doc_printf(doc, "%.1f 0.0 translate -1 1 scale\n", PageWidth);
+
switch (doc->number_up)
{
default :
.\"
.\" lp man page for the Common UNIX Printing System (CUPS).
.\"
-.\" Copyright 2007 by Apple Inc.
+.\" Copyright 2007-2008 by Apple Inc.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" which should have been included with this file. If this file is
.\" file is missing or damaged, see the license at "http://www.cups.org/".
.\"
-.TH lp 1 "Common UNIX Printing System" "23 March 2006" "Apple Inc."
+.TH lp 1 "Common UNIX Printing System" "29 August 2008" "Apple Inc."
.SH NAME
lp - print files
.SH SYNOPSIS
.SH DESCRIPTION
\fIlp\fR submits files for printing or alters a pending job. Use
a filename of "-" to force printing from the standard input.
+.SH THE DEFAULT DESTINATION
+CUPS provides many ways to set the default destination. The "LPDEST" and
+"PRINTER" environment variables are consulted first. If neither are set,
+the current default set using the \fIlpoptions(1)\fR command is used,
+followed by the default set using the \fIlpadmin(8)\fR command.
.SH OPTIONS
The following options are recognized by \fIlp\fR:
.TP 5
100 is highest priority) instead of the Solaris values (0-39, 0
is highest priority).
.SH SEE ALSO
-\fIcancel(1)\fR, \fIlpmove(8)\fR, \fIlpoptions(1)\fR, \fIlpstat(1)\fR,
+\fIcancel(1)\fR, \fIlpadmin(8)\fR, \fIlpmove(8)\fR, \fIlpoptions(1)\fR,
+\fIlpstat(1)\fR,
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007 by Apple Inc.
+Copyright 2007-2008 by Apple Inc.
.\"
.\" End of "$Id: lp.man 7600 2008-05-20 21:06:23Z mike $".
.\"
.\"
.\" lpoptions man page for the Common UNIX Printing System (CUPS).
.\"
-.\" Copyright 2007 by Apple Inc.
+.\" Copyright 2007-2008 by Apple Inc.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" which should have been included with this file. If this file is
.\" file is missing or damaged, see the license at "http://www.cups.org/".
.\"
-.TH lpoptions 1 "Common UNIX Printing System" "20 March 2006" "Apple Inc."
+.TH lpoptions 1 "Common UNIX Printing System" "29 August 2008" "Apple Inc."
.SH NAME
lpoptions \- display or set printer options and defaults
.SH SYNOPSIS
.TP 5
-d destination[/instance]
.br
-Sets the default printer to \fIdestination\fR. If \fIinstance\fR
+Sets the user default printer to \fIdestination\fR. If \fIinstance\fR
is supplied then that particular instance is used. This option
overrides the system default printer for the current user.
.TP 5
@CUPS_SERVERROOT@/lpoptions - system-wide defaults and instances
created by the root user.
.SH SEE ALSO
-\fIcancel(1)\fR, \fIlp(1)\fR, \fIlpr(1)\fR,
+\fIcancel(1)\fR, \fIlp(1)\fR, \fIlpadmin(8)\fR, \fIlpr(1)\fR,
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007 by Apple Inc.
+Copyright 2007-2008 by Apple Inc.
.\"
.\" End of "$Id: lpoptions.man.in 7600 2008-05-20 21:06:23Z mike $".
.\"
.\"
.\" lpr man page for the Common UNIX Printing System (CUPS).
.\"
-.\" Copyright 2007 by Apple Inc.
+.\" Copyright 2007-2008 by Apple Inc.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" which should have been included with this file. If this file is
.\" file is missing or damaged, see the license at "http://www.cups.org/".
.\"
-.TH lpr 1 "Common UNIX Printing System" "12 February 2006" "Apple Inc."
+.TH lpr 1 "Common UNIX Printing System" "29 August 2008" "Apple Inc."
.SH NAME
lpr \- print files
.SH SYNOPSIS
]
.SH DESCRIPTION
\fIlpr\fR submits files for printing. Files named on the command
-line are sent to the named printer (or the system default
-destination if no destination is specified). If no files are
-listed on the command-line, \fIlpr\fR reads the print file from
-the standard input.
+line are sent to the named printer (or the default destination if no
+destination is specified). If no files are listed on the command-line,
+\fIlpr\fR reads the print file from the standard input.
+.SH THE DEFAULT DESTINATION
+CUPS provides many ways to set the default destination. The "LPDEST" and
+"PRINTER" environment variables are consulted first. If neither are set,
+the current default set using the \fIlpoptions(1)\fR command is used,
+followed by the default set using the \fIlpadmin(8)\fR command.
.SH OPTIONS
The following options are recognized by \fIlpr\fR:
.TP 5
The "c", "d", "f", "g", "i", "n", "t", "v", and "w" options
are not supported by CUPS and produce a warning message if used.
.SH SEE ALSO
-\fIcancel(1)\fR, \fIlp(1)\fR, \fIlpq(1)\fR, \fIlprm(1)\fR,
-\fIlpstat(1)\fR,
+\fIcancel(1)\fR, \fIlp(1)\fR, \fIlpadmin(8)\fR, \fIlpoptions(1)\fR,
+\fIlpq(1)\fR, \fIlprm(1)\fR, \fIlpstat(1)\fR,
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007 by Apple Inc.
+Copyright 2007-2008 by Apple Inc.
.\"
.\" End of "$Id: lpr.man 7600 2008-05-20 21:06:23Z mike $".
.\"
include ../Makedefs
-TARGETS = mailto rss testnotify
-OBJS = mailto.o rss.o testnotify.o
+NOTIFIERS = $(DBUS_NOTIFIER) mailto rss
+TARGETS = $(NOTIFIERS) testnotify
+OBJS = dbus.o mailto.o rss.o testnotify.o
#
#
clean:
- $(RM) $(OBJS) $(TARGETS)
+ $(RM) $(OBJS) $(TARGETS) dbus.h
#
-chgrp $(CUPS_GROUP) $(CACHEDIR)/rss
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
- cp mailto rss $(SYMROOT); \
+ cp $(NOTIFIERS) $(SYMROOT); \
fi
#
install-exec:
+ echo Installing notifiers in $(SERVERBIN)/notifier...
$(INSTALL_DIR) -m 755 $(SERVERBIN)/notifier
- $(INSTALL_BIN) mailto $(SERVERBIN)/notifier
- $(INSTALL_BIN) rss $(SERVERBIN)/notifier
+ for file in $(NOTIFIERS); do \
+ $(INSTALL_BIN) $$file $(SERVERBIN)/notifier; \
+ done
#
#
uninstall:
- for file in $(TARGETS); do \
+ for file in $(NOTIFIERS); do \
$(RM) $(SERVERBIN)/notifier/$$file; \
done
-$(RMDIR) $(SERVERBIN)/notifier
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
+#
+# dbus
+#
+
+dbus: dbus.o ../cups/$(LIBCUPS)
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o dbus dbus.o $(DBUS_NOTIFIERLIBS) $(LIBS)
+
+dbus.o: dbus.h
+dbus.h: dbus-notifier.xml
+ dbus-binding-tool --mode=glib-server $< >$@
+
+
#
# mailto
#
--- /dev/null
+/*
+ * "$Id$"
+ *
+ * D-Bus notifier for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 2008 by Apple Inc.
+ * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007 Tim Waugh <twaugh@redhat.com>
+ * Copyright 1997-2005 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * Contents:
+ *
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/cups.h>
+#include <cups/string.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <dbus/dbus.h>
+#ifdef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND
+# define dbus_message_append_iter_init dbus_message_iter_init_append
+# define dbus_message_iter_append_string(i,v) dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, v)
+# define dbus_message_iter_append_uint32(i,v) dbus_message_iter_append_basic(i, DBUS_TYPE_UINT32, v)
+# define dbus_message_iter_append_boolean(i,v) dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, v)
+#endif /* HAVE_DBUS_MESSAGE_ITER_INIT_APPEND */
+
+
+/*
+ * D-Bus object: org.cups.cupsd.Notifier
+ * D-Bus object path: /org/cups/cupsd/Notifier
+ *
+ * D-Bus interface name: org.cups.cupsd.Notifier
+ *
+ * Signals:
+ *
+ * ServerRestarted(STRING text)
+ * Server has restarted.
+ *
+ * ServerStarted(STRING text)
+ * Server has started.
+ *
+ * ServerStopped(STRING text)
+ * Server has stopped.
+ *
+ * ServerAudit(STRING text)
+ * Security-related event.
+ *
+ * PrinterRestarted(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer has restarted.
+ *
+ * PrinterShutdown(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer has shutdown.
+ *
+ * PrinterStopped(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer has stopped.
+ *
+ * PrinterStateChanged(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer state has changed.
+ *
+ * PrinterFinishingsChanged(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer's finishings-supported attribute has changed.
+ *
+ * PrinterMediaChanged(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer's media-supported attribute has changed.
+ *
+ * PrinterAdded(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer has been added.
+ *
+ * PrinterDeleted(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer has been deleted.
+ *
+ * PrinterModified(STRING text,
+ * STRING printer-uri,
+ * STRING printer-name,
+ * UINT32 printer-state,
+ * STRING printer-state-reasons,
+ * BOOLEAN printer-is-accepting-jobs)
+ * Printer has been modified.
+ *
+ * text describes the event.
+ * printer-state-reasons is a comma-separated list.
+ * If printer-uri is "" in a Job* signal, the other printer-* parameters
+ * must be ignored.
+ * If the job name is not know, job-name will be "".
+ */
+
+/*
+ * Constants...
+ */
+
+enum
+{
+ PARAMS_NONE,
+ PARAMS_PRINTER,
+ PARAMS_JOB
+};
+
+
+/*
+ * Local functions...
+ */
+
+static int acquire_lock(int *fd);
+
+
+/*
+ * 'main()' - Read events and send DBUS notifications.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line args */
+ char *argv[]) /* I - Command-line arguments */
+{
+ ipp_t *msg; /* Event message from scheduler */
+ ipp_state_t state; /* IPP event state */
+ struct sigaction action; /* POSIX sigaction data */
+ DBusConnection *con = NULL; /* Connection to DBUS server */
+ DBusError error; /* Error, if any */
+ DBusMessage *message; /* Message to send */
+ DBusMessageIter iter; /* Iterator for message data */
+ int lock_fd = -1; /* Lock file descriptor */
+ char lock_filename[1024];
+ /* Lock filename */
+
+
+ /*
+ * Don't buffer stderr...
+ */
+
+ setbuf(stderr, NULL);
+
+ /*
+ * Ignore SIGPIPE signals...
+ */
+
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &action, NULL);
+
+ /*
+ * Validate command-line options...
+ */
+
+ if (argc != 3)
+ {
+ fputs("Usage: dbus dbus:/// notify-user-data\n", stderr);
+ return (1);
+ }
+
+ if (strcmp(argv[1], "dbus:"))
+ {
+ fprintf(stderr, "ERROR: Bad URI \"%s\"!\n", argv[1]);
+ return (1);
+ }
+
+ /*
+ * Loop forever until we run out of events...
+ */
+
+ for (;;)
+ {
+ ipp_attribute_t *attr; /* Current attribute */
+ const char *event; /* Event name */
+ const char *signame = NULL;/* DBUS signal name */
+ char *printer_reasons = NULL;
+ /* Printer reasons string */
+ const char *nul = ""; /* Empty string value */
+ int no = 0; /* Boolean "no" value */
+ int params = PARAMS_NONE;
+ /* What parameters to include? */
+
+
+ /*
+ * Get the next event...
+ */
+
+ msg = ippNew();
+ while ((state = ippReadFile(0, msg)) != IPP_DATA)
+ {
+ if (state <= IPP_IDLE)
+ break;
+ }
+
+ fprintf(stderr, "DEBUG: state=%d\n", state);
+
+ if (state == IPP_ERROR)
+ fputs("DEBUG: ippReadFile() returned IPP_ERROR!\n", stderr);
+
+ if (state <= IPP_IDLE)
+ {
+ /*
+ * Out of messages, free memory and then exit...
+ */
+
+ ippDelete(msg);
+ break;
+ }
+
+ /*
+ * Verify connection to DBUS server...
+ */
+
+ if (con && !dbus_connection_get_is_connected(con))
+ {
+ dbus_connection_unref(con);
+ con = NULL;
+ }
+
+ if (!con)
+ {
+ dbus_error_init(&error);
+
+ con = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (!con)
+ dbus_error_free(&error);
+ else
+ fputs("DEBUG: Connected to D-BUS\n", stderr);
+ }
+
+ if (!con)
+ continue;
+
+ if (lock_fd == -1 &&
+ acquire_lock(&lock_fd, lock_filename, sizeof(lock_filename)))
+ continue;
+
+ attr = ippFindAttribute(msg, "notify-subscribed-event",
+ IPP_TAG_KEYWORD);
+ if (!attr)
+ continue;
+
+ event = attr->values[0].string.text;
+ if (!strncmp(event, "server-", 7))
+ {
+ const char *word2 = event + 7; /* Second word */
+
+ if (!strcmp(word2, "restarted"))
+ signame = "ServerRestarted";
+ else if (!strcmp(word2, "started"))
+ signame = "ServerStarted";
+ else if (!strcmp(word2, "stopped"))
+ signame = "ServerStopped";
+ else if (!strcmp(word2, "audit"))
+ signame = "ServerAudit";
+ else
+ continue;
+ }
+ else if (!strncmp(event, "printer-", 8))
+ {
+ const char *word2 = event + 8; /* Second word */
+
+ params = PARAMS_PRINTER;
+ if (!strcmp(word2, "restarted"))
+ signame = "PrinterRestarted";
+ else if (!strcmp(word2, "shutdown"))
+ signame = "PrinterShutdown";
+ else if (!strcmp(word2, "stopped"))
+ signame = "PrinterStopped";
+ else if (!strcmp(word2, "state-changed"))
+ signame = "PrinterStateChanged";
+ else if (!strcmp(word2, "finishings-changed"))
+ signame = "PrinterFinishingsChanged";
+ else if (!strcmp(word2, "media-changed"))
+ signame = "PrinterMediaChanged";
+ else if (!strcmp(word2, "added"))
+ signame = "PrinterAdded";
+ else if (!strcmp(word2, "deleted"))
+ signame = "PrinterDeleted";
+ else if (!strcmp(word2, "modified"))
+ signame = "PrinterModified";
+ else
+ continue;
+ }
+ else if (!strncmp(event, "job-", 4))
+ {
+ const char *word2 = event + 4; /* Second word */
+
+ params = PARAMS_JOB;
+ if (!strcmp(word2, "state"))
+ signame = "JobState";
+ else if (!strcmp(word2, "created"))
+ signame = "JobCreated";
+ else if (!strcmp(word2, "completed"))
+ signame = "JobCompleted";
+ else if (!strcmp(word2, "stopped"))
+ signame = "JobStopped";
+ else if (!strcmp(word2, "config-changed"))
+ signame = "JobConfigChanged";
+ else if (!strcmp(word2, "progress"))
+ signame = "JobProgress";
+ else
+ continue;
+ }
+ else
+ continue;
+
+ /*
+ * Create and send the new message...
+ */
+
+ fprintf(stderr, "DEBUG: %s\n", signame);
+ message = dbus_message_new_signal("/org/cups/cupsd/Notifier",
+ "org.cups.cupsd.Notifier",
+ signame);
+
+ dbus_message_append_iter_init(message, &iter);
+ attr = ippFindAttribute(msg, "notify-text", IPP_TAG_TEXT);
+ if (!attr)
+ goto bail;
+ dbus_message_iter_append_string(&iter, &(attr->values[0].string.text));
+
+ if (params >= PARAMS_PRINTER)
+ {
+ char *p; /* Pointer into printer_reasons */
+ size_t reasons_length; /* Required size of printer_reasons */
+ int i; /* Looping var */
+ int have_printer_params = 1;/* Do we have printer URI? */
+
+ /* STRING printer-uri or "" */
+ attr = ippFindAttribute(msg, "notify-printer-uri", IPP_TAG_URI);
+ if (attr)
+ dbus_message_iter_append_string(&iter, &(attr->values[0].string.text));
+ else
+ {
+ have_printer_params = 0;
+ dbus_message_iter_append_string(&iter, &nul);
+ }
+
+ /* STRING printer-name */
+ if (have_printer_params)
+ {
+ attr = ippFindAttribute(msg, "printer-name", IPP_TAG_NAME);
+ if (attr)
+ dbus_message_iter_append_string(&iter,
+ &(attr->values[0].string.text));
+ else
+ goto bail;
+ }
+ else
+ dbus_message_iter_append_string(&iter, &nul);
+
+ /* UINT32 printer-state */
+ if (have_printer_params)
+ {
+ attr = ippFindAttribute(msg, "printer-state", IPP_TAG_ENUM);
+ if (attr)
+ dbus_message_iter_append_uint32(&iter, &(attr->values[0].integer));
+ else
+ goto bail;
+ }
+ else
+ dbus_message_iter_append_uint32(&iter, &no);
+
+ /* STRING printer-state-reasons */
+ if (have_printer_params)
+ {
+ attr = ippFindAttribute(msg, "printer-state-reasons",
+ IPP_TAG_KEYWORD);
+ if (attr)
+ {
+ for (reasons_length = 0, i = 0; i < attr->num_values; i++)
+ /* All need commas except the last, which needs a nul byte. */
+ reasons_length += 1 + strlen(attr->values[i].string.text);
+ printer_reasons = malloc(reasons_length);
+ if (!printer_reasons)
+ goto bail;
+ p = printer_reasons;
+ for (i = 0; i < attr->num_values; i++)
+ {
+ strcpy(p, attr->values[i].string.text);
+ p += strlen(p);
+ if (i)
+ *p++ = ',';
+ }
+ dbus_message_iter_append_string(&iter, &printer_reasons);
+ }
+ else
+ goto bail;
+ }
+ else
+ dbus_message_iter_append_string(&iter, &nul);
+
+ /* BOOL printer-is-accepting-jobs */
+ if (have_printer_params)
+ {
+ attr = ippFindAttribute(msg, "printer-is-accepting-jobs",
+ IPP_TAG_BOOLEAN);
+ if (attr)
+ dbus_message_iter_append_boolean(&iter, &(attr->values[0].boolean));
+ else
+ goto bail;
+ }
+ else
+ dbus_message_iter_append_boolean(&iter, &no);
+ }
+
+ if (params >= PARAMS_JOB)
+ {
+ /* UINT32 job-id */
+ attr = ippFindAttribute(msg, "notify-job-id", IPP_TAG_INTEGER);
+ if (!attr)
+ goto bail;
+ dbus_message_iter_append_uint32(&iter, &(attr->values[0].integer));
+
+ /* UINT32 job-state */
+ attr = ippFindAttribute(msg, "job-state", IPP_TAG_ENUM);
+ if (!attr)
+ goto bail;
+ dbus_message_iter_append_uint32(&iter, &(attr->values[0].integer));
+
+ /* STRING job-state-reasons */
+ attr = ippFindAttribute(msg, "job-state-reasons", IPP_TAG_KEYWORD);
+ if (!attr)
+ goto bail;
+ dbus_message_iter_append_string(&iter, &(attr->values[0].string.text));
+
+ /* STRING job-name or "" */
+ attr = ippFindAttribute(msg, "job-name", IPP_TAG_NAME);
+ if (attr)
+ dbus_message_iter_append_string(&iter, &(attr->values[0].string.text));
+ else
+ dbus_message_iter_append_string(&iter, &nul);
+
+ /* UINT32 job-impressions-completed */
+ attr = ippFindAttribute(msg, "job-impressions-completed",
+ IPP_TAG_INTEGER);
+ if (!attr)
+ goto bail;
+ dbus_message_iter_append_uint32(&iter, &(attr->values[0].integer));
+ }
+
+ dbus_connection_send(con, message, NULL);
+ dbus_connection_flush(con);
+
+ /*
+ * Cleanup...
+ */
+
+ bail:
+
+ if (printer_reasons)
+ free(printer_reasons);
+
+ dbus_message_unref(message);
+ ippDelete(msg);
+ }
+
+ /*
+ * Remove lock file...
+ */
+
+ if (lock_fd >= 0)
+ {
+ close(lock_fd);
+ unlink(lock_filename);
+ }
+
+ return (0);
+}
+
+
+/*
+ * 'acquire_lock()' - Acquire a lock so we only have a single notifier running.
+ */
+
+static int /* O - 0 on success, -1 on failure */
+acquire_lock(int *fd, /* O - Lock file descriptor */
+ char *lockfile, /* I - Lock filename buffer */
+ size_t locksize) /* I - Size of filename buffer */
+{
+ const char *tmpdir; /* Temporary directory */
+
+
+ /*
+ * Figure out where to put the lock file...
+ */
+
+ if ((tmpdir = getenv("TMPDIR")) == NULL)
+ tmpdir = "/tmp";
+
+ snprintf(lockfile, locksize, "%s/cups-dbus-notifier-lockfile", tmpdir);
+
+ /*
+ * Create the lock file and fail if it already exists...
+ */
+
+ if ((*fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
+ return (-1);
+ else
+ return (0);
+}
+
+
+/*
+ * End of "$Id$".
+ */
f 0700 root sys $SERVERBIN/backend/ipp backend/ipp
l 0700 root sys $SERVERBIN/backend/http ipp
f 0700 root sys $SERVERBIN/backend/lpd backend/lpd
-%if MDNS
-f 0700 root sys $SERVERBIN/backend/mdns backend/mdns
+%if DNSSD_BACKEND
+f 0700 root sys $SERVERBIN/backend/dnssd backend/dnssd
+l 0700 root sys $SERVERBIN/backend/mdns dnssd
%endif
%system !darwin
f 0755 root sys $SERVERBIN/backend/parallel backend/parallel
{ "DefaultCharset", &DefaultCharset, CUPSD_VARTYPE_STRING },
{ "DefaultLanguage", &DefaultLanguage, CUPSD_VARTYPE_STRING },
{ "DefaultLeaseDuration", &DefaultLeaseDuration, CUPSD_VARTYPE_INTEGER },
+ { "DefaultPaperSize", &DefaultPaperSize, CUPSD_VARTYPE_STRING },
{ "DefaultPolicy", &DefaultPolicy, CUPSD_VARTYPE_STRING },
{ "DefaultShared", &DefaultShared, CUPSD_VARTYPE_BOOLEAN },
{ "DirtyCleanInterval", &DirtyCleanInterval, CUPSD_VARTYPE_INTEGER },
cupsdSetString(&DefaultCharset, _cupsEncodingName(language->encoding));
+ cupsdClearString(&DefaultPaperSize);
+
cupsdSetString(&RIPCache, "8m");
cupsdSetString(&TempDir, NULL);
cupsdInitEnv();
+ /*
+ * Update default paper size setting as needed...
+ */
+
+ if (!DefaultPaperSize)
+ {
+#ifdef HAVE_LIBPAPER
+ char *paper_result; /* Paper size name from libpaper */
+
+ if ((paper_result = systempapername()) != NULL)
+ cupsdSetString(&DefaultPaperSize, paper_result);
+ else
+#endif /* HAVE_LIBPAPER */
+ if (!DefaultLanguage ||
+ !strcasecmp(DefaultLanguage, "C") ||
+ !strcasecmp(DefaultLanguage, "POSIX") ||
+ !strcasecmp(DefaultLanguage, "en") ||
+ !strncasecmp(DefaultLanguage, "en.", 3) ||
+ !strncasecmp(DefaultLanguage, "en_US", 5) ||
+ !strncasecmp(DefaultLanguage, "en_CA", 5) ||
+ !strncasecmp(DefaultLanguage, "fr_CA", 5))
+ {
+ /*
+ * These are the only locales that will default to "letter" size...
+ */
+
+ cupsdSetString(&DefaultPaperSize, "Letter");
+ }
+ else
+ cupsdSetString(&DefaultPaperSize, "A4");
+ }
+
+ /*
+ * Update classification setting as needed...
+ */
+
+ if (Classification && !strcasecmp(Classification, "none"))
+ cupsdClearString(&Classification);
+
+ if (Classification)
+ cupsdLogMessage(CUPSD_LOG_INFO, "Security set to \"%s\"", Classification);
+
/*
* Check the MaxClients setting, and then allocate memory for it...
*/
if (MaxActiveJobs > (MaxFDs / 3))
MaxActiveJobs = MaxFDs / 3;
- if (Classification && !strcasecmp(Classification, "none"))
- cupsdClearString(&Classification);
-
- if (Classification)
- cupsdLogMessage(CUPSD_LOG_INFO, "Security set to \"%s\"", Classification);
-
/*
* Update the MaxClientsPerHost value, as needed...
*/
/* Default charset */
*DefaultLocale VALUE(NULL),
/* Default locale */
+ *DefaultPaperSize VALUE(NULL),
+ /* Default paper size */
*ErrorPolicy VALUE(NULL),
/* Default printer-error-policy */
*RIPCache VALUE(NULL),
*/
static int create_job(http_t *http, const char *dest, const char *title,
- const char *user, int num_options,
- cups_option_t *options);
+ const char *docname, const char *user,
+ int num_options, cups_option_t *options);
static int get_printer(http_t *http, const char *name, char *dest,
int destsize, cups_option_t **options,
int *accepting, int *shared, ipp_pstate_t *state);
create_job(http_t *http, /* I - HTTP connection */
const char *dest, /* I - Destination name */
const char *title, /* I - job-name */
+ const char *docname, /* I - Name of job file */
const char *user, /* I - requesting-user-name */
int num_options, /* I - Number of options for job */
cups_option_t *options) /* I - Options for job */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
- if (title)
+ if (title[0])
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, title);
+ if (docname[0])
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
+ NULL, docname);
+
cupsEncodeOptions(request, num_options, options);
/*
* Grab the job information...
*/
- title[0] = '\0';
- user[0] = '\0';
- doccount = 0;
+ title[0] = '\0';
+ user[0] = '\0';
+ docname[0] = '\0';
+ doccount = 0;
while (smart_gets(line, sizeof(line), fp) != NULL)
{
strlcpy(title, line + 1, sizeof(title));
break;
+ case 'N' : /* Document name */
+ strlcpy(docname, line + 1, sizeof(docname));
+ break;
+
case 'P' : /* User identification */
strlcpy(user, line + 1, sizeof(user));
break;
* Create the job...
*/
- if ((id = create_job(http, dest, title, user, num_options, options)) < 0)
+ if ((id = create_job(http, dest, title, docname, user, num_options,
+ options)) < 0)
status = 1;
else
{
*
* Contents:
*
+ * cupsdDeregisterPrinter() - Stop sending broadcast information for a local
+ * printer and remove any pending references to
+ * remote printers.
+ * cupsdLoadRemoteCache() - Load the remote printer cache.
+ * cupsdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
+ * cupsdRestartPolling() - Restart polling servers as needed.
+ * cupsdSaveRemoteCache() - Save the remote printer cache.
+ * cupsdSendBrowseList() - Send new browsing information as necessary.
+ * ldap_rebind_proc() - Callback function for LDAP rebind
+ * ldap_connect() - Start new LDAP connection
+ * ldap_reconnect() - Reconnect to LDAP Server
+ * ldap_disconnect() - Disconnect from LDAP Server
+ * cupsdStartBrowsing() - Start sending and receiving broadcast
+ * information.
+ * cupsdStartPolling() - Start polling servers as needed.
+ * cupsdStopBrowsing() - Stop sending and receiving broadcast
+ * information.
+ * cupsdStopPolling() - Stop polling servers as needed.
+ * cupsdUpdateDNSSDName() - Update the computer name we use for
+ * browsing...
+ * cupsdUpdateLDAPBrowse() - Scan for new printers via LDAP...
+ * cupsdUpdateSLPBrowse() - Get browsing information via SLP.
+ * dequote() - Remote quotes from a string.
+ * dnssdBuildTxtRecord() - Build a TXT record from printer info.
+ * dnssdComparePrinters() - Compare the registered names of two printers.
+ * dnssdDeregisterPrinter() - Stop sending broadcast information for a
+ * printer.
+ * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
+ * record format.
+ * dnssdRegisterCallback() - DNSServiceRegister callback.
+ * dnssdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
+ * dnssdUpdate() - Handle DNS-SD queries.
+ * get_hostconfig() - Get an /etc/hostconfig service setting.
+ * is_local_queue() - Determine whether the URI points at a local
+ * queue.
+ * process_browse_data() - Process new browse data.
+ * process_implicit_classes() - Create/update implicit classes as needed.
+ * send_cups_browse() - Send new browsing information using the CUPS
+ * protocol.
+ * ldap_search_rec() - LDAP Search with reconnect
+ * ldap_freeres() - Free LDAPMessage
+ * ldap_getval_char() - Get first LDAP value and convert to string
+ * send_ldap_ou() - Send LDAP ou registrations.
+ * send_ldap_browse() - Send LDAP printer registrations.
+ * ldap_dereg_printer() - Delete printer from directory
+ * send_slp_browse() - Register the specified printer with SLP.
+ * slp_attr_callback() - SLP attribute callback
+ * slp_dereg_printer() - SLPDereg() the specified printer
+ * slp_get_attr() - Get an attribute from an SLP registration.
+ * slp_reg_callback() - Empty SLPRegReport.
+ * slp_url_callback() - SLP service url callback
+ * update_cups_browse() - Update the browse lists using the CUPS
+ * protocol.
+ * update_lpd() - Update the LPD configuration as needed.
+ * update_polling() - Read status messages from the poll daemons.
+ * update_smb() - Update the SMB configuration as needed.
*/
/*
* move_job() - Move a job to a new destination.
* ppd_parse_line() - Parse a PPD default line.
* print_job() - Print a file to a printer or class.
- * read_ps_job_ticket() - Reads a job ticket embedded in a PS file.
+ * read_job_ticket() - Read a job ticket embedded in a print file.
* reject_jobs() - Reject print jobs to a printer.
* release_job() - Release a held print job.
* renew_subscription() - Renew an existing subscription...
static int ppd_parse_line(const char *line, char *option, int olen,
char *choice, int clen);
static void print_job(cupsd_client_t *con, ipp_attribute_t *uri);
-static void read_ps_job_ticket(cupsd_client_t *con);
+static void read_job_ticket(cupsd_client_t *con);
static void reject_jobs(cupsd_client_t *con, ipp_attribute_t *uri);
static void release_job(cupsd_client_t *con, ipp_attribute_t *uri);
static void renew_subscription(cupsd_client_t *con, int sub_id);
*/
cupsdLogMessage(con->response->request.status.status_code
- >= IPP_BAD_REQUEST ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG,
+ >= IPP_BAD_REQUEST &&
+ con->response->request.status.status_code
+ != IPP_NOT_FOUND ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG,
"Returning IPP %s for %s (%s) from %s",
ippErrorString(con->response->request.status.status_code),
ippOpString(con->request->request.op.operation_id),
cups_option_t *defaults; /* Default options */
char cups_protocol[PPD_MAX_LINE];
/* cupsProtocol attribute */
- int have_letter, /* Have Letter size */
- have_a4; /* Have A4 size */
-#ifdef HAVE_LIBPAPER
- char *paper_result; /* Paper size name from libpaper */
- char system_paper[64]; /* Paper size name buffer */
-#endif /* HAVE_LIBPAPER */
cupsdLogMessage(CUPSD_LOG_DEBUG2,
return (-1);
}
- have_letter = ppdPageSize(ppd, "Letter") != NULL;
- have_a4 = ppdPageSize(ppd, "A4") != NULL;
-
/*
* Open the destination (if possible) and set the default options...
*/
cupsFileClose(dst);
}
-#ifdef HAVE_LIBPAPER
- else if ((paper_result = systempapername()) != NULL)
- {
- /*
- * Set the default media sizes from the systemwide default...
- */
-
- strlcpy(system_paper, paper_result, sizeof(system_paper));
- system_paper[0] = toupper(system_paper[0] & 255);
-
- if ((!strcmp(system_paper, "Letter") && have_letter) ||
- (!strcmp(system_paper, "A4") && have_a4))
- {
- num_defaults = cupsAddOption("PageSize", system_paper,
- num_defaults, &defaults);
- num_defaults = cupsAddOption("PageRegion", system_paper,
- num_defaults, &defaults);
- num_defaults = cupsAddOption("PaperDimension", system_paper,
- num_defaults, &defaults);
- num_defaults = cupsAddOption("ImageableArea", system_paper,
- num_defaults, &defaults);
- }
- }
-#endif /* HAVE_LIBPAPER */
- else
+ else if (ppdPageSize(ppd, DefaultPaperSize))
{
/*
* Add the default media sizes...
- *
- * Note: These values are generally not valid for large-format devices
- * like plotters, however it is probably safe to say that those
- * users will configure the media size after initially adding
- * the device anyways...
*/
- if (!DefaultLanguage ||
- !strcasecmp(DefaultLanguage, "C") ||
- !strcasecmp(DefaultLanguage, "POSIX") ||
- !strcasecmp(DefaultLanguage, "en") ||
- !strncasecmp(DefaultLanguage, "en.", 3) ||
- !strncasecmp(DefaultLanguage, "en_US", 5) ||
- !strncasecmp(DefaultLanguage, "en_CA", 5) ||
- !strncasecmp(DefaultLanguage, "fr_CA", 5))
- {
- /*
- * These are the only locales that will default to "letter" size...
- */
-
- if (have_letter)
- {
- num_defaults = cupsAddOption("PageSize", "Letter", num_defaults,
- &defaults);
- num_defaults = cupsAddOption("PageRegion", "Letter", num_defaults,
- &defaults);
- num_defaults = cupsAddOption("PaperDimension", "Letter", num_defaults,
- &defaults);
- num_defaults = cupsAddOption("ImageableArea", "Letter", num_defaults,
- &defaults);
- }
- }
- else if (have_a4)
- {
- /*
- * The rest default to "a4" size...
- */
-
- num_defaults = cupsAddOption("PageSize", "A4", num_defaults,
- &defaults);
- num_defaults = cupsAddOption("PageRegion", "A4", num_defaults,
- &defaults);
- num_defaults = cupsAddOption("PaperDimension", "A4", num_defaults,
- &defaults);
- num_defaults = cupsAddOption("ImageableArea", "A4", num_defaults,
- &defaults);
- }
+ num_defaults = cupsAddOption("PageSize", DefaultPaperSize,
+ num_defaults, &defaults);
+ num_defaults = cupsAddOption("PageRegion", DefaultPaperSize,
+ num_defaults, &defaults);
+ num_defaults = cupsAddOption("PaperDimension", DefaultPaperSize,
+ num_defaults, &defaults);
+ num_defaults = cupsAddOption("ImageableArea", DefaultPaperSize,
+ num_defaults, &defaults);
}
ppdClose(ppd);
*/
if (!strcasecmp(filetype->super, "application") &&
- !strcasecmp(filetype->type, "postscript"))
- read_ps_job_ticket(con);
+ (!strcasecmp(filetype->type, "postscript") ||
+ !strcasecmp(filetype->type, "pdf")))
+ read_job_ticket(con);
/*
* Create the job object...
/*
- * 'read_ps_job_ticket()' - Reads a job ticket embedded in a PS file.
+ * 'read_job_ticket()' - Read a job ticket embedded in a print file.
*
- * This function only gets called when printing a single PostScript
+ * This function only gets called when printing a single PDF or PostScript
* file using the Print-Job operation. It doesn't work for Create-Job +
* Send-File, since the job attributes need to be set at job creation
- * time for banners to work. The embedded PS job ticket stuff is here
- * only to allow the Windows printer driver for CUPS to pass in JCL
+ * time for banners to work. The embedded job ticket stuff is here
+ * primarily to allow the Windows printer driver for CUPS to pass in JCL
* options and IPP attributes which otherwise would be lost.
*
- * The format of a PS job ticket is simple:
+ * The format of a job ticket is simple:
*
* %cupsJobTicket: attr1=value1 attr2=value2 ... attrN=valueN
*
* %cupsJobTicket: attrN=valueN
*
* Job ticket lines must appear immediately after the first line that
- * specifies PostScript format (%!PS-Adobe-3.0), and CUPS will stop
- * looking for job ticket info when it finds a line that does not begin
+ * specifies PostScript (%!PS-Adobe-3.0) or PDF (%PDF) format, and CUPS
+ * stops looking for job ticket info when it finds a line that does not begin
* with "%cupsJobTicket:".
*
* The maximum length of a job ticket line, including the prefix, is
*/
static void
-read_ps_job_ticket(cupsd_client_t *con) /* I - Client connection */
+read_job_ticket(cupsd_client_t *con) /* I - Client connection */
{
cups_file_t *fp; /* File to read from */
char line[256]; /* Line data */
if ((fp = cupsFileOpen(con->filename, "rb")) == NULL)
{
cupsdLogMessage(CUPSD_LOG_ERROR,
- "read_ps_job_ticket: Unable to open PostScript print file "
- "- %s",
+ "Unable to open print file for job ticket - %s",
strerror(errno));
return;
}
if (cupsFileGets(fp, line, sizeof(line)) == NULL)
{
cupsdLogMessage(CUPSD_LOG_ERROR,
- "read_ps_job_ticket: Unable to read from PostScript print "
- "file - %s",
+ "Unable to read from print file for job ticket - %s",
strerror(errno));
cupsFileClose(fp);
return;
}
- if (strncmp(line, "%!PS-Adobe-", 11))
+ if (strncmp(line, "%!PS-Adobe-", 11) && strncmp(line, "%PDF-", 5))
{
/*
* Not a DSC-compliant file, so no job ticket info will be available...
if (!strncmp(attr->name, "time-", 5))
continue;
- if (!strncmp(attr->name, "job-", 4) && strcmp(attr->name, "job-uuid") &&
- strcmp(attr->name, "job-impressions") &&
- strcmp(attr->name, "job-originating-host-name") &&
- !(printer->type & CUPS_PRINTER_REMOTE))
- continue;
-
if (!strncmp(attr->name, "job-", 4) &&
strcmp(attr->name, "job-uuid") &&
- strcmp(attr->name, "job-billing") &&
strcmp(attr->name, "job-impressions") &&
- strcmp(attr->name, "job-sheets") &&
- strcmp(attr->name, "job-hold-until") &&
- strcmp(attr->name, "job-priority"))
+ strcmp(attr->name, "job-originating-host-name") &&
+ !(printer->type & CUPS_PRINTER_REMOTE))
continue;
if ((!strcmp(attr->name, "job-impressions") ||
<SMALL>(Human-readable location such as "Lab 1")</SMALL></TD>
</TR>
<TR>
+<TH CLASS="label">Sharing:</TH>
+<TD><INPUT TYPE="CHECKBOX" NAME="PRINTER_IS_SHARED" {PRINTER_IS_SHARED=1?CHECKED:}">
+Share This Printer</TD>
+</TR>
+<TR>
<TD></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="Continue"></TD>
</TR>
<TD><INPUT TYPE="HIDDEN" NAME="PRINTER_LOCATION" VALUE="{printer_location}">{printer_location}</TD>
</TR>
<TR>
+<TH CLASS="label">Sharing:</TH>
+<TD><INPUT TYPE="HIDDEN" NAME="PRINTER_IS_SHARED" VALUE="{?printer_is_shared}">
+{?printer_is_shared=?Do Not:{?printer_is_shared=0?Do Not:}} Share This Printer</TD>
+</TR>
+<TR>
<TH CLASS="label">Make:</TH>
<TD>
<SELECT NAME="PPD_MAKE" SIZE="10">
<INPUT TYPE="HIDDEN" NAME="BITS" VALUE="{?bits}">
<INPUT TYPE="HIDDEN" NAME="PARITY" VALUE="{?parity}">
<INPUT TYPE="HIDDEN" NAME="FLOW" VALUE="{?flow}">
-
<TABLE>
<TR>
<TH CLASS="label">Connection:</TH>
<TD><INPUT TYPE="HIDDEN" NAME="PRINTER_LOCATION" VALUE="{printer_location}">{printer_location}</TD>
</TR>
<TR>
+<TH CLASS="label">Sharing:</TH>
+<TD><INPUT TYPE="HIDDEN" NAME="PRINTER_IS_SHARED" VALUE="{?printer_is_shared}">
+{?printer_is_shared=?Do Not:{?printer_is_shared=0?Do Not:}} Share This Printer</TD>
+</TR>
+<TR>
<TH CLASS="label">Make:</TH>
<TD>{PPD_MAKE} <INPUT TYPE="SUBMIT" NAME="SELECT_MAKE" VALUE="Select Another Make/Manufacturer"></TD>
</TR>
<SMALL>(Human-readable location such as "Lab 1")</SMALL></TD>
</TR>
<TR>
+<TH CLASS="label">Sharing:</TH>
+<TD><INPUT TYPE="CHECKBOX" NAME="PRINTER_IS_SHARED" {PRINTER_IS_SHARED=1?CHECKED:}">
+Share This Printer</TD>
+</TR>
+<TR>
<TR>
<TD></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="Continue"></TD>