Load cups into easysw/current.

git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@13 a1ca3aef-8c08-0410-bb20-df032aa958be
Esse commit está contido em:
jlovell
2006-01-26 21:39:43 +00:00
commit fa73b22906
202 arquivos alterados com 26712 adições e 22694 exclusões
+11 -4
Ver Arquivo
@@ -1,8 +1,15 @@
CHANGES.txt - 01/12/2006
CHANGES.txt - 01/18/2006
------------------------
CHANGES IN CUPS V1.2.0b1
- All of the Berkeley (except for lpc) and System V
commands now support specification of user, host, and
port (STR #1028, STR #1029, STR #1087)
- The lpmove command now allows you to move all jobs for
a given queue (STR #56)
- The web interface now supports moving of a job or jobs
to another queue (STR #56)
- The web interface now provides searching, paging, and
changing of the sort/display order of classes, jobs,
and printers.
@@ -13,9 +20,9 @@ CHANGES IN CUPS V1.2.0b1
UI text (STR #1101)
- Printer names can now (reliably) contain Unicode
characters (STR #896)
- The "lpstat -p" command now shows the time and date of
the last printer state change instead of the hardcoded
"Jan 01 00:00" (STR #659)
- The lpstat command now shows the time and date of the
last printer state change instead of the hardcoded "Jan
01 00:00" (STR #659)
- The scheduler now adds a job-actual-printer-uri
attribute to job objects when printing to a class (STR
#116)
+12 -12
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: Makefile 4835 2005-11-12 22:00:16Z mike $"
# "$Id: Makefile 4971 2006-01-24 14:33:18Z mike $"
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -92,25 +92,25 @@ install: installhdrs
echo Installing startup script...
if test "x$(INITDIR)" != "x"; then \
$(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/init.d; \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
fi
if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
$(INSTALL_SCRIPT) cups.osx $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(INSTALL_DATA) cups.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
$(INSTALL_SCRIPT) init/cups.osx $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(INSTALL_DATA) init/cups.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
$(INSTALL_DATA) cups.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
$(INSTALL_DATA) init/cups.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
else \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
fi \
fi
@@ -167,5 +167,5 @@ tardist:
epm $(EPMFLAGS) -f tardist cups packaging/cups.list
#
# End of "$Id: Makefile 4835 2005-11-12 22:00:16Z mike $".
# End of "$Id: Makefile 4971 2006-01-24 14:33:18Z mike $".
#
+39 -128
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: ipp.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: ipp.c 4926 2006-01-13 03:12:13Z mike $"
*
* IPP backend for the Common UNIX Printing System (CUPS).
*
@@ -68,8 +68,7 @@ static char tmpfilename[1024] = ""; /* Temporary spool file name */
* Local functions...
*/
void check_printer_state(http_t *http, cups_lang_t *language,
const char *charset, const char *uri, /* I - Printer URI */
void check_printer_state(http_t *http, const char *uri,
const char *resource, const char *user,
int version);
const char *password_cb(const char *);
@@ -119,12 +118,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
ipp_attribute_t *job_sheets; /* job-media-sheets-completed attribute */
ipp_attribute_t *job_state; /* job-state attribute */
ipp_attribute_t *copies_sup; /* copies-supported attribute */
ipp_attribute_t *charset_sup; /* charset-supported attribute */
ipp_attribute_t *format_sup; /* document-format-supported attribute */
ipp_attribute_t *printer_state; /* printer-state attribute */
ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs attribute */
const char *charset; /* Character set to use */
cups_lang_t *language; /* Default language */
int copies; /* Number of copies remaining */
const char *content_type; /* CONTENT_TYPE environment variable */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
@@ -135,7 +131,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
static const char * const pattrs[] =
{ /* Printer attributes we want */
"copies-supported",
"charset-supported",
"document-format-supported",
"printer-is-accepting-jobs",
"printer-state",
@@ -539,11 +534,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* don't support the copies attribute...
*/
language = cupsLangDefault();
charset_sup = NULL;
copies_sup = NULL;
format_sup = NULL;
supported = NULL;
copies_sup = NULL;
format_sup = NULL;
supported = NULL;
do
{
@@ -551,17 +544,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Build the IPP request...
*/
request = ippNew();
request->request.op.version[1] = version;
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language != NULL ? language->language : "en");
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.version[1] = version;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -634,10 +618,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
copies_sup = NULL; /* No */
}
charset_sup = ippFindAttribute(supported, "charset-supported",
IPP_TAG_CHARSET);
format_sup = ippFindAttribute(supported, "document-format-supported",
IPP_TAG_MIMETYPE);
format_sup = ippFindAttribute(supported, "document-format-supported",
IPP_TAG_MIMETYPE);
if (format_sup)
{
@@ -704,43 +686,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
else
copies = atoi(argv[4]);
/*
* Figure out the character set to use...
*/
charset = language ? cupsLangEncoding(language) : "us-ascii";
if (charset_sup)
{
/*
* See if IPP server supports the requested character set...
*/
for (i = 0; i < charset_sup->num_values; i ++)
if (strcasecmp(charset, charset_sup->values[i].string.text) == 0)
break;
/*
* If not, choose us-ascii or utf-8...
*/
if (i >= charset_sup->num_values)
{
/*
* See if us-ascii is supported...
*/
for (i = 0; i < charset_sup->num_values; i ++)
if (strcasecmp("us-ascii", charset_sup->values[i].string.text) == 0)
break;
if (i < charset_sup->num_values)
charset = "us-ascii";
else
charset = "utf-8";
}
}
/*
* Then issue the print-job request...
*/
@@ -753,17 +698,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Build the IPP request...
*/
request = ippNew();
request->request.op.version[1] = version;
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, charset);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language != NULL ? language->language : "en");
request = ippNewRequest(IPP_PRINT_JOB);
request->request.op.version[1] = version;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -923,17 +859,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Build an IPP_GET_JOB_ATTRIBUTES request...
*/
request = ippNew();
request->request.op.version[1] = version;
request->request.op.operation_id = IPP_GET_JOB_ATTRIBUTES;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, charset);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language != NULL ? language->language : "en");
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
request->request.op.version[1] = version;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -999,8 +926,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (job_state->values[0].integer > IPP_JOB_PROCESSING ||
job_state->values[0].integer == IPP_JOB_HELD)
{
if ((job_sheets = ippFindAttribute(response, "job-media-sheets-completed",
IPP_TAG_INTEGER)) != NULL)
if ((job_sheets = ippFindAttribute(response,
"job-media-sheets-completed",
IPP_TAG_INTEGER)) != NULL)
fprintf(stderr, "PAGE: total %d\n", job_sheets->values[0].integer);
ippDelete(response);
@@ -1016,11 +944,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Check the printer state and report it if necessary...
*/
/* if (!copies_sup)
httpReconnect(http);*/
check_printer_state(http, language, charset, uri, resource, argv[2],
version);
check_printer_state(http, uri, resource, argv[2], version);
/*
* Wait 10 seconds before polling again...
@@ -1037,7 +961,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
/* if (!copies_sup)
httpReconnect(http);*/
check_printer_state(http, language, charset, uri, resource, argv[2], version);
check_printer_state(http, uri, resource, argv[2], version);
/*
* Free memory...
@@ -1073,16 +997,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
void
check_printer_state(http_t *http, /* I - HTTP connection */
cups_lang_t *language,
/* I - Language */
const char *charset,
/* I - Charset */
const char *uri, /* I - Printer URI */
const char *resource,
/* I - Resource path */
const char *user, /* I - Username, if any */
int version)/* I - IPP version */
check_printer_state(
http_t *http, /* I - HTTP connection */
const char *uri, /* I - Printer URI */
const char *resource, /* I - Resource path */
const char *user, /* I - Username, if any */
int version) /* I - IPP version */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
@@ -1092,17 +1012,8 @@ check_printer_state(http_t *http, /* I - HTTP connection */
* Check on the printer state...
*/
request = ippNew();
request->request.op.version[1] = version;
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, charset);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language != NULL ? language->language : "en");
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.version[1] = version;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1130,8 +1041,8 @@ check_printer_state(http_t *http, /* I - HTTP connection */
* 'password_cb()' - Disable the password prompt for cupsDoFileRequest().
*/
const char * /* O - Password */
password_cb(const char *prompt) /* I - Prompt (not used) */
const char * /* O - Password */
password_cb(const char *prompt) /* I - Prompt (not used) */
{
(void)prompt;
@@ -1279,17 +1190,17 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */
* PostScript file for printing...
*/
int /* O - Exit status of filter */
run_pictwps_filter(char **argv, /* I - Command-line arguments */
const char *filename) /* I - Filename */
int /* O - Exit status of filter */
run_pictwps_filter(char **argv, /* I - Command-line arguments */
const char *filename)/* I - Filename */
{
struct stat fileinfo; /* Print file information */
const char *ppdfile; /* PPD file for destination printer */
int pid; /* Child process ID */
int fd; /* Temporary file descriptor */
int status; /* Exit status of filter */
const char *printer; /* PRINTER env var */
static char ppdenv[1024]; /* PPD environment variable */
struct stat fileinfo; /* Print file information */
const char *ppdfile; /* PPD file for destination printer */
int pid; /* Child process ID */
int fd; /* Temporary file descriptor */
int status; /* Exit status of filter */
const char *printer; /* PRINTER env var */
static char ppdenv[1024]; /* PPD environment variable */
/*
@@ -1464,5 +1375,5 @@ sigterm_handler(int sig) /* I - Signal */
/*
* End of "$Id: ipp.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: ipp.c 4926 2006-01-13 03:12:13Z mike $".
*/
+123 -45
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: lpd.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: lpd.c 4991 2006-01-26 15:01:46Z mike $"
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
@@ -59,6 +59,10 @@
# include <arpa/inet.h>
# include <netdb.h>
#endif /* WIN32 */
#ifdef __APPLE__
# include <CoreFoundation/CFNumber.h>
# include <CoreFoundation/CFPreferences.h>
#endif /* __APPLE__ */
/*
@@ -95,7 +99,7 @@ static int lpd_queue(const char *hostname, int port, const char *printer,
const char *filename,
const char *user, const char *title, int copies,
int banner, int format, int order, int reserve,
int manual_copies, int timeout);
int manual_copies, int timeout, int contimeout);
static void lpd_timeout(int sig);
static int lpd_write(int lpd_fd, char *buffer, int length);
#ifndef HAVE_RRESVPORT_AF
@@ -135,6 +139,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int sanitize_title; /* Sanitize title string? */
int manual_copies, /* Do manual copies? */
timeout, /* Timeout */
contimeout, /* Connection timeout */
copies; /* Number of copies */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
@@ -243,18 +248,41 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* See if there are any options...
*/
banner = 0;
format = 'l';
order = ORDER_CONTROL_DATA;
reserve = RESERVE_ANY;
manual_copies = 1;
timeout = 300;
sanitize_title = 1;
banner = 0;
format = 'l';
order = ORDER_CONTROL_DATA;
reserve = RESERVE_ANY;
manual_copies = 1;
timeout = 300;
contimeout = 7 * 24 * 60 * 60;
#if defined(__APPLE__)
#ifdef __APPLE__
/* We want to pass utf-8 characters, not re-map them (3071945) */
sanitize_title= 0;
#endif
sanitize_title = 0;
{
CFPropertyListRef pvalue; /* Preference value */
SInt32 toval; /* Timeout value */
pvalue = CFPreferencesCopyValue(CFSTR("timeout"),
CFSTR("com.apple.print.backends"),
kCFPreferencesAnyUser,
kCFPreferencesCurrentHost);
if (pvalue)
{
if (CFGetTypeID(pvalue) == CFNumberGetTypeID())
{
CFNumberGetValue(pvalue, kCFNumberSInt32Type, &toval);
contimeout = (int)toval;
}
CFRelease(pvalue);
}
}
#else
sanitize_title = 1;
#endif /* __APPLE__ */
if ((options = strchr(resource, '?')) != NULL)
{
@@ -293,7 +321,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
if (*options == '+' || *options == '&')
options ++;
}
else
@@ -303,51 +331,47 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Process the option...
*/
if (strcasecmp(name, "banner") == 0)
if (!strcasecmp(name, "banner"))
{
/*
* Set the banner...
*/
banner = !value[0] ||
strcasecmp(value, "on") == 0 ||
strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "true") == 0;
banner = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
else if (strcasecmp(name, "format") == 0 && value[0])
else if (!strcasecmp(name, "format") && value[0])
{
/*
* Set output format...
*/
if (strchr("cdfglnoprtv", value[0]) != NULL)
if (strchr("cdfglnoprtv", value[0]))
format = value[0];
else
fprintf(stderr, "ERROR: Unknown format character \"%c\"\n", value[0]);
}
else if (strcasecmp(name, "order") == 0 && value[0])
else if (!strcasecmp(name, "order") && value[0])
{
/*
* Set control/data order...
*/
if (strcasecmp(value, "control,data") == 0)
if (!strcasecmp(value, "control,data"))
order = ORDER_CONTROL_DATA;
else if (strcasecmp(value, "data,control") == 0)
else if (!strcasecmp(value, "data,control"))
order = ORDER_DATA_CONTROL;
else
fprintf(stderr, "ERROR: Unknown file order \"%s\"\n", value);
}
else if (strcasecmp(name, "reserve") == 0)
else if (!strcasecmp(name, "reserve"))
{
/*
* Set port reservation mode...
*/
if (!value[0] ||
!strcasecmp(value, "on") ||
!strcasecmp(value, "yes") ||
!strcasecmp(value, "true") ||
if (!value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true") ||
!strcasecmp(value, "rfc1179"))
reserve = RESERVE_RFC1179;
else if (!strcasecmp(value, "any"))
@@ -355,29 +379,25 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
else
reserve = RESERVE_NONE;
}
else if (strcasecmp(name, "manual_copies") == 0)
else if (!strcasecmp(name, "manual_copies"))
{
/*
* Set manual copies...
*/
manual_copies = !value[0] ||
strcasecmp(value, "on") == 0 ||
strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "true") == 0;
manual_copies = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
else if (strcasecmp(name, "sanitize_title") == 0)
else if (!strcasecmp(name, "sanitize_title"))
{
/*
* Set sanitize title...
*/
sanitize_title = !value[0] ||
strcasecmp(value, "on") == 0 ||
strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "true") == 0;
sanitize_title = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
else if (strcasecmp(name, "timeout") == 0)
else if (!strcasecmp(name, "timeout"))
{
/*
* Set the timeout...
@@ -386,6 +406,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (atoi(value) > 0)
timeout = atoi(value);
}
else if (!strcasecmp(name, "contimeout"))
{
/*
* Set the timeout...
*/
if (atoi(value) > 0)
contimeout = atoi(value);
}
}
}
@@ -426,7 +455,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
status = lpd_queue(hostname, port, resource + 1, filename,
username, title, copies,
banner, format, order, reserve, manual_copies, timeout);
banner, format, order, reserve, manual_copies,
timeout, contimeout);
if (!status)
fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4]));
@@ -434,7 +464,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
else
status = lpd_queue(hostname, port, resource + 1, filename,
username, title, 1,
banner, format, order, reserve, 1, timeout);
banner, format, order, reserve, 1,
timeout, contimeout);
/*
* Remove the temporary file if necessary...
@@ -536,7 +567,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
int order, /* I - Order of data/control files */
int reserve, /* I - Reserve ports? */
int manual_copies, /* I - Do copies by hand... */
int timeout) /* I - Timeout... */
int timeout, /* I - Timeout... */
int contimeout) /* I - Connection timeout */
{
FILE *fp; /* Job file */
char localhost[255]; /* Local host name */
@@ -551,6 +583,10 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Socket address */
int copy; /* Copies written */
time_t start_time; /* Time of first connect */
#ifdef __APPLE__
int recoverable; /* Recoverable error shown? */
#endif /* __APPLE__ */
size_t nbytes; /* Number of bytes written */
off_t tbytes; /* Total bytes written */
char buffer[65536]; /* Output buffer */
@@ -588,6 +624,15 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
return (CUPS_BACKEND_STOP);
}
/*
* Remember when we starting trying to connect to the printer...
*/
#ifdef __APPLE__
recoverable = 0;
#endif /* __APPLE__ */
start_time = time(NULL);
/*
* Loop forever trying to print the file...
*/
@@ -714,7 +759,20 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (error == ECONNREFUSED || error == EHOSTDOWN ||
error == EHOSTUNREACH)
{
fprintf(stderr, "WARNING: Network host \'%s\' is busy, down, or unreachable; will retry in 30 seconds...\n",
if (contimeout && (time(NULL) - start_time) > contimeout)
{
fputs("ERROR: Printer not responding!\n", stderr);
return (CUPS_BACKEND_FAILED);
}
#ifdef __APPLE__
recoverable = 1;
fprintf(stderr, "WARNING: recoverable: "
#else
fprintf(stderr, "WARNING: "
#endif /* __APPLE__ */
"Network host \'%s\' is busy, down, or "
"unreachable; will retry in 30 seconds...\n",
hostname);
sleep(30);
}
@@ -728,11 +786,31 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
else
{
perror("ERROR: Unable to connect to printer; will retry in 30 seconds...");
#ifdef __APPLE__
recoverable = 1;
perror("ERROR: recoverable: "
#else
perror("ERROR: "
#endif /* __APPLE__ */
"Unable to connect to printer; will retry in 30 seconds...");
sleep(30);
}
}
#ifdef __APPLE__
if (recoverable)
{
/*
* If we've shown a recoverable error make sure the printer proxies
* have a chance to see the recovered message. Not pretty but
* necessary for now...
*/
fputs("INFO: recovered: \n", stderr);
sleep(5);
}
#endif /* __APPLE__ */
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
fprintf(stderr, "DEBUG: Connected on ports %d (local %d)...\n", port,
lport);
@@ -1145,5 +1223,5 @@ sigterm_handler(int sig) /* I - Signal */
/*
* End of "$Id: lpd.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: lpd.c 4991 2006-01-26 15:01:46Z mike $".
*/
+104 -31
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: socket.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: socket.c 4974 2006-01-25 07:04:33Z mike $"
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
@@ -71,9 +71,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024]; /* Resource info (not used) */
resource[1024], /* Resource info (not used) */
*options, /* Pointer to options */
name[255], /* Name of option */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
int fp; /* Print file */
int copies; /* Number of copies to print */
int waiteof; /* Wait for end-of-file? */
int port; /* Port number */
char portname[255]; /* Port name */
int delay; /* Delay for retries... */
@@ -166,6 +171,71 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (port == 0)
port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */
/*
* Get options, if any...
*/
waiteof = 1;
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
/*
* Parse options...
*/
while (*options)
{
/*
* Get the name...
*/
for (ptr = name; *options && *options != '=';)
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
{
/*
* Get the value...
*/
options ++;
for (ptr = value; *options && *options != '+' && *options != '&';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+' || *options == '&')
options ++;
}
else
value[0] = '\0';
/*
* Process the option...
*/
if (!strcasecmp(name, "waiteof"))
{
/*
* Set the wait-for-eof value...
*/
waiteof = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
}
}
/*
* Then try to connect to the remote host...
*/
@@ -346,48 +416,51 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
(unsigned long)tbytes);
}
/*
* Shutdown the socket and wait for the other end to finish...
*/
fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
shutdown(fd, 1);
for (;;)
if (waiteof)
{
/*
* Wait a maximum of 90 seconds for backchannel data or a closed
* connection...
* Shutdown the socket and wait for the other end to finish...
*/
timeout.tv_sec = 90;
timeout.tv_usec = 0;
fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
FD_ZERO(&input);
FD_SET(fd, &input);
shutdown(fd, 1);
#ifdef __hpux
if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
#else
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
#endif /* __hpux */
for (;;)
{
/*
* Grab the data coming back and spit it out to stderr...
* Wait a maximum of 90 seconds for backchannel data or a closed
* connection...
*/
if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
timeout.tv_sec = 90;
timeout.tv_usec = 0;
FD_ZERO(&input);
FD_SET(fd, &input);
#ifdef __hpux
if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
#else
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
#endif /* __hpux */
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackchannelWrite(resource, rbytes, 1.0);
}
/*
* Grab the data coming back and spit it out to stderr...
*/
if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackchannelWrite(resource, rbytes, 1.0);
}
else
break;
}
else
break;
}
else
break;
}
/*
@@ -414,5 +487,5 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
/*
* End of "$Id: socket.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: socket.c 4974 2006-01-25 07:04:33Z mike $".
*/
+19 -22
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: lpc.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: lpc.c 4948 2006-01-19 03:23:41Z mike $"
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
@@ -85,7 +85,7 @@ main(int argc, /* I - Number of command-line arguments */
* Do the command prompt thing...
*/
printf("lpc> ");
_cupsLangPuts(stdout, _("lpc> "));
while (fgets(line, sizeof(line), stdin) != NULL)
{
/*
@@ -113,7 +113,7 @@ main(int argc, /* I - Number of command-line arguments */
* Nothing left, just show a prompt...
*/
printf("lpc> ");
_cupsLangPuts(stdout, _("lpc> "));
continue;
}
@@ -149,7 +149,7 @@ main(int argc, /* I - Number of command-line arguments */
* Put another prompt out to the user...
*/
printf("lpc> ");
_cupsLangPuts(stdout, _("lpc> "));
}
}
@@ -197,7 +197,7 @@ do_command(http_t *http, /* I - HTTP connection to server */
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
show_help(params);
else
_cupsLangPrintf(stdout, cupsLangDefault(),
_cupsLangPrintf(stdout,
_("%s is not implemented by the CUPS version of lpc.\n"),
command);
}
@@ -212,20 +212,17 @@ show_help(const char *command) /* I - Command to describe or NULL */
{
if (!command)
{
_cupsLangPrintf(stdout, cupsLangDefault(),
_cupsLangPrintf(stdout,
_("Commands may be abbreviated. Commands are:\n"
"\n"
"exit help quit status ?\n"));
}
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
_cupsLangPrintf(stdout, cupsLangDefault(),
_("help\t\tget help on commands\n"));
_cupsLangPrintf(stdout, _("help\t\tget help on commands\n"));
else if (!compare_strings(command, "status", 4))
_cupsLangPrintf(stdout, cupsLangDefault(),
_("status\t\tshow status of daemon and queue\n"));
_cupsLangPrintf(stdout, _("status\t\tshow status of daemon and queue\n"));
else
_cupsLangPrintf(stdout, cupsLangDefault(),
_("?Invalid help command unknown\n"));
_cupsLangPrintf(stdout, _("?Invalid help command unknown\n"));
}
@@ -474,7 +471,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
printf("%s:\n", printer);
if (!strncmp(device, "file:", 5))
_cupsLangPrintf(stdout, language,
_cupsLangPrintf(stdout,
_("\tprinter is on device \'%s\' speed -1\n"),
device + 5);
else
@@ -486,28 +483,28 @@ show_status(http_t *http, /* I - HTTP connection to server */
if ((delimiter = strchr(device, ':')) != NULL )
{
*delimiter = '\0';
_cupsLangPrintf(stdout, language,
_cupsLangPrintf(stdout,
_("\tprinter is on device \'%s\' speed -1\n"),
device);
}
}
if (accepting)
_cupsLangPuts(stdout, language, _("\tqueuing is enabled\n"));
_cupsLangPuts(stdout, _("\tqueuing is enabled\n"));
else
_cupsLangPuts(stdout, language, _("\tqueuing is disabled\n"));
_cupsLangPuts(stdout, _("\tqueuing is disabled\n"));
if (pstate != IPP_PRINTER_STOPPED)
_cupsLangPuts(stdout, language, _("\tprinting is enabled\n"));
_cupsLangPuts(stdout, _("\tprinting is enabled\n"));
else
_cupsLangPuts(stdout, language, _("\tprinting is disabled\n"));
_cupsLangPuts(stdout, _("\tprinting is disabled\n"));
if (jobcount == 0)
_cupsLangPuts(stdout, language, _("\tno entries\n"));
_cupsLangPuts(stdout, _("\tno entries\n"));
else
_cupsLangPrintf(stdout, language, _("\t%d entries\n"), jobcount);
_cupsLangPrintf(stdout, _("\t%d entries\n"), jobcount);
_cupsLangPuts(stdout, language, _("\tdaemon present\n"));
_cupsLangPuts(stdout, _("\tdaemon present\n"));
}
if (attr == NULL)
@@ -520,5 +517,5 @@ show_status(http_t *http, /* I - HTTP connection to server */
/*
* End of "$Id: lpc.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: lpc.c 4948 2006-01-19 03:23:41Z mike $".
*/
+139 -124
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: lpq.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: lpq.c 4948 2006-01-19 03:23:41Z mike $"
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
@@ -49,9 +49,9 @@
* Local functions...
*/
static int show_jobs(http_t *, const char *, const char *, const int,
const int);
static void show_printer(http_t *, const char *);
static int show_jobs(const char *, http_t *, const char *,
const char *, const int, const int);
static void show_printer(const char *, http_t *, const char *);
static void usage(void);
@@ -60,24 +60,24 @@ static void usage(void);
*/
int
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
int i; /* Looping var */
http_t *http; /* Connection to server */
const char *dest, /* Desired printer */
*user, /* Desired user */
*val; /* Environment variable name */
char *instance; /* Printer instance */
int id, /* Desired job ID */
all, /* All printers */
interval, /* Reporting interval */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
cups_lang_t *language; /* Language */
int i; /* Looping var */
http_t *http; /* Connection to server */
const char *dest, /* Desired printer */
*user, /* Desired user */
*val; /* Environment variable name */
char *instance; /* Printer instance */
int id, /* Desired job ID */
all, /* All printers */
interval, /* Reporting interval */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
cups_lang_t *language; /* Language */
#ifdef HAVE_SSL
http_encryption_t encryption; /* Encryption? */
http_encryption_t encryption; /* Encryption? */
#endif /* HAVE_SSL */
@@ -90,8 +90,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
cupsEncryption())) == NULL)
{
_cupsLangPuts(stderr, language,
_("lpq: Unable to contact server!\n"));
_cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]);
return (1);
}
@@ -121,12 +120,31 @@ main(int argc, /* I - Number of command-line arguments */
if (http)
httpEncryption(http, encryption);
#else
_cupsLangPrintf(stderr, language,
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
argv[0]);
#endif /* HAVE_SSL */
break;
case 'U' : /* Username */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
}
cupsSetUser(argv[i]);
}
break;
case 'P' : /* Printer */
if (argv[i][2])
dest = argv[i] + 2;
@@ -151,12 +169,13 @@ main(int argc, /* I - Number of command-line arguments */
if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
{
if (instance)
_cupsLangPrintf(stderr, language,
_("lpq: Unknown destination \"%s/%s\"!\n"),
dest, instance);
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s/%s\"!\n"),
argv[0], dest, instance);
else
_cupsLangPrintf(stderr, language,
_("lpq: Unknown destination \"%s\"!\n"), dest);
_cupsLangPrintf(stderr,
_("%s: Unknown destination \"%s\"!\n"),
argv[0], dest);
return (1);
}
@@ -166,6 +185,29 @@ main(int argc, /* I - Number of command-line arguments */
all = 1;
break;
case 'h' : /* Connect to host */
if (http != NULL)
httpClose(http);
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
"\'-h\' option!\n"),
argv[0]);
return (1);
}
else
cupsSetServer(argv[i]);
}
break;
case 'l' : /* Long status */
longstatus = 1;
break;
@@ -207,13 +249,14 @@ main(int argc, /* I - Number of command-line arguments */
val = "LPDEST";
if (dest && !cupsGetDest(dest, NULL, num_dests, dests))
_cupsLangPrintf(stderr, language,
_("lp: error - %s environment variable names "
_cupsLangPrintf(stderr,
_("%s: error - %s environment variable names "
"non-existent destination \"%s\"!\n"),
val, dest);
argv[0], val, dest);
else
_cupsLangPuts(stderr, language,
_("lpq: error - no default destination available.\n"));
_cupsLangPrintf(stderr,
_("%s: error - no default destination available.\n"),
argv[0]);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
@@ -227,9 +270,9 @@ main(int argc, /* I - Number of command-line arguments */
for (;;)
{
if (dest)
show_printer(http, dest);
show_printer(argv[0], http, dest);
i = show_jobs(http, dest, user, id, longstatus);
i = show_jobs(argv[0], http, dest, user, id, longstatus);
if (i && interval)
{
@@ -255,33 +298,33 @@ main(int argc, /* I - Number of command-line arguments */
* 'show_jobs()' - Show jobs.
*/
static int /* O - Number of jobs in queue */
show_jobs(http_t *http, /* I - HTTP connection to server */
const char *dest, /* I - Destination */
const char *user, /* I - User */
const int id, /* I - Job ID */
const int longstatus)/* I - 1 if long report desired */
static int /* O - Number of jobs in queue */
show_jobs(const char *command, /* I - Command name */
http_t *http, /* I - HTTP connection to server */
const char *dest, /* I - Destination */
const char *user, /* I - User */
const int id, /* I - Job ID */
const int longstatus) /* I - 1 if long report desired */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
const char *jobdest, /* Pointer into job-printer-uri */
*jobuser, /* Pointer to job-originating-user-name */
*jobname; /* Pointer to job-name */
ipp_jstate_t jobstate; /* job-state */
int jobid, /* job-id */
jobsize, /* job-k-octets */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
const char *jobdest, /* Pointer into job-printer-uri */
*jobuser, /* Pointer to job-originating-user-name */
*jobname; /* Pointer to job-name */
ipp_jstate_t jobstate; /* job-state */
int jobid, /* job-id */
jobsize, /* job-k-octets */
#ifdef __osf__
jobpriority, /* job-priority */
jobpriority, /* job-priority */
#endif /* __osf__ */
jobcount, /* Number of jobs */
jobcopies, /* Number of copies */
rank; /* Rank of job */
char resource[1024]; /* Resource string */
char rankstr[255]; /* Rank string */
char namestr[1024]; /* Job name string */
static const char *ranks[10] =/* Ranking strings */
jobcount, /* Number of jobs */
jobcopies, /* Number of copies */
rank; /* Rank of job */
char resource[1024]; /* Resource string */
char rankstr[255]; /* Rank string */
char namestr[1024]; /* Job name string */
static const char *ranks[10] = /* Ranking strings */
{
"th",
"st",
@@ -311,18 +354,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
* job-uri or printer-uri
*/
request = ippNew();
request->request.op.operation_id = id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
request->request.op.request_id = 1;
language = cupsLangDefault();
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
if (dest == NULL)
{
@@ -360,8 +392,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
_cupsLangPrintf(stderr, language, _("lpq: get-jobs failed: %s\n"),
ippErrorString(response->request.status.status_code));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
ippDelete(response);
return (0);
}
@@ -401,38 +432,38 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
{
if (strcmp(attr->name, "job-id") == 0 &&
if (!strcmp(attr->name, "job-id") &&
attr->value_tag == IPP_TAG_INTEGER)
jobid = attr->values[0].integer;
if (strcmp(attr->name, "job-k-octets") == 0 &&
if (!strcmp(attr->name, "job-k-octets") &&
attr->value_tag == IPP_TAG_INTEGER)
jobsize = attr->values[0].integer;
#ifdef __osf__
if (strcmp(attr->name, "job-priority") == 0 &&
if (!strcmp(attr->name, "job-priority") &&
attr->value_tag == IPP_TAG_INTEGER)
jobpriority = attr->values[0].integer;
#endif /* __osf__ */
if (strcmp(attr->name, "job-state") == 0 &&
if (!strcmp(attr->name, "job-state") &&
attr->value_tag == IPP_TAG_ENUM)
jobstate = (ipp_jstate_t)attr->values[0].integer;
if (strcmp(attr->name, "job-printer-uri") == 0 &&
if (!strcmp(attr->name, "job-printer-uri") &&
attr->value_tag == IPP_TAG_URI)
if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL)
jobdest ++;
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
if (!strcmp(attr->name, "job-originating-user-name") &&
attr->value_tag == IPP_TAG_NAME)
jobuser = attr->values[0].string.text;
if (strcmp(attr->name, "job-name") == 0 &&
if (!strcmp(attr->name, "job-name") &&
attr->value_tag == IPP_TAG_NAME)
jobname = attr->values[0].string.text;
if (strcmp(attr->name, "copies") == 0 &&
if (!strcmp(attr->name, "copies") &&
attr->value_tag == IPP_TAG_INTEGER)
jobcopies = attr->values[0].integer;
@@ -453,11 +484,11 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
if (!longstatus && jobcount == 0)
#ifdef __osf__
_cupsLangPuts(stdout, language,
_cupsLangPuts(stdout,
_("Rank Owner Pri Job Files"
" Total Size\n"));
#else
_cupsLangPuts(stdout, language,
_cupsLangPuts(stdout,
_("Rank Owner Job File(s)"
" Total Size\n"));
#endif /* __osf__ */
@@ -487,7 +518,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
if (longstatus)
{
_cupsLangPuts(stdout, language, "");
_cupsLangPuts(stdout, "\n");
if (jobcopies > 1)
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
@@ -495,19 +526,19 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
else
strlcpy(namestr, jobname, sizeof(namestr));
_cupsLangPrintf(stdout, language, _("%s: %-33.33s [job %d localhost]\n"),
_cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]\n"),
jobuser, rankstr, jobid);
_cupsLangPrintf(stdout, language, _(" %-39.39s %.0f bytes\n"),
_cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes\n"),
namestr, 1024.0 * jobsize);
}
else
#ifdef __osf__
_cupsLangPrintf(stdout, language,
_cupsLangPrintf(stdout,
_("%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"),
rankstr, jobuser, jobpriority, jobid, jobname,
1024.0 * jobsize);
#else
_cupsLangPrintf(stdout, language,
_cupsLangPrintf(stdout,
_("%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"),
rankstr, jobuser, jobid, jobname, 1024.0 * jobsize);
#endif /* __osf */
@@ -520,13 +551,12 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
}
else
{
_cupsLangPrintf(stderr, language, _("lpq: get-jobs failed: %s\n"),
ippErrorString(cupsLastError()));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
return (0);
}
if (jobcount == 0)
_cupsLangPuts(stdout, language, _("no entries\n"));
_cupsLangPuts(stdout, _("no entries\n"));
return (jobcount);
}
@@ -537,16 +567,15 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
*/
static void
show_printer(http_t *http, /* I - HTTP connection to server */
const char *dest) /* I - Destination */
show_printer(const char *command, /* I - Command name */
http_t *http, /* I - HTTP connection to server */
const char *dest) /* I - Destination */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
ipp_pstate_t state; /* Printer state */
char uri[HTTP_MAX_URI];
/* Printer URI */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
ipp_pstate_t state; /* Printer state */
char uri[HTTP_MAX_URI]; /* Printer URI */
if (http == NULL)
@@ -561,18 +590,7 @@ show_printer(http_t *http, /* I - HTTP connection to server */
* printer-uri
*/
request = ippNew();
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", dest);
@@ -587,9 +605,7 @@ show_printer(http_t *http, /* I - HTTP connection to server */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
_cupsLangPrintf(stderr, language,
_("lpq: get-printer-attributes failed: %s\n"),
ippErrorString(response->request.status.status_code));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
ippDelete(response);
return;
}
@@ -602,23 +618,21 @@ show_printer(http_t *http, /* I - HTTP connection to server */
switch (state)
{
case IPP_PRINTER_IDLE :
_cupsLangPrintf(stdout, language, _("%s is ready\n"), dest);
_cupsLangPrintf(stdout, _("%s is ready\n"), dest);
break;
case IPP_PRINTER_PROCESSING :
_cupsLangPrintf(stdout, language, _("%s is ready and printing\n"),
_cupsLangPrintf(stdout, _("%s is ready and printing\n"),
dest);
break;
case IPP_PRINTER_STOPPED :
_cupsLangPrintf(stdout, language, _("%s is not ready\n"), dest);
_cupsLangPrintf(stdout, _("%s is not ready\n"), dest);
break;
}
ippDelete(response);
}
else
_cupsLangPrintf(stderr, language,
_("lpq: get-printer-attributes failed: %s\n"),
ippErrorString(cupsLastError()));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
}
@@ -629,12 +643,13 @@ show_printer(http_t *http, /* I - HTTP connection to server */
static void
usage(void)
{
_cupsLangPuts(stderr, cupsLangDefault(),
_("Usage: lpq [-P dest] [-l] [+interval]\n"));
_cupsLangPuts(stderr,
_("Usage: lpq [-P dest] [-U username] [-h hostname[:port]] "
"[-l] [+interval]\n"));
exit(1);
}
/*
* End of "$Id: lpq.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: lpq.c 4948 2006-01-19 03:23:41Z mike $".
*/
+137 -99
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: lpr.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: lpr.c 4974 2006-01-25 07:04:33Z mike $"
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
@@ -64,31 +64,33 @@ char tempfile[1024]; /* Temporary file for printing from stdin */
*/
int
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
int i, j; /* Looping var */
int job_id; /* Job ID */
char ch; /* Option character */
char *printer, /* Destination printer or class */
*instance; /* Instance */
const char *title, /* Job title */
*val; /* Environment variable name */
int num_copies; /* Number of copies per file */
int num_files; /* Number of files to print */
const char *files[1000]; /* Files to print */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Selected destination */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
int deletefile; /* Delete file after print? */
char buffer[8192]; /* Copy buffer */
int temp; /* Temporary file descriptor */
cups_lang_t *language; /* Language information */
int i, j; /* Looping var */
int job_id; /* Job ID */
char ch; /* Option character */
char *printer, /* Destination printer or class */
*instance; /* Instance */
const char *title, /* Job title */
*val; /* Environment variable name */
int num_copies; /* Number of copies per file */
int num_files; /* Number of files to print */
const char *files[1000]; /* Files to print */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Selected destination */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
int deletefile; /* Delete file after print? */
char buffer[8192]; /* Copy buffer */
ssize_t bytes; /* Bytes copied */
off_t filesize; /* Size of temp file */
int temp; /* Temporary file descriptor */
cups_lang_t *language; /* Language information */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Signal action */
struct sigaction oldaction; /* Old signal action */
struct sigaction action; /* Signal action */
struct sigaction oldaction; /* Old signal action */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -110,12 +112,51 @@ main(int argc, /* I - Number of command-line arguments */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr, language,
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
argv[0]);
#endif /* HAVE_SSL */
break;
case 'U' : /* Username */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
}
cupsSetUser(argv[i]);
}
break;
case 'H' : /* Connect to host */
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
"\'-H\' option!\n"),
argv[0]);
return (1);
}
else
cupsSetServer(argv[i]);
}
break;
case '1' : /* TROFF font set 1 */
case '2' : /* TROFF font set 2 */
case '3' : /* TROFF font set 3 */
@@ -128,9 +169,9 @@ main(int argc, /* I - Number of command-line arguments */
if (i >= argc)
{
_cupsLangPrintf(stderr, language,
_("lpr: error - expected value after -%c "
"option!\n"), ch);
_cupsLangPrintf(stderr,
_("%s: Error - expected value after \'-%c\' "
"option!\n"), argv[0], ch);
return (1);
}
}
@@ -142,9 +183,10 @@ main(int argc, /* I - Number of command-line arguments */
case 'n' : /* Ditroff */
case 't' : /* Troff */
case 'v' : /* Raster image */
_cupsLangPrintf(stderr, language,
_("lpr: warning - \'%c\' format modifier not "
"supported - output may not be correct!\n"), ch);
_cupsLangPrintf(stderr,
_("%s: Warning - \'%c\' format modifier not "
"supported - output may not be correct!\n"),
argv[0], ch);
break;
case 'o' : /* Option */
@@ -155,9 +197,10 @@ main(int argc, /* I - Number of command-line arguments */
i ++;
if (i >= argc)
{
_cupsLangPuts(stderr, language,
_("lpr: error - expected option=value after "
"-o option!\n"));
_cupsLangPrintf(stderr,
_("%s: error - expected option=value after "
"\'-o\' option!\n"),
argv[0]);
return (1);
}
@@ -170,20 +213,28 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'p' : /* Prettyprint */
num_options = cupsAddOption("prettyprint", "", num_options, &options);
num_options = cupsAddOption("prettyprint", "", num_options,
&options);
break;
case 'h' : /* Suppress burst page */
num_options = cupsAddOption("job-sheets", "none", num_options, &options);
num_options = cupsAddOption("job-sheets", "none", num_options,
&options);
break;
case 's' : /* Don't use symlinks */
break;
case 'm' : /* Mail on completion */
_cupsLangPuts(stderr, language,
_("lpr: warning - email notification is not "
"currently supported!\n"));
{
char email[1024]; /* EMail address */
snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(),
httpGetHostname(buffer, sizeof(buffer)));
num_options = cupsAddOption("notify-recipient", email,
num_options, &options);
}
break;
case 'q' : /* Queue file but don't print */
@@ -203,9 +254,10 @@ main(int argc, /* I - Number of command-line arguments */
i ++;
if (i >= argc)
{
_cupsLangPuts(stderr, language,
_("lpr: error - expected destination after -P "
"option!\n"));
_cupsLangPrintf(stderr,
_("%s: Error - expected destination after "
"\'-P\' option!\n"),
argv[0]);
return (1);
}
@@ -221,7 +273,8 @@ main(int argc, /* I - Number of command-line arguments */
if ((dest = cupsGetDest(printer, instance, num_dests, dests)) != NULL)
{
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
if (cupsGetOption(dest->options[j].name, num_options,
options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
@@ -236,9 +289,10 @@ main(int argc, /* I - Number of command-line arguments */
i ++;
if (i >= argc)
{
_cupsLangPuts(stderr, language,
_("lpr: error - expected copy count after -# "
"option!\n"));
_cupsLangPrintf(stderr,
_("%s: Error - expected copy count after "
"\'-#\' option!\n"),
argv[0]);
return (1);
}
@@ -259,9 +313,9 @@ main(int argc, /* I - Number of command-line arguments */
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, language,
_("lpr: error - expected name after -%c "
"option!\n"), ch);
_cupsLangPrintf(stderr,
_("%s: Error - expected name after \'-%c\' "
"option!\n"), argv[0], ch);
return (1);
}
@@ -269,28 +323,10 @@ main(int argc, /* I - Number of command-line arguments */
}
break;
case 'U' : /* User */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPuts(stderr, language,
_("lpr: error - expected username after -U "
"option!\n"));
return (1);
}
cupsSetUser(argv[i]);
}
break;
default :
_cupsLangPrintf(stderr, language,
_("lpr: error - unknown option \'%c\'!\n"),
argv[i][1]);
_cupsLangPrintf(stderr,
_("%s: Error - unknown option \'%c\'!\n"),
argv[0], argv[i][1]);
return (1);
}
else if (num_files < 1000)
@@ -301,9 +337,9 @@ main(int argc, /* I - Number of command-line arguments */
if (access(argv[i], R_OK) != 0)
{
_cupsLangPrintf(stderr, language,
_("lpr: error - unable to access \"%s\" - %s\n"),
argv[i], strerror(errno));
_cupsLangPrintf(stderr,
_("%s: Error - unable to access \"%s\" - %s\n"),
argv[0], argv[i], strerror(errno));
return (1);
}
@@ -319,8 +355,9 @@ main(int argc, /* I - Number of command-line arguments */
}
}
else
_cupsLangPrintf(stderr, language,
_("lpr: error - too many files - \"%s\"\n"), argv[i]);
_cupsLangPrintf(stderr,
_("%s: Error - too many files - \"%s\"\n"),
argv[0], argv[i]);
/*
* See if we have any files to print; if not, print from stdin...
*/
@@ -360,16 +397,18 @@ main(int argc, /* I - Number of command-line arguments */
val = "LPDEST";
if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
_cupsLangPrintf(stderr, language,
_("lpr: error - %s environment variable names "
_cupsLangPrintf(stderr,
_("%s: Error - %s environment variable names "
"non-existent destination \"%s\"!\n"),
val, printer);
argv[0], val, printer);
else if (cupsLastError() == IPP_NOT_FOUND)
_cupsLangPuts(stderr, language,
_("lpr: error - no default destination available.\n"));
_cupsLangPrintf(stderr,
_("%s: Error - no default destination available.\n"),
argv[0]);
else
_cupsLangPuts(stderr, language,
_("lpr: error - scheduler not responding!\n"));
_cupsLangPrintf(stderr,
_("%s: Error - scheduler not responding!\n"),
argv[0]);
return (1);
}
@@ -417,32 +456,33 @@ main(int argc, /* I - Number of command-line arguments */
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
_cupsLangPrintf(stderr, language,
_("lpr: error - unable to create temporary file "
_cupsLangPrintf(stderr,
_("%s: Error - unable to create temporary file "
"\"%s\" - %s\n"),
tempfile, strerror(errno));
argv[0], tempfile, strerror(errno));
return (1);
}
while ((i = read(0, buffer, sizeof(buffer))) > 0)
if (write(temp, buffer, i) < 0)
while ((bytes = read(0, buffer, sizeof(buffer))) > 0)
if (write(temp, buffer, bytes) < 0)
{
_cupsLangPrintf(stderr, language,
_("lpr: error - unable to write to temporary file "
_cupsLangPrintf(stderr,
_("%s: Error - unable to write to temporary file "
"\"%s\" - %s\n"),
tempfile, strerror(errno));
argv[0], tempfile, strerror(errno));
close(temp);
unlink(tempfile);
return (1);
}
i = lseek(temp, 0, SEEK_CUR);
filesize = lseek(temp, 0, SEEK_CUR);
close(temp);
if (i == 0)
if (filesize <= 0)
{
_cupsLangPuts(stderr, language,
_("lpr: error - stdin is empty, so no job has been sent.\n"));
_cupsLangPrintf(stderr,
_("%s: Error - stdin is empty, so no job has been sent.\n"),
argv[0]);
unlink(tempfile);
return (1);
}
@@ -457,9 +497,7 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
_cupsLangPrintf(stderr, language,
_("lpr: error - unable to print file: %s\n"),
ippErrorString(cupsLastError()));
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
return (1);
}
@@ -473,7 +511,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
void
sighandler(int s) /* I - Signal number */
sighandler(int s) /* I - Signal number */
{
/*
* Remove the temporary file we're using to print from stdin...
@@ -491,5 +529,5 @@ sighandler(int s) /* I - Signal number */
/*
* End of "$Id: lpr.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: lpr.c 4974 2006-01-25 07:04:33Z mike $".
*/
+59 -56
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: lprm.c 4906 2006-01-10 20:53:28Z mike $"
* "$Id: lprm.c 4948 2006-01-19 03:23:41Z mike $"
*
* "lprm" command for the Common UNIX Printing System (CUPS).
*
@@ -84,7 +84,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL)
{
_cupsLangPuts(stderr, language, _("lprm: Unable to contact server!\n"));
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
cupsFreeDests(num_dests, dests);
return (1);
}
@@ -103,7 +103,7 @@ main(int argc, /* I - Number of command-line arguments */
httpEncryption(http, encryption);
#else
_cupsLangPrintf(stderr, language,
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
argv[0]);
#endif /* HAVE_SSL */
@@ -123,17 +123,61 @@ main(int argc, /* I - Number of command-line arguments */
if (cupsGetDest(dest, NULL, num_dests, dests) == NULL)
{
_cupsLangPrintf(stderr, language,
_("lprm: Unknown destination \"%s\"!\n"), dest);
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s\"!\n"),
argv[0], dest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return(1);
}
break;
case 'U' : /* Username */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
}
cupsSetUser(argv[i]);
}
break;
case 'h' : /* Connect to host */
if (http != NULL)
httpClose(http);
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
"\'-h\' option!\n"),
argv[0]);
return (1);
}
else
cupsSetServer(argv[i]);
}
break;
default :
_cupsLangPrintf(stderr, language,
_("lprm: Unknown option \'%c\'!\n"), argv[i][1]);
_cupsLangPrintf(stderr,
_("%s: Error - unknown option \'%c\'!\n"),
argv[0], argv[i][1]);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
@@ -151,7 +195,7 @@ main(int argc, /* I - Number of command-line arguments */
op = IPP_CANCEL_JOB;
job_id = atoi(argv[i]);
}
else if (strcmp(argv[i], "-") == 0)
else if (!strcmp(argv[i], "-"))
{
/*
* Cancel all jobs
@@ -175,16 +219,7 @@ main(int argc, /* I - Number of command-line arguments */
* [requesting-user-name]
*/
request = ippNew();
request->request.op.operation_id = op;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(op);
if (dest)
{
@@ -214,43 +249,12 @@ main(int argc, /* I - Number of command-line arguments */
else
response = cupsDoRequest(http, request, "/jobs/");
if (response != NULL)
{
switch (response->request.status.status_code)
{
case IPP_NOT_FOUND :
_cupsLangPuts(stderr, language,
_("lprm: Job or printer not found!\n"));
break;
case IPP_NOT_AUTHORIZED :
_cupsLangPuts(stderr, language,
_("lprm: Not authorized to lprm job(s)!\n"));
break;
case IPP_FORBIDDEN :
_cupsLangPrintf(stderr, language,
_("lprm: You don't own job ID %d!\n"), job_id);
break;
default :
if (response->request.status.status_code > IPP_OK_CONFLICT)
_cupsLangPuts(stderr, language,
_("lprm: Unable to lprm job(s)!\n"));
break;
}
ippDelete(response);
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
ippDelete(response);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
ippDelete(response);
}
else
if (cupsLastError() > IPP_OK_CONFLICT)
{
_cupsLangPuts(stderr, language,
_("lprm: Unable to cancel job(s)!\n"));
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
@@ -265,8 +269,7 @@ main(int argc, /* I - Number of command-line arguments */
if (response == NULL)
if (!cupsCancelJob(dest, 0))
{
_cupsLangPuts(stderr, language,
_("lprm: Unable to cancel job(s)!\n"));
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
@@ -280,5 +283,5 @@ main(int argc, /* I - Number of command-line arguments */
/*
* End of "$Id: lprm.c 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: lprm.c 4948 2006-01-19 03:23:41Z mike $".
*/
+34 -34
Ver Arquivo
@@ -1,50 +1,50 @@
# DO NOT DELETE
help-index.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
help-index.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
help-index.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h
help-index.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
help-index.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
help-index.o: ../cups/array.h ../cups/string.h ../config.h ../cups/dir.h
html.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
html.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
html.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
html.o: ../cups/string.h ../config.h
html.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
html.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
html.o: ../cups/array.h ../cups/string.h ../config.h
ipp-var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
ipp-var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
ipp-var.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
ipp-var.o: ../cups/string.h ../config.h
ipp-var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
ipp-var.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
ipp-var.o: ../cups/array.h ../cups/string.h ../config.h
search.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
search.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
search.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
search.o: ../cups/string.h ../config.h
search.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
search.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
search.o: ../cups/array.h ../cups/string.h ../config.h
template.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
template.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
template.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
template.o: ../cups/string.h ../config.h
template.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
template.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
template.o: ../cups/array.h ../cups/string.h ../config.h
var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
var.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
var.o: ../cups/string.h ../config.h
var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
var.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
var.o: ../cups/array.h ../cups/string.h ../config.h
admin.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
admin.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
admin.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
admin.o: ../cups/string.h ../config.h ../cups/file.h
admin.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
admin.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
admin.o: ../cups/array.h ../cups/string.h ../config.h ../cups/file.h
classes.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
classes.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
classes.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
classes.o: ../cups/string.h ../config.h
classes.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
classes.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
classes.o: ../cups/array.h ../cups/string.h ../config.h
help.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
help.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
help.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
help.o: ../cups/string.h ../config.h
help.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
help.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
help.o: ../cups/array.h ../cups/string.h ../config.h
jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
jobs.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
jobs.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
jobs.o: ../cups/string.h ../config.h
jobs.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
jobs.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
jobs.o: ../cups/array.h ../cups/string.h ../config.h
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
printers.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h
printers.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h
printers.o: ../cups/string.h ../config.h
printers.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h
printers.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h
printers.o: ../cups/array.h ../cups/string.h ../config.h
testcgi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
testcgi.o: ../cups/ppd.h ../cups/file.h help-index.h
testcgi.o: ../cups/ppd.h ../cups/file.h ../cups/array.h help-index.h
testhi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
testhi.o: ../cups/ppd.h ../cups/file.h help-index.h
testhi.o: ../cups/ppd.h ../cups/file.h ../cups/array.h help-index.h
+539 -545
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+6 -3
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: cgi.h 4921 2006-01-12 21:26:26Z mike $"
* "$Id: cgi.h 4931 2006-01-14 20:37:40Z mike $"
*
* CGI support library definitions.
*
@@ -80,6 +80,8 @@ extern char *cgiGetTemplateDir(void);
extern const char *cgiGetVariable(const char *name);
extern int cgiInitialize(void);
extern int cgiIsPOST(void);
extern void cgiMoveJobs(http_t *http, const char *dest, int job_id);
extern void cgiPrintTestPage(http_t *http, const char *dest);
extern char *cgiRewriteURL(const char *uri, char *url, int urlsize,
const char *newresource);
extern void cgiSetArray(const char *name, int element,
@@ -95,12 +97,13 @@ extern int cgiSetIPPVars(ipp_t *response, const char *filter_name,
extern void cgiSetServerVersion(void);
extern void cgiSetSize(const char *name, int size);
extern void cgiSetVariable(const char *name, const char *value);
extern void cgiShowIPPError(const char *message);
extern void cgiShowJobs(http_t *http, const char *dest);
extern void cgiStartHTML(const char *title);
extern const char *cgiText(const char *message);
#endif /* !_CUPS_CGI_H_ */
/*
* End of "$Id: cgi.h 4921 2006-01-12 21:26:26Z mike $".
* End of "$Id: cgi.h 4931 2006-01-14 20:37:40Z mike $".
*/
+327 -260
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: classes.c 4921 2006-01-12 21:26:26Z mike $"
* "$Id: classes.c 4931 2006-01-14 20:37:40Z mike $"
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
@@ -23,7 +23,9 @@
*
* Contents:
*
* main() - Main entry for CGI.
* main() - Main entry for CGI.
* show_all_classes() - Show all classes...
* show_class() - Show a single class.
*/
/*
@@ -33,6 +35,14 @@
#include "cgi-private.h"
/*
* Local functions...
*/
void show_all_classes(http_t *http, const char *username);
void show_class(http_t *http, const char *printer);
/*
* 'main()' - Main entry for CGI.
*/
@@ -41,17 +51,14 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
char *pclass; /* Printer class name */
const char *pclass; /* Class name */
const char *user; /* Username */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI]; /* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
static const char *def_attrs[] = /* Attributes for default printer */
static const char *def_attrs[] = /* Attributes for default printer */
{
"printer-name",
"printer-uri-supported"
@@ -63,6 +70,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiInitialize();
op = cgiGetVariable("OP");
/*
@@ -72,10 +80,20 @@ main(int argc, /* I - Number of command-line arguments */
cgiSetVariable("SECTION", "classes");
/*
* Get the request language...
* See if we are displaying a printer or all classes...
*/
language = cupsLangDefault();
if (!strcmp(argv[0], "/") || strstr(argv[0], "classes.cgi"))
pclass = NULL;
else
pclass = argv[0];
/*
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* Connect to the HTTP server...
@@ -84,48 +102,16 @@ main(int argc, /* I - Number of command-line arguments */
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
/*
* Tell the client to expect UTF-8 encoded HTML...
* Get the default printer...
*/
puts("Content-Type: text/html;charset=utf-8\n");
/*
* See if we need to show a list of printers or the status of a
* single printer...
*/
cgiSetServerVersion();
pclass = argv[0];
if (strcmp(pclass, "/") == 0 || strcmp(pclass, "classes.cgi") == 0)
if (!op)
{
pclass = NULL;
cgiSetVariable("TITLE", _cupsLangString(language, _("Class")));
}
else
cgiSetVariable("TITLE", pclass);
if (op == NULL || strcasecmp(op, "print-test-page") != 0)
{
/*
* Show the standard header...
*/
cgiCopyTemplateLang("header.tmpl");
/*
* Get the default destination...
*/
request = ippNew();
request->request.op.operation_id = CUPS_GET_DEFAULT;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(CUPS_GET_DEFAULT);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
@@ -150,238 +136,39 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* Get the class info...
* See if we need to show a list of classes or the status of a
* single printer...
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
if (pclass == NULL)
{
/*
* Build a CUPS_GET_CLASSES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
*/
request->request.op.operation_id = CUPS_GET_CLASSES;
request->request.op.request_id = 1;
if (getenv("REMOTE_USER") != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
}
if (!pclass)
show_all_classes(http, user);
else
{
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/classes/%s", pclass);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
}
cgiGetAttributes(request, "classes.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
/*
* Write the report...
*/
cgiCopyTemplateLang("classes.tmpl");
/*
* Get jobs for the specified class if a class has been chosen...
*/
if (pclass != NULL)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/classes/%s", pclass);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
if (getenv("REMOTE_USER") != NULL)
{
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
if (strcmp(getenv("REMOTE_USER"), "root"))
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "unknown");
cgiGetAttributes(request, "jobs.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang("jobs.tmpl");
}
}
show_class(http, pclass);
}
else if (!strcasecmp(op, "print-test-page") && pclass)
cgiPrintTestPage(http, pclass);
else if (!strcasecmp(op, "move-jobs") && pclass)
cgiMoveJobs(http, pclass, 0);
else
{
/*
* Print a test page...
* Unknown/bad operation...
*/
char filename[1024]; /* Test page filename */
const char *datadir; /* CUPS_DATADIR env var */
char refresh[1024]; /* Refresh URL */
cgiFormEncode(uri, pclass, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;/classes/%s", uri);
cgiSetVariable("refresh_page", refresh);
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
datadir = CUPS_DATADIR;
snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/classes/%s", pclass);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNew();
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (getenv("REMOTE_USER") != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
if (pclass)
cgiStartHTML(pclass);
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "root");
cgiStartHTML(cgiText(_("Classes")));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Test Page");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, uri + 15,
filename)) != NULL)
{
status = response->request.status.status_code;
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
else
status = cupsLastError();
cgiSetVariable("PRINTER_NAME", pclass);
/*
* Show the standard header...
*/
cgiCopyTemplateLang("header.tmpl");
/*
* Show the result...
*/
if (status > IPP_OK_CONFLICT)
{
cgiSetVariable("ERROR", ippErrorString(status));
cgiCopyTemplateLang("error.tmpl");
}
else
cgiCopyTemplateLang("test-page.tmpl");
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
cgiCopyTemplateLang("trailer.tmpl");
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -392,5 +179,285 @@ main(int argc, /* I - Number of command-line arguments */
/*
* End of "$Id: classes.c 4921 2006-01-12 21:26:26Z mike $".
* 'show_all_classes()' - Show all classes...
*/
void
show_all_classes(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
int i; /* Looping var */
ipp_t *request, /* IPP request */
*response; /* IPP response */
cups_array_t *classes; /* Array of class objects */
ipp_attribute_t *pclass; /* Class object */
int ascending, /* Order of classes (0 = descending) */
first, /* First class to show */
count; /* Number of classes */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
/*
* Show the standard header...
*/
cgiStartHTML(cgiText(_("Classes")));
/*
* Build a CUPS_GET_CLASSES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* requesting-user-name
*/
request = ippNewRequest(CUPS_GET_CLASSES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
cgiGetAttributes(request, "classes.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
classes = cgiGetIPPObjects(response, search);
count = cupsArrayCount(classes);
if (search)
cgiFreeSearch(search);
/*
* Figure out which classes to display...
*/
if ((var = cgiGetVariable("FIRST")) != NULL)
first = atoi(var);
else
first = 0;
if (first >= count)
first = count - CUPS_PAGE_MAX;
first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX;
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
else
ascending = 1;
if (ascending)
{
for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, first);
i < CUPS_PAGE_MAX && pclass;
i ++, pclass = (ipp_attribute_t *)cupsArrayNext(classes))
cgiSetIPPObjectVars(pclass, NULL, i);
}
else
{
for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, count - first - 1);
i < CUPS_PAGE_MAX && pclass;
i ++, pclass = (ipp_attribute_t *)cupsArrayPrev(classes))
cgiSetIPPObjectVars(pclass, NULL, i);
}
/*
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/classes/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/classes/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
* Then show everything...
*/
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("classes-header.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("classes.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
/*
* Delete the response...
*/
ippDelete(response);
}
else
{
/*
* Show the error...
*/
cgiShowIPPError(_("Unable to get class list:"));
}
cgiEndHTML();
}
/*
* 'show_class()' - Show a single class.
*/
void
show_class(http_t *http, /* I - Connection to server */
const char *pclass) /* I - Name of class */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
char uri[HTTP_MAX_URI]; /* Printer URI */
char refresh[1024]; /* Refresh URL */
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/classes/%s", pclass);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "classes.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Got the result; set the CGI variables and check the status of a
* single-queue request...
*/
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if (pclass && (attr = ippFindAttribute(response, "printer-state",
IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer == IPP_PRINTER_PROCESSING)
{
/*
* Class is processing - automatically refresh the page until we
* are done printing...
*/
cgiFormEncode(uri, pclass, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;/classes/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
/*
* Delete the response...
*/
ippDelete(response);
/*
* Show the standard header...
*/
cgiStartHTML(pclass);
/*
* Show the class status...
*/
cgiCopyTemplateLang("classes.tmpl");
/*
* Show jobs for the specified class...
*/
cgiCopyTemplateLang("class-jobs-header.tmpl");
cgiShowJobs(http, pclass);
}
else
{
/*
* Show the IPP error...
*/
cgiStartHTML(pclass);
cgiShowIPPError(_("Unable to get class status:"));
}
cgiEndHTML();
}
/*
* End of "$Id: classes.c 4931 2006-01-14 20:37:40Z mike $".
*/
+410 -32
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: ipp-var.c 4921 2006-01-12 21:26:26Z mike $"
* "$Id: ipp-var.c 4931 2006-01-14 20:37:40Z mike $"
*
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
*
@@ -25,10 +25,15 @@
*
* cgiGetAttributes() - Get the list of attributes that are needed
* by the template file.
* cupsGetIPPObjects() - Get the objects in an IPP response.
* cgiGetIPPObjects() - Get the objects in an IPP response.
* cgiMoveJobs() - Move one or more jobs.
* cgiPrintTestPage() - Print a test page.
* cgiRewriteURL() - Rewrite a printer URI into a web browser URL...
* cgiSetIPPObjectVars() - Set CGI variables from an IPP object.
* cgiSetIPPVars() - Set CGI variables from an IPP response.
* cgiShowIPPError() - Show the last IPP error message.
* cgiShowJobs() - Show print jobs.
* cgiText() - Return localized text.
*/
/*
@@ -165,7 +170,7 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */
/*
* 'cupsGetIPPObjects()' - Get the objects in an IPP response.
* 'cgiGetIPPObjects()' - Get the objects in an IPP response.
*/
cups_array_t * /* O - Array of objects */
@@ -263,6 +268,353 @@ cgiGetIPPObjects(ipp_t *response, /* I - IPP response */
}
/*
* 'cgiMoveJobs()' - Move one or more jobs.
*
* At least one of dest or job_id must be non-zero/NULL.
*/
void
cgiMoveJobs(http_t *http, /* I - Connection to server */
const char *dest, /* I - Destination or NULL */
int job_id) /* I - Job ID or 0 for all */
{
int i; /* Looping var */
const char *user; /* Username */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* Current attribute */
const char *name; /* Destination name */
const char *job_printer_uri; /* JOB_PRINTER_URI form variable */
char current_dest[1024]; /* Current destination */
/*
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* See if the user has already selected a new destination...
*/
if ((job_printer_uri = cgiGetVariable("JOB_PRINTER_URI")) == NULL)
{
/*
* Make sure necessary form variables are set...
*/
if (job_id)
{
char temp[255]; /* Temporary string */
sprintf(temp, "%d", job_id);
cgiSetVariable("JOB_ID", temp);
}
if (dest)
cgiSetVariable("PRINTER_NAME", dest);
/*
* No new destination specified, show the user what the available
* printers/classes are...
*/
if (!dest)
{
/*
* Get the current destination for job N...
*/
char job_uri[1024]; /* Job URI */
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
snprintf(job_uri, sizeof(job_uri), "ipp://localhost/jobs/%d", job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, job_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "job-printer-uri");
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
if ((attr = ippFindAttribute(response, "job-printer-uri",
IPP_TAG_URI)) != NULL)
{
/*
* Pull the name from the URI...
*/
strlcpy(current_dest, strrchr(attr->values[0].string.text, '/') + 1,
sizeof(current_dest));
dest = current_dest;
}
ippDelete(response);
}
if (!dest)
{
/*
* Couldn't get the current destination...
*/
cgiStartHTML(cgiText(_("Move Job")));
cgiShowIPPError(_("Unable to find destination for job!"));
cgiEndHTML();
return;
}
}
/*
* Get the list of available destinations...
*/
request = ippNewRequest(CUPS_GET_PRINTERS);
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 ((response = cupsDoRequest(http, request, "/")) != NULL)
{
for (i = 0, attr = ippFindAttribute(response, "printer-uri-supported",
IPP_TAG_URI);
attr;
attr = ippFindNextAttribute(response, "printer-uri-supported",
IPP_TAG_URI))
{
/*
* Pull the name from the URI...
*/
name = strrchr(attr->values[0].string.text, '/') + 1;
/*
* If the name is not the same as the current destination, add it!
*/
if (strcasecmp(name, dest))
{
cgiSetArray("JOB_PRINTER_URI", i, attr->values[0].string.text);
cgiSetArray("JOB_PRINTER_NAME", i, name);
i ++;
}
}
ippDelete(response);
}
/*
* Show the form...
*/
if (job_id)
cgiStartHTML(cgiText(_("Move Job")));
else
cgiStartHTML(cgiText(_("Move All Jobs")));
cgiCopyTemplateLang("job-move.tmpl");
}
else
{
/*
* Try moving the job or jobs...
*/
char uri[1024], /* Job/printer URI */
resource[1024], /* Post resource */
refresh[1024]; /* Refresh URL */
const char *job_printer_name; /* New printer name */
request = ippNewRequest(CUPS_MOVE_JOB);
if (job_id)
{
/*
* Move 1 job...
*/
snprintf(resource, sizeof(resource), "/jobs/%d", job_id);
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, uri);
}
else
{
/*
* Move all active jobs on a destination...
*/
snprintf(resource, sizeof(resource), "/%s/%s",
cgiGetVariable("SECTION"), dest);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", ippPort(),
"/%s/%s", cgiGetVariable("SECTION"), dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-printer-uri",
NULL, job_printer_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippDelete(cupsDoRequest(http, request, resource));
/*
* Show the results...
*/
job_printer_name = strrchr(job_printer_uri, '/') + 1;
if (cupsLastError() <= IPP_OK_CONFLICT)
{
cgiRewriteURL(job_printer_uri, resource, sizeof(resource), NULL);
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;%s", uri);
cgiSetVariable("refresh_page", refresh);
}
if (job_id)
cgiStartHTML(cgiText(_("Move Job")));
else
cgiStartHTML(cgiText(_("Move All Jobs")));
if (cupsLastError() > IPP_OK_CONFLICT)
{
if (job_id)
cgiShowIPPError(_("Unable to move job"));
else
cgiShowIPPError(_("Unable to move jobs"));
}
else
{
cgiSetVariable("JOB_PRINTER_NAME", job_printer_name);
cgiCopyTemplateLang("job-moved.tmpl");
}
}
cgiEndHTML();
}
/*
* 'cgiPrintTestPage()' - Print a test page.
*/
void
cgiPrintTestPage(http_t *http, /* I - Connection to server */
const char *dest) /* I - Destination printer/class */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
char uri[HTTP_MAX_URI], /* Printer URI */
resource[1024], /* POST resource path */
refresh[1024], /* Refresh URL */
filename[1024]; /* Test page filename */
const char *datadir; /* CUPS_DATADIR env var */
const char *user; /* Username */
/*
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* Locate the test page file...
*/
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
datadir = CUPS_DATADIR;
snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
/*
* Point to the printer/class...
*/
snprintf(resource, sizeof(resource), "/%s/%s", cgiGetVariable("SECTION"),
dest);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", ippPort(),
"/%s/%s", cgiGetVariable("SECTION"), dest);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNewRequest(IPP_PRINT_JOB);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Test Page");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, resource,
filename)) != NULL)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
if (cupsLastError() <= IPP_OK_CONFLICT)
{
/*
* Automatically reload the printer status page...
*/
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;%s", uri);
cgiSetVariable("refresh_page", refresh);
}
cgiStartHTML(cgiText(_("Print Test Page")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to print test page:"));
else
{
cgiSetVariable("PRINTER_NAME", dest);
cgiCopyTemplateLang("test-page.tmpl");
}
cgiEndHTML();
}
/*
* 'cgiRewriteURL()' - Rewrite a printer URI into a web browser URL...
*/
@@ -686,6 +1038,21 @@ cgiSetIPPVars(ipp_t *response, /* I - Response data to be copied... */
}
/*
* 'cgiShowIPPError()' - Show the last IPP error message.
*
* The caller must still call cgiStartHTML() and cgiEndHTML().
*/
void
cgiShowIPPError(const char *message) /* I - Contextual message */
{
cgiSetVariable("MESSAGE", cgiText(message));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiCopyTemplateLang("error.tmpl");
}
/*
* 'cgiShowJobs()' - Show print jobs.
*/
@@ -708,7 +1075,6 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
cups_lang_t *language; /* Language information */
/*
@@ -720,18 +1086,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* printer-uri
*/
request = ippNew();
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
request = ippNewRequest(IPP_GET_JOBS);
if (dest)
{
@@ -760,7 +1115,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if (!dest && (var = cgiGetVariable("QUERY")) != NULL)
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
@@ -817,14 +1172,14 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
urlend = url + sizeof(url);
if (dest)
if ((var = cgiGetVariable("QUERY")) != NULL)
{
snprintf(url, sizeof(url), "/%s/%s?", cgiGetVariable("SECTION"), dest);
urlptr = url + strlen(url);
}
else if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/jobs/?QUERY=", sizeof(url));
if (dest)
snprintf(url, sizeof(url), "/%s/%s?QUERY=", cgiGetVariable("SECTION"),
dest);
else
strlcpy(url, "/jobs/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
@@ -835,7 +1190,11 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
}
else
{
strlcpy(url, "/jobs/?", sizeof(url));
if (dest)
snprintf(url, sizeof(url), "/%s/%s?", cgiGetVariable("SECTION"), dest);
else
strlcpy(url, "/jobs/?", sizeof(url));
urlptr = url + strlen(url);
}
@@ -872,25 +1231,44 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Then show everything...
*/
if (!dest)
cgiCopyTemplateLang("search.tmpl");
if (dest)
cgiSetVariable("SEARCH_DEST", dest);
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("jobs-header.tmpl");
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("page.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("jobs.tmpl");
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("page.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
ippDelete(response);
}
}
/*
* 'cgiText()' - Return localized text.
*/
const char * /* O - Localized message */
cgiText(const char *message) /* I - Message */
{
static cups_lang_t *language = NULL;
/* Language */
if (!language)
language = cupsLangDefault();
return (_cupsLangString(language, message));
}
/*
* End of "$Id: ipp-var.c 4921 2006-01-12 21:26:26Z mike $".
* End of "$Id: ipp-var.c 4931 2006-01-14 20:37:40Z mike $".
*/
+40 -75
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: jobs.c 4921 2006-01-12 21:26:26Z mike $"
* "$Id: jobs.c 4931 2006-01-14 20:37:40Z mike $"
*
* Job status CGI for the Common UNIX Printing System (CUPS).
*
@@ -38,7 +38,7 @@
* Local functions...
*/
static void do_job_op(http_t *http, cups_lang_t *language, ipp_op_t op);
static void do_job_op(http_t *http, int job_id, ipp_op_t op);
/*
@@ -49,10 +49,11 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
http_t *http; /* Connection to the server */
const char *op; /* Operation name */
const char *job_id_var; /* Job ID form variable */
int job_id; /* Job ID */
/*
* Get any form variables...
@@ -66,12 +67,6 @@ main(int argc, /* I - Number of command-line arguments */
cgiSetVariable("SECTION", "jobs");
/*
* Get the request language...
*/
language = cupsLangDefault();
/*
* Connect to the HTTP server...
*/
@@ -79,42 +74,43 @@ main(int argc, /* I - Number of command-line arguments */
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
/*
* Tell the client to expect UTF-8 encoded HTML...
* Get the job ID, if any...
*/
puts("Content-Type: text/html;charset=utf-8\n");
if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL)
job_id = atoi(job_id_var);
else
job_id = 0;
/*
* Send a standard header...
* Do the operation...
*/
cgiSetVariable("TITLE", _cupsLangString(language, _("Jobs")));
cgiSetServerVersion();
cgiCopyTemplateLang("header.tmpl");
if ((op = cgiGetVariable("OP")) != NULL)
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
{
/*
* Do the operation...
*/
if (!strcmp(op, "cancel-job"))
do_job_op(http, language, IPP_CANCEL_JOB);
do_job_op(http, job_id, IPP_CANCEL_JOB);
else if (!strcmp(op, "hold-job"))
do_job_op(http, language, IPP_HOLD_JOB);
do_job_op(http, job_id, IPP_HOLD_JOB);
else if (!strcmp(op, "move-job"))
cgiMoveJobs(http, NULL, job_id);
else if (!strcmp(op, "release-job"))
do_job_op(http, language, IPP_RELEASE_JOB);
do_job_op(http, job_id, IPP_RELEASE_JOB);
else if (!strcmp(op, "restart-job"))
do_job_op(http, language, IPP_RESTART_JOB);
do_job_op(http, job_id, IPP_RESTART_JOB);
else
{
/*
* Bad operation code... Display an error...
*/
cgiCopyTemplateLang("job-op.tmpl");
cgiStartHTML(cgiText(_("Jobs")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
}
else
@@ -123,17 +119,16 @@ main(int argc, /* I - Number of command-line arguments */
* Show a list of jobs...
*/
cgiStartHTML(cgiText(_("Jobs")));
cgiShowJobs(http, NULL);
cgiEndHTML();
}
cgiCopyTemplateLang("trailer.tmpl");
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -149,25 +144,14 @@ main(int argc, /* I - Number of command-line arguments */
static void
do_job_op(http_t *http, /* I - HTTP connection */
cups_lang_t *language, /* I - Client's language */
int job_id, /* I - Job ID */
ipp_op_t op) /* I - Operation to perform */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_t *request; /* IPP request */
char uri[HTTP_MAX_URI]; /* Job URI */
const char *job; /* Job ID */
ipp_status_t status; /* Operation status... */
const char *user; /* Username */
if ((job = cgiGetVariable("JOB_ID")) != NULL)
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%s", job);
else
{
cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND));
cgiCopyTemplateLang("error.tmpl");
return;
}
/*
* Build a job request, which requires the following
* attributes:
@@ -178,50 +162,29 @@ do_job_op(http_t *http, /* I - HTTP connection */
* requesting-user-name
*/
request = ippNew();
request->request.op.operation_id = op;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(op);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, uri);
if (getenv("REMOTE_USER") != NULL)
{
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
if (strcmp(getenv("REMOTE_USER"), "root"))
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "unknown");
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/jobs")) != NULL)
{
status = response->request.status.status_code;
ippDelete(cupsDoRequest(http, request, "/jobs"));
ippDelete(response);
}
else
status = cupsLastError();
cgiStartHTML(cgiText(_("Jobs")));
if (status > IPP_OK_CONFLICT)
{
cgiSetVariable("ERROR", ippErrorString(status));
cgiCopyTemplateLang("error.tmpl");
}
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Job operation failed:"));
else if (op == IPP_CANCEL_JOB)
cgiCopyTemplateLang("job-cancel.tmpl");
else if (op == IPP_HOLD_JOB)
@@ -230,9 +193,11 @@ do_job_op(http_t *http, /* I - HTTP connection */
cgiCopyTemplateLang("job-release.tmpl");
else if (op == IPP_RESTART_JOB)
cgiCopyTemplateLang("job-restart.tmpl");
cgiEndHTML();
}
/*
* End of "$Id: jobs.c 4921 2006-01-12 21:26:26Z mike $".
* End of "$Id: jobs.c 4931 2006-01-14 20:37:40Z mike $".
*/
+337 -301
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: printers.c 4921 2006-01-12 21:26:26Z mike $"
* "$Id: printers.c 4931 2006-01-14 20:37:40Z mike $"
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
@@ -23,7 +23,9 @@
*
* Contents:
*
* main() - Main entry for CGI.
* main() - Main entry for CGI.
* show_all_printers() - Show all printers...
* show_printer() - Show a single printer.
*/
/*
@@ -33,6 +35,14 @@
#include "cgi-private.h"
/*
* Local functions...
*/
void show_all_printers(http_t *http, const char *username);
void show_printer(http_t *http, const char *printer);
/*
* 'main()' - Main entry for CGI.
*/
@@ -41,17 +51,13 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
char *printer; /* Printer name */
const char *printer; /* Printer name */
const char *user; /* Username */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI]; /* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
char refresh[1024]; /* Refresh URL */
static const char *def_attrs[] = /* Attributes for default printer */
{
"printer-name",
@@ -64,20 +70,31 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiInitialize();
op = cgiGetVariable("OP");
/*
* Get the request language...
*/
language = cupsLangDefault();
/*
* Set the web interface section...
*/
cgiSetVariable("SECTION", "printers");
/*
* See if we are displaying a printer or all printers...
*/
if (!strcmp(argv[0], "/") || strstr(argv[0], "printers.cgi"))
printer = NULL;
else
printer = argv[0];
/*
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* Connect to the HTTP server...
*/
@@ -85,42 +102,16 @@ main(int argc, /* I - Number of command-line arguments */
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
/*
* Tell the client to expect UTF-8 encoded HTML...
* Get the default printer...
*/
puts("Content-Type: text/html;charset=utf-8\n");
/*
* See if we need to show a list of printers or the status of a
* single printer...
*/
cgiSetServerVersion();
printer = argv[0];
if (strcmp(printer, "/") == 0 || strstr(printer, "printers.cgi") != NULL)
{
printer = NULL;
cgiSetVariable("TITLE", _cupsLangString(language, _("Printer")));
}
else
cgiSetVariable("TITLE", printer);
if (op == NULL || strcasecmp(op, "print-test-page") != 0)
if (!op)
{
/*
* Get the default destination...
*/
request = ippNew();
request->request.op.operation_id = CUPS_GET_DEFAULT;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(CUPS_GET_DEFAULT);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
@@ -145,281 +136,39 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* Get the printer info...
* See if we need to show a list of printers or the status of a
* single printer...
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
if (printer == NULL)
{
/*
* Build a CUPS_GET_PRINTERS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
*/
request->request.op.operation_id = CUPS_GET_PRINTERS;
request->request.op.request_id = 1;
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type", 0);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type-mask", CUPS_PRINTER_CLASS);
if (getenv("REMOTE_USER") != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
}
if (!printer)
show_all_printers(http, user);
else
{
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
}
cgiGetAttributes(request, "printers.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Got the result; set the CGI variables and check the status of a
* single-queue request...
*/
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if (printer && (attr = ippFindAttribute(response, "printer-state",
IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer == IPP_PRINTER_PROCESSING)
{
/*
* Printer is processing - automatically refresh the page until we
* are done printing...
*/
cgiFormEncode(uri, printer, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
/*
* Delete the response...
*/
ippDelete(response);
}
else if (printer)
fprintf(stderr, "ERROR: Get-Printer-Attributes request failed - %s (%x)\n",
ippErrorString(cupsLastError()), cupsLastError());
else
fprintf(stderr, "ERROR: CUPS-Get-Printers request failed - %s (%x)\n",
ippErrorString(cupsLastError()), cupsLastError());
/*
* Show the standard header...
*/
cgiCopyTemplateLang("header.tmpl");
/*
* Write the report...
*/
cgiCopyTemplateLang("printers.tmpl");
/*
* Get jobs for the specified printer if a printer has been chosen...
*/
if (printer != NULL)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
if (getenv("REMOTE_USER") != NULL)
{
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
if (strcmp(getenv("REMOTE_USER"), "root"))
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "unknown");
cgiGetAttributes(request, "jobs.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang("jobs.tmpl");
}
else
fprintf(stderr, "ERROR: Get-Jobs request failed - %s (%x)\n",
ippErrorString(cupsLastError()), cupsLastError());
}
show_printer(http, printer);
}
else if (!strcasecmp(op, "print-test-page") && printer)
cgiPrintTestPage(http, printer);
else if (!strcasecmp(op, "move-jobs") && printer)
cgiMoveJobs(http, printer, 0);
else
{
/*
* Print a test page...
* Unknown/bad operation...
*/
char filename[1024]; /* Test page filename */
const char *datadir; /* CUPS_DATADIR env var */
cgiFormEncode(uri, printer, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;/printers/%s", uri);
cgiSetVariable("refresh_page", refresh);
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
datadir = CUPS_DATADIR;
snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", printer);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNew();
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (getenv("REMOTE_USER") != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
if (printer)
cgiStartHTML(printer);
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "root");
cgiStartHTML(cgiText(_("Printers")));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Test Page");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, uri + 15,
filename)) != NULL)
{
status = response->request.status.status_code;
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
else
status = cupsLastError();
cgiSetVariable("PRINTER_NAME", printer);
/*
* Show the standard header...
*/
cgiCopyTemplateLang("header.tmpl");
/*
* Show the result...
*/
if (status > IPP_OK_CONFLICT)
{
cgiSetVariable("ERROR", ippErrorString(status));
cgiCopyTemplateLang("error.tmpl");
}
else
cgiCopyTemplateLang("test-page.tmpl");
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
cgiCopyTemplateLang("trailer.tmpl");
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -430,5 +179,292 @@ main(int argc, /* I - Number of command-line arguments */
/*
* End of "$Id: printers.c 4921 2006-01-12 21:26:26Z mike $".
* 'show_all_printers()' - Show all printers...
*/
void
show_all_printers(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
int i; /* Looping var */
ipp_t *request, /* IPP request */
*response; /* IPP response */
cups_array_t *printers; /* Array of printer objects */
ipp_attribute_t *printer; /* Printer object */
int ascending, /* Order of printers (0 = descending) */
first, /* First printer to show */
count; /* Number of printers */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
/*
* Show the standard header...
*/
cgiStartHTML(cgiText(_("Printers")));
/*
* Build a CUPS_GET_PRINTERS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-type
* printer-type-mask
* requesting-user-name
*/
request = ippNewRequest(CUPS_GET_PRINTERS);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type", 0);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type-mask", CUPS_PRINTER_CLASS);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
cgiGetAttributes(request, "printers.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
printers = cgiGetIPPObjects(response, search);
count = cupsArrayCount(printers);
if (search)
cgiFreeSearch(search);
/*
* Figure out which printers to display...
*/
if ((var = cgiGetVariable("FIRST")) != NULL)
first = atoi(var);
else
first = 0;
if (first >= count)
first = count - CUPS_PAGE_MAX;
first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX;
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
else
ascending = 1;
if (ascending)
{
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, first);
i < CUPS_PAGE_MAX && printer;
i ++, printer = (ipp_attribute_t *)cupsArrayNext(printers))
cgiSetIPPObjectVars(printer, NULL, i);
}
else
{
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, count - first - 1);
i < CUPS_PAGE_MAX && printer;
i ++, printer = (ipp_attribute_t *)cupsArrayPrev(printers))
cgiSetIPPObjectVars(printer, NULL, i);
}
/*
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/printers/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/printers/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
* Then show everything...
*/
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("printers-header.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("printers.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
/*
* Delete the response...
*/
ippDelete(response);
}
else
{
/*
* Show the error...
*/
cgiShowIPPError(_("Unable to get printer list:"));
}
cgiEndHTML();
}
/*
* 'show_printer()' - Show a single printer.
*/
void
show_printer(http_t *http, /* I - Connection to server */
const char *printer) /* I - Name of printer */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
char uri[HTTP_MAX_URI]; /* Printer URI */
char refresh[1024]; /* Refresh URL */
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "printers.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Got the result; set the CGI variables and check the status of a
* single-queue request...
*/
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if (printer && (attr = ippFindAttribute(response, "printer-state",
IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer == IPP_PRINTER_PROCESSING)
{
/*
* Printer is processing - automatically refresh the page until we
* are done printing...
*/
cgiFormEncode(uri, printer, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
/*
* Delete the response...
*/
ippDelete(response);
/*
* Show the standard header...
*/
cgiStartHTML(printer);
/*
* Show the printer status...
*/
cgiCopyTemplateLang("printers.tmpl");
/*
* Show jobs for the specified printer...
*/
cgiCopyTemplateLang("printer-jobs-header.tmpl");
cgiShowJobs(http, printer);
}
else
{
/*
* Show the IPP error...
*/
cgiStartHTML(printer);
cgiShowIPPError(_("Unable to get printer status:"));
}
cgiEndHTML();
}
/*
* End of "$Id: printers.c 4931 2006-01-14 20:37:40Z mike $".
*/
+6 -5
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: Makefile 4664 2005-09-17 22:56:56Z mike $"
# "$Id: Makefile 4972 2006-01-24 14:48:12Z mike $"
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1993-2005 by Easy Software Products.
# Copyright 1993-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -28,7 +28,7 @@ include ../Makedefs
# Config files...
#
KEEP = classes.conf client.conf cupsd.conf printers.conf
KEEP = client.conf cupsd.conf
REPLACE = mime.convs mime.types
@@ -50,7 +50,7 @@ clean:
# Install files...
#
install:
install: all
$(INSTALL_DIR) $(SERVERROOT)
for file in $(KEEP); do \
if test -r $(SERVERROOT)/$$file ; then \
@@ -59,6 +59,7 @@ install:
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
fi ; \
done
$(INSTALL_DATA) cupsd.conf $(SERVERROOT)/cupsd.conf.default
for file in $(REPLACE); do \
if test -r $(SERVERROOT)/$$file ; then \
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
@@ -76,5 +77,5 @@ install:
#
# End of "$Id: Makefile 4664 2005-09-17 22:56:56Z mike $".
# End of "$Id: Makefile 4972 2006-01-24 14:48:12Z mike $".
#
-89
Ver Arquivo
@@ -1,89 +0,0 @@
#
# "$Id: classes.conf 4494 2005-02-18 02:18:11Z mike $"
#
# Sample class configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products 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 missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
########################################################################
# #
# This is a sample class configuration file. This file is included #
# from the main configuration file (cups.conf) and lists all of the #
# printer classes known to the system. #
# #
########################################################################
#
# Each class starts with a <Class name> definition. Class names
# can be up to 128 characters in length and are *not* case sensitive.
#
# One <DefaultClass name> entry can appear in this file; if you don't
# define a default destination, the first printer or class becomes
# the default.
#
#<Class sample>
#
# Info: the description for the class.
#
#Info Acme LaserPrint 1000 Printers
#
# Location: the location of the printer.
#
#Location Room 101 in the activities building
#
# State: sets the initial state of the class. Can be one of the
# following:
#
# Idle - Class is available to print new jobs.
# Stopped - Class is disabled but accepting new jobs.
#
#State Idle
#
# StateMessage: sets the printer-state-message attribute for the class.
#
#StateMessage Class is idle.
#
# Accepting: is the class accepting jobs?
#
#Accepting Yes
#Accepting No
#
#
# Printer: adds a printer to the class.
#
#Printer sample
#Printer sample@host2
#</Class>
#
# End of "$Id: classes.conf 4494 2005-02-18 02:18:11Z mike $".
#
-2
Ver Arquivo
@@ -1,2 +0,0 @@
# This is a dummy printcap file that is automatically generated by the
# CUPS software for old applications that rely on it.
-96
Ver Arquivo
@@ -1,96 +0,0 @@
#
# "$Id: printers.conf 4494 2005-02-18 02:18:11Z mike $"
#
# Sample printer configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products 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 missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
########################################################################
# #
# This is a sample printer configuration file. This file is included #
# from the main configuration file (cups.conf) and lists all of the #
# printers known to the system. #
# #
########################################################################
#
# Each printer starts with a <Printer name> definition. Printer names
# can be up to 128 characters in length and are *not* case sensitive.
#
# One <DefaultPrinter name> entry can appear in this file; if you don't
# define a default destination, the first printer or class becomes the
# default.
#
#<Printer sample>
#
# Info: the description for the printer.
#
#Info Acme LaserPrint 1000
#
# Location: the location of the printer.
#
#Location Room 101 in the activities building
#
# DeviceURI: the device URI for this printer.
#
#DeviceURI parallel:/dev/plp
#DeviceURI serial:/dev/ttyd1?baud=38400+size=8+parity=none+flow=soft
#DeviceURI scsi:/dev/scsi/sc1d6l0
#DeviceURI socket://hostname:port
#DeviceURI tftp://hostname/path
#DeviceURI ftp://hostname/path
#DeviceURI http://hostname[:port]/path
#DeviceURI ipp://hostname/path
#DeviceURI smb://hostname/printer
#
# State: sets the initial state of the printer. Can be one of the
# following:
#
# Idle - Printer is available to print new jobs.
# Stopped - Printer is disabled but accepting new jobs.
#
#State Idle
#
# StateMessage: sets the printer-state-message attribute for the printer.
#
#StateMessage Printer is idle.
#
# Accepting: is the printer accepting jobs?
#
#Accepting Yes
#Accepting No
#</Printer>
#
# End of "$Id: printers.conf 4494 2005-02-18 02:18:11Z mike $".
#
+30 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 4833 2005-11-12 21:46:52Z mike $"
dnl "$Id: cups-common.m4 4979 2006-01-25 17:47:43Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -159,6 +159,11 @@ AC_TRY_COMPILE([#include <time.h>],[struct tm t;
AC_DEFINE(HAVE_TM_GMTOFF),
AC_MSG_RESULT(no))
dnl See if we have POSIX ACL support...
dnl TODO: Linux/Solaris/IRIX/etc. version
AC_CHECK_FUNCS(acl_init)
dnl Flags for "ar" command...
case $uname in
Darwin* | *BSD*)
@@ -176,6 +181,29 @@ case $uname in
Darwin*)
BACKLIBS="-framework IOKit"
LIBS="-framework CoreFoundation $LIBS"
dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
if test "$uname" = "Darwin" -a $uversion -ge 70; then
AC_DEFINE(HAVE_CF_LOCALE_ID)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Check for framework headers...
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
dnl Check for the new membership functions in MacOSX 10.4 (Tiger)...
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
AC_CHECK_FUNCS(mbr_uid_to_uuid)
dnl Check for notify_post support
AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
AC_CHECK_FUNCS(notify_post)
;;
*)
BACKLIBS=""
@@ -193,5 +221,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
dnl End of "$Id: cups-common.m4 4833 2005-11-12 21:46:52Z mike $".
dnl End of "$Id: cups-common.m4 4979 2006-01-25 17:47:43Z mike $".
dnl
+7 -11
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-compiler.m4 4915 2006-01-11 15:57:53Z mike $"
dnl "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -27,12 +27,14 @@ dnl for them...
OPTIM=""
AC_SUBST(OPTIM)
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
[if test x$enable_debug = xyes; then
OPTIM="-g"
fi])
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no])
dnl Update compiler options...
CXXLIBS=""
@@ -64,16 +66,10 @@ if test -n "$GCC"; then
;;
Linux*)
AC_MSG_CHECKING(if GCC supports -fpie)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fpie"
AC_TRY_COMPILE(,,
if test x$enable_pie = xyes; then
OPTIM="$OPTIM -fpie"
LDFLAGS="$LDFLAGS -pie"
AC_MSG_RESULT(yes),
CFLAGS="$OLDCFLAGS"
AC_MSG_RESULT(no))
fi
;;
esac
@@ -196,5 +192,5 @@ if test $uname = HP-UX; then
fi
dnl
dnl End of "$Id: cups-compiler.m4 4915 2006-01-11 15:57:53Z mike $".
dnl End of "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $".
dnl
+6 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-directories.m4 4873 2005-12-07 01:46:54Z mike $"
dnl "$Id: cups-directories.m4 4933 2006-01-16 00:26:57Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -43,11 +43,15 @@ if test "$bindir" = "\${exec_prefix}/bin"; then
bindir="$exec_prefix/bin"
fi
AC_DEFINE_UNQUOTED(CUPS_BINDIR, "$bindir")
dnl Fix "sbindir" variable...
if test "$sbindir" = "\${exec_prefix}/sbin"; then
sbindir="$exec_prefix/sbin"
fi
AC_DEFINE_UNQUOTED(CUPS_SBINDIR, "$sbindir")
dnl Fix "sharedstatedir" variable if it hasn't been specified...
if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
sharedstatedir="/usr/com"
@@ -275,5 +279,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 4873 2005-12-07 01:46:54Z mike $".
dnl End of "$Id: cups-directories.m4 4933 2006-01-16 00:26:57Z mike $".
dnl
+4 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-opsys.m4 4833 2005-11-12 21:46:52Z mike $"
dnl "$Id: cups-opsys.m4 4960 2006-01-20 16:41:20Z mike $"
dnl
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -24,7 +24,8 @@ dnl
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'`
case "$uname" in
GNU* | GNU/*)
uname="GNU"
@@ -95,5 +96,5 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
dnl
dnl "$Id: cups-opsys.m4 4833 2005-11-12 21:46:52Z mike $"
dnl "$Id: cups-opsys.m4 4960 2006-01-20 16:41:20Z mike $"
dnl
+45 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: config.h.in 4760 2005-10-08 20:11:08Z mike $"
* "$Id: config.h.in 4979 2006-01-25 17:47:43Z mike $"
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
@@ -71,6 +71,7 @@
* variables at run-time...
*/
#define CUPS_BINDIR "/usr/bin"
#define CUPS_CACHEDIR "/var/cache/cups"
#define CUPS_DATADIR "/usr/share/cups"
#define CUPS_DOCROOT "/usr/share/doc/cups"
@@ -78,6 +79,7 @@
#define CUPS_LOCALEDIR "/usr/share/locale"
#define CUPS_LOGDIR "/var/logs/cups"
#define CUPS_REQUESTS "/var/spool/cups"
#define CUPS_SBINDIR "/usr/sbin"
#define CUPS_SERVERBIN "/usr/lib/cups"
#define CUPS_SERVERROOT "/etc/cups"
#define CUPS_STATEDIR "/var/run/cups"
@@ -207,6 +209,13 @@
#undef HAVE_MALLOC_H
/*
* Do we have the POSIX ACL functions?
*/
#undef HAVE_ACL_INIT
/*
* Do we have the langinfo.h header file?
*/
@@ -336,8 +345,42 @@
#define CUPS_PYTHON "/usr/bin/python"
/*
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
*/
#undef HAVE_COREFOUNDATION
#undef HAVE_SYSTEMCONFIGURATION
/*
* Do we have CoreFoundation public and private headers?
*/
#undef HAVE_COREFOUNDATION_H
#undef HAVE_CFPRIV_H
#undef HAVE_CFBUNDLEPRIV_H
/*
* Do we have MacOSX 10.4's mbr_XXX functions()?
*/
#undef HAVE_MEMBERSHIP_H
#undef HAVE_MEMBERSHIPPRIV_H
#undef HAVE_MBR_UID_TO_UUID
/*
* Do we have Darwin's notify_post() header and function?
*/
#undef HAVE_NOTIFY_H
#undef HAVE_NOTIFY_POST
#endif /* !_CUPS_CONFIG_H_ */
/*
* End of "$Id: config.h.in 4760 2005-10-08 20:11:08Z mike $".
* End of "$Id: config.h.in 4979 2006-01-25 17:47:43Z mike $".
*/
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: configure.in 4873 2005-12-07 01:46:54Z mike $"
dnl "$Id: configure.in 4971 2006-01-24 14:33:18Z mike $"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -46,12 +46,12 @@ AC_SUBST(MAKEDEFS)
sinclude(config-scripts/cups-scripting.m4)
AC_OUTPUT(Makedefs packaging/cups.list cups.sh cups-config
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh cups-config
conf/cupsd.conf conf/pam.std doc/index.html
doc/help/standard.html templates/edit-config.tmpl)
chmod +x cups-config
dnl
dnl End of "$Id: configure.in 4873 2005-12-07 01:46:54Z mike $".
dnl End of "$Id: configure.in 4971 2006-01-24 14:33:18Z mike $".
dnl
+39 -31
Ver Arquivo
@@ -1,66 +1,74 @@
# DO NOT DELETE
array.o: array.h string.h ../config.h debug.h
attr.o: ppd.h file.h debug.h string.h ../config.h
auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h
auth.o: i18n.h language.h array.h normalize.h transcode.h debug.h
backchannel.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h
dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h
dest.o: i18n.h language.h array.h normalize.h transcode.h
attr.o: ppd.h array.h file.h debug.h string.h ../config.h
auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
auth.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
backchannel.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h
backchannel.o: file.h
custom.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
custom.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
dest.o: array.h file.h i18n.h language.h normalize.h transcode.h
dir.o: dir.h string.h ../config.h debug.h
emit.o: ppd.h file.h string.h ../config.h
encode.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h debug.h
emit.o: ppd.h array.h file.h string.h ../config.h
encode.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h file.h
encode.o: debug.h
file.o: http-private.h ../config.h http.h string.h md5.h ../cups/debug.h
file.o: file.h
getputfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h
getputfile.o: language.h array.h debug.h
getputfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h
getputfile.o: file.h language.h debug.h
globals.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h
globals.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h
globals.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h
globals.o: transcode.h
http.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h
http.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h transcode.h
http.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h transcode.h
http.o: debug.h
http-addr.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
http-addr.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h
http-addr.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
http-addrlist.o: http-private.h ../config.h http.h string.h md5.h globals.h
http-addrlist.o: cups.h ipp.h ppd.h file.h i18n.h language.h array.h
http-addrlist.o: cups.h ipp.h ppd.h array.h file.h i18n.h language.h
http-addrlist.o: normalize.h transcode.h debug.h
http-support.o: debug.h globals.h string.h ../config.h cups.h ipp.h http.h
http-support.o: md5.h ppd.h file.h i18n.h language.h array.h normalize.h
http-support.o: md5.h ppd.h array.h file.h i18n.h language.h normalize.h
http-support.o: transcode.h
ipp.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h
ipp.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h transcode.h
ipp.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h transcode.h
ipp.o: debug.h
ipp-support.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
ipp-support.o: file.h i18n.h language.h array.h normalize.h transcode.h
ipp-support.o: array.h file.h i18n.h language.h normalize.h transcode.h
ipp-support.o: debug.h
langprintf.o: string.h ../config.h i18n.h language.h array.h transcode.h
langprintf.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
langprintf.o: array.h file.h i18n.h language.h normalize.h transcode.h
language.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
language.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h
mark.o: ppd.h file.h string.h ../config.h debug.h
language.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
localize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
localize.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
mark.o: ppd.h array.h file.h string.h ../config.h debug.h
md5.o: md5.h string.h ../config.h
md5passwd.o: http.h string.h ../config.h md5.h
normalize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
normalize.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h
options.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h
options.o: debug.h
page.o: ppd.h file.h string.h ../config.h
ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h
ppd.o: i18n.h language.h array.h normalize.h transcode.h debug.h
normalize.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
options.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h
options.o: file.h debug.h
page.o: ppd.h array.h file.h string.h ../config.h
ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h
ppd.o: file.h i18n.h language.h normalize.h transcode.h debug.h
snprintf.o: string.h ../config.h
string.o: string.h ../config.h
tempfile.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
tempfile.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h
tempfile.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
transcode.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
transcode.o: file.h i18n.h language.h array.h normalize.h transcode.h
transcode.o: array.h file.h i18n.h language.h normalize.h transcode.h
usersys.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h
usersys.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h
usersys.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h
usersys.o: transcode.h
util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h
util.o: i18n.h language.h array.h normalize.h transcode.h debug.h
util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
util.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h
testarray.o: ../cups/string.h ../config.h string.h array.h dir.h debug.h
testfile.o: string.h ../config.h file.h debug.h
testhttp.o: http.h string.h ../config.h md5.h
testi18n.o: language.h array.h string.h ../config.h transcode.h normalize.h
testipp.o: ../cups/string.h ../config.h string.h ipp.h http.h md5.h
testlang.o: i18n.h language.h array.h
testppd.o: ../cups/string.h ../config.h string.h ppd.h array.h file.h
+19 -4
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: Makefile 4918 2006-01-12 05:14:40Z mike $"
# "$Id: Makefile 4961 2006-01-20 22:19:13Z mike $"
#
# API library Makefile for the Common UNIX Printing System (CUPS).
#
@@ -35,6 +35,7 @@ LIBOBJS = \
attr.o \
auth.o \
backchannel.o \
custom.o \
dest.o \
dir.o \
emit.o \
@@ -50,10 +51,12 @@ LIBOBJS = \
ipp-support.o \
langprintf.o \
language.o \
localize.o \
mark.o \
md5.o \
md5passwd.o \
normalize.o \
notify.o \
options.o \
page.o \
ppd.o \
@@ -71,6 +74,7 @@ OBJS = \
testi18n.o \
testipp.o \
testlang.o \
testppd.o \
php_cups_wrap.o
@@ -105,7 +109,8 @@ TARGETS = \
testhttp \
testi18n \
testipp \
testlang
testlang \
testppd
#
@@ -177,7 +182,7 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
libcups.2.dylib: $(LIBOBJS)
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/libcups.dylib \
-install_name $(libdir)/$@ \
-current_version 2.7.0 \
-compatibility_version 2.0.0 \
$(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
@@ -298,6 +303,16 @@ testlang: testlang.o libcups.a
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# testppd (dependency on static CUPS library is intentional)
#
testppd: testppd.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# Automatic API help files...
#
@@ -338,5 +353,5 @@ include Dependencies
#
# End of "$Id: Makefile 4918 2006-01-12 05:14:40Z mike $".
# End of "$Id: Makefile 4961 2006-01-20 22:19:13Z mike $".
#
+108 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: array.c 4921 2006-01-12 21:26:26Z mike $"
* "$Id: array.c 4970 2006-01-24 14:05:45Z mike $"
*
* Sorted array routines for the Common UNIX Printing System (CUPS).
*
@@ -34,6 +34,7 @@
* cupsArrayFind() - Find an element in the array.
* cupsArrayFirst() - Get the first element in the array.
* cupsArrayIndex() - Get the N-th element in the array.
* cupsArrayInsert() - Insert an element in the array.
* cupsArrayLast() - Get the last element in the array.
* cupsArrayNew() - Create a new array.
* cupsArrayNext() - Get the next element in the array.
@@ -485,6 +486,111 @@ cupsArrayIndex(cups_array_t *a, /* I - Array */
}
/*
* 'cupsArrayInsert()' - Insert an element in the array.
*
* When inserting an element in a sorted array, this function works
* just like cupsArrayAdd(). For unsorted arrays, the element is
* inserted at the beginning of the array.
*/
int /* O - 0 on failure, 1 on success */
cupsArrayInsert(cups_array_t *a, /* I - Array */
void *e) /* I - Element */
{
int i; /* Looping var */
DEBUG_printf(("cupsArrayInsert(a=%p, e=%p)\n", a, e));
/*
* Range check input...
*/
if (!a || !e)
{
DEBUG_puts("cupsArrayInsert: returning 0");
return (0);
}
/*
* Inserting into a sorted array is the same as adding...
*/
if (a->compare)
return (cupsArrayAdd(a, e));
/*
* Verify we have room for the new element...
*/
if (a->num_elements >= a->alloc_elements)
{
/*
* Allocate additional elements; start with 16 elements, then
* double the size until 1024 elements, then add 1024 elements
* thereafter...
*/
void **temp; /* New array elements */
int count; /* New allocation count */
if (a->alloc_elements == 0)
{
count = 16;
temp = malloc(count * sizeof(void *));
}
else
{
if (a->alloc_elements < 1024)
count = a->alloc_elements * 2;
else
count = a->alloc_elements + 1024;
temp = realloc(a->elements, count * sizeof(void *));
}
DEBUG_printf(("cupsArrayInsert: count=%d\n", count));
if (!temp)
{
DEBUG_puts("cupsAddInsert: allocation failed, returning 0");
return (0);
}
a->alloc_elements = count;
a->elements = temp;
}
/*
* Insert the element...
*/
memmove(a->elements + 1, a->elements, a->num_elements * sizeof(void *));
if (a->current >= 0)
a->current ++;
for (i = 0; i < a->num_saved; i ++)
if (a->saved[i] >= 0)
a->saved[i] ++;
a->elements[0] = e;
a->num_elements ++;
a->insert = 0;
#ifdef DEBUG
for (i = 0; i < a->num_elements; i ++)
printf("cupsArrayInsert: a->elements[%d]=%p\n", i, a->elements[i]);
#endif /* DEBUG */
DEBUG_puts("cupsArrayInsert: returning 1");
return (1);
}
/*
* 'cupsArrayLast()' - Get the last element in the array.
*/
@@ -824,5 +930,5 @@ cups_find(cups_array_t *a, /* I - Array */
/*
* End of "$Id: array.c 4921 2006-01-12 21:26:26Z mike $".
* End of "$Id: array.c 4970 2006-01-24 14:05:45Z mike $".
*/
+3 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: array.h 4921 2006-01-12 21:26:26Z mike $"
* "$Id: array.h 4970 2006-01-24 14:05:45Z mike $"
*
* Sorted array definitions for the Common UNIX Printing System (CUPS).
*
@@ -65,6 +65,7 @@ extern cups_array_t *cupsArrayDup(cups_array_t *a);
extern void *cupsArrayFind(cups_array_t *a, void *e);
extern void *cupsArrayFirst(cups_array_t *a);
extern void *cupsArrayIndex(cups_array_t *a, int n);
extern int cupsArrayInsert(cups_array_t *a, void *e);
extern void *cupsArrayLast(cups_array_t *a);
extern cups_array_t *cupsArrayNew(cups_array_func_t f, void *d);
extern void *cupsArrayNext(cups_array_t *a);
@@ -79,5 +80,5 @@ extern int cupsArraySave(cups_array_t *a);
#endif /* !_CUPS_ARRAY_H_ */
/*
* End of "$Id: array.h 4921 2006-01-12 21:26:26Z mike $".
* End of "$Id: array.h 4970 2006-01-24 14:05:45Z mike $".
*/
+4 -4
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: backend.h 4703 2005-09-26 19:33:58Z mike $"
* "$Id: backend.h 4973 2006-01-25 02:36:02Z mike $"
*
* Backend definitions for the Common UNIX Printing System (CUPS).
*
@@ -36,15 +36,15 @@ typedef enum cups_backend_e /**** Backend exit codes ****/
{
CUPS_BACKEND_OK = 0, /* Job completed successfully */
CUPS_BACKEND_FAILED = 1, /* Job failed, use error-policy */
CUPS_BACKEND_CANCEL = 2, /* Job failed, cancel job */
CUPS_BACKEND_AUTH_REQUIRED = 2, /* Job failed, authentication required */
CUPS_BACKEND_HOLD = 3, /* Job failed, hold job */
CUPS_BACKEND_STOP = 4, /* Job failed, stop queue */
CUPS_BACKEND_AUTH_REQUIRED = 5 /* Job failed, authentication required */
CUPS_BACKEND_CANCEL = 5 /* Job failed, cancel job */
} cups_backend_t;
#endif /* !_CUPS_BACKEND_H_ */
/*
* End of "$Id: backend.h 4703 2005-09-26 19:33:58Z mike $".
* End of "$Id: backend.h 4973 2006-01-25 02:36:02Z mike $".
*/
+7 -3
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: cups.h 4918 2006-01-12 05:14:40Z mike $"
* "$Id: cups.h 4973 2006-01-25 02:36:02Z mike $"
*
* API definitions for the Common UNIX Printing System (CUPS).
*
@@ -33,10 +33,12 @@
# include "ipp.h"
# include "ppd.h"
# include "language.h"
/*
* With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get
* an error at compile-time.
* a warning at compile-time.
*/
# if defined(__GNUC__) && __GNUC__ > 2
@@ -223,6 +225,8 @@ extern void cupsEncodeOptions2(ipp_t *ipp, int num_options,
cups_option_t *options,
ipp_tag_t group_tag);
extern const char *cupsLastErrorString(void);
extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event);
extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event);
extern cups_file_t *cupsTempFile2(char *filename, int len);
@@ -233,5 +237,5 @@ extern cups_file_t *cupsTempFile2(char *filename, int len);
#endif /* !_CUPS_CUPS_H_ */
/*
* End of "$Id: cups.h 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: cups.h 4973 2006-01-25 02:36:02Z mike $".
*/
+115
Ver Arquivo
@@ -0,0 +1,115 @@
/*
* "$Id: custom.c 4938 2006-01-17 15:11:15Z mike $"
*
* PPD custom option routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products 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 missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* PostScript is a trademark of Adobe Systems, Inc.
*
* This code and any derivative of it may be used and distributed
* freely under the terms of the GNU General Public License when
* used with GNU Ghostscript or its derivatives. Use of the code
* (or any derivative of it) with software other than GNU
* GhostScript (or its derivatives) is governed by the CUPS license
* agreement.
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
*/
/*
* Include necessary headers.
*/
#include "globals.h"
#include "debug.h"
/*
* 'ppdFindCustomOption()' - Find a custom option.
*/
ppd_coption_t * /* O - Custom option or NULL */
ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
const char *keyword)/* I - Custom option name */
{
ppd_coption_t key; /* Custom option search key */
if (!ppd)
return (NULL);
strlcpy(key.keyword, keyword, sizeof(key.keyword));
return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
}
/*
* 'ppdFindCustomParam()' - Find a parameter for a custom option.
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
const char *name) /* I - Parameter name */
{
ppd_cparam_t key; /* Custom parameter search key */
if (!opt)
return (NULL);
strlcpy(key.name, name, sizeof(key.name));
return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key));
}
/*
* 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
{
if (!opt)
return (NULL);
return ((ppd_cparam_t *)cupsArrayFirst(opt->params));
}
/*
* 'ppdNextCustomParam()' - Return the next parameter for a custom option.
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */
{
if (!opt)
return (NULL);
return ((ppd_cparam_t *)cupsArrayNext(opt->params));
}
/*
* End of "$Id: custom.c 4938 2006-01-17 15:11:15Z mike $".
*/
+137 -31
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: dest.c 4918 2006-01-12 05:14:40Z mike $"
* "$Id: dest.c 4979 2006-01-25 17:47:43Z mike $"
*
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
@@ -45,6 +45,10 @@
#include <stdlib.h>
#include <ctype.h>
#ifdef HAVE_NOTIFY_H
# include <notify.h>
#endif /* HAVE_NOTIFY_H */
/*
* Local functions...
@@ -562,16 +566,21 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
}
/*
* Free the temporary destinations...
* Free the temporary destinations and close the file...
*/
cupsFreeDests(num_temps, temps);
fclose(fp);
#ifdef HAVE_NOTIFY_POST
/*
* Close the file and return...
* Send a notification so that MacOS X applications can know about the
* change, too.
*/
fclose(fp);
notify_post("com.apple.printerListChange");
#endif /* HAVE_NOTIFY_POST */
return (0);
}
@@ -739,17 +748,35 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */
int num_dests, /* I - Number of destinations */
cups_dest_t **dests) /* IO - Destinations */
{
int i; /* Looping var */
cups_dest_t *dest; /* Current destination */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
const char *name; /* printer-name attribute */
char job_sheets[1024]; /* job-sheets option */
int accepting, /* printer-is-accepting-jobs attribute */
shared, /* printer-is-shared attribute */
state, /* printer-state attribute */
change_time, /* printer-state-change-time attribute */
type; /* printer-type attribute */
const char *info, /* printer-info attribute */
*make_model, /* printer-make-and-model attribute */
*name; /* printer-name attribute */
char job_sheets[1024], /* job-sheets option */
reasons[1024], /* printer-state-reasons attribute */
*rptr, /* Pointer into reasons string */
temp[255]; /* Temporary string for numbers */
static const char * const pattrs[] = /* Attributes we're interested in */
{
"job-sheets-default",
"printer-info",
"printer-is-accepting-jobs",
"printer-is-shared",
"printer-make-and-model",
"printer-name",
"job-sheets-default"
"printer-state",
"printer-state-change-time",
"printer-state-reasons",
"printer-type"
};
@@ -759,27 +786,18 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */
*
* attributes-charset
* attributes-natural-language
* requesting-user-name
*/
request = ippNew();
request->request.op.operation_id = op;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
cupsLangFree(language);
request = ippNewRequest(op);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
NULL, pattrs);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
/*
* Do the request and get back a response...
*/
@@ -802,17 +820,21 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */
* Pull the needed attributes from this job...
*/
name = NULL;
accepting = 0;
change_time = 0;
info = NULL;
make_model = NULL;
name = NULL;
shared = 1;
state = IPP_PRINTER_IDLE;
type = CUPS_PRINTER_LOCAL;
strcpy(job_sheets, "");
strcpy(reasons, "");
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
if (strcmp(attr->name, "printer-name") == 0 &&
attr->value_tag == IPP_TAG_NAME)
name = attr->values[0].string.text;
if (strcmp(attr->name, "job-sheets-default") == 0 &&
if (!strcmp(attr->name, "job-sheets-default") &&
(attr->value_tag == IPP_TAG_KEYWORD ||
attr->value_tag == IPP_TAG_NAME))
{
@@ -820,8 +842,46 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */
snprintf(job_sheets, sizeof(job_sheets), "%s,%s",
attr->values[0].string.text, attr->values[1].string.text);
else
strcpy(job_sheets, attr->values[0].string.text);
strlcpy(job_sheets, attr->values[0].string.text,
sizeof(job_sheets));
}
else if (!strcmp(attr->name, "printer-info") &&
attr->value_tag == IPP_TAG_TEXT)
info = attr->values[0].string.text;
else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
attr->value_tag == IPP_TAG_BOOLEAN)
accepting = attr->values[0].boolean;
else if (!strcmp(attr->name, "printer-is-shared") &&
attr->value_tag == IPP_TAG_BOOLEAN)
shared = attr->values[0].boolean;
else if (!strcmp(attr->name, "printer-make-and-model") &&
attr->value_tag == IPP_TAG_TEXT)
make_model = attr->values[0].string.text;
else if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
name = attr->values[0].string.text;
else if (!strcmp(attr->name, "printer-state") &&
attr->value_tag == IPP_TAG_ENUM)
state = attr->values[0].integer;
else if (!strcmp(attr->name, "printer-state-change-time") &&
attr->value_tag == IPP_TAG_INTEGER)
change_time = attr->values[0].integer;
else if (!strcmp(attr->name, "printer-state-reasons") &&
attr->value_tag == IPP_TAG_KEYWORD)
{
strlcpy(reasons, attr->values[0].string.text, sizeof(reasons));
for (i = 1, rptr = reasons + strlen(reasons);
i < attr->num_values;
i ++)
{
snprintf(rptr, sizeof(reasons) - (rptr - reasons), ",%s",
attr->values[i].string.text);
rptr += strlen(rptr);
}
}
else if (!strcmp(attr->name, "printer-type") &&
attr->value_tag == IPP_TAG_ENUM)
type = attr->values[0].integer;
attr = attr->next;
}
@@ -841,10 +901,56 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */
num_dests = cupsAddDest(name, NULL, num_dests, dests);
if ((dest = cupsGetDest(name, NULL, num_dests, *dests)) != NULL)
{
if (job_sheets[0])
dest->num_options = cupsAddOption("job-sheets", job_sheets, 0,
dest->num_options = cupsAddOption("job-sheets", job_sheets,
dest->num_options,
&(dest->options));
if (info)
dest->num_options = cupsAddOption("printer-info", info,
dest->num_options,
&(dest->options));
sprintf(temp, "%d", accepting);
dest->num_options = cupsAddOption("printer-is-accepting-jobs", temp,
dest->num_options,
&(dest->options));
sprintf(temp, "%d", shared);
dest->num_options = cupsAddOption("printer-is-shared", temp,
dest->num_options,
&(dest->options));
if (make_model)
dest->num_options = cupsAddOption("printer-make-and-model",
make_model, dest->num_options,
&(dest->options));
sprintf(temp, "%d", state);
dest->num_options = cupsAddOption("printer-state", temp,
dest->num_options,
&(dest->options));
if (change_time)
{
sprintf(temp, "%d", change_time);
dest->num_options = cupsAddOption("printer-state-change-time", temp,
dest->num_options,
&(dest->options));
}
if (reasons[0])
dest->num_options = cupsAddOption("printer-state-reasons", reasons,
dest->num_options,
&(dest->options));
sprintf(temp, "%d", type);
dest->num_options = cupsAddOption("printer-type", temp,
dest->num_options,
&(dest->options));
}
if (attr == NULL)
break;
}
@@ -861,5 +967,5 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */
/*
* End of "$Id: dest.c 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: dest.c 4979 2006-01-25 17:47:43Z mike $".
*/
+148 -34
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: emit.c 4785 2005-10-13 19:39:05Z mike $"
* "$Id: emit.c 4980 2006-01-25 19:57:45Z mike $"
*
* PPD code emission routines for the Common UNIX Printing System (CUPS).
*
@@ -27,14 +27,17 @@
*
* Contents:
*
* ppdCollect() - Collect all marked options that reside in the
* specified section.
* ppdEmit() - Emit code for marked options to a file.
* ppdEmitFd() - Emit code for marked options to a file.
* ppdEmitJCL() - Emit code for JCL options to a file.
* ppdEmitJCLEnd() - Emit JCLEnd code to a file.
* ppd_handle_media() - Handle media selection...
* ppd_sort() - Sort options by ordering numbers...
* ppdCollect() - Collect all marked options that reside in the
* specified section.
* ppdCollect2() - Collect all marked options that reside in the
* specified section and minimum order.
* ppdEmit() - Emit code for marked options to a file.
* ppdEmitAfterOrder() - Emit a subset of the code for marked options to a file.
* ppdEmitFd() - Emit code for marked options to a file.
* ppdEmitJCL() - Emit code for JCL options to a file.
* ppdEmitJCLEnd() - Emit JCLEnd code to a file.
* ppd_handle_media() - Handle media selection...
* ppd_sort() - Sort options by ordering numbers...
*/
/*
@@ -78,6 +81,23 @@ int /* O - Number of options marked */
ppdCollect(ppd_file_t *ppd, /* I - PPD file data */
ppd_section_t section, /* I - Section to collect */
ppd_choice_t ***choices) /* O - Pointers to choices */
{
return (ppdCollect2(ppd, section, 0.0, choices));
}
/*
* 'ppdCollect2()' - Collect all marked options that reside in the
* specified section and minimum order.
*
* @since CUPS 1.2@
*/
int /* O - Number of options marked */
ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
ppd_section_t section, /* I - Section to collect */
float min_order, /* I - Minimum OrderDependency value */
ppd_choice_t ***choices) /* O - Pointers to choices */
{
int i, j, k, m; /* Looping vars */
ppd_group_t *g, /* Current group */
@@ -105,7 +125,7 @@ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
{
for (j = g->num_options, o = g->options; j > 0; j --, o ++)
if (o->section == section)
if (o->section == section && o->order >= min_order)
for (k = o->num_choices, c = o->choices; k > 0; k --, c ++)
if (c->marked && count < 1000)
{
@@ -115,7 +135,7 @@ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */
for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
for (k = sg->num_options, o = sg->options; k > 0; k --, o ++)
if (o->section == section)
if (o->section == section && o->order >= min_order)
for (m = o->num_choices, c = o->choices; m > 0; m --, c ++)
if (c->marked && count < 1000)
{
@@ -159,6 +179,29 @@ int /* O - 0 on success, -1 on failure */
ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
FILE *fp, /* I - File to write to */
ppd_section_t section) /* I - Section to write */
{
return (ppdEmitAfterOrder(ppd, fp, section, 0, 0.0));
}
/*
* 'ppdEmitAfterOrder()' - Emit a subset of the code for marked options to a file.
*
* When "limit" is non-zero, this function only emits options whose
* OrderDependency value is greater than or equal to "min_order".
*
* When "limit" is zero, this function is identical to ppdEmit().
*
* @since CUPS 1.2@
*/
int /* O - 0 on success, -1 on failure */
ppdEmitAfterOrder(
ppd_file_t *ppd, /* I - PPD file record */
FILE *fp, /* I - File to write to */
ppd_section_t section, /* I - Section to write */
int limit, /* I - Non-zero to use min_order, 0 to include all */
float min_order) /* I - Lowest order dependency to include */
{
int i, /* Looping var */
count; /* Number of choices */
@@ -176,7 +219,7 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
* Collect the options we need to emit and emit them!
*/
if ((count = ppdCollect(ppd, section, &choices)) == 0)
if ((count = ppdCollect2(ppd, section, min_order, &choices)) == 0)
return (0);
for (i = 0; i < count; i ++)
@@ -197,9 +240,9 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
!strcasecmp(choices[i]->choice, "Custom"))
{
/*
* Variable size; write out standard size options, using the
@@ -208,15 +251,16 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
ppd_attr_t *attr; /* PPD attribute */
int pos, /* Position of custom value */
values[5], /* Values for custom command */
orientation; /* Orientation to use */
float values[5]; /* Values for custom command */
int isfloat[5]; /* Whether each value is float or int */
fputs("%%BeginFeature: *CustomPageSize True\n", fp);
size = ppdPageSize(ppd, "Custom");
memset(values, 0, sizeof(values));
memset(isfloat, 0, sizeof(isfloat));
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
{
@@ -228,7 +272,8 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
else
pos = 0;
values[pos] = (int)size->width;
values[pos] = size->width;
isfloat[pos] = 1;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
{
@@ -240,7 +285,8 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
else
pos = 1;
values[pos] = (int)size->length;
values[pos] = size->length;
isfloat[pos] = 1;
/*
* According to the Adobe PPD specification, an orientation of 1
@@ -292,8 +338,11 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
values[pos] = orientation;
fprintf(fp, "%d %d %d %d %d\n", values[0], values[1],
values[2], values[3], values[4]);
for (pos = 0; pos < 5; pos ++)
if (isfloat[pos])
fprintf(fp, "%.2f\n", values[pos]);
else
fprintf(fp, "%.0f\n", values[pos]);
if (choices[i]->code == NULL)
{
@@ -306,8 +355,75 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
fputs(ppd_custom_code, fp);
}
}
else if (!strcasecmp(choices[i]->choice, "Custom"))
{
/*
* Custom option...
*/
ppd_coption_t *coption; /* Custom option */
ppd_cparam_t *cparam; /* Custom parameter */
const char *s; /* Pointer into string value */
/*
* TODO: Support custom options with more than 1 parameter...
*/
if ((coption = ppdFindCustomOption(ppd, choices[i]->option->keyword))
!= NULL &&
(cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) != NULL)
{
if (fprintf(fp, "%%%%BeginFeature: *Custom%s True\n",
coption->keyword) < 0)
{
free(choices);
return (-1);
}
switch (cparam->type)
{
case PPD_CUSTOM_CURVE :
case PPD_CUSTOM_INVCURVE :
case PPD_CUSTOM_POINTS :
case PPD_CUSTOM_REAL :
if (fprintf(fp, "%f\n", cparam->current.custom_real) < 0)
{
free(choices);
return (-1);
}
break;
case PPD_CUSTOM_INT :
if (fprintf(fp, "%d\n", cparam->current.custom_int) < 0)
{
free(choices);
return (-1);
}
break;
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
putc('(', fp);
for (s = cparam->current.custom_string; *s; s ++)
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
fprintf(fp, "\\%03o", *s & 255);
else
putc(*s, fp);
if (fputs(")\n", fp) < 0)
{
free(choices);
return (-1);
}
break;
}
}
}
else if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->option->keyword,
choices[i]->choice) < 0)
{
free(choices);
@@ -397,9 +513,9 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
!strcasecmp(choices[i]->choice, "Custom"))
{
custom_size = 1;
@@ -410,8 +526,7 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
custom_size = 0;
snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice);
choices[i]->option->keyword, choices[i]->choice);
}
if (write(fd, buf, strlen(buf)) < 1)
@@ -748,10 +863,9 @@ ppd_handle_media(ppd_file_t *ppd)
if (!rpr)
rpr = ppdFindAttr(ppd, "RequiresPageRegion", "All");
if (strcasecmp(size->name, "Custom") == 0 ||
(manual_feed == NULL && input_slot == NULL) ||
(manual_feed != NULL && strcasecmp(manual_feed->choice, "False") == 0) ||
(input_slot != NULL && (input_slot->code == NULL || !input_slot->code[0])))
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])))
{
/*
* Manual feed was not selected and/or the input slot selection does
@@ -802,9 +916,9 @@ static int /* O - -1 if c1 < c2, 0 if equal, 1 otherwise */
ppd_sort(ppd_choice_t **c1, /* I - First choice */
ppd_choice_t **c2) /* I - Second choice */
{
if (((ppd_option_t *)(*c1)->option)->order < ((ppd_option_t *)(*c2)->option)->order)
if ((*c1)->option->order < (*c2)->option->order)
return (-1);
else if (((ppd_option_t *)(*c1)->option)->order > ((ppd_option_t *)(*c2)->option)->order)
else if ((*c1)->option->order > (*c2)->option->order)
return (1);
else
return (0);
@@ -812,5 +926,5 @@ ppd_sort(ppd_choice_t **c1, /* I - First choice */
/*
* End of "$Id: emit.c 4785 2005-10-13 19:39:05Z mike $".
* End of "$Id: emit.c 4980 2006-01-25 19:57:45Z mike $".
*/
+54 -12
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id: encode.c 4918 2006-01-12 05:14:40Z mike $"
* "$Id: encode.c 4977 2006-01-25 15:52:30Z mike $"
*
* Option encoding routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -25,9 +25,10 @@
*
* Contents:
*
* cupsEncodeOptions() - Encode printer options into IPP attributes.
* cupsEncodeOptions2() - Encode printer options into IPP attributes for
* a group.
* cupsEncodeOptions() - Encode printer options into IPP attributes.
* cupsEncodeOptions2() - Encode printer options into IPP attributes for
* a group.
* compare_ipp_options() - Compare two IPP options.
*/
/*
@@ -35,6 +36,7 @@
*/
#include "cups.h"
#include "ipp-private.h"
#include <stdlib.h>
#include <ctype.h>
#include "string.h"
@@ -43,6 +45,8 @@
/*
* Local list of option names and the value tags they should use...
*
* **** THIS LIST MUST BE SORTED ****
*/
typedef struct
@@ -89,9 +93,19 @@ static const _ipp_option_t ipp_options[] =
{ "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
{ "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
{ "printer-is-accepting-jobs",IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ "printer-is-shared", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ "printer-make-and-model", IPP_TAG_TEXT, IPP_TAG_PRINTER },
{ "printer-more-info", IPP_TAG_URI, IPP_TAG_PRINTER },
{ "printer-resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
{ "printer-state", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ "printer-state-change-time",IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ "printer-type", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ "printer-uri", IPP_TAG_URI, IPP_TAG_OPERATION },
{ "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
{ "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
{ "saturation", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ "scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
@@ -100,6 +114,13 @@ static const _ipp_option_t ipp_options[] =
};
/*
* Local functions...
*/
static int compare_ipp_options(_ipp_option_t *a, _ipp_option_t *b);
/*
* 'cupsEncodeOptions()' - Encode printer options into IPP attributes.
*
@@ -189,6 +210,10 @@ cupsEncodeOptions2(
for (i = 0; i < num_options; i ++)
{
_ipp_option_t key, /* Search key */
*match; /* Matching attribute */
/*
* Skip document format options that are handled above...
*/
@@ -202,16 +227,21 @@ cupsEncodeOptions2(
* Figure out the proper value and group tags for this option...
*/
for (j = 0; j < (int)(sizeof(ipp_options) / sizeof(ipp_options[0])); j ++)
if (!strcasecmp(options[i].name, ipp_options[j].name))
break;
key.name = options[i].name;
match = (_ipp_option_t *)bsearch(&key, ipp_options,
sizeof(ipp_options) /
sizeof(ipp_options[0]),
sizeof(ipp_options[0]),
(int (*)(const void *,
const void *))
compare_ipp_options);
if (j < (int)(sizeof(ipp_options) / sizeof(ipp_options[0])))
if (match)
{
if (ipp_options[j].group_tag != group_tag)
if (match->group_tag != group_tag)
continue;
value_tag = ipp_options[j].value_tag;
value_tag = match->value_tag;
}
else if (group_tag != IPP_TAG_JOB)
continue;
@@ -467,5 +497,17 @@ cupsEncodeOptions2(
/*
* End of "$Id: encode.c 4918 2006-01-12 05:14:40Z mike $".
* 'compare_ipp_options()' - Compare two IPP options.
*/
static int /* O - Result of comparison */
compare_ipp_options(_ipp_option_t *a, /* I - First option */
_ipp_option_t *b) /* I - Second option */
{
return (strcmp(a->name, b->name));
}
/*
* End of "$Id: encode.c 4977 2006-01-25 15:52:30Z mike $".
*/
-307
Ver Arquivo
@@ -1,307 +0,0 @@
/*
* "$Id: extended.c 4494 2005-02-18 02:18:11Z mike $"
*
* Extended option routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products 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 missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* PostScript is a trademark of Adobe Systems, Inc.
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* ppdFindExtOption() - Return a pointer to the extended option.
* ppdMarkCurve() - Mark an extended curve option.
* ppdMarkGamma() - Mark an extended gamma option.
* ppdMarkInteger() - Mark an extended integer option.
* ppdMarkIntegerArray() - Mark an extended integer array option.
* ppdMarkReal() - Mark an extended real option.
* ppdMarkRealArray() - Mark an extended real array option.
* ppdMarkText() - Mark an extended text option.
*/
/*
* Include necessary headers...
*/
#include "ppd.h"
#include "string.h"
#include "debug.h"
/*
* Local functions...
*/
static void ppd_unmark_choices(ppd_option_t *option);
/*
* 'ppdFindExtOption()' - Return a pointer to the extended option.
*/
ppd_ext_option_t * /* O - Pointer to option or NULL */
ppdFindExtOption(ppd_file_t *ppd, /* I - PPD file data */
const char *option) /* I - Option/Keyword name */
{
int i; /* Looping var */
ppd_ext_option_t **o; /* Pointer to option */
if (ppd == NULL || option == NULL)
return (NULL);
for (i = ppd->num_extended, o = ppd->extended; i > 0; i --, o ++)
if (strcasecmp(o[0]->keyword, option) == 0)
return (*o);
return (NULL);
}
/*
* 'ppdFindExtParam()' - Find an extended parameter.
*/
ppd_ext_param_t * /* O - Parameter or NULL */
ppdFindExtParam(ppd_ext_option_t *opt, /* I - Option */
const char *param)/* I - Parameter name */
{
int i; /* Looping var */
ppd_ext_param_t **p; /* Pointer to parameter */
if (opt == NULL || param == NULL)
return (NULL);
for (i = opt->num_params, p = opt->params; i > 0; i --, p ++)
if (strcasecmp(p[0]->keyword, param) == 0)
return (*p);
return (NULL);
}
/*
* 'ppdMarkCurve()' - Mark an extended curve option.
*/
int /* O - Number of conflicts */
ppdMarkCurve(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Option name */
const char *param, /* I - Parameter name */
float low, /* I - Lower (start) value */
float high, /* I - Upper (end) value */
float gvalue) /* I - Gamma value for range */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppdMarkGamma()' - Mark an extended gamma option.
*/
int /* O - Number of conflicts */
ppdMarkGamma(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Option name */
const char *param, /* I - Parameter name */
float gvalue) /* I - Gamma value */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppdMarkInteger()' - Mark an extended integer option.
*/
int /* O - Number of conflicts */
ppdMarkInteger(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Option name */
const char *param, /* I - Parameter name */
int value) /* I - Option value */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppdMarkIntegerArray()' - Mark an extended integer array option.
*/
int /* O - Number of conflicts */
ppdMarkIntegerArray(ppd_file_t *ppd, /* I - PPD file */
const char *keyword,/* I - Option name */
const char *param, /* I - Parameter name */
int num_values,
/* I - Number of values */
const int *values) /* I - Values */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppdMarkReal()' - Mark an extended real option.
*/
int /* O - Number of conflicts */
ppdMarkReal(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Option name */
const char *param, /* I - Parameter name */
float value) /* I - Option value */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppdMarkRealArray()' - Mark an extended real array option.
*/
int /* O - Number of conflicts */
ppdMarkRealArray(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Option name */
const char *param, /* I - Parameter name */
int num_values,/* I - Number of values */
const float *values) /* I - Values */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppdMarkText()' - Mark an extended text option.
*/
int /* O - Number of conflicts */
ppdMarkText(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Option name */
const char *param, /* I - Parameter name */
const char *value) /* I - Option value */
{
ppd_ext_option_t *o; /* Extended option */
ppd_ext_param_t *p; /* Extended parameter */
if ((o = ppdFindExtOption(ppd, keyword)) == NULL)
return (-1);
if ((p = ppdFindExtParam(o, param)) == NULL)
return (-1);
ppd_unmark_choices(o->option);
return (ppdConflicts(ppd));
}
/*
* 'ppd_unmark_choices()' - Unmark all "canned" choices.
*/
static void
ppd_unmark_choices(ppd_option_t *option)/* I - Option choice */
{
int i; /* Looping var */
ppd_choice_t *c; /* Current choice */
for (i = option->num_choices, c = option->choices; i > 0; i --, c++)
c->marked = 0;
}
/*
* End of "$Id: extended.c 4494 2005-02-18 02:18:11Z mike $".
*/
+129 -35
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: file.c 4844 2005-11-21 17:37:57Z mike $"
* "$Id: file.c 4983 2006-01-25 21:53:43Z mike $"
*
* File functions for the Common UNIX Printing System (CUPS).
*
@@ -31,6 +31,7 @@
* cupsFileClose() - Close a CUPS file.
* cupsFileCompression() - Return whether a file is compressed.
* cupsFileEOF() - Return the end-of-file status.
* cupsFileFind() - Find a file using the specified path.
* cupsFileFlush() - Flush pending output.
* cupsFileGetChar() - Get a single character from a file.
* cupsFileGetConf() - Get a line from a configuration file...
@@ -99,14 +100,14 @@ struct _cups_file_s /**** CUPS file structure... ****/
char mode, /* Mode ('r' or 'w') */
compressed, /* Compression used? */
eof, /* End of file? */
buf[2048], /* Buffer */
buf[4096], /* Buffer */
*ptr, /* Pointer into buffer */
*end; /* End of buffer data */
off_t pos; /* File position for start of buffer */
#ifdef HAVE_LIBZ
z_stream stream; /* (De)compression stream */
Bytef cbuf[1024]; /* (De)compression buffer */
Bytef cbuf[4096]; /* (De)compression buffer */
uLong crc; /* (De)compression CRC */
#endif /* HAVE_LIBZ */
};
@@ -271,6 +272,91 @@ cupsFileEOF(cups_file_t *fp) /* I - CUPS file */
}
/*
* 'cupsFileFind()' - Find a file using the specified path.
*
* This function allows the paths in the path string to be separated by
* colons (UNIX standard) or semicolons (Windows standard) and stores the
* result in the buffer supplied. If the file cannot be found in any of
* the supplied paths, NULL is returned. A NULL path only matches the
* current directory.
*/
const char * /* O - Full path to file or NULL */
cupsFileFind(const char *filename, /* I - File to find */
const char *path, /* I - Colon/semicolon-separated path */
char *buffer, /* I - Filename buffer */
int bufsize) /* I - Size of filename buffer */
{
char *bufptr, /* Current position in buffer */
*bufend; /* End of buffer */
/*
* Range check input...
*/
if (!filename || !buffer || bufsize < 2)
return (NULL);
if (!path)
{
/*
* No path, so check current directory...
*/
if (!access(filename, 0))
{
strlcpy(buffer, filename, bufsize);
return (buffer);
}
else
return (NULL);
}
/*
* Now check each path and return the first match...
*/
bufend = buffer + bufsize - 1;
bufptr = buffer;
while (*path)
{
if (*path == ';' || *path == ':')
{
if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
*bufptr++ = '/';
strlcpy(bufptr, filename, bufend - bufptr);
if (!access(buffer, 0))
return (buffer);
bufptr = buffer;
}
else if (bufptr < bufend)
*bufptr++ = *path;
path ++;
}
/*
* Check the last path...
*/
if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
*bufptr++ = '/';
strlcpy(bufptr, filename, bufend - bufptr);
if (!access(buffer, 0))
return (buffer);
else
return (NULL);
}
/*
* 'cupsFileFlush()' - Flush pending output.
*/
@@ -1325,7 +1411,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
* file...
*/
if ((bytes = cups_read(fp, (char *)fp->cbuf, sizeof(fp->cbuf))) < 0)
if ((bytes = cups_read(fp, (char *)fp->buf, sizeof(fp->buf))) < 0)
{
/*
* Can't read from file!
@@ -1334,15 +1420,14 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
return (-1);
}
if (bytes < 10 || fp->cbuf[0] != 0x1f || fp->cbuf[1] != 0x8b ||
fp->cbuf[2] != 8 || (fp->cbuf[3] & 0xe0) != 0)
if (bytes < 10 || fp->buf[0] != 0x1f ||
(unsigned char)fp->buf[1] != 0x8b ||
fp->buf[2] != 8 || (fp->buf[3] & 0xe0) != 0)
{
/*
* Not a gzip'd file!
*/
memcpy(fp->buf, fp->cbuf, bytes);
fp->ptr = fp->buf;
fp->end = fp->buf + bytes;
@@ -1353,10 +1438,10 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
* Parse header junk: extra data, original name, and comment...
*/
ptr = (unsigned char *)fp->cbuf + 10;
end = (unsigned char *)fp->cbuf + bytes;
ptr = (unsigned char *)fp->buf + 10;
end = (unsigned char *)fp->buf + bytes;
if (fp->cbuf[3] & 0x04)
if (fp->buf[3] & 0x04)
{
/*
* Skip extra data...
@@ -1384,7 +1469,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
}
}
if (fp->cbuf[3] & 0x08)
if (fp->buf[3] & 0x08)
{
/*
* Skip original name data...
@@ -1405,7 +1490,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
}
}
if (fp->cbuf[3] & 0x10)
if (fp->buf[3] & 0x10)
{
/*
* Skip comment data...
@@ -1426,7 +1511,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
}
}
if (fp->cbuf[3] & 0x02)
if (fp->buf[3] & 0x02)
{
/*
* Skip header CRC data...
@@ -1444,6 +1529,13 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
}
}
/*
* Copy the flate-compressed data to the compression buffer...
*/
if ((bytes = end - ptr) > 0)
memcpy(fp->cbuf, ptr, bytes);
/*
* Setup the decompressor data...
*/
@@ -1451,9 +1543,9 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
fp->stream.zalloc = (alloc_func)0;
fp->stream.zfree = (free_func)0;
fp->stream.opaque = (voidpf)0;
fp->stream.next_in = (Bytef *)ptr;
fp->stream.next_in = (Bytef *)fp->cbuf;
fp->stream.next_out = NULL;
fp->stream.avail_in = end - ptr;
fp->stream.avail_in = bytes;
fp->stream.avail_out = 0;
fp->crc = crc32(0L, Z_NULL, 0);
@@ -1509,29 +1601,30 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
*/
fp->eof = 1;
return (-1);
}
tcrc = (((((trailer[3] << 8) | trailer[2]) << 8) | trailer[1]) << 8) |
trailer[0];
if (tcrc != fp->crc)
else
{
tcrc = (((((trailer[3] << 8) | trailer[2]) << 8) | trailer[1]) << 8) |
trailer[0];
if (tcrc != fp->crc)
{
/*
* Bad CRC, mark end-of-file...
*/
fp->eof = 1;
return (-1);
}
/*
* Bad CRC, mark end-of-file...
* Otherwise, reset the compressed flag so that we re-read the
* file header...
*/
fp->eof = 1;
return (-1);
fp->compressed = 0;
}
/*
* Otherwise, reset the current pointer so that we re-read the
* file header...
*/
fp->ptr = NULL;
continue;
}
bytes = sizeof(fp->buf) - fp->stream.avail_out;
@@ -1543,7 +1636,8 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
fp->ptr = fp->buf;
fp->end = fp->buf + bytes;
return (bytes);
if (bytes)
return (bytes);
}
}
#endif /* HAVE_LIBZ */
@@ -1676,5 +1770,5 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
/*
* End of "$Id: file.c 4844 2005-11-21 17:37:57Z mike $".
* End of "$Id: file.c 4983 2006-01-25 21:53:43Z mike $".
*/
+4 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: file.h 4857 2005-11-30 19:25:17Z mike $"
* "$Id: file.h 4933 2006-01-16 00:26:57Z mike $"
*
* Public file definitions for the Common UNIX Printing System (CUPS).
*
@@ -74,6 +74,8 @@ typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/
extern int cupsFileClose(cups_file_t *fp);
extern int cupsFileCompression(cups_file_t *fp);
extern int cupsFileEOF(cups_file_t *fp);
extern const char *cupsFileFind(const char *filename, const char *path,
char *buffer, int bufsize);
extern int cupsFileFlush(cups_file_t *fp);
extern int cupsFileGetChar(cups_file_t *fp);
extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen,
@@ -101,5 +103,5 @@ extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes);
#endif /* !_CUPS_FILE_H_ */
/*
* End of "$Id: file.h 4857 2005-11-30 19:25:17Z mike $".
* End of "$Id: file.h 4933 2006-01-16 00:26:57Z mike $".
*/
+22 -6
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: getputfile.c 4918 2006-01-12 05:14:40Z mike $"
* "$Id: getputfile.c 4984 2006-01-25 21:55:36Z mike $"
*
* Get/put file functions for the Common UNIX Printing System (CUPS).
*
@@ -125,7 +125,11 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */
if (cupsDoAuthentication(http, "GET", resource))
break;
httpReconnect(http);
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
continue;
}
@@ -136,7 +140,11 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */
httpFlush(http);
/* Reconnect... */
httpReconnect(http);
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
/* Upgrade with encryption... */
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
@@ -340,7 +348,11 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
if (cupsDoAuthentication(http, "PUT", resource))
break;
httpReconnect(http);
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
continue;
}
@@ -351,7 +363,11 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
httpFlush(http);
/* Reconnect... */
httpReconnect(http);
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
/* Upgrade with encryption... */
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
@@ -431,5 +447,5 @@ cupsPutFile(http_t *http, /* I - HTTP connection to server */
/*
* End of "$Id: getputfile.c 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: getputfile.c 4984 2006-01-25 21:55:36Z mike $".
*/
+14 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: globals.c 4922 2006-01-12 22:05:06Z mike $"
* "$Id: globals.c 4967 2006-01-24 03:42:15Z mike $"
*
* Global variable access routines for the Common UNIX Printing System (CUPS).
*
@@ -152,6 +152,18 @@ globals_init()
static void
globals_destructor(void *value) /* I - Data to free */
{
_cups_globals_t *cg; /* Global data */
cg = (_cups_globals_t *)value;
if (cg->http)
httpClose(cg->http);
_cupsLangFlush(cg);
_cupsCharmapFlush(cg);
_cupsNormalizeMapsFlush(cg);
free(value);
}
@@ -198,5 +210,5 @@ _cupsGlobals(void)
/*
* End of "$Id: globals.c 4922 2006-01-12 22:05:06Z mike $".
* End of "$Id: globals.c 4967 2006-01-24 03:42:15Z mike $".
*/
+6 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: globals.h 4918 2006-01-12 05:14:40Z mike $"
* "$Id: globals.h 4967 2006-01-24 03:42:15Z mike $"
*
* Global variable definitions for the Common UNIX Printing System (CUPS).
*
@@ -94,6 +94,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
/* language.c */
cups_lang_t *lang_cache; /* Language string cache */
cups_lang_t *lang_default; /* Default language */
# ifdef __APPLE__
# ifdef HAVE_CF_LOCALE_ID
char language[32]; /* Cached language */
@@ -140,6 +141,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
extern const char *_cupsGetPassword(const char *prompt);
extern _cups_globals_t *_cupsGlobals(void);
extern void _cupsLangFlush(_cups_globals_t *cg);
extern void _cupsCharmapFlush(_cups_globals_t *cg);
extern void _cupsNormalizeMapsFlush(_cups_globals_t *cg);
/*
@@ -152,5 +156,5 @@ extern _cups_globals_t *_cupsGlobals(void);
#endif /* !_CUPS_GLOBALS_H_ */
/*
* End of "$Id: globals.h 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: globals.h 4967 2006-01-24 03:42:15Z mike $".
*/
+3 -4
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: http-addr.c 4806 2005-10-21 18:49:24Z mike $"
* "$Id: http-addr.c 4950 2006-01-19 16:07:57Z mike $"
*
* HTTP address routines for the Common UNIX Printing System (CUPS).
*
@@ -133,8 +133,7 @@ httpAddrLocalhost(
{
#ifdef AF_INET6
if (addr->addr.sa_family == AF_INET6 &&
(IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr)) ||
IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr))))
IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr)))
return (1);
#endif /* AF_INET6 */
@@ -541,5 +540,5 @@ httpGetHostname(char *s, /* I - String buffer for name */
/*
* End of "$Id: http-addr.c 4806 2005-10-21 18:49:24Z mike $".
* End of "$Id: http-addr.c 4950 2006-01-19 16:07:57Z mike $".
*/
+8 -3
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id: http-addrlist.c 4815 2005-10-31 20:40:17Z mike $"
* "$Id: http-addrlist.c 4976 2006-01-25 15:07:40Z mike $"
*
* HTTP address list routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -90,6 +90,11 @@ httpAddrConnect(
setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
#endif /* SO_REUSEPORT */
#ifdef SO_NOSIGPIPE
val = 1;
setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
#endif /* SO_NOSIGPIPE */
/*
* Using TCP_NODELAY improves responsiveness, especially on systems
* with a slow loopback interface...
@@ -584,5 +589,5 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
/*
* End of "$Id: http-addrlist.c 4815 2005-10-31 20:40:17Z mike $".
* End of "$Id: http-addrlist.c 4976 2006-01-25 15:07:40Z mike $".
*/
+3 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: http-private.h 4800 2005-10-18 18:06:20Z mike $"
* "$Id: http-private.h 4973 2006-01-25 02:36:02Z mike $"
*
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
*
@@ -64,6 +64,7 @@ typedef int socklen_t;
# endif /* __sgi */
# include "http.h"
# include "ipp-private.h"
# if defined HAVE_LIBSSL
/*
@@ -122,5 +123,5 @@ extern const char *hstrerror(int error);
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
/*
* End of "$Id: http-private.h 4800 2005-10-18 18:06:20Z mike $".
* End of "$Id: http-private.h 4973 2006-01-25 02:36:02Z mike $".
*/
+57 -5
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: http-support.c 4903 2006-01-10 20:02:46Z mike $"
* "$Id: http-support.c 4961 2006-01-20 22:19:13Z mike $"
*
* HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
*
@@ -320,6 +320,9 @@ httpAssembleURIf(char *uri, /* I - URI buffer */
if (resourcef)
{
char *query; /* Pointer to query string */
va_start(ap, resourcef);
bytes = vsnprintf(resource, sizeof(resource), resourcef, ap);
va_end(ap);
@@ -327,9 +330,27 @@ httpAssembleURIf(char *uri, /* I - URI buffer */
if (bytes >= sizeof(resource))
goto assemble_overflow;
/*
* Temporarily remove query string if present...
*/
if ((query = strchr(resource, '?')) != NULL)
*query = '\0';
ptr = http_copy_encode(ptr, resource, end, NULL);
if (!ptr)
goto assemble_overflow;
if (query)
{
/*
* Copy query string without encoding...
*/
*query = '?';
strlcpy(ptr, query, end - ptr);
ptr += strlen(ptr);
}
}
else if (ptr < end)
*ptr++ = '/';
@@ -398,9 +419,17 @@ httpDecode64_2(char *out, /* I - String to write to */
* Range check input...
*/
if (!out || !outlen || *outlen < 1 || !in || !*in)
if (!out || !outlen || *outlen < 1 || !in)
return (NULL);
if (!*in)
{
*out = '\0';
*outlen = 0;
return (out);
}
/*
* Convert from base-64 to bytes...
*/
@@ -991,10 +1020,33 @@ httpSeparateURI(const char *uri, /* I - Universal Resource Identifier */
status = HTTP_URI_MISSING_RESOURCE;
*resource = '/';
uri = http_copy_decode(resource + 1, uri, resourcelen - 1, "");
/*
* Copy any query string without decoding it...
*/
if (*uri == '?')
{
strlcpy(resource + 1, uri, resourcelen - 1);
uri += strlen(uri);
}
else
resource[1] = '\0';
}
else
uri = http_copy_decode(resource, uri, resourcelen, "");
{
uri = http_copy_decode(resource, uri, resourcelen, "?");
if (uri && *uri == '?')
{
/*
* Concatenate any query string without decoding it...
*/
strlcat(resource, uri, resourcelen);
uri += strlen(uri);
}
}
if (!uri)
{
@@ -1191,5 +1243,5 @@ http_copy_encode(char *dst, /* O - Destination buffer */
/*
* End of "$Id: http-support.c 4903 2006-01-10 20:02:46Z mike $".
* End of "$Id: http-support.c 4961 2006-01-20 22:19:13Z mike $".
*/
+139 -36
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id: http.c 4914 2006-01-11 02:04:22Z mike $"
* "$Id: http.c 4995 2006-01-26 20:14:42Z mike $"
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -379,11 +379,52 @@ void
httpFlush(http_t *http) /* I - HTTP data */
{
char buffer[8192]; /* Junk buffer */
int blocking; /* To block or not to block */
DEBUG_printf(("httpFlush(http=%p), state=%d\n", http, http->state));
/*
* Temporarily set non-blocking mode so we don't get stuck in httpRead()...
*/
blocking = http->blocking;
http->blocking = 0;
/*
* Read any data we can...
*/
while (httpRead(http, buffer, sizeof(buffer)) > 0);
/*
* Restore blocking and reset the connection if we didn't get all of
* the remaining data...
*/
http->blocking = blocking;
if (http->state != HTTP_WAITING && http->fd >= 0)
{
/*
* Didn't get the data back, so close the current connection.
*/
http->state = HTTP_WAITING;
#ifdef HAVE_SSL
if (http->tls)
http_shutdown_ssl(http);
#endif /* HAVE_SSL */
#ifdef WIN32
closesocket(http->fd);
#else
close(http->fd);
#endif /* WIN32 */
http->fd = -1;
}
}
@@ -829,21 +870,23 @@ httpInitialize(void)
if (!initialized)
WSAStartup(MAKEWORD(1,1), &winsockdata);
#elif defined(HAVE_SIGSET)
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
struct sigaction action; /* POSIX sigaction data */
#elif !defined(SO_NOSIGPIPE)
/*
* Ignore SIGPIPE signals...
*/
# ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
# elif defined(HAVE_SIGACTION)
struct sigaction action; /* POSIX sigaction data */
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
# else
signal(SIGPIPE, SIG_IGN);
# endif /* !SO_NOSIGPIPE */
#endif /* WIN32 */
#ifdef HAVE_GNUTLS
@@ -1166,7 +1209,7 @@ httpRead(http_t *http, /* I - HTTP data */
{
ch = buffer[i + j] & 255;
if (ch < ' ' || ch == 127)
if (ch < ' ' || ch >= 127)
ch = '.';
putchar(ch);
@@ -1191,17 +1234,34 @@ _httpReadCDSA(
void *data, /* I - Data buffer */
size_t *dataLength) /* IO - Number of bytes */
{
OSStatus result; /* Return value */
ssize_t bytes; /* Number of bytes read */
bytes = recv((int)connection, data, *dataLength, 0);
if (bytes >= 0)
for (;;)
{
*dataLength = bytes;
return (0);
bytes = recv((int)connection, data, *dataLength, 0);
if (bytes > 0)
{
result = (bytes == *dataLength);
*dataLength = bytes;
return (result);
}
if (bytes == 0)
return (errSSLClosedAbort);
if (errno == EAGAIN)
return (errSSLWouldBlock);
if (errno == EPIPE)
return (errSSLClosedAbort);
if (errno != EINTR)
return (errSSLInternal);
}
else
return (-1);
}
#endif /* HAVE_SSL && HAVE_CDSASSL */
@@ -1705,17 +1765,31 @@ _httpWriteCDSA(
const void *data, /* I - Data buffer */
size_t *dataLength) /* IO - Number of bytes */
{
ssize_t bytes; /* Number of write written */
OSStatus result; /* Return value */
ssize_t bytes; /* Number of bytes read */
bytes = write((int)connection, data, *dataLength);
if (bytes >= 0)
for (;;)
{
*dataLength = bytes;
return (0);
bytes = write((int)connection, data, *dataLength);
if (bytes >= 0)
{
result = (bytes == *dataLength) ? 0 : errSSLWouldBlock;
*dataLength = bytes;
return (result);
}
if (errno == EAGAIN)
return (errSSLWouldBlock);
if (errno == EPIPE)
return (errSSLClosedAbort);
if (errno != EINTR)
return (errSSLInternal);
}
else
return (-1);
}
#endif /* HAVE_SSL && HAVE_CDSASSL */
@@ -1755,20 +1829,32 @@ http_read_ssl(http_t *http, /* I - HTTP data */
return (gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len));
# elif defined(HAVE_CDSASSL)
int result; /* Return value */
OSStatus error; /* Error info */
size_t processed; /* Number of bytes processed */
error = SSLRead((SSLContextRef)http->tls, buf, len, &processed);
if (error == 0)
return (processed);
else
switch (error)
{
http->error = error;
return (-1);
case 0 :
result = (int)processed;
break;
case errSSLClosedGraceful :
result = 0;
break;
case errSSLWouldBlock :
errno = EAGAIN;
result = -1;
break;
default :
errno = EPIPE;
result = -1;
break;
}
return (result);
# endif /* HAVE_LIBSSL */
}
#endif /* HAVE_SSL */
@@ -1843,7 +1929,8 @@ http_send(http_t *http, /* I - HTTP data */
*/
if (http->status == HTTP_ERROR || http->status >= HTTP_BAD_REQUEST)
httpReconnect(http);
if (httpReconnect(http))
return (-1);
/*
* Send the request header...
@@ -2186,6 +2273,9 @@ http_wait(http_t *http, /* I - HTTP data */
DEBUG_printf(("http_wait(http=%p, msec=%d)\n", http, msec));
if (http->fd < 0)
return (0);
/*
* Check the SSL/TLS buffers for data first...
*/
@@ -2413,24 +2503,37 @@ http_write_ssl(http_t *http, /* I - HTTP data */
# elif defined(HAVE_GNUTLS)
return (gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len));
# elif defined(HAVE_CDSASSL)
int result; /* Return value */
OSStatus error; /* Error info */
size_t processed; /* Number of bytes processed */
error = SSLWrite((SSLContextRef)http->tls, buf, len, &processed);
if (error == 0)
return (processed);
else
switch (error)
{
http->error = error;
return (-1);
case 0 :
result = (int)processed;
break;
case errSSLClosedGraceful :
result = 0;
break;
case errSSLWouldBlock :
errno = EAGAIN;
result = -1;
break;
default :
errno = EPIPE;
result = -1;
break;
}
return (result);
# endif /* HAVE_LIBSSL */
}
#endif /* HAVE_SSL */
/*
* End of "$Id: http.c 4914 2006-01-11 02:04:22Z mike $".
* End of "$Id: http.c 4995 2006-01-26 20:14:42Z mike $".
*/
+7 -7
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: http.h 4906 2006-01-10 20:53:28Z mike $"
* "$Id: http.h 4973 2006-01-25 02:36:02Z mike $"
*
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
@@ -59,7 +59,7 @@
/*
* With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get
* an error at compile-time.
* a warning at compile-time.
*/
# if defined(__GNUC__) && __GNUC__ > 2
@@ -113,7 +113,7 @@ extern "C" {
# define HTTP_MAX_URI 1024 /* Max length of URI string */
# define HTTP_MAX_HOST 256 /* Max length of hostname string */
# define HTTP_MAX_BUFFER 1024 /* Max length of data buffer */
# define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */
# define HTTP_MAX_VALUE 256 /* Max header field value length */
@@ -323,8 +323,6 @@ typedef struct http_s /**** HTTP connection structure. ****/
int used; /* Number of bytes used in buffer */
char buffer[HTTP_MAX_BUFFER];
/* Buffer for incoming data */
char wbuffer[HTTP_MAX_BUFFER];
/* Buffer for outgoing data */
int auth_type; /* Authentication in use */
_cups_md5_state_t md5_state; /* MD5 state */
char nonce[HTTP_MAX_VALUE];
@@ -343,10 +341,12 @@ typedef struct http_s /**** HTTP connection structure. ****/
/* Username:password string @since CUPS 1.1.20@ */
int digest_tries; /* Number of tries for digest auth @since CUPS 1.1.20@ */
/**** New in CUPS 1.2 ****/
off_t data_remaining; /* Number of bytes left @since CUPS 1.2@ */
http_addr_t *hostaddr; /* Current host address and port @since CUPS 1.2@ */
http_addrlist_t *addrlist; /* List of valid addresses @since CUPS 1.2@ */
char wbuffer[HTTP_MAX_BUFFER];
/* Buffer for outgoing data */
int wused; /* Write buffer bytes used @since CUPS 1.2@ */
off_t data_remaining; /* Number of bytes left @since CUPS 1.2@ */
} http_t;
@@ -469,5 +469,5 @@ extern void httpSetLength(http_t *http, size_t length);
#endif /* !_CUPS_HTTP_H_ */
/*
* End of "$Id: http.h 4906 2006-01-10 20:53:28Z mike $".
* End of "$Id: http.h 4973 2006-01-25 02:36:02Z mike $".
*/
+5 -7
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: i18n.h 4903 2006-01-10 20:02:46Z mike $"
* "$Id: i18n.h 4924 2006-01-13 01:55:20Z mike $"
*
* (Private) localization support for the Common UNIX Printing System (CUPS).
*
@@ -66,14 +66,12 @@ extern char *_cupsSaveLocale(int category, const char *locale);
/**** New in CUPS 1.2 ****/
extern const char *_cupsEncodingName(cups_encoding_t encoding);
extern int _cupsLangPrintf(FILE *fp, cups_lang_t *lang,
const char *message, ...)
extern int _cupsLangPrintf(FILE *fp, const char *message, ...)
# ifdef __GNUC__
__attribute__ ((__format__ (__printf__, 3, 4)))
__attribute__ ((__format__ (__printf__, 2, 3)))
# endif /* __GNUC__ */
;
extern int _cupsLangPuts(FILE *fp, cups_lang_t *lang,
const char *message);
extern int _cupsLangPuts(FILE *fp, const char *message);
extern const char *_cupsLangString(cups_lang_t *lang, const char *message);
extern void _cupsMessageFree(cups_array_t *a);
extern cups_array_t *_cupsMessageLoad(const char *filename);
@@ -86,5 +84,5 @@ extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
#endif /* !_CUPS_I18N_H_ */
/*
* End of "$Id: i18n.h 4903 2006-01-10 20:02:46Z mike $".
* End of "$Id: i18n.h 4924 2006-01-13 01:55:20Z mike $".
*/
+65
Ver Arquivo
@@ -0,0 +1,65 @@
/*
* "$Id: ipp-private.h 4973 2006-01-25 02:36:02Z mike $"
*
* Private IPP definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products 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 missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*/
#ifndef _CUPS_IPP_PRIVATE_H_
# define _CUPS_IPP_PRIVATE_H_
/*
* Include necessary headers...
*/
# include "ipp.h"
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Prototypes for private functions...
*/
extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int);
extern void _ipp_free_attr(ipp_attribute_t *);
/*
* C++ magic...
*/
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_IPP_H_ */
/*
* End of "$Id: ipp-private.h 4973 2006-01-25 02:36:02Z mike $".
*/
+2 -4
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: ipp-support.c 4785 2005-10-13 19:39:05Z mike $"
* "$Id: ipp-support.c 4987 2006-01-26 00:25:21Z mike $"
*
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
@@ -321,12 +321,10 @@ ippPort(void)
void
ippSetPort(int p) /* I - Port number to use */
{
fprintf(stderr, "ippSetPort(p=%d)\n", p);
_cupsGlobals()->ipp_port = p;
}
/*
* End of "$Id: ipp-support.c 4785 2005-10-13 19:39:05Z mike $".
* End of "$Id: ipp-support.c 4987 2006-01-26 00:25:21Z mike $".
*/
+15 -11
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: ipp.c 4922 2006-01-12 22:05:06Z mike $"
* "$Id: ipp.c 4995 2006-01-26 20:14:42Z mike $"
*
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
@@ -1023,6 +1023,7 @@ ippReadIO(void *src, /* I - Data source */
*bufptr; /* Pointer into buffer */
ipp_attribute_t *attr; /* Current attribute */
ipp_tag_t tag; /* Current tag */
ipp_tag_t value_tag; /* Current value tag */
ipp_value_t *value; /* Current value */
@@ -1163,14 +1164,15 @@ ippReadIO(void *src, /* I - Data source */
if (ipp->current == NULL)
return (IPP_ERROR);
attr = ipp->current;
attr = ipp->current;
value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK);
/*
* Make sure we aren't adding a new value of a different
* type...
*/
if (attr->value_tag == IPP_TAG_ZERO)
if (value_tag == IPP_TAG_ZERO)
{
/*
* Setting the value of a collection member...
@@ -1178,9 +1180,9 @@ ippReadIO(void *src, /* I - Data source */
attr->value_tag = tag;
}
else if (attr->value_tag == IPP_TAG_STRING ||
(attr->value_tag >= IPP_TAG_TEXTLANG &&
attr->value_tag <= IPP_TAG_MIMETYPE))
else if (value_tag == IPP_TAG_STRING ||
(value_tag >= IPP_TAG_TEXTLANG &&
value_tag <= IPP_TAG_MIMETYPE))
{
/*
* String values can sometimes come across in different
@@ -1191,7 +1193,7 @@ ippReadIO(void *src, /* I - Data source */
(tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE))
return (IPP_ERROR);
}
else if (attr->value_tag != tag)
else if (value_tag != tag)
return (IPP_ERROR);
/*
@@ -1709,6 +1711,8 @@ ippWriteIO(void *dst, /* I - Destination */
DEBUG_printf(("ippWrite: wrote group tag = %x\n", attr->group_tag));
*bufptr++ = attr->group_tag;
}
else if (attr->group_tag == IPP_TAG_ZERO)
continue;
/*
* Write the attribute tag and name. The current implementation
@@ -2402,10 +2406,10 @@ _ipp_add_attr(ipp_t *ipp, /* I - IPP message */
attr = calloc(sizeof(ipp_attribute_t) +
(num_values - 1) * sizeof(ipp_value_t), 1);
attr->num_values = num_values;
if (attr != NULL)
{
attr->num_values = num_values;
if (ipp->last == NULL)
ipp->attrs = attr;
else
@@ -2466,7 +2470,7 @@ _ipp_free_attr(ipp_attribute_t *attr) /* I - Attribute to free */
break; /* anti-compiler-warning-code */
}
if (attr->name != NULL)
if (attr->name)
free(attr->name);
free(attr);
@@ -2759,5 +2763,5 @@ ipp_write_file(int *fd, /* I - File descriptor */
/*
* End of "$Id: ipp.c 4922 2006-01-12 22:05:06Z mike $".
* End of "$Id: ipp.c 4995 2006-01-26 20:14:42Z mike $".
*/
+122 -99
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: ipp.h 4922 2006-01-12 22:05:06Z mike $"
* "$Id: ipp.h 4995 2006-01-26 20:14:42Z mike $"
*
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
@@ -72,7 +72,7 @@ extern "C" {
* Types and structures...
*/
typedef enum /**** Format tags for attribute formats... ****/
typedef enum /**** Format tags for attribute formats... ****/
{
IPP_TAG_ZERO = 0x00,
IPP_TAG_OPERATION,
@@ -109,17 +109,17 @@ typedef enum /**** Format tags for attribute formats... ****/
IPP_TAG_LANGUAGE,
IPP_TAG_MIMETYPE,
IPP_TAG_MEMBERNAME,
IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values */
IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */
IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values */
IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */
} ipp_tag_t;
typedef enum /**** Resolution units... ****/
typedef enum /**** Resolution units... ****/
{
IPP_RES_PER_INCH = 3,
IPP_RES_PER_CM
} ipp_res_t;
typedef enum /**** Finishings... ****/
typedef enum /**** Finishings... ****/
{
IPP_FINISHINGS_NONE = 3,
IPP_FINISHINGS_STAPLE,
@@ -151,22 +151,22 @@ typedef enum /**** Finishings... ****/
IPP_FINISHINGS_BIND_BOTTOM
} ipp_finish_t;
typedef enum /**** Orientation... ****/
typedef enum /**** Orientation... ****/
{
IPP_PORTRAIT = 3, /* No rotation */
IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
IPP_REVERSE_PORTRAIT /* 180 degrees */
IPP_PORTRAIT = 3, /* No rotation */
IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
IPP_REVERSE_PORTRAIT /* 180 degrees */
} ipp_orient_t;
typedef enum /**** Qualities... ****/
typedef enum /**** Qualities... ****/
{
IPP_QUALITY_DRAFT = 3,
IPP_QUALITY_NORMAL,
IPP_QUALITY_HIGH
} ipp_quality_t;
typedef enum /**** Job States.... */
typedef enum /**** Job States.... */
{
IPP_JOB_PENDING = 3,
IPP_JOB_HELD,
@@ -177,23 +177,23 @@ typedef enum /**** Job States.... */
IPP_JOB_COMPLETED
} ipp_jstate_t;
typedef enum /**** Printer States.... */
typedef enum /**** Printer States.... */
{
IPP_PRINTER_IDLE = 3,
IPP_PRINTER_PROCESSING,
IPP_PRINTER_STOPPED
} ipp_pstate_t;
typedef enum /**** IPP states... ****/
typedef enum /**** IPP states... ****/
{
IPP_ERROR = -1, /* An error occurred */
IPP_IDLE, /* Nothing is happening/request completed */
IPP_HEADER, /* The request header needs to be sent/received */
IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */
IPP_DATA /* IPP request data needs to be sent/received */
IPP_ERROR = -1, /* An error occurred */
IPP_IDLE, /* Nothing is happening/request completed */
IPP_HEADER, /* The request header needs to be sent/received */
IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */
IPP_DATA /* IPP request data needs to be sent/received */
} ipp_state_t;
typedef enum /**** IPP operations... ****/
typedef enum /**** IPP operations... ****/
{
IPP_PRINT_JOB = 0x0002,
IPP_PRINT_URI,
@@ -242,10 +242,10 @@ typedef enum /**** IPP operations... ****/
IPP_PRIVATE = 0x4000,
CUPS_GET_DEFAULT,
CUPS_GET_PRINTERS,
CUPS_ADD_PRINTER,
CUPS_ADD_MODIFY_PRINTER,
CUPS_DELETE_PRINTER,
CUPS_GET_CLASSES,
CUPS_ADD_CLASS,
CUPS_ADD_MODIFY_CLASS,
CUPS_DELETE_CLASS,
CUPS_ACCEPT_JOBS,
CUPS_REJECT_JOBS,
@@ -256,7 +256,11 @@ typedef enum /**** IPP operations... ****/
CUPS_AUTHENTICATE_JOB
} ipp_op_t;
typedef enum /**** IPP status codes... ****/
/* Old names for the operations */
#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
typedef enum /**** IPP status codes... ****/
{
IPP_OK = 0x0000,
IPP_OK_SUBST,
@@ -304,105 +308,105 @@ typedef enum /**** IPP status codes... ****/
IPP_PRINTER_IS_DEACTIVATED
} ipp_status_t;
typedef unsigned char ipp_uchar_t;/**** Unsigned 8-bit integer/character ****/
typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/
/**** New in CUPS 1.1.19 ****/
typedef int (*ipp_iocb_t)(void *, ipp_uchar_t *, int);
/**** IPP IO Callback Function ****/
/**** IPP IO Callback Function ****/
typedef union /**** Request Header ****/
typedef union /**** Request Header ****/
{
struct /* Any Header */
struct /* Any Header */
{
ipp_uchar_t version[2]; /* Protocol version number */
int op_status; /* Operation ID or status code*/
int request_id; /* Request ID */
ipp_uchar_t version[2]; /* Protocol version number */
int op_status; /* Operation ID or status code*/
int request_id; /* Request ID */
} any;
struct /* Operation Header */
struct /* Operation Header */
{
ipp_uchar_t version[2]; /* Protocol version number */
ipp_op_t operation_id; /* Operation ID */
int request_id; /* Request ID */
ipp_uchar_t version[2]; /* Protocol version number */
ipp_op_t operation_id; /* Operation ID */
int request_id; /* Request ID */
} op;
struct /* Status Header */
struct /* Status Header */
{
ipp_uchar_t version[2]; /* Protocol version number */
ipp_status_t status_code; /* Status code */
int request_id; /* Request ID */
ipp_uchar_t version[2]; /* Protocol version number */
ipp_status_t status_code; /* Status code */
int request_id; /* Request ID */
} status;
/**** New in CUPS 1.1.19 ****/
struct /* Event Header */
struct /* Event Header */
{
ipp_uchar_t version[2]; /* Protocol version number */
ipp_status_t status_code; /* Status code */
int request_id; /* Request ID */
ipp_uchar_t version[2]; /* Protocol version number */
ipp_status_t status_code; /* Status code */
int request_id; /* Request ID */
} event;
} ipp_request_t;
/**** New in CUPS 1.1.19 ****/
typedef struct ipp_str ipp_t;
typedef union /**** Attribute Value ****/
typedef union /**** Attribute Value ****/
{
int integer; /* Integer/enumerated value */
int integer; /* Integer/enumerated value */
char boolean; /* Boolean value */
char boolean; /* Boolean value */
ipp_uchar_t date[11]; /* Date/time value */
ipp_uchar_t date[11]; /* Date/time value */
struct
{
int xres, /* Horizontal resolution */
yres; /* Vertical resolution */
ipp_res_t units; /* Resolution units */
} resolution; /* Resolution value */
int xres, /* Horizontal resolution */
yres; /* Vertical resolution */
ipp_res_t units; /* Resolution units */
} resolution; /* Resolution value */
struct
{
int lower, /* Lower value */
upper; /* Upper value */
} range; /* Range of integers value */
int lower, /* Lower value */
upper; /* Upper value */
} range; /* Range of integers value */
struct
{
char *charset; /* Character set */
char *text; /* String */
} string; /* String with language value */
char *charset; /* Character set */
char *text; /* String */
} string; /* String with language value */
struct
{
int length; /* Length of attribute */
void *data; /* Data in attribute */
} unknown; /* Unknown attribute type */
int length; /* Length of attribute */
void *data; /* Data in attribute */
} unknown; /* Unknown attribute type */
/**** New in CUPS 1.1.19 ****/
ipp_t *collection; /* Collection value */
ipp_t *collection; /* Collection value */
} ipp_value_t;
typedef struct ipp_attribute_s /**** Attribute ****/
typedef struct ipp_attribute_s /**** Attribute ****/
{
struct ipp_attribute_s *next; /* Next attribute in list */
ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
value_tag; /* What type of value is it? */
char *name; /* Name of attribute */
int num_values; /* Number of values */
ipp_value_t values[1]; /* Values */
struct ipp_attribute_s *next; /* Next attribute in list */
ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
value_tag; /* What type of value is it? */
char *name; /* Name of attribute */
int num_values; /* Number of values */
ipp_value_t values[1]; /* Values */
} ipp_attribute_t;
struct ipp_str /**** IPP Request/Response/Notification ****/
struct ipp_str /**** IPP Request/Response/Notification ****/
{
ipp_state_t state; /* State of request */
ipp_request_t request; /* Request header */
ipp_attribute_t *attrs, /* Attributes */
*last, /* Last attribute in list */
*current; /* Current attribute (for read/write) */
ipp_tag_t curtag; /* Current attribute group tag */
ipp_state_t state; /* State of request */
ipp_request_t request; /* Request header */
ipp_attribute_t *attrs, /* Attributes */
*last, /* Last attribute in list */
*current; /* Current attribute (for read/write) */
ipp_tag_t curtag; /* Current attribute group tag */
/**** New in CUPS 1.2 ****/
ipp_attribute_t *prev; /* Previous attribute (for read) */
ipp_attribute_t *prev; /* Previous attribute (for read) */
};
@@ -410,18 +414,39 @@ struct ipp_str /**** IPP Request/Response/Notification ****/
* Prototypes...
*/
extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group, const char *name, char value);
extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const char *values);
extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group, const char *name, const ipp_uchar_t *value);
extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int value);
extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const int *values);
extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group, const char *name, int lower, int upper);
extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const int *lower, const int *upper);
extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_res_t units, int xres, int yres);
extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, ipp_res_t units, const int *xres, const int *yres);
extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group,
const char *name, char value);
extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group,
const char *name, int num_values,
const char *values);
extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group,
const char *name, const ipp_uchar_t *value);
extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group,
ipp_tag_t type, const char *name,
int value);
extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group,
ipp_tag_t type, const char *name,
int num_values, const int *values);
extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group,
const char *name, int lower, int upper);
extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group,
const char *name, int num_values,
const int *lower, const int *upper);
extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group,
const char *name, ipp_res_t units,
int xres, int yres);
extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group,
const char *name, int num_values,
ipp_res_t units, const int *xres,
const int *yres);
extern ipp_attribute_t *ippAddSeparator(ipp_t *ipp);
extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, const char *charset, const char *value);
extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const char *charset, const char * const *values);
extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group,
ipp_tag_t type, const char *name,
const char *charset, const char *value);
extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group,
ipp_tag_t type, const char *name,
int num_values, const char *charset,
const char * const *values);
extern time_t ippDateToTime(const ipp_uchar_t *date);
extern void ippDelete(ipp_t *ipp);
extern const char *ippErrorString(ipp_status_t error);
@@ -438,13 +463,18 @@ extern int ippPort(void);
extern void ippSetPort(int p);
/**** New in CUPS 1.1.19 ****/
extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_t *value);
extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const ipp_t **values);
extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group,
const char *name, ipp_t *value);
extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group,
const char *name, int num_values,
const ipp_t **values);
extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr);
extern ipp_state_t ippReadFile(int fd, ipp_t *ipp);
extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking,
ipp_t *parent, ipp_t *ipp);
extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp);
extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking,
ipp_t *parent, ipp_t *ipp);
/**** New in CUPS 1.2 ****/
extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group,
@@ -455,13 +485,6 @@ extern ipp_t *ippNewRequest(ipp_op_t op);
extern const char *ippOpString(ipp_op_t op);
extern ipp_op_t ippOpValue(const char *name);
/*
* "Private" functions used internally by CUPS...
*/
extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int);
extern void _ipp_free_attr(ipp_attribute_t *);
/*
* C++ magic...
@@ -473,5 +496,5 @@ extern void _ipp_free_attr(ipp_attribute_t *);
#endif /* !_CUPS_IPP_H_ */
/*
* End of "$Id: ipp.h 4922 2006-01-12 22:05:06Z mike $".
* End of "$Id: ipp.h 4995 2006-01-26 20:14:42Z mike $".
*/
+19 -16
Ver Arquivo
@@ -1,10 +1,10 @@
/*
* "$Id: langprintf.c 4898 2006-01-08 23:13:20Z mike $"
* "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $"
*
* Localized printf/puts functions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 2002 by Easy Software Products.
* Copyright 2002-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -35,9 +35,7 @@
*/
#include <stdio.h>
#include "string.h"
#include "i18n.h"
#include "transcode.h"
#include "globals.h"
/*
@@ -46,7 +44,6 @@
int /* O - Number of bytes written */
_cupsLangPrintf(FILE *fp, /* I - File to write to */
cups_lang_t *language, /* I - Language to use */
const char *message, /* I - Message string to use */
...) /* I - Additional arguments as needed */
{
@@ -54,6 +51,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
char buffer[2048], /* Message buffer */
output[8192]; /* Output buffer */
va_list ap; /* Pointer to additional arguments */
_cups_globals_t *cg; /* Global data */
/*
@@ -63,8 +61,10 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
if (!fp || !message)
return (-1);
if (!language)
language = cupsLangDefault();
cg = _cupsGlobals();
if (!cg->lang_default)
cg->lang_default = cupsLangDefault();
/*
* Format the string...
@@ -72,7 +72,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
va_start(ap, message);
bytes = vsnprintf(buffer, sizeof(buffer),
_cupsLangString(language, message), ap);
_cupsLangString(cg->lang_default, message), ap);
va_end(ap);
/*
@@ -80,7 +80,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
*/
bytes = cupsUTF8ToCharset(output, (cups_utf8_t *)buffer, sizeof(output),
language->encoding);
cg->lang_default->encoding);
/*
* Write the string and return the number of bytes written...
@@ -99,11 +99,11 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
int /* O - Number of bytes written */
_cupsLangPuts(FILE *fp, /* I - File to write to */
cups_lang_t *language, /* I - Language to use */
const char *message) /* I - Message string to use */
{
int bytes; /* Number of bytes formatted */
char output[2048]; /* Message buffer */
_cups_globals_t *cg; /* Global data */
/*
@@ -113,16 +113,19 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */
if (!fp || !message)
return (-1);
if (!language)
language = cupsLangDefault();
cg = _cupsGlobals();
if (!cg->lang_default)
cg->lang_default = cupsLangDefault();
/*
* Transcode to the destination charset...
*/
bytes = cupsUTF8ToCharset(output,
(cups_utf8_t *)_cupsLangString(language, message),
sizeof(output), language->encoding);
(cups_utf8_t *)_cupsLangString(cg->lang_default,
message),
sizeof(output), cg->lang_default->encoding);
/*
* Write the string and return the number of bytes written...
@@ -136,5 +139,5 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */
/*
* End of "$Id: langprintf.c 4898 2006-01-08 23:13:20Z mike $".
* End of "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $".
*/
+17 -4
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: language.c 4922 2006-01-12 22:05:06Z mike $"
* "$Id: language.c 4985 2006-01-25 21:57:18Z mike $"
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
@@ -31,6 +31,7 @@
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
* for the given language.
* cupsLangFlush() - Flush all language data out of the cache.
* _cupsLangFlush() - Flush all language data out of the cache.
* cupsLangFree() - Free language data.
* cupsLangGet() - Get a language.
* _cupsLangString() - Get a message string.
@@ -60,6 +61,9 @@
#else
# include <unistd.h>
#endif /* WIN32 */
#ifdef HAVE_COREFOUNDATION_H
# include <CoreFoundation/CoreFoundation.h>
#endif /* HAVE_COREFOUNDATION_H */
/*
@@ -67,7 +71,6 @@
*/
#ifdef __APPLE__
# include <CoreFoundation/CoreFoundation.h>
static const char *appleLangDefault(void);
#endif /* __APPLE__ */
static cups_lang_t *cups_cache_lookup(const char *name,
@@ -201,10 +204,20 @@ cupsLangEncoding(cups_lang_t *lang) /* I - Language data */
void
cupsLangFlush(void)
{
_cupsLangFlush(_cupsGlobals());
}
/*
* '_cupsLangFlush()' - Flush all language data out of the cache.
*/
void
_cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
{
cups_lang_t *lang, /* Current language */
*next; /* Next language */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
/*
@@ -1236,5 +1249,5 @@ cups_unquote(char *d, /* O - Unquoted string */
/*
* End of "$Id: language.c 4922 2006-01-12 22:05:06Z mike $".
* End of "$Id: language.c 4985 2006-01-25 21:57:18Z mike $".
*/
+187
Ver Arquivo
@@ -0,0 +1,187 @@
/*
* "$Id: localize.c 4937 2006-01-17 04:03:22Z mike $"
*
* PPD custom option routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products 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 missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* PostScript is a trademark of Adobe Systems, Inc.
*
* This code and any derivative of it may be used and distributed
* freely under the terms of the GNU General Public License when
* used with GNU Ghostscript or its derivatives. Use of the code
* (or any derivative of it) with software other than GNU
* GhostScript (or its derivatives) is governed by the CUPS license
* agreement.
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* ppdLocalize() - Localize the PPD file to the current locale.
*/
/*
* Include necessary headers.
*/
#include "globals.h"
#include "debug.h"
/*
* Local functions...
*/
static const char *ppd_text(ppd_file_t *ppd, const char *keyword,
const char *spec, const char *ll_CC,
const char *ll);
/*
* 'ppdLocalize()' - Localize the PPD file to the current locale.
*/
int /* O - 0 on success, -1 on error */
ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
{
int i, j, k; /* Looping vars */
ppd_group_t *group; /* Current group */
ppd_option_t *option; /* Current option */
ppd_choice_t *choice; /* Current choice */
ppd_coption_t *coption; /* Current custom option */
ppd_cparam_t *cparam; /* Current custom parameter */
cups_lang_t *lang; /* Current language */
char ckeyword[PPD_MAX_NAME], /* Custom keyword */
ll_CC[6], /* Language + country locale */
ll[3]; /* Language locale */
const char *text; /* Localized text */
/*
* Range check input...
*/
if (!ppd)
return (-1);
/*
* Get the default language...
*/
if ((lang = cupsLangDefault()) == NULL)
return (-1);
strlcpy(ll_CC, lang->language, sizeof(ll_CC));
strlcpy(ll, lang->language, sizeof(ll));
/*
* Now lookup all of the groups, options, choices, etc.
*/
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
{
if ((text = ppd_text(ppd, "Translation", group->name, ll_CC, ll)) != NULL)
strlcpy(group->text, text, sizeof(group->text));
for (j = group->num_options, option = group->options; j > 0; j --, option ++)
{
if ((text = ppd_text(ppd, "Translation", option->keyword, ll_CC,
ll)) != NULL)
strlcpy(option->text, text, sizeof(option->text));
for (k = option->num_choices, choice = option->choices;
k > 0;
k --, choice ++)
{
if (strcmp(choice->choice, "Custom"))
text = ppd_text(ppd, option->keyword, choice->choice, ll_CC, ll);
else
{
snprintf(ckeyword, sizeof(ckeyword), "Custom%s", option->keyword);
text = ppd_text(ppd, ckeyword, "True", ll_CC, ll);
}
if (text)
strlcpy(choice->text, text, sizeof(choice->text));
}
}
}
/*
* Translate any custom parameters...
*/
for (coption = (ppd_coption_t *)cupsArrayFirst(ppd->coptions);
coption;
coption = (ppd_coption_t *)cupsArrayNext(ppd->coptions))
{
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
{
snprintf(ckeyword, sizeof(ckeyword), "ParamCustom%s", coption->keyword);
if ((text = ppd_text(ppd, ckeyword, cparam->name, ll_CC, ll)) != NULL)
strlcpy(cparam->text, text, sizeof(cparam->text));
}
}
return (0);
}
/*
* 'ppd_text()' - Find the localized text as needed...
*/
static const char * /* O - Localized text or NULL */
ppd_text(ppd_file_t *ppd, /* I - PPD file */
const char *keyword, /* I - Main keyword */
const char *spec, /* I - Option keyword */
const char *ll_CC, /* I - Language + country locale */
const char *ll) /* I - Language locale */
{
char lkeyword[PPD_MAX_NAME]; /* Localization keyword */
ppd_attr_t *attr; /* Current attribute */
/*
* Look for Keyword.ll_CC, then Keyword.ll...
*/
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll_CC);
if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL)
{
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll);
attr = ppdFindAttr(ppd, lkeyword, spec);
}
/*
* Return text if we find it...
*/
return (attr ? attr->text : NULL);
}
/*
* End of "$Id: localize.c 4937 2006-01-17 04:03:22Z mike $".
*/
+179 -73
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: mark.c 4494 2005-02-18 02:18:11Z mike $"
* "$Id: mark.c 4980 2006-01-25 19:57:45Z mike $"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
@@ -239,28 +239,23 @@ ppd_option_t * /* O - Pointer to option or NULL */
ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */
const char *option) /* I - Option/Keyword name */
{
int i, j, k; /* Looping vars */
ppd_option_t *o; /* Pointer to option */
ppd_group_t *g, /* Pointer to group */
*sg; /* Pointer to subgroup */
ppd_option_t key; /* Option search key */
if (ppd == NULL || option == NULL)
/*
* Range check input...
*/
if (!ppd || !option)
return (NULL);
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
{
for (j = g->num_options, o = g->options; j > 0; j --, o ++)
if (strcasecmp(o->keyword, option) == 0)
return (o);
/*
* Search...
*/
for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
for (k = sg->num_options, o = sg->options; k > 0; k --, o ++)
if (strcasecmp(o->keyword, option) == 0)
return (o);
}
strlcpy(key.keyword, option, sizeof(key.keyword));
return (NULL);
return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
}
@@ -323,91 +318,202 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
const char *option, /* I - Keyword */
const char *choice) /* I - Option name */
{
int i; /* Looping var */
ppd_option_t *o; /* Option pointer */
ppd_choice_t *c; /* Choice pointer */
int i, j; /* Looping vars */
ppd_option_t *o; /* Option pointer */
ppd_choice_t *c; /* Choice pointer */
if (ppd == NULL)
/*
* Range check input...
*/
if (!ppd || !option || !choice)
return (0);
if (strcasecmp(option, "PageSize") == 0 && strncasecmp(choice, "Custom.", 7) == 0)
{
/*
* Handle variable page sizes...
*/
/*
* AP_D_InputSlot is the "default input slot" on MacOS X, and setting
* it clears the regular InputSlot choices...
*/
ppdPageSize(ppd, choice);
choice = "Custom";
if (!strcasecmp(option, "AP_D_InputSlot"))
{
if ((o = ppdFindOption(ppd, "InputSlot")) != NULL)
for (i = 0; i < o->num_choices; i ++)
o->choices[i].marked = 0;
}
/*
* Check for custom options...
*/
if ((o = ppdFindOption(ppd, option)) == NULL)
return (0);
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcasecmp(c->choice, choice) == 0)
break;
if (i)
if (!strncasecmp(choice, "Custom.", 7) /* TODO || strchr(choice, '=') */ )
{
/*
* Option found; mark it and then handle unmarking any other options.
* Handle a custom option...
*/
c->marked = 1;
if ((c = ppdFindChoice(o, "Custom")) == NULL)
return (0);
if (o->ui != PPD_UI_PICKMANY)
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcasecmp(c->choice, choice) != 0)
c->marked = 0;
if (strcasecmp(option, "PageSize") == 0 || strcasecmp(option, "PageRegion") == 0)
if (!strcasecmp(option, "PageSize"))
{
/*
* Mark current page size...
* Handle custom page sizes...
*/
for (i = 0; i < ppd->num_sizes; i ++)
ppd->sizes[i].marked = strcasecmp(ppd->sizes[i].name, choice) == 0;
/*
* Unmark the current PageSize or PageRegion setting, as appropriate...
*/
if (strcasecmp(option, "PageSize") == 0)
{
if ((o = ppdFindOption(ppd, "PageRegion")) != NULL)
for (i = 0; i < o->num_choices; i ++)
o->choices[i].marked = 0;
}
else
{
if ((o = ppdFindOption(ppd, "PageSize")) != NULL)
for (i = 0; i < o->num_choices; i ++)
o->choices[i].marked = 0;
}
ppdPageSize(ppd, choice);
}
else if (strcasecmp(option, "InputSlot") == 0)
else
{
/*
* Unmark ManualFeed option...
* Handle other custom options...
*/
if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL)
for (i = 0; i < o->num_choices; i ++)
o->choices[i].marked = 0;
}
else if (strcasecmp(option, "ManualFeed") == 0)
{
ppd_coption_t *coption; /* Custom option */
ppd_cparam_t *cparam; /* Custom parameter */
char units[33]; /* Custom points units */
/*
* Unmark InputSlot option...
* TODO: Detect and support custom option values using the
* collection format "{Name1=foo Name2=bar}". For now, just
* support Custom.value for single-valued custom options.
*/
if ((o = ppdFindOption(ppd, "InputSlot")) != NULL)
for (i = 0; i < o->num_choices; i ++)
o->choices[i].marked = 0;
if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
{
if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL)
return (0);
switch (cparam->type)
{
case PPD_CUSTOM_CURVE :
case PPD_CUSTOM_INVCURVE :
case PPD_CUSTOM_REAL :
cparam->current.custom_real = atof(choice + 7);
break;
case PPD_CUSTOM_POINTS :
if (sscanf(choice + 7, "%f%s", &(cparam->current.custom_points),
units) < 2)
strcpy(units, "pt");
if (!strcasecmp(units, "cm"))
cparam->current.custom_points *= 72.0 / 2.54;
else if (!strcasecmp(units, "mm"))
cparam->current.custom_points *= 72.0 / 25.4;
else if (!strcasecmp(units, "m"))
cparam->current.custom_points *= 72.0 / 0.0254;
else if (!strcasecmp(units, "in"))
cparam->current.custom_points *= 72.0;
else if (!strcasecmp(units, "ft"))
cparam->current.custom_points *= 12 * 72.0;
break;
case PPD_CUSTOM_INT :
cparam->current.custom_int = atoi(choice + 7);
break;
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
if (cparam->current.custom_string)
free(cparam->current.custom_string);
cparam->current.custom_string = strdup(choice + 7);
break;
}
}
}
}
else
{
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (!strcasecmp(c->choice, choice))
break;
if (!i)
return (0);
}
/*
* Option found; mark it and then handle unmarking any other options.
*/
c->marked = 1;
if (o->ui != PPD_UI_PICKMANY)
{
/*
* Unmark all other choices...
*/
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcasecmp(c->choice, choice))
{
c->marked = 0;
if (!strcasecmp(option, "PageSize") ||
!strcasecmp(option, "PageRegion"))
{
/*
* Mark current page size...
*/
for (j = 0; j < ppd->num_sizes; j ++)
ppd->sizes[i].marked = !strcasecmp(ppd->sizes[i].name,
choice);
/*
* Unmark the current PageSize or PageRegion setting, as
* appropriate...
*/
if (!strcasecmp(option, "PageSize"))
{
if ((o = ppdFindOption(ppd, "PageRegion")) != NULL)
for (j = 0; j < o->num_choices; j ++)
o->choices[i].marked = 0;
}
else
{
if ((o = ppdFindOption(ppd, "PageSize")) != NULL)
for (j = 0; j < o->num_choices; j ++)
o->choices[j].marked = 0;
}
}
else if (!strcasecmp(option, "InputSlot"))
{
/*
* Unmark ManualFeed True and possibly mark ManualFeed False
* option...
*/
if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL)
for (j = 0; j < o->num_choices; j ++)
o->choices[j].marked = !strcasecmp(o->choices[j].choice, "False");
}
else if (!strcasecmp(option, "ManualFeed") &&
!strcasecmp(choice, "True"))
{
/*
* Unmark InputSlot option...
*/
if ((o = ppdFindOption(ppd, "InputSlot")) != NULL)
for (j = 0; j < o->num_choices; j ++)
o->choices[j].marked = 0;
}
}
}
/*
* Return the number of conflicts...
*/
return (ppdConflicts(ppd));
}
@@ -439,5 +545,5 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */
/*
* End of "$Id: mark.c 4494 2005-02-18 02:18:11Z mike $".
* End of "$Id: mark.c 4980 2006-01-25 19:57:45Z mike $".
*/
+15 -4
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: normalize.c 4903 2006-01-10 20:02:46Z mike $"
* "$Id: normalize.c 4967 2006-01-24 03:42:15Z mike $"
*
* Unicode normalization for the Common UNIX Printing System (CUPS).
*
@@ -26,6 +26,7 @@
* cupsNormalizeMapsGet() - Get all norm maps to cache.
* cupsNormalizeMapsFree() - Free all norm maps in cache.
* cupsNormalizeMapsFlush() - Flush all norm maps in cache.
* _cupsNormalizeMapsFlush() - Flush all normalization maps in cache.
* cupsUTF8Normalize() - Normalize UTF-8 string.
* cupsUTF32Normalize() - Normalize UTF-32 string.
* cupsUTF8CaseFold() - Case fold UTF-8 string.
@@ -314,13 +315,23 @@ cupsNormalizeMapsFree(void)
void
cupsNormalizeMapsFlush(void)
{
_cupsNormalizeMapsFlush(_cupsGlobals());
}
/*
* '_cupsNormalizeMapsFlush()' - Flush all normalization maps in cache.
*/
void
_cupsNormalizeMapsFlush(
_cups_globals_t *cg) /* I - Global data */
{
_cups_norm_map_t *nmap; /* Unicode Normalization Map */
_cups_norm_map_t *nextnorm; /* Next Unicode Normalization Map */
_cups_fold_map_t *fmap; /* Unicode Case Folding Map */
_cups_fold_map_t *nextfold; /* Next Unicode Case Folding Map */
_cups_globals_t *cg = _cupsGlobals();
/* Pointer to library globals */
/*
@@ -2173,5 +2184,5 @@ compare_propchar(const void *k1, /* I - Key char */
/*
* End of "$Id: normalize.c 4903 2006-01-10 20:02:46Z mike $"
* End of "$Id: normalize.c 4967 2006-01-24 03:42:15Z mike $"
*/
+211
Ver Arquivo
@@ -0,0 +1,211 @@
/*
* "$Id: notify.c 4961 2006-01-20 22:19:13Z mike $"
*
* Notification routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2005-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products 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 missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* cupsNotifySubject() - Return the subject for the given notification
* message.
* cupsNotifyText() - Return the text for the given notification message.
*/
/*
* Include necessary headers...
*/
#include "globals.h"
/*
* 'cupsNotifySubject()' - Return the subject for the given notification message.
*
* The returned string must be freed by the caller using free().
*
* @since CUPS 1.2@
*/
char * /* O - Subject string or NULL */
cupsNotifySubject(cups_lang_t *lang, /* I - Language data */
ipp_t *event) /* I - Event data */
{
char buffer[1024]; /* Subject buffer */
const char *prefix, /* Prefix on subject */
*state; /* Printer/job state string */
ipp_attribute_t *job_id, /* notify-job-id */
*job_name, /* job-name */
*job_state, /* job-state */
*printer_name, /* printer-name */
*printer_state, /* printer-state */
*printer_uri, /* notify-printer-uri */
*subscribed; /* notify-subscribed-event */
/*
* Range check input...
*/
if (!event || !lang)
return (NULL);
/*
* Get the required attributes...
*/
job_id = ippFindAttribute(event, "notify-job-id", IPP_TAG_INTEGER);
job_name = ippFindAttribute(event, "job-name", IPP_TAG_NAME);
job_state = ippFindAttribute(event, "job-state", IPP_TAG_ENUM);
printer_name = ippFindAttribute(event, "printer-name", IPP_TAG_NAME);
printer_state = ippFindAttribute(event, "printer-state", IPP_TAG_ENUM);
printer_uri = ippFindAttribute(event, "notify-printer-uri", IPP_TAG_URI);
subscribed = ippFindAttribute(event, "notify-subscribed-event",
IPP_TAG_KEYWORD);
if (job_id && printer_name && printer_uri && job_state)
{
/*
* Job event...
*/
prefix = _cupsLangString(lang, _("Print Job:"));
switch (job_state->values[0].integer)
{
case IPP_JOB_PENDING :
state = _cupsLangString(lang, _("pending"));
break;
case IPP_JOB_HELD :
state = _cupsLangString(lang, _("held"));
break;
case IPP_JOB_PROCESSING :
state = _cupsLangString(lang, _("processing"));
break;
case IPP_JOB_STOPPED :
state = _cupsLangString(lang, _("stopped"));
break;
case IPP_JOB_CANCELLED :
state = _cupsLangString(lang, _("canceled"));
break;
case IPP_JOB_ABORTED :
state = _cupsLangString(lang, _("aborted"));
break;
case IPP_JOB_COMPLETED :
state = _cupsLangString(lang, _("completed"));
break;
default :
state = _cupsLangString(lang, _("unknown"));
break;
}
snprintf(buffer, sizeof(buffer), "%s %s-%d (%s) %s",
prefix,
printer_name->values[0].string.text,
job_id->values[0].integer,
job_name ? job_name->values[0].string.text :
_cupsLangString(lang, _("untitled")),
state);
}
else if (printer_uri && printer_name && printer_state)
{
/*
* Printer event...
*/
prefix = _cupsLangString(lang, _("Printer:"));
switch (printer_state->values[0].integer)
{
case IPP_PRINTER_IDLE :
state = _cupsLangString(lang, _("idle"));
break;
case IPP_PRINTER_PROCESSING :
state = _cupsLangString(lang, _("processing"));
break;
case IPP_PRINTER_STOPPED :
state = _cupsLangString(lang, _("stopped"));
break;
default :
state = _cupsLangString(lang, _("unknown"));
break;
}
snprintf(buffer, sizeof(buffer), "%s %s %s",
prefix,
printer_name->values[0].string.text,
state);
}
else if (subscribed)
strlcpy(buffer, subscribed->values[0].string.text, sizeof(buffer));
else
return (NULL);
/*
* Duplicate and return the subject string...
*/
return (strdup(buffer));
}
/*
* 'cupsNotifyText()' - Return the text for the given notification message.
*
* The returned string must be freed by the caller using free().
*
* @since CUPS 1.2@
*/
char * /* O - Message text or NULL */
cupsNotifyText(cups_lang_t *lang, /* I - Language data */
ipp_t *event) /* I - Event data */
{
ipp_attribute_t *notify_text; /* notify-text */
/*
* Range check input...
*/
if (!event || !lang)
return (NULL);
/*
* Get the notify-text attribute from the server...
*/
if ((notify_text = ippFindAttribute(event, "notify-text",
IPP_TAG_TEXT)) == NULL)
return (NULL);
/*
* Return a copy...
*/
return (strdup(notify_text->values[0].string.text));
}
/*
* End of "$Id: notify.c 4961 2006-01-20 22:19:13Z mike $".
*/
+13 -5
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: options.c 4918 2006-01-12 05:14:40Z mike $"
* "$Id: options.c 4980 2006-01-25 19:57:45Z mike $"
*
* Option routines for the Common UNIX Printing System (CUPS).
*
@@ -367,6 +367,7 @@ cupsMarkOptions(
char *val, /* Pointer into value */
*ptr, /* Pointer into string */
s[255]; /* Temporary string */
const char *page_size; /* PageSize option */
cups_option_t *optptr; /* Current option */
ppd_option_t *option; /* PPD option */
static const char * const duplex_options[] =
@@ -407,16 +408,23 @@ cupsMarkOptions(
* Mark options...
*/
conflict = 0;
conflict = 0;
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
if (!strcasecmp(optptr->name, "media"))
{
/*
* Loop through the option string, separating it at commas and
* marking each individual option.
* marking each individual option as long as the corresponding
* PPD option (PageSize, InputSlot, etc.) is not also set.
*
* For PageSize, we also check for an empty option value since
* some versions of MacOS X use it to specify auto-selection
* of the media based solely on the size.
*/
page_size = cupsGetOption("PageSize", num_options, options);
for (val = optptr->value; *val;)
{
/*
@@ -434,7 +442,7 @@ cupsMarkOptions(
* Mark it...
*/
if (cupsGetOption("PageSize", num_options, options) == NULL)
if (!page_size || !page_size[0])
if (ppdMarkOption(ppd, "PageSize", s))
conflict = 1;
@@ -569,5 +577,5 @@ cupsMarkOptions(
/*
* End of "$Id: options.c 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: options.c 4980 2006-01-25 19:57:45Z mike $".
*/
+342 -528
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+200 -229
Ver Arquivo
@@ -1,10 +1,10 @@
/*
* "$Id: ppd.h 4785 2005-10-13 19:39:05Z mike $"
* "$Id: ppd.h 4980 2006-01-25 19:57:45Z mike $"
*
* PostScript Printer Description definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -42,6 +42,7 @@
*/
# include <stdio.h>
# include "array.h"
# include "file.h"
@@ -58,307 +59,265 @@ extern "C" {
* PPD version...
*/
# define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
# define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
/*
* PPD size limits (defined in Adobe spec)
*/
# define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
# define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
# define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
# define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
# define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
# define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
/*
* Types and structures...
*/
typedef enum ppd_ui_e /**** UI Types ****/
typedef enum ppd_ui_e /**** UI Types ****/
{
PPD_UI_BOOLEAN, /* True or False option */
PPD_UI_PICKONE, /* Pick one from a list */
PPD_UI_PICKMANY /* Pick zero or more from a list */
PPD_UI_BOOLEAN, /* True or False option */
PPD_UI_PICKONE, /* Pick one from a list */
PPD_UI_PICKMANY /* Pick zero or more from a list */
} ppd_ui_t;
typedef enum ppd_section_e /**** Order dependency sections ****/
typedef enum ppd_section_e /**** Order dependency sections ****/
{
PPD_ORDER_ANY, /* Option code can be anywhere in the file */
PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */
PPD_ORDER_EXIT, /* ... must be sent prior to the document */
PPD_ORDER_JCL, /* ... must be sent as a JCL command */
PPD_ORDER_PAGE, /* ... must be in the PageSetup section */
PPD_ORDER_PROLOG /* ... must be in the Prolog section */
PPD_ORDER_ANY, /* Option code can be anywhere in the file */
PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */
PPD_ORDER_EXIT, /* ... must be sent prior to the document */
PPD_ORDER_JCL, /* ... must be sent as a JCL command */
PPD_ORDER_PAGE, /* ... must be in the PageSetup section */
PPD_ORDER_PROLOG /* ... must be in the Prolog section */
} ppd_section_t;
typedef enum ppd_cs_e /**** Colorspaces ****/
typedef enum ppd_cs_e /**** Colorspaces ****/
{
PPD_CS_CMYK = -4, /* CMYK colorspace */
PPD_CS_CMY, /* CMY colorspace */
PPD_CS_GRAY = 1, /* Grayscale colorspace */
PPD_CS_RGB = 3, /* RGB colorspace */
PPD_CS_RGBK, /* RGBK (K = gray) colorspace */
PPD_CS_N /* DeviceN colorspace */
PPD_CS_CMYK = -4, /* CMYK colorspace */
PPD_CS_CMY, /* CMY colorspace */
PPD_CS_GRAY = 1, /* Grayscale colorspace */
PPD_CS_RGB = 3, /* RGB colorspace */
PPD_CS_RGBK, /* RGBK (K = gray) colorspace */
PPD_CS_N /* DeviceN colorspace */
} ppd_cs_t;
typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19@ ****/
typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19@ ****/
{
PPD_OK = 0, /* OK */
PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */
PPD_NULL_FILE, /* NULL PPD file pointer */
PPD_ALLOC_ERROR, /* Memory allocation error */
PPD_MISSING_PPDADOBE4, /* Missing PPD-Adobe-4.x header */
PPD_MISSING_VALUE, /* Missing value string */
PPD_INTERNAL_ERROR, /* Internal error */
PPD_BAD_OPEN_GROUP, /* Bad OpenGroup */
PPD_NESTED_OPEN_GROUP, /* OpenGroup without a CloseGroup first */
PPD_BAD_OPEN_UI, /* Bad OpenUI/JCLOpenUI */
PPD_NESTED_OPEN_UI, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */
PPD_BAD_ORDER_DEPENDENCY, /* Bad OrderDependency */
PPD_BAD_UI_CONSTRAINTS, /* Bad UIConstraints */
PPD_MISSING_ASTERISK, /* Missing asterisk in column 0 */
PPD_LINE_TOO_LONG, /* Line longer than 255 chars */
PPD_ILLEGAL_CHARACTER, /* Illegal control character */
PPD_ILLEGAL_MAIN_KEYWORD, /* Illegal main keyword string */
PPD_ILLEGAL_OPTION_KEYWORD, /* Illegal option keyword string */
PPD_ILLEGAL_TRANSLATION, /* Illegal translation string */
PPD_ILLEGAL_WHITESPACE /* Illegal whitespace character */
PPD_OK = 0, /* OK */
PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */
PPD_NULL_FILE, /* NULL PPD file pointer */
PPD_ALLOC_ERROR, /* Memory allocation error */
PPD_MISSING_PPDADOBE4, /* Missing PPD-Adobe-4.x header */
PPD_MISSING_VALUE, /* Missing value string */
PPD_INTERNAL_ERROR, /* Internal error */
PPD_BAD_OPEN_GROUP, /* Bad OpenGroup */
PPD_NESTED_OPEN_GROUP, /* OpenGroup without a CloseGroup first */
PPD_BAD_OPEN_UI, /* Bad OpenUI/JCLOpenUI */
PPD_NESTED_OPEN_UI, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */
PPD_BAD_ORDER_DEPENDENCY, /* Bad OrderDependency */
PPD_BAD_UI_CONSTRAINTS, /* Bad UIConstraints */
PPD_MISSING_ASTERISK, /* Missing asterisk in column 0 */
PPD_LINE_TOO_LONG, /* Line longer than 255 chars */
PPD_ILLEGAL_CHARACTER, /* Illegal control character */
PPD_ILLEGAL_MAIN_KEYWORD, /* Illegal main keyword string */
PPD_ILLEGAL_OPTION_KEYWORD, /* Illegal option keyword string */
PPD_ILLEGAL_TRANSLATION, /* Illegal translation string */
PPD_ILLEGAL_WHITESPACE, /* Illegal whitespace character */
PPD_BAD_CUSTOM_PARAM /* Bad custom parameter */
} ppd_status_t;
typedef enum ppd_conform_e /**** Conformance Levels ****/
typedef enum ppd_conform_e /**** Conformance Levels ****/
{
PPD_CONFORM_RELAXED, /* Relax whitespace and control char */
PPD_CONFORM_STRICT /* Require strict conformance */
PPD_CONFORM_RELAXED, /* Relax whitespace and control char */
PPD_CONFORM_STRICT /* Require strict conformance */
} ppd_conform_t;
typedef struct ppd_attr_str /**** PPD Attribute Structure @since CUPS 1.1.19@ ****/
typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19@ ****/
{
char name[PPD_MAX_NAME];
/* Name of attribute (cupsXYZ) */
char spec[PPD_MAX_NAME];
/* Specifier string, if any */
char text[PPD_MAX_TEXT];
/* Human-readable text, if any */
char *value; /* Value string */
char name[PPD_MAX_NAME]; /* Name of attribute (cupsXYZ) */
char spec[PPD_MAX_NAME]; /* Specifier string, if any */
char text[PPD_MAX_TEXT]; /* Human-readable text, if any */
char *value; /* Value string */
} ppd_attr_t;
typedef struct ppd_option_str ppd_option_t;
/**** Options ****/
typedef struct ppd_option_s ppd_option_t;
/**** Options ****/
typedef struct ppd_choice_str /**** Option choices ****/
typedef struct ppd_choice_s /**** Option choices ****/
{
char marked; /* 0 if not selected, 1 otherwise */
char choice[PPD_MAX_NAME];
/* Computer-readable option name */
char text[PPD_MAX_TEXT];
/* Human-readable option name */
char *code; /* Code to send for this option */
ppd_option_t *option; /* Pointer to parent option structure */
char marked; /* 0 if not selected, 1 otherwise */
char choice[PPD_MAX_NAME]; /* Computer-readable option name */
char text[PPD_MAX_TEXT]; /* Human-readable option name */
char *code; /* Code to send for this option */
ppd_option_t *option; /* Pointer to parent option structure */
} ppd_choice_t;
struct ppd_option_str /**** Options ****/
struct ppd_option_s /**** Options ****/
{
char conflicted; /* 0 if no conflicts exist, 1 otherwise */
char keyword[PPD_MAX_NAME];
/* Option keyword name ("PageSize", etc.) */
char defchoice[PPD_MAX_NAME];
/* Default option choice */
char text[PPD_MAX_TEXT];
/* Human-readable text */
ppd_ui_t ui; /* Type of UI option */
ppd_section_t section; /* Section for command */
float order; /* Order number */
int num_choices; /* Number of option choices */
ppd_choice_t *choices; /* Option choices */
char conflicted; /* 0 if no conflicts exist, 1 otherwise */
char keyword[PPD_MAX_NAME]; /* Option keyword name ("PageSize", etc.) */
char defchoice[PPD_MAX_NAME];/* Default option choice */
char text[PPD_MAX_TEXT]; /* Human-readable text */
ppd_ui_t ui; /* Type of UI option */
ppd_section_t section; /* Section for command */
float order; /* Order number */
int num_choices; /* Number of option choices */
ppd_choice_t *choices; /* Option choices */
};
typedef struct ppd_group_str /**** Groups ****/
typedef struct ppd_group_s /**** Groups ****/
{
/**** Group text strings are limited to 39 chars + nul in order to
**** preserve binary compatibility and allow applications to get
**** the group's keyword name.
****/
char text[PPD_MAX_TEXT - PPD_MAX_NAME];
/* Human-readable group name */
char name[PPD_MAX_NAME];
/* Group name @since CUPS 1.1.18@ */
int num_options; /* Number of options */
ppd_option_t *options; /* Options */
int num_subgroups; /* Number of sub-groups */
struct ppd_group_str *subgroups;
/* Sub-groups (max depth = 1) */
/* Human-readable group name */
char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18@ */
int num_options; /* Number of options */
ppd_option_t *options; /* Options */
int num_subgroups; /* Number of sub-groups */
struct ppd_group_s *subgroups; /* Sub-groups (max depth = 1) */
} ppd_group_t;
typedef struct /**** Constraints ****/
typedef struct /**** Constraints ****/
{
char option1[PPD_MAX_NAME];
/* First keyword */
char choice1[PPD_MAX_NAME];
/* First option/choice (blank for all) */
char option2[PPD_MAX_NAME];
/* Second keyword */
char choice2[PPD_MAX_NAME];
/* Second option/choice (blank for all) */
char option1[PPD_MAX_NAME]; /* First keyword */
char choice1[PPD_MAX_NAME]; /* First option/choice (blank for all) */
char option2[PPD_MAX_NAME]; /* Second keyword */
char choice2[PPD_MAX_NAME]; /* Second option/choice (blank for all) */
} ppd_const_t;
typedef struct ppd_size_str /**** Page Sizes ****/
typedef struct ppd_size_s /**** Page Sizes ****/
{
int marked; /* Page size selected? */
char name[PPD_MAX_NAME];
/* Media size option */
float width; /* Width of media in points */
float length; /* Length of media in points */
float left; /* Left printable margin in points */
float bottom; /* Bottom printable margin in points */
float right; /* Right printable margin in points */
float top; /* Top printable margin in points */
int marked; /* Page size selected? */
char name[PPD_MAX_NAME]; /* Media size option */
float width; /* Width of media in points */
float length; /* Length of media in points */
float left; /* Left printable margin in points */
float bottom; /* Bottom printable margin in points */
float right; /* Right printable margin in points */
float top; /* Top printable margin in points */
} ppd_size_t;
typedef struct ppd_emul_str /**** Emulators ****/
typedef struct ppd_emul_s /**** Emulators ****/
{
char name[PPD_MAX_NAME];
/* Emulator name */
char *start; /* Code to switch to this emulation */
char *stop; /* Code to stop this emulation */
char name[PPD_MAX_NAME]; /* Emulator name */
char *start; /* Code to switch to this emulation */
char *stop; /* Code to stop this emulation */
} ppd_emul_t;
typedef struct ppd_profile_str /**** sRGB Color Profiles ****/
typedef struct ppd_profile_s /**** sRGB Color Profiles ****/
{
char resolution[PPD_MAX_NAME];
/* Resolution or "-" */
/* Resolution or "-" */
char media_type[PPD_MAX_NAME];
/* Media type or "-" */
float density; /* Ink density to use */
float gamma; /* Gamma correction to use */
float matrix[3][3]; /* Transform matrix */
/* Media type or "-" */
float density; /* Ink density to use */
float gamma; /* Gamma correction to use */
float matrix[3][3]; /* Transform matrix */
} ppd_profile_t;
/**** New in CUPS 1.2 ****/
# if 0
typedef enum ppd_ext_ui_e /**** Extended UI Types @since CUPS 1.2@ ****/
typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2@ ****/
{
PPD_UI_CUPS_TEXT, /* Specify a string */
PPD_UI_CUPS_INTEGER, /* Specify an integer number */
PPD_UI_CUPS_REAL, /* Specify a real number */
PPD_UI_CUPS_GAMMA, /* Specify a gamma number */
PPD_UI_CUPS_CURVE, /* Specify start, end, and gamma numbers */
PPD_UI_CUPS_INTEGER_ARRAY, /* Specify an array of integer numbers */
PPD_UI_CUPS_REAL_ARRAY, /* Specify an array of real numbers */
PPD_UI_CUPS_XY_ARRAY /* Specify an array of X/Y real numbers */
} ppd_ext_ui_t;
PPD_CUSTOM_CURVE, /* Curve value for f(x) = x^value */
PPD_CUSTOM_INT, /* Integer number value */
PPD_CUSTOM_INVCURVE, /* Curve value for f(x) = x^(1/value) */
PPD_CUSTOM_PASSCODE, /* String of (hidden) numbers */
PPD_CUSTOM_PASSWORD, /* String of (hidden) characters */
PPD_CUSTOM_POINTS, /* Measurement value in points */
PPD_CUSTOM_REAL, /* Real number value */
PPD_CUSTOM_STRING /* String of characters */
} ppd_cptype_t;
typedef union ppd_ext_value_u /**** Extended Values @since CUPS 1.2@ ****/
typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2@ ****/
{
char *text; /* Text value */
int integer; /* Integer value */
float real; /* Real value */
float gamma; /* Gamma value */
struct
{
float start; /* Linear (density) start value for curve */
float end; /* Linear (density) end value for curve */
float gamma; /* Gamma correction */
} curve; /* Curve values */
struct
{
int num_elements; /* Number of array elements */
int *elements; /* Array of integer values */
} integer_array; /* Integer array value */
struct
{
int num_elements; /* Number of array elements */
float *elements; /* Array of real values */
} real_array; /* Real array value */
struct
{
int num_elements; /* Number of array elements */
float *elements; /* Array of XY values */
} xy_array; /* XY array value */
} ppd_ext_value_t;
float custom_curve; /* Gamma value */
int custom_int; /* Integer value */
float custom_invcurve; /* Gamma value */
char *custom_passcode; /* Passcode value */
char *custom_password; /* Password value */
float custom_points; /* Measurement value */
float custom_real; /* Real value */
char *custom_string; /* String value */
} ppd_cpvalue_t;
typedef struct ppd_ext_param_str/**** Extended Parameter @since CUPS 1.2@ ****/
typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2@ ****/
{
char keyword[PPD_MAX_NAME];
/* Parameter name */
char text[PPD_MAX_TEXT];
/* Human-readable text */
ppd_ext_value_t *value; /* Current values */
ppd_ext_value_t *defval; /* Default values */
ppd_ext_value_t *minval; /* Minimum numeric values */
ppd_ext_value_t *maxval; /* Maximum numeric values */
} ppd_ext_param_t;
char name[PPD_MAX_NAME]; /* Parameter name */
char text[PPD_MAX_TEXT]; /* Human-readable text */
int order; /* Order (0 to N) */
ppd_cptype_t type; /* Parameter type */
ppd_cpvalue_t minimum, /* Minimum value */
maximum, /* Maximum value */
current; /* Current value */
} ppd_cparam_t;
typedef struct ppd_ext_option_str
/**** Extended Options @since CUPS 1.2@ ****/
typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2@ ****/
{
char keyword[PPD_MAX_NAME];
/* Name of option that is being extended... */
ppd_option_t *option; /* Option that is being extended... */
int marked; /* Extended option is marked */
char *code; /* Generic PS code for extended options */
int num_params; /* Number of parameters */
ppd_ext_param_t **params; /* Parameters */
} ppd_ext_option_t;
# endif /* 0 */
char keyword[PPD_MAX_NAME]; /* Name of option that is being extended... */
ppd_option_t *option; /* Option that is being extended... */
int marked; /* Extended option is marked */
cups_array_t *params; /* Parameters */
} ppd_coption_t;
typedef struct ppd_file_str /**** Files ****/
typedef struct ppd_file_s /**** PPD File ****/
{
int language_level; /* Language level of device */
int color_device; /* 1 = color device, 0 = grayscale */
int variable_sizes; /* 1 = supports variable sizes, 0 = doesn't */
int accurate_screens;
/* 1 = supports accurate screens, 0 = not */
int contone_only; /* 1 = continuous tone only, 0 = not */
int landscape; /* -90 or 90 */
int model_number; /* Device-specific model number */
int manual_copies; /* 1 = Copies done manually, 0 = hardware */
int throughput; /* Pages per minute */
ppd_cs_t colorspace; /* Default colorspace */
char *patches; /* Patch commands to be sent to printer */
int num_emulations; /* Number of emulations supported */
ppd_emul_t *emulations; /* Emulations and the code to invoke them */
char *jcl_begin; /* Start JCL commands */
char *jcl_ps; /* Enter PostScript interpreter */
char *jcl_end; /* End JCL commands */
char *lang_encoding; /* Language encoding */
char *lang_version; /* Language version (English, Spanish, etc.) */
char *modelname; /* Model name (general) */
char *ttrasterizer; /* Truetype rasterizer */
char *manufacturer; /* Manufacturer name */
char *product; /* Product name (from PS RIP/interpreter) */
char *nickname; /* Nickname (specific) */
char *shortnickname; /* Short version of nickname */
int num_groups; /* Number of UI groups */
ppd_group_t *groups; /* UI groups */
int num_sizes; /* Number of page sizes */
ppd_size_t *sizes; /* Page sizes */
float custom_min[2]; /* Minimum variable page size */
float custom_max[2]; /* Maximum variable page size */
float custom_margins[4];/* Margins around page */
int num_consts; /* Number of UI/Non-UI constraints */
ppd_const_t *consts; /* UI/Non-UI constraints */
int num_fonts; /* Number of pre-loaded fonts */
char **fonts; /* Pre-loaded fonts */
int num_profiles; /* Number of sRGB color profiles */
ppd_profile_t *profiles; /* sRGB color profiles */
int num_filters; /* Number of filters */
char **filters; /* Filter strings... */
int language_level; /* Language level of device */
int color_device; /* 1 = color device, 0 = grayscale */
int variable_sizes; /* 1 = supports variable sizes, 0 = doesn't */
int accurate_screens; /* 1 = supports accurate screens, 0 = not */
int contone_only; /* 1 = continuous tone only, 0 = not */
int landscape; /* -90 or 90 */
int model_number; /* Device-specific model number */
int manual_copies; /* 1 = Copies done manually, 0 = hardware */
int throughput; /* Pages per minute */
ppd_cs_t colorspace; /* Default colorspace */
char *patches; /* Patch commands to be sent to printer */
int num_emulations; /* Number of emulations supported */
ppd_emul_t *emulations; /* Emulations and the code to invoke them */
char *jcl_begin; /* Start JCL commands */
char *jcl_ps; /* Enter PostScript interpreter */
char *jcl_end; /* End JCL commands */
char *lang_encoding; /* Language encoding */
char *lang_version; /* Language version (English, Spanish, etc.) */
char *modelname; /* Model name (general) */
char *ttrasterizer; /* Truetype rasterizer */
char *manufacturer; /* Manufacturer name */
char *product; /* Product name (from PS RIP/interpreter) */
char *nickname; /* Nickname (specific) */
char *shortnickname; /* Short version of nickname */
int num_groups; /* Number of UI groups */
ppd_group_t *groups; /* UI groups */
int num_sizes; /* Number of page sizes */
ppd_size_t *sizes; /* Page sizes */
float custom_min[2]; /* Minimum variable page size */
float custom_max[2]; /* Maximum variable page size */
float custom_margins[4]; /* Margins around page */
int num_consts; /* Number of UI/Non-UI constraints */
ppd_const_t *consts; /* UI/Non-UI constraints */
int num_fonts; /* Number of pre-loaded fonts */
char **fonts; /* Pre-loaded fonts */
int num_profiles; /* Number of sRGB color profiles */
ppd_profile_t *profiles; /* sRGB color profiles */
int num_filters; /* Number of filters */
char **filters; /* Filter strings... */
/**** New in CUPS 1.1 ****/
int flip_duplex; /* 1 = Flip page for back sides @since CUPS 1.1@ */
int flip_duplex; /* 1 = Flip page for back sides @since CUPS 1.1@ */
/**** New in CUPS 1.1.19 ****/
char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */
char *pcfilename; /* PCFileName string @since CUPS 1.1.19@ */
int num_attrs; /* Number of attributes @since CUPS 1.1.19@ */
int cur_attr; /* Current attribute @since CUPS 1.1.19@ */
ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19@ */
char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */
char *pcfilename; /* PCFileName string @since CUPS 1.1.19@ */
int num_attrs; /* Number of attributes @since CUPS 1.1.19@ */
int cur_attr; /* Current attribute @since CUPS 1.1.19@ */
ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19@ */
/**** New in CUPS 1.2 ****/
# if 0
int num_extended; /* Number of extended options @since CUPS 1.2@ */
ppd_ext_option_t **extended; /* Extended options @since CUPS 1.2@ */
# endif /* 0 */
cups_array_t *options; /* Option lookup array @since CUPS 1.2@ */
cups_array_t *coptions; /* Custom options array @since CUPS 1.2@ */
} ppd_file_t;
@@ -403,7 +362,19 @@ extern ppd_status_t ppdLastError(int *line);
extern void ppdSetConformance(ppd_conform_t c);
/**** New in CUPS 1.2 ****/
extern int ppdCollect2(ppd_file_t *ppd, ppd_section_t section,
float min_order, ppd_choice_t ***choices);
extern int ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp,
ppd_section_t section, int limit,
float min_order);
extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp);
extern ppd_coption_t *ppdFindCustomOption(ppd_file_t *ppd,
const char *keyword);
extern ppd_cparam_t *ppdFindCustomParam(ppd_coption_t *opt,
const char *name);
extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt);
extern ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt);
extern int ppdLocalize(ppd_file_t *ppd);
extern ppd_file_t *ppdOpen2(cups_file_t *fp);
@@ -417,5 +388,5 @@ extern ppd_file_t *ppdOpen2(cups_file_t *fp);
#endif /* !_CUPS_PPD_H_ */
/*
* End of "$Id: ppd.h 4785 2005-10-13 19:39:05Z mike $".
* End of "$Id: ppd.h 4980 2006-01-25 19:57:45Z mike $".
*/
-299
Ver Arquivo
@@ -1,299 +0,0 @@
*PPD-Adobe: "4.3"
*%
*% "$Id: sample.ppd 2620 2002-08-14 05:34:15Z mike $"
*%
*% Sample HP DeskJet driver PPD file for the Common UNIX Printing
*% System (CUPS).
*%
*% Copyright 1997-2002 by Easy Software Products.
*%
*% These coded instructions, statements, and computer programs are the
*% property of Easy Software Products 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 missing or damaged please contact Easy Software Products
*% at:
*%
*% Attn: CUPS Licensing Information
*% Easy Software Products
*% 44141 Airport View Drive, Suite 204
*% Hollywood, Maryland 20636-3111 USA
*%
*% Voice: (301) 373-9603
*% EMail: cups-info@cups.org
*% WWW: http://www.cups.org
*%
*FormatVersion: "4.3"
*FileVersion: "1.1"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "DESKJET.PPD"
*Manufacturer: "ESP"
*Product: "(CUPS v1.1)"
*cupsVersion: 1.1
*cupsManualCopies: True
*cupsFilter: "application/vnd.cups-raster 0 rastertohp"
*cupsModelNumber: 1
*ModelName: "HP DeskJet Series"
*ShortNickName: "HP DeskJet Series"
*NickName: "HP DeskJet Series CUPS v1.1"
*PSVersion: "(3010.000) 550"
*LanguageLevel: "3"
*ColorDevice: True
*DefaultColorSpace: RGB
*FileSystem: False
*Throughput: "1"
*LandscapeOrientation: Plus90
*VariablePaperSize: False
*TTRasterizer: Type42
*UIConstraints: *PageSize Executive *InputSlot Envelope
*UIConstraints: *PageSize Letter *InputSlot Envelope
*UIConstraints: *PageSize Legal *InputSlot Envelope
*UIConstraints: *PageSize Tabloid *InputSlot Envelope
*UIConstraints: *PageSize A3 *InputSlot Envelope
*UIConstraints: *PageSize A4 *InputSlot Envelope
*UIConstraints: *PageSize A5 *InputSlot Envelope
*UIConstraints: *PageSize B5 *InputSlot Envelope
*UIConstraints: *Resolution 600dpi *ColorModel CMYK
*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: Letter
*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
*PageSize Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Letter
*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
*PageRegion Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: Letter
*ImageableArea Letter/US Letter: "18 36 594 756"
*ImageableArea Legal/US Legal: "18 36 594 972"
*ImageableArea Executive/US Executive: "18 36 504 684"
*ImageableArea Tabloid/US Tabloid: "18 36 774 1188"
*ImageableArea A3/A3: "18 36 824 1155"
*ImageableArea A4/A4: "18 36 577 806"
*ImageableArea A5/A5: "18 36 403 559"
*ImageableArea B5/JIS B5: "18 36 498 693"
*ImageableArea EnvISOB5/B5 (ISO): "18 36 463 673"
*ImageableArea Env10/Com-10: "18 36 279 648"
*ImageableArea EnvC5/EnvC5: "18 36 441 613"
*ImageableArea EnvDL/EnvDL: "18 36 294 588"
*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504"
*DefaultPaperDimension: Letter
*PaperDimension Letter/US Letter: "612 792"
*PaperDimension Legal/US Legal: "612 1008"
*PaperDimension Executive/US Executive: "522 756"
*PaperDimension Tabloid/US Tabloid: "792 1224"
*PaperDimension A3/A3: "842 1191"
*PaperDimension A4/A4: "595 842"
*PaperDimension A5/A5: "421 595"
*PaperDimension B5/B5 (JIS): "516 729"
*PaperDimension EnvISOB5/Envelope B5: "499 709"
*PaperDimension Env10/Envelope #10: "297 684"
*PaperDimension EnvC5/Envelope C5: "459 649"
*PaperDimension EnvDL/Envelope DL: "312 624"
*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
*OpenUI *MediaType/Media Type: PickOne
*OrderDependency: 10 AnySetup *MediaType
*DefaultMediaType: Plain
*MediaType Plain/Plain Paper: "<</MediaType(Plain)/cupsMediaType 0>>setpagedevice"
*MediaType Bond/Bond Paper: "<</MediaType(Bond)/cupsMediaType 1>>setpagedevice"
*MediaType Special/Special Paper: "<</MediaType(Special)/cupsMediaType 2>>setpagedevice"
*MediaType Transparency/Transparency: "<</MediaType(Transparency)/cupsMediaType 3>>setpagedevice"
*MediaType Glossy/Glossy Paper: "<</MediaType(Glossy)/cupsMediaType 4>>setpagedevice"
*CloseUI: *MediaType
*OpenUI *InputSlot/Media Source: PickOne
*OrderDependency: 10 AnySetup *InputSlot
*DefaultInputSlot: Tray
*InputSlot Tray/Tray: "<</cupsMediaPosition 1>>setpagedevice"
*InputSlot Manual/Manual Feed: "<</cupsMediaPosition 2>>setpagedevice"
*InputSlot Envelope/Envelope Feed: "<</cupsMediaPosition 3>>setpagedevice"
*CloseUI: *InputSlot
*OpenUI *Resolution/Output Resolution: PickOne
*OrderDependency: 20 AnySetup *Resolution
*DefaultResolution: 300dpi
*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]/cupsColorSpace 3>>setpagedevice"
*CloseUI: *Resolution
*OpenUI *ColorModel/Output Mode: PickOne
*OrderDependency: 10 AnySetup *ColorModel
*DefaultColorModel: CMYK
*ColorModel CMYK/CMYK Color: "<</cupsColorOrder 1/cupsColorSpace 8/cupsCompression 2>>setpagedevice"
*ColorModel RGB/CMY Color: "<</cupsColorOrder 1/cupsColorSpace 4/cupsCompression 2>>setpagedevice"
*ColorModel Gray/Grayscale: "<</cupsColorOrder 0/cupsColorSpace 3/cupsCompression 2>>setpagedevice"
*CloseUI: *ColorModel
*OpenGroup Extended/Extended Options
*OpenUI IntOption/Integer: PickOne
*OrderDependency: 10 AnySetup *IntOption
*DefaultIntOption: None
*IntOption None: ""
*IntOption 1: "<</cupsInteger0 1>>setpagedevice"
*IntOption 2: "<</cupsInteger0 2>>setpagedevice"
*IntOption 3: "<</cupsInteger0 3>>setpagedevice"
*IntOption 4: "<</cupsInteger0 4>>setpagedevice"
*IntOption 5: "<</cupsInteger0 5>>setpagedevice"
*cupsUIType IntOption: Integer
*cupsUIMinimum IntOption: "1"
*cupsUIMaximum IntOption: "5"
*cupsUICommand IntOption: "<</cupsInteger0 3 1 roll>>setpagedevice>>"
*CloseUI: *IntOption
*OpenUI RealOption/Real Number: PickOne
*OrderDependency: 10 AnySetup *RealOption
*DefaultRealOption: None
*RealOption None: ""
*RealOption 1: "<</cupsReal0 1>>setpagedevice"
*RealOption 2: "<</cupsReal0 2>>setpagedevice"
*RealOption 3: "<</cupsReal0 3>>setpagedevice"
*RealOption 4: "<</cupsReal0 4>>setpagedevice"
*RealOption 5: "<</cupsReal0 5>>setpagedevice"
*cupsUIType RealOption: Real
*cupsUIMinimum RealOption: "1"
*cupsUIMaximum RealOption: "5"
*cupsUICommand RealOption: "<</cupsReal0 3 1 roll>>setpagedevice>>"
*CloseUI: *RealOption
*OpenUI TextOption/Text: PickOne
*OrderDependency: 10 AnySetup *TextOption
*DefaultTextOption: None
*TextOption None: ""
*TextOption NOFORN: "<</cupsString0 (NOFORN)>>setpagedevice"
*TextOption FOIA: "<</cupsString0 (FOIA)>>setpagedevice"
*TextOption FOUO: "<</cupsString0 (FOUO)>>setpagedevice"
*cupsUIType TextOption: Text
*cupsUICommand TextOption: "<</cupsString0 3 1 roll>>setpagedevice>>"
*CloseUI: *TextOption
*OpenUI GammaOption/Gamma Curve: PickOne
*OrderDependency: 10 AnySetup *GammaOption
*DefaultGammaOption: None
*GammaOption None: ""
*GammaOption 1: "<</cupsReal1 1>>setpagedevice"
*GammaOption 1.5: "<</cupsReal1 1.5>>setpagedevice"
*GammaOption 2.0: "<</cupsReal1 2>>setpagedevice"
*GammaOption 2.5: "<</cupsReal1 2.5>>setpagedevice"
*GammaOption 3.0: "<</cupsReal1 3>>setpagedevice"
*cupsUIType GammaOption: Integer
*cupsUIMinimum GammaOption: "1"
*cupsUIMaximum GammaOption: "3"
*cupsUICommand GammaOption: "<</cupsReal1 3 1 roll>>setpagedevice>>"
*CloseUI: *GammaOption
*OpenUI CurveOption/Curve: PickOne
*OrderDependency: 10 AnySetup *CurveOption
*DefaultCurveOption: None
*CurveOption None: ""
*CurveOption 1: "<</cupsReal2 0/cupsReal3 1/cupsReal4 1>>setpagedevice"
*CurveOption 2: "<</cupsReal2 0/cupsReal3 1/cupsReal4 2>>setpagedevice"
*CurveOption 3: "<</cupsReal2 0/cupsReal3 1/cupsReal4 3>>setpagedevice"
*CurveOption 4: "<</cupsReal2 0/cupsReal3 1/cupsReal4 4>>setpagedevice"
*CurveOption 5: "<</cupsReal2 0/cupsReal3 1/cupsReal4 5>>setpagedevice"
*cupsUIType CurveOption: Curve
*cupsUIMinimum CurveOption: "0 0 1"
*cupsUIMaximum CurveOption: "1 1 5"
*cupsUICommand CurveOption: "<</cupsReal2 5 index/cupsReal3 6 index/cupsReal4 7 index>>setpagedevice pop pop pop>>"
*CloseUI: *CurveOption
*OpenUI IntArrayOption/Integer Array: PickOne
*OrderDependency: 10 AnySetup *IntArrayOption
*DefaultIntArrayOption: None
*IntArrayOption None: ""
*IntArrayOption Linear: "<</cupsInteger[0 255]>>setpagedevice"
*IntArrayOption Parametric: "<</cupsInteger[0 28 113 255]>>setpagedevice"
*IntArrayOption Sine: "<</cupsInteger[0 44 87 128 164 195 221 240 251 255]>>setpagedevice"
*cupsUIType IntArrayOption: IntegerArray
*cupsUIMinimum IntArrayOption: "2 0"
*cupsUIMaximum IntArrayOption: "16 255"
*cupsUICommand IntArrayOption: "<</cupsInteger 3 1 roll>>setpagedevice>>"
*CloseUI: *IntArrayOption
*OpenUI RealArrayOption/Real Array: PickOne
*OrderDependency: 10 AnySetup *RealArrayOption
*DefaultRealArrayOption: None
*RealArrayOption None: ""
*RealArrayOption Linear: "<</cupsReal[0 255]>>setpagedevice"
*RealArrayOption Parametric: "<</cupsReal[0 28 113 255]>>setpagedevice"
*RealArrayOption Sine: "<</cupsReal[0 44 87 128 164 195 221 240 251 255]>>setpagedevice"
*cupsUIType RealArrayOption: RealArray
*cupsUIMinimum RealArrayOption: "2 0"
*cupsUIMaximum RealArrayOption: "16 255"
*cupsUICommand RealArrayOption: "<</cupsReal 3 1 roll>>setpagedevice>>"
*CloseUI: *RealArrayOption
*CloseGroup
*DefaultFont: Courier
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
*Font Courier: Standard "(002.004S)" Standard ROM
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
*Font Helvetica: Standard "(001.006S)" Standard ROM
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
*Font Symbol: Special "(001.007S)" Special ROM
*Font Times-Bold: Standard "(001.007S)" Standard ROM
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
*Font Times-Italic: Standard "(001.007S)" Standard ROM
*Font Times-Roman: Standard "(001.007S)" Standard ROM
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
*Font ZapfDingbats: Special "(001.004S)" Standard ROM
*%
*% End of "$Id: sample.ppd 2620 2002-08-14 05:34:15Z mike $".
*%
+187
Ver Arquivo
@@ -0,0 +1,187 @@
*PPD-Adobe: "4.3"
*%
*% "$Id: test.ppd 4939 2006-01-17 18:54:33Z mike $"
*%
*% Test PPD file for the Common UNIX Printing System (CUPS).
*%
*% This file is used to test the CUPS PPD API functions and cannot be
*% used with any known printers. Look at the PPD files in the "ppd"
*% subdirectory as well as the CUPS web site for working PPD files.
*%
*% If you are a PPD file developer, consider using the CUPS DDK to
*% create your PPD files - not only will it save you time, it produces
*% consistently high-quality files.
*%
*% Copyright 2002-2006 by Easy Software Products.
*%
*% These coded instructions, statements, and computer programs are the
*% property of Easy Software Products 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 missing or damaged please contact Easy Software Products
*% at:
*%
*% Attn: CUPS Licensing Information
*% Easy Software Products
*% 44141 Airport View Drive, Suite 204
*% Hollywood, Maryland 20636-3111 USA
*%
*% Voice: (301) 373-9603
*% EMail: cups-info@cups.org
*% WWW: http://www.cups.org
*%
*FormatVersion: "4.3"
*FileVersion: "1.2"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "TEST.PPD"
*Manufacturer: "ESP"
*Product: "(ESP Ghostscript)"
*cupsVersion: 1.2
*cupsManualCopies: True
*cupsFilter: "application/vnd.cups-raster 0 rastertotest"
*cupsModelNumber: 1
*ModelName: "Test"
*ShortNickName: "Test"
*NickName: "Test for CUPS v1.2"
*PSVersion: "(3010.000) 81501"
*LanguageLevel: "3"
*ColorDevice: True
*DefaultColorSpace: RGB
*FileSystem: False
*Throughput: "1"
*LandscapeOrientation: Plus90
*TTRasterizer: Type42
*% These constraints are used to test ppdConflicts()
*UIConstraints: *PageSize Letter *InputSlot Envelope
*UIConstraints: *InputSlot Envelope *PageSize Letter
*% For PageSize, we have put all of the translations in-line...
*OpenUI *PageSize/Page Size: PickOne
*fr.Translation PageSize/French Page Size: ""
*fr_CA.Translation PageSize/French Canadian Page Size: ""
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: Letter
*PageSize Letter/US Letter: "PageSize=Letter"
*fr.PageSize Letter/French US Letter: ""
*fr_CA.PageSize Letter/French Canadian US Letter: ""
*PageSize A4/A4: "PageSize=A4"
*fr.PageSize A4/French A4: ""
*fr_CA.PageSize A4/French Canadian A4: ""
*PageSize Env10/#10 Envelope: "PageSize=Env10"
*fr.PageSize Env10/French #10 Envelope: ""
*fr_CA.PageSize Env10/French Canadian #10 Envelope: ""
*CloseUI: *PageSize
*% For PageRegion, we have separated the translations...
*OpenUI *PageRegion/Page Region: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Letter
*PageRegion Letter/US Letter: "PageRegion=Letter"
*PageRegion A4/A4: "PageRegion=A4"
*PageRegion Env10/#10 Envelope: "PageRegion=Env10"
*CloseUI: *PageRegion
*fr.Translation PageRegion/French Page Region: ""
*fr.PageRegion Letter/French US Letter: ""
*fr.PageRegion A4/French A4: ""
*fr.PageRegion Env10/French #10 Envelope: ""
*fr_CA.Translation PageRegion/French Canadian Page Region: ""
*fr_CA.PageRegion Letter/French Canadian US Letter: ""
*fr_CA.PageRegion A4/French Canadian A4: ""
*fr_CA.PageRegion Env10/French Canadian #10 Envelope: ""
*DefaultImageableArea: Letter
*ImageableArea Letter: "18 36 594 756"
*ImageableArea A4: "18 36 577 806"
*ImageableArea Env10: "18 36 279 648"
*DefaultPaperDimension: Letter
*PaperDimension Letter: "612 792"
*PaperDimension A4: "595 842"
*PaperDimension Env10: "297 684"
*% Custom page size support
*HWMargins: 0 0 0 0
*CustomPageSize True/Custom Page Size: "PageSize=Custom"
*ParamCustomPageSize Width: 1 points 36 1080
*ParamCustomPageSize Height: 2 points 36 86400
*ParamCustomPageSize WidthOffset/Width Offset: 3 points 0 0
*ParamCustomPageSize HeightOffset/Height Offset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0
*OpenUI *InputSlot/Input Slot: PickOne
*OrderDependency: 10 AnySetup *InputSlot
*DefaultInputSlot: Tray
*InputSlot Tray/Tray: "InputSlot=Tray"
*InputSlot Manual/Manual Feed: "InputSlot=Manual"
*InputSlot Envelope/Envelope Feed: "InputSlot=Envelope"
*CloseUI: *InputSlot
*% Custom options...
*OpenGroup: Extended/Extended Options
*OpenUI IntOption/Integer: PickOne
*OrderDependency: 10 AnySetup *IntOption
*DefaultIntOption: None
*IntOption 1: "IntOption=1"
*IntOption 2: "IntOption=2"
*IntOption 3: "IntOption=3"
*CloseUI: *IntOption
*CustomIntOption True/Custom Integer: "IntOption=Custom"
*ParamCustomIntOption Integer: 1 int -100 100
*OpenUI StringOption/String: PickOne
*OrderDependency: 10 AnySetup *StringOption
*DefaultStringOption: None
*StringOption foo: "StringOption=foo"
*StringOption bar: "StringOption=bar"
*CloseUI: *StringOption
*CustomStringOption True/Custom Stringeger: "StringOption=Custom"
*ParamCustomStringOption String: 1 string * **********
*CloseGroup: Extended
*DefaultFont: Courier
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
*Font Courier: Standard "(002.004S)" Standard ROM
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
*Font Helvetica: Standard "(001.006S)" Standard ROM
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
*Font Symbol: Special "(001.007S)" Special ROM
*Font Times-Bold: Standard "(001.007S)" Standard ROM
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
*Font Times-Italic: Standard "(001.007S)" Standard ROM
*Font Times-Roman: Standard "(001.007S)" Standard ROM
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
*Font ZapfDingbats: Special "(001.004S)" Standard ROM
*%
*% End of "$Id: test.ppd 4939 2006-01-17 18:54:33Z mike $".
*%
+64 -18
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: testfile.c 4754 2005-10-08 04:01:46Z mike $"
* "$Id: testfile.c 4942 2006-01-18 19:49:15Z mike $"
*
* File test program for the Common UNIX Printing System (CUPS).
*
@@ -57,33 +57,79 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
int status; /* Exit status */
int status; /* Exit status */
char filename[1024]; /* Filename buffer */
/*
* Do uncompressed file tests...
*/
if (argc == 1)
{
/*
* Do uncompressed file tests...
*/
status = read_write_tests(0);
status = read_write_tests(0);
#ifdef HAVE_LIBZ
/*
* Do compressed file tests...
*/
/*
* Do compressed file tests...
*/
putchar('\n');
putchar('\n');
status += read_write_tests(1);
status += read_write_tests(1);
#endif /* HAVE_LIBZ */
/*
* Summarize the results and return...
*/
/*
* Test path functions...
*/
if (!status)
puts("\nALL TESTS PASSED!");
fputs("cupsFileFind: ", stdout);
if (cupsFileFind("cat", "/bin", filename, sizeof(filename)) &&
cupsFileFind("cat", "/bin:/usr/bin", filename, sizeof(filename)))
printf("PASS (%s)\n", filename);
else
{
puts("FAIL");
status ++;
}
/*
* Summarize the results and return...
*/
if (!status)
puts("\nALL TESTS PASSED!");
else
printf("\n%d TEST(S) FAILED!\n", status);
}
else
printf("\n%d TEST(S) FAILED!\n", status);
{
/*
* Cat the filename on the command-line...
*/
cups_file_t *fp; /* File pointer */
char line[1024]; /* Line from file */
if ((fp = cupsFileOpen(argv[1], "r")) == NULL)
{
perror(argv[1]);
status = 1;
}
else
{
status = 0;
while (cupsFileGets(fp, line, sizeof(line)))
puts(line);
if (!cupsFileEOF(fp))
perror(argv[1]);
cupsFileClose(fp);
}
}
return (status);
}
@@ -396,5 +442,5 @@ read_write_tests(int compression) /* I - Use compression? */
/*
* End of "$Id: testfile.c 4754 2005-10-08 04:01:46Z mike $".
* End of "$Id: testfile.c 4942 2006-01-18 19:49:15Z mike $".
*/
+4 -2
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: testhttp.c 4809 2005-10-21 19:43:55Z mike $"
* "$Id: testhttp.c 4943 2006-01-18 20:30:42Z mike $"
*
* HTTP test program for the Common UNIX Printing System (CUPS).
*
@@ -96,6 +96,8 @@ static uri_test_t uri_tests[] = /* URI test data */
"socket", "", "server", "/", 9100, 0 },
{ HTTP_URI_OK, "ipp://username:password@[v1.fe80::200:1234:5678:9abc+eth0]:999/ipp",
"ipp", "username:password", "fe80::200:1234:5678:9abc%eth0", "/ipp", 999, 999 },
{ HTTP_URI_OK, "http://server/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400",
"http", "", "server", "/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400", 80, 0 },
/* Missing scheme */
{ HTTP_URI_MISSING_SCHEME, "/path/to/file/index.html",
@@ -510,5 +512,5 @@ main(int argc, /* I - Number of command-line arguments */
/*
* End of "$Id: testhttp.c 4809 2005-10-21 19:43:55Z mike $".
* End of "$Id: testhttp.c 4943 2006-01-18 20:30:42Z mike $".
*/
+86
Ver Arquivo
@@ -0,0 +1,86 @@
/*
* "$Id: testppd.c 4939 2006-01-17 18:54:33Z mike $"
*
* PPD test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products 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 missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Main entry.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include <cups/string.h>
#include <errno.h>
#include "ppd.h"
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
#endif /* WIN32 */
/*
* 'main()' - Main entry.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
ppd_file_t *ppd; /* PPD file loaded from disk */
int status; /* Status of tests (0 = success, 1 = fail) */
status = 0;
fputs("ppdOpenFile: ", stdout);
if ((ppd = ppdOpenFile("test.ppd")) != NULL)
puts("PASS");
else
{
ppd_status_t err; /* Last error in file */
int line; /* Line number in file */
status ++;
err = ppdLastError(&line);
printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
}
ppdClose(ppd);
return (status);
}
/*
* End of "$Id: testppd.c 4939 2006-01-17 18:54:33Z mike $".
*/
+24 -12
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: transcode.c 4903 2006-01-10 20:02:46Z mike $"
* "$Id: transcode.c 4967 2006-01-24 03:42:15Z mike $"
*
* Transcoding support for the Common UNIX Printing System (CUPS).
*
@@ -26,6 +26,7 @@
* cupsCharmapGet() - Get a character set map.
* cupsCharmapFree() - Free a character set map.
* cupsCharmapFlush() - Flush all character set maps out of cache.
* _cupsCharmapFlush() - Flush all character set maps out of cache.
* cupsUTF8ToCharset() - Convert UTF-8 to legacy character set.
* cupsCharsetToUTF8() - Convert legacy character set to UTF-8.
* cupsUTF8ToUTF16() - Convert UTF-8 to UTF-16.
@@ -171,22 +172,33 @@ cupsCharmapFree(const cups_encoding_t encoding)
return;
}
/*
* 'cupsCharmapFlush()' - Flush all character set maps out of cache.
*/
void
cupsCharmapFlush(void)
{
int i; /* Looping variable */
_cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */
_cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */
_cups_cmap_t *cnext; /* Next Legacy SBCS Charset Map */
_cups_vmap_t *vnext; /* Next Legacy VBCS Charset Map */
cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */
cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */
cups_vbcs_t *vrow; /* Pointer to VBCS row in 'uni2char' */
_cups_globals_t *cg = _cupsGlobals();
/* Pointer to library globals */
_cupsCharmapFlush(_cupsGlobals());
}
/*
* '_cupsCharmapFlush()' - Flush all character set maps out of cache.
*/
void
_cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
{
int i; /* Looping variable */
_cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */
_cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */
_cups_cmap_t *cnext; /* Next Legacy SBCS Charset Map */
_cups_vmap_t *vnext; /* Next Legacy VBCS Charset Map */
cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */
cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */
cups_vbcs_t *vrow; /* Pointer to VBCS row in 'uni2char' */
/*
* Loop through SBCS charset map cache, free all memory...
@@ -1664,5 +1676,5 @@ compare_wide(const void *k1, /* I - Key char */
/*
* End of "$Id: transcode.c 4903 2006-01-10 20:02:46Z mike $"
* End of "$Id: transcode.c 4967 2006-01-24 03:42:15Z mike $"
*/
+261 -159
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: util.c 4918 2006-01-12 05:14:40Z mike $"
* "$Id: util.c 4987 2006-01-26 00:25:21Z mike $"
*
* Printing utilities for the Common UNIX Printing System (CUPS).
*
@@ -25,25 +25,36 @@
*
* Contents:
*
* cupsCancelJob() - Cancel a print job on the default server.
* cupsDoFileRequest() - Do an IPP request.
* cupsFreeJobs() - Free memory used by job data.
* cupsGetClasses() - Get a list of printer classes from the default server.
* cupsGetDefault() - Get the default printer or class from the default server.
* cupsGetDefault2() - Get the default printer or class from the specified server.
* cupsGetJobs() - Get the jobs from the default server.
* cupsGetJobs2() - Get the jobs from the specified server.
* cupsGetPPD() - Get the PPD file for a printer on the default server.
* cupsGetPPD2() - Get the PPD file for a printer on the specified server.
* cupsGetPrinters() - Get a list of printers from the default server.
* cupsLastError() - Return the last IPP status code.
* cupsLastErrorString() - Return the last IPP status-message.
* cupsPrintFile() - Print a file to a printer or class on the default server.
* cupsPrintFile2() - Print a file to a printer or class on the specified server.
* cupsPrintFiles() - Print one or more files to a printer or class on the default server.
* cupsPrintFiles2() - Print one or more files to a printer or class on the specified server.
* cups_connect() - Connect to the specified host...
* cups_set_error() - Set the last IPP status code and status-message.
* cupsCancelJob() - Cancel a print job on the default server.
* cupsDoFileRequest() - Do an IPP request.
* cupsFreeJobs() - Free memory used by job data.
* cupsGetClasses() - Get a list of printer classes from the default
* server.
* cupsGetDefault() - Get the default printer or class from the default
* server.
* cupsGetDefault2() - Get the default printer or class from the
* specified server.
* cupsGetJobs() - Get the jobs from the default server.
* cupsGetJobs2() - Get the jobs from the specified server.
* cupsGetPPD() - Get the PPD file for a printer on the default
* server.
* cupsGetPPD2() - Get the PPD file for a printer on the specified
* server.
* cupsGetPrinters() - Get a list of printers from the default server.
* cupsLastError() - Return the last IPP status code.
* cupsLastErrorString() - Return the last IPP status-message.
* cupsPrintFile() - Print a file to a printer or class on the default
* server.
* cupsPrintFile2() - Print a file to a printer or class on the
* specified server.
* cupsPrintFiles() - Print one or more files to a printer or class on
* the default server.
* cupsPrintFiles2() - Print one or more files to a printer or class on
* the specified server.
* cups_connect() - Connect to the specified host...
* cups_get_printer_uri() - Get the printer-uri-supported attribute for the
* first printer in a class.
* cups_set_error() - Set the last IPP status code and status-message.
*/
/*
@@ -68,6 +79,10 @@
*/
static char *cups_connect(const char *name, char *printer, char *hostname);
static int cups_get_printer_uri(http_t *http, const char *name,
char *host, int hostsize, int *port,
char *resource, int resourcesize,
int depth);
static void cups_set_error(ipp_status_t status, const char *message);
@@ -354,7 +369,11 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
if (cupsDoAuthentication(http, "POST", resource))
break;
httpReconnect(http);
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
continue;
}
@@ -1121,29 +1140,15 @@ const char * /* O - Filename for PPD file */
cupsGetPPD2(http_t *http, /* I - HTTP connection */
const char *name) /* I - Printer name */
{
int i; /* Looping var */
int http_port; /* Port number */
http_t *http2; /* Alternate HTTP connection */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Local language */
int fd; /* PPD file */
char uri[HTTP_MAX_URI], /* Printer URI */
printer[HTTP_MAX_URI], /* Printer name */
method[HTTP_MAX_URI], /* Method/scheme name */
username[HTTP_MAX_URI], /* Username:password */
char localhost[HTTP_MAX_URI],/* Local hostname */
hostname[HTTP_MAX_URI], /* Hostname */
resource[HTTP_MAX_URI]; /* Resource name */
int port; /* Port number */
http_status_t status; /* HTTP status from server */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
static const char * const requested_attrs[] =
{ /* Requested attributes */
"printer-uri-supported",
"printer-type",
"member-uris"
};
/*
@@ -1161,19 +1166,24 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
}
/*
* Setup the printer URI...
* Try finding a printer URI for this printer...
*/
if (httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", name) != HTTP_URI_OK)
{
cups_set_error(IPP_INTERNAL_ERROR, NULL);
if (!cups_get_printer_uri(http, name, hostname, sizeof(hostname), &port,
resource, sizeof(resource), 0))
return (NULL);
}
/*
* Get the port number we are connect to...
* Remap local hostname to localhost...
*/
httpGetHostname(localhost, sizeof(localhost));
if (!strcasecmp(localhost, hostname))
strcpy(hostname, "localhost");
/*
* Get the port number we are connected to...
*/
#ifdef AF_INET6
@@ -1186,106 +1196,6 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
else
http_port = ippPort();
port = http_port;
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requested-attributes
*/
request = ippNew();
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
cupsLangFree(language);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
DEBUG_printf(("cupsGetPPD2: printer-uri=\"%s\"\n", uri));
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requested-attributes",
sizeof(requested_attrs) / sizeof(requested_attrs[0]),
NULL, requested_attrs);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
printer[0] = '\0';
hostname[0] = '\0';
if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
{
/*
* Get the first actual server and printer name in the class...
*/
for (i = 0; i < attr->num_values; i ++)
{
httpSeparateURI(attr->values[i].string.text, method, sizeof(method),
username, sizeof(username), hostname, sizeof(hostname),
&port, resource, sizeof(resource));
if (!strncmp(resource, "/printers/", 10))
{
/*
* Found a printer!
*/
strlcpy(printer, resource + 10, sizeof(printer));
break;
}
}
}
else if ((attr = ippFindAttribute(response, "printer-uri-supported",
IPP_TAG_URI)) != NULL)
{
/*
* Get the actual server and printer names...
*/
httpSeparateURI(attr->values[0].string.text, method, sizeof(method),
username, sizeof(username), hostname, sizeof(hostname),
&port, resource, sizeof(resource));
strlcpy(printer, strrchr(resource, '/') + 1, sizeof(printer));
}
ippDelete(response);
/*
* Remap local hostname to localhost...
*/
httpGetHostname(uri, sizeof(uri));
if (!strcasecmp(uri, hostname))
strcpy(hostname, "localhost");
}
if (!printer[0])
{
cups_set_error(IPP_NOT_FOUND, NULL);
return (NULL);
}
/*
* Reconnect to the correct server as needed...
*/
@@ -1322,7 +1232,7 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
* And send a request to the HTTP server...
*/
snprintf(resource, sizeof(resource), "/printers/%s.ppd", printer);
strlcat(resource, ".ppd", sizeof(resource));
status = cupsGetFd(http2, resource, fd);
@@ -1553,7 +1463,8 @@ cupsPrintFile2(http_t *http, /* I - HTTP connection */
/*
* 'cupsPrintFiles()' - Print one or more files to a printer or class on the default server.
* 'cupsPrintFiles()' - Print one or more files to a printer or class on the
* default server.
*/
int /* O - Job ID */
@@ -1596,7 +1507,8 @@ cupsPrintFiles(const char *name, /* I - Printer or class name */
/*
* 'cupsPrintFiles2()' - Print one or more files to a printer or class on the specified server.
* 'cupsPrintFiles2()' - Print one or more files to a printer or class on the
* specified server.
*
* @since CUPS 1.1.21@
*/
@@ -1761,17 +1673,18 @@ cupsPrintFiles2(http_t *http, /* I - HTTP connection */
*/
if (cupsGetOption("raw", num_options, options))
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/vnd.cups-raw");
else if ((val = cupsGetOption("document-format", num_options, options)) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
NULL, val);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, "application/vnd.cups-raw");
else if ((val = cupsGetOption("document-format", num_options,
options)) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, val);
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/octet-stream");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, "application/octet-stream");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
/*
* Is this the last document?
@@ -1807,7 +1720,7 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
char *hostname) /* O - Hostname [HTTP_MAX_URI] */
{
char hostbuf[HTTP_MAX_URI]; /* Name of host */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
_cups_globals_t *cg = _cupsGlobals();/* Pointer to library globals */
DEBUG_printf(("cups_connect(\"%s\", %p, %p)\n", name, printer, hostname));
@@ -1848,7 +1761,7 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
DEBUG_printf(("connecting to %s on port %d...\n", hostname, ippPort()));
if ((cg->http = httpConnectEncrypt(hostname, ippPort(),
cupsEncryption())) == NULL)
cupsEncryption())) == NULL)
{
DEBUG_puts("Unable to connect to server!");
@@ -1861,6 +1774,195 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
}
/*
* 'cups_get_printer_uri()' - Get the printer-uri-supported attribute for the first printer in a class.
*/
static int /* O - 1 on success, 0 on failure */
cups_get_printer_uri(
http_t *http, /* I - HTTP connection */
const char *name, /* I - Name of printer or class */
char *host, /* I - Hostname buffer */
int hostsize, /* I - Size of hostname buffer */
int *port, /* O - Port number */
char *resource, /* I - Resource buffer */
int resourcesize, /* I - Size of resource buffer */
int depth) /* I - Depth of query */
{
int i; /* Looping var */
int http_port; /* Port number */
http_t *http2; /* Alternate HTTP connection */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* Current attribute */
char uri[HTTP_MAX_URI], /* printer-uri attribute */
scheme[HTTP_MAX_URI], /* Scheme name */
username[HTTP_MAX_URI], /* Username:password */
classname[255]; /* Temporary class name */
static const char * const requested_attrs[] =
{ /* Requested attributes */
"printer-uri-supported",
"printer-type",
"member-uris"
};
DEBUG_printf(("cups_get_printer_uri(http=%p, name=\"%s\", host=%p, "
"hostsize=%d, resource=%p, resourcesize=%d, depth=%d)\n",
http, name ? name : "(null)", host, hostsize,
resource, resourcesize, depth));
/*
* Setup the printer URI...
*/
if (httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0,
"/printers/%s", name) != HTTP_URI_OK)
{
cups_set_error(IPP_INTERNAL_ERROR, NULL);
*host = '\0';
*resource = '\0';
return (0);
}
DEBUG_printf(("cups_get_printer_uri: printer-uri=\"%s\"\n", uri));
/*
* Get the port number we are connected to...
*/
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
http_port = ntohs(http->hostaddr->ipv6.sin6_port);
else
#endif /* AF_INET6 */
if (http->hostaddr->addr.sa_family == AF_INET)
http_port = ntohs(http->hostaddr->ipv4.sin_port);
else
http_port = ippPort();
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requested-attributes
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requested-attributes",
sizeof(requested_attrs) / sizeof(requested_attrs[0]),
NULL, requested_attrs);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
{
/*
* Get the first actual printer name in the class...
*/
for (i = 0; i < attr->num_values; i ++)
{
httpSeparateURI(attr->values[i].string.text, scheme, sizeof(scheme),
username, sizeof(username), host, hostsize,
port, resource, resourcesize);
if (!strncmp(resource, "/printers/", 10))
{
/*
* Found a printer!
*/
ippDelete(response);
return (1);
}
}
/*
* No printers in this class - try recursively looking for a printer,
* but not more than 3 levels deep...
*/
if (depth < 3)
{
for (i = 0; i < attr->num_values; i ++)
{
httpSeparateURI(attr->values[i].string.text, scheme, sizeof(scheme),
username, sizeof(username), host, hostsize,
port, resource, resourcesize);
if (!strncmp(resource, "/classes/", 9))
{
/*
* Found a class! Connect to the right server...
*/
if (!strcasecmp(http->hostname, host) && *port == http_port)
http2 = http;
else if ((http2 = httpConnectEncrypt(host, *port,
cupsEncryption())) == NULL)
{
DEBUG_puts("Unable to connect to server!");
continue;
}
/*
* Look up printers on that server...
*/
strlcpy(classname, resource + 9, sizeof(classname));
cups_get_printer_uri(http2, classname, host, hostsize, port,
resource, resourcesize, depth + 1);
/*
* Close the connection as needed...
*/
if (http2 != http)
httpClose(http2);
if (*host)
return (1);
}
}
}
}
else if ((attr = ippFindAttribute(response, "printer-uri-supported",
IPP_TAG_URI)) != NULL)
{
httpSeparateURI(attr->values[0].string.text, scheme, sizeof(scheme),
username, sizeof(username), host, hostsize,
port, resource, resourcesize);
ippDelete(response);
return (1);
}
ippDelete(response);
}
*host = '\0';
*resource = '\0';
return (0);
}
/*
* 'cups_set_error()' - Set the last IPP status code and status-message.
*/
@@ -1888,5 +1990,5 @@ cups_set_error(ipp_status_t status, /* I - IPP status code */
/*
* End of "$Id: util.c 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: util.c 4987 2006-01-26 00:25:21Z mike $".
*/
+4 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: Makefile 4494 2005-02-18 02:18:11Z mike $"
# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $"
#
# Datafile makefile for the Common UNIX Printing System (CUPS).
#
@@ -136,7 +136,7 @@ clean:
# Install files...
#
install:
install: all
$(INSTALL_DIR) $(DATADIR)/banners
for file in $(BANNERS); do \
$(INSTALL_DATA) $$file $(DATADIR)/banners; \
@@ -153,8 +153,9 @@ install:
for file in $(DATAFILES); do \
$(INSTALL_DATA) $$file $(DATADIR)/data; \
done
$(INSTALL_DIR) $(DATADIR)/profiles
#
# End of "$Id: Makefile 4494 2005-02-18 02:18:11Z mike $".
# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $".
#
+4 -4
Ver Arquivo
@@ -6,7 +6,7 @@
%%DocumentSuppliedResources: procset testprint/1.2
%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
%%Creator: Michael Sweet, Easy Software Products
%%CreationDate: D:20051002193000+0500
%%CreationDate: D:20060114093000+0500
%%Title: Test Page
%%EndComments
%%BeginProlog
@@ -14,7 +14,7 @@
%
% PostScript test page for the Common UNIX Printing System ("CUPS").
%
% Copyright 1993-2005 Easy Software Products
% Copyright 1993-2006 Easy Software Products
%
% These coded instructions, statements, and computer programs are the
% property of Easy Software Products and are protected by Federal
@@ -600,7 +600,7 @@ gsave
pageHeight 8 mul % Move down...
2 copy moveto % Position text
smallFont setfont % Font
(Copyright 1993-2005 Easy Software Products, All Rights Reserved.) CENTER
(Copyright 1993-2006 Easy Software Products, All Rights Reserved.) CENTER
pageHeight sub % Move down...
2 copy moveto % Position text
(CUPS, and the CUPS logo are the trademark property of Easy Software Products,) CENTER
@@ -631,6 +631,6 @@ gsave
grestore
showpage
%
% End of "$Id: testprint.ps 4743 2005-10-02 23:29:44Z mike $".
% End of "$Id: testprint.ps 4930 2006-01-14 16:54:03Z mike $".
%
%%EOF
+10 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: Makefile 4918 2006-01-12 05:14:40Z mike $"
# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $"
#
# Documentation makefile for the Common UNIX Printing System (CUPS).
#
@@ -44,7 +44,6 @@ WEBIMAGES = \
images/continue.gif \
images/delete-class.gif \
images/delete-printer.gif \
images/draft.gif \
images/edit-configuration-file.gif \
images/esp-logo.gif \
images/happy.gif \
@@ -57,6 +56,8 @@ WEBIMAGES = \
images/manage-server.gif \
images/modify-class.gif \
images/modify-printer.gif \
images/move-job.gif \
images/move-jobs.gif \
images/printer-idle.gif \
images/printer-processing.gif \
images/printer-stopped.gif \
@@ -71,7 +72,12 @@ WEBIMAGES = \
images/set-as-default.gif \
images/set-printer-options.gif \
images/show-active.gif \
images/show-all.gif \
images/show-completed.gif \
images/show-next.gif \
images/show-previous.gif \
images/sort-ascending.gif \
images/sort-descending.gif \
images/start-class.gif \
images/start-printer.gif \
images/stop-class.gif \
@@ -124,6 +130,7 @@ HELPFILES = \
help/man-lpstat.html \
help/network.html \
help/overview.html \
help/spec-ipp.html \
help/spec-ppd.html \
help/standard.html \
help/whatsnew.html
@@ -147,7 +154,7 @@ clean:
# Install all documentation files...
#
install:
install: all
$(INSTALL_DIR) $(DOCDIR)
for file in $(WEBPAGES); do \
$(INSTALL_MAN) $$file $(DOCDIR); \
+16
Ver Arquivo
@@ -205,3 +205,19 @@ DIV.sidebar P.l2 {
margin-top: 0;
text-indent: -2em;
}
TABLE.pager {
background: #cccc99;
border: solid thin #999966;
margin-top: 10px;
padding: 2px;
}
DT {
margin-left: 3em;
margin-top: 1em;
}
DD {
margin-left: 5em;
}
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+10 -2
Ver Arquivo
@@ -7,7 +7,7 @@
</head>
<body>
<!--
"$Id: spec-ppd.html 4918 2006-01-12 05:14:40Z mike $"
"$Id: spec-ppd.html 4941 2006-01-18 13:16:40Z mike $"
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
@@ -196,6 +196,14 @@ any necessary value quoting for HP-PJL commands.</p>
number from 1 to N and specifies the order of values as they are
placed on the stack before the command.</p>
<blockquote><b>Note:</b> Currently only CustomPageSize supports
more than 1 parameter. This restriction is due to value encoding
issues, since the "Custom.value" format does not allow for
specification of named parameters. We anticipate supporting the
collection value format "{Name1=foo Name2=bar}" for the final
CUPS 1.2 release. In addition, the collection value format will
allow string values to contain spaces.</blockquote>
<p>The "type" is one of the following keywords:</p>
<ul>
@@ -343,7 +351,7 @@ is not absolute, it is loaded relative to the
*cupsColorProfile RGB.Glossy.720dpi/720dpi Glossy: "vendor/foo-720-glossy-rgb.icc"
<em>*% Specify a default profile for printing at all other resolutions and media types</em>
*cupsICCProfile .../Default: "vendor/foo-default.icc"
*cupsICCProfile ../Default: "vendor/foo-default.icc"
</pre>
<h4>Customizing the Profile Selection Keywords</h4>
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 771 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 463 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 574 B

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 638 B

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 659 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 699 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 723 B

+8 -3
Ver Arquivo
@@ -109,12 +109,17 @@ assistance:</P>
<A HREF="http://www.cups.org/" TARGET="_blank">www.cups.org</A>
</PRE>
<P>Commercial support and an enhanced version of CUPS called <A
HREF="http://www.easysw.com/printpro/">ESP Print Pro</A> is
available at:</P>
<PRE>
<A HREF="http://www.easysw.com/" TARGET="_blank">www.easysw.com</A>
</PRE>
</TD>
<TD WIDTH="15">&nbsp;</TD>
</TR>
<TR CLASS="page">
<TD COLSPAN="5">&nbsp;</TD>
</TR>
<TR CLASS="header">
<TD VALIGN="BOTTOM" WIDTH="15"><IMG SRC="/images/bottom-left.gif"
WIDTH="15" HEIGHT="15" ALT=""></TD>
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: Makefile 4804 2005-10-20 14:05:42Z mike $"
# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $"
#
# Filter makefile for the Common UNIX Printing System (CUPS).
#
@@ -145,7 +145,7 @@ libcupsimage.so.2 libcupsimage.sl.2: $(IMAGEOBJS)
libcupsimage.2.dylib: $(IMAGEOBJS)
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/libcupsimage.dylib \
-install_name $(libdir)/$@ \
-current_version 2.2.0 \
-compatibility_version 2.0.0 \
$(IMAGEOBJS) $(DSOLIBS) -L../cups $(LINKCUPS) -lm
@@ -281,5 +281,5 @@ include Dependencies
#
# End of "$Id: Makefile 4804 2005-10-20 14:05:42Z mike $".
# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $".
#
+36 -12
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: interpret.c 4903 2006-01-10 20:02:46Z mike $"
* "$Id: interpret.c 4982 2006-01-25 21:44:44Z mike $"
*
* PPD command interpreter for the Common UNIX Printing System (CUPS).
*
@@ -92,14 +92,23 @@ cupsRasterInterpretPPD(
memset(h, 0, sizeof(cups_page_header2_t));
h->NumCopies = 1;
h->PageSize[0] = 612;
h->PageSize[1] = 792;
h->HWResolution[0] = 100;
h->HWResolution[1] = 100;
h->cupsBitsPerColor = 1;
h->cupsColorOrder = CUPS_ORDER_CHUNKED;
h->cupsColorSpace = CUPS_CSPACE_K;
h->NumCopies = 1;
h->PageSize[0] = 612;
h->PageSize[1] = 792;
h->HWResolution[0] = 100;
h->HWResolution[1] = 100;
h->cupsBitsPerColor = 1;
h->cupsColorOrder = CUPS_ORDER_CHUNKED;
h->cupsColorSpace = CUPS_CSPACE_K;
h->cupsPageScaling = 1.0f;
h->cupsPageSize[0] = 612.0f;
h->cupsPageSize[1] = 792.0f;
h->cupsImagingBBox[0] = 0.0f;
h->cupsImagingBBox[1] = 0.0f;
h->cupsImagingBBox[2] = 612.0f;
h->cupsImagingBBox[3] = 792.0f;
strcpy(h->cupsPageSizeName, "Letter");
/*
* Apply patches and options to the page header...
@@ -169,6 +178,8 @@ cupsRasterInterpretPPD(
bottom = size->bottom;
right = size->right;
top = size->top;
strlcpy(h->cupsPageSizeName, size->name, sizeof(h->cupsPageSizeName));
}
else
{
@@ -188,13 +199,19 @@ cupsRasterInterpretPPD(
h->ImagingBoundingBox[1] = bottom;
h->ImagingBoundingBox[2] = right;
h->ImagingBoundingBox[3] = top;
h->cupsImagingBBox[0] = left;
h->cupsImagingBBox[1] = bottom;
h->cupsImagingBBox[2] = right;
h->cupsImagingBBox[3] = top;
/*
* Compute the bitmap parameters...
*/
h->cupsWidth = (int)((right - left) * h->HWResolution[0] / 72.0f + 0.5f);
h->cupsHeight = (int)((top - bottom) * h->HWResolution[1] / 72.0f + 0.5f);
h->cupsWidth = (int)((right - left) * h->cupsPageScaling *
h->HWResolution[0] / 72.0f + 0.5f);
h->cupsHeight = (int)((top - bottom) * h->cupsPageScaling *
h->HWResolution[1] / 72.0f + 0.5f);
switch (h->cupsColorSpace)
{
@@ -473,6 +490,9 @@ exec_code(cups_page_header2_t *h, /* O - Page header */
{
if (sscanf(value, "[%d%d]", h->PageSize + 0, h->PageSize + 1) != 2)
return (-1);
if (sscanf(value, "[%f%f]", h->cupsPageSize + 0, h->cupsPageSize + 1) != 2)
return (-1);
}
else if (!strcmp(name, "Separations") && type == CUPS_TYPE_NAME)
h->Separations = !strcmp(value, "true");
@@ -496,6 +516,10 @@ exec_code(cups_page_header2_t *h, /* O - Page header */
h->cupsRowFeed = atoi(value);
else if (!strcmp(name, "cupsRowStep") && type == CUPS_TYPE_NUMBER)
h->cupsRowStep = atoi(value);
else if (!strcmp(name, "cupsPageScaling") && type == CUPS_TYPE_NUMBER)
{
h->cupsPageScaling = atof(value);
}
else if (!strncmp(name, "cupsInteger", 11) && type == CUPS_TYPE_NUMBER)
{
if ((i = atoi(name + 11)) >= 0 || i > 15)
@@ -541,5 +565,5 @@ exec_code(cups_page_header2_t *h, /* O - Page header */
/*
* End of "$Id: interpret.c 4903 2006-01-10 20:02:46Z mike $".
* End of "$Id: interpret.c 4982 2006-01-25 21:44:44Z mike $".
*/
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: raster.c 4903 2006-01-10 20:02:46Z mike $"
* "$Id: raster.c 4981 2006-01-25 21:34:00Z mike $"
*
* Raster file routines for the Common UNIX Printing System (CUPS).
*
@@ -609,7 +609,7 @@ cups_raster_read_header(
*/
if (r->sync == CUPS_RASTER_REVSYNC || r->sync == CUPS_RASTER_REVSYNCv1)
for (len = 74, s = (union swap_s *)&(r->header.AdvanceDistance);
for (len = 81, s = (union swap_s *)&(r->header.AdvanceDistance);
len > 0;
len --, s ++)
s->v = (((((s->b[3] << 8) | s->b[2]) << 8) | s->b[1]) << 8) | s->b[0];
@@ -888,5 +888,5 @@ cups_write(int fd, /* I - File descriptor */
/*
* End of "$Id: raster.c 4903 2006-01-10 20:02:46Z mike $".
* End of "$Id: raster.c 4981 2006-01-25 21:34:00Z mike $".
*/
+12 -8
Ver Arquivo
@@ -1,5 +1,5 @@
/*
* "$Id: raster.h 4903 2006-01-10 20:02:46Z mike $"
* "$Id: raster.h 4981 2006-01-25 21:34:00Z mike $"
*
* Raster file definitions for the Common UNIX Printing System (CUPS).
*
@@ -288,12 +288,16 @@ typedef struct cups_page_header2_s /**** Version 2 Page Header @since CUPS 1.2@
unsigned cupsRowStep; /* Spacing between lines */
/**** Version 2 Dictionary Values ****/
unsigned cupsNumColors; /* Number of colors */
unsigned cupsInteger[16]; /* User-defined integer values */
float cupsReal[16]; /* User-defined floating-point values */
char cupsString[16][64]; /* User-defined string values */
char cupsMarkerType[64]; /* Ink/toner type */
char cupsRenderingIntent[64];/* Color rendering intent */
unsigned cupsNumColors; /* Number of colors @since CUPS 1.2@ */
float cupsPageScaling; /* Scaling that was applied to page data */
float cupsPageSize[2]; /* Floating point PageSize @since CUPS 1.2@ */
float cupsImagingBBox[4]; /* Floating point ImagingBoundingBox @since CUPS 1.2@ */
unsigned cupsInteger[16]; /* User-defined integer values @since CUPS 1.2@ */
float cupsReal[16]; /* User-defined floating-point values @since CUPS 1.2@ */
char cupsString[16][64]; /* User-defined string values @since CUPS 1.2@ */
char cupsMarkerType[64]; /* Ink/toner type @since CUPS 1.2@ */
char cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2@ */
char cupsPageSizeName[64]; /* PageSize name @since CUPS 1.2@ */
} cups_page_header2_t;
typedef struct _cups_raster_s /**** Raster stream data ****/
@@ -341,5 +345,5 @@ extern unsigned cupsRasterWriteHeader2(cups_raster_t *r,
#endif /* !_CUPS_RASTER_H_ */
/*
* End of "$Id: raster.h 4903 2006-01-10 20:02:46Z mike $".
* End of "$Id: raster.h 4981 2006-01-25 21:34:00Z mike $".
*/
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: Makefile,v 1.6 1999/05/10 17:42:00 mike Exp $"
# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $"
#
# Fonts makefile for the Common UNIX Printing System (CUPS).
#
@@ -50,7 +50,7 @@ clean:
# Install files...
#
install:
install: all
$(INSTALL_DIR) $(DATADIR)/fonts
for file in $(FONTS); do \
$(INSTALL_DATA) $$file $(DATADIR)/fonts; \
@@ -58,5 +58,5 @@ install:
#
# End of "$Id: Makefile,v 1.6 1999/05/10 17:42:00 mike Exp $".
# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $".
#
+10 -4
Ver Arquivo
@@ -8,10 +8,13 @@
StartService ()
{
if [ "${CUPS:=-YES-}" = "-YES-" ]; then
if [ "${CUPS:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
ConsoleMessage "Starting printing services"
/usr/sbin/cupsd
fi
elif [ "${CUPS:=-AUTOMATIC-}" = "-YES-" ]; then
ConsoleMessage "Starting printing services"
/usr/sbin/cupsd
fi
}
StopService ()
@@ -21,7 +24,7 @@ StopService ()
if test "$pid" != ""; then
ConsoleMessage "Stopping printing services"
kill "${pid}"
fi
fi
}
RestartService ()
@@ -32,7 +35,10 @@ RestartService ()
ConsoleMessage "Restarting printing services"
kill -HUP "${pid}"
else
StartService
if [ "${CUPS:=-AUTOMATIC-}" = "-AUTOMATIC-" -o "${CUPS:=-AUTOMATIC-}" = "-YES-" ]; then
ConsoleMessage "Starting printing services"
/usr/sbin/cupsd
fi
fi
}
+2 -2
Ver Arquivo
@@ -1,6 +1,6 @@
#!/bin/sh
#
# "$Id: cups.sh.in 4493 2005-02-18 02:09:53Z mike $"
# "$Id: cups.sh.in 4971 2006-01-24 14:33:18Z mike $"
#
# Startup/shutdown script for the Common UNIX Printing System (CUPS).
#
@@ -207,5 +207,5 @@ exit 0
#
# End of "$Id: cups.sh.in 4493 2005-02-18 02:09:53Z mike $".
# End of "$Id: cups.sh.in 4971 2006-01-24 14:33:18Z mike $".
#
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: Makefile 4898 2006-01-08 23:13:20Z mike $"
# "$Id: Makefile 4965 2006-01-21 06:12:17Z mike $"
#
# Locale file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1993-2005 by Easy Software Products.
# Copyright 1993-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -28,7 +28,7 @@ include ../Makedefs
# Locales...
#
LOCALES = fr
LOCALES = fr ja
#
@@ -50,7 +50,7 @@ clean:
# Install files...
#
install:
install: all
$(INSTALL_DIR) $(LOCALEDIR)
for loc in $(LOCALES) ; do \
$(INSTALL_DIR) $(LOCALEDIR)/$$loc ; \
@@ -95,5 +95,5 @@ translate.o: ../cups/http.h ../cups/i18n.h ../cups/language.h ../cups/string.h
#
# End of "$Id: Makefile 4898 2006-01-08 23:13:20Z mike $".
# End of "$Id: Makefile 4965 2006-01-21 06:12:17Z mike $".
#
+1052 -195
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+1096 -195
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+3167
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+9 -2
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: Makefile 4868 2005-12-05 16:59:11Z mike $"
# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $"
#
# Man page makefile for the Common UNIX Printing System (CUPS).
#
@@ -69,7 +69,14 @@ all: $(MAN1) $(MAN5) $(MAN8) html
#
clean:
$(RM) mantohtml mantohtml.o
$(RM) $(MAN1) $(MAN5) $(MAN8)
for file in $(MAN1); do \
$(RM) ../doc/help/man-`basename $$file .$(MAN1EXT)`.html; \
done
for file in $(MAN8); do \
$(RM) ../doc/help/man-`basename $$file .$(MAN8EXT)`.html; \
done
#
@@ -127,5 +134,5 @@ mantohtml: mantohtml.o
#
# End of "$Id: Makefile 4868 2005-12-05 16:59:11Z mike $".
# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $".
#
+11 -9
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: accept.man 4493 2005-02-18 02:09:53Z mike $"
.\" "$Id: accept.man 4948 2006-01-19 03:23:41Z mike $"
.\"
.\" accept/reject man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 1997-2005 by Easy Software Products.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" property of Easy Software Products and are protected by Federal
@@ -21,7 +21,7 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH accept 8 "Common UNIX Printing System" "23 January 2001" "Easy Software Products"
.TH accept 8 "Common UNIX Printing System" "18 January 2006" "Easy Software Products"
.SH NAME
accept/reject \- accept/reject jobs sent to a destination
.SH SYNOPSIS
@@ -29,8 +29,10 @@ accept/reject \- accept/reject jobs sent to a destination
destination(s)
.br
.B reject
[ -E ] [ -h
.I server
[ -E ] [ -U
.I username
] [ -h
.I hostname[:port]
] [ -r
.I reason
]
@@ -51,10 +53,10 @@ from the System V versions which require the root user to execute these
commands.
.SH SEE ALSO
cancel(1), disable(8), enable(8), lp(1), lpadmin(8), lpstat(1),
CUPS Software Administrators Manual,
http://localhost:631/documentation.html
.br
http://localhost:631/help
.SH COPYRIGHT
Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: accept.man 4493 2005-02-18 02:09:53Z mike $".
.\" End of "$Id: accept.man 4948 2006-01-19 03:23:41Z mike $".
.\"
+19 -13
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: lp.man 4493 2005-02-18 02:09:53Z mike $"
.\" "$Id: lp.man 4948 2006-01-19 03:23:41Z mike $"
.\"
.\" lp/cancel man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 1997-2005 by Easy Software Products.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" property of Easy Software Products and are protected by Federal
@@ -21,17 +21,19 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lp 1 "Common UNIX Printing System" "1 May 2003" "Easy Software Products"
.TH lp 1 "Common UNIX Printing System" "18 January 2006" "Easy Software Products"
.SH NAME
lp \- print files
.br
cancel \- cancel jobs
.SH SYNOPSIS
.B lp
[ -E ] [ \-c ] [ \-d
[ -E ] [ -U
.I username
] [ \-c ] [ \-d
.I destination
] [ \-h
.I server
.I hostname[:port]
] [ \-m ] [ \-n
.I num-copies
[ \-o
@@ -49,8 +51,10 @@ cancel \- cancel jobs
]
.br
.B lp
[ -E ] [ \-c ] [ \-h
.I server
[ -E ] [ -U
.I username
] [ \-c ] [ \-h
.I hostname[:port]
] [ \-i
.I job-id
] [ \-n
@@ -68,8 +72,10 @@ cancel \- cancel jobs
]
.br
.B cancel
[ \-a ] [ -h
.I server
[ -E ] [ -U
.I username
] [ \-a ] [ -h
.I hostname:port
] [ -u
.I username
] [
@@ -172,10 +178,10 @@ jobs via the \fI-u\fR option should password-protect the /jobs
location in \fIcupsd.conf(5)\fR.
.SH SEE ALSO
lpstat(1),
CUPS Software Users Manual,
http://localhost:631/documentation.html
.br
http://localhost:631/help
.SH COPYRIGHT
Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lp.man 4493 2005-02-18 02:09:53Z mike $".
.\" End of "$Id: lp.man 4948 2006-01-19 03:23:41Z mike $".
.\"
+30 -16
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: lpmove.man 4493 2005-02-18 02:09:53Z mike $"
.\" "$Id: lpmove.man 4948 2006-01-19 03:23:41Z mike $"
.\"
.\" lpmove man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 1997-2005 by Easy Software Products.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" property of Easy Software Products and are protected by Federal
@@ -21,33 +21,47 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lpmove 8 "Common UNIX Printing System" "23 January 2001" "Easy Software Products"
.TH lpmove 8 "Common UNIX Printing System" "18 January 2006" "Easy Software Products"
.SH NAME
lpmove \- move a job to a new destination
lpmove \- move a job or all jobs to a new destination
.SH SYNOPSIS
.B lpmove
[ -E ]
[ -E ] [ -h
.I hostname[:port]
] [ -U
.I username
]
.I job destination
.br
.B lpmove
[ -E ] [ -h
.I hostname[:port]
] [ -U
.I username
]
.I source destination
.SH DESCRIPTION
\fBlpmove\fR moves the specified \fIjob\fR to \fIdestination\fR. \fIjob\fR
can be the job ID number or the old destination and job ID:
\fBlpmove\fR moves the specified \fIjob\fR or all jobs from
\fIsource\fR to \fIdestination\fR. \fIjob\fR can be the job ID
number or the old destination and job ID:
.br
.nf
lpmove 123 newprinter
lpmove oldprinter-123 newprinter
.fi
.LP
.SH OPTIONS
The \fI-E\fR option forces encryption when connecting to the server.
.SH COMPATIBILITY
The System V version of this command also allows moving of all jobs from one
queue to another. This functionality is currently not supported by CUPS.
.LP
The \fI-U\fR option specifies an alternate username.
.LP
The \fI-h\fR option specifies an alternate server.
.SH SEE ALSO
cancel(1), lp(1),
CUPS Software Users Manual,
http://localhost:631/documentation.html
cancel(1), lp(1)
.br
http://localhost:631/help
.SH COPYRIGHT
Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lpmove.man 4493 2005-02-18 02:09:53Z mike $".
.\" End of "$Id: lpmove.man 4948 2006-01-19 03:23:41Z mike $".
.\"
+11 -8
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: lpq.man 4493 2005-02-18 02:09:53Z mike $"
.\" "$Id: lpq.man 4948 2006-01-19 03:23:41Z mike $"
.\"
.\" lpq man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 1997-2005 by Easy Software Products.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" property of Easy Software Products and are protected by Federal
@@ -21,12 +21,16 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lpq 1 "Common UNIX Printing System" "13 February 2001" "Easy Software Products"
.TH lpq 1 "Common UNIX Printing System" "18 January 2006" "Easy Software Products"
.SH NAME
lpq \- show printer queue status
.SH SYNOPSIS
.B lpq
[ -E ] [ \-P
[ -E ] [ -U
.I username
] [ -h
.I hostname[:port]
] [ \-P
.I dest
] [ \-a ] [ \-l ] [
.I +interval
@@ -48,10 +52,9 @@ The \fI-l\fR option requests a more verbose (long) reporting format.
.SH SEE ALSO
cancel(1), lp(1), lpr(1), lprm(1), lpstat(1)
.br
CUPS Software Users Manual,
http://localhost:631/documentation.html
http://localhost:631/help
.SH COPYRIGHT
Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lpq.man 4493 2005-02-18 02:09:53Z mike $".
.\" End of "$Id: lpq.man 4948 2006-01-19 03:23:41Z mike $".
.\"
+11 -9
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: lpr.man 4493 2005-02-18 02:09:53Z mike $"
.\" "$Id: lpr.man 4948 2006-01-19 03:23:41Z mike $"
.\"
.\" lpr man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 1997-2005 by Easy Software Products.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
.\" property of Easy Software Products and are protected by Federal
@@ -21,15 +21,17 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lpr 1 "Common UNIX Printing System" "16 December 2004" "Easy Software Products"
.TH lpr 1 "Common UNIX Printing System" "18 January 2006" "Easy Software Products"
.SH NAME
lpr \- print files
.SH SYNOPSIS
.B lpr
[ -E ] [ \-P
.I destination
[ -E ] [ -H
.I hostname[:port]
] [ \-U
.I username
] [ \-P
.I destination
] [ \-#
.I num-copies
[ \-l ] [ \-o
@@ -98,10 +100,10 @@ The "c", "d", "f", "g", "i", "m", "n", "t", "v", and "w" options are not
supported by CUPS and will produce a warning message if used.
.SH SEE ALSO
cancel(1), lp(1), lpstat(1),
CUPS Software Users Manual,
http://localhost:631/documentation.html
.br
http://localhost:631/help
.SH COPYRIGHT
Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lpr.man 4493 2005-02-18 02:09:53Z mike $".
.\" End of "$Id: lpr.man 4948 2006-01-19 03:23:41Z mike $".
.\"

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais