From f11a948a02771f78f50b530880a0269d4b4f58eb Mon Sep 17 00:00:00 2001
From: msweet
Date: Fri, 8 May 2009 18:38:44 +0000
Subject: [PATCH] Merge changes from CUPS 1.4svn-r8606.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1480 a1ca3aef-8c08-0410-bb20-df032aa958be
---
CHANGES-1.3.txt | 10 +
CHANGES.txt | 12 +-
INSTALL.txt | 5 +-
Makefile | 42 +-
backend/ipp.c | 93 +-
backend/usb-darwin.c | 55 +-
cgi-bin/Dependencies | 3 +
cgi-bin/Makefile | 16 +-
cgi-bin/ipp-var.c | 26 +-
cgi-bin/makedocset.c | 478 +++++
cgi-bin/var.c | 12 +
config-scripts/cups-ssl.m4 | 8 +-
cups/Makefile | 54 +-
cups/adminutil.c | 2 +
cups/auth.c | 94 +-
cups/cups.h | 11 +
cups/debug.c | 19 +-
cups/debug.h | 1 +
cups/emit.c | 75 +-
cups/getdevices.c | 3 +
cups/getputfile.c | 6 +
cups/globals.c | 2 +-
cups/globals.h | 3 +-
cups/http-support.c | 7 +-
cups/http.c | 84 +-
cups/http.h | 5 +-
cups/ipp.c | 2 +-
cups/language.c | 18 +-
cups/libcups.exp | 2 +
cups/localize.c | 80 +-
cups/options.c | 24 +-
cups/page.c | 14 +-
cups/request.c | 11 +-
cups/test.ppd | 2 +
cups/testppd.c | 41 +
cups/transcode.c | 4 +-
cups/usersys.c | 63 +-
doc/Makefile | 33 +-
doc/cups-printable.css | 4 +
doc/favicon.png | Bin 2271 -> 0 bytes
doc/help/api-array.html | 4 +
doc/help/api-cgi.html | 1021 +++++++++
doc/help/api-cups.html | 63 +
doc/help/api-driver.html | 1096 ++++++++++
doc/help/api-filedir.html | 4 +
doc/help/api-filter.html | 4 +
doc/help/api-httpipp.html | 148 +-
doc/help/api-mime.html | 715 +++++++
doc/help/api-overview.html | 4 +
doc/help/api-ppd.html | 22 +-
doc/help/api-ppdc.html | 2121 +++++++++++++++++++
doc/help/api-raster.html | 60 +-
doc/help/postscript-driver.html | 4 +
doc/help/ppd-compiler.html | 4 +
doc/help/raster-driver.html | 4 +
doc/help/ref-classes-conf.html | 46 -
driver/Makefile | 3 +
filter/Makefile | 22 +-
filter/bannertops.c | 6 +-
locale/cups_ja.po | 3477 +++----------------------------
man/classes.conf.man | 10 +-
man/printers.conf.man | 4 +-
packaging/cups.spec.in | 2 +
ppdc/Makefile | 26 +-
ppdc/ppdc-driver.cxx | 53 +-
ppdc/ppdc-import.cxx | 103 +-
ppdc/sample.drv | 11 +-
scheduler/Makefile | 5 +-
scheduler/auth.c | 4 +
scheduler/classes.c | 11 +-
scheduler/client.c | 135 +-
scheduler/client.h | 4 +-
scheduler/conf.c | 27 +-
scheduler/conf.h | 4 +-
scheduler/dirsvc.c | 28 +-
scheduler/ipp.c | 35 +-
scheduler/job.c | 22 +-
scheduler/job.h | 4 +-
scheduler/main.c | 14 +-
scheduler/network.c | 2 +-
scheduler/printers.c | 17 +-
scheduler/printers.h | 4 +-
scheduler/type.c | 75 +-
systemv/Makefile | 10 +-
test/run-stp-tests.sh | 3 +
tools/makedocset | 72 -
86 files changed, 7075 insertions(+), 3862 deletions(-)
create mode 100644 cgi-bin/makedocset.c
delete mode 100644 doc/favicon.png
create mode 100644 doc/help/api-cgi.html
create mode 100644 doc/help/api-driver.html
create mode 100644 doc/help/api-mime.html
create mode 100644 doc/help/api-ppdc.html
diff --git a/CHANGES-1.3.txt b/CHANGES-1.3.txt
index 644ff8b33..709f815de 100644
--- a/CHANGES-1.3.txt
+++ b/CHANGES-1.3.txt
@@ -3,6 +3,16 @@ CHANGES-1.3.txt
CHANGES IN CUPS V1.3.11
+ - The web interface could hang on OpenBSD (STR #3176)
+ - The scheduler and cupsfilter utility did not handle rules starting
+ with a negation operator properly (STR #3160)
+ - The scheduler and cupsfilter utility would crash with certain MIME
+ .types rules (STR #3159)
+ - httpSetField wasn't bracketing IPv6 numeric addresses for the Host:
+ field (STR #3164)
+ - The ServerName, if specified, was not treated as a valid alias for the
+ local system (STR #3167)
+ - "make epm" did not work (STR #3166)
- "lpstat -h server" showed non-shared printers (STR #3147)
- "make check" did not work on Linux (STR #3161)
diff --git a/CHANGES.txt b/CHANGES.txt
index 93a428e1f..dcf311820 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,4 @@
-CHANGES.txt - 2009-04-21
+CHANGES.txt - 2009-05-08
------------------------
CHANGES IN CUPS V1.4b3
@@ -8,6 +8,16 @@ CHANGES IN CUPS V1.4b3
Russian and partial localizations for Chinese, Danish, Finnish,
French, Italian, Korean, Norwegian, Portuguese, and Swedish
(STR #3096, STR #3098, STR #3109, STR #3111, STR #3141)
+ - Fixed a number of ppdi issues and added a unit test to validate that
+ ppdc + ppdi can generate and import the same data (STR #3152)
+ - Moving jobs in the web interface now shows an error if you only have
+ one printer or class added (STR #3094)
+ - Since classes have never truly supported the printer-error-policy
+ stuff added in CUPS 1.2, update the code to reflect the current
+ reality and support only the retry-current-job policy for now
+ (STR #3171)
+ - Revised the password callback support (STR #2953)
+ - ppdEmit*() did not choose between PageSize and PageRegion properly.
- Make some fairly substantial changes to the Kerberos support code so
that CUPS can work in multi-realm environments and does not require
delegatable credentials. Shared printing still requires delegation,
diff --git a/INSTALL.txt b/INSTALL.txt
index fbc2b3c39..ea7aba67e 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -186,8 +186,9 @@ GETTING DEBUG LOGGING FROM CUPS
which messages are logged.
CUPS_DEBUG_LEVEL Specifies a number from 0 to 9 to control the
verbosity of the logging. The default level is 1.
- CUPS_DEBUG_LOG Specifies a log file to append to; use the name "-"
- to send the messages to stderr.
+ CUPS_DEBUG_LOG Specifies a log file to use. Specify the name "-"
+ to send the messages to stderr. Prefix a filename
+ with "+" to append to an existing file.
REPORTING PROBLEMS
diff --git a/Makefile b/Makefile
index fb892d04c..5a1f8b4a0 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
-# Copyright 2007-2008 by Apple Inc.
+# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -333,16 +333,52 @@ uninstall:
# Run the test suite...
#
-test: all
+test: all unittests
echo Running CUPS test suite...
cd test; ./run-stp-tests.sh
-check: all
+check: all unittests
echo Running CUPS test suite with defaults...
cd test; ./run-stp-tests.sh 1 0 n
+#
+# Create an Xcode docset...
+#
+
+apihelp:
+ for dir in cgi-bin cups filter driver ppdc scheduler; do\
+ echo Generating API help in $$dir... ;\
+ (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
+ done
+
+framedhelp:
+ for dir in cgi-bin cups filter driver ppdc scheduler; do\
+ echo Generating framed API help in $$dir... ;\
+ (cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
+ done
+
+docset: apihelp
+ echo Generating docset directory tree...
+ $(RM) -r org.cups.docset
+ mkdir -p org.cups.docset/Contents/Resources/Documentation/help
+ mkdir -p org.cups.docset/Contents/Resources/Documentation/images
+ cd doc; $(MAKE) $(MFLAGS) docset
+ cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
+ cgi-bin/makedocset org.cups.docset \
+ `svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
+ doc/help/api-*.tokens
+ $(RM) doc/help/api-*.tokens
+ echo Indexing docset...
+ /Developer/usr/bin/docsetutil index org.cups.docset
+ echo Generating docset archive and feed...
+ /Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
+ --atom org.cups.docset.atom \
+ --download-url http://www.cups.org/org.cups.docset.xar \
+ org.cups.docset
+
+
#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
#
diff --git a/backend/ipp.c b/backend/ipp.c
index f71d6186c..aa7878c64 100644
--- a/backend/ipp.c
+++ b/backend/ipp.c
@@ -143,7 +143,9 @@ main(int argc, /* I - Number of command-line args */
"copies-supported",
"document-format-supported",
"marker-colors",
+ "marker-high-levels",
"marker-levels",
+ "marker-low-levels",
"marker-message",
"marker-names",
"marker-types",
@@ -1629,11 +1631,8 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
*reasons, /* printer-state-reasons */
*marker; /* marker-* attributes */
const char *reason; /* Current reason */
- const char *message; /* Message to show */
- char unknown[1024]; /* Unknown message string */
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 */
@@ -1648,96 +1647,24 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
saw_caprw = 0;
state[0] = '\0';
prefix = "STATE: ";
- language = cupsLangDefault();
for (i = 0, count = 0; i < reasons->num_values; i ++)
{
reason = reasons->values[i].string.text;
- if (strcmp(reason, "paused"))
+ if (!strcmp(reason, "com.apple.print.recoverable-warning"))
+ saw_caprw = 1;
+ else if (strcmp(reason, "paused"))
{
strlcat(state, prefix, sizeof(state));
strlcat(state, reason, sizeof(state));
prefix = ",";
}
-
- message = "";
-
- if (!strncmp(reason, "media-needed", 12))
- message = _("Media tray needs to be filled.");
- else if (!strncmp(reason, "media-jam", 9))
- message = _("Media jam!");
- else if (!strncmp(reason, "moving-to-paused", 16) ||
- !strncmp(reason, "offline", 7) ||
- !strncmp(reason, "paused", 6) ||
- !strncmp(reason, "shutdown", 8))
- message = _("Printer offline.");
- else if (!strncmp(reason, "toner-low", 9))
- message = _("Toner low.");
- else if (!strncmp(reason, "toner-empty", 11))
- message = _("Out of toner!");
- else if (!strncmp(reason, "cover-open", 10))
- message = _("Cover open.");
- else if (!strncmp(reason, "interlock-open", 14))
- message = _("Interlock open.");
- else if (!strncmp(reason, "door-open", 9))
- message = _("Door open.");
- else if (!strncmp(reason, "input-tray-missing", 18))
- message = _("Media tray missing!");
- else if (!strncmp(reason, "media-low", 9))
- message = _("Media tray almost empty.");
- else if (!strncmp(reason, "media-empty", 11))
- message = _("Media tray empty!");
- else if (!strncmp(reason, "output-tray-missing", 19))
- message = _("Output tray missing!");
- else if (!strncmp(reason, "output-area-almost-full", 23))
- message = _("Output bin almost full.");
- else if (!strncmp(reason, "output-area-full", 16))
- message = _("Output bin full!");
- else if (!strncmp(reason, "marker-supply-low", 17))
- message = _("Ink/toner almost empty.");
- else if (!strncmp(reason, "marker-supply-empty", 19))
- message = _("Ink/toner empty!");
- else if (!strncmp(reason, "marker-waste-almost-full", 24))
- message = _("Ink/toner waste bin almost full.");
- else if (!strncmp(reason, "marker-waste-full", 17))
- message = _("Ink/toner waste bin full!");
- else if (!strncmp(reason, "fuser-over-temp", 15))
- message = _("Fuser temperature high!");
- else if (!strncmp(reason, "fuser-under-temp", 16))
- message = _("Fuser temperature low!");
- else if (!strncmp(reason, "opc-near-eol", 12))
- message = _("OPC almost at end-of-life.");
- else if (!strncmp(reason, "opc-life-over", 13))
- message = _("OPC at end-of-life!");
- else if (!strncmp(reason, "developer-low", 13))
- 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;
-
- snprintf(unknown, sizeof(unknown), _("Unknown printer error (%s)!"),
- reason);
- }
-
- if (message[0])
- {
- count ++;
- if (strstr(reasons->values[i].string.text, "error"))
- fprintf(stderr, "ERROR: %s\n", _cupsLangString(language, message));
- else if (strstr(reasons->values[i].string.text, "warning"))
- fprintf(stderr, "WARNING: %s\n", _cupsLangString(language, message));
- else
- fprintf(stderr, "INFO: %s\n", _cupsLangString(language, message));
- }
}
- fprintf(stderr, "%s\n", state);
+ if (state[0])
+ fprintf(stderr, "%s\n", state);
/*
* Relay com.apple.print.recoverable-message...
@@ -1755,9 +1682,15 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
report_attr(marker);
+ if ((marker = ippFindAttribute(ipp, "marker-high-levels",
+ IPP_TAG_INTEGER)) != NULL)
+ report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
+ if ((marker = ippFindAttribute(ipp, "marker-low-levels",
+ IPP_TAG_INTEGER)) != NULL)
+ report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c
index fe2dabdd3..8d3fe4f81 100644
--- a/backend/usb-darwin.c
+++ b/backend/usb-darwin.c
@@ -279,10 +279,11 @@ static void soft_reset();
static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
#if defined(__i386__) || defined(__x86_64__)
-static pid_t child_pid; /* Child PID */
+static pid_t child_pid; /* Child PID */
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
-static void sigterm_handler(int sig); /* SIGTERM handler */
#endif /* __i386__ || __x86_64__ */
+static int job_canceled = 0; /* Was the job canceled? */
+static void sigterm_handler(int sig); /* SIGTERM handler */
#ifdef PARSE_PS_ERRORS
static const char *next_line (const char *buffer);
@@ -448,9 +449,9 @@ print_device(const char *uri, /* I - Device URI */
fputs("STATE: -connecting-to-device\n", stderr);
/*
- * Now that we are "connected" to the port, ignore SIGTERM so that we
+ * Now that we are "connected" to the port, catch SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
- * current page... Only ignore SIGTERM if we are printing data from
+ * current page... Only catch SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
@@ -462,7 +463,7 @@ print_device(const char *uri, /* I - Device URI */
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_IGN;
+ action.sa_handler = sigterm_handler;
sigaction(SIGTERM, &action, NULL);
}
@@ -582,13 +583,13 @@ print_device(const char *uri, /* I - Device URI */
{
fputs("DEBUG: Received an interrupt before any bytes were "
"written, aborting!\n", stderr);
- return (0);
+ return (CUPS_BACKEND_OK);
}
else if (errno != EAGAIN)
{
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
perror("DEBUG: select");
- return (CUPS_BACKEND_STOP);
+ return (CUPS_BACKEND_FAILED);
}
}
@@ -621,7 +622,7 @@ print_device(const char *uri, /* I - Device URI */
{
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
perror("DEBUG: read");
- return CUPS_BACKEND_STOP;
+ return (CUPS_BACKEND_FAILED);
}
g.print_bytes = 0;
@@ -667,7 +668,7 @@ print_device(const char *uri, /* I - Device URI */
(long)status);
fprintf(stderr, "DEBUG: USB class driver Abort returned %ld\n",
(long)err);
- status = CUPS_BACKEND_STOP;
+ status = job_canceled ? CUPS_BACKEND_FAILED : CUPS_BACKEND_STOP;
break;
}
@@ -1910,23 +1911,47 @@ static void run_legacy_backend(int argc,
exit(exitstatus);
}
+#endif /* __i386__ || __x86_64__ */
+
/*
* 'sigterm_handler()' - SIGTERM handler.
*/
-static void sigterm_handler(int sig)
+static void
+sigterm_handler(int sig) /* I - Signal */
{
- /* If we started a child process pass the signal on to it...
- */
+#if defined(__i386__) || defined(__x86_64__)
if (child_pid)
- kill(child_pid, sig);
+ {
+ /*
+ * If we started a child process pass the signal on to it...
+ */
- exit(1);
-}
+ int status;
+
+ kill(child_pid, sig);
+ while (waitpid(child_pid, &status, 0) < 0 && errno == EINTR);
+ if (WIFEXITED(status))
+ exit(WEXITSTATUS(status));
+ else if (status == SIGTERM || status == SIGKILL)
+ exit(0);
+ else
+ {
+ fprintf(stderr, "DEBUG: Child crashed on signal %d!\n", status);
+ exit(CUPS_BACKEND_STOP);
+ }
+ }
#endif /* __i386__ || __x86_64__ */
+ /*
+ * Otherwise just flag that the job has been canceled...
+ */
+
+ job_canceled = 1;
+}
+
#ifdef PARSE_PS_ERRORS
/*
diff --git a/cgi-bin/Dependencies b/cgi-bin/Dependencies
index c417e9693..f018cd0a0 100644
--- a/cgi-bin/Dependencies
+++ b/cgi-bin/Dependencies
@@ -42,6 +42,9 @@ jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
jobs.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
jobs.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
jobs.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
+makedocset.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+makedocset.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
+makedocset.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
printers.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
printers.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
diff --git a/cgi-bin/Makefile b/cgi-bin/Makefile
index 3e1a59aaa..b51b4c06c 100644
--- a/cgi-bin/Makefile
+++ b/cgi-bin/Makefile
@@ -28,6 +28,7 @@ OBJS = \
classes.o \
help.o \
jobs.o \
+ makedocset.o \
printers.o \
testcgi.o \
testhi.o \
@@ -80,7 +81,7 @@ unittests: $(UNITTARGETS)
#
clean:
- $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
+ $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS) makedocset
$(RM) libcupscgi.so libcupscgi.sl libcupscgi.dylib
@@ -194,6 +195,8 @@ apihelp:
--css ../doc/cups-printable.css \
--header api-cgi.header --intro api-cgi.shtml \
cgi.h help-index.h $(LIBOBJS:.o=.c) >../doc/help/api-cgi.html
+ mxmldoc --tokens help/api-cgi.html api-cgi.xml >../doc/help/api-cgi.tokens
+ $(RM) api-cgi.xml
framedhelp:
mxmldoc --framed api-cgi \
@@ -299,6 +302,17 @@ jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
+#
+# makedocset
+#
+
+makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/libcups.a
+ echo Linking $@...
+ $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
+ ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
+ $(LIBZ) $(LIBGSSAPI)
+
+
#
# printers.cgi
#
diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c
index 4048dd605..1b63056fa 100644
--- a/cgi-bin/ipp-var.c
+++ b/cgi-bin/ipp-var.c
@@ -288,8 +288,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
* See who is logged in...
*/
- if ((user = getenv("REMOTE_USER")) == NULL)
- user = "guest";
+ user = getenv("REMOTE_USER");
/*
* See if the user has already selected a new destination...
@@ -374,8 +373,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-uri-supported");
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
- "requesting-user-name", NULL, user);
+ if (user)
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, user);
+
+ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
+ CUPS_PRINTER_LOCAL);
+ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
+ CUPS_PRINTER_SCANNER);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -415,7 +420,18 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
else
cgiStartHTML(cgiText(_("Move All Jobs")));
- cgiCopyTemplateLang("job-move.tmpl");
+ if (cgiGetSize("JOB_PRINTER_NAME") > 0)
+ cgiCopyTemplateLang("job-move.tmpl");
+ else
+ {
+ if (job_id)
+ cgiSetVariable("MESSAGE", cgiText(_("Unable to move job")));
+ else
+ cgiSetVariable("MESSAGE", cgiText(_("Unable to move jobs")));
+
+ cgiSetVariable("ERROR", cgiText(_("No destinations added.")));
+ cgiCopyTemplateLang("error.tmpl");
+ }
}
else
{
diff --git a/cgi-bin/makedocset.c b/cgi-bin/makedocset.c
new file mode 100644
index 000000000..807c1f60f
--- /dev/null
+++ b/cgi-bin/makedocset.c
@@ -0,0 +1,478 @@
+/*
+ * "$Id$"
+ *
+ * Xcode documentation set generator.
+ *
+ * Copyright 2007-2009 by Apple Inc.
+ * Copyright 1997-2007 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/".
+ *
+ * Usage:
+ *
+ * makedocset directory *.tokens
+ *
+ * Contents:
+ *
+ * main() - Test the help index code.
+ * compare_html() - Compare the titles of two HTML files.
+ * compare_sections() - Compare the names of two help sections.
+ * compare_sections_files() - Compare the number of files and section names.
+ * write_index() - Write an index file for the CUPS help.
+ * write_info() - Write the Info.plist file.
+ * write_nodes() - Write the Nodes.xml file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "cgi.h"
+#include
+
+
+/*
+ * Local structures...
+ */
+
+typedef struct _cups_html_s /**** Help file ****/
+{
+ char *path; /* Path to help file */
+ char *title; /* Title of help file */
+} _cups_html_t;
+
+typedef struct _cups_section_s /**** Help section ****/
+{
+ char *name; /* Section name */
+ cups_array_t *files; /* Files in this section */
+} _cups_section_t;
+
+
+/*
+ * Local functions...
+ */
+
+static int compare_html(_cups_html_t *a, _cups_html_t *b);
+static int compare_sections(_cups_section_t *a, _cups_section_t *b);
+static int compare_sections_files(_cups_section_t *a, _cups_section_t *b);
+static void write_index(const char *path, help_index_t *hi);
+static void write_info(const char *path, const char *revision);
+static void write_nodes(const char *path, help_index_t *hi);
+
+
+/*
+ * 'main()' - Test the help index code.
+ */
+
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line args */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int i; /* Looping var */
+ char path[1024], /* Path to documentation */
+ line[1024]; /* Line from file */
+ help_index_t *hi; /* Help index */
+ cups_file_t *tokens, /* Tokens.xml file */
+ *fp; /* Current file */
+
+
+ if (argc < 4)
+ {
+ puts("Usage: makedocset directory revision *.tokens");
+ return (1);
+ }
+
+ /*
+ * Index the help documents...
+ */
+
+ snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation", argv[1]);
+ if ((hi = helpLoadIndex(NULL, path)) == NULL)
+ {
+ fputs("makedocset: Unable to index help files!\n", stderr);
+ return (1);
+ }
+
+ snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation/index.html",
+ argv[1]);
+ write_index(path, hi);
+
+ snprintf(path, sizeof(path), "%s/Contents/Resources/Nodes.xml", argv[1]);
+ write_nodes(path, hi);
+
+ /*
+ * Write the Info.plist file...
+ */
+
+ snprintf(path, sizeof(path), "%s/Contents/Info.plist", argv[1]);
+ write_info(path, argv[2]);
+
+ /*
+ * Merge the Tokens.xml files...
+ */
+
+ snprintf(path, sizeof(path), "%s/Contents/Resources/Tokens.xml", argv[1]);
+ if ((tokens = cupsFileOpen(path, "w")) == NULL)
+ {
+ fprintf(stderr, "makedocset: Unable to create \"%s\": %s\n", path,
+ strerror(errno));
+ return (1);
+ }
+
+ cupsFilePuts(tokens, "\n");
+ cupsFilePuts(tokens, "\n");
+
+ for (i = 3; i < argc; i ++)
+ {
+ if ((fp = cupsFileOpen(argv[i], "r")) == NULL)
+ {
+ fprintf(stderr, "makedocset: Unable to open \"%s\": %s\n", argv[i],
+ strerror(errno));
+ return (1);
+ }
+
+ if (!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, ""))
+ cupsFilePrintf(tokens, "%s\n", line);
+ }
+
+ cupsFileClose(fp);
+ }
+
+ cupsFilePuts(tokens, " \n");
+
+ cupsFileClose(tokens);
+
+ /*
+ * Return with no errors...
+ */
+
+ return (0);
+}
+
+
+/*
+ * 'compare_html()' - Compare the titles of two HTML files.
+ */
+
+static int /* O - Result of comparison */
+compare_html(_cups_html_t *a, /* I - First file */
+ _cups_html_t *b) /* I - Second file */
+{
+ return (strcasecmp(a->title, b->title));
+}
+
+
+/*
+ * 'compare_sections()' - Compare the names of two help sections.
+ */
+
+static int /* O - Result of comparison */
+compare_sections(_cups_section_t *a, /* I - First section */
+ _cups_section_t *b) /* I - Second section */
+{
+ return (strcasecmp(a->name, b->name));
+}
+
+
+/*
+ * 'compare_sections_files()' - Compare the number of files and section names.
+ */
+
+static int /* O - Result of comparison */
+compare_sections_files(
+ _cups_section_t *a, /* I - First section */
+ _cups_section_t *b) /* I - Second section */
+{
+ int ret = cupsArrayCount(b->files) - cupsArrayCount(a->files);
+
+ if (ret)
+ return (ret);
+ else
+ return (strcasecmp(a->name, b->name));
+}
+
+
+/*
+ * 'write_index()' - Write an index file for the CUPS help.
+ */
+
+static void
+write_index(const char *path, /* I - File to write */
+ help_index_t *hi) /* I - Index of files */
+{
+ cups_file_t *fp; /* Output file */
+ help_node_t *node; /* Current help node */
+ _cups_section_t *section, /* Current section */
+ key; /* Section search key */
+ _cups_html_t *html; /* Current HTML file */
+ cups_array_t *sections, /* Sections in index */
+ *sections_files,/* Sections sorted by size */
+ *columns[3]; /* Columns in final HTML file */
+ int column, /* Current column */
+ lines[3], /* Number of lines in each column */
+ min_column, /* Smallest column */
+ min_lines; /* Smallest number of lines */
+
+
+ /*
+ * Build an array of sections and their files.
+ */
+
+ sections = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
+
+ for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
+ node;
+ node = (help_node_t *)cupsArrayNext(hi->nodes))
+ {
+ if (node->anchor)
+ continue;
+
+ key.name = node->section ? node->section : "Miscellaneous";
+ if ((section = (_cups_section_t *)cupsArrayFind(sections, &key)) == NULL)
+ {
+ section = (_cups_section_t *)calloc(1, sizeof(_cups_section_t));
+ section->name = key.name;
+ section->files = cupsArrayNew((cups_array_func_t)compare_html, NULL);
+
+ cupsArrayAdd(sections, section);
+ }
+
+ html = (_cups_html_t *)calloc(1, sizeof(_cups_html_t));
+ html->path = node->filename;
+ html->title = node->text;
+
+ cupsArrayAdd(section->files, html);
+ }
+
+ /*
+ * Build a sorted list of sections based on the number of files in each section
+ * and the section name...
+ */
+
+ sections_files = cupsArrayNew((cups_array_func_t)compare_sections_files,
+ NULL);
+ for (section = (_cups_section_t *)cupsArrayFirst(sections);
+ section;
+ section = (_cups_section_t *)cupsArrayNext(sections))
+ cupsArrayAdd(sections_files, section);
+
+ /*
+ * Then build three columns to hold everything, trying to balance the number of
+ * lines in each column...
+ */
+
+ for (column = 0; column < 3; column ++)
+ {
+ columns[column] = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
+ lines[column] = 0;
+ }
+
+ for (section = (_cups_section_t *)cupsArrayFirst(sections_files);
+ section;
+ section = (_cups_section_t *)cupsArrayNext(sections_files))
+ {
+ for (min_column = 0, min_lines = lines[0], column = 1;
+ column < 3;
+ column ++)
+ {
+ if (lines[column] < min_lines)
+ {
+ min_column = column;
+ min_lines = lines[column];
+ }
+ }
+
+ cupsArrayAdd(columns[min_column], section);
+ lines[min_column] += cupsArrayCount(section->files) + 2;
+ }
+
+ /*
+ * Write the HTML file...
+ */
+
+ if ((fp = cupsFileOpen(path, "w")) == NULL)
+ {
+ fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
+ strerror(errno));
+ exit(1);
+ }
+
+ cupsFilePuts(fp, "\n"
+ "\n"
+ "\n"
+ "CUPS Documentation \n"
+ " \n"
+ "\n"
+ "\n"
+ "CUPS Documentation \n"
+ "\n"
+ "\n");
+
+ for (column = 0; column < 3; column ++)
+ {
+ if (column)
+ cupsFilePuts(fp, " \n");
+
+ cupsFilePuts(fp, "");
+ for (section = (_cups_section_t *)cupsArrayFirst(columns[column]);
+ section;
+ section = (_cups_section_t *)cupsArrayNext(columns[column]))
+ {
+ cupsFilePrintf(fp, "%s \n", section->name);
+ for (html = (_cups_html_t *)cupsArrayFirst(section->files);
+ html;
+ html = (_cups_html_t *)cupsArrayNext(section->files))
+ cupsFilePrintf(fp, "%s
\n",
+ html->path, html->title);
+ }
+ cupsFilePuts(fp, " \n");
+ }
+ cupsFilePuts(fp, " \n"
+ "
\n"
+ "\n"
+ "\n");
+ cupsFileClose(fp);
+}
+
+
+/*
+ * 'write_info()' - Write the Info.plist file.
+ */
+
+static void
+write_info(const char *path, /* I - File to write */
+ const char *revision) /* I - Version number */
+{
+ cups_file_t *fp; /* File */
+
+
+ if ((fp = cupsFileOpen(path, "w")) == NULL)
+ {
+ fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
+ strerror(errno));
+ exit(1);
+ }
+
+ cupsFilePrintf(fp, "\n"
+ "\n"
+ "\n"
+ "\n"
+ "\tCFBundleIdentifier \n"
+ "\torg.cups.docset \n"
+ "\tCFBundleName \n"
+ "\tCUPS Documentation \n"
+ "\tCFBundleVersion \n"
+ "\t1.4.%s \n"
+ "\tDocSetFeedName \n"
+ "\tcups.org \n"
+ "\tDocSetFeedURL \n"
+ "\thttp://www.cups.org/org.cups.docset.xar"
+ " \n"
+ " \n"
+ " \n", revision);
+
+ cupsFileClose(fp);
+}
+
+
+/*
+ * 'write_nodes()' - Write the Nodes.xml file.
+ */
+
+static void
+write_nodes(const char *path, /* I - File to write */
+ help_index_t *hi) /* I - Index of files */
+{
+ cups_file_t *fp; /* Output file */
+ int id; /* Current node ID */
+ help_node_t *node; /* Current help node */
+ int subnodes; /* Currently in Subnodes for file? */
+ int needclose; /* Need to close the current node? */
+
+
+ if ((fp = cupsFileOpen(path, "w")) == NULL)
+ {
+ fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
+ strerror(errno));
+ exit(1);
+ }
+
+ cupsFilePuts(fp, "\n"
+ "\n"
+ "\n"
+ "\n"
+ "CUPS Documentation \n"
+ "Documentation/index.html \n"
+ " \n");
+
+ for (node = (help_node_t *)cupsArrayFirst(hi->nodes), id = 1, subnodes = 0,
+ needclose = 0;
+ node;
+ node = (help_node_t *)cupsArrayNext(hi->nodes), id ++)
+ {
+ if (node->anchor)
+ {
+ if (!subnodes)
+ {
+ cupsFilePuts(fp, "\n");
+ subnodes = 1;
+ }
+
+ cupsFilePrintf(fp, "\n"
+ "Documentation/%s \n"
+ "%s \n"
+ "%s \n"
+ " \n", id, node->filename, node->anchor,
+ node->text);
+ }
+ else
+ {
+ if (subnodes)
+ {
+ cupsFilePuts(fp, " \n");
+ subnodes = 0;
+ }
+
+ if (needclose)
+ cupsFilePuts(fp, "\n");
+
+ cupsFilePrintf(fp, "\n"
+ "Documentation/%s \n"
+ "%s \n", id, node->filename, node->text);
+ needclose = 1;
+ }
+ }
+
+ if (subnodes)
+ cupsFilePuts(fp, "\n");
+
+ if (needclose)
+ cupsFilePuts(fp, " \n");
+
+ cupsFilePuts(fp, " \n"
+ " \n");
+
+ cupsFileClose(fp);
+}
+
+
+/*
+ * End of "$Id$".
+ */
diff --git a/cgi-bin/var.c b/cgi-bin/var.c
index 6470fcbfd..628ce8add 100644
--- a/cgi-bin/var.c
+++ b/cgi-bin/var.c
@@ -806,6 +806,18 @@ cgi_initialize_post(void)
else
nbytes = 0;
}
+ else if (nbytes == 0)
+ {
+ /*
+ * CUPS STR #3176: OpenBSD: Early end-of-file on POST data causes 100% CPU
+ *
+ * This should never happen, but does on OpenBSD. If we see early end-of-
+ * file, treat this as an error and process no data.
+ */
+
+ free(data);
+ return (0);
+ }
data[length] = '\0';
diff --git a/config-scripts/cups-ssl.m4 b/config-scripts/cups-ssl.m4
index a3b4ccf9d..7e20ecd90 100644
--- a/config-scripts/cups-ssl.m4
+++ b/config-scripts/cups-ssl.m4
@@ -58,11 +58,11 @@ if test x$enable_ssl != xno; then
fi
dnl Then look for GNU TLS...
- if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
+ if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
- if test "x$LIBGNUTLSCONFIG" != x; then
- SSLLIBS=`$LIBGNUTLSCONFIG --libs`
- SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
+ if $PKGCONFIG --exists gnutls; then
+ SSLLIBS=`$PKGCONFIG --libs gnutls`
+ SSLFLAGS=`$PKGCONFIG --cflags gnutls`
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
fi
diff --git a/cups/Makefile b/cups/Makefile
index 31be2be31..dbdd2b91f 100644
--- a/cups/Makefile
+++ b/cups/Makefile
@@ -548,34 +548,52 @@ apihelp:
mxmldoc --section "Programming" --title "Array API" \
--css ../doc/cups-printable.css \
--header api-array.header --intro api-array.shtml \
+ api-array.xml \
array.h array.c >../doc/help/api-array.html
+ mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
+ $(RM) api-array.xml
mxmldoc --section "Programming" --title "CUPS API" \
--css ../doc/cups-printable.css \
--header api-cups.header --intro api-cups.shtml \
+ api-cups.xml \
cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c >../doc/help/api-cups.html
+ mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
+ $(RM) api-cups.xml
mxmldoc --section "Programming" --title "File and Directory APIs" \
--css ../doc/cups-printable.css \
--header api-filedir.header --intro api-filedir.shtml \
+ api-filedir.xml \
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
+ mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
+ $(RM) api-filedir.xml
mxmldoc --section "Programming" --title "PPD API" \
--css ../doc/cups-printable.css \
--header api-ppd.header --intro api-ppd.shtml \
+ api-ppd.xml \
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
ppd.c >../doc/help/api-ppd.html
+ mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
+ $(RM) api-ppd.xml
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
--css ../doc/cups-printable.css \
--header api-httpipp.header --intro api-httpipp.shtml \
+ api-httpipp.xml \
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
http.c http-addr.c http-support.c ipp.c ipp-support.c \
md5passwd.c request.c >../doc/help/api-httpipp.html
+ mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
+ $(RM) api-httpipp.xml
mxmldoc --section "Programming" \
--title "Filter and Backend Programming" \
--css ../doc/cups-printable.css \
--header api-filter.header --intro api-filter.shtml \
+ api-filter.xml \
backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
>../doc/help/api-filter.html
+ mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
+ $(RM) api-filter.xml
framedhelp:
echo Generating CUPS API help files...
@@ -622,42 +640,6 @@ framedhelp:
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
-docsets:
- echo Generating CUPS API documentation sets...
- ../tools/makedocset --docset org.cups.overview.docset \
- --title "Introduction to CUPS Programming" \
- --header api-overview.header --intro api-overview.shtml
- ../tools/makedocset --docset org.cups.array.docset \
- --title "Array API" \
- --header api-array.header --intro api-array.shtml \
- array.h array.c
- ../tools/makedocset --docset org.cups.cups.docset \
- --title "CUPS API" \
- --header api-cups.header --intro api-cups.shtml \
- cups.h adminutil.c dest.c language.c notify.c \
- options.c tempfile.c usersys.c \
- util.c
- ../tools/makedocset --docset org.cups.filedir.docset \
- --title "File and Directory APIs" \
- --header api-filedir.header --intro api-filedir.shtml \
- file.h file.c dir.h dir.c
- ../tools/makedocset --docset org.cups.ppd.docset \
- --title "PPD API" \
- --header api-ppd.header --intro api-ppd.shtml \
- ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
- page.c ppd.c
- ../tools/makedocset --docset org.cups.httpipp.docset \
- --title "HTTP and IPP APIs" \
- --header api-httpipp.header --intro api-httpipp.shtml \
- http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
- http.c http-addr.c http-support.c ipp.c ipp-support.c \
- md5passwd.c request.c
- ../tools/makedocset --docset org.cups.filter.docset \
- --title "Filter and Backend Programming" \
- --header api-filter.header --intro api-filter.shtml \
- backchannel.c backend.h backend.c sidechannel.c sidechannel.h
-
-
#
# Dependencies...
#
diff --git a/cups/adminutil.c b/cups/adminutil.c
index a46d34f69..e2c5ea827 100644
--- a/cups/adminutil.c
+++ b/cups/adminutil.c
@@ -949,6 +949,8 @@ _cupsAdminGetServerSettings(
return (0);
}
}
+
+ http = cg->http;
}
if (!http || !num_settings || !settings)
diff --git a/cups/auth.c b/cups/auth.c
index da37c0bfc..ca877a398 100644
--- a/cups/auth.c
+++ b/cups/auth.c
@@ -83,10 +83,10 @@ static int cups_local_auth(http_t *http);
*/
int /* O - 0 on success, -1 on error */
-cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
- const char *method,/* I - Request method ("GET", "POST", "PUT") */
- const char *resource)
- /* I - Resource path */
+cupsDoAuthentication(
+ http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ const char *method, /* I - Request method ("GET", "POST", "PUT") */
+ const char *resource) /* I - Resource path */
{
const char *password; /* Password string */
char prompt[1024], /* Prompt for user */
@@ -103,6 +103,12 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
+ if (!http)
+ http = _cupsConnect();
+
+ if (!http || !method || !resource)
+ return (-1);
+
/*
* Clear the current authentication string...
*/
@@ -126,7 +132,10 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
return (0);
}
else if (localauth == -1)
+ {
+ http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1); /* Error or canceled */
+ }
}
/*
@@ -154,11 +163,17 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
"Digest", 5) != 0;
http->userpass[0] = '\0';
- if ((password = cupsGetPassword(prompt)) == NULL)
+ if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
+ {
+ http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
+ }
if (!password[0])
+ {
+ http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
+ }
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
password);
@@ -201,6 +216,8 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
{
DEBUG_puts("1cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
"is not present");
+ http->status = HTTP_AUTHORIZATION_CANCELED;
+
return (-1);
}
# endif /* __APPLE__ */
@@ -209,6 +226,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
{
DEBUG_printf(("1cupsDoAuthentication: too many Negotiate tries (%d)",
http->digest_tries));
+ http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
@@ -295,6 +313,8 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
cups_gss_printf(major_status, minor_status,
"cupsDoAuthentication: Unable to initialize security "
"context");
+ http->status = HTTP_AUTHORIZATION_CANCELED;
+
return (-1);
}
@@ -331,7 +351,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
{
DEBUG_printf(("1cupsDoAuthentication: Kerberos credentials too large - "
"%d bytes!", (int)output_token.length));
-
+ http->status = HTTP_AUTHORIZATION_CANCELED;
gss_release_buffer(&minor_status, &output_token);
return (-1);
@@ -595,6 +615,37 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
}
# endif /* HAVE_AUTHORIZATION_H */
+# if defined(SO_PEERCRED) && defined(AF_LOCAL)
+ /*
+ * See if we can authenticate using the peer credentials provided over a
+ * domain socket; if so, specify "PeerCred username" as the authentication
+ * information...
+ */
+
+ if (http->hostaddr->addr.sa_family == AF_LOCAL &&
+ !getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
+ {
+ /*
+ * Verify that the current cupsUser() matches the current UID...
+ */
+
+ struct passwd *pwd; /* Password information */
+ const char *username; /* Current username */
+
+ username = cupsUser();
+
+ if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
+ {
+ httpSetAuthString(http, "PeerCred", username);
+
+ DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
+ http->authstring));
+
+ return (0);
+ }
+ }
+# endif /* SO_PEERCRED && AF_LOCAL */
+
/*
* Try opening a certificate file for this PID. If that fails,
* try the root certificate...
@@ -657,37 +708,6 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
return (0);
}
-# if defined(SO_PEERCRED) && defined(AF_LOCAL)
- /*
- * See if we can authenticate using the peer credentials provided over a
- * domain socket; if so, specify "PeerCred username" as the authentication
- * information...
- */
-
- if (http->hostaddr->addr.sa_family == AF_LOCAL &&
- !getenv("GATEWAY_INTERFACE")) /* Not via CGI programs... */
- {
- /*
- * Verify that the current cupsUser() matches the current UID...
- */
-
- struct passwd *pwd; /* Password information */
- const char *username; /* Current username */
-
- username = cupsUser();
-
- if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
- {
- httpSetAuthString(http, "PeerCred", username);
-
- DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
- http->authstring));
-
- return (0);
- }
- }
-# endif /* SO_PEERCRED && AF_LOCAL */
-
return (1);
#endif /* WIN32 || __EMX__ */
}
diff --git a/cups/cups.h b/cups/cups.h
index 8836aab94..a4f92e877 100644
--- a/cups/cups.h
+++ b/cups/cups.h
@@ -125,6 +125,12 @@ enum cups_ptype_e /**** Printer type/capability bit constants ****/
typedef const char *(*cups_password_cb_t)(const char *prompt);
/**** Password callback ****/
+typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
+ const char *method,
+ const char *resource,
+ void *user_data);
+ /**** New password callback @since CUPS 1.4@ ****/
+
typedef void (*cups_device_cb_t)(const char *device_class,
const char *device_id, const char *device_info,
const char *device_make_and_model,
@@ -294,6 +300,9 @@ extern ipp_status_t cupsGetDevices(http_t *http, int timeout,
void *user_data) _CUPS_API_1_4;
extern cups_dest_t *cupsGetNamedDest(http_t *http, const char *name,
const char *instance) _CUPS_API_1_4;
+extern const char *cupsGetPassword2(const char *prompt, http_t *http,
+ const char *method,
+ const char *resource) _CUPS_API_1_4;
extern http_status_t cupsGetPPD3(http_t *http, const char *name,
time_t *modtime, char *buffer,
size_t bufsize) _CUPS_API_1_4;
@@ -309,6 +318,8 @@ extern int cupsResolveConflicts(ppd_file_t *ppd, const char *option,
extern http_status_t cupsSendRequest(http_t *http, ipp_t *request,
const char *resource,
size_t length) _CUPS_API_1_4;
+extern void cupsSetPasswordCB2(cups_password_cb2_t cb,
+ void *user_data) _CUPS_API_1_4;
extern http_status_t cupsStartDocument(http_t *http, const char *name,
int job_id, const char *docname,
const char *format,
diff --git a/cups/debug.c b/cups/debug.c
index cd622c961..74f77ffd4 100644
--- a/cups/debug.c
+++ b/cups/debug.c
@@ -38,6 +38,8 @@
int _cups_debug_fd = -1;
/* Debug log file descriptor */
+int _cups_debug_level = 1;
+ /* Log level (0 to 9) */
#ifdef DEBUG
@@ -47,9 +49,8 @@ int _cups_debug_fd = -1;
static regex_t *debug_filter = NULL;
/* Filter expression for messages */
-static int debug_init = 1; /* Did we initialize debugging? */
+static int debug_init = 0; /* Did we initialize debugging? */
# ifdef HAVE_PTHREAD_H
-static int debug_level = 0;/* Log level (0 to 9) */
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Mutex to control initialization */
# endif /* HAVE_PTHREAD_H */
@@ -420,8 +421,6 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
if (!debug_init)
{
- debug_init = 1;
-
if ((cups_debug_log = getenv("CUPS_DEBUG_LOG")) == NULL)
_cups_debug_fd = -1;
else if (!strcmp(cups_debug_log, "-"))
@@ -429,11 +428,15 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
else
{
snprintf(buffer, sizeof(buffer), cups_debug_log, getpid());
- _cups_debug_fd = open(buffer, O_WRONLY | O_APPEND | O_CREAT, 0644);
+
+ if (buffer[0] == '+')
+ _cups_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644);
+ else
+ _cups_debug_fd = open(buffer, O_WRONLY | O_TRUNC | O_CREAT, 0644);
}
if ((cups_debug_level = getenv("CUPS_DEBUG_LEVEL")) != NULL)
- debug_level = atoi(cups_debug_level);
+ _cups_debug_level = atoi(cups_debug_level);
if ((cups_debug_filter = getenv("CUPS_DEBUG_FILTER")) != NULL)
{
@@ -448,6 +451,8 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
debug_filter = NULL;
}
}
+
+ debug_init = 1;
}
pthread_mutex_unlock(&debug_mutex);
@@ -465,7 +470,7 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
else
level = 0;
- if (level > debug_level)
+ if (level > _cups_debug_level)
return;
if (debug_filter)
diff --git a/cups/debug.h b/cups/debug.h
index e13335bfc..e051be4f7 100644
--- a/cups/debug.h
+++ b/cups/debug.h
@@ -70,6 +70,7 @@ extern "C" {
*/
extern int _cups_debug_fd;
+extern int _cups_debug_level;
extern void _cups_debug_printf(const char *format, ...)
#ifdef __GNUC__
__attribute__ ((__format__ (__printf__, 1, 2)))
diff --git a/cups/emit.c b/cups/emit.c
index 922c8b917..82c07f66e 100644
--- a/cups/emit.c
+++ b/cups/emit.c
@@ -1111,17 +1111,32 @@ static void
ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */
{
ppd_choice_t *manual_feed, /* ManualFeed choice, if any */
- *input_slot, /* InputSlot choice, if any */
- *page; /* PageSize/PageRegion */
+ *input_slot; /* InputSlot choice, if any */
ppd_size_t *size; /* Current media size */
ppd_attr_t *rpr; /* RequiresPageRegion value */
/*
- * This function determines if the user has selected a media source
- * via the InputSlot or ManualFeed options; if so, it marks the
- * PageRegion option corresponding to the current media size.
- * Otherwise it marks the PageSize option.
+ * This function determines what page size code to use, if any, for the
+ * current media size, InputSlot, and ManualFeed selections.
+ *
+ * We use the PageSize code if:
+ *
+ * 1. A custom media size is selected.
+ * 2. ManualFeed and InputSlot are not selected (or do not exist).
+ * 3. ManualFeed is selected but is False and InputSlot is not selected or
+ * the selection has no code - the latter check done to support "auto" or
+ * "printer default" InputSlot options.
+ *
+ * We use the PageRegion code if:
+ *
+ * 4. RequiresPageRegion does not exist and the PPD contains cupsFilter
+ * keywords, indicating this is a CUPS-based driver.
+ * 5. RequiresPageRegion exists for the selected InputSlot (or "All" for any
+ * InputSlot or ManualFeed selection) and is True.
+ *
+ * If none of the 5 conditions are true, no page size code is used and we
+ * unmark any existing PageSize or PageRegion choices.
*/
if ((size = ppdPageSize(ppd, NULL)) == NULL)
@@ -1138,46 +1153,52 @@ ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */
if (!rpr)
rpr = ppdFindAttr(ppd, "RequiresPageRegion", "All");
- if (!strcasecmp(size->name, "Custom") || (!manual_feed && !input_slot) ||
- !((manual_feed && !strcasecmp(manual_feed->choice, "True")) ||
- (input_slot && input_slot->code && input_slot->code[0])))
+ if (!strcasecmp(size->name, "Custom") ||
+ (!manual_feed && !input_slot) ||
+ (manual_feed && !strcasecmp(manual_feed->choice, "False") &&
+ (!input_slot || (input_slot->code && !input_slot->code[0]))))
{
/*
- * Manual feed was not selected and/or the input slot selection does
- * not contain any PostScript code. Use the PageSize option...
+ * Use PageSize code...
*/
ppdMarkOption(ppd, "PageSize", size->name);
}
- else
+ else if ((rpr && rpr->value && !strcasecmp(rpr->value, "True")) ||
+ (!rpr && ppd->num_filters > 0))
{
/*
- * Manual feed was selected and/or the input slot selection contains
- * PostScript code. Use the PageRegion option...
+ * Use PageRegion code...
*/
ppdMarkOption(ppd, "PageRegion", size->name);
-
+ }
+ else
+ {
/*
- * RequiresPageRegion does not apply to manual feed so we need to
- * check that we are not doing manual feed before unmarking PageRegion.
+ * Do not use PageSize or PageRegion code...
*/
- if (!(manual_feed && !strcasecmp(manual_feed->choice, "True")) &&
- ((rpr && rpr->value && !strcmp(rpr->value, "False")) ||
- (!rpr && !ppd->num_filters)))
+ ppd_choice_t *page; /* PageSize/Region choice, if any */
+
+ if ((page = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
{
/*
- * Either the PPD file specifies no PageRegion code or the PPD file
- * not for a CUPS raster driver and thus defaults to no PageRegion
- * code... Unmark the PageRegion choice so that we don't output the
- * code...
+ * Unmark PageSize...
*/
- page = ppdFindMarkedChoice(ppd, "PageRegion");
+ page->marked = 0;
+ cupsArrayRemove(ppd->marked, page);
+ }
+
+ if ((page = ppdFindMarkedChoice(ppd, "PageRegion")) != NULL)
+ {
+ /*
+ * Unmark PageRegion...
+ */
- if (page)
- page->marked = 0;
+ page->marked = 0;
+ cupsArrayRemove(ppd->marked, page);
}
}
}
diff --git a/cups/getdevices.c b/cups/getdevices.c
index 44500d3fc..81f885912 100644
--- a/cups/getdevices.c
+++ b/cups/getdevices.c
@@ -134,7 +134,10 @@ cupsGetDevices(
if (!cupsDoAuthentication(http, "POST", "/"))
httpReconnect(http);
else
+ {
+ status = HTTP_AUTHORIZATION_CANCELED;
break;
+ }
}
#ifdef HAVE_SSL
diff --git a/cups/getputfile.c b/cups/getputfile.c
index 43952dc1f..a8be5aca0 100644
--- a/cups/getputfile.c
+++ b/cups/getputfile.c
@@ -123,7 +123,10 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
*/
if (cupsDoAuthentication(http, "GET", resource))
+ {
+ status = HTTP_AUTHORIZATION_CANCELED;
break;
+ }
if (httpReconnect(http))
{
@@ -390,7 +393,10 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
*/
if (cupsDoAuthentication(http, "PUT", resource))
+ {
+ status = HTTP_AUTHORIZATION_CANCELED;
break;
+ }
if (httpReconnect(http))
{
diff --git a/cups/globals.c b/cups/globals.c
index fc7d6807b..e9e863313 100644
--- a/cups/globals.c
+++ b/cups/globals.c
@@ -112,7 +112,7 @@ _cupsGlobals(void)
*/
globals->encryption = (http_encryption_t)-1;
- globals->password_cb = _cupsGetPassword;
+ globals->password_cb = (cups_password_cb2_t)_cupsGetPassword;
cups_env_init(globals);
}
diff --git a/cups/globals.h b/cups/globals.h
index 89139367f..fecbeb3d7 100644
--- a/cups/globals.h
+++ b/cups/globals.h
@@ -120,7 +120,8 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
char user[65], /* User name */
server[256], /* Server address */
servername[256];/* Server hostname */
- cups_password_cb_t password_cb; /* Password callback */
+ cups_password_cb2_t password_cb; /* Password callback */
+ void *password_data; /* Password user data */
/* util.c */
http_t *http; /* Current server connection */
diff --git a/cups/http-support.c b/cups/http-support.c
index baa45c122..cd78c628b 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -1210,6 +1210,7 @@ httpStatus(http_status_t status) /* I - HTTP status code */
s = _("Bad Request");
break;
case HTTP_UNAUTHORIZED :
+ case HTTP_AUTHORIZATION_CANCELED :
s = _("Unauthorized");
break;
case HTTP_FORBIDDEN :
@@ -1460,9 +1461,9 @@ _httpResolveURI(
if (logit)
{
if (uri)
- fputs("DEBUG: Unable to resolve URI!\n", stderr);
- else
fprintf(stderr, "DEBUG: Resolved as \"%s\"...\n", uri);
+ else
+ fputs("DEBUG: Unable to resolve URI!\n", stderr);
fputs("STATE: -connecting-to-device\n", stderr);
}
@@ -1637,7 +1638,7 @@ resolve_callback(
* Figure out the scheme from the full name...
*/
- if (strstr(fullName, "._ipp"))
+ if (strstr(fullName, "._ipp") || strstr(fullName, "._fax-ipp"))
scheme = "ipp";
else if (strstr(fullName, "._printer."))
scheme = "lpd";
diff --git a/cups/http.c b/cups/http.c
index e5920fa3f..a717f80c0 100644
--- a/cups/http.c
+++ b/cups/http.c
@@ -181,6 +181,25 @@ static const char * const http_fields[] =
"User-Agent",
"WWW-Authenticate"
};
+#ifdef DEBUG
+static const char * const http_states[] =
+ {
+ "HTTP_WAITING",
+ "HTTP_OPTIONS",
+ "HTTP_GET",
+ "HTTP_GET_SEND",
+ "HTTP_HEAD",
+ "HTTP_POST",
+ "HTTP_POST_RECV",
+ "HTTP_POST_SEND",
+ "HTTP_PUT",
+ "HTTP_PUT_RECV",
+ "HTTP_DELETE",
+ "HTTP_TRACE",
+ "HTTP_CLOSE",
+ "HTTP_STATUS"
+ };
+#endif /* DEBUG */
#if defined(HAVE_SSL) && defined(HAVE_LIBSSL)
@@ -545,7 +564,8 @@ httpFlush(http_t *http) /* I - Connection to server */
int blocking; /* To block or not to block */
- DEBUG_printf(("httpFlush(http=%p), state=%d", http, http->state));
+ DEBUG_printf(("httpFlush(http=%p), state=%s", http,
+ http_states[http->state]));
/*
* Temporarily set non-blocking mode so we don't get stuck in httpRead()...
@@ -757,7 +777,8 @@ httpGetLength(http_t *http) /* I - Connection to server */
off_t /* O - Content length */
httpGetLength2(http_t *http) /* I - Connection to server */
{
- DEBUG_printf(("2httpGetLength2(http=%p), state=%d", http, http->state));
+ DEBUG_printf(("2httpGetLength2(http=%p), state=%s", http,
+ http_states[http->state]));
if (!http)
return (-1);
@@ -996,10 +1017,11 @@ httpGets(char *line, /* I - Line to read into */
/*
* Read a line from the buffer...
*/
-
- lineptr = line;
- lineend = line + length - 1;
- eol = 0;
+
+ http->error = 0;
+ lineptr = line;
+ lineend = line + length - 1;
+ eol = 0;
while (lineptr < lineend)
{
@@ -1328,6 +1350,7 @@ httpRead2(http_t *http, /* I - Connection to server */
return (-1);
http->activity = time(NULL);
+ http->error = 0;
if (length <= 0)
return (0);
@@ -1866,18 +1889,38 @@ httpSetField(http_t *http, /* I - Connection to server */
else if (field == HTTP_FIELD_HOST)
{
/*
- * Special-case for Host: as we don't want a trailing "." on the hostname.
+ * Special-case for Host: as we don't want a trailing "." on the hostname and
+ * need to bracket IPv6 numeric addresses.
*/
- char *ptr = http->fields[HTTP_FIELD_HOST];
- /* Pointer into Host: field */
+ if (strchr(value, ':'))
+ {
+ /*
+ * Bracket IPv6 numeric addresses...
+ *
+ * This is slightly inefficient (basically copying twice), but is an edge
+ * case and not worth optimizing...
+ */
- if (*ptr)
+ snprintf(http->fields[HTTP_FIELD_HOST],
+ sizeof(http->fields[HTTP_FIELD_HOST]), "[%s]", value);
+ }
+ else
{
- ptr += strlen(ptr) - 1;
+ /*
+ * Check for a trailing dot on the hostname...
+ */
+
+ char *ptr = http->fields[HTTP_FIELD_HOST];
+ /* Pointer into Host: field */
+
+ if (*ptr)
+ {
+ ptr += strlen(ptr) - 1;
- if (*ptr == '.')
- *ptr = '\0';
+ if (*ptr == '.')
+ *ptr = '\0';
+ }
}
}
}
@@ -1936,7 +1979,8 @@ httpUpdate(http_t *http) /* I - Connection to server */
status; /* Request status */
- DEBUG_printf(("httpUpdate(http=%p), state=%d", http, http->state));
+ DEBUG_printf(("httpUpdate(http=%p), state=%s", http,
+ http_states[http->state]));
/*
* Flush pending data, if any...
@@ -2604,12 +2648,12 @@ http_debug_hex(const char *prefix, /* I - Prefix for line */
*ptr; /* Pointer into line */
- if (_cups_debug_fd < 0)
+ if (_cups_debug_fd < 0 || _cups_debug_level < 6)
return;
DEBUG_printf(("6%s: %d bytes:\n", prefix, bytes));
- snprintf(line, sizeof(line), "%s: ", prefix);
+ snprintf(line, sizeof(line), "6%s: ", prefix);
start = line + strlen(line);
for (i = 0; i < bytes; i += 16)
@@ -3164,14 +3208,15 @@ http_upgrade(http_t *http) /* I - Connection to server */
static int /* O - Number of bytes written */
http_write(http_t *http, /* I - Connection to server */
- const char *buffer, /* I - Buffer for data */
- int length) /* I - Number of bytes to write */
+ const char *buffer, /* I - Buffer for data */
+ int length) /* I - Number of bytes to write */
{
int tbytes, /* Total bytes sent */
bytes; /* Bytes sent */
- tbytes = 0;
+ http->error = 0;
+ tbytes = 0;
while (length > 0)
{
@@ -3230,6 +3275,7 @@ http_write_chunk(http_t *http, /* I - Connection to server */
char header[255]; /* Chunk header */
int bytes; /* Bytes written */
+
DEBUG_printf(("7http_write_chunk(http=%p, buffer=%p, length=%d)",
http, buffer, length));
diff --git a/cups/http.h b/cups/http.h
index 0c51578d7..70ffe4d3a 100644
--- a/cups/http.h
+++ b/cups/http.h
@@ -248,7 +248,10 @@ typedef enum http_status_e /**** HTTP status codes ****/
HTTP_BAD_GATEWAY, /* Bad gateway */
HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */
HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
- HTTP_NOT_SUPPORTED /* HTTP version not supported */
+ HTTP_NOT_SUPPORTED, /* HTTP version not supported */
+
+ HTTP_AUTHORIZATION_CANCELED = 1000 /* User cancelled authorization */
+
} http_status_t;
typedef enum http_uri_status_e /**** URI separation status @since CUPS1.2@ ****/
diff --git a/cups/ipp.c b/cups/ipp.c
index 021a56e11..c3e8a8f12 100644
--- a/cups/ipp.c
+++ b/cups/ipp.c
@@ -1148,7 +1148,7 @@ ippReadIO(void *src, /* I - Data source */
return (IPP_ERROR);
}
- DEBUG_printf(("1ippReadIO: ipp->current=%p, ipp->prev=%p",
+ DEBUG_printf(("2ippReadIO: ipp->current=%p, ipp->prev=%p",
ipp->current, ipp->prev));
/*
diff --git a/cups/language.c b/cups/language.c
index 39ef43569..e162bfe13 100644
--- a/cups/language.c
+++ b/cups/language.c
@@ -429,7 +429,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
};
- DEBUG_printf(("cupsLangGet(language=\"%s\")", language));
+ DEBUG_printf(("2cupsLangGet(language=\"%s\")", language));
#ifdef __APPLE__
/*
@@ -448,7 +448,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if ((language = getenv("LANG")) == NULL)
language = appleLangDefault();
- DEBUG_printf(("2cupsLangGet: language=\"%s\"", language));
+ DEBUG_printf(("4cupsLangGet: language=\"%s\"", language));
}
#else
@@ -477,7 +477,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
ptr = setlocale(LC_ALL, NULL);
# endif /* LC_MESSAGES */
- DEBUG_printf(("2cupsLangGet: current locale is \"%s\"", ptr));
+ DEBUG_printf(("4cupsLangGet: current locale is \"%s\"", ptr));
if (!ptr || !strcmp(ptr, "C") || !strcmp(ptr, "POSIX"))
{
@@ -525,7 +525,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if (!strncmp(locale, "nb", 2))
locale[1] = 'o';
- DEBUG_printf(("2cupsLangGet: new language value is \"%s\"", language));
+ DEBUG_printf(("4cupsLangGet: new language value is \"%s\"", language));
}
}
#endif /* __APPLE__ */
@@ -562,7 +562,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*ptr = '\0';
- DEBUG_printf(("2cupsLangGet: charset set to \"%s\" via "
+ DEBUG_printf(("4cupsLangGet: charset set to \"%s\" via "
"nl_langinfo(CODESET)...", charset));
}
#endif /* CODESET */
@@ -642,7 +642,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
}
}
- DEBUG_printf(("2cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"",
+ DEBUG_printf(("4cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"",
langname, country, charset));
/*
@@ -680,7 +680,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
}
}
- DEBUG_printf(("2cupsLangGet: encoding=%d(%s)", encoding,
+ DEBUG_printf(("4cupsLangGet: encoding=%d(%s)", encoding,
encoding == CUPS_AUTO_ENCODING ? "auto" :
lang_encodings[encoding]));
@@ -711,7 +711,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
pthread_mutex_unlock(&lang_mutex);
#endif /* HAVE_PTHREAD_H */
- DEBUG_printf(("1cupsLangGet: Using cached copy of \"%s\"...", real));
+ DEBUG_printf(("3cupsLangGet: Using cached copy of \"%s\"...", real));
return (lang);
}
@@ -731,7 +731,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
* No generic localization, so use POSIX...
*/
- DEBUG_printf(("2cupsLangGet: access(\"%s\", 0): %s", filename,
+ DEBUG_printf(("4cupsLangGet: access(\"%s\", 0): %s", filename,
strerror(errno)));
snprintf(filename, sizeof(filename), "%s/C/cups_C.po", cg->localedir);
diff --git a/cups/libcups.exp b/cups/libcups.exp
index 4bb5cd67a..16fa94d1d 100644
--- a/cups/libcups.exp
+++ b/cups/libcups.exp
@@ -154,6 +154,7 @@ _cupsGetJobs2
_cupsGetNamedDest
_cupsGetOption
_cupsGetPassword
+_cupsGetPassword2
_cupsGetPPD
_cupsGetPPD2
_cupsGetPPD3
@@ -188,6 +189,7 @@ _cupsSetDests
_cupsSetDests2
_cupsSetEncryption
_cupsSetPasswordCB
+_cupsSetPasswordCB2
_cupsSetServer
_cupsSetUser
_cupsSideChannelDoRequest
diff --git a/cups/localize.c b/cups/localize.c
index 07cfe8a55..8520e9310 100644
--- a/cups/localize.c
+++ b/cups/localize.c
@@ -52,7 +52,7 @@
* Local functions...
*/
-static void ppd_ll_CC(char *ll_CC, int ll_CC_size);
+static cups_lang_t *ppd_ll_CC(char *ll_CC, int ll_CC_size);
/*
@@ -258,6 +258,7 @@ ppdLocalizeIPPReason(
char *buffer, /* I - Value buffer */
size_t bufsize) /* I - Size of value buffer */
{
+ cups_lang_t *lang; /* Current language */
ppd_attr_t *locattr; /* Localized attribute */
char ll_CC[6], /* Language + country locale */
*bufptr, /* Pointer into buffer */
@@ -282,7 +283,7 @@ ppdLocalizeIPPReason(
* Get the default language...
*/
- ppd_ll_CC(ll_CC, sizeof(ll_CC));
+ lang = ppd_ll_CC(ll_CC, sizeof(ll_CC));
/*
* Find the localized attribute...
@@ -293,7 +294,77 @@ ppdLocalizeIPPReason(
locattr = ppdFindAttr(ppd, "cupsIPPReason", reason);
if (!locattr)
+ {
+ if (lang && (!scheme || !strcmp(scheme, "text")))
+ {
+ /*
+ * Try to localize a standard printer-state-reason keyword...
+ */
+
+ const char *message = NULL; /* Localized message */
+
+
+ if (!strncmp(reason, "media-needed", 12))
+ message = _("Media tray needs to be filled.");
+ else if (!strncmp(reason, "media-jam", 9))
+ message = _("Media jam!");
+ else if (!strncmp(reason, "moving-to-paused", 16) ||
+ !strncmp(reason, "offline", 7) ||
+ !strncmp(reason, "paused", 6) ||
+ !strncmp(reason, "shutdown", 8))
+ message = _("Printer offline.");
+ else if (!strncmp(reason, "toner-low", 9))
+ message = _("Toner low.");
+ else if (!strncmp(reason, "toner-empty", 11))
+ message = _("Out of toner!");
+ else if (!strncmp(reason, "cover-open", 10))
+ message = _("Cover open.");
+ else if (!strncmp(reason, "interlock-open", 14))
+ message = _("Interlock open.");
+ else if (!strncmp(reason, "door-open", 9))
+ message = _("Door open.");
+ else if (!strncmp(reason, "input-tray-missing", 18))
+ message = _("Media tray missing!");
+ else if (!strncmp(reason, "media-low", 9))
+ message = _("Media tray almost empty.");
+ else if (!strncmp(reason, "media-empty", 11))
+ message = _("Media tray empty!");
+ else if (!strncmp(reason, "output-tray-missing", 19))
+ message = _("Output tray missing!");
+ else if (!strncmp(reason, "output-area-almost-full", 23))
+ message = _("Output bin almost full.");
+ else if (!strncmp(reason, "output-area-full", 16))
+ message = _("Output bin full!");
+ else if (!strncmp(reason, "marker-supply-low", 17))
+ message = _("Ink/toner almost empty.");
+ else if (!strncmp(reason, "marker-supply-empty", 19))
+ message = _("Ink/toner empty!");
+ else if (!strncmp(reason, "marker-waste-almost-full", 24))
+ message = _("Ink/toner waste bin almost full.");
+ else if (!strncmp(reason, "marker-waste-full", 17))
+ message = _("Ink/toner waste bin full!");
+ else if (!strncmp(reason, "fuser-over-temp", 15))
+ message = _("Fuser temperature high!");
+ else if (!strncmp(reason, "fuser-under-temp", 16))
+ message = _("Fuser temperature low!");
+ else if (!strncmp(reason, "opc-near-eol", 12))
+ message = _("OPC almost at end-of-life.");
+ else if (!strncmp(reason, "opc-life-over", 13))
+ message = _("OPC at end-of-life!");
+ else if (!strncmp(reason, "developer-low", 13))
+ message = _("Developer almost empty.");
+ else if (!strncmp(reason, "developer-empty", 15))
+ message = _("Developer empty!");
+
+ if (message)
+ {
+ strlcpy(buffer, _cupsLangString(lang, message), bufsize);
+ return (buffer);
+ }
+ }
+
return (NULL);
+ }
/*
* Now find the value we need...
@@ -659,7 +730,7 @@ _ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */
* 'ppd_ll_CC()' - Get the current locale names.
*/
-static void
+static cups_lang_t * /* O - Current language */
ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
int ll_CC_size) /* I - Size of country-specific name */
{
@@ -673,7 +744,7 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
if ((lang = cupsLangDefault()) == NULL)
{
strlcpy(ll_CC, "en_US", ll_CC_size);
- return;
+ return (NULL);
}
/*
@@ -703,6 +774,7 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
DEBUG_printf(("8ppd_ll_CC: lang->language=\"%s\", ll_CC=\"%s\"...",
lang->language, ll_CC));
+ return (lang);
}
diff --git a/cups/options.c b/cups/options.c
index ecc210e0b..23e4dff1c 100644
--- a/cups/options.c
+++ b/cups/options.c
@@ -3,7 +3,7 @@
*
* Option routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -61,12 +61,12 @@ cupsAddOption(const char *name, /* I - Name of option */
diff; /* Result of search */
- DEBUG_printf(("cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
+ DEBUG_printf(("2cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
"options=%p)", name, value, num_options, options));
if (!name || !name[0] || !value || !options || num_options < 0)
{
- DEBUG_printf(("1cupsAddOption: Returning %d", num_options));
+ DEBUG_printf(("3cupsAddOption: Returning %d", num_options));
return (num_options);
}
@@ -94,7 +94,7 @@ cupsAddOption(const char *name, /* I - Name of option */
* No matching option name...
*/
- DEBUG_printf(("2cupsAddOption: New option inserted at index %d...",
+ DEBUG_printf(("4cupsAddOption: New option inserted at index %d...",
insert));
if (num_options == 0)
@@ -105,7 +105,7 @@ cupsAddOption(const char *name, /* I - Name of option */
if (temp == NULL)
{
- DEBUG_puts("1cupsAddOption: Unable to expand option array, returning 0");
+ DEBUG_puts("3cupsAddOption: Unable to expand option array, returning 0");
return (0);
}
@@ -113,7 +113,7 @@ cupsAddOption(const char *name, /* I - Name of option */
if (insert < num_options)
{
- DEBUG_printf(("2cupsAddOption: Shifting %d options...",
+ DEBUG_printf(("4cupsAddOption: Shifting %d options...",
(int)(num_options - insert)));
memmove(temp + insert + 1, temp + insert,
(num_options - insert) * sizeof(cups_option_t));
@@ -129,7 +129,7 @@ cupsAddOption(const char *name, /* I - Name of option */
* Match found; free the old value...
*/
- DEBUG_printf(("2cupsAddOption: Option already exists at index %d...",
+ DEBUG_printf(("4cupsAddOption: Option already exists at index %d...",
insert));
temp = *options + insert;
@@ -138,7 +138,7 @@ cupsAddOption(const char *name, /* I - Name of option */
temp->value = _cupsStrAlloc(value);
- DEBUG_printf(("1cupsAddOption: Returning %d", num_options));
+ DEBUG_printf(("3cupsAddOption: Returning %d", num_options));
return (num_options);
}
@@ -452,7 +452,7 @@ cupsRemoveOption(
cups_option_t *option; /* Current option */
- DEBUG_printf(("cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)",
+ DEBUG_printf(("2cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)",
name, num_options, options));
/*
@@ -461,7 +461,7 @@ cupsRemoveOption(
if (!name || num_options < 1 || !options)
{
- DEBUG_printf(("1cupsRemoveOption: Returning %d", num_options));
+ DEBUG_printf(("3cupsRemoveOption: Returning %d", num_options));
return (num_options);
}
@@ -479,7 +479,7 @@ cupsRemoveOption(
* Remove this option from the array...
*/
- DEBUG_puts("2cupsRemoveOption: Found option, removing it...");
+ DEBUG_puts("4cupsRemoveOption: Found option, removing it...");
num_options --;
i --;
@@ -495,7 +495,7 @@ cupsRemoveOption(
* Return the new number of options...
*/
- DEBUG_printf(("1cupsRemoveOption: Returning %d", num_options));
+ DEBUG_printf(("3cupsRemoveOption: Returning %d", num_options));
return (num_options);
}
diff --git a/cups/page.c b/cups/page.c
index 21ee3ab25..8616c25e0 100644
--- a/cups/page.c
+++ b/cups/page.c
@@ -50,11 +50,11 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
ppd_cparam_t *cparam; /* Custom option parameter */
- DEBUG_printf(("ppdPageSize(ppd=%p, name=\"%s\")", ppd, name));
+ DEBUG_printf(("2ppdPageSize(ppd=%p, name=\"%s\")", ppd, name));
if (!ppd)
{
- DEBUG_puts("1ppdPageSize: Bad PPD pointer, returning NULL...");
+ DEBUG_puts("3ppdPageSize: Bad PPD pointer, returning NULL...");
return (NULL);
}
@@ -72,7 +72,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
if (!i)
{
- DEBUG_puts("1ppdPageSize: No custom sizes, returning NULL...");
+ DEBUG_puts("3ppdPageSize: No custom sizes, returning NULL...");
return (NULL);
}
@@ -144,7 +144,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
* Return the page size...
*/
- DEBUG_printf(("1ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
+ DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
size->name, size->width, size->length));
return (size);
@@ -158,7 +158,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (!strcasecmp(name, size->name))
{
- DEBUG_printf(("1ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
+ DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
size->name, size->width, size->length));
return (size);
@@ -174,14 +174,14 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (size->marked)
{
- DEBUG_printf(("1ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
+ DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
size->name, size->width, size->length));
return (size);
}
}
- DEBUG_puts("1ppdPageSize: Size not found, returning NULL");
+ DEBUG_puts("3ppdPageSize: Size not found, returning NULL");
return (NULL);
}
diff --git a/cups/request.c b/cups/request.c
index 68b35c645..615ef22a2 100644
--- a/cups/request.c
+++ b/cups/request.c
@@ -264,6 +264,8 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
status = http->status;
}
+ DEBUG_printf(("2cupsDoIORequest: status=%d", status));
+
if (status == HTTP_FORBIDDEN || status == HTTP_ERROR ||
status >= HTTP_SERVER_ERROR)
{
@@ -434,6 +436,8 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
if (!cupsDoAuthentication(http, "POST", resource))
httpReconnect(http);
+ else
+ status = HTTP_AUTHORIZATION_CANCELED;
}
#ifdef HAVE_SSL
@@ -681,11 +685,15 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
case HTTP_UNAUTHORIZED :
if (!cupsDoAuthentication(http, "POST", resource))
+ {
if (httpReconnect(http))
{
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
return (HTTP_SERVICE_UNAVAILABLE);
}
+ }
+ else
+ status = HTTP_AUTHORIZATION_CANCELED;
return (status);
@@ -782,7 +790,7 @@ cupsWriteRequestData(
* Finally, check if we have any pending data from the server...
*/
- if (length > HTTP_MAX_BUFFER ||
+ if (length >= HTTP_MAX_BUFFER ||
http->wused < wused ||
(wused > 0 && http->wused == length))
{
@@ -863,6 +871,7 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
break;
case HTTP_UNAUTHORIZED :
+ case HTTP_AUTHORIZATION_CANCELED :
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
break;
diff --git a/cups/test.ppd b/cups/test.ppd
index 45473fdac..0dab6506a 100644
--- a/cups/test.ppd
+++ b/cups/test.ppd
@@ -39,6 +39,8 @@
*Throughput: "1"
*LandscapeOrientation: Plus90
*TTRasterizer: Type42
+*cupsFilter: "application/vnd.cups-raster - 0"
+*RequiresPageRegion All: True
*% These constraints are used to test ppdConflicts() and cupsResolveConflicts()
*UIConstraints: *PageSize Letter *InputSlot Envelope
diff --git a/cups/testppd.c b/cups/testppd.c
index 3a6bb8517..8b386e376 100644
--- a/cups/testppd.c
+++ b/cups/testppd.c
@@ -98,6 +98,30 @@ static const char *custom_code =
"%%EndFeature\n"
"} stopped cleartomark\n";
+static const char *default2_code =
+ "[{\n"
+ "%%BeginFeature: *InstalledDuplexer False\n"
+ "%%EndFeature\n"
+ "} stopped cleartomark\n"
+ "[{\n"
+ "%%BeginFeature: *InputSlot Tray\n"
+ "InputSlot=Tray\n"
+ "%%EndFeature\n"
+ "} stopped cleartomark\n"
+ "[{\n"
+ "%%BeginFeature: *Quality Normal\n"
+ "Quality=Normal\n"
+ "%%EndFeature\n"
+ "} stopped cleartomark\n"
+ "[{\n"
+ "%%BeginFeature: *IntOption None\n"
+ "%%EndFeature\n"
+ "} stopped cleartomark\n"
+ "[{\n"
+ "%%BeginFeature: *StringOption None\n"
+ "%%EndFeature\n"
+ "} stopped cleartomark\n";
+
/*
* 'main()' - Main entry.
@@ -596,6 +620,23 @@ main(int argc, /* I - Number of command-line arguments */
printf("FAIL (%d conflicts)\n", conflicts);
}
+ fputs("ppdEmitString (defaults): ", stdout);
+ if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
+ !strcmp(s, default2_code))
+ puts("PASS");
+ else
+ {
+ status ++;
+ printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
+ (int)strlen(default2_code));
+
+ if (s)
+ puts(s);
+ }
+
+ if (s)
+ free(s);
+
fputs("ppdConflicts(): ", stdout);
ppdMarkOption(ppd, "PageSize", "Env10");
ppdMarkOption(ppd, "InputSlot", "Envelope");
diff --git a/cups/transcode.c b/cups/transcode.c
index afeb2de4a..4e7a794cb 100644
--- a/cups/transcode.c
+++ b/cups/transcode.c
@@ -263,7 +263,7 @@ cupsCharsetToUTF8(
* Check for valid arguments...
*/
- DEBUG_printf(("cupsCharsetToUTF8(dest=%p, src=\"%s\", maxout=%d, encoding=%d)",
+ DEBUG_printf(("2cupsCharsetToUTF8(dest=%p, src=\"%s\", maxout=%d, encoding=%d)",
dest, src, maxout, encoding));
if (dest)
@@ -271,7 +271,7 @@ cupsCharsetToUTF8(
if (!dest || !src || maxout < 1 || maxout > CUPS_MAX_USTRING)
{
- DEBUG_puts("1cupsCharsetToUTF8: Bad arguments, returning -1");
+ DEBUG_puts("3cupsCharsetToUTF8: Bad arguments, returning -1");
return (-1);
}
diff --git a/cups/usersys.c b/cups/usersys.c
index 1ec589da9..be69e2652 100644
--- a/cups/usersys.c
+++ b/cups/usersys.c
@@ -23,6 +23,7 @@
* server.
* cupsSetEncryption() - Set the encryption preference.
* cupsSetPasswordCB() - Set the password callback for CUPS.
+ * cupsSetPasswordCB2() - Set the advanced password callback for CUPS.
* cupsSetServer() - Set the default server name.
* cupsSetUser() - Set the default user name.
* cupsUser() - Return the current user's name.
@@ -87,7 +88,36 @@ cupsEncryption(void)
const char * /* O - Password */
cupsGetPassword(const char *prompt) /* I - Prompt string */
{
- return ((*_cupsGlobals()->password_cb)(prompt));
+ _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
+
+
+ return ((cg->password_cb)(prompt, NULL, NULL, NULL, cg->password_data));
+}
+
+
+/*
+ * 'cupsGetPassword2()' - Get a password from the user using the advanced
+ * callback.
+ *
+ * Uses the current password callback function. Returns @code NULL@ if the
+ * user does not provide a password.
+ *
+ * @since CUPS 1.4@
+ */
+
+const char * /* O - Password */
+cupsGetPassword2(const char *prompt, /* I - Prompt string */
+ http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ const char *method, /* I - Request method ("GET", "POST", "PUT") */
+ const char *resource) /* I - Resource path */
+{
+ _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
+
+
+ if (!http)
+ http = _cupsConnect();
+
+ return ((cg->password_cb)(prompt, http, method, resource, cg->password_data));
}
@@ -140,10 +170,37 @@ cupsSetPasswordCB(cups_password_cb_t cb)/* I - Callback function */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
- if (cb == (const char *(*)(const char *))0)
- cg->password_cb = _cupsGetPassword;
+ if (cb == (cups_password_cb_t)0)
+ cg->password_cb = (cups_password_cb2_t)_cupsGetPassword;
+ else
+ cg->password_cb = (cups_password_cb2_t)cb;
+
+ cg->password_data = NULL;
+}
+
+
+/*
+ * 'cupsSetPasswordCB2()' - Set the advanced password callback for CUPS.
+ *
+ * Pass @code NULL@ to restore the default (console) password callback.
+ *
+ * @since CUPS 1.4@
+ */
+
+void
+cupsSetPasswordCB2(
+ cups_password_cb2_t cb, /* I - Callback function */
+ void *user_data) /* I - User data pointer */
+{
+ _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
+
+
+ if (cb == (cups_password_cb2_t)0)
+ cg->password_cb = (cups_password_cb2_t)_cupsGetPassword;
else
cg->password_cb = cb;
+
+ cg->password_data = user_data;
}
diff --git a/doc/Makefile b/doc/Makefile
index 2be1141c9..f86f11070 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -3,7 +3,7 @@
#
# Documentation makefile for the Common UNIX Printing System (CUPS).
#
-# Copyright 2007-2008 by Apple Inc.
+# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -22,33 +22,37 @@ include ../Makedefs
WEBPAGES = \
cups.css \
cups-printable.css \
- favicon.png \
index.html \
robots.txt
WEBIMAGES = \
images/color-wheel.png \
images/cups.png \
- images/cups-block-diagram.gif \
- images/cups-command-chain.png \
images/cups-icon.png \
- images/cups-postscript-chain.png \
- images/cups-raster-chain.png \
images/left.gif \
- images/raster.png \
images/right.gif \
images/sel.gif \
- images/smiley.jpg \
images/unsel.gif \
images/wait.gif
+HELPIMAGES = \
+ images/cups-block-diagram.gif \
+ images/cups-command-chain.png \
+ images/cups-postscript-chain.png \
+ images/cups-raster-chain.png \
+ images/raster.png \
+ images/smiley.jpg
HELPFILES = \
help/accounting.html \
help/api-array.html \
+ help/api-cgi.html \
help/api-cups.html \
+ help/api-driver.html \
help/api-filedir.html \
help/api-filter.html \
help/api-httpipp.html \
+ help/api-mime.html \
help/api-overview.html \
help/api-ppd.html \
+ help/api-ppdc.html \
help/api-raster.html \
help/cgi.html \
help/glossary.html \
@@ -111,6 +115,7 @@ HELPFILES = \
help/spec-command.html \
help/spec-design.html \
help/spec-ipp.html \
+ help/spec-pdf.html \
help/spec-postscript.html \
help/spec-ppd.html \
help/spec-raster.html \
@@ -176,7 +181,7 @@ install-data: $(INSTALL_LANGUAGES)
$(INSTALL_MAN) $$file $(DOCDIR)/help; \
done
$(INSTALL_DIR) -m 755 $(DOCDIR)/images
- for file in $(WEBIMAGES); do \
+ for file in $(WEBIMAGES) $(HELPIMAGES); do \
$(INSTALL_MAN) $$file $(DOCDIR)/images; \
done
@@ -237,6 +242,16 @@ uninstall-languages:
done
+#
+# Install the docset bits locally...
+#
+
+docset:
+ cp $(HELPFILES) ../org.cups.docset/Contents/Resources/Documentation/help
+ cp cups-printable.css ../org.cups.docset/Contents/Resources/Documentation
+ cp $(HELPIMAGES) ../org.cups.docset/Contents/Resources/Documentation/images
+
+
#
# End of Makefile.
#
diff --git a/doc/cups-printable.css b/doc/cups-printable.css
index e4ad1fbff..a65dd8355 100644
--- a/doc/cups-printable.css
+++ b/doc/cups-printable.css
@@ -19,6 +19,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
diff --git a/doc/favicon.png b/doc/favicon.png
deleted file mode 100644
index d77f3c8f69760d25730eaaf95bc1e3dc9bb0c43e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc-jL100001
literal 2271
zc-jHq2q5=~P)I~d
zIdtsMa4=rm+Nj5WF8!sn^BVz>d!*e7hcQC_LUU;0!?lXSGhEj
z2Bk)cePbW8wQnmg?|In_9Xj#1TD|@&`Xl7LcF;#l<VqMb;{ic6VDiu;BRj^hHznv!!61%=Y>{=c%xl2XkR}p&_qrH|CTmPx22&%EDnNT3zn!i#x4sPe`cKFW1}3{e~^jyCvpCuFvdc|
zw%bWI0zW+~fZQqbWhpmFK~On`9uTT8*6H{Aq0`WEr=m6+Faf^xaYQ4cu+|XShW)HORAO#%B3pyplj~Z-Z34(z5
zj&VNx?;d)Xh5b*O!onQ!35(8Xk}x5Am7*dOj5?zPYlo=*tBSRjc$>jnu1K0KrXY@L
zu@3^bo!J8g)}9oXeM0oQ0l+_BlUt*yyin%oo(AQ2BhrUm%s8}uE5nKHWma6-LBli%
zZA8oWTykqX;>aN5;Ch-kZ83RET#&V=Xr4R=XH&eVZ
zhu?6h?~Q5h_VKe0@vy-};1v`qC)kvwVG}}=5SWM{iK&_fwK$>{MAS!PqQeRCd-ekR
zgx!6r2b#D>(t`Mc){6LunVHJ3OyMhsku5diVMD22M}Tan$K;U)>DexRK~pcsgtdg)
zXoTCVsEtH8%N6c-HI9>@eMOuxs3v<2up25p*oi
zkZE;ErCp>BZS&I%y)jAGMLA}#ZbCxv(u(?l7?lW>tqnZUxLTuKLHPnMJ*VY>a_JIh
zYW0pN;=@xO@H#Z9w1cl4mfX^g4utd?hm`MN0&rZ#lIsenjNmspRctBk%=WA?Hp>ca^pwB(B(
zqkRE$FVC~*@5AI4_>h9ZcPgxUayCg~h+=~)3au1M3Ca73B1V6nNM#)sUtOSQRi5q(@+1{Y_l3=LEzQxsFheHqVrrJ2was{nHhoZ1DAV+rmuMbBl;Ed5S98ST=$s0CL|88lcTW9WDwOD&10
zB@umZj&b52lhjRwf0c`N6dFMp!5Rim127@mBm!jwg~IRAGi;STA@1@iL0@Tn(WI1f
z3V_C7jU`cr$R@n?`vFP^>gbH((sznzGbOHKL27#2X(6zW*j-X$Tt$L5LUx%q18`u|
z*i=|V)R3z95#v6|`cAcIBKr+TF
z5`rYqwl+<6kqf}s?tq~;C#NCQ3`FWP{iL`nioMSb&s2sTmt{~^PzDGEGh$x(tmY{I
zjO+VsMT|5A0T!%potb*={(h>1jVTDF@Z{5Q_)6nVk5`U{y!uf8RD9Elxj)Jy1_;5F
zjj^NLcUFLKL)h0im~6LI3lVf)o2B)FGytO?1w47(PLA!Wpil0U>5#b7*?we4iN}BZ
z9#Jg;;M)%rX`1Uo1g2`K_r=@G8^XTNYMxdTrf*Hp?^x^aZeN_vwzj14Cmi0rcaY&7
z)u~nait{cnu=J94R$SUab0N*a_s7`#_9wjdOg|=>vN!+Q7OvjZ%XqEMSSes=|77*V
zOVyR7r-P5b5I{t{{B7RN-9KsG++NJ6)?Avr>$Cfh!|Z(gIOl3!T64wv9+utRPT4dV
zD+de@R?WfZM{gh9Tz}qL+c+110NIXTW`5WE!`Ayd=VVk{E=@}+#n_tx1OF~F^g)$@
z-DM`nrfjA2E^`()QCyMZs`c}bSx~Ci8Lb2i4NjVU{~UYh_{Q?XK-GRu@Qh{oG(@`d
z_RP-~-`Ku!PIr^nmP^x`Nzv@3$hjU_$D?*U!gUn6SswKyVKQn^jzY$30i%_GWBujE
z2QLi&`uOI_zXHMM#o;Vf@$`!|5!oE}kGxyEq4B7?q;Rp*szhhh^dC(~6*NkO$$Enz
zPM8cEOjPTPmIAx)?U5aQTgHAd@@nk^Yi)S8kbSAEnTWXa?`i$Pob#K0+jCya#a+c*
zrpb5lovETUNfK&d%<;iW?ePAI9RqtSe>(8k$V=AR=$y8{>g`xW>r8I`MghL*_CJglw^m+E#m)c#002ovPDHLkV1iXfP=^2j
diff --git a/doc/help/api-array.html b/doc/help/api-array.html
index d05a656f8..95b308006 100644
--- a/doc/help/api-array.html
+++ b/doc/help/api-array.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
diff --git a/doc/help/api-cgi.html b/doc/help/api-cgi.html
new file mode 100644
index 000000000..756294840
--- /dev/null
+++ b/doc/help/api-cgi.html
@@ -0,0 +1,1021 @@
+
+
+
+
+CGI API
+
+
+
+
+
+
+
Contents
+
+Functions
+Data Types
+Structures
+
+
+Check for the presence of "required" variables.
+
+int cgiCheckVariables (
+ const char *names
+);
+Parameters
+
+names
+Variables to look for
+
+Return Value
+1 if all variables present, 0 otherwise
+Discussion
+Names may be separated by spaces and/or commas.
+
+Compile a search string.
+
+void *cgiCompileSearch (
+ const char *query
+);
+Parameters
+
+query
+Query string
+
+Return Value
+Search context
+
+Copy a template file and replace all the
+'{variable}' strings with the variable value.
+
+void cgiCopyTemplateFile (
+ FILE *out,
+ const char *tmpl
+);
+Parameters
+
+out
+Output file
+tmpl
+Template file to read
+
+
+Copy a template file using a language...
+
+void cgiCopyTemplateLang (
+ const char *tmpl
+);
+Parameters
+
+tmpl
+Base filename
+
+
+Do a search of some text.
+
+int cgiDoSearch (
+ void *search,
+ const char *text
+);
+Parameters
+
+search
+Search context
+text
+Text to search
+
+Return Value
+Number of matches
+
+End a HTML page.
+
+void cgiEndHTML (void);
+
+End the delivery of a multipart web page.
+
+void cgiEndMultipart (void);
+
+Encode a string as a form variable.
+
+char *cgiFormEncode (
+ char *dst,
+ const char *src,
+ size_t dstsize
+);
+Parameters
+
+dst
+Destination string
+src
+Source string
+dstsize
+Size of destination string
+
+Return Value
+Destination string
+
+Free a compiled search context.
+
+void cgiFreeSearch (
+ void *search
+);
+Parameters
+
+search
+Search context
+
+
+Get an element from a form array...
+
+const char *cgiGetArray (
+ const char *name,
+ int element
+);
+Parameters
+
+name
+Name of array variable
+element
+Element number (0 to N)
+
+Return Value
+Element value or NULL
+
+Get the list of attributes that are needed
+by the template file.
+
+void cgiGetAttributes (
+ ipp_t *request,
+ const char *tmpl
+);
+Parameters
+
+request
+IPP request
+tmpl
+Base filename
+
+
+Get the file (if any) that was submitted in the form.
+
+const cgi_file_t *cgiGetFile (void);
+Return Value
+Attached file or NULL
+
+Get the objects in an IPP response.
+
+cups_array_t *cgiGetIPPObjects (
+ ipp_t *response,
+ void *search
+);
+Parameters
+
+response
+IPP response
+search
+Search filter
+
+Return Value
+Array of objects
+
+Get the size of a form array value.
+
+int cgiGetSize (
+ const char *name
+);
+Parameters
+
+name
+Name of variable
+
+Return Value
+Number of elements
+
+Get the templates directory...
+
+char *cgiGetTemplateDir (void);
+Return Value
+Template directory
+
+Get a CGI variable from the database...
+
+const char *cgiGetVariable (
+ const char *name
+);
+Parameters
+
+name
+Name of variable
+
+Return Value
+Value of variable
+Discussion
+Returns NULL if the variable doesn't exist. If the variable is an
+array of values, returns the last element...
+
+Initialize the CGI variable "database"...
+
+int cgiInitialize (void);
+Return Value
+Non-zero if there was form data
+
+Determine whether this page was POSTed.
+
+int cgiIsPOST (void);
+Return Value
+1 if POST, 0 if GET
+
+Move one or more jobs.
+
+void cgiMoveJobs (
+ http_t *http,
+ const char *dest,
+ int job_id
+);
+Parameters
+
+http
+Connection to server
+dest
+Destination or NULL
+job_id
+Job ID or 0 for all
+
+Discussion
+At least one of dest or job_id must be non-zero/NULL.
+
+Print a CUPS command job.
+
+void cgiPrintCommand (
+ http_t *http,
+ const char *dest,
+ const char *command,
+ const char *title
+);
+Parameters
+
+http
+Connection to server
+dest
+Destination printer
+command
+Command to send
+title
+Page/job title
+
+
+Print a test page.
+
+void cgiPrintTestPage (
+ http_t *http,
+ const char *dest
+);
+Parameters
+
+http
+Connection to server
+dest
+Destination printer/class
+
+
+Rewrite a printer URI into a web browser URL...
+
+char *cgiRewriteURL (
+ const char *uri,
+ char *url,
+ int urlsize,
+ const char *newresource
+);
+Parameters
+
+uri
+Current URI
+url
+New URL
+urlsize
+Size of URL buffer
+newresource
+Replacement resource
+
+Return Value
+New URL
+
+Set array element N to the specified string.
+
+void cgiSetArray (
+ const char *name,
+ int element,
+ const char *value
+);
+Parameters
+
+name
+Name of variable
+element
+Element number (0 to N)
+value
+Value of variable
+
+Discussion
+If the variable array is smaller than (element + 1), the intervening
+elements are set to NULL.
+
+Set CGI variables from an IPP object.
+
+ipp_attribute_t *cgiSetIPPObjectVars (
+ ipp_attribute_t *obj,
+ const char *prefix,
+ int element
+);
+Parameters
+
+obj
+Response data to be copied...
+prefix
+Prefix for name or NULL
+element
+Parent element number
+
+Return Value
+Next object
+
+Set CGI variables from an IPP response.
+
+int cgiSetIPPVars (
+ ipp_t *response,
+ const char *filter_name,
+ const char *filter_value,
+ const char *prefix,
+ int parent_el
+);
+Parameters
+
+response
+Response data to be copied...
+filter_name
+Filter name
+filter_value
+Filter value
+prefix
+Prefix for name or NULL
+parent_el
+Parent element number
+
+Return Value
+Maximum number of elements
+
+Set the server name and CUPS version...
+
+void cgiSetServerVersion (void);
+
+Set the array size.
+
+void cgiSetSize (
+ const char *name,
+ int size
+);
+Parameters
+
+name
+Name of variable
+size
+Number of elements (0 to N)
+
+
+Set a CGI variable in the database...
+
+void cgiSetVariable (
+ const char *name,
+ const char *value
+);
+Parameters
+
+name
+Name of variable
+value
+Value of variable
+
+Discussion
+If the variable is an array, this truncates the array to a single element.
+
+Show the last IPP error message.
+
+void cgiShowIPPError (
+ const char *message
+);
+Parameters
+
+message
+Contextual message
+
+Discussion
+The caller must still call cgiStartHTML() and cgiEndHTML().
+
+Show print jobs.
+
+void cgiShowJobs (
+ http_t *http,
+ const char *dest
+);
+Parameters
+
+http
+Connection to server
+dest
+Destination name or NULL
+
+
+Start a HTML page.
+
+void cgiStartHTML (
+ const char *title
+);
+Parameters
+
+title
+Title of page
+
+
+Start a multipart delivery of a web page.
+
+void cgiStartMultipart (void);
+
+Does the browser support multi-part documents?
+
+int cgiSupportsMultipart (void);
+Return Value
+1 if multi-part supported, 0 otherwise
+
+Return localized text.
+
+const char *cgiText (
+ const char *message
+);
+Parameters
+
+message
+Message
+
+Return Value
+Localized message
+
+Delete an index, freeing all memory used.
+
+void helpDeleteIndex (
+ help_index_t *hi
+);
+Parameters
+
+hi
+Help index
+
+
+Find a node in an index.
+
+help_node_t *helpFindNode (
+ help_index_t *hi,
+ const char *filename,
+ const char *anchor
+);
+Parameters
+
+hi
+Index
+filename
+Filename
+anchor
+Anchor
+
+Return Value
+Node pointer or NULL
+
+Load a help index from disk.
+
+help_index_t *helpLoadIndex (
+ const char *hifile,
+ const char *directory
+);
+Parameters
+
+hifile
+Index filename
+directory
+Directory that is indexed
+
+Return Value
+Index pointer or NULL
+
+Save a help index to disk.
+
+int helpSaveIndex (
+ help_index_t *hi,
+ const char *hifile
+);
+Parameters
+
+hi
+Index
+hifile
+Index filename
+
+Return Value
+0 on success, -1 on error
+
+Search an index.
+
+help_index_t *helpSearchIndex (
+ help_index_t *hi,
+ const char *query,
+ const char *section,
+ const char *filename
+);
+Parameters
+
+hi
+Index
+query
+Query string
+section
+Limit search to this section
+filename
+Limit search to this file
+
+Return Value
+Search index
+
+
+Uploaded file data
+
+typedef struct cgi_file_s cgi_file_t;
+
+
+Help index structure
+
+typedef struct help_index_s help_index_t;
+
+
+Help node structure...
+
+typedef struct help_node_s help_node_t;
+
+
+Help word structure...
+
+typedef struct help_word_s help_word_t;
+
+
+
+Uploaded file data
+struct cgi_file_s {
+ size_t filesize;
+ char tempfile[1024], *name, *filename, *mimetype;
+};
+Members
+
+filesize
+Size of uploaded file
+mimetype
+MIME media type
+
+
+Help index structure
+struct help_index_s {
+ cups_array_t *nodes;
+ int search;
+ cups_array_t *sorted;
+};
+Members
+
+nodes
+Nodes sorted by filename
+search
+1 = search index, 0 = normal
+sorted
+Nodes sorted by score + text
+
+
+Help node structure...
+struct help_node_s {
+ char *anchor;
+ char *filename;
+ size_t length;
+ time_t mtime;
+ off_t offset;
+ int score;
+ char *section;
+ char *text;
+ cups_array_t *words;
+};
+Members
+
+anchor
+Anchor name (NULL if none)
+filename
+Filename, relative to help dir
+length
+Length in bytes
+mtime
+Last modification time
+offset
+Offset in file
+score
+Search score
+section
+Section name (NULL if none)
+text
+Text in anchor
+words
+Words after this node
+
+
+Help word structure...
+struct help_word_s {
+ int count;
+ char *text;
+};
+Members
+
+count
+Number of occurrences
+text
+Word text
+
+
+
+
diff --git a/doc/help/api-cups.html b/doc/help/api-cups.html
index 3d4bfb10c..dcfa36fa1 100644
--- a/doc/help/api-cups.html
+++ b/doc/help/api-cups.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
@@ -409,6 +413,8 @@ div.contents ul.subcontents li {
cupsGetPPD3
cupsGetPassword
+cupsGetPassword2
cupsGetPrinters
cupsGetServerPPD
cupsLangDefault
@@ -437,6 +443,7 @@ specified server.">cupsPrintFiles2
cupsSetDests2
cupsSetEncryption
cupsSetPasswordCB
+cupsSetPasswordCB2
cupsSetServer
cupsSetUser
cupsStartDocument
@@ -450,6 +457,7 @@ specified server.">cupsPrintFiles2
cups_device_cb_t
cups_job_t
cups_option_t
+ cups_password_cb2_t
cups_password_cb_t
cups_ptype_t
@@ -1562,6 +1570,34 @@ const char *cupsGetPassword (
Discussion
Uses the current password callback function. Returns NULL
if the
user does not provide a password.
+
+Get a password from the user using the advanced
+callback.
+
+const char *cupsGetPassword2 (
+ const char *prompt,
+ http_t *http,
+ const char *method,
+ const char *resource
+);
+Parameters
+
+prompt
+Prompt string
+http
+Connection to server or CUPS_HTTP_DEFAULT
+method
+Request method ("GET", "POST", "PUT")
+resource
+Resource path
+
+Return Value
+Password
+Discussion
+Uses the current password callback function. Returns NULL
if the
+user does not provide a password.
+
+
Get a list of printers from the default server.
@@ -1990,6 +2026,24 @@ void cupsSetPasswordCB (
Discussion
Pass NULL
to restore the default (console) password callback.
+
+Set the advanced password callback for CUPS.
+
+void cupsSetPasswordCB2 (
+ cups_password_cb2_t cb,
+ void *user_data
+);
+Parameters
+
+cb
+Callback function
+user_data
+User data pointer
+
+Discussion
+Pass NULL
to restore the default (console) password callback.
+
+
Set the default server name.
@@ -2145,6 +2199,11 @@ typedef struct cups_job_s cups_job_t;
typedef struct cups_option_s cups_option_t;
+
+New password callback
+
+typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
+
Password callback
@@ -2269,6 +2328,8 @@ typedef unsigned cups_ptype_t;
Local printer or class
CUPS_PRINTER_MEDIUM
Can do Tabloid/B/C/A3/A2
+CUPS_PRINTER_MFP CUPS 1.4
+Printer with scanning capabilities
CUPS_PRINTER_NOT_SHARED CUPS 1.2/Mac OS X 10.5
Printer is not shared
CUPS_PRINTER_PUNCH
@@ -2277,6 +2338,8 @@ typedef unsigned cups_ptype_t;
Printer is rejecting jobs
CUPS_PRINTER_REMOTE
Remote printer or class
+CUPS_PRINTER_SCANNER CUPS 1.4
+Scanner-only device
CUPS_PRINTER_SMALL
Can do Letter/Legal/A4
CUPS_PRINTER_SORT
diff --git a/doc/help/api-driver.html b/doc/help/api-driver.html
new file mode 100644
index 000000000..7278a8038
--- /dev/null
+++ b/doc/help/api-driver.html
@@ -0,0 +1,1096 @@
+
+
+
+
+Printer Driver API
+
+
+
+
+
+
+
Contents
+
+Functions
+Data Types
+Structures
+Variables
+
+
+Delete a color separation.
+
+void cupsCMYKDelete (
+ cups_cmyk_t *cmyk
+);
+Parameters
+
+cmyk
+Color separation
+
+
+Do a black separation...
+
+void cupsCMYKDoBlack (
+ const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output,
+ int num_pixels
+);
+Parameters
+
+cmyk
+Color separation
+input
+Input grayscale pixels
+output
+Output Device-N pixels
+num_pixels
+Number of pixels
+
+
+Do a CMYK separation...
+
+void cupsCMYKDoCMYK (
+ const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output,
+ int num_pixels
+);
+Parameters
+
+cmyk
+Color separation
+input
+Input grayscale pixels
+output
+Output Device-N pixels
+num_pixels
+Number of pixels
+
+
+Do a grayscale separation...
+
+void cupsCMYKDoGray (
+ const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output,
+ int num_pixels
+);
+Parameters
+
+cmyk
+Color separation
+input
+Input grayscale pixels
+output
+Output Device-N pixels
+num_pixels
+Number of pixels
+
+
+Do an sRGB separation...
+
+void cupsCMYKDoRGB (
+ const cups_cmyk_t *cmyk,
+ const unsigned char *input,
+ short *output,
+ int num_pixels
+);
+Parameters
+
+cmyk
+Color separation
+input
+Input grayscale pixels
+output
+Output Device-N pixels
+num_pixels
+Number of pixels
+
+
+Load a CMYK color profile from PPD attributes.
+
+cups_cmyk_t *cupsCMYKLoad (
+ ppd_file_t *ppd,
+ const char *colormodel,
+ const char *media,
+ const char *resolution
+);
+Parameters
+
+ppd
+PPD file
+colormodel
+ColorModel value
+media
+MediaType value
+resolution
+Resolution value
+
+Return Value
+CMYK color separation
+
+Create a new CMYK color separation.
+
+cups_cmyk_t *cupsCMYKNew (
+ int num_channels
+);
+Parameters
+
+num_channels
+Number of color components
+
+Return Value
+New CMYK separation or NULL
+
+Set the transition range for CMY to black.
+
+void cupsCMYKSetBlack (
+ cups_cmyk_t *cmyk,
+ float lower,
+ float upper
+);
+Parameters
+
+cmyk
+CMYK color separation
+lower
+No black ink
+upper
+Only black ink
+
+
+Set a color transform curve using points.
+
+void cupsCMYKSetCurve (
+ cups_cmyk_t *cmyk,
+ int channel,
+ int num_xypoints,
+ const float *xypoints
+);
+Parameters
+
+cmyk
+CMYK color separation
+channel
+Color channel
+num_xypoints
+Number of X,Y points
+xypoints
+X,Y points
+
+
+Set a color transform curve using gamma and density.
+
+void cupsCMYKSetGamma (
+ cups_cmyk_t *cmyk,
+ int channel,
+ float gamval,
+ float density
+);
+Parameters
+
+cmyk
+CMYK color separation
+channel
+Ink channel
+gamval
+Gamma correction
+density
+Maximum density
+
+
+Set the limit on the amount of ink.
+
+void cupsCMYKSetInkLimit (
+ cups_cmyk_t *cmyk,
+ float limit
+);
+Parameters
+
+cmyk
+CMYK color separation
+limit
+Limit of ink
+
+
+Set light/dark ink transforms.
+
+void cupsCMYKSetLtDk (
+ cups_cmyk_t *cmyk,
+ int channel,
+ float light,
+ float dark
+);
+Parameters
+
+cmyk
+CMYK color separation
+channel
+Dark ink channel (+1 for light)
+light
+Light ink only level
+dark
+Dark ink only level
+
+
+Check to see if all bytes are zero.
+
+int cupsCheckBytes (
+ const unsigned char *bytes,
+ int length
+);
+Parameters
+
+bytes
+Bytes to check
+length
+Number of bytes to check
+
+Return Value
+1 if they match
+
+Check to see if all bytes match the given value.
+
+int cupsCheckValue (
+ const unsigned char *bytes,
+ int length,
+ const unsigned char value
+);
+Parameters
+
+bytes
+Bytes to check
+length
+Number of bytes to check
+value
+Value to check
+
+Return Value
+1 if they match
+
+Free a dithering buffer.
+
+void cupsDitherDelete (
+ cups_dither_t *d
+);
+Parameters
+
+d
+Dithering buffer
+
+Discussion
+Returns 0 on success, -1 on failure.
+
+Dither a line of pixels...
+
+void cupsDitherLine (
+ cups_dither_t *d,
+ const cups_lut_t *lut,
+ const short *data,
+ int num_channels,
+ unsigned char *p
+);
+Parameters
+
+d
+Dither data
+lut
+Lookup table
+data
+Separation data
+num_channels
+Number of components
+p
+Pixels
+
+
+Create an error-diffusion dithering buffer.
+
+cups_dither_t *cupsDitherNew (
+ int width
+);
+Parameters
+
+width
+Width of output in pixels
+
+Return Value
+New state array
+
+Find a PPD attribute based on the colormodel,
+media, and resolution.
+
+ppd_attr_t *cupsFindAttr (
+ ppd_file_t *ppd,
+ const char *name,
+ const char *colormodel,
+ const char *media,
+ const char *resolution,
+ char *spec,
+ int specsize
+);
+Parameters
+
+ppd
+PPD file
+name
+Attribute name
+colormodel
+Color model
+media
+Media type
+resolution
+Resolution
+spec
+Final selection string
+specsize
+Size of string buffer
+
+Return Value
+Matching attribute or NULL
+
+Free the memory used by a lookup table.
+
+void cupsLutDelete (
+ cups_lut_t *lut
+);
+Parameters
+
+lut
+Lookup table to free
+
+
+Load a LUT from a PPD file.
+
+cups_lut_t *cupsLutLoad (
+ ppd_file_t *ppd,
+ const char *colormodel,
+ const char *media,
+ const char *resolution,
+ const char *ink
+);
+Parameters
+
+ppd
+PPD file
+colormodel
+Color model
+media
+Media type
+resolution
+Resolution
+ink
+Ink name
+
+Return Value
+New lookup table
+
+Make a lookup table from a list of pixel values.
+
+cups_lut_t *cupsLutNew (
+ int num_values,
+ const float *values
+);
+Parameters
+
+num_values
+Number of values
+values
+Lookup table values
+
+Return Value
+New lookup table
+Discussion
+Returns a pointer to the lookup table on success, NULL on failure.
+
+Pack pixels horizontally...
+
+void cupsPackHorizontal (
+ const unsigned char *ipixels,
+ unsigned char *obytes,
+ int width,
+ const unsigned char clearto,
+ const int step
+);
+Parameters
+
+ipixels
+Input pixels
+obytes
+Output bytes
+width
+Number of pixels
+clearto
+Initial value of bytes
+step
+Step value between pixels
+
+
+Pack 2-bit pixels horizontally...
+
+void cupsPackHorizontal2 (
+ const unsigned char *ipixels,
+ unsigned char *obytes,
+ int width,
+ const int step
+);
+Parameters
+
+ipixels
+Input pixels
+obytes
+Output bytes
+width
+Number of pixels
+step
+Stepping value
+
+
+Pack pixels horizontally by bit...
+
+void cupsPackHorizontalBit (
+ const unsigned char *ipixels,
+ unsigned char *obytes,
+ int width,
+ const unsigned char clearto,
+ const unsigned char bit
+);
+Parameters
+
+ipixels
+Input pixels
+obytes
+Output bytes
+width
+Number of pixels
+clearto
+Initial value of bytes
+bit
+Bit to check
+
+
+Pack pixels vertically...
+
+void cupsPackVertical (
+ const unsigned char *ipixels,
+ unsigned char *obytes,
+ int width,
+ const unsigned char bit,
+ const int step
+);
+Parameters
+
+ipixels
+Input pixels
+obytes
+Output bytes
+width
+Number of input pixels
+bit
+Output bit
+step
+Number of bytes between columns
+
+
+Delete a color separation.
+
+void cupsRGBDelete (
+ cups_rgb_t *rgbptr
+);
+Parameters
+
+rgbptr
+Color separation
+
+
+Do a grayscale separation...
+
+void cupsRGBDoGray (
+ cups_rgb_t *rgbptr,
+ const unsigned char *input,
+ unsigned char *output,
+ int num_pixels
+);
+Parameters
+
+rgbptr
+Color separation
+input
+Input grayscale pixels
+output
+Output Device-N pixels
+num_pixels
+Number of pixels
+
+
+Do a RGB separation...
+
+void cupsRGBDoRGB (
+ cups_rgb_t *rgbptr,
+ const unsigned char *input,
+ unsigned char *output,
+ int num_pixels
+);
+Parameters
+
+rgbptr
+Color separation
+input
+Input RGB pixels
+output
+Output Device-N pixels
+num_pixels
+Number of pixels
+
+
+Load a RGB color profile from a PPD file.
+
+cups_rgb_t *cupsRGBLoad (
+ ppd_file_t *ppd,
+ const char *colormodel,
+ const char *media,
+ const char *resolution
+);
+Parameters
+
+ppd
+PPD file
+colormodel
+Color model
+media
+Media type
+resolution
+Resolution
+
+Return Value
+New color profile
+
+Create a new RGB color separation.
+
+cups_rgb_t *cupsRGBNew (
+ int num_samples,
+ cups_sample_t *samples,
+ int cube_size,
+ int num_channels
+);
+Parameters
+
+num_samples
+Number of samples
+samples
+Samples
+cube_size
+Size of LUT cube
+num_channels
+Number of color components
+
+Return Value
+New color separation or NULL
+
+
+Simple CMYK lookup table
+
+typedef struct cups_cmyk_s cups_cmyk_t;
+
+
+Dithering State
+
+typedef struct cups_dither_s cups_dither_t;
+
+
+Lookup Table for Dithering
+
+typedef struct cups_lut_s cups_lut_t;
+
+
+Color separation lookup table
+
+typedef struct cups_rgb_s cups_rgb_t;
+
+
+Color sample point
+
+typedef struct cups_sample_s cups_sample_t;
+
+
+
+Simple CMYK lookup table
+struct cups_cmyk_s {
+ unsigned char black_lut[256];
+ short *channels[CUPS_MAX_CHAN];
+ unsigned char color_lut[256];
+ int ink_limit;
+ int num_channels;
+};
+Members
+
+black_lut[256]
+Black generation LUT
+channels[CUPS_MAX_CHAN]
+Lookup tables
+color_lut[256]
+Color removal LUT
+ink_limit
+Ink limit
+num_channels
+Number of components
+
+
+Dithering State
+struct cups_dither_s {
+ int errors[96];
+ int row;
+ int width;
+};
+Members
+
+errors[96]
+Error values
+row
+Current row
+width
+Width of buffer
+
+
+Lookup Table for Dithering
+struct cups_lut_s {
+ int error;
+ short intensity;
+ short pixel;
+};
+Members
+
+error
+Error from desired value
+intensity
+Adjusted intensity
+pixel
+Output pixel value
+
+
+Color separation lookup table
+struct cups_rgb_s {
+ unsigned char black[CUPS_MAX_RGB];
+ int cache_init;
+ unsigned char ****colors;
+ int cube_index[256];
+ int cube_mult[256];
+ int cube_size;
+ int num_channels;
+ unsigned char white[CUPS_MAX_RGB];
+};
+Members
+
+black[CUPS_MAX_RGB]
+Cached black (sRGB = 0,0,0)
+cache_init
+Are cached values initialized?
+colors
+4-D array of sample values
+cube_index[256]
+Index into cube for a given sRGB value
+cube_mult[256]
+Multiplier value for a given sRGB value
+cube_size
+Size of color cube (2-N) on a side
+num_channels
+Number of colors per sample
+white[CUPS_MAX_RGB]
+Cached white (sRGB = 255,255,255)
+
+
+Color sample point
+struct cups_sample_s {
+ unsigned char colors[CUPS_MAX_RGB];
+ unsigned char rgb[3];
+};
+Members
+
+colors[CUPS_MAX_RGB]
+Color values
+rgb[3]
+sRGB values
+
+
+
+sRGB gamma lookup table (inverted)
+extern const unsigned char cups_scmy_lut[256];
+
+sRGB gamma lookup table
+extern const unsigned char cups_srgb_lut[256];
+
+
+
diff --git a/doc/help/api-filedir.html b/doc/help/api-filedir.html
index 13ab31f75..a91c7d273 100644
--- a/doc/help/api-filedir.html
+++ b/doc/help/api-filedir.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
diff --git a/doc/help/api-filter.html b/doc/help/api-filter.html
index 54ae977f5..29347b08a 100644
--- a/doc/help/api-filter.html
+++ b/doc/help/api-filter.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
diff --git a/doc/help/api-httpipp.html b/doc/help/api-httpipp.html
index 899fe8cde..444fe5870 100644
--- a/doc/help/api-httpipp.html
+++ b/doc/help/api-httpipp.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
@@ -507,6 +511,10 @@ in seconds.">ippDateToTime
ippWriteIO
Data Types
Structures
Unions
Constants
@@ -3233,6 +3241,14 @@ const ipp_uchar_t *ippTimeToDate (
Return Value
Current state
+ CUPS 1.2/Mac OS X 10.5 http_addr_t
+Socket address union, which
+makes using IPv6 and other
+address types easier and
+more portable.
+
+typedef union _http_addr_u / http_addr_t;
+
Socket address list, which is
used to enumerate all of the
@@ -3262,10 +3278,16 @@ typedef enum http_encryption_e http_encryption_
typedef enum http_field_e http_field_t;
-Types and structures...
+HTTP keep-alive values
typedef enum http_keepalive_e http_keepalive_t;
+
+HTTP state values; states
+are server-oriented...
+
+typedef enum http_state_e / http_state_t;
+
HTTP status codes
@@ -3277,20 +3299,17 @@ typedef enum http_status_e http_status_t;
typedef struct _http_s http_t;
-HTTP version numbers
+URI en/decode flags
typedef enum http_uri_coding_e http_uri_coding_t;
-
-URI en/decode flags
+
+URI separation status
typedef enum http_uri_status_e http_uri_status_t;
-
-Socket address union, which
-makes using IPv6 and other
-address types easier and
-more portable.
+
+HTTP version numbers
typedef enum http_version_e http_version_t;
@@ -3300,7 +3319,7 @@ typedef enum http_version_e http_version_t;
typedef struct ipp_attribute_s ipp_attribute_t;
-Orientation...
+Finishings...
typedef enum ipp_finish_e ipp_finish_t;
@@ -3310,27 +3329,27 @@ typedef enum ipp_finish_e ipp_finish_t;
typedef ssize_t (*ipp_iocb_t)(void *, ipp_uchar_t *, size_t);
-Printer States....
+Job States....
typedef enum ipp_jstate_e ipp_jstate_t;
-Old names for the operations
+IPP operations...
typedef enum ipp_op_e ipp_op_t;
-Qualities...
+Orientation...
typedef enum ipp_orient_e ipp_orient_t;
-IPP states...
+Printer States....
typedef enum ipp_pstate_e ipp_pstate_t;
-Job States....
+Qualities...
typedef enum ipp_quality_e ipp_quality_t;
@@ -3340,12 +3359,12 @@ typedef enum ipp_quality_e ipp_quality_t;
typedef union ipp_request_u ipp_request_t;
-Types and structures...
+Resolution units...
typedef enum ipp_res_e ipp_res_t;
-IPP operations...
+IPP states...
typedef enum ipp_state_e ipp_state_t;
@@ -3365,7 +3384,7 @@ typedef typedef unsigned char ipp_uchar_t;
typedef enum ipp_tag_e ipp_tag_t;
-New in CUPS 1.1.19
+Attribute Value
typedef union ipp_value_u ipp_value_t;
@@ -3445,7 +3464,7 @@ with a hostname.
-New in CUPS 1.1.19
+Attribute Value
union ipp_value_u {
char boolean;
ipp_t *collection;
@@ -3571,7 +3590,7 @@ with a hostname.
WWW-Authenticate field
-Types and structures...
+HTTP keep-alive values
Constants
HTTP_KEEPALIVE_OFF
@@ -3580,7 +3599,8 @@ with a hostname.
Use keep alive
-
+HTTP state values; states
+are server-oriented...
Constants
HTTP_CLOSE
@@ -3618,6 +3638,8 @@ with a hostname.
HTTP_ACCEPTED
DELETE command was successful
+HTTP_AUTHORIZATION_CANCELED
+User cancelled authorization
HTTP_BAD_GATEWAY
Bad gateway
HTTP_BAD_REQUEST
@@ -3700,7 +3722,7 @@ with a hostname.
Must use a proxy to access this URI
-
+URI en/decode flags
Constants
HTTP_URI_CODING_ALL
@@ -3718,8 +3740,8 @@ with a hostname.
HTTP_URI_CODING_USERNAME
En/decode the username portion
-
-
+
+URI separation status
Constants
HTTP_URI_BAD_ARGUMENTS
@@ -3748,7 +3770,7 @@ with a hostname.
Unknown scheme in URI (warning)
-
+HTTP version numbers
Constants
HTTP_0_9
@@ -3759,7 +3781,7 @@ with a hostname.
HTTP/1.1
-
+Finishings...
Constants
IPP_FINISHINGS_BALE
@@ -3820,7 +3842,7 @@ with a hostname.
Trim (any type)
-
+Job States....
Constants
IPP_JOB_ABORTED
@@ -3839,7 +3861,7 @@ with a hostname.
Job has been stopped
-
+IPP operations...
Constants
CUPS_ACCEPT_JOBS
@@ -3926,7 +3948,7 @@ with a hostname.
Validate job options
-
+Orientation...
Constants
IPP_LANDSCAPE
@@ -3939,7 +3961,7 @@ with a hostname.
180 degrees
-
+Printer States....
Constants
IPP_PRINTER_IDLE
@@ -3950,7 +3972,7 @@ with a hostname.
Printer is stopped
-
+Qualities...
Constants
IPP_QUALITY_DRAFT
@@ -3961,7 +3983,7 @@ with a hostname.
Normal quality
-Types and structures...
+Resolution units...
Constants
IPP_RES_PER_CM
@@ -3970,7 +3992,7 @@ with a hostname.
Pixels per inch
-
+IPP states...
Constants
IPP_ATTRIBUTE
diff --git a/doc/help/api-mime.html b/doc/help/api-mime.html
new file mode 100644
index 000000000..7d759781f
--- /dev/null
+++ b/doc/help/api-mime.html
@@ -0,0 +1,715 @@
+
+
+
+
+MIME API
+
+
+
+
+
+
+
Contents
+
+Functions
+Data Types
+
+
+Add a filter to the current MIME database.
+
+mime_filter_t *mimeAddFilter (
+ mime_t *mime,
+ mime_type_t *src,
+ mime_type_t *dst,
+ int cost,
+ const char *filter
+);
+Parameters
+
+mime
+MIME database
+src
+Source type
+dst
+Destination type
+cost
+Relative time/resource cost
+filter
+Filter program to run
+
+Return Value
+New filter
+
+Add a MIME type to a database.
+
+mime_type_t *mimeAddType (
+ mime_t *mime,
+ const char *super,
+ const char *type
+);
+Parameters
+
+mime
+MIME database
+super
+Super-type name
+type
+Type name
+
+Return Value
+New (or existing) MIME type
+
+Add a detection rule for a file type.
+
+int mimeAddTypeRule (
+ mime_type_t *mt,
+ const char *rule
+);
+Parameters
+
+mt
+Type to add to
+rule
+Rule to add
+
+Return Value
+0 on success, -1 on failure
+
+Delete (free) a MIME database.
+
+void mimeDelete (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+
+Delete a filter from the MIME database.
+
+void mimeDeleteFilter (
+ mime_t *mime,
+ mime_filter_t *filter
+);
+Parameters
+
+mime
+MIME database
+filter
+Filter
+
+
+Delete a type from the MIME database.
+
+void mimeDeleteType (
+ mime_t *mime,
+ mime_type_t *mt
+);
+Parameters
+
+mime
+MIME database
+mt
+Type
+
+
+Determine the type of a file.
+
+mime_type_t *mimeFileType (
+ mime_t *mime,
+ const char *pathname,
+ const char *filename,
+ int *compression
+);
+Parameters
+
+mime
+MIME database
+pathname
+Name of file to check on disk
+filename
+Original filename or NULL
+compression
+Is the file compressed?
+
+Return Value
+Type of file
+
+Find the fastest way to convert from one type to another.
+
+cups_array_t *mimeFilter (
+ mime_t *mime,
+ mime_type_t *src,
+ mime_type_t *dst,
+ int *cost
+);
+Parameters
+
+mime
+MIME database
+src
+Source file type
+dst
+Destination file type
+cost
+Cost of filters
+
+Return Value
+Array of filters to run
+
+Lookup a filter...
+
+mime_filter_t *mimeFilterLookup (
+ mime_t *mime,
+ mime_type_t *src,
+ mime_type_t *dst
+);
+Parameters
+
+mime
+MIME database
+src
+Source type
+dst
+Destination type
+
+Return Value
+Filter for src->dst
+
+Get the first filter in the MIME database.
+
+mime_filter_t *mimeFirstFilter (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+Return Value
+Filter or NULL
+
+Get the first type in the MIME database.
+
+mime_type_t *mimeFirstType (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+Return Value
+Type or NULL
+
+Create a new MIME database from disk.
+
+mime_t *mimeLoad (
+ const char *pathname,
+ const char *filterpath
+);
+Parameters
+
+pathname
+Directory to load
+filterpath
+Directory to load
+
+Return Value
+New MIME database
+Discussion
+This function uses mimeLoadFilters
and mimeLoadTypes
to
+create a MIME database from a single directory.
+
+Load filter definitions from disk.
+
+mime_t *mimeLoadFilters (
+ mime_t *mime,
+ const char *pathname,
+ const char *filterpath
+);
+Parameters
+
+mime
+MIME database
+pathname
+Directory to load from
+filterpath
+Default filter program directory
+
+Return Value
+MIME database
+Discussion
+This function loads all of the .convs files from the specified directory.
+Use mimeLoadTypes
to load all types before you load the filters.
+
+Load type definitions from disk.
+
+mime_t *mimeLoadTypes (
+ mime_t *mime,
+ const char *pathname
+);
+Parameters
+
+mime
+MIME database or NULL
to create a new one
+pathname
+Directory to load from
+
+Return Value
+MIME database
+Discussion
+This function loads all of the .types files from the specified directory.
+Use mimeLoadFilters
to load all filters after you load the types.
+
+Get the next filter in the MIME database.
+
+mime_filter_t *mimeNextFilter (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+Return Value
+Filter or NULL
+
+Get the next type in the MIME database.
+
+mime_type_t *mimeNextType (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+Return Value
+Type or NULL
+
+MIME database
+
+int mimeNumFilters (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+Return Value
+Get the number of filters in a MIME database.
+
+MIME database
+
+int mimeNumTypes (
+ mime_t *mime
+);
+Parameters
+
+mime
+MIME database
+
+Return Value
+Get the number of types in a MIME database.
+
+Lookup a file type.
+
+mime_type_t *mimeType (
+ mime_t *mime,
+ const char *super,
+ const char *type
+);
+Parameters
+
+mime
+MIME database
+super
+Super-type name
+type
+Type name
+
+Return Value
+Matching file type definition
+
+
+MIME Conversion Filter Data
+
+typedef struct _mime_filter_s mime_filter_t;
+
+
+MIME Magic Data
+
+typedef struct _mime_magic_s mime_magic_t;
+
+
+Types/structures...
+
+typedef enum mime_op_t;
+
+
+MIME Database
+
+typedef struct _mime_s mime_t;
+
+
+MIME Type Data
+
+typedef struct _mime_type_s mime_type_t;
+
+
+
+
diff --git a/doc/help/api-overview.html b/doc/help/api-overview.html
index 4bf8c5466..b6e07808c 100644
--- a/doc/help/api-overview.html
+++ b/doc/help/api-overview.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
diff --git a/doc/help/api-ppd.html b/doc/help/api-ppd.html
index 263e91b0d..56cd2abd0 100644
--- a/doc/help/api-ppd.html
+++ b/doc/help/api-ppd.html
@@ -27,6 +27,10 @@ PRE.command {
margin-left: 36pt;
}
+P.compact {
+ margin: 0;
+}
+
P.example {
font-style: italic;
margin-left: 36pt;
@@ -444,7 +448,7 @@ conflicts.">ppdMarkOption
ppd_profile_t
ppd_section_t
ppd_size_t
- ppd_status_t
+ ppd_status_t
ppd_ui_t
Structures
@@ -465,11 +469,11 @@ conflicts.">ppdMarkOption
ppd_cpvalue_u
Constants
+
+PPD Compiler API
+
+
+
+
+
+
+
Contents
+
+Classes
+Data Types
+Variables
+Constants
+
+
+// Shared Array
+class ppdcArray : public ppdcShared {
+ public:
+ int count, alloc, current;
+ ppdcShared **data;
+};
+Members
+
+current
+Current element
+data
+Elements
+
+
+
+
+void PPDC_NAME (
+ void add(ppdcShared *d
+);
+Parameters
+
+d
+
+
+
+
+void add (
+ ppdcShared *d
+);
+Parameters
+
+d
+
+
+Return the first element in the array.
+
+ppdcShared *first (void);
+Return Value
+
+
+Return the next element in the array.
+
+ppdcShared *next (void);
+Return Value
+
+
+
+
+void ppdcArray (
+ ppdcArray *a
+);
+Parameters
+
+a
+
+
+
+
+void remove (
+ ppdcShared *d
+);
+Parameters
+
+d
+Data element
+
+
+
+
+void ~ppdcArray (void);
+
+// Attribute
+class ppdcAttr : public ppdcShared {
+ public:
+ bool localizable;
+ ppdcString *name, *selector, *text, *value;
+};
+Members
+
+localizable
+Should this attribute be localized?
+value
+Value string
+
+
+
+
+void ppdcAttr (
+ const char *n,
+ const char *s,
+ const char *t,
+ const char *v,
+ bool loc
+);
+Parameters
+
+n
+Name
+s
+Spec string
+t
+Human-readable text
+v
+Value
+loc
+Localize this attribute?
+
+
+
+
+void ~ppdcAttr (void);
+
+// Translation catalog
+class ppdcCatalog : public ppdcShared {
+ public:
+ ppdcString *filename;
+ ppdcString *locale;
+ ppdcArray *messages;
+};
+Members
+
+filename
+Name of translation file
+locale
+Name of locale
+messages
+Array of translation messages
+
+
+
+
+void PPDC_NAME (
+ void add_message(const char *id,
+ const char *string = NULL
+);
+Parameters
+
+id
+string
+
+
+
+
+void add_message (
+ const char *id,
+ const char *string
+);
+Parameters
+
+id
+Message ID to add
+string
+Translation string
+
+
+
+
+const char *find_message (
+ const char *id
+);
+Parameters
+
+id
+Message ID
+
+Return Value
+Message text
+
+
+
+int load_messages (
+ const char *f
+);
+Parameters
+
+f
+Message catalog file
+
+Return Value
+0 on success, -1 on failure
+
+
+
+void ppdcCatalog (
+ const char *l,
+ const char *f
+);
+Parameters
+
+l
+Locale
+f
+Message catalog file
+
+
+
+
+int save_messages (
+ const char *f
+);
+Parameters
+
+f
+File to save to
+
+Return Value
+0 on success, -1 on error
+
+
+
+void ~ppdcCatalog (void);
+
+// Option Choice
+class ppdcChoice : public ppdcShared {
+ public:
+ ppdcString *name, *text, *code;
+};
+Members
+
+code
+PS code of choice
+
+
+
+
+void ppdcChoice (
+ const char *n,
+ const char *t,
+ const char *c
+);
+Parameters
+
+n
+Name of choice
+t
+Text of choice
+c
+Code of choice
+
+
+
+
+void ~ppdcChoice (void);
+
+// Constraint
+class ppdcConstraint : public ppdcShared {
+ public:
+ ppdcString *option1, *choice1, *option2, *choice2;
+};
+Members
+
+choice2
+Second choice
+
+
+
+
+void ppdcConstraint (
+ const char *o1,
+ const char *c1,
+ const char *o2,
+ const char *c2
+);
+Parameters
+
+o1
+First option
+c1
+First choice
+o2
+Second option
+c2
+Second choice
+
+
+
+
+void ~ppdcConstraint (void);
+
+// Printer Driver Data
+class ppdcDriver : public ppdcShared {
+ public:
+ ppdcArray *copyright;
+ ppdcString *custom_size_code;
+ ppdcString *default_font, *default_size;
+ float left_margin, bottom_margin, right_margin, top_margin, max_width, max_length, min_width, min_length;
+ ppdcArray *attrs, *constraints, *filters, *fonts, *groups, *profiles, *sizes;
+ int model_number, manual_copies, color_device, throughput;
+ ppdcDrvType type;
+ int variable_paper_size;
+ ppdcString *manufacturer, *model_name, *file_name, *pc_file_name, *version;
+};
+Members
+
+copyright
+Copyright strings
+custom_size_code
+Custom page size code, if any
+default_size
+Default size option
+min_length
+Minimum length (points)
+sizes
+Fixed sizes
+throughput
+Throughput in pages per minute
+type
+Driver type
+variable_paper_size
+Support variable sizes?
+version
+Version number
+
+
+
+
+void PPDC_NAME (
+ void add_attr(ppdcAttr *a
+);
+Parameters
+
+a
+
+
+
+
+void add_constraint (
+ ppdcConstraint *c
+);
+Parameters
+
+c
+
+
+
+
+void add_copyright (
+ const char *c
+);
+Parameters
+
+c
+
+
+
+
+void add_filter (
+ ppdcFilter *f
+);
+Parameters
+
+f
+
+
+
+
+void add_font (
+ ppdcFont *f
+);
+Parameters
+
+f
+
+
+
+
+void add_group (
+ ppdcGroup *g
+);
+Parameters
+
+g
+
+
+
+
+void add_profile (
+ ppdcProfile *p
+);
+Parameters
+
+p
+
+
+
+
+void add_size (
+ ppdcMediaSize *m
+);
+Parameters
+
+m
+
+
+
+
+ppdcAttr *find_attr (
+ const char *k,
+ const char *s
+);
+Parameters
+
+k
+Keyword string
+s
+Spec string
+
+Return Value
+Attribute or NULL
+
+
+
+ppdcGroup *find_group (
+ const char *n
+);
+Parameters
+
+n
+Group name
+
+Return Value
+Matching group or NULL
+
+
+
+ppdcOption *find_option (
+ const char *n
+);
+Parameters
+
+n
+Option name
+
+Return Value
+Matching option or NULL
+
+
+
+void ppdcDriver (
+ ppdcDriver *d
+);
+Parameters
+
+d
+Printer driver template
+
+
+
+
+void set_custom_size_code (
+ const char *c
+);
+Parameters
+
+c
+CustomPageSize code
+
+
+
+
+void set_default_font (
+ ppdcFont *f
+);
+Parameters
+
+f
+Font
+
+
+
+
+void set_default_size (
+ ppdcMediaSize *m
+);
+Parameters
+
+m
+Media size
+
+
+
+
+void set_file_name (
+ const char *f
+);
+Parameters
+
+f
+Filename
+
+
+
+
+void set_manufacturer (
+ const char *m
+);
+Parameters
+
+m
+Model name
+
+
+
+
+void set_model_name (
+ const char *m
+);
+Parameters
+
+m
+Model name
+
+
+
+
+void set_pc_file_name (
+ const char *f
+);
+Parameters
+
+f
+Filename
+
+
+
+
+void set_version (
+ const char *v
+);
+Parameters
+
+v
+Version
+
+
+
+
+int write_ppd_file (
+ cups_file_t *fp,
+ ppdcCatalog *catalog,
+ ppdcArray *locales,
+ ppdcSource *src,
+ ppdcLineEnding le
+);
+Parameters
+
+fp
+PPD file
+catalog
+Message catalog
+locales
+Additional languages to add
+src
+Driver source
+le
+Line endings to use
+
+Return Value
+0 on success, -1 on failure
+
+
+
+void ~ppdcDriver (void);
+
+// File
+class ppdcFile {
+ public:
+ const char *filename;
+ cups_file_t *fp;
+ int line;
+};
+Members
+
+filename
+Filename
+fp
+File pointer
+line
+Line in file
+
+
+Get a character from a file.
+
+int get (void);
+Return Value
+
+
+
+
+int peek (void);
+Return Value
+Next character in file
+
+
+
+void ppdcFile (
+ const char *f,
+ cups_file_t *ffp
+);
+Parameters
+
+f
+File to open
+ffp
+File pointer to use
+
+
+
+
+void ~ppdcFile (void);
+
+// Filter Program
+class ppdcFilter : public ppdcShared {
+ public:
+ int cost;
+ ppdcString *mime_type, *program;
+};
+Members
+
+cost
+Relative cost of filter
+program
+Filter program
+
+
+
+
+void ppdcFilter (
+ const char *t,
+ const char *p,
+ int c
+);
+Parameters
+
+t
+MIME type
+p
+Filter program
+c
+Relative cost
+
+
+
+
+void ~ppdcFilter (void);
+
+// Shared Font
+class ppdcFont : public ppdcShared {
+ public:
+ ppdcString *name, *encoding, *version, *charset;
+ ppdcFontStatus status;
+};
+Members
+
+charset
+Font charset
+status
+Font status (ROM or Disk)
+
+
+
+
+void ppdcFont (
+ const char *n,
+ const char *e,
+ const char *v,
+ const char *c,
+ ppdcFontStatus s
+);
+Parameters
+
+n
+Name of font
+e
+Font encoding
+v
+Font version
+c
+Font charset
+s
+Font status
+
+
+
+
+void ~ppdcFont (void);
+
+// Group of Options
+class ppdcGroup : public ppdcShared {
+ public:
+ ppdcArray *options;
+ ppdcString *name, *text;
+};
+Members
+
+options
+Options
+text
+Human-readable text of option
+
+
+
+
+void PPDC_NAME (
+ void add_option(ppdcOption *o
+);
+Parameters
+
+o
+
+
+Find an option in a group.
+
+ppdcOption *find_option (
+ const char *n
+);
+Parameters
+
+n
+Name of option
+
+Return Value
+
+
+
+
+void ppdcGroup (
+ ppdcGroup *g
+);
+Parameters
+
+g
+Group template
+
+
+
+
+void ~ppdcGroup (void);
+
+// Shared integer
+class ppdcInteger : public ppdcShared {
+ public:
+ int *value;
+};
+Members
+
+value
+Integer value
+
+
+Integer value
+
+void ppdcInteger (
+ int *v
+);
+Parameters
+
+v
+
+
+// Media Size
+class ppdcMediaSize : public ppdcShared {
+ public:
+ ppdcString *size_code, *region_code;
+ ppdcString *name, *text;
+ float width, length, left, bottom, right, top;
+};
+Members
+
+region_code
+PageRegion code, if any
+text
+Human-readable text
+top
+Top limit in points
+
+
+
+
+void ppdcMediaSize (
+ const char *n,
+ const char *t,
+ float w,
+ float l,
+ float lm,
+ float bm,
+ float rm,
+ float tm,
+ const char *sc,
+ const char *rc
+);
+Parameters
+
+n
+Name of media size
+t
+Text of media size
+w
+Width in points
+l
+Length in points
+lm
+Left margin in points
+bm
+Bottom margin in points
+rm
+Right margin in points
+tm
+Top margin in points
+sc
+PageSize code, if any
+rc
+PageRegion code, if any
+
+
+
+
+void ~ppdcMediaSize (void);
+
+// Translation message
+class ppdcMessage : public ppdcShared {
+ public:
+ ppdcString *id, *string;
+};
+Members
+
+string
+Translation string
+
+
+
+
+void ppdcMessage (
+ const char *i,
+ const char *s
+);
+Parameters
+
+i
+ID
+s
+Text
+
+
+
+
+void ~ppdcMessage (void);
+
+// Option
+class ppdcOption : public ppdcShared {
+ public:
+ ppdcArray *choices;
+ ppdcString *defchoice;
+ float order;
+ ppdcOptSection section;
+ ppdcString *name, *text;
+ ppdcOptType type;
+};
+Members
+
+choices
+Choices
+defchoice
+Default choice
+order
+Order number
+section
+Section for option code
+text
+Human-readable text of option
+type
+Type of option
+
+
+
+
+void PPDC_NAME (
+ void add_choice(ppdcChoice *c
+);
+Parameters
+
+c
+
+
+
+
+ppdcChoice *find_choice (
+ const char *n
+);
+Parameters
+
+n
+Name of choice
+
+Return Value
+Choice or NULL
+
+
+
+void ppdcOption (
+ ppdcOption *o
+);
+Parameters
+
+o
+Template option
+
+
+
+
+void set_defchoice (
+ ppdcChoice *c
+);
+Parameters
+
+c
+Choice
+
+
+
+
+void ~ppdcOption (void);
+
+// Color Profile
+class ppdcProfile : public ppdcShared {
+ public:
+ ppdcString *resolution, *media_type;
+ float density, gamma, profile[9];
+};
+Members
+
+media_type
+Media type name
+profile[9]
+Color profile matrix
+
+
+
+
+void ppdcProfile (
+ const char *r,
+ const char *m,
+ float d,
+ float g,
+ const float *p
+);
+Parameters
+
+r
+Resolution name
+m
+Media type name
+d
+Density
+g
+Gamma
+p
+3x3 transform matrix
+
+
+
+
+void ~ppdcProfile (void);
+
+// Shared Data Value
+class ppdcShared {
+ private:
+ int use;
+};
+Members
+
+use
+Use count (delete when 0)
+
+
+
+
+virtual const char *class_name (void);
+Return Value
+
+
+
+
+void ppdcShared (void);
+
+
+
+void release (void);
+
+
+
+void retain (void);
+
+
+
+void ~ppdcShared (void);
+
+// Source File
+class ppdcSource : public ppdcShared {
+ public:
+ int cond_state, *cond_current, cond_stack[101];
+ static const char *driver_types[];
+ ppdcString *filename;
+ static ppdcArray *includes;
+ ppdcArray *base_fonts, *drivers, *po_files, *sizes, *vars;
+};
+Members
+
+cond_stack[101]
+#if state stack
+driver_types[]
+Driver types
+filename
+Filename
+includes
+Include directories
+vars
+Defined variables
+
+
+
+
+void PPDC_NAME (
+ static void add_include(const char *d
+);
+Parameters
+
+d
+
+
+
+
+void add_include (
+ const char *d
+);
+Parameters
+
+d
+Include directory
+
+
+
+
+ppdcDriver *find_driver (
+ const char *f
+);
+Parameters
+
+f
+Driver file name
+
+Return Value
+Driver
+
+
+
+char *find_include (
+ const char *f,
+ const char *base,
+ char *n,
+ int nlen
+);
+Parameters
+
+f
+Include filename
+base
+Current directory
+n
+Path buffer
+nlen
+Path buffer length
+
+Return Value
+Found path or NULL
+
+
+
+ppdcCatalog *find_po (
+ const char *l
+);
+Parameters
+
+l
+Locale name
+
+Return Value
+Message catalog or NULL
+
+
+
+ppdcMediaSize *find_size (
+ const char *s
+);
+Parameters
+
+s
+Size name
+
+Return Value
+Size
+
+
+
+ppdcVariable *find_variable (
+ const char *n
+);
+Parameters
+
+n
+Variable name
+
+Return Value
+Variable
+
+
+
+ppdcAttr *get_attr (
+ ppdcFile *fp,
+ bool loc
+);
+Parameters
+
+fp
+File to read
+loc
+Localize this attribute?
+
+Return Value
+Attribute
+
+
+
+int get_boolean (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Boolean value
+
+
+
+ppdcChoice *get_choice (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Choice data
+
+
+
+ppdcChoice *get_color_model (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Choice data
+
+
+
+int get_color_order (
+ const char *co
+);
+Parameters
+
+co
+Color order string
+
+Return Value
+Color order value
+
+
+
+ppdcProfile *get_color_profile (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Color profile
+
+
+
+int get_color_space (
+ const char *cs
+);
+Parameters
+
+cs
+Colorspace string
+
+Return Value
+Colorspace value
+
+
+
+ppdcConstraint *get_constraint (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Constraint
+
+
+
+ppdcMediaSize *get_custom_size (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Media size
+
+
+
+void get_duplex (
+ ppdcFile *fp,
+ ppdcDriver *d
+);
+Parameters
+
+fp
+File to read from
+d
+Current driver
+
+
+
+
+ppdcFilter *get_filter (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Filter
+
+
+
+float get_float (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Number
+
+
+
+ppdcFont *get_font (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Font data
+
+
+
+ppdcChoice *get_generic (
+ ppdcFile *fp,
+ const char *keyword,
+ const char *tattr,
+ const char *nattr
+);
+Parameters
+
+fp
+File to read
+keyword
+Keyword name
+tattr
+Text attribute
+nattr
+Numeric attribute
+
+Return Value
+Choice data
+
+
+
+ppdcGroup *get_group (
+ ppdcFile *fp,
+ ppdcDriver *d
+);
+Parameters
+
+fp
+File to read
+d
+Printer driver
+
+Return Value
+Group
+
+
+
+ppdcOption *get_installable (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Option
+
+
+
+int get_integer (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Integer value
+
+
+
+float get_measurement (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Measurement value in points
+
+
+
+ppdcOption *get_option (
+ ppdcFile *fp,
+ ppdcDriver *d,
+ ppdcGroup *g
+);
+Parameters
+
+fp
+File to read
+d
+Printer driver
+g
+Current group
+
+Return Value
+Option
+
+
+
+ppdcCatalog *get_po (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Message catalog
+
+
+
+ppdcChoice *get_resolution (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Choice data
+
+
+
+ppdcProfile *get_simple_profile (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Color profile
+
+
+
+ppdcMediaSize *get_size (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Media size
+
+
+
+char *get_token (
+ ppdcFile *fp,
+ char *buffer,
+ int buflen
+);
+Parameters
+
+fp
+File to read
+buffer
+Buffer
+buflen
+Length of buffer
+
+Return Value
+Token string or NULL
+
+
+
+ppdcVariable *get_variable (
+ ppdcFile *fp
+);
+Parameters
+
+fp
+File to read
+
+Return Value
+Variable
+
+
+
+int import_ppd (
+ const char *f
+);
+Parameters
+
+f
+Filename
+
+Return Value
+1 on success, 0 on failure
+
+
+
+void ppdcSource (
+ const char *f,
+ cups_file_t *ffp
+);
+Parameters
+
+f
+File to read
+ffp
+File pointer to use
+
+
+
+
+int quotef (
+ cups_file_t *fp,
+ const char *format,
+ ...
+);
+Parameters
+
+fp
+File to write to
+format
+Printf-style format string
+...
+Additional args as needed
+
+Return Value
+Number bytes on success, -1 on failure
+
+
+
+void read_file (
+ const char *f,
+ cups_file_t *ffp
+);
+Parameters
+
+f
+File to read
+ffp
+File pointer to use
+
+
+
+
+void scan_file (
+ ppdcFile *fp,
+ ppdcDriver *td,
+ bool inc
+);
+Parameters
+
+fp
+File to read
+td
+Driver template
+inc
+Including?
+
+
+
+
+ppdcVariable *set_variable (
+ const char *name,
+ const char *value
+);
+Parameters
+
+name
+Name
+value
+Value
+
+Return Value
+Variable
+
+
+
+int write_file (
+ const char *f
+);
+Parameters
+
+f
+File to write
+
+Return Value
+0 on success, -1 on error
+
+
+
+void ~ppdcSource (void);
+
+// Shared String
+class ppdcString : public ppdcShared {
+ public:
+ char *value;
+};
+Members
+
+value
+String value
+
+
+
+
+void ppdcString (
+ const char *v
+);
+Parameters
+
+v
+String
+
+
+
+
+void ~ppdcString (void);
+
+// Variable Definition
+class ppdcVariable : public ppdcShared {
+ public:
+ ppdcString *name, *value;
+};
+Members
+
+value
+Value of variable
+
+
+
+
+void PPDC_NAME (
+ void set_value(const char *v
+);
+Parameters
+
+v
+
+
+
+
+void ppdcVariable (
+ const char *n,
+ const char *v
+);
+Parameters
+
+n
+Name of variable
+v
+Value of variable
+
+
+
+
+void set_value (
+ const char *v
+);
+Parameters
+
+v
+
+
+
+
+void ~ppdcVariable (void);
+
+
+
+
+typedef enum ppdc_cs_t;
+
+
+
+// Printer Driver Data
+class ppdcSource;
+
+
+// Condition flags
+Constants
+
+PPDC_COND_NORMAL
+Normal state
+PPDC_COND_SATISFIED
+At least one condition satisfied
+PPDC_COND_SKIP
+Skip state
+
+
+// Driver type
+Constants
+
+PPDC_DRIVER_CUSTOM
+Custom driver
+PPDC_DRIVER_EPSON
+rastertoepson driver
+PPDC_DRIVER_ESCP
+rastertoescpx driver
+PPDC_DRIVER_HP
+rastertohp driver
+PPDC_DRIVER_LABEL
+rastertolabel/rastertodymo driver
+PPDC_DRIVER_MAX
+Number of driver types defined
+PPDC_DRIVER_PCL
+rastertopclx driver
+PPDC_DRIVER_PS
+PostScript driver
+
+
+// Load status of font
+Constants
+
+PPDC_FONT_DISK
+Font is on disk
+PPDC_FONT_ROM
+Font is in ROM
+
+
+// Line endings
+Constants
+
+PPDC_CRLF
+CR + LF
+PPDC_CRONLY
+CR only
+PPDC_LFONLY
+LF only
+
+
+// Option section
+Constants
+
+PPDC_SECTION_ANY
+AnySetup
+PPDC_SECTION_DOCUMENT
+DocumentSetup
+PPDC_SECTION_EXIT
+ExitServer
+PPDC_SECTION_JCL
+JCLSetup
+PPDC_SECTION_PAGE
+PageSetup
+PPDC_SECTION_PROLOG
+Prolog
+
+
+// Option type
+Constants
+
+PPDC_BOOLEAN
+True/false option
+PPDC_PICKMANY
+Multiple choices from list
+PPDC_PICKONE
+Single choice from list
+
+
+
+