Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 289f19a5d3 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.0.2@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
84 arquivos alterados com 3936 adições e 1959 exclusões
+98
Ver Arquivo
@@ -0,0 +1,98 @@
CHANGES.txt - 11/04/1999
------------------------
CHANGES IN CUPS v1.0.2
- The HP-GL/2 filter didn't always scale the output
correctly.
- The HP-GL/2 filter now supports changing the page size
automatically when the "fitplot" option is not used.
- The cancel-job operation was expecting a resource name
of the form "/job/#" instead of "/jobs/#"; this
prevented the cancel and lprm commands from working.
- The backends didn't log pages when files were printed
using the "-oraw" option.
- The authorization code did not work with the Slackware
long shadow password package because its crypt() can
return NULL.
- The chunking code didn't work for reading the response
of a POST request.
- cupsGetPPD() now does authentication as needed.
- The N-up code in the PostScript filter didn't work
with some printers (grestoreall would restore the
default blank page and device settings).
- The N-up code in the PostScript filter didn't scale
the pages to fit within the imageable area of the
page.
- Wasn't doing an fchown() on the request files. This
caused problems when the default root account group
and CUPS group were not the same.
CHANGES IN CUPS v1.0.1
- Documentation updates.
- Fixed a bunch of possible buffer-overflow conditions.
- The scheduler now supports authentication using PAM.
- Updated the Italian message file.
- httpEncode64() didn't add an extra "=" if there was
only one byte in the last three-byte group.
- Now drop any trailing character set from the locale
string (e.g. "en_US.ISO_8859-1" becomes "en_US")
- Fixed "timezone" vs "tm_gmtoff" usage for BSD-based
operating systems.
- Updated IPP security so that "get" operations can be
done from any resource name; this allows the CGIs to
work with printer authentication enabled so long as
authentication isn't turned on for the whole "site".
- The IPP code didn't properly handle the "unsupported"
group; this caused problems with the HP JetDirect since
it doesn't seem to support the "copies" attribute.
- The HTTP chunking code was missing a CR LF pair at the
end of a 0-length chunk.
- The httpSeparate() function didn't handle embedded
usernames and passwords in the URI properly.
- Doing "lpadmin -p printer -E" didn't restart printing
if there were pending jobs.
- The cancel-job operation now requires either a
requesting-user-name attribute or an authenticated
username.
- The add-printer code did not report errors if the
interface script or PPD file could not be renamed.
- Request files are now created without world read
permissions.
- Added a cupsLastError() function to the CUPS API to
retrieve the IPP error code from the last request.
- Options are now case-insensitive.
- The lpq command now provides 10 characters for the
username instead of the original (Berkeley standard)
7.
- The cancel command needed a local CUPS server to work
(or the appropriate ServerName in cupsd.conf)
- The cancel and lprm commands didn't report the IPP
error if the job could not be cancelled.
- The lp and lpr commands didn't intercept SIGTERM to
remove temporary files when printing from stdin.
- The lp and lpr commands didn't report the IPP error if
the job could not be printed.
+25
Ver Arquivo
@@ -0,0 +1,25 @@
CREDITS.txt - 10/01/1999
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
like to thank the following individuals for their contributions:
Nathaniel Barbour - Lots of testing and feedback.
N. Becker - setsid().
Jean-Eric Cuendet - GhostScript filters for CUPS.
Van Dang - HTTP and IPP policeman.
Dr. ZP Han - setgid()/setuid().
Guy Harris - *BSD shared libraries and lots of other fixes.
Wang Jian - CUPS RPM corrections.
Roderick Johnstone - Beta tester of the millenium.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Mark Lawrence - Microsoft interoperability testing.
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Ulrich Oldendorf - German locale.
Petter Reinholdtsen - HP-UX compiler stuff.
Stuart Stevens - HP JetDirect IPP information.
Kiko - Bug fixes.
If I've missed someone, please let me know by sending an email to
"mike@easysw.com".
-1
Ver Arquivo
@@ -44,7 +44,6 @@ RANLIB = @RANLIB@
RM = @RM@ -f
SED = @SED@
SHELL = /bin/sh
SMBCLIENT = @SMBCLIENT@
#
# Libraries...
+22 -16
Ver Arquivo
@@ -1,15 +1,5 @@
README - CUPS v1.0b10 - 09/27/1999
----------------------------------
BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE
WARNING - This is a BETA release of CUPS, which means that it may
contain "bugs" that could prevent you from printing. If
you are concerned that this may cause you lost time or
money, please STOP and do not install this software!
BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE
README - CUPS v1.0.2 - 11/04/1999
---------------------------------
INTRODUCTION
@@ -56,7 +46,7 @@ the binary distributions from Easy Software Products:
- Digital UNIX (aka OSF1 aka Compaq Tru64 UNIX) 4.0 or higher
- HP-UX 10.20 or higher
- IRIX 5.3 or higher
- Linux 2.0 with glibc2 or higher (tested with RedHat 5.2)
- Linux 2.0 with glibc2 or higher
- Solaris 2.5 or higher (SPARC or Intel)
@@ -64,8 +54,9 @@ INSTALLING CUPS
We are currently distributing CUPS binary distributions in TAR format
with installation and removal scripts generated by our ESP Package
Manager (EPM) software, which is also included with the source
distribution.
Manager (EPM) software, which is available from:
http://www.easysw.com/epm
WARNING: Installing CUPS will overwrite your existing printing system.
Backup files are made by the installation script and restored by the
@@ -84,6 +75,20 @@ After asking you a few yes/no questions the CUPS software will be
installed and the scheduler will be started automatically.
READING THE DOCUMENTATION
Once you have installed the software you can access the documentation
(and a bunch of other stuff) on-line at:
http://localhost:631
If you're having trouble getting that far, the documentation is located
in the "/usr/share/cups/doc" directory in the binary distributions, and
under the "doc" directory in the source archives.
Please read the documentation before asking questions.
SETTING UP PRINTER QUEUES
CUPS works best with PPD (PostScript Printer Description) files. In a
@@ -160,7 +165,8 @@ REPORTING PROBLEMS
If you have problems, please send an email to cups-support@cups.org.
Include your operating system and version, compiler and version, and
any errors or problems you've run into.
any errors or problems you've run into. If you are running a version
of Linux, be sure to provide the Linux distribution you have, too.
OTHER RESOURCES
+12 -2
Ver Arquivo
@@ -24,8 +24,8 @@
include ../Makedefs
TARGETS = ipp lpd parallel serial socket
OBJS = ipp.o lpd.o parallel.o serial.o socket.o
TARGETS = betest ipp lpd parallel serial socket
OBJS = betest.o ipp.o lpd.o parallel.o serial.o socket.o
#
# Make all targets...
@@ -50,6 +50,16 @@ install:
-$(LN) ipp $(SERVERROOT)/backend/http
$(CHMOD) u+s $(SERVERROOT)/backend/lpd
#
# betest
#
betest: betest.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o betest betest.o $(LIBS)
betest.o: ../cups/string.h ../Makedefs
#
# ipp
#
+85
Ver Arquivo
@@ -0,0 +1,85 @@
/*
* "$Id$"
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-1999 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" 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
*
* Contents:
*
* main() - Run the named backend.
*/
/*
* Include necessary headers.
*/
#include <stdio.h>
#include <stdlib.h>
#include <cups/string.h>
#include <unistd.h>
/*
* 'main()' - Run the named backend.
*
* Usage:
*
* betest device-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (7 or 8) */
char *argv[]) /* I - Command-line arguments */
{
char backend[255]; /* Method in URI */
if (argc < 7 || argc > 8)
{
fputs("Usage: betest device-uri job-id user title copies options [file]\n",
stderr);
return (1);
}
/*
* Extract the method from the device-uri - that's the program we want to
* execute.
*/
if (sscanf(argv[1], "%254[^:]", backend) != 1)
{
fputs("betest: Bad device-uri - no colon!\n", stderr);
return (1);
}
/*
* Execute and return
*/
execl(backend, argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7],
NULL);
return (1);
}
/*
* End of "$Id$".
*/
+41 -12
Ver Arquivo
@@ -133,8 +133,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
sprintf(uri, "%s://%s:%d%s", method, hostname, port, resource);
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
@@ -144,13 +142,21 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
"attributes-natural-language", NULL,
language != NULL ? language->language : "C");
snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, hostname, port, resource);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
fprintf(stderr, "DEBUG: printer-uri = \"%s\"\n", uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, argv[2]);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, argv[3]);
fprintf(stderr, "DEBUG: requesting-user-name = \"%s\"\n", argv[2]);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
argv[3]);
fprintf(stderr, "DEBUG: job-name = \"%s\"\n", argv[3]);
/*
* Handle options on the command-line...
@@ -166,7 +172,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/octet-stream");
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", atoi(argv[4]));
if (fp != stdin)
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", atoi(argv[4]));
for (i = 0; i < num_options; i ++)
{
@@ -174,7 +181,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Skip the "raw" option - handled above...
*/
if (strcmp(options[i].name, "raw") == 0)
if (strcasecmp(options[i].name, "raw") == 0)
continue;
/*
@@ -218,7 +225,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
else
{
if (strncmp(option, "no", 2) == 0)
if (strncasecmp(option, "no", 2) == 0)
{
option += 2;
n = 0;
@@ -249,9 +256,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
{
n2 = strtol(s + 1, &s, 0);
if (strcmp(s, "dpc") == 0)
if (strcasecmp(s, "dpc") == 0)
ippAddResolution(request, IPP_TAG_JOB, option, IPP_RES_PER_CM, n, n2);
else if (strcmp(s, "dpi") == 0)
else if (strcasecmp(s, "dpi") == 0)
ippAddResolution(request, IPP_TAG_JOB, option, IPP_RES_PER_INCH, n, n2);
else
ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, option, NULL, val);
@@ -272,8 +279,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
httpClearFields(http);
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
httpEncode64(password, username);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, password);
if (username[0])
{
httpEncode64(password, username);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, password);
}
if (fp != stdin)
{
@@ -358,8 +368,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
ippRead(http, response);
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
ipp_attribute_t *attr;
fprintf(stderr, "ERROR: Print file was not accepted (%04x)!\n",
response->request.status.status_code);
for (attr = response->attrs; attr != NULL; attr = attr->next)
if (attr->name != NULL)
fprintf(stderr, "ERROR: attribute \"%s\"\n", attr->name);
}
else if ((job_id = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL)
fputs("INFO: Print file accepted - job ID unknown.\n", stderr);
else
@@ -369,9 +387,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
else
{
response = NULL;
httpFlush(http);
fprintf(stderr, "ERROR: Print request was not accepted (%d)!\n", status);
if (status == HTTP_ERROR)
{
fprintf(stderr, "WARNING: Did not receive the IPP response (%d)\n",
errno);
status = HTTP_OK;
}
else
fprintf(stderr, "ERROR: Print request was not accepted (%d)!\n", status);
}
break;
@@ -392,7 +416,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (fp != stdin)
{
if (status == HTTP_OK)
fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4]));
fclose(fp);
}
/*
* Return the queue status...
+24 -9
Ver Arquivo
@@ -125,7 +125,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
fclose(fp);
}
else
strcpy(filename, argv[6]);
{
strncpy(filename, argv[6], sizeof(filename) - 1);
filename[sizeof(filename) - 1] = '\0';
}
/*
* Extract the hostname and printer name from the URI...
@@ -137,8 +140,17 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Queue the job...
*/
status = lpd_queue(hostname, resource + 1, filename,
argv[2] /* user */, atoi(argv[4]) /* copies */);
if (argc > 6)
{
status = lpd_queue(hostname, resource + 1, filename,
argv[2] /* user */, atoi(argv[4]) /* copies */);
if (!status)
fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4]));
}
else
status = lpd_queue(hostname, resource + 1, filename,
argv[2] /* user */, 1);
/*
* Remove the temporary file if necessary...
@@ -175,7 +187,7 @@ lpd_command(int fd, /* I - Socket connection to LPD host */
*/
va_start(ap, format);
bytes = vsprintf(buf, format, ap);
bytes = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
fprintf(stderr, "DEBUG: lpd_command %02.2x %s", buf[0], buf + 1);
@@ -308,19 +320,22 @@ lpd_queue(char *hostname, /* I - Host to connect to */
gethostname(localhost, sizeof(localhost));
localhost[31] = '\0'; /* RFC 1179, Section 7.2 - host name < 32 chars */
sprintf(control, "H%s\nP%s\n", localhost, user);
snprintf(control, sizeof(control), "H%s\nP%s\n", localhost, user);
cptr = control + strlen(control);
while (copies > 0)
{
sprintf(cptr, "ldfA%03.3d%s\n", getpid() % 1000, localhost);
snprintf(cptr, sizeof(control) - (cptr - control), "ldfA%03.3d%s\n",
getpid() % 1000, localhost);
cptr += strlen(cptr);
copies --;
}
sprintf(cptr, "UdfA%03.3d%s\nNdfA%03.3d%s\n",
getpid() % 1000, localhost,
getpid() % 1000, localhost);
snprintf(cptr, sizeof(control) - (cptr - control),
"UdfA%03.3d%s\nNdfA%03.3d%s\n",
getpid() % 1000, localhost,
getpid() % 1000, localhost);
fprintf(stderr, "DEBUG: Control file is:\n%s", control);
+30 -13
Ver Arquivo
@@ -63,6 +63,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int error; /* Error code (if any) */
size_t nbytes, /* Number of bytes written */
@@ -83,7 +84,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (argc == 6)
fp = stdin;
{
fp = stdin;
copies = 1;
}
else
{
/*
@@ -95,6 +99,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
}
/*
@@ -143,23 +149,34 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Finally, send the print file...
*/
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
while (copies > 0)
{
/*
* Write the print data to the printer...
*/
copies --;
if (write(fd, buffer, nbytes) < nbytes)
if (fp != stdin)
{
perror("ERROR: Unable to send print file to printer");
break;
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
}
else
tbytes += nbytes;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Write the print data to the printer...
*/
if (write(fd, buffer, nbytes) < nbytes)
{
perror("ERROR: Unable to send print file to printer");
break;
}
else
tbytes += nbytes;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
}
}
/*
+30 -13
Ver Arquivo
@@ -66,6 +66,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*ptr; /* Pointer into name or value */
int port; /* Port number (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int error; /* Error code (if any) */
size_t nbytes, /* Number of bytes written */
@@ -86,7 +87,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (argc == 6)
fp = stdin;
{
fp = stdin;
copies = 1;
}
else
{
/*
@@ -98,6 +102,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
}
/*
@@ -261,23 +267,34 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Finally, send the print file...
*/
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
while (copies > 0)
{
/*
* Write the print data to the printer...
*/
copies --;
if (write(fd, buffer, nbytes) < nbytes)
if (fp != stdin)
{
perror("ERROR: Unable to send print file to printer");
break;
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
}
else
tbytes += nbytes;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Write the print data to the printer...
*/
if (write(fd, buffer, nbytes) < nbytes)
{
perror("ERROR: Unable to send print file to printer");
break;
}
else
tbytes += nbytes;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
}
}
/*
+85 -63
Ver Arquivo
@@ -66,6 +66,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
username[255], /* Username info (not used) */
resource[1024]; /* Resource info (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int port; /* Port number */
int fd; /* AppSocket */
int error; /* Error code (if any) */
@@ -93,7 +94,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (argc == 6)
fp = stdin;
{
fp = stdin;
copies = 1;
}
else
{
/*
@@ -105,6 +109,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
}
/*
@@ -135,91 +141,107 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
addr.sin_family = hostaddr->h_addrtype;
addr.sin_port = htons(port);
for (;;)
while (copies > 0)
{
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
for (;;)
{
perror("ERROR: Unable to connect to printer");
return (1);
}
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
error = errno;
close(fd);
fd = -1;
if (error == ECONNREFUSED)
{
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in 30 seconds...\n",
hostname);
sleep(30);
}
else
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
perror("ERROR: Unable to connect to printer");
return (1);
return (1);
}
}
else
break;
}
/*
* Finally, send the print file...
*/
fputs("INFO: Connected to host, sending print job...\n", stderr);
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
error = errno;
close(fd);
fd = -1;
nbytes -= wbytes;
bufptr += wbytes;
if (error == ECONNREFUSED)
{
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in 30 seconds...\n",
hostname);
sleep(30);
}
else
{
perror("ERROR: Unable to connect to printer");
return (1);
}
}
else
break;
}
/*
* Check for possible data coming back from the printer...
* Finally, send the print file...
*/
timeout.tv_sec = 0;
timeout.tv_usec = 0;
FD_ZERO(&input);
FD_SET(fd, &input);
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
copies --;
if (fp != stdin)
{
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
}
fputs("INFO: Connected to host, sending print job...\n", stderr);
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Grab the data coming back and spit it out to stderr...
* Write the print data to the printer...
*/
if ((nbytes = recv(fd, buffer, sizeof(buffer), 0)) > 0)
fprintf(stderr, "INFO: Received %u bytes of back-channel data!\n",
nbytes);
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
/*
* Check for possible data coming back from the printer...
*/
timeout.tv_sec = 0;
timeout.tv_usec = 0;
FD_ZERO(&input);
FD_SET(fd, &input);
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
{
/*
* Grab the data coming back and spit it out to stderr...
*/
if ((nbytes = recv(fd, buffer, sizeof(buffer), 0)) > 0)
fprintf(stderr, "INFO: Received %u bytes of back-channel data!\n",
nbytes);
}
else if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
}
else if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
/*
* Close the socket connection...
*/
close(fd);
}
/*
* Close the socket connection and input file and return...
* Close the input file and return...
*/
close(fd);
if (fp != stdin)
fclose(fp);
+2 -1
Ver Arquivo
@@ -411,7 +411,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
"attributes-natural-language", NULL,
language->language);
sprintf(printer_uri, "ipp://localhost/printers/%s", printer);
snprintf(printer_uri, sizeof(printer_uri),
"ipp://localhost/printers/%s", printer);
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer_uri);
+5 -5
Ver Arquivo
@@ -219,7 +219,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
}
else
{
sprintf(resource, "ipp://localhost/printers/%s", dest);
snprintf(resource, sizeof(resource), "ipp://localhost/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, resource);
@@ -237,7 +237,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
*/
if (!longstatus)
puts("Rank\tPri Owner Job Files Total Size");
puts("Rank\tPri Owner Job Files Total Size");
jobcount = 0;
@@ -338,7 +338,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
}
printf("[job %03dlocalhost]\n", jobid);
printf("\t%-33s%d bytes\n", jobname, jobsize);
printf("\t%-32.32s %d bytes\n", jobname, jobsize);
}
else
{
@@ -350,8 +350,8 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
rank ++;
}
printf(" %-5d%-7.7s%-7d%-19s%d bytes\n", jobpriority, jobuser, jobid,
jobname, jobsize);
printf(" %-4d %-10.10s %-6d %-18.18s %d bytes\n", jobpriority, jobuser,
jobid, jobname, jobsize);
}
if (attr == NULL)
break;
+46 -4
Ver Arquivo
@@ -23,7 +23,8 @@
*
* Contents:
*
* main() - Parse options and send files for printing.
* main() - Parse options and send files for printing.
* sighandler() - Signal catcher for when we print from stdin...
*/
/*
@@ -35,6 +36,25 @@
#include <cups/cups.h>
#ifndef WIN32
# include <signal.h>
/*
* Local functions.
*/
void sighandler(void);
#endif /* !WIN32 */
/*
* Globals...
*/
char tempfile[1024]; /* Temporary file for printing from stdin */
/*
* 'main()' - Parse options and send files for printing.
*/
@@ -54,7 +74,6 @@ main(int argc, /* I - Number of command-line arguments */
cups_option_t *options; /* Options */
int silent, /* Silent or verbose output? */
deletefile; /* Delete file after print? */
char tempfile[1024]; /* Temporary file for printing from stdin */
char buffer[8192]; /* Copy buffer */
FILE *temp; /* Temporary file pointer */
@@ -190,7 +209,8 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
fprintf(stderr, "lpr: unable to print file \'%s\'.\n", argv[i]);
fprintf(stderr, "lpr: unable to print file \'%s\' - error code %x.\n",
argv[i], cupsLastError());
return (1);
}
else if (deletefile)
@@ -209,6 +229,10 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
#ifndef WIN32
signal(SIGTERM, sighandler);
#endif /* !WIN32 */
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "w");
if (temp == NULL)
@@ -238,7 +262,8 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
fputs("lpr: unable to print standard input.\n", stderr);
fprintf(stderr, "lpr: unable to print standard input - error code %x.\n",
cupsLastError());
return (1);
}
}
@@ -247,6 +272,23 @@ main(int argc, /* I - Number of command-line arguments */
}
#ifndef WIN32
/*
* 'sighandler()' - Signal catcher for when we print from stdin...
*/
void
sighandler(void)
{
/*
* Remove the temporary file we're using to print from stdin...
*/
unlink(tempfile);
}
#endif /* !WIN32 */
/*
* End of "$Id$".
*/
+21 -5
Ver Arquivo
@@ -65,6 +65,7 @@ main(int argc, /* I - Number of command-line arguments */
job_id = 0;
dest = cupsGetDefault();
response = NULL;
http = NULL;
/*
* Open a connection to the server...
@@ -146,7 +147,7 @@ main(int argc, /* I - Number of command-line arguments */
if (dest)
{
sprintf(uri, "ipp://localhost/printers/%s", dest);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
@@ -159,6 +160,9 @@ main(int argc, /* I - Number of command-line arguments */
uri);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
/*
* Do the request and get back a response...
*/
@@ -170,10 +174,22 @@ main(int argc, /* I - Number of command-line arguments */
if (response != NULL)
{
if (response->request.status.status_code == IPP_NOT_FOUND)
fputs("lprm: Job or printer not found!\n", stderr);
else if (response->request.status.status_code > IPP_OK_CONFLICT)
fputs("lprm: Unable to cancel job(s)!\n", stderr);
switch (response->request.status.status_code)
{
case IPP_NOT_FOUND :
fputs("lprm: Job or printer not found!\n", stderr);
break;
case IPP_NOT_AUTHORIZED :
fputs("lprm: Not authorized to lprm job(s)!\n", stderr);
break;
case IPP_FORBIDDEN :
fprintf(stderr, "lprm: You don't own job ID %d!\n", job_id);
break;
default :
if (response->request.status.status_code > IPP_OK_CONFLICT)
fputs("lprm: Unable to lprm job(s)!\n", stderr);
break;
}
ippDelete(response);
}
+13 -12
Ver Arquivo
@@ -105,12 +105,12 @@ main(int argc, /* I - Number of command-line arguments */
puts("<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"/cups.css\">");
puts("<MAP NAME=\"navbar\">");
#ifdef ESPPRINTPRO
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,76,30\" HREF=\"printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"88,10,158,30\" HREF=\"classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"170,10,210,30\" HREF=\"jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"222,10,354,30\" HREF=\"documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"366,10,442,30\" HREF=\"http://www.easysw.com/printpro/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"454,10,530,30\" HREF=\"http://www.easysw.com/printpro/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,76,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"88,10,158,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"170,10,210,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"222,10,354,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"366,10,442,30\" HREF=\"http://www.easysw.com/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"454,10,530,30\" HREF=\"http://www.easysw.com/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
#else
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,85,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
@@ -216,7 +216,7 @@ show_class_list(http_t *http, /* I - HTTP connection */
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/classes/")) != NULL)
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Loop through the classes returned in the list and display
@@ -297,7 +297,7 @@ show_class_info(http_t *http,
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
sprintf(uri, "ipp://localhost/classes/%s", name);
snprintf(uri, sizeof(uri), "ipp://localhost/classes/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
@@ -305,7 +305,7 @@ show_class_info(http_t *http,
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, uri + 15)) == NULL)
if ((response = cupsDoRequest(http, request, "/")) == NULL)
{
puts("<P>Unable to communicate with CUPS server!");
return;
@@ -341,7 +341,8 @@ show_class_info(http_t *http,
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
strcpy(uri, "http:");
strcpy(uri + 5, strchr(attr->values[0].string.text, '/'));
strncpy(uri + 5, strchr(attr->values[0].string.text, '/'), sizeof(uri) - 6);
uri[sizeof(uri) - 1] = '\0';
}
/*
@@ -397,11 +398,11 @@ show_class_info(http_t *http,
"attributes-natural-language", NULL,
language->language);
sprintf(uri, "ipp://localhost/printers/%s", name);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
jobs = cupsDoRequest(http, request, uri + 15);
jobs = cupsDoRequest(http, request, "/");
}
else
jobs = NULL;
+9 -10
Ver Arquivo
@@ -105,12 +105,12 @@ main(int argc, /* I - Number of command-line arguments */
puts("<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"/cups.css\">");
puts("<MAP NAME=\"navbar\">");
#ifdef ESPPRINTPRO
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,76,30\" HREF=\"printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"88,10,158,30\" HREF=\"classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,76,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"88,10,158,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"170,10,210,30\" HREF=\"jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"222,10,354,30\" HREF=\"documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"366,10,442,30\" HREF=\"http://www.easysw.com/printpro/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"454,10,530,30\" HREF=\"http://www.easysw.com/printpro/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"222,10,354,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"366,10,442,30\" HREF=\"http://www.easysw.com/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"454,10,530,30\" HREF=\"http://www.easysw.com/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
#else
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,85,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
@@ -217,7 +217,7 @@ show_job_list(http_t *http, /* I - HTTP connection */
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/jobs/")) != NULL)
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Do a table for the jobs...
@@ -386,14 +386,14 @@ show_job_info(http_t *http, /* I - Server connection */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
sprintf(uri, "ipp://localhost/jobs/%s", name);
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, uri + 15)) == NULL)
if ((response = cupsDoRequest(http, request, "/")) == NULL)
{
puts("<P>Unable to communicate with CUPS server!");
return;
@@ -507,8 +507,7 @@ show_job_info(http_t *http, /* I - Server connection */
for (attr = response->attrs; attr != NULL; attr = attr->next)
{
if (attr->group_tag != IPP_TAG_JOB &&
attr->group_tag != IPP_TAG_EXTENSION)
if (attr->group_tag != IPP_TAG_JOB)
continue;
if (strcmp(attr->name, "job-uri") == 0 ||
+13 -12
Ver Arquivo
@@ -105,12 +105,12 @@ main(int argc, /* I - Number of command-line arguments */
puts("<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"/cups.css\">");
puts("<MAP NAME=\"navbar\">");
#ifdef ESPPRINTPRO
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,76,30\" HREF=\"printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"88,10,158,30\" HREF=\"classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"170,10,210,30\" HREF=\"jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"222,10,354,30\" HREF=\"documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"366,10,442,30\" HREF=\"http://www.easysw.com/printpro/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"454,10,530,30\" HREF=\"http://www.easysw.com/printpro/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,76,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"88,10,158,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"170,10,210,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"222,10,354,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"366,10,442,30\" HREF=\"http://www.easysw.com/software.html\" ALT=\"Download the Current ESP Print Pro Software\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"454,10,530,30\" HREF=\"http://www.easysw.com/support.html\" ALT=\"Get Tech Support for Current ESP Print Pro\">");
#else
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,85,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
@@ -216,7 +216,7 @@ show_printer_list(http_t *http, /* I - HTTP connection */
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/printers/")) != NULL)
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Loop through the printers returned in the list and display
@@ -297,7 +297,7 @@ show_printer_info(http_t *http,
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
sprintf(uri, "ipp://localhost/printers/%s", name);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
@@ -305,7 +305,7 @@ show_printer_info(http_t *http,
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, uri + 15)) == NULL)
if ((response = cupsDoRequest(http, request, "/")) == NULL)
{
puts("<P>Unable to communicate with CUPS server!");
return;
@@ -341,7 +341,8 @@ show_printer_info(http_t *http,
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
strcpy(uri, "http:");
strcpy(uri + 5, strchr(attr->values[0].string.text, '/'));
strncpy(uri + 5, strchr(attr->values[0].string.text, '/'), sizeof(uri) - 6);
uri[sizeof(uri) - 1] = '\0';
}
/*
@@ -399,11 +400,11 @@ show_printer_info(http_t *http,
"attributes-natural-language", NULL,
language->language);
sprintf(uri, "ipp://localhost/printers/%s", name);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
jobs = cupsDoRequest(http, request, uri + 15);
jobs = cupsDoRequest(http, request, "/");
}
else
jobs = NULL;
+8 -1
Ver Arquivo
@@ -28,7 +28,7 @@
* Version of software...
*/
#define CUPS_SVERSION "CUPS v1.0b9"
#define CUPS_SVERSION "CUPS v1.0.2"
/*
* Where are files stored?
@@ -82,6 +82,13 @@
#undef HAVE_STRCASECMP
#undef HAVE_STRNCASECMP
/*
* Do we have the (v)snprintf() functions?
*/
#undef HAVE_SNPRINTF
#undef HAVE_VSNPRINTF
/*
* What signal functions to use?
*/
+22 -14
Ver Arquivo
@@ -45,8 +45,8 @@ CFLAGS="${CFLAGS:=}"
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],[if eval "test x$enable_debug = xyes"; then
OPTIM="-g "
fi])
AC_ARG_ENABLE(shared, [ --disable-shared turn off shared libraries [default=no]])
if test "$disable_shared" != "yes"; then
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=yes]])
if test "$enable_shared" != "no"; then
case "$uname" in
SunOS* | UNIX_S*)
LIBCUPS="libcups.so.1"
@@ -58,7 +58,12 @@ if test "$disable_shared" != "yes"; then
LIBCUPSIMAGE="libcupsimage.sl.1"
DSO="ld -b -z +h \$@ -o"
;;
OSF1* | Linux* | FreeBSD*)
FreeBSD* | NetBSD* | OpenBSD*)
LIBCUPS="libcups.so.1"
LIBCUPSIMAGE="libcupsimage.so.1"
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
;;
OSF1* | Linux*)
LIBCUPS="libcups.so.1"
LIBCUPSIMAGE="libcupsimage.so.1"
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
@@ -120,12 +125,6 @@ fi
AC_SUBST(CAT)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(SMBCLIENT,smbclient)
if test "$SMBCLIENT" = ""; then
echo "Looking for smbclient in standard locations..."
AC_PATH_PROG(SMBCLIENT,smbclient,samba_not_detected,
/usr/samba/bin:/usr/local/samba/bin:/usr/freeware/samba/bin:/opt/samba/bin)
fi
dnl Architecture checks...
AC_C_BIGENDIAN
@@ -160,16 +159,23 @@ AC_SUBST(LIBPNG)
AC_SUBST(LIBTIFF)
AC_SUBST(LIBZ)
AC_CHECK_HEADER(jpeglib.h,
dnl AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_DEFINE(HAVE_LIBJPEG)
LIBJPEG="-ljpeg")
AC_CHECK_HEADER(png.h,
dnl AC_CHECK_HEADER(png.h,
AC_CHECK_LIB(png, png_read_info,
AC_DEFINE(HAVE_LIBPNG)
LIBPNG="-lpng")
AC_CHECK_HEADER(tiff.h,
dnl AC_CHECK_HEADER(tiff.h,
AC_CHECK_LIB(tiff, TIFFReadScanline,
AC_DEFINE(HAVE_LIBTIFF)
LIBTIFF="-ltiff")
AC_CHECK_HEADER(zlib.h,
dnl AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, deflateInit,
AC_DEFINE(HAVE_LIBZ)
LIBZ="-lz")
@@ -182,6 +188,8 @@ dnl Checks for string functions.
AC_CHECK_FUNCS(strdup)
AC_CHECK_FUNCS(strcasecmp)
AC_CHECK_FUNCS(strncasecmp)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(vsnprintf)
dnl Checks for signal functions.
AC_CHECK_FUNCS(sigset)
@@ -194,7 +202,7 @@ AC_CHECK_FUNCS(wait3)
dnl Update compiler options...
if test -n "$GXX"; then
if test -z "$OPTIM"; then
OPTIM="-O2"
OPTIM="-O2"
fi
if test $PICFLAG = 1; then
OPTIM="-fPIC $OPTIM"
+317
Ver Arquivo
@@ -0,0 +1,317 @@
#
# "$Id: cups.list 775 1999-11-04 13:35:01Z mike $"
#
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
#
# EPM can be found in the "epm" subdirectory of this distribution.
# Please report problems and fixes to "epm@easysw.com".
#
# Copyright 1997-1999 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-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
%product Common UNIX Printing System
%copyright 1993-1999 by Easy Software Products, All Rights Reserved.
%vendor Easy Software Products
%license LICENSE.cups
%readme README.cups
%version 1.0.2
%incompat printpro
%system all
# Server files
f 0555 root sys /var/cups/backend/ipp backend/ipp
l 0555 root sys /var/cups/backend/http ipp
f 4550 root sys /var/cups/backend/lpd backend/lpd
f 0555 root sys /var/cups/backend/parallel backend/parallel
f 0555 root sys /var/cups/backend/serial backend/serial
f 0555 root sys /var/cups/backend/socket backend/socket
f 0500 root sys /usr/sbin/cupsd scheduler/cupsd
f 0555 root sys /var/cups/cgi-bin/classes.cgi cgi-bin/classes.cgi
f 0555 root sys /var/cups/cgi-bin/jobs.cgi cgi-bin/jobs.cgi
f 0555 root sys /var/cups/cgi-bin/printers.cgi cgi-bin/printers.cgi
f 0555 root sys /var/cups/filter/pstoraster pstoraster/pstoraster
l 0555 root sys /var/cups/filter/pdftops pstoraster
f 0555 root sys /var/cups/filter/imagetops filter/imagetops
f 0555 root sys /var/cups/filter/pstops filter/pstops
f 0555 root sys /var/cups/filter/texttops filter/texttops
f 0555 root sys /var/cups/filter/rastertohp filter/rastertohp
f 0555 root sys /var/cups/filter/hpgltops filter/hpgltops
f 0555 root sys /var/cups/filter/imagetoraster filter/imagetoraster
# Admin commands
l 0555 root sys /usr/bin/disable /usr/sbin/accept
l 0555 root sys /usr/bin/enable /usr/sbin/accept
l 0555 root sys /usr/lib/accept /usr/sbin/accept
l 0555 root sys /usr/lib/lpadmin /usr/sbin/lpadmin
l 0555 root sys /usr/lib/reject accept
f 0555 root sys /usr/sbin/accept systemv/accept
f 0555 root sys /usr/sbin/esplicense license/esplicense
f 0555 root sys /usr/sbin/lpadmin systemv/lpadmin
f 0555 root sys /usr/sbin/lpc berkeley/lpc
l 0555 root sys /usr/sbin/reject accept
# User commands
f 0555 root sys /usr/bin/cancel systemv/cancel
f 0555 root sys /usr/bin/lp systemv/lp
f 0555 root sys /usr/bin/lpq berkeley/lpq
f 0555 root sys /usr/bin/lpr berkeley/lpr
f 0555 root sys /usr/bin/lprm berkeley/lprm
f 0555 root sys /usr/bin/lpstat systemv/lpstat
f 0555 root sys /usr/bin/lpwin gui/lpwin
# DSOs
%system hpux
f 0555 root sys /usr/lib/libcups.sl.1 cups/libcups.sl.1
l 0555 root sys /usr/lib/libcups.sl libcups.sl.1
f 0555 root sys /usr/lib/libcupsimage.sl.1 filter/libcupsimage.sl.1
l 0555 root sys /usr/lib/libcupsimage.sl libcupsimage.sl.1
%system irix-6.5
f 0555 root sys /usr/lib32/libcups.so.1 cups/libcups.so.1
l 0555 root sys /usr/lib32/libcups.so libcups.so.1
f 0555 root sys /usr/lib32/libcupsimage.so.1 filter/libcupsimage.so.1
l 0555 root sys /usr/lib32/libcupsimage.so libcupsimage.so.1
%system !irix-6.5 !hpux
f 0555 root sys /usr/lib/libcups.so.1 cups/libcups.so.1
l 0555 root sys /usr/lib/libcups.so libcups.so.1
f 0555 root sys /usr/lib/libcupsimage.so.1 filter/libcupsimage.so.1
l 0555 root sys /usr/lib/libcupsimage.so libcupsimage.so.1
%system all
# Directories
d 0755 root sys /var/cups/interfaces
d 0755 root sys /var/cups/logs
d 0755 root sys /var/cups/ppd
d 0755 root sys /var/cups/requests
# Data files
f 0444 root sys /usr/lib/locale/C/cups_C locale/C/cups_C
f 0444 root sys /usr/lib/locale/de/cups_de locale/de/cups_de
f 0444 root sys /usr/lib/locale/en/cups_en locale/en/cups_en
f 0444 root sys /usr/lib/locale/es/cups_es locale/es/cups_es
f 0444 root sys /usr/lib/locale/fr/cups_fr locale/fr/cups_fr
f 0444 root sys /usr/lib/locale/it/cups_it locale/it/cups_it
f 0444 root sys /usr/share/cups/data/8859-1 data/8859-1
f 0444 root sys /usr/share/cups/data/8859-14 data/8859-14
f 0444 root sys /usr/share/cups/data/8859-15 data/8859-15
f 0444 root sys /usr/share/cups/data/8859-2 data/8859-2
f 0444 root sys /usr/share/cups/data/8859-3 data/8859-3
f 0444 root sys /usr/share/cups/data/8859-4 data/8859-4
f 0444 root sys /usr/share/cups/data/8859-5 data/8859-5
f 0444 root sys /usr/share/cups/data/8859-6 data/8859-6
f 0444 root sys /usr/share/cups/data/8859-7 data/8859-7
f 0444 root sys /usr/share/cups/data/8859-8 data/8859-8
f 0444 root sys /usr/share/cups/data/8859-9 data/8859-9
f 0444 root sys /usr/share/cups/data/HPGLprolog data/HPGLprolog
f 0444 root sys /usr/share/cups/data/psglyphs data/psglyphs
f 0444 root sys /usr/share/cups/fonts/AvantGarde-Book fonts/AvantGarde-Book
f 0444 root sys /usr/share/cups/fonts/AvantGarde-BookOblique fonts/AvantGarde-BookOblique
f 0444 root sys /usr/share/cups/fonts/AvantGarde-Demi fonts/AvantGarde-Demi
f 0444 root sys /usr/share/cups/fonts/AvantGarde-DemiOblique fonts/AvantGarde-DemiOblique
f 0444 root sys /usr/share/cups/fonts/Bookman-Demi fonts/Bookman-Demi
f 0444 root sys /usr/share/cups/fonts/Bookman-DemiItalic fonts/Bookman-DemiItalic
f 0444 root sys /usr/share/cups/fonts/Bookman-Light fonts/Bookman-Light
f 0444 root sys /usr/share/cups/fonts/Bookman-LightItalic fonts/Bookman-LightItalic
f 0444 root sys /usr/share/cups/fonts/Courier fonts/Courier
f 0444 root sys /usr/share/cups/fonts/Courier-Bold fonts/Courier-Bold
f 0444 root sys /usr/share/cups/fonts/Courier-BoldOblique fonts/Courier-BoldOblique
f 0444 root sys /usr/share/cups/fonts/Courier-Oblique fonts/Courier-Oblique
f 0444 root sys /usr/share/cups/fonts/Helvetica fonts/Helvetica
f 0444 root sys /usr/share/cups/fonts/Helvetica-Bold fonts/Helvetica-Bold
f 0444 root sys /usr/share/cups/fonts/Helvetica-BoldOblique fonts/Helvetica-BoldOblique
f 0444 root sys /usr/share/cups/fonts/Helvetica-Narrow fonts/Helvetica-Narrow
f 0444 root sys /usr/share/cups/fonts/Helvetica-Narrow-Bold fonts/Helvetica-Narrow-Bold
f 0444 root sys /usr/share/cups/fonts/Helvetica-Narrow-BoldOblique fonts/Helvetica-Narrow-BoldOblique
f 0444 root sys /usr/share/cups/fonts/Helvetica-Narrow-Oblique fonts/Helvetica-Narrow-Oblique
f 0444 root sys /usr/share/cups/fonts/Helvetica-Oblique fonts/Helvetica-Oblique
f 0444 root sys /usr/share/cups/fonts/NewCenturySchlbk-Bold fonts/NewCenturySchlbk-Bold
f 0444 root sys /usr/share/cups/fonts/NewCenturySchlbk-BoldItalic fonts/NewCenturySchlbk-BoldItalic
f 0444 root sys /usr/share/cups/fonts/NewCenturySchlbk-Italic fonts/NewCenturySchlbk-Italic
f 0444 root sys /usr/share/cups/fonts/NewCenturySchlbk-Roman fonts/NewCenturySchlbk-Roman
f 0444 root sys /usr/share/cups/fonts/Palatino-Bold fonts/Palatino-Bold
f 0444 root sys /usr/share/cups/fonts/Palatino-BoldItalic fonts/Palatino-BoldItalic
f 0444 root sys /usr/share/cups/fonts/Palatino-Italic fonts/Palatino-Italic
f 0444 root sys /usr/share/cups/fonts/Palatino-Roman fonts/Palatino-Roman
f 0444 root sys /usr/share/cups/fonts/Symbol fonts/Symbol
f 0444 root sys /usr/share/cups/fonts/Times-Bold fonts/Times-Bold
f 0444 root sys /usr/share/cups/fonts/Times-BoldItalic fonts/Times-BoldItalic
f 0444 root sys /usr/share/cups/fonts/Times-Italic fonts/Times-Italic
f 0444 root sys /usr/share/cups/fonts/Times-Roman fonts/Times-Roman
f 0444 root sys /usr/share/cups/fonts/Utopia-Bold fonts/Utopia-Bold
f 0444 root sys /usr/share/cups/fonts/Utopia-BoldItalic fonts/Utopia-BoldItalic
f 0444 root sys /usr/share/cups/fonts/Utopia-Italic fonts/Utopia-Italic
f 0444 root sys /usr/share/cups/fonts/Utopia-Regular fonts/Utopia-Regular
f 0444 root sys /usr/share/cups/fonts/ZapfChancery-MediumItalic fonts/ZapfChancery-MediumItalic
f 0444 root sys /usr/share/cups/fonts/ZapfDingbats fonts/ZapfDingbats
f 0444 root sys /usr/share/cups/pstoraster/Fontmap pstoraster/Fontmap
f 0444 root sys /usr/share/cups/pstoraster/gs_l2img.ps pstoraster/gs_l2img.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_pfile.ps pstoraster/gs_pfile.ps
f 0444 root sys /usr/share/cups/pstoraster/pfbtogs.ps pstoraster/pfbtogs.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_wl1_e.ps pstoraster/gs_wl1_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_wl2_e.ps pstoraster/gs_wl2_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_wl5_e.ps pstoraster/gs_wl5_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_wan_e.ps pstoraster/gs_wan_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_pdf_e.ps pstoraster/gs_pdf_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_sym_e.ps pstoraster/gs_sym_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_std_e.ps pstoraster/gs_std_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_dbt_e.ps pstoraster/gs_dbt_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_mex_e.ps pstoraster/gs_mex_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_mro_e.ps pstoraster/gs_mro_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_iso_e.ps pstoraster/gs_iso_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_ksb_e.ps pstoraster/gs_ksb_e.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_ttf.ps pstoraster/gs_ttf.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_pdf.ps pstoraster/gs_pdf.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_ccfnt.ps pstoraster/gs_ccfnt.ps
f 0444 root sys /usr/share/cups/pstoraster/pdf_sec.ps pstoraster/pdf_sec.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_res.ps pstoraster/gs_res.ps
f 0444 root sys /usr/share/cups/pstoraster/pdf_base.ps pstoraster/pdf_base.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_btokn.ps pstoraster/gs_btokn.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_diskf.ps pstoraster/gs_diskf.ps
f 0444 root sys /usr/share/cups/pstoraster/pdf_2ps.ps pstoraster/pdf_2ps.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_init.ps pstoraster/gs_init.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_kanji.ps pstoraster/gs_kanji.ps
f 0444 root sys /usr/share/cups/pstoraster/pdf_draw.ps pstoraster/pdf_draw.ps
f 0444 root sys /usr/share/cups/pstoraster/pdf_font.ps pstoraster/pdf_font.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_type1.ps pstoraster/gs_type1.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_fonts.ps pstoraster/gs_fonts.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_statd.ps pstoraster/gs_statd.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_lev2.ps pstoraster/gs_lev2.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_typ42.ps pstoraster/gs_typ42.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_pdfwr.ps pstoraster/gs_pdfwr.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_cidfn.ps pstoraster/gs_cidfn.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_cmdl.ps pstoraster/gs_cmdl.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_dps1.ps pstoraster/gs_dps1.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_setpd.ps pstoraster/gs_setpd.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_cmap.ps pstoraster/gs_cmap.ps
f 0444 root sys /usr/share/cups/pstoraster/gs_fform.ps pstoraster/gs_fform.ps
f 0444 root sys /usr/share/cups/pstoraster/pdf_main.ps pstoraster/pdf_main.ps
f 0444 root sys /usr/share/cups/model/deskjet.ppd ppd/deskjet.ppd
f 0444 root sys /usr/share/cups/model/laserjet.ppd ppd/laserjet.ppd
# Config files
c 0644 root sys /var/cups/conf/classes.conf conf/classes.conf
c 0644 root sys /var/cups/conf/cupsd.conf conf/cupsd.conf
f 0644 root sys /var/cups/conf/mime.convs conf/mime.convs
f 0644 root sys /var/cups/conf/mime.types conf/mime.types
c 0644 root sys /var/cups/conf/printers.conf conf/printers.conf
# Dummy printcap file for Digital UNIX and Linux...
%system dunix linux
f 0644 root sys /etc/printcap conf/printcap
%system all
# Developer files
f 0444 root sys /usr/include/cups/cups.h cups/cups.h
f 0444 root sys /usr/include/cups/http.h cups/http.h
f 0444 root sys /usr/include/cups/ipp.h cups/ipp.h
f 0444 root sys /usr/include/cups/language.h cups/language.h
f 0444 root sys /usr/include/cups/mime.h cups/mime.h
f 0444 root sys /usr/include/cups/ppd.h cups/ppd.h
f 0444 root sys /usr/include/cups/raster.h cups/raster.h
%system irix-6.5
f 0444 root sys /usr/lib32/libcups.a cups/libcups.a
%system !irix-6.5
f 0444 root sys /usr/lib/libcups.a cups/libcups.a
%system all
# Documentation files
f 0444 root sys /usr/share/cups/doc/cmp.html doc/cmp.html
f 0444 root sys /usr/share/cups/doc/cmp.pdf doc/cmp.pdf
f 0444 root sys /usr/share/cups/doc/cupsdoc.css doc/cupsdoc.css
f 0444 root sys /usr/share/cups/doc/cups.css doc/cups.css
f 0444 root sys /usr/share/cups/doc/documentation.html doc/documentation.html
f 0444 root sys /usr/share/cups/doc/idd.html doc/idd.html
f 0444 root sys /usr/share/cups/doc/idd.pdf doc/idd.pdf
f 0444 root sys /usr/share/cups/doc/images/classes.gif doc/images/classes.gif
f 0444 root sys /usr/share/cups/doc/images/cups-bar.gif doc/images/cups-bar.gif
f 0444 root sys /usr/share/cups/doc/images/cups-block-diagram.gif doc/images/cups-block-diagram.gif
f 0444 root sys /usr/share/cups/doc/images/cups-large.gif doc/images/cups-large.gif
f 0444 root sys /usr/share/cups/doc/images/cups-medium.gif doc/images/cups-medium.gif
f 0444 root sys /usr/share/cups/doc/images/cups-small.gif doc/images/cups-small.gif
f 0444 root sys /usr/share/cups/doc/images/logo.gif doc/images/logo.gif
f 0444 root sys /usr/share/cups/doc/images/navbar.gif doc/images/navbar.gif
f 0444 root sys /usr/share/cups/doc/images/printer-idle.gif doc/images/printer-idle.gif
f 0444 root sys /usr/share/cups/doc/images/printer-processing.gif doc/images/printer-processing.gif
f 0444 root sys /usr/share/cups/doc/images/printer-stopped.gif doc/images/printer-stopped.gif
f 0444 root sys /usr/share/cups/doc/index.html doc/index.html
f 0444 root sys /usr/share/cups/doc/overview.html doc/overview.html
f 0444 root sys /usr/share/cups/doc/overview.pdf doc/overview.pdf
f 0444 root sys /usr/share/cups/doc/sam.html doc/sam.html
f 0444 root sys /usr/share/cups/doc/sam.pdf doc/sam.pdf
f 0444 root sys /usr/share/cups/doc/sdd.html doc/sdd.html
f 0444 root sys /usr/share/cups/doc/sdd.pdf doc/sdd.pdf
f 0444 root sys /usr/share/cups/doc/ssr.html doc/ssr.html
f 0444 root sys /usr/share/cups/doc/ssr.pdf doc/ssr.pdf
f 0444 root sys /usr/share/cups/doc/stp.html doc/stp.html
f 0444 root sys /usr/share/cups/doc/stp.pdf doc/stp.pdf
f 0444 root sys /usr/share/cups/doc/sum.html doc/sum.html
f 0444 root sys /usr/share/cups/doc/sum.pdf doc/sum.pdf
f 0444 root sys /usr/share/cups/doc/svd.html doc/svd.html
f 0444 root sys /usr/share/cups/doc/svd.pdf doc/svd.pdf
# Man pages
%system irix
f 0444 root sys /usr/share/catman/a_man/cat1/accept.z man/accept.z
l 0444 root sys /usr/share/catman/a_man/cat1/reject.z accept.z
f 0444 root sys /usr/share/catman/u_man/cat1/backend.z man/backend.z
f 0444 root sys /usr/share/catman/u_man/cat5/classes.conf.z man/classes.conf.z
f 0444 root sys /usr/share/catman/u_man/cat5/cupsd.conf.z man/cupsd.conf.z
f 0444 root sys /usr/share/catman/a_man/cat1/cupsd.z man/cupsd.z
f 0444 root sys /usr/share/catman/a_man/cat1/enable.z man/enable.z
l 0444 root sys /usr/share/catman/a_man/cat1/disable.z enable.z
f 0444 root sys /usr/share/catman/u_man/cat1/filter.z man/filter.z
f 0444 root sys /usr/share/catman/a_man/cat1/lpadmin.z man/lpadmin.z
f 0444 root sys /usr/share/catman/a_man/cat1/lpc.z man/lpc.z
f 0444 root sys /usr/share/catman/u_man/cat1/lprm.z man/lprm.z
f 0444 root sys /usr/share/catman/u_man/cat1/lpr.z man/lpr.z
f 0444 root sys /usr/share/catman/u_man/cat1/lpstat.z man/lpstat.z
f 0444 root sys /usr/share/catman/u_man/cat1/lp.z man/lp.z
l 0444 root sys /usr/share/catman/u_man/cat1/cancel.z lp.z
f 0444 root sys /usr/share/catman/u_man/cat5/mime.convs.z man/mime.convs.z
f 0444 root sys /usr/share/catman/u_man/cat5/mime.types.z man/mime.types.z
f 0444 root sys /usr/share/catman/u_man/cat5/printers.conf.z man/printers.conf.z
%system !irix
f 0444 root sys /usr/man/man8/accept.8 man/accept.8
l 0444 root sys /usr/man/man8/reject.8 accept.8
f 0444 root sys /usr/man/man1/backend.1 man/backend.1
f 0444 root sys /usr/man/man1/classes.conf.5 man/classes.conf.5
f 0444 root sys /usr/man/man8/cupsd.8 man/cupsd.8
f 0444 root sys /usr/man/man5/cupsd.conf.5 man/cupsd.conf.5
f 0444 root sys /usr/man/man8/enable.8 man/enable.8
l 0444 root sys /usr/man/man8/disable.8 enable.8
f 0444 root sys /usr/man/man1/filter.1 man/filter.1
f 0444 root sys /usr/man/man8/lpadmin.8 man/lpadmin.8
f 0444 root sys /usr/man/man8/lpc.8 man/lpc.8
f 0444 root sys /usr/man/man1/lprm.1 man/lprm.1
f 0444 root sys /usr/man/man1/lpr.1 man/lpr.1
f 0444 root sys /usr/man/man1/lpstat.1 man/lpstat.1
f 0444 root sys /usr/man/man1/lp.1 man/lp.1
l 0444 root sys /usr/man/man1/cancel.1 lp.1
f 0444 root sys /usr/man/man5/mime.convs.5 man/mime.convs.5
f 0444 root sys /usr/man/man5/mime.types.5 man/mime.types.5
f 0444 root sys /usr/man/man5/printers.conf.5 man/printers.conf.5
# Startup script
%system all
i 0555 root sys cups cups.sh
#
# End of "$Id: cups.list 775 1999-11-04 13:35:01Z mike $".
#
+5
Ver Arquivo
@@ -64,6 +64,11 @@ case "`uname`" in
;;
esac
# Change to the root directory first, in case we are being run from a
# CD-ROM installation script...
cd /
# Start or stop the CUPS server based upon the first argument to the script.
case $1 in
start | restart | reload)
+25 -200
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: cups.spec 695 1999-09-27 18:24:36Z mike $"
# "$Id: cups.spec 775 1999-11-04 13:35:01Z mike $"
#
# RPM "spec" file for the Common UNIX Printing System (CUPS).
#
@@ -26,11 +26,11 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.0b10
Version: 1.0.2
Release: 0
Copyright: GPL
Group: System Environment/Daemons
Source: ftp://ftp.easysw.com/pub/cups/beta/cups-1.0b10-source.tar.gz
Source: ftp://ftp.easysw.com/pub/cups/1.0.2/cups-1.0.2-source.tar.gz
Url: http://www.cups.org
Packager: Michael Sweet <mike@easysw.com>
Vendor: Easy Software Products
@@ -80,16 +80,22 @@ mkdir -p $RPM_BUILD_ROOT/usr/share/locale
mkdir -p $RPM_BUILD_ROOT/var/cups
mkdir -p $RPM_BUILD_ROOT/var/cups/conf
mkdir -p $RPM_BUILD_ROOT/var/cups/logs
mkdir -p $RPM_BUILD_ROOT/var/logs
mkdir -p $RPM_BUILD_ROOT/var/log
ln -sf /var/cups/logs $RPM_BUILD_ROOT/var/logs/cups
ln -sf /var/cups/logs $RPM_BUILD_ROOT/var/log/cups
ln -sf /var/cups/conf $RPM_BUILD_ROOT/etc/cups
make prefix=$RPM_BUILD_ROOT/usr DATADIR=$RPM_BUILD_ROOT/usr/share/cups LOCALEDIR=$RPM_BUILD_ROOT/usr/share/locale SERVERROOT=$RPM_BUILD_ROOT/var/cups install
$RPM_BUILD_ROOT/etc/rc.d/init.d/cups
install -m 755 -o root -g root cups.sh $RPM_BUILD_ROOT/etc/rc.d/init.d/cups
ln -sf /usr/sbin/accept $RPM_BUILD_ROOT/usr/bin/disable
ln -sf /usr/sbin/accept $RPM_BUILD_ROOT/usr/bin/enable
ln -sf /usr/sbin/accept $RPM_BUILD_ROOT/usr/lib/accept
ln -sf /usr/sbin/accept $RPM_BUILD_ROOT/usr/lib/reject
ln -sf /usr/sbin/accept $RPM_BUILD_ROOT/usr/sbin/reject
ln -sf /usr/sbin/lpadmin $RPM_BUILD_ROOT/usr/lib/lpadmin
%post
/sbin/chkconfig --add cups
@@ -101,209 +107,28 @@ rm -rf $RPM_BUILD_ROOT
%files
/etc/rc.d/init.d/cups
%config /var/cups/conf/classes.conf
%config /var/cups/conf/cupsd.conf
%config /var/cups/conf/mime.convs
%config /var/cups/conf/mime.types
%config /var/cups/conf/printers.conf
/usr/bin/lpr
/usr/bin/lprm
/usr/bin/disable
/usr/bin/enable
/usr/bin/cancel
/usr/bin/lp
/usr/bin/lpstat
/usr/lib/accept
/usr/lib/libcups.so.1
/usr/lib/libcupsimage.so.1
/usr/lib/lpadmin
/usr/lib/reject
/usr/man/man1/backend.1
/usr/man/man1/filter.1
/usr/man/man1/lprm.1
/usr/man/man1/lpr.1
/usr/man/man1/lpstat.1
/usr/man/man1/lp.1
/usr/man/man1/cancel.1
/usr/man/man5/classes.conf.5
/usr/man/man5/cupsd.conf.5
/usr/man/man5/mime.convs.5
/usr/man/man5/mime.types.5
/usr/man/man5/printers.conf.5
/usr/man/man8/accept.8
/usr/man/man8/cupsd.8
/usr/man/man8/enable.8
/usr/man/man8/lpadmin.8
/usr/man/man8/lpc.8
/usr/man/man8/reject.8
/usr/man/man8/disable.8
/usr/sbin/accept
/usr/sbin/cupsd
/usr/sbin/lpadmin
/usr/sbin/lpc
/usr/sbin/reject
%config /var/cups/conf/*
/usr/bin/*
/usr/lib/*
/usr/man/*
/usr/sbin/*
%dir /usr/share/cups
/usr/share/cups/data/8859-1
/usr/share/cups/data/8859-14
/usr/share/cups/data/8859-15
/usr/share/cups/data/8859-2
/usr/share/cups/data/8859-3
/usr/share/cups/data/8859-4
/usr/share/cups/data/8859-5
/usr/share/cups/data/8859-6
/usr/share/cups/data/8859-7
/usr/share/cups/data/8859-8
/usr/share/cups/data/8859-9
/usr/share/cups/data/HPGLprolog
/usr/share/cups/data/psglyphs
/usr/share/cups/doc/cmp.html
/usr/share/cups/doc/cmp.pdf
/usr/share/cups/doc/cups.css
/usr/share/cups/doc/cupsdoc.css
/usr/share/cups/doc/documentation.html
/usr/share/cups/doc/idd.html
/usr/share/cups/doc/idd.pdf
/usr/share/cups/doc/images/classes.gif
/usr/share/cups/doc/images/cups-block-diagram.gif
/usr/share/cups/doc/images/cups-large.gif
/usr/share/cups/doc/images/cups-medium.gif
/usr/share/cups/doc/images/cups-small.gif
/usr/share/cups/doc/images/logo.gif
/usr/share/cups/doc/images/navbar.gif
/usr/share/cups/doc/images/printer-idle.gif
/usr/share/cups/doc/images/printer-processing.gif
/usr/share/cups/doc/images/printer-stopped.gif
/usr/share/cups/doc/index.html
/usr/share/cups/doc/overview.html
/usr/share/cups/doc/overview.pdf
/usr/share/cups/doc/sam.html
/usr/share/cups/doc/sam.pdf
/usr/share/cups/doc/sdd.html
/usr/share/cups/doc/sdd.pdf
/usr/share/cups/doc/ssr.html
/usr/share/cups/doc/ssr.pdf
/usr/share/cups/doc/stp.html
/usr/share/cups/doc/stp.pdf
/usr/share/cups/doc/sum.html
/usr/share/cups/doc/sum.pdf
/usr/share/cups/doc/svd.html
/usr/share/cups/doc/svd.pdf
/usr/share/cups/fonts/AvantGarde-Book
/usr/share/cups/fonts/AvantGarde-BookOblique
/usr/share/cups/fonts/AvantGarde-Demi
/usr/share/cups/fonts/AvantGarde-DemiOblique
/usr/share/cups/fonts/Bookman-Demi
/usr/share/cups/fonts/Bookman-DemiItalic
/usr/share/cups/fonts/Bookman-Light
/usr/share/cups/fonts/Bookman-LightItalic
/usr/share/cups/fonts/Courier
/usr/share/cups/fonts/Courier-Bold
/usr/share/cups/fonts/Courier-BoldOblique
/usr/share/cups/fonts/Courier-Oblique
/usr/share/cups/fonts/Helvetica
/usr/share/cups/fonts/Helvetica-Bold
/usr/share/cups/fonts/Helvetica-BoldOblique
/usr/share/cups/fonts/Helvetica-Narrow
/usr/share/cups/fonts/Helvetica-Narrow-Bold
/usr/share/cups/fonts/Helvetica-Narrow-BoldOblique
/usr/share/cups/fonts/Helvetica-Narrow-Oblique
/usr/share/cups/fonts/Helvetica-Oblique
/usr/share/cups/fonts/NewCenturySchlbk-Bold
/usr/share/cups/fonts/NewCenturySchlbk-BoldItalic
/usr/share/cups/fonts/NewCenturySchlbk-Italic
/usr/share/cups/fonts/NewCenturySchlbk-Roman
/usr/share/cups/fonts/Palatino-Bold
/usr/share/cups/fonts/Palatino-BoldItalic
/usr/share/cups/fonts/Palatino-Italic
/usr/share/cups/fonts/Palatino-Roman
/usr/share/cups/fonts/Symbol
/usr/share/cups/fonts/Times-Bold
/usr/share/cups/fonts/Times-BoldItalic
/usr/share/cups/fonts/Times-Italic
/usr/share/cups/fonts/Times-Roman
/usr/share/cups/fonts/Utopia-Bold
/usr/share/cups/fonts/Utopia-BoldItalic
/usr/share/cups/fonts/Utopia-Italic
/usr/share/cups/fonts/Utopia-Regular
/usr/share/cups/fonts/ZapfChancery-MediumItalic
/usr/share/cups/fonts/ZapfDingbats
/usr/share/cups/model/deskjet.ppd
/usr/share/cups/model/laserjet.ppd
/usr/share/cups/pstoraster/Fontmap
/usr/share/cups/pstoraster/gs_btokn.ps
/usr/share/cups/pstoraster/gs_ccfnt.ps
/usr/share/cups/pstoraster/gs_cidfn.ps
/usr/share/cups/pstoraster/gs_cmap.ps
/usr/share/cups/pstoraster/gs_cmdl.ps
/usr/share/cups/pstoraster/gs_dbt_e.ps
/usr/share/cups/pstoraster/gs_diskf.ps
/usr/share/cups/pstoraster/gs_dps1.ps
/usr/share/cups/pstoraster/gs_fform.ps
/usr/share/cups/pstoraster/gs_fonts.ps
/usr/share/cups/pstoraster/gs_init.ps
/usr/share/cups/pstoraster/gs_iso_e.ps
/usr/share/cups/pstoraster/gs_kanji.ps
/usr/share/cups/pstoraster/gs_ksb_e.ps
/usr/share/cups/pstoraster/gs_l2img.ps
/usr/share/cups/pstoraster/gs_lev2.ps
/usr/share/cups/pstoraster/gs_mex_e.ps
/usr/share/cups/pstoraster/gs_mro_e.ps
/usr/share/cups/pstoraster/gs_pdf.ps
/usr/share/cups/pstoraster/gs_pdf_e.ps
/usr/share/cups/pstoraster/gs_pdfwr.ps
/usr/share/cups/pstoraster/gs_pfile.ps
/usr/share/cups/pstoraster/gs_res.ps
/usr/share/cups/pstoraster/gs_setpd.ps
/usr/share/cups/pstoraster/gs_statd.ps
/usr/share/cups/pstoraster/gs_std_e.ps
/usr/share/cups/pstoraster/gs_sym_e.ps
/usr/share/cups/pstoraster/gs_ttf.ps
/usr/share/cups/pstoraster/gs_typ42.ps
/usr/share/cups/pstoraster/gs_type1.ps
/usr/share/cups/pstoraster/gs_wan_e.ps
/usr/share/cups/pstoraster/gs_wl1_e.ps
/usr/share/cups/pstoraster/gs_wl2_e.ps
/usr/share/cups/pstoraster/gs_wl5_e.ps
/usr/share/cups/pstoraster/pdf_2ps.ps
/usr/share/cups/pstoraster/pdf_base.ps
/usr/share/cups/pstoraster/pdf_draw.ps
/usr/share/cups/pstoraster/pdf_font.ps
/usr/share/cups/pstoraster/pdf_main.ps
/usr/share/cups/pstoraster/pdf_sec.ps
/usr/share/cups/pstoraster/pfbtogs.ps
/usr/share/cups/*
%dir /var/cups
/var/cups/backend/http
/var/cups/backend/ipp
/var/cups/backend/lpd
/var/cups/backend/parallel
/var/cups/backend/serial
/var/cups/backend/socket
/var/cups/cgi-bin/classes.cgi
/var/cups/cgi-bin/jobs.cgi
/var/cups/cgi-bin/printers.cgi
/var/cups/conf
/var/cups/filter/hpgltops
/var/cups/filter/imagetops
/var/cups/filter/imagetoraster
/var/cups/filter/pstops
/var/cups/filter/pstoraster
/var/cups/filter/rastertohp
/var/cups/filter/texttops
/var/cups/backend/*
/var/cups/cgi-bin/*
/var/cups/filter/*
%dir /var/cups/interfaces
%dir /var/cups/logs
%dir /var/cups/ppd
%dir /var/cups/requests
%dir /etc/cups
%dir /var/log/cups
%files devel
%dir /usr/include/cups
/usr/include/cups/cups.h
/usr/include/cups/http.h
/usr/include/cups/ipp.h
/usr/include/cups/language.h
/usr/include/cups/mime.h
/usr/include/cups/ppd.h
/usr/include/cups/raster.h
/usr/include/cups/*
#
# End of "$Id: cups.spec 695 1999-09-27 18:24:36Z mike $".
# End of "$Id: cups.spec 775 1999-11-04 13:35:01Z mike $".
#
+3 -2
Ver Arquivo
@@ -29,8 +29,8 @@ include ../Makedefs
#
LIBOBJS = emit.o filter.o http.o ipp.o language.o mark.o mime.o \
options.o page.o ppd.o raster.o string.o type.o usersys.o \
util.o
options.o page.o ppd.o raster.o snprintf.o string.o type.o \
usersys.o util.o
OBJS = $(LIBOBJS) testhttp.o testmime.o testppd.o
#
@@ -110,6 +110,7 @@ options.o: cups.h ../config.h ../Makedefs
page.o: ppd.h ../config.h ../Makedefs
ppd.o: language.h ppd.h ../config.h ../Makedefs
raster.o: raster.h ../config.h ../Makedefs
snprintf.o: string.h ../config.h ../Makedefs
string.o: string.h ../config.h ../Makedefs
type.o: mime.h ../config.h ../Makedefs
usersys.o: cups.h ../config.h ../Makedefs
+1
Ver Arquivo
@@ -114,6 +114,7 @@ extern int cupsGetClasses(char ***classes);
extern const char *cupsGetDefault(void);
extern const char *cupsGetPPD(const char *printer);
extern int cupsGetPrinters(char ***printers);
extern ipp_status_t cupsLastError(void);
extern int cupsPrintFile(const char *printer, const char *filename,
const char *title, int num_options,
cups_option_t *options);
+2 -2
Ver Arquivo
@@ -86,8 +86,8 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
return (-1);
}
if (strcmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 &&
strcmp(choices[i]->choice, "Custom") == 0)
if (strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 &&
strcasecmp(choices[i]->choice, "Custom") == 0)
{
/*
* Variable size; write out standard size options (this should
+4 -2
Ver Arquivo
@@ -88,7 +88,8 @@ mimeAddFilter(mime_t *mime, /* I - MIME database */
if (temp->cost > cost)
{
temp->cost = cost;
strcpy(temp->filter, filter);
strncpy(temp->filter, filter, sizeof(temp->filter) - 1);
temp->filter[sizeof(temp->filter) - 1] = '\0';
}
}
else
@@ -116,7 +117,8 @@ mimeAddFilter(mime_t *mime, /* I - MIME database */
temp->src = src;
temp->dst = dst;
temp->cost = cost;
strcpy(temp->filter, filter);
strncpy(temp->filter, filter, sizeof(temp->filter) - 1);
temp->filter[sizeof(temp->filter) - 1] = '\0';
if (mime->num_filters > 1)
qsort(mime->filters, mime->num_filters, sizeof(mime_filter_t),
+66 -42
Ver Arquivo
@@ -284,8 +284,7 @@ httpConnect(const char *host, /* I - Host to connect to */
* Copy the hostname and port and then "reconnect"...
*/
strcpy(http->hostname, host);
memset((char *)&(http->hostaddr), 0, sizeof(http->hostaddr));
strncpy(http->hostname, host, sizeof(http->hostname) - 1);
memcpy((char *)&(http->hostaddr.sin_addr), hostaddr->h_addr, hostaddr->h_length);
http->hostaddr.sin_family = hostaddr->h_addrtype;
#ifdef WIN32
@@ -381,11 +380,11 @@ httpReconnect(http_t *http) /* I - HTTP data */
void
httpSeparate(const char *uri, /* I - Universal Resource Identifier */
char *method, /* O - Method (http, https, etc.) */
char *username, /* O - Username */
char *host, /* O - Hostname */
char *method, /* O - Method [32] (http, https, etc.) */
char *username, /* O - Username [32] */
char *host, /* O - Hostname [32] */
int *port, /* O - Port number to use */
char *resource) /* O - Resource/filename */
char *resource) /* O - Resource/filename [1024] */
{
char *ptr; /* Pointer into string... */
@@ -415,7 +414,8 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
{
if ((ptr = strchr(host, '/')) != NULL)
{
strcpy(resource, ptr);
strncpy(resource, ptr, HTTP_MAX_URI - 1);
resource[HTTP_MAX_URI - 1] = '\0';
*ptr = '\0';
}
else
@@ -430,7 +430,10 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
*port = strtol(uri, (char **)&uri, 10);
if (*uri == '/')
strcpy(resource, uri);
{
strncpy(resource, uri, HTTP_MAX_URI - 1);
resource[HTTP_MAX_URI - 1] = '\0';
}
}
else
*port = 0;
@@ -440,7 +443,10 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
return;
}
else
strcpy(method, host);
{
strncpy(method, host, 31);
method[31] = '\0';
}
/*
* If the method starts with less than 2 slashes then it is a local resource...
@@ -448,7 +454,9 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
if (strncmp(uri, "//", 2) != 0)
{
strcpy(resource, uri);
strncpy(resource, uri, 1023);
resource[1023] = '\0';
username[0] = '\0';
host[0] = '\0';
*port = 0;
@@ -463,7 +471,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
uri ++;
ptr = host;
while (*uri != ':' && *uri != '@' && *uri != '/' && *uri != '\0')
while (!(*uri == ':' && isdigit(uri[1])) && *uri != '@' && *uri != '/' && *uri != '\0')
*ptr ++ = *uri ++;
*ptr = '\0';
@@ -474,9 +482,11 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* Got a username...
*/
strcpy(username, host);
strncpy(username, host, 31);
username[31] = '\0';
ptr = host;
uri ++;
while (*uri != ':' && *uri != '/' && *uri != '\0')
*ptr ++ = *uri ++;
@@ -532,7 +542,8 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
* The remaining portion is the resource string...
*/
strcpy(resource, uri);
strncpy(resource, uri, HTTP_MAX_URI - 1);
resource[HTTP_MAX_URI - 1] = '\0';
}
@@ -676,12 +687,15 @@ httpRead(http_t *http, /* I - HTTP data */
return (0);
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
http->data_remaining <= 0 &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
http->data_remaining <= 0)
{
DEBUG_puts("httpRead: Getting chunk length...");
if (httpGets(len, sizeof(len), http) == NULL)
{
DEBUG_puts("httpRead: Could not get length!");
return (0);
}
http->data_remaining = strtol(len, NULL, 16);
}
@@ -695,9 +709,7 @@ httpRead(http_t *http, /* I - HTTP data */
* data, go idle...
*/
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
httpGets(len, sizeof(len), http);
if (http->state == HTTP_POST_RECV)
@@ -739,9 +751,7 @@ httpRead(http_t *http, /* I - HTTP data */
if (http->data_remaining == 0)
{
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
httpGets(len, sizeof(len), http);
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
@@ -776,25 +786,30 @@ httpWrite(http_t *http, /* I - HTTP data */
http->activity = time(NULL);
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
{
if (httpPrintf(http, "%x\r\n", length) < 0)
return (-1);
if (length == 0)
{
/*
* A zero-length chunk ends a transfer; unless we are sending POST
* data, go idle...
*/
if (length == 0)
{
/*
* A zero-length chunk ends a transfer; unless we are sending POST
* data, go idle...
*/
if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
DEBUG_puts("httpWrite: changing states...");
return (0);
if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
if (httpPrintf(http, "\r\n") < 0)
return (-1);
return (0);
}
}
tbytes = 0;
@@ -816,9 +831,7 @@ httpWrite(http_t *http, /* I - HTTP data */
http->data_remaining -= bytes;
}
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
(http->state == HTTP_GET_SEND || http->state == HTTP_POST_RECV ||
http->state == HTTP_POST_SEND || http->state == HTTP_PUT_RECV))
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
if (httpPrintf(http, "\r\n") < 0)
return (-1);
@@ -828,6 +841,8 @@ httpWrite(http_t *http, /* I - HTTP data */
* Finished with the transfer; unless we are sending POST data, go idle...
*/
DEBUG_puts("httpWrite: changing states...");
if (http->state == HTTP_POST_RECV)
http->state ++;
else
@@ -973,7 +988,7 @@ httpPrintf(http_t *http, /* I - HTTP data */
va_start(ap, format);
bytes = vsprintf(buf, format, ap);
bytes = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
DEBUG_printf(("httpPrintf: %s", buf));
@@ -1061,7 +1076,7 @@ httpGetDateTime(const char *s) /* I - Date/time string */
int hour, min, sec; /* Time */
if (sscanf(s, "%*s%d%s%d%d:%d:%d", &day, mon, &year, &hour, &min, &sec) < 6)
if (sscanf(s, "%*s%d%15s%d%d:%d:%d", &day, mon, &year, &hour, &min, &sec) < 6)
return (0);
for (i = 0; i < 12; i ++)
@@ -1305,7 +1320,10 @@ httpEncode64(char *out, /* I - String to write to */
in ++;
if (*in == '\0')
{
*outptr ++ = '=';
break;
}
*outptr ++ = base64[((in[0] << 2) | (in[1] >> 6)) & 63];
@@ -1335,14 +1353,18 @@ httpEncode64(char *out, /* I - String to write to */
int /* O - Content length */
httpGetLength(http_t *http) /* I - HTTP data */
{
DEBUG_printf(("httpGetLength(%08x)\n", http));
if (strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked") == 0)
{
DEBUG_puts("httpGetLength: chunked request!");
http->data_encoding = HTTP_ENCODE_CHUNKED;
http->data_remaining = 0;
}
else
{
http->data_encoding = HTTP_ENCODE_LENGTH;
http->data_encoding = HTTP_ENCODE_LENGTH;
/*
* The following is a hack for HTTP servers that don't send a
@@ -1356,6 +1378,8 @@ httpGetLength(http_t *http) /* I - HTTP data */
http->data_remaining = 2147483647;
else
http->data_remaining = atoi(http->fields[HTTP_FIELD_CONTENT_LENGTH]);
DEBUG_printf(("httpGetLength: content_length = %d\n", http->data_remaining));
}
return (http->data_remaining);
+2 -4
Ver Arquivo
@@ -512,8 +512,6 @@ ippDateToTime(const ipp_uchar_t *date) /* I - RFC 1903 date info */
else
t -= date[9] * 3600 + date[10] * 60;
t -= timezone;
return (t);
}
@@ -595,7 +593,7 @@ ippFindAttribute(ipp_t *ipp, /* I - IPP request */
DEBUG_printf(("ippFindAttribute: attr = %08x, name = \'%s\'\n", attr,
attr->name));
if (attr->name != NULL && strcmp(attr->name, name) == 0 &&
if (attr->name != NULL && strcasecmp(attr->name, name) == 0 &&
(attr->value_tag == type ||
(attr->value_tag == IPP_TAG_TEXTLANG && type == IPP_TAG_TEXT) ||
(attr->value_tag == IPP_TAG_NAMELANG && type == IPP_TAG_NAME)))
@@ -803,7 +801,7 @@ ippRead(http_t *http, /* I - HTTP data */
ipp->state = IPP_DATA;
break;
}
else if (tag <= IPP_TAG_UNSUPPORTED)
else if (tag < IPP_TAG_UNSUPPORTED_VALUE)
{
/*
* Group tag... Set the current group and continue...
+2 -2
Ver Arquivo
@@ -75,8 +75,8 @@ typedef enum /**** Format tags for attribute formats... ****/
IPP_TAG_JOB,
IPP_TAG_END,
IPP_TAG_PRINTER,
IPP_TAG_EXTENSION,
IPP_TAG_UNSUPPORTED = 0x10,
IPP_TAG_UNSUPPORTED_GROUP,
IPP_TAG_UNSUPPORTED_VALUE = 0x10,
IPP_TAG_DEFAULT,
IPP_TAG_UNKNOWN,
IPP_TAG_NOVALUE,
+20 -4
Ver Arquivo
@@ -146,14 +146,29 @@ cupsLangGet(const char *language) /* I - Language or locale */
* standard POSIX locale and is copied unchanged. Otherwise the
* language string is converted from ll-cc (language-country) to ll_CC
* to match the file naming convention used by all POSIX-compliant
* operating systems.
* operating systems. Any trailing character set specification is
* dropped.
*/
if (language == NULL || language[0] == '\0' ||
strcmp(language, "POSIX") == 0)
strcpy(langname, "C");
else
strcpy(langname, language);
{
/*
* Copy the locale string over safely...
*/
strncpy(langname, language, sizeof(langname) - 1);
langname[sizeof(langname) - 1] = '\0';
/*
* Strip charset from "locale.charset"...
*/
if ((text = strchr(langname, '.')) != NULL)
*text = '\0';
}
if (strlen(langname) < 2)
strcpy(real, "C");
@@ -186,7 +201,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if ((localedir = getenv("LOCALEDIR")) == NULL)
localedir = CUPS_LOCALEDIR;
sprintf(filename, "%s/%s/cups_%s", localedir, real, real);
snprintf(filename, sizeof(filename), "%s/%s/cups_%s", localedir, real, real);
if ((fp = fopen(filename, "r")) == NULL)
if (strlen(real) > 2)
@@ -196,7 +211,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
real[2] = '\0';
sprintf(filename, "%s/%s/cups_%s", localedir, real, real);
snprintf(filename, sizeof(filename), "%s/%s/cups_%s", localedir, real,
real);
fp = fopen(filename, "r");
}
+12 -12
Ver Arquivo
@@ -117,7 +117,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
if (c1->marked)
break;
if (j == 0)
if (j == 0 || strcasecmp(c1->choice, "None") == 0)
c1 = NULL;
}
@@ -147,7 +147,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
if (c2->marked)
break;
if (j == 0)
if (j == 0 || strcasecmp(c2->choice, "None") == 0)
c2 = NULL;
}
@@ -188,7 +188,7 @@ ppdFindChoice(ppd_option_t *o, /* I - Pointer to option */
return (NULL);
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcmp(c->choice, choice) == 0)
if (strcasecmp(c->choice, choice) == 0)
return (c);
return (NULL);
@@ -239,12 +239,12 @@ ppdFindOption(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 (strcmp(o->keyword, option) == 0)
if (strcasecmp(o->keyword, option) == 0)
return (o);
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 (strcmp(o->keyword, option) == 0)
if (strcasecmp(o->keyword, option) == 0)
return (o);
}
@@ -320,7 +320,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
if (ppd == NULL)
return (0);
if (strcmp(option, "PageSize") == 0 && strncmp(choice, "Custom.", 7) == 0)
if (strcasecmp(option, "PageSize") == 0 && strncasecmp(choice, "Custom.", 7) == 0)
{
/*
* Handle variable page sizes...
@@ -334,7 +334,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
return (0);
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcmp(c->choice, choice) == 0)
if (strcasecmp(c->choice, choice) == 0)
break;
if (i)
@@ -347,23 +347,23 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
if (o->ui != PPD_UI_PICKMANY)
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
if (strcmp(c->choice, choice) != 0)
if (strcasecmp(c->choice, choice) != 0)
c->marked = 0;
if (strcmp(option, "PageSize") == 0 || strcmp(option, "PageRegion") == 0)
if (strcasecmp(option, "PageSize") == 0 || strcasecmp(option, "PageRegion") == 0)
{
/*
* Mark current page size...
*/
for (i = 0; i < ppd->num_sizes; i ++)
ppd->sizes[i].marked = strcmp(ppd->sizes[i].name, choice) == 0;
ppd->sizes[i].marked = strcasecmp(ppd->sizes[i].name, choice) == 0;
/*
* Unmark the current PageSize or PageRegion setting, as appropriate...
*/
if (strcmp(option, "PageSize") == 0)
if (strcasecmp(option, "PageSize") == 0)
{
if ((o = ppdFindOption(ppd, "PageRegion")) != NULL)
for (i = 0; i < o->num_choices; i ++)
@@ -399,7 +399,7 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */
return;
for (i = g->num_options, o = g->options; i > 0; i --, o ++)
if (strcmp(o->keyword, "PageRegion") != 0)
if (strcasecmp(o->keyword, "PageRegion") != 0)
ppdMarkOption(ppd, o->keyword, o->defchoice);
for (i = g->num_subgroups, sg = g->subgroups; i > 0; i --, sg ++)
+8 -3
Ver Arquivo
@@ -33,6 +33,9 @@
* Revision History:
*
* $Log: mime.c,v $
* Revision 1.15 1999/10/10 15:40:23 mike
* Scanf, strcpy, and sprintf security changes.
*
* Revision 1.14 1999/07/12 16:09:38 mike
* Fixed all constant arrays to use "const" modifier.
*
@@ -198,7 +201,9 @@ mimeMerge(mime_t *mime, /* I - MIME database to add to */
if (pathname == NULL)
return (NULL);
strcpy(filename, pathname);
strncpy(filename, pathname, sizeof(filename) - 1);
filename[sizeof(filename) - 1] = '\0';
pathsep = filename + strlen(filename);
if (pathsep == filename ||
(pathsep[-1] != '/' && pathsep[-1] != '\\'))
@@ -298,7 +303,7 @@ mimeMerge(mime_t *mime, /* I - MIME database to add to */
* Load a mime.types file...
*/
sprintf(filename, "%s/%s", pathname, dent->d_name);
snprintf(filename, sizeof(filename), "%s/%s", pathname, dent->d_name);
load_types(mime, filename);
}
}
@@ -318,7 +323,7 @@ mimeMerge(mime_t *mime, /* I - MIME database to add to */
* Load a mime.convs file...
*/
sprintf(filename, "%s/%s", pathname, dent->d_name);
snprintf(filename, sizeof(filename), "%s/%s", pathname, dent->d_name);
load_convs(mime, filename);
}
}
+8 -8
Ver Arquivo
@@ -62,7 +62,7 @@ cupsAddOption(const char *name, /* I - Name of option */
*/
for (i = 0, temp = *options; i < num_options; i ++, temp ++)
if (strcmp(temp->name, name) == 0)
if (strcasecmp(temp->name, name) == 0)
break;
if (i >= num_options)
@@ -140,7 +140,7 @@ cupsGetOption(const char *name, /* I - Name of option */
return (NULL);
for (i = 0; i < num_options; i ++)
if (strcmp(options[i].name, name) == 0)
if (strcasecmp(options[i].name, name) == 0)
return (options[i].value);
return (NULL);
@@ -287,7 +287,7 @@ cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
conflict = 0;
for (i = num_options; i > 0; i --, options ++)
if (strcmp(options->name, "media") == 0)
if (strcasecmp(options->name, "media") == 0)
{
/*
* Loop through the option string, separating it at commas and
@@ -324,9 +324,9 @@ cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
conflict = 1;
}
}
else if (strcmp(options->name, "sides") == 0)
else if (strcasecmp(options->name, "sides") == 0)
{
if (strcmp(options->value, "one-sided") == 0)
if (strcasecmp(options->value, "one-sided") == 0)
{
if (ppdMarkOption(ppd, "Duplex", "None"))
conflict = 1;
@@ -335,7 +335,7 @@ cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
if (ppdMarkOption(ppd, "KD03Duplex", "None")) /* Kodak */
conflict = 1;
}
else if (strcmp(options->value, "two-sided-long-edge") == 0)
else if (strcasecmp(options->value, "two-sided-long-edge") == 0)
{
if (ppdMarkOption(ppd, "Duplex", "DuplexNoTumble"))
conflict = 1;
@@ -344,7 +344,7 @@ cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
if (ppdMarkOption(ppd, "KD03Duplex", "DuplexNoTumble")) /* Kodak */
conflict = 1;
}
else if (strcmp(options->value, "two-sided-short-edge") == 0)
else if (strcasecmp(options->value, "two-sided-short-edge") == 0)
{
if (ppdMarkOption(ppd, "Duplex", "DuplexTumble"))
conflict = 1;
@@ -354,7 +354,7 @@ cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
conflict = 1;
}
}
else if (strcmp(options->name, "resolution") == 0)
else if (strcasecmp(options->name, "resolution") == 0)
{
if (ppdMarkOption(ppd, "Resolution", options->value))
conflict = 1;
+1 -1
Ver Arquivo
@@ -80,7 +80,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
*/
units[0] = '\0';
if (sscanf(name + 7, "%fx%f%s", &w, &l, units) < 2)
if (sscanf(name + 7, "%fx%f%254s", &w, &l, units) < 2)
return (NULL);
if (strcasecmp(units, "in") == 0)
+1 -1
Ver Arquivo
@@ -1028,7 +1028,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
else if (strcmp(keyword, "OrderDependency") == 0 ||
strcmp(keyword, "NonUIOrderDependency") == 0)
{
if (sscanf(string, "%f%s%s", &order, name, keyword) != 3)
if (sscanf(string, "%f%40s%40s", &order, name, keyword) != 3)
{
ppdClose(ppd);
safe_free(string);
+287
Ver Arquivo
@@ -0,0 +1,287 @@
/*
* "$Id$"
*
* snprintf functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-1999 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
*
* Contents:
*
* vsnprintf() - Format a string into a fixed size buffer.
* snprintf() - Format a string into a fixed size buffer.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <ctype.h>
#include "string.h"
#ifndef HAVE_VSNPRINTF
/*
* 'vsnprintf()' - Format a string into a fixed size buffer.
*/
int /* O - Number of bytes formatted */
vsnprintf(char *buffer, /* O - Output buffer */
size_t bufsize, /* O - Size of output buffer */
const char *format, /* I - printf-style format string */
va_list ap) /* I - Pointer to additional arguments */
{
char *bufptr, /* Pointer to position in buffer */
*bufend, /* Pointer to end of buffer */
sign, /* Sign of format width */
size, /* Size character (h, l, L) */
type; /* Format type character */
const char *bufformat; /* Start of format */
int width, /* Width of field */
prec; /* Number of characters of precision */
char tformat[100], /* Temporary format string for sprintf() */
temp[1024]; /* Buffer for formatted numbers */
int *chars; /* Pointer to integer for %p */
char *s; /* Pointer to string */
int slen; /* Length of string */
/*
* Loop through the format string, formatting as needed...
*/
bufptr = buffer;
bufend = buffer + bufsize - 1;
while (*format && bufptr < bufend)
{
if (*format == '%')
{
bufformat = format;
format ++;
if (*format == '%')
{
*bufptr++ = *format++;
continue;
}
else if (strchr(" -+#\'", *format))
sign = *format++;
else
sign = 0;
width = 0;
while (isdigit(*format))
width = width * 10 + *format++ - '0';
if (*format == '.')
{
format ++;
prec = 0;
while (isdigit(*format))
prec = prec * 10 + *format++ - '0';
}
else
prec = -1;
if (*format == 'l' && format[1] == 'l')
{
size = 'L';
format += 2;
}
else if (*format == 'h' || *format == 'l' || *format == 'L')
size = *format++;
if (!*format)
break;
type = *format++;
switch (type)
{
case 'E' : /* Floating point formats */
case 'G' :
case 'e' :
case 'f' :
case 'g' :
if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp))
break;
strncpy(tformat, bufformat, format - bufformat);
tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, double));
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
break;
case 'B' : /* Integer formats */
case 'X' :
case 'b' :
case 'd' :
case 'i' :
case 'o' :
case 'u' :
case 'x' :
if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp))
break;
strncpy(tformat, bufformat, format - bufformat);
tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, int));
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
break;
case 'p' : /* Pointer value */
if ((chars = va_arg(ap, int *)) != NULL)
*chars = bufptr - buffer;
break;
case 'c' : /* Character or character array */
if (width <= 1)
*bufptr++ = va_arg(ap, int);
else
{
if ((bufptr + width) > bufend)
width = bufend - bufptr;
memcpy(bufptr, va_arg(ap, char *), width);
bufptr += width;
}
break;
case 's' : /* String */
if ((s = va_arg(ap, char *)) == NULL)
s = "(null)";
slen = strlen(s);
if (slen > width && prec != width)
width = slen;
if ((bufptr + width) > bufend)
width = bufend - bufptr;
if (slen > width)
slen = width;
if (sign == '-')
{
strncpy(bufptr, s, slen);
memset(bufptr + slen, ' ', width - slen);
}
else
{
memset(bufptr, ' ', width - slen);
strncpy(bufptr + width - slen, s, slen);
}
bufptr += width;
break;
case 'n' : /* Output number of chars so far */
if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp))
break;
strncpy(tformat, bufformat, format - bufformat);
tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, int));
if ((bufptr + strlen(temp)) > bufend)
{
strncpy(bufptr, temp, bufend - bufptr);
bufptr = bufend;
break;
}
else
{
strcpy(bufptr, temp);
bufptr += strlen(temp);
}
break;
}
}
else
*bufptr++ = *format++;
}
/*
* Nul-terminate the string and return the number of characters in it.
*/
*bufptr = '\0';
return (bufptr - buffer);
}
#endif /* !HAVE_VSNPRINT */
#ifndef HAVE_SNPRINTF
/*
* 'snprintf()' - Format a string into a fixed size buffer.
*/
int /* O - Number of bytes formatted */
snprintf(char *buffer, /* O - Output buffer */
size_t bufsize, /* O - Size of output buffer */
const char *format, /* I - printf-style format string */
...) /* I - Additional arguments as needed */
{
int bytes; /* Number of bytes formatted */
va_list ap; /* Pointer to additional arguments */
va_start(ap, format);
bytes = vsnprintf(buffer, bufsize, format, ap);
va_end(ap);
return (bytes);
}
#endif /* !HAVE_SNPRINTF */
/*
* End of "$Id$".
*/
+28
Ver Arquivo
@@ -29,6 +29,8 @@
* Include necessary headers...
*/
# include <stdio.h>
# include <stdarg.h>
# include <config.h>
# include <string.h>
@@ -43,6 +45,15 @@
# endif /* WIN32 || __EMX__ */
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Prototypes...
*/
@@ -59,6 +70,23 @@ extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t n);
# endif /* !HAVE_STRNCASECMP */
# ifndef HAVE_SNPRINTF
extern int snprintf(char *, size_t, const char *, ...);
# endif /* !HAVE_SNPRINTF */
# ifndef HAVE_VSNPRINTF
extern int vsnprintf(char *, size_t, const char *, va_list);
# endif /* !HAVE_VSNPRINTF */
/*
* C++ magic...
*/
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_STRING_H_ */
/*
+1 -1
Ver Arquivo
@@ -104,7 +104,7 @@ main(int argc, /* I - Number of command-line args */
case 3 :
src = mimeFileType(mime, argv[1]);
sscanf(argv[2], "%[^/]/%s", super, type);
sscanf(argv[2], "%15[^/]/31%s", super, type);
dst = mimeType(mime, super, type);
filters = mimeFilter(mime, src, dst, &num_filters);
+8 -5
Ver Arquivo
@@ -108,8 +108,8 @@ mimeAddType(mime_t *mime, /* I - MIME database */
mime->num_types ++;
*types = temp;
strcpy(temp->super, super);
strcpy(temp->type, type);
strncpy(temp->super, super, sizeof(temp->super) - 1);
strncpy(temp->type, type, sizeof(temp->type) - 1);
if (mime->num_types > 1)
qsort(mime->types, mime->num_types, sizeof(mime_type_t *),
@@ -392,7 +392,7 @@ mimeAddTypeRule(mime_type_t *mt, /* I - Type to add to */
* This is just a filename match on the extension...
*/
sprintf(value[0], "*.%s", name);
snprintf(value[0], sizeof(value[0]), "*.%s", name);
length[0] = strlen(value[0]);
num_values = 1;
op = MIME_MAGIC_MATCH;
@@ -582,8 +582,11 @@ mimeType(mime_t *mime, /* I - MIME database */
* Lookup the type in the array...
*/
strcpy(key.super, super);
strcpy(key.type, type);
strncpy(key.super, super, sizeof(key.super) - 1);
key.super[sizeof(key.super) - 1] = '\0';
strncpy(key.type, type, sizeof(key.type) - 1);
key.type[sizeof(key.type) - 1] = '\0';
keyptr = &key;
match = (mime_type_t **)bsearch(&keyptr, mime->types, mime->num_types,
+129 -37
Ver Arquivo
@@ -57,7 +57,9 @@
* Local globals...
*/
static http_t *cups_server = NULL;
static http_t *cups_server = NULL; /* Current server connection */
static ipp_status_t last_error = IPP_OK; /* Last IPP error */
static char authstring[255] = ""; /* Authorization string */
/*
@@ -98,6 +100,7 @@ cupsCancelJob(const char *name, /* I - Name of printer or class */
* attributes-natural-language
* printer-uri
* job-id
* [requesting-user-name]
*/
request = ippNew();
@@ -114,21 +117,31 @@ cupsCancelJob(const char *name, /* I - Name of printer or class */
"attributes-natural-language", NULL,
language != NULL ? language->language : "C");
sprintf(uri, "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
snprintf(uri, sizeof(uri), "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
/*
* Do the request...
*/
if ((response = cupsDoRequest(cups_server, request, "/jobs/")) == NULL)
{
last_error = IPP_BAD_REQUEST;
return (0);
}
else
{
last_error = response->request.status.status_code;
ippDelete(response);
ippDelete(response);
return (1);
return (1);
}
}
@@ -152,8 +165,6 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
const char *password; /* Password string */
char plain[255], /* Plaintext username:password */
encode[255]; /* Encoded username:password */
static char authstring[255] = "";
/* Authorization string */
DEBUG_printf(("cupsDoFileRequest(%08x, %08s, \'%s\', \'%s\')\n",
@@ -260,7 +271,10 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
httpFlush(http);
if ((password = cupsGetPassword("Password:")) != NULL)
printf("Authentication required for %s on %s...\n", cupsUser(),
http->hostname);
if ((password = cupsGetPassword("UNIX Password: ")) != NULL)
{
/*
* Got a password; send it to the server...
@@ -268,9 +282,9 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
if (!password[0])
break;
sprintf(plain, "%s:%s", cupsUser(), password);
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), password);
httpEncode64(encode, plain);
sprintf(authstring, "Basic %s", encode);
snprintf(authstring, sizeof(authstring), "Basic %s", encode);
continue;
}
@@ -392,8 +406,10 @@ cupsGetClasses(char ***classes) /* O - Classes */
if ((response = cupsDoRequest(cups_server, request, "/classes/")) != NULL)
{
last_error = response->request.status.status_code;
for (attr = response->attrs; attr != NULL; attr = attr->next)
if (strcmp(attr->name, "printer-name") == 0 &&
if (strcasecmp(attr->name, "printer-name") == 0 &&
attr->value_tag == IPP_TAG_NAME)
{
if (n == 0)
@@ -413,6 +429,8 @@ cupsGetClasses(char ***classes) /* O - Classes */
ippDelete(response);
}
else
last_error = IPP_BAD_REQUEST;
return (n);
}
@@ -474,17 +492,22 @@ cupsGetDefault(void)
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(cups_server, request, "/printers/")) != NULL)
if ((response = cupsDoRequest(cups_server, request, "/")) != NULL)
{
last_error = response->request.status.status_code;
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
{
strcpy(def_printer, attr->values[0].string.text);
strncpy(def_printer, attr->values[0].string.text, sizeof(def_printer) - 1);
def_printer[sizeof(def_printer) - 1] = '\0';
ippDelete(response);
return (def_printer);
}
ippDelete(response);
}
else
last_error = IPP_BAD_REQUEST;
return (NULL);
}
@@ -503,8 +526,12 @@ cupsGetPPD(const char *name) /* I - Printer name */
char printer[HTTP_MAX_URI], /* Printer name */
hostname[HTTP_MAX_URI], /* Hostname */
resource[HTTP_MAX_URI]; /* Resource name */
static char filename[HTTP_MAX_URI]; /* Local filename */
char *tempdir; /* Temporary file directory */
const char *password; /* Password string */
char plain[255], /* Plaintext username:password */
encode[255]; /* Encoded username:password */
http_status_t status; /* HTTP status from server */
static char filename[HTTP_MAX_URI]; /* Local filename */
/*
@@ -521,31 +548,66 @@ cupsGetPPD(const char *name) /* I - Printer name */
#if defined(WIN32) || defined(__EMX__)
tempdir = "C:/WINDOWS/TEMP";
sprintf(filename, "%s/%s.ppd", tempdir, printer);
snprintf(filename, sizeof(filename), "%s/%s.ppd", tempdir, printer);
#else
if ((tempdir = getenv("TMPDIR")) == NULL)
tempdir = "/tmp";
sprintf(filename, "%s/%d.%s.ppd", tempdir, getuid(), printer);
snprintf(filename, sizeof(filename), "%s/%d.%s.ppd", tempdir, getuid(), printer);
#endif /* WIN32 || __EMX__ */
/*
* And send a request to the HTTP server...
*/
sprintf(resource, "/printers/%s.ppd", printer);
snprintf(resource, sizeof(resource), "/printers/%s.ppd", printer);
httpClearFields(cups_server);
httpSetField(cups_server, HTTP_FIELD_HOST, hostname);
httpGet(cups_server, resource);
switch (httpUpdate(cups_server))
do
{
case HTTP_OK : /* New file - get it! */
httpClearFields(cups_server);
httpSetField(cups_server, HTTP_FIELD_HOST, hostname);
httpSetField(cups_server, HTTP_FIELD_AUTHORIZATION, authstring);
if (httpGet(cups_server, resource))
{
status = HTTP_UNAUTHORIZED;
continue;
}
while ((status = httpUpdate(cups_server)) == HTTP_CONTINUE);
if (status == HTTP_UNAUTHORIZED)
{
DEBUG_puts("cupsGetPPD: unauthorized...");
/*
* Flush any error message...
*/
httpFlush(cups_server);
printf("Authentication required for %s on %s...\n", cupsUser(),
cups_server->hostname);
if ((password = cupsGetPassword("UNIX Password: ")) != NULL)
{
/*
* Got a password; send it to the server...
*/
if (!password[0])
break;
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), password);
httpEncode64(encode, plain);
snprintf(authstring, sizeof(authstring), "Basic %s", encode);
continue;
}
else
break;
default :
return (NULL);
}
}
while (status == HTTP_UNAUTHORIZED);
/*
* OK, we need to copy the file; open the file and copy it...
@@ -623,8 +685,10 @@ cupsGetPrinters(char ***printers) /* O - Printers */
if ((response = cupsDoRequest(cups_server, request, "/printers/")) != NULL)
{
last_error = response->request.status.status_code;
for (attr = response->attrs; attr != NULL; attr = attr->next)
if (strcmp(attr->name, "printer-name") == 0 &&
if (strcasecmp(attr->name, "printer-name") == 0 &&
attr->value_tag == IPP_TAG_NAME)
{
if (n == 0)
@@ -644,11 +708,24 @@ cupsGetPrinters(char ***printers) /* O - Printers */
ippDelete(response);
}
else
last_error = IPP_BAD_REQUEST;
return (n);
}
/*
* 'cupsLastError()' - Return the last IPP error that occurred.
*/
ipp_status_t /* O - IPP error code */
cupsLastError(void)
{
return (last_error);
}
/*
* 'cupsPrintFile()' - Print a file to a printer or class.
*/
@@ -704,7 +781,7 @@ cupsPrintFile(const char *name, /* I - Printer or class name */
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
sprintf(uri, "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
snprintf(uri, sizeof(uri), "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
language = cupsLangDefault();
@@ -745,7 +822,7 @@ cupsPrintFile(const char *name, /* I - Printer or class name */
* Skip the "raw" option - handled above...
*/
if (strcmp(options[i].name, "raw") == 0)
if (strcasecmp(options[i].name, "raw") == 0)
continue;
/*
@@ -789,7 +866,7 @@ cupsPrintFile(const char *name, /* I - Printer or class name */
}
else
{
if (strncmp(option, "no", 2) == 0)
if (strncasecmp(option, "no", 2) == 0)
{
option += 2;
n = 0;
@@ -829,9 +906,9 @@ cupsPrintFile(const char *name, /* I - Printer or class name */
{
n2 = strtol(s + 1, &s, 0);
if (strcmp(s, "dpc") == 0)
if (strcasecmp(s, "dpc") == 0)
ippAddResolution(request, IPP_TAG_JOB, option, IPP_RES_PER_CM, n, n2);
else if (strcmp(s, "dpi") == 0)
else if (strcasecmp(s, "dpi") == 0)
ippAddResolution(request, IPP_TAG_JOB, option, IPP_RES_PER_INCH, n, n2);
else
ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, option, NULL, val);
@@ -863,7 +940,7 @@ cupsPrintFile(const char *name, /* I - Printer or class name */
* Try printing the file...
*/
sprintf(uri, "/printers/%s", printer);
snprintf(uri, sizeof(uri), "/printers/%s", printer);
if ((response = cupsDoFileRequest(cups_server, request, uri, filename)) == NULL)
jobid = 0;
@@ -944,8 +1021,8 @@ cupsTempFile(char *filename, /* I - Pointer to buffer */
static char * /* I - Printer name or NULL */
cups_connect(const char *name, /* I - Destination (printer[@host]) */
char *printer, /* O - Printer name */
char *hostname) /* O - Hostname */
char *printer, /* O - Printer name [HTTP_MAX_URI] */
char *hostname) /* O - Hostname [HTTP_MAX_URI] */
{
char hostbuf[HTTP_MAX_URI];
/* Name of host */
@@ -954,18 +1031,30 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
if (name == NULL)
{
last_error = IPP_BAD_REQUEST;
return (NULL);
}
if (sscanf(name, "%[^@]@%s", printerbuf, hostbuf) == 1)
strcpy(hostbuf, cupsServer());
if (sscanf(name, "%1023[^@]@%1023s", printerbuf, hostbuf) == 1)
{
strncpy(hostbuf, cupsServer(), sizeof(hostbuf) - 1);
hostbuf[sizeof(hostbuf) - 1] = '\0';
}
if (hostname != NULL)
strcpy(hostname, hostbuf);
{
strncpy(hostname, hostbuf, HTTP_MAX_URI - 1);
hostname[HTTP_MAX_URI - 1] = '\0';
}
else
hostname = hostbuf;
if (printer != NULL)
strcpy(printer, printerbuf);
{
strncpy(printer, printerbuf, HTTP_MAX_URI - 1);
printer[HTTP_MAX_URI - 1] = '\0';
}
else
printer = printerbuf;
@@ -978,7 +1067,10 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
}
if ((cups_server = httpConnect(hostname, ippPort())) == NULL)
{
last_error = IPP_SERVICE_UNAVAILABLE;
return (NULL);
}
else
return (printer);
}
+2 -2
Ver Arquivo
@@ -340,7 +340,7 @@ extension of &quot;.h&quot;.
the file, the purpose or nature of the source file, the copyright and
licensing notice, and the functions contained in the file. The file
name and revision information is provided by the CVS &quot;$Id: cmp.shtml,v
1.3 1999/05/21 20:54:04 mike Exp $&quot; tag:
1.4 1999/09/22 20:06:18 mike Exp $&quot; tag:
<UL>
<PRE>
/*
@@ -376,7 +376,7 @@ name and revision information is provided by the CVS &quot;$Id: cmp.shtml,v
</PRE>
</UL>
The bottom of each source file shall contain a trailer giving the name
of the file using the CVS &quot;$Id: cmp.shtml,v 1.3 1999/05/21 20:54:04
of the file using the CVS &quot;$Id: cmp.shtml,v 1.4 1999/09/22 20:06:18
mike Exp $&quot; tag. The primary purpose of this is to mark the end of a
source file; if the trailer is missing it is possible that code has
been lost near the end of the file:
+88 -88
Ver Arquivo
@@ -1,6 +1,6 @@
%PDF-1.2
%âãÏÓ
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19990922200456Z)/Title(CUPS Configuration Management Plan)/Author(Easy Software Products)>>endobj
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19991004131140Z)/Title(CUPS Configuration Management Plan)/Author(Easy Software Products)>>endobj
2 0 obj<</Type/Encoding/BaseEncoding/WinAnsiEncoding>>endobj
3 0 obj<</Type/Font/Subtype/Type1/BaseFont/Courier/Encoding 2 0 R>>endobj
4 0 obj<</Type/Font/Subtype/Type1/BaseFont/Times-Roman/Encoding 2 0 R>>endobj
@@ -485,19 +485,19 @@ endobj
endobj
222 0 obj<</Type/Page/Parent 191 0 R/Contents 223 0 R/Resources<</ProcSet[/PDF/Text]/Font<</F0 3 0 R/F4 4 0 R/F8 7 0 R/F9 8 0 R>>>>>>endobj
223 0 obj<</Length 224 0 R/Filter/FlateDecode>>stream
VMSÛ0½çWìpjgˆ'’Þ€N/”¤\Y^'flÉ•d(ÿ¾»’çchÃ!±õôöí7¿1Œè/†«1L¦ ËÁÍjðå~ñVL¯.`•~º„¥ÎÜ«0X °h?¯žò2šìðrtÃ#k?ê2A“«uÀ_@7èñ4 o-–P#pƒ8¬„qðÒ(Oé­p˜Bò1êÔ‚Ó`°2hQ9º‹PŠgmΡÌ •B%œÜÊ‹f
d9žDc¶¨í× ms~q ¶öFÌž=òä‘çÝ9£Q4ÚõrÈT­Ÿ7èÄСu­r˜â™«”ÔçY\U…*¥xy
VMSÛ0½çWìpjgˆ'’Þ€N/”¤\Y^'flÉ•d(ÿ¾»’çchÃ!±õôöí7¿1Œè/†«1L¦ ËÁÍjðå~ñVL¯.`•~º„¥ÎÜ«0X °h?¯žò2šìðrtÃ#k?ê2A“«uÀ_@7èñ4 o-–P#pƒ8¬„qðÒ(Oé­p˜Bò1êÔ‚Ó`°2hQ9º‹PŠgmΡÌ •B%œÜÊ‹f
d9žDc¶¨í× ms~q ¶öFÌž=òä‘çÝ9£Q4ÚõrÈT­Ÿ7èÄСu­r˜â™«”ÔçY\U…*¥xy
tŽœ¿L…~
>Hê¼H›Øü¿þÄÓì{‘Ä'ü¸†ÛÇ%X%*»Ñr kTr“iH™{ƒ„¼õ Èr%ŠÖeÿÆçšè¥˜)1ÝúØKVг—3Oòš»'IQæ%Y¨t®œåz(„ $5…ÖX©©@>£—øiôÔ ÷òDLî™ÜµF%QòÆqMg¢.(LŠ~Ú¶‰l í›uXÒ4X"kgwv굉Lß3ºø{aYæíðÝ-}Š6_+Ðøæ¢3ÚƒSß#§H¥«BÁãï©9Ø=ÀÝç¸G^¦7H5!uYQʰx#DЃi×£ÿ ¢g6ø°×Ú
‘}§çÃ9ojèsŸjP_¼=¯ß!ÇŒ\¢Ô$â4 #­ŒNké¸àáã=”B°
Ô‹=ÒcWâ.zh¦Ö.ô4{ÿÊø` :ngâ.ôû¸£ÝrñÍ6™·ëe ßÂÈ¡»G÷Êvcmǭ݈Pe½ÅÍkk)ÑÚ¬.¨bÛâM»–rF×IÁd•6.‚kbÒÉ3õ×b¯FñÊÚ ÆgyñÞrŠ·¢f¸Ji•‘†’>ŠšQ~´Ó*[›fžX]Ù²§X$=¦ÑMÜ…j+Z9§öï6N.;±\à” nEI-l%í›Ø·ùö&›€E!Ô¹?.W‹!× Ü Vè™m/FRЀåêÁ¯ñ¤Ðs3?Ã2š"YZJMôÆÝYçÈtü“r1EsÂbÎÏw«ÁÏÁ_øe¼?endstream
endobj
845
endobj
224 0 obj
845
endobj
225 0 obj<</Type/Page/Parent 191 0 R/Contents 226 0 R/Resources<</ProcSet[/PDF/Text]/Font<</F4 4 0 R/F8 7 0 R/F9 8 0 R>>>>>>endobj
226 0 obj<</Length 227 0 R/Filter/FlateDecode>>stream
xÚmP½R„0îyŠ+- ǶÞh§sz¨õ^XŽ8`6Ì,,œ¤Úý~÷+QÉS°-ã×crß$·w vi
xÚmP½R„0îyŠ+- ǶÞh§sz¨õ^XŽ8`6Ì,,œ¤Úý~÷+QÉS°-ã×crß$·w vi
M'»²ªÒšöz—ðJ!ÓMó)¨”Z1›¼”¥`>z²ˆƒ±gè‘áD2Ðnœ
ÔÏZs7Ã7 Xº@k8xsšƒq̈gà=a$tÞz={O6Àþý(zíAŒÕ6Í£ñ[œ¸wá*…g“wí¬I¿Fîq„j ìºpAO¢aIj]€ ™Å4úá$“7’âXšqº¶¯Û«¢’SÕKŠýÛá{g;sž=.öOh¥Ò£´‘»Y)*Ï"IeqXäuº…ìŸC?4ÉKòc„endstream
endobj
@@ -872,89 +872,89 @@ xref
0000016725 00000 n
0000016774 00000 n
0000016823 00000 n
0000017019 00000 n
0000017068 00000 n
0000017117 00000 n
0000017166 00000 n
0000017215 00000 n
0000017264 00000 n
0000017313 00000 n
0000017362 00000 n
0000017411 00000 n
0000017460 00000 n
0000017509 00000 n
0000017558 00000 n
0000017607 00000 n
0000017656 00000 n
0000017705 00000 n
0000017754 00000 n
0000017803 00000 n
0000017852 00000 n
0000017901 00000 n
0000017950 00000 n
0000017999 00000 n
0000018260 00000 n
0000018412 00000 n
0000024803 00000 n
0000024825 00000 n
0000024938 00000 n
0000025040 00000 n
0000025060 00000 n
0000025200 00000 n
0000026140 00000 n
0000026161 00000 n
0000026274 00000 n
0000026462 00000 n
0000026483 00000 n
0000026623 00000 n
0000027230 00000 n
0000027251 00000 n
0000027364 00000 n
0000027557 00000 n
0000027578 00000 n
0000027709 00000 n
0000028322 00000 n
0000028343 00000 n
0000028456 00000 n
0000028645 00000 n
0000028666 00000 n
0000028797 00000 n
0000029741 00000 n
0000029762 00000 n
0000029893 00000 n
0000030180 00000 n
0000030201 00000 n
0000030341 00000 n
0000031257 00000 n
0000031278 00000 n
0000031409 00000 n
0000031767 00000 n
0000031788 00000 n
0000031928 00000 n
0000032424 00000 n
0000032445 00000 n
0000032576 00000 n
0000033028 00000 n
0000033049 00000 n
0000033189 00000 n
0000034329 00000 n
0000034351 00000 n
0000034491 00000 n
0000035397 00000 n
0000035418 00000 n
0000035558 00000 n
0000036484 00000 n
0000036505 00000 n
0000036645 00000 n
0000037291 00000 n
0000037312 00000 n
0000037452 00000 n
0000038272 00000 n
0000038293 00000 n
0000038433 00000 n
0000039360 00000 n
0000016872 00000 n
0000016921 00000 n
0000016970 00000 n
0000017019 00000 n
0000017068 00000 n
0000017117 00000 n
0000017166 00000 n
0000017215 00000 n
0000017264 00000 n
0000017313 00000 n
0000017362 00000 n
0000017411 00000 n
0000017460 00000 n
0000017509 00000 n
0000017558 00000 n
0000017607 00000 n
0000017656 00000 n
0000017705 00000 n
0000017754 00000 n
0000017803 00000 n
0000017852 00000 n
0000017901 00000 n
0000017950 00000 n
0000017999 00000 n
0000018260 00000 n
0000018412 00000 n
0000024803 00000 n
0000024825 00000 n
0000024938 00000 n
0000025040 00000 n
0000025060 00000 n
0000025200 00000 n
0000026140 00000 n
0000026161 00000 n
0000026274 00000 n
0000026462 00000 n
0000026483 00000 n
0000026623 00000 n
0000027230 00000 n
0000027251 00000 n
0000027364 00000 n
0000027557 00000 n
0000027578 00000 n
0000027709 00000 n
0000028322 00000 n
0000028343 00000 n
0000028456 00000 n
0000028645 00000 n
0000028666 00000 n
0000028797 00000 n
0000029741 00000 n
0000029762 00000 n
0000029893 00000 n
0000030180 00000 n
0000030201 00000 n
0000030341 00000 n
0000031257 00000 n
0000031278 00000 n
0000031409 00000 n
0000031767 00000 n
0000031788 00000 n
0000031928 00000 n
0000032424 00000 n
0000032445 00000 n
0000032576 00000 n
0000033028 00000 n
0000033049 00000 n
0000033189 00000 n
0000034329 00000 n
0000034351 00000 n
0000034491 00000 n
0000035395 00000 n
0000035416 00000 n
0000035556 00000 n
0000036482 00000 n
0000036503 00000 n
0000036643 00000 n
0000037289 00000 n
0000037310 00000 n
0000037450 00000 n
0000038270 00000 n
0000038291 00000 n
0000038431 00000 n
0000039358 00000 n
0000039946 00000 n
0000039379 00000 n
0000039519 00000 n
+3 -3
Ver Arquivo
@@ -11,7 +11,7 @@
<TD><H1 ALIGN=right>An Overview of the<BR>
Common UNIX Printing System</H1></DIV>
<P ALIGN=right>September 14, 1999<BR>
<P ALIGN=right>October 4, 1999<BR>
Michael Sweet, Easy Software Products<BR>
Copyright 1998-1999, All Rights Reserved.</P>
</TD>
@@ -229,8 +229,8 @@ interfaces to ensure compatibility with existing applications.
<H2>Licensing</H2>
CUPS is available under the terms of the Aladdin Free Public
License, which means that it is basically free except for commercial
CUPS is available under the terms of the GNU General Public License
which means that it is basically free except for binary-only
distribution. Vendors wishing to license CUPS for their printing
solution should contact Easy Software Products at:
Arquivo binário não exibido.
+3 -3
Ver Arquivo
@@ -3,12 +3,12 @@
<TITLE>CUPS Software Administrators Manual</TITLE>
<META NAME="AUTHOR" CONTENT="Easy Software Products">
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.0.0">
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.0.2">
</HEAD>
<BODY>
<CENTER><A HREF=#contents><IMG SRC="images/cups-large.gif" BORDER=0><BR>
<H1>CUPS Software Administrators Manual</H1></A><BR>
CUPS-SAM-1.0.0<BR>
CUPS-SAM-1.0.2<BR>
Easy Software Products<BR>
Copyright 1997-1999, All Rights Reserved<BR>
</CENTER>
@@ -92,7 +92,7 @@ Copyright 1997-1999, All Rights Reserved<BR>
<HR>
<H1 ALIGN=RIGHT><A NAME=1>Preface</A></H1>
This software administrators manual provides printer administration
information for the Common UNIX Printing System (&quot;CUPS&quot;) Version 1.0.0.
information for the Common UNIX Printing System (&quot;CUPS&quot;) Version 1.0.2.
<H2><A NAME=1_1>System Overview</A></H2>
The Common UNIX Printing System provides a portable printing layer for
UNIX&reg; operating systems. It has been developed by Easy Software
+143 -144
Ver Arquivo
@@ -1,6 +1,6 @@
%PDF-1.2
%âãÏÓ
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19990922200503Z)/Title(CUPS Software Administrators Manual)/Author(Easy Software Products)>>endobj
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19991029131928Z)/Title(CUPS Software Administrators Manual)/Author(Easy Software Products)>>endobj
2 0 obj<</Type/Encoding/BaseEncoding/WinAnsiEncoding>>endobj
3 0 obj<</Type/Font/Subtype/Type1/BaseFont/Courier/Encoding 2 0 R>>endobj
4 0 obj<</Type/Font/Subtype/Type1/BaseFont/Courier-Oblique/Encoding 2 0 R>>endobj
@@ -396,7 +396,7 @@ H
“ã¿DÝ<jåš÷Áª¥µ(N°JúF¥.ƒk–—¦f7\¡ê¨ Šó ,¥ÉTë2¸‚²¥t•=<ë_]{:­WÖepMJ_Ý
Wr<(”×…/-Hà)»BY—Ï•vÉN¬W'ïRpY§äsM]Õ6¿ú[ËÇ;I—\¢ ò4«NXx!³¦.Ë?Ÿn&ñ¤3®°¸
'*J2ž¸¡.kr|Q—I<_úg8©Åq‚¥å$mU]×ôø86O&è‡+9ýé˜å$mU]WP|t33®–ôÃã?gg2/ˆU\¸#¥¯KâÚÞÿ:>¦y§\Ý?ly
IÅM[ýx.q˜¤Û)¼ìŒ+Ô¥ãΔ³ºƒçZ>oûÉëθö‘àZ7NJÓH[—Ädhkéqg\‡³Îóµ:ÀÚeR<ɹ¶.‰ NÙ¯~Þ×1D¯õvÿÃëë*¹ê‰;Šä0_·î«;®B>H¥·Ñ“·9úb}]
IÅM[ýx.q˜¤Û)¼ìŒ+Ô¥ãΔ³ºƒçZ>oûÉëθö‘àZ7NJÓH[—Ädhkéqg\‡³Îóµ:ÀÚeR<ɹ¶.‰ NÙ¯~Þ×1D¯õvÿÃëë*¹ê‰;Šä0_·î«;®B>H¥·Ñ“·9úb}]
Wz0€ÕöƒÍ¸šÎõŠõJï%NêY´Úº®ìðÇ­[6äj:‡”÷8J‹ã¸µ.…KzǢϚ¹ŒÎ—¥6³TÔ²Zôu \ùÁ1ïþ¶;®J­×F2@Ô¥píóÎ-wÉUxÑV™Bõ#sºº®½cNw>¾K®§‹°µ\*U²ic]×Þ1§»úf\­y_÷¡jÖåCQ×Åû匷ÿï·pÙÈg{¸¨/jÍ"GU—À•ì,pç–»ç:õvZ ¥Ö¨º®½cÞ¹å>¸žDa¢4Mu \{Ǽsˆ\Øw‹¦ÍbÐT—À%Ÿ¼Ø¬/®Sâu;W¥.kï˜÷"ÙÈe½}•̲습\Mu)\œd§ýÓN¸ÊîZ7;uu)\ÉðÓ½c4äŠqû‡-\Mu)\Û‘N¼ã‹ê:ãš”lËoäÒÕ¥pÁþ2¬ßÆerïF”þY4ê|S]
W²¿Y31çZ6/¿æÅuÈTËÕT—•žœzg\Iq<W•¯©t¶©.…+;­¹Lî!îÛú·§C­¥–«©nK<_zÛ–,Ÿ
pÍ[ÏaO‡úÅbS]
@@ -414,12 +414,11 @@ endobj
| ê%è@N‰ǵ‚-Ý®)’+udÀdÈ
Â!72ÄÊO-
j¨V¹ gÉ·ÈÍ ±S­Ç>Ý9š oˆJGj`3¢¬ñJñ3íÒï<¾j¹¤7´%fFÒ¹±!v¤‰Âȇ‚ñ¤íÈ;£­P½3Ƴ¶ïœZ ûúN¦˜
e l<1û+–•é# ×¾»'|qNåJHfS;(š¹¤7˜ Í'Ø1r`RXøR°d*Ò¼ž3¸hß°)ßõ,…
¡XØ](X…¹*^Û1°±^µFÃÒÇ`e¡àNÖ}bé¥
lEiG°7=)aóa0XÔ&Sõ c5ÜF{žÿd<[ÌBêl®<ä€UéUnè_³æs%,.Ï¿¥Ãâ›â€6.æ€yÞyÜñ`5¯Z¹"[ð?:ÿ XÓ87á’¿œ£¬1»à}úÒˆË`À¶óì²Í˜T-ˇv.“Û£=ê?û&dîÜ‹º SäåcmÜäÃ"4y\¹)WæÙ)gç‹ÅâÍã¦<,¡á§Í¹l ˜õÒ–ÿˆá’rÍ-p™Iâ Ã…ãroÀ–V¸œ°ö­/Ûp!¹§6}Ć+]âZÛãJÇ5\h.ÖNGGÛäÊœášç6¹œÑzÜñžK†cÑxw gÑ q9!Øó^
e l<1û+–•é# ×¾»'|qNåJHfS;(š¹¤7˜ Í'Ø1r`RXøR°d*Ò¼ž3¸hß°)ßõ,…
¡XØ](X…¹*^Û1°±^µFÃÒÇ`e¡àNÖ}bé¥
lEiG°7=)aóa0XÔ&Sõ c5ÜF{žÿd<[ÌBêl®<ä€UéUnè_³æs%,.Ï¿¥Ãâ›â€6.æ€yÞyÜñ`5¯Z¹"[ð?:ÿ XÓ87á’¿œ£¬1»à}úÒˆË`À¶óì²Í˜T-ˇv.“Û£=ê?û&dîÜ‹º SäåcmÜäÃ"4y\¹)WæÙ)gç‹ÅâÍã¦<,¡á§Í¹l ˜õÒ–ÿˆá’rÍ-p™Iâ Ã…ãroÀ–V¸œ°ö­/Ûp!¹§6}Ć+]âZÛãJÇ5\h.ÖNGGÛäÊœášç6¹œÑzÜñžK†cÑxw gÑ q9!Øó^
Ò¸°DôÑ!‰kpKÄgи²‘X!•kàø—p€MäÔ)¹/T®!½3åø‰Ê5``OJš#s
Ùd»Ã•Ë wË&—¥!;_ç®qåòÆXߨê‹M.~jõêÒ^Oìr¤W#R·‡äâ’٥ꂋCvþÆvºà"æÅû‹ÞsÑ
6Åhi/t®¦1±ŒÁ5Ì#ží2¸™bÔ,%=pÍ`sõ®ôT9WÏÚÁÈdrIᮚpõ)ЬÔa.W`¼L26#í§ÇeÌÕÓbŒyãÀ€«ÿìs/R˜puoŠü,M#®®Á O͸ºUE“daC®.´Q´)Ww`fÉøÆ\äêŽ&ö¹ºX¶¦«Ûá²/‹æ÷&¬påÒ®-^š÷Èׯí
Ùd»Ã•Ë wË&—¥!;_ç®qåòÆXߨê‹M.~jõêÒ^Oìr¤W#R·‡äâ’٥ꂋCvþÆvºà"æÅû‹ÞsÑ
צ<â²ãýóÛN¾¾3®Ý¨µäÙⱫïî’k7l7‹3õ8]>vù½]sín{Ãaqq¶-ç‹Ååãcç_Ù ×âO¯’W÷òÕ»ß}×…ü£øðÃÕ÷âvuu+äÿðC&²_ÿøíÿ>ùIÜýøçŸÿòó×o_>ûõËWñûÏùíó/ÿ(ÿ{ÓúV\_o[_¿¿¾ú(Þ^¿¿ºyjÿ6»ûýÛë«ÕÕͶêÛ{óaÿùñç¯;}>|ùõÇßþðíë®Þíû«úõþöåçÿúÓ·M/?~ÿvóÿIÜýò‹H·ùU¤?}ýéËÿþôã¶i,7Lÿíqòµendstream
endobj
@@ -986,145 +985,145 @@ xref
0000010207 00000 n
0000010313 00000 n
0000010419 00000 n
0000010631 00000 n
0000010737 00000 n
0000010843 00000 n
0000010949 00000 n
0000011055 00000 n
0000011161 00000 n
0000011267 00000 n
0000011373 00000 n
0000011479 00000 n
0000011585 00000 n
0000011691 00000 n
0000011797 00000 n
0000011903 00000 n
0000012009 00000 n
0000012115 00000 n
0000012221 00000 n
0000012327 00000 n
0000012432 00000 n
0000012536 00000 n
0000012640 00000 n
0000013405 00000 n
0000013511 00000 n
0000013615 00000 n
0000013720 00000 n
0000013826 00000 n
0000013932 00000 n
0000014036 00000 n
0000014140 00000 n
0000014244 00000 n
0000014349 00000 n
0000014454 00000 n
0000014560 00000 n
0000014666 00000 n
0000014772 00000 n
0000014878 00000 n
0000014984 00000 n
0000015088 00000 n
0000015193 00000 n
0000015299 00000 n
0000015403 00000 n
0000015508 00000 n
0000015614 00000 n
0000015718 00000 n
0000015823 00000 n
0000015929 00000 n
0000016139 00000 n
0000016173 00000 n
0000016207 00000 n
0000016908 00000 n
0000016957 00000 n
0000017006 00000 n
0000017055 00000 n
0000017104 00000 n
0000017153 00000 n
0000017202 00000 n
0000017251 00000 n
0000017300 00000 n
0000017349 00000 n
0000017398 00000 n
0000017447 00000 n
0000017496 00000 n
0000017545 00000 n
0000017594 00000 n
0000017643 00000 n
0000017692 00000 n
0000017741 00000 n
0000017790 00000 n
0000017839 00000 n
0000017888 00000 n
0000017937 00000 n
0000017986 00000 n
0000018035 00000 n
0000018084 00000 n
0000018133 00000 n
0000018182 00000 n
0000018231 00000 n
0000018280 00000 n
0000018329 00000 n
0000018378 00000 n
0000018427 00000 n
0000018476 00000 n
0000018525 00000 n
0000018574 00000 n
0000018623 00000 n
0000018672 00000 n
0000018721 00000 n
0000018770 00000 n
0000018819 00000 n
0000018868 00000 n
0000018917 00000 n
0000018966 00000 n
0000019015 00000 n
0000019064 00000 n
0000019113 00000 n
0000019162 00000 n
0000019211 00000 n
0000019260 00000 n
0000019309 00000 n
0000019358 00000 n
0000019407 00000 n
0000019456 00000 n
0000019765 00000 n
0000019917 00000 n
0000026302 00000 n
0000026324 00000 n
0000026437 00000 n
0000026539 00000 n
0000026559 00000 n
0000026690 00000 n
0000027459 00000 n
0000027480 00000 n
0000027621 00000 n
0000027997 00000 n
0000028018 00000 n
0000028158 00000 n
0000029072 00000 n
0000029093 00000 n
0000029233 00000 n
0000030669 00000 n
0000030691 00000 n
0000030831 00000 n
0000031723 00000 n
0000031744 00000 n
0000031857 00000 n
0000032054 00000 n
0000032075 00000 n
0000032229 00000 n
0000033131 00000 n
0000033152 00000 n
0000033306 00000 n
0000034227 00000 n
0000034248 00000 n
0000034397 00000 n
0000035103 00000 n
0000035124 00000 n
0000035237 00000 n
0000035434 00000 n
0000010525 00000 n
0000010631 00000 n
0000010737 00000 n
0000010843 00000 n
0000010949 00000 n
0000011055 00000 n
0000011161 00000 n
0000011267 00000 n
0000011373 00000 n
0000011479 00000 n
0000011585 00000 n
0000011691 00000 n
0000011797 00000 n
0000011903 00000 n
0000012009 00000 n
0000012115 00000 n
0000012221 00000 n
0000012327 00000 n
0000012432 00000 n
0000012536 00000 n
0000012640 00000 n
0000013405 00000 n
0000013511 00000 n
0000013615 00000 n
0000013720 00000 n
0000013826 00000 n
0000013932 00000 n
0000014036 00000 n
0000014140 00000 n
0000014244 00000 n
0000014349 00000 n
0000014454 00000 n
0000014560 00000 n
0000014666 00000 n
0000014772 00000 n
0000014878 00000 n
0000014984 00000 n
0000015088 00000 n
0000015193 00000 n
0000015299 00000 n
0000015403 00000 n
0000015508 00000 n
0000015614 00000 n
0000015718 00000 n
0000015823 00000 n
0000015929 00000 n
0000016139 00000 n
0000016173 00000 n
0000016207 00000 n
0000016908 00000 n
0000016957 00000 n
0000017006 00000 n
0000017055 00000 n
0000017104 00000 n
0000017153 00000 n
0000017202 00000 n
0000017251 00000 n
0000017300 00000 n
0000017349 00000 n
0000017398 00000 n
0000017447 00000 n
0000017496 00000 n
0000017545 00000 n
0000017594 00000 n
0000017643 00000 n
0000017692 00000 n
0000017741 00000 n
0000017790 00000 n
0000017839 00000 n
0000017888 00000 n
0000017937 00000 n
0000017986 00000 n
0000018035 00000 n
0000018084 00000 n
0000018133 00000 n
0000018182 00000 n
0000018231 00000 n
0000018280 00000 n
0000018329 00000 n
0000018378 00000 n
0000018427 00000 n
0000018476 00000 n
0000018525 00000 n
0000018574 00000 n
0000018623 00000 n
0000018672 00000 n
0000018721 00000 n
0000018770 00000 n
0000018819 00000 n
0000018868 00000 n
0000018917 00000 n
0000018966 00000 n
0000019015 00000 n
0000019064 00000 n
0000019113 00000 n
0000019162 00000 n
0000019211 00000 n
0000019260 00000 n
0000019309 00000 n
0000019358 00000 n
0000019407 00000 n
0000019456 00000 n
0000019765 00000 n
0000019917 00000 n
0000026302 00000 n
0000026324 00000 n
0000026437 00000 n
0000026539 00000 n
0000026559 00000 n
0000026690 00000 n
0000027460 00000 n
0000027481 00000 n
0000027622 00000 n
0000027998 00000 n
0000028019 00000 n
0000028159 00000 n
0000029073 00000 n
0000029094 00000 n
0000029234 00000 n
0000030670 00000 n
0000030692 00000 n
0000030832 00000 n
0000031724 00000 n
0000031745 00000 n
0000031858 00000 n
0000032055 00000 n
0000032076 00000 n
0000032230 00000 n
0000033132 00000 n
0000033153 00000 n
0000033307 00000 n
0000034228 00000 n
0000034249 00000 n
0000034398 00000 n
0000035104 00000 n
0000035125 00000 n
0000035238 00000 n
0000035435 00000 n
0000035456 00000 n
0000035614 00000 n
0000036387 00000 n
0000036367 00000 n
0000036388 00000 n
+2 -2
Ver Arquivo
@@ -1,7 +1,7 @@
<HTML>
<HEAD>
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.0.0">
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.0.2">
<META NAME="Author" CONTENT="Easy Software Products">
<TITLE>CUPS Software Administrators Manual</TITLE>
</HEAD>
@@ -10,7 +10,7 @@
<H1 ALIGN=RIGHT>Preface</H1>
This software administrators manual provides printer administration
information for the Common UNIX Printing System ("CUPS") Version 1.0.0.
information for the Common UNIX Printing System ("CUPS") Version 1.0.2.
<H2>System Overview</H2>
+29 -14
Ver Arquivo
@@ -3,12 +3,12 @@
<TITLE>CUPS Software Users Manual</TITLE>
<META NAME="AUTHOR" CONTENT="Easy Software Products">
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SUM-1.0.0">
<META NAME="DOCNUMBER" CONTENT="CUPS-SUM-1.0.2">
</HEAD>
<BODY>
<CENTER><A HREF=#contents><IMG SRC="images/cups-large.gif" BORDER=0><BR>
<H1>CUPS Software Users Manual</H1></A><BR>
CUPS-SUM-1.0.0<BR>
CUPS-SUM-1.0.2<BR>
Easy Software Products<BR>
Copyright 1997-1999, All Rights Reserved<BR>
</CENTER>
@@ -48,8 +48,9 @@ Copyright 1997-1999, All Rights Reserved<BR>
<LI><A HREF=#4_1_2>Setting the Orientation</A></LI>
<LI><A HREF=#4_1_3>Printing On Both Sides of the Paper</A></LI>
<LI><A HREF=#4_1_4>Selecting a Range of Pages</A></LI>
<LI><A HREF=#4_1_5>Setting the Brightness</A></LI>
<LI><A HREF=#4_1_6>Setting the Gamma Correction</A></LI>
<LI><A HREF=#4_1_5>N-Up Printing</A></LI>
<LI><A HREF=#4_1_6>Setting the Brightness</A></LI>
<LI><A HREF=#4_1_7>Setting the Gamma Correction</A></LI>
</UL>
<LI><A HREF=#4_2>Text Options</A></LI>
<UL>
@@ -69,7 +70,7 @@ Copyright 1997-1999, All Rights Reserved<BR>
<HR>
<H1 ALIGN=RIGHT><A NAME=1>Preface</A></H1>
This software users manual describes how to use the Common UNIX
Printing System (&quot;CUPS&quot;) Version 1.0.0.
Printing System (&quot;CUPS&quot;) Version 1.0.2.
<H2><A NAME=1_1>System Overview</A></H2>
The Common UNIX Printing System provides a portable printing layer for
UNIX&reg; operating systems. It has been developed by Easy Software
@@ -354,14 +355,15 @@ in landscape orientation: </P>
</PRE>
</UL>
<H3><A NAME=4_1_3>Printing On Both Sides of the Paper</A></H3>
<P>The &quot;-o sides=two-sided-short&quot; and &quot;-o sides=two-sided-long&quot; options
will enable duplexing on the printer (if the printer supports it.) The
&quot;two-sided-short&quot; option is suitable for landscape pages, while the
&quot;two-sided-long&quot; option is suitable for portrait pages: </P>
<P>The &quot;-o sides=two-sided-short-edge&quot; and &quot;-o
sides=two-sided-long-edge&quot; options will enable duplexing on the printer
(if the printer supports it.) The &quot;two-sided-short&quot; option is suitable
for landscape pages, while the &quot;two-sided-long&quot; option is suitable for
portrait pages: </P>
<UL>
<PRE>
% lp -o sides=two-sided-short filename ENTER
% lp -o sides=two-sided-long filename ENTER
% lp -o sides=two-sided-short-edge filename ENTER
% lp -o sides=two-sided-long-edge filename ENTER
</PRE>
</UL>
<H3><A NAME=4_1_4>Selecting a Range of Pages</A></H3>
@@ -385,7 +387,19 @@ of the order of the pages in the &quot;page-range&quot; option. </P>
% lp -o page-set=even filename ENTER
</PRE>
</UL>
<H3><A NAME=4_1_5>Setting the Brightness</A></H3>
<H3><A NAME=4_1_5>N-Up Printing</A></H3>
<P>The &quot;-o number-up=value&quot; option selects N-Up printing. N-Up
printing places multiple document pages on a single printed page. CUPS
supports 1-Up, 2-Up, and 4-Up formats: </P>
<UL>
<PRE>
% lp -o number-up=1 filename ENTER
% lp -o number-up=2 filename ENTER
% lp -o number-up=4 filename ENTER
</PRE>
</UL>
<P>The default format is 1-Up. </P>
<H3><A NAME=4_1_6>Setting the Brightness</A></H3>
<P>You can control the overall brightness of the printed output using
the &quot;-o brightness=percent&quot; option: </P>
<UL>
@@ -395,7 +409,7 @@ the &quot;-o brightness=percent&quot; option: </P>
</UL>
<P>Values greater than 100 will lighten the print, while values less
than 100 will darken it. </P>
<H3><A NAME=4_1_6>Setting the Gamma Correction</A></H3>
<H3><A NAME=4_1_7>Setting the Gamma Correction</A></H3>
<P>You can control the overall gamma correction of the printed output
using the &quot;-o gamma=value&quot; option: </P>
<UL>
@@ -404,7 +418,8 @@ using the &quot;-o gamma=value&quot; option: </P>
</PRE>
</UL>
<P>Values greater than 1000 will lighten the print, while values less
than 1000 will darken it. </P>
than 1000 will darken it. The default gamma is 2200 which matches the
sRGB specification. </P>
<H2><A NAME=4_2>Text Options</A></H2>
<P>The following options apply when printing text files. </P>
<H3><A NAME=4_2_1>Setting the Number of Characters Per Inch</A></H3>
+480 -472
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+25 -9
Ver Arquivo
@@ -2,7 +2,7 @@
<HEAD>
<META NAME="Description" CONTENT="Common UNIX Printing System Software Users Manual">
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SUM-1.0.0">
<META NAME="DOCNUMBER" CONTENT="CUPS-SUM-1.0.2">
<META NAME="Author" CONTENT="Easy Software Products">
<TITLE>CUPS Software Users Manual</TITLE>
</HEAD>
@@ -11,7 +11,7 @@
<H1 ALIGN=RIGHT>Preface</H1>
This software users manual describes how to use the Common UNIX Printing
System ("CUPS") Version 1.0.0.
System ("CUPS") Version 1.0.2.
<H2>System Overview</H2>
@@ -359,14 +359,15 @@ landscape orientation:
<H3>Printing On Both Sides of the Paper</H3>
<P>The "-o sides=two-sided-short" and "-o sides=two-sided-long" options will
enable duplexing on the printer (if the printer supports it.) The "two-sided-short"
option is suitable for landscape pages, while the "two-sided-long" option is
suitable for portrait pages:
<P>The "-o sides=two-sided-short-edge" and "-o
sides=two-sided-long-edge" options will enable duplexing on the
printer (if the printer supports it.) The "two-sided-short"
option is suitable for landscape pages, while the
"two-sided-long" option is suitable for portrait pages:
<UL><PRE>
% lp -o sides=two-sided-short filename ENTER
% lp -o sides=two-sided-long filename ENTER
% lp -o sides=two-sided-short-edge filename ENTER
% lp -o sides=two-sided-long-edge filename ENTER
</PRE></UL>
<H3>Selecting a Range of Pages</H3>
@@ -391,6 +392,20 @@ the pages in the "page-range" option.
% lp -o page-set=even filename ENTER
</PRE></UL>
<H3>N-Up Printing</H3>
<P>The "-o number-up=value" option selects N-Up printing. N-Up
printing places multiple document pages on a single printed
page. CUPS supports 1-Up, 2-Up, and 4-Up formats:
<UL><PRE>
% lp -o number-up=1 filename ENTER
% lp -o number-up=2 filename ENTER
% lp -o number-up=4 filename ENTER
</PRE></UL>
<P>The default format is 1-Up.
<H3>Setting the Brightness</H3>
<P>You can control the overall brightness of the printed output using the
@@ -413,7 +428,8 @@ using the "-o gamma=value" option:
</PRE></UL>
<P>Values greater than 1000 will lighten the print, while values less
than 1000 will darken it.
than 1000 will darken it. The default gamma is 2200 which matches the
sRGB specification.
<H2>Text Options</H2>
+2 -2
Ver Arquivo
@@ -237,10 +237,10 @@ SetCommonOptions(int num_options, /* I - Number of options */
}
if ((val = cupsGetOption("sides", num_options, options)) != NULL &&
strncmp(val, "two-", 4) == 0)
strncasecmp(val, "two-", 4) == 0)
Duplex = 1;
else if ((val = cupsGetOption("Duplex", num_options, options)) != NULL &&
strcmp(val, "DuplexNoTumble") == 0)
strncasecmp(val, "Duplex", 6) == 0)
Duplex = 1;
else if (ppdIsMarked(ppd, "Duplex", "DuplexNoTumble") ||
ppdIsMarked(ppd, "Duplex", "DuplexTumble"))
+75 -32
Ver Arquivo
@@ -131,17 +131,16 @@ LA_line_attributes(int num_params, /* I - Number of parameters */
if (num_params == 0)
{
Outputf("3.0 setmiterlimit\n");
Outputf("0 setlinecap\n");
Outputf("0 setlinejoin\n");
MiterLimit = 3.0f;
LineCap = 0;
LineJoin = 0;
}
else for (i = 0; i < (num_params - 1); i += 2)
switch ((int)params[i].value.number)
{
case 1 :
Outputf("%d setlinecap\n",
params[i + 1].value.number == 1 ? 0 :
params[i + 1].value.number == 4 ? 1 : 2);
LineCap = params[i + 1].value.number == 1 ? 0 :
params[i + 1].value.number == 4 ? 1 : 2;
break;
case 2 :
switch ((int)params[i + 1].value.number)
@@ -149,21 +148,27 @@ LA_line_attributes(int num_params, /* I - Number of parameters */
case 1 :
case 2 :
case 3 :
Outputf("0 setlinejoin\n");
LineJoin = 0;
break;
case 5 :
Outputf("2 setlinejoin\n");
LineJoin = 2;
break;
default :
Outputf("1 setlinejoin\n");
LineJoin = 1;
break;
}
break;
case 3 :
Outputf("%f setmiterlimit\n",
1.0 + 0.5 * (params[i + 1].value.number - 1.0));
MiterLimit = 1.0 + 0.5 * (params[i + 1].value.number - 1.0);
break;
}
if (PageDirty)
{
printf("%.1f setmiterlimit\n", MiterLimit);
printf("%d setlinecap\n", LineCap);
printf("%d setlinejoin\n", LineJoin);
}
}
@@ -197,7 +202,7 @@ NP_number_pens(int num_params, /* I - Number of parameters */
if (num_params == 0)
PenCount = 8;
else if (num_params == 1)
else if (num_params == 1 && params[0].value.number <= 1024)
PenCount = (int)params[0].value.number;
else
fprintf(stderr, "WARNING: HP-GL/2 \'NP\' command with invalid number of parameters (%d)!\n",
@@ -206,7 +211,11 @@ NP_number_pens(int num_params, /* I - Number of parameters */
PC_pen_color(0, NULL);
for (i = 0; i <= PenCount; i ++)
Outputf("/W%d { DefaultPenWidth PenScaling mul setlinewidth } bind def\n", i);
Pens[i].width = PenWidth;
if (PageDirty)
for (i = 0; i <= PenCount; i ++)
printf("/W%d { DefaultPenWidth PenScaling mul setlinewidth } bind def\n", i);
}
@@ -235,26 +244,44 @@ PC_pen_color(int num_params, /* I - Number of parameters */
{
for (i = 0; i <= PenCount; i ++)
if (i < 8)
Outputf("/P%d { %.3f %.3f %.3f setrgbcolor } bind def\n",
i, standard_colors[i][0],
standard_colors[i][1], standard_colors[i][2]);
{
Pens[i].rgb[0] = standard_colors[i][0];
Pens[i].rgb[1] = standard_colors[i][1];
Pens[i].rgb[2] = standard_colors[i][2];
}
else
Outputf("/P%d { 0.0 0.0 0.0 setrgbcolor } bind def\n", i);
{
Pens[i].rgb[0] = 0.0f;
Pens[i].rgb[1] = 0.0f;
Pens[i].rgb[2] = 0.0f;
}
if (PageDirty)
for (i = 0; i <= PenCount; i ++)
Outputf("/P%d { %.3f %.3f %.3f setrgbcolor } bind def\n",
i, Pens[i].rgb[0], Pens[i].rgb[1], Pens[i].rgb[2]);
}
else if (num_params == 1)
else if (num_params == 1 || num_params == 4)
{
i = (int)params[0].value.number;
Outputf("/P%d { %.3f %.3f %.3f setrgbcolor } bind def\n",
i, standard_colors[i & 7][0], standard_colors[i & 7][1],
standard_colors[i & 7][2]);
if (num_params == 1)
{
Pens[i].rgb[0] = standard_colors[i & 7][0];
Pens[i].rgb[1] = standard_colors[i & 7][1];
Pens[i].rgb[2] = standard_colors[i & 7][2];
}
else
{
Pens[i].rgb[0] = params[1].value.number;
Pens[i].rgb[1] = params[2].value.number;
Pens[i].rgb[2] = params[3].value.number;
}
if (PageDirty)
Outputf("/P%d { %.3f %.3f %.3f setrgbcolor } bind def\n",
i, Pens[i].rgb[0], Pens[i].rgb[1], Pens[i].rgb[2]);
}
else if (num_params == 4)
Outputf("/P%d { %.3f %.3f %.3f setrgbcolor } bind def\n",
(int)params[0].value.number,
(params[1].value.number - ColorRange[0][0]) / ColorRange[0][1],
(params[2].value.number - ColorRange[1][0]) / ColorRange[1][1],
(params[3].value.number - ColorRange[2][0]) / ColorRange[2][1]);
else
fprintf(stderr, "WARNING: HP-GL/2 \'PC\' command with invalid number of parameters (%d)!\n",
num_params);
@@ -299,8 +326,18 @@ PW_pen_width(int num_params, /* I - Number of parameters */
}
if (num_params == 2)
Outputf("/W%d { %.1f PenScaling mul setlinewidth } bind def W%d\n",
(int)params[1].value.number, w, (int)params[1].value.number);
{
pen = (int)params[1].value.number;
Pens[pen].width = w;
if (PageDirty)
{
Outputf("/W%d { %.1f PenScaling mul setlinewidth } bind def\n", pen, w);
if (pen == PenNumber)
Outputf("W%d\n", PenNumber);
}
}
else if (num_params < 2)
{
/*
@@ -308,10 +345,16 @@ PW_pen_width(int num_params, /* I - Number of parameters */
*/
for (pen = 0; pen <= PenCount; pen ++)
Outputf("/W%d { %.1f PenScaling mul setlinewidth } bind def\n",
pen, w);
Pens[pen].width = w;
Outputf("W%d\n", PenNumber);
if (PageDirty)
{
for (pen = 0; pen <= PenCount; pen ++)
Outputf("/W%d { %.1f PenScaling mul setlinewidth } bind def\n",
pen, w);
Outputf("W%d\n", PenNumber);
}
}
else
fprintf(stderr, "WARNING: HP-GL/2 \'PW\' command with invalid number of parameters (%d)!\n",
+104 -46
Ver Arquivo
@@ -60,20 +60,16 @@ AD_define_alternate(int num_params, /* I - Number of parameters */
param_t *params) /* I - Parameters */
{
int i; /* Looping var */
int typeface, /* Typeface number */
posture, /* Posture number */
weight; /* Weight number */
float height; /* Height/size of font */
/*
* Set default font attributes...
*/
typeface = 48;
posture = 0;
weight = 0;
height = 11.5;
AlternateFont.typeface = 48;
AlternateFont.posture = 0;
AlternateFont.weight = 0;
AlternateFont.height = 11.5;
/*
* Loop through parameter value pairs...
@@ -83,16 +79,16 @@ AD_define_alternate(int num_params, /* I - Number of parameters */
switch ((int)params[i].value.number)
{
case 4 :
height = params[i + 1].value.number;
AlternateFont.height = params[i + 1].value.number;
break;
case 5 :
posture = (int)params[i + 1].value.number;
AlternateFont.posture = (int)params[i + 1].value.number;
break;
case 6 :
weight = (int)params[i + 1].value.number;
AlternateFont.weight = (int)params[i + 1].value.number;
break;
case 7 :
typeface = (int)params[i + 1].value.number;
AlternateFont.typeface = (int)params[i + 1].value.number;
break;
}
@@ -100,14 +96,22 @@ AD_define_alternate(int num_params, /* I - Number of parameters */
* Define the font...
*/
Outputf("/SA { /%s%s%s%s findfont %.1f scalefont setfont } def\n",
typeface == 48 ? "Courier" : "Helvetica",
(weight != 0 || posture != 0) ? "-" : "",
weight != 0 ? "Bold" : "",
posture != 0 ? "Oblique" : "",
height);
if (PageDirty)
printf("/SA {\n"
" /%s%s%s%s findfont\n"
" [ %f %f %f %f 0.0 0.0 ] makefont\n"
" setfont\n"
"} bind def\n",
AlternateFont.typeface == 48 ? "Courier" : "Helvetica",
(AlternateFont.weight != 0 || AlternateFont.posture != 0) ? "-" : "",
AlternateFont.weight != 0 ? "Bold" : "",
AlternateFont.posture != 0 ? "Oblique" : "",
AlternateFont.x * AlternateFont.height,
-AlternateFont.y * AlternateFont.height,
AlternateFont.y * AlternateFont.height,
AlternateFont.x * AlternateFont.height);
CharHeight[1] = height;
CharHeight[1] = AlternateFont.height;
}
@@ -171,12 +175,56 @@ void
DI_absolute_direction(int num_params, /* I - Number of parameters */
param_t *params) /* I - Parameters */
{
Outputf(CharFont == 0 ? "SS\n" : "SA\n");
if (CharFont)
{
if (num_params == 2)
{
AlternateFont.x = params[0].value.number;
AlternateFont.y = params[1].value.number;
}
if (num_params == 2)
Outputf("currentfont [ %f %f %f %f 0.0 0.0 ] makefont setfont\n",
params[0].value.number, -params[1].value.number,
params[1].value.number, params[0].value.number);
if (PageDirty)
{
printf("/SA {\n"
" /%s%s%s%s findfont\n"
" [ %f %f %f %f 0.0 0.0 ] makefont\n"
" setfont\n"
"} bind def\n",
AlternateFont.typeface == 48 ? "Courier" : "Helvetica",
(AlternateFont.weight != 0 || AlternateFont.posture != 0) ? "-" : "",
AlternateFont.weight != 0 ? "Bold" : "",
AlternateFont.posture != 0 ? "Oblique" : "",
AlternateFont.x * AlternateFont.height,
-AlternateFont.y * AlternateFont.height,
AlternateFont.y * AlternateFont.height,
AlternateFont.x * AlternateFont.height);
}
}
else
{
if (num_params == 2)
{
StandardFont.x = params[0].value.number;
StandardFont.y = params[1].value.number;
}
if (PageDirty)
{
printf("/SS {\n"
" /%s%s%s%s findfont\n"
" [ %f %f %f %f 0.0 0.0 ] makefont\n"
" setfont\n"
"} bind def\n",
StandardFont.typeface == 48 ? "Courier" : "Helvetica",
(StandardFont.weight != 0 || StandardFont.posture != 0) ? "-" : "",
StandardFont.weight != 0 ? "Bold" : "",
StandardFont.posture != 0 ? "Oblique" : "",
StandardFont.x * StandardFont.height,
-StandardFont.y * StandardFont.height,
StandardFont.y * StandardFont.height,
StandardFont.x * StandardFont.height);
}
}
}
@@ -249,7 +297,7 @@ LB_label(int num_params, /* I - Number of parameters */
return;
Outputf("gsave\n");
Outputf("currentmiterlimit 1.0 setmiterlimit\n");
Outputf("currentmiterlimit 1.0 \n");
Outputf("MP\n");
Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]);
@@ -295,7 +343,9 @@ SA_select_alternate(int num_params, /* I - Number of parameters */
(void)num_params;
(void)params;
Outputf("SA\n");
if (PageDirty)
puts("SA");
CharFont = 1;
}
@@ -309,20 +359,18 @@ SD_define_standard(int num_params, /* I - Number of parameters */
param_t *params) /* I - Parameters */
{
int i; /* Looping var */
int typeface, /* Typeface number */
posture, /* Posture number */
weight; /* Weight number */
float height; /* Height/size of font */
/*
* Set default font attributes...
*/
typeface = 48;
posture = 0;
weight = 0;
height = 11.5;
StandardFont.typeface = 48;
StandardFont.posture = 0;
StandardFont.weight = 0;
StandardFont.height = 11.5;
StandardFont.x = 1.0;
StandardFont.y = 0.0;
/*
* Loop through parameter value pairs...
@@ -332,16 +380,16 @@ SD_define_standard(int num_params, /* I - Number of parameters */
switch ((int)params[i].value.number)
{
case 4 :
height = params[i + 1].value.number;
StandardFont.height = params[i + 1].value.number;
break;
case 5 :
posture = (int)params[i + 1].value.number;
StandardFont.posture = (int)params[i + 1].value.number;
break;
case 6 :
weight = (int)params[i + 1].value.number;
StandardFont.weight = (int)params[i + 1].value.number;
break;
case 7 :
typeface = (int)params[i + 1].value.number;
StandardFont.typeface = (int)params[i + 1].value.number;
break;
}
@@ -349,14 +397,22 @@ SD_define_standard(int num_params, /* I - Number of parameters */
* Define the font...
*/
Outputf("/SS { /%s%s%s%s findfont %.1f scalefont setfont } def\n",
typeface == 48 ? "Courier" : "Helvetica",
(weight != 0 || posture != 0) ? "-" : "",
weight != 0 ? "Bold" : "",
posture != 0 ? "Oblique" : "",
height);
if (PageDirty)
printf("/SS {\n"
" /%s%s%s%s findfont\n"
" [ %f %f %f %f 0.0 0.0 ] makefont\n"
" setfont\n"
"} bind def\n",
StandardFont.typeface == 48 ? "Courier" : "Helvetica",
(StandardFont.weight != 0 || StandardFont.posture != 0) ? "-" : "",
StandardFont.weight != 0 ? "Bold" : "",
StandardFont.posture != 0 ? "Oblique" : "",
StandardFont.x * StandardFont.height,
-StandardFont.y * StandardFont.height,
StandardFont.y * StandardFont.height,
StandardFont.x * StandardFont.height);
CharHeight[0] = height;
CharHeight[0] = StandardFont.height;
}
@@ -410,7 +466,9 @@ SS_select_standard(int num_params, /* I - Number of parameters */
(void)num_params;
(void)params;
Outputf("SS\n");
if (PageDirty)
puts("SS");
CharFont = 0;
}
+221 -52
Ver Arquivo
@@ -51,54 +51,153 @@
void
update_transform(void)
{
float width, /* Plot width */
height; /* Plot height */
float page_width, /* Actual page width in points */
page_length; /* Actual page length in points */
float page_width, /* Actual page width */
page_height; /* Actual page height */
float scaling; /* Scaling factor */
float left, right, /* Scaling window */
bottom, top;
float width, height; /* Scaling width and height */
float iw1[2], iw2[2]; /* Clipping window */
/*
* Get the page and input window sizes...
*/
width = IW2[0] - IW1[0];
height = IW2[1] - IW1[1];
if (FitPlot)
{
page_width = PageRight - PageLeft;
page_height = PageTop - PageBottom;
}
else
{
page_width = (P2[0] - P1[0]) * 72.0f / 1016.0f;
page_height = (P2[1] - P1[1]) * 72.0f / 1016.0f;
}
fprintf(stderr, "DEBUG: page_width = %.0f, page_height = %.0f\n",
page_width, page_height);
if (page_width == 0 || page_height == 0)
return;
/*
* Set the scaling window...
*/
switch (ScalingType)
{
case -1 : /* No user scaling */
left = P1[0];
bottom = P1[1];
right = P2[0];
top = P2[1];
break;
case 0 : /* Anisotropic (non-uniform) scaling */
left = Scaling1[0];
bottom = Scaling1[1];
right = Scaling2[0];
top = Scaling2[1];
break;
case 1 : /* Isotropic (uniform) scaling */
left = Scaling1[0];
bottom = Scaling1[1];
right = Scaling2[0];
top = Scaling2[1];
width = right - left;
height = top - bottom;
if (width == 0 || height == 0)
return;
if ((width * page_height) != (height * page_width))
{
scaling = height * page_width / page_height;
if (width < scaling)
{
width = scaling;
left = 0.5f * (left + right - width);
right = left + width;
}
else
{
height = width * page_height / page_width;
bottom = 0.5f * (bottom + top - height);
top = bottom + height;
}
}
break;
case 2 :
left = Scaling1[0];
bottom = Scaling1[1];
right = left + page_width * Scaling2[0];
top = bottom + page_height * Scaling2[1];
break;
}
width = right - left;
height = top - bottom;
if (width == 0 || height == 0)
return;
/*
* Scale the plot as needed...
* Rotate the plot as needed...
*/
if (FitPlot)
if (Rotation == 0 || Rotation == 180)
{
page_width = PageRight - PageLeft;
page_length = PageTop - PageBottom;
if (Rotation == 0 || Rotation == 180)
if ((width > height && page_width < page_height) ||
(width < height && page_width > page_height))
{
scaling = page_width / width;
if (scaling > (page_length / width))
scaling = page_length / width;
}
else
{
scaling = page_width / height;
if (scaling > (page_length / height))
scaling = page_length / height;
fputs("DEBUG: Automatically rotating the page...\n", stderr);
Rotation += 90;
}
}
else
{
page_width = PlotSize[0];
page_length = PlotSize[1];
if ((width > height && page_width > page_height) ||
(width < height && page_width < page_height))
{
fputs("DEBUG: Automatically rotating the page...\n", stderr);
Rotation = (Rotation + 90) % 360;
}
}
/*
* Scale the plot as needed...
*/
if (Rotation == 0 || Rotation == 180)
scaling = page_width / width;
else
scaling = page_width / height;
if (FitPlot)
{
if (Rotation == 0 || Rotation == 180)
scaling = page_width / width;
scaling *= page_width / PlotSize[1];
else
scaling = page_width / height;
scaling *= page_width / PlotSize[0];
}
/*
* Offset for the current P1 location...
*/
if (FitPlot)
{
left = 0;
bottom = 0;
}
else
{
left = P1[0] * 72.0f / 1016.0f;
bottom = P1[1] * 72.0f / 1016.0f;
}
/*
@@ -110,47 +209,69 @@ update_transform(void)
case 0 :
Transform[0][0] = scaling;
Transform[0][1] = 0.0;
Transform[0][2] = -IW1[0] * scaling;
Transform[0][2] = -left;
Transform[1][0] = 0.0;
Transform[1][1] = scaling;
Transform[1][2] = -IW1[1] * scaling;
Transform[1][2] = -bottom;
break;
case 90 :
Transform[0][0] = 0.0;
Transform[0][1] = -scaling;
Transform[0][2] = (height - IW1[0]) * scaling;
Transform[0][2] = PageLength - left;
Transform[1][0] = scaling;
Transform[1][1] = 0.0;
Transform[1][2] = -IW1[1] * scaling;
Transform[1][2] = -bottom;
break;
case 180 :
Transform[0][0] = -scaling;
Transform[0][1] = 0.0;
Transform[0][2] = (height - IW1[0]) * scaling;
Transform[0][2] = PageLength - left;
Transform[1][0] = 0.0;
Transform[1][1] = -scaling;
Transform[1][2] = (width - IW1[1]) * scaling;
Transform[1][2] = PageWidth - bottom;
break;
case 270 :
Transform[0][0] = 0.0;
Transform[0][1] = scaling;
Transform[0][2] = -IW1[0] * scaling;
Transform[0][2] = -left;
Transform[1][0] = -scaling;
Transform[1][1] = 0.0;
Transform[1][2] = (width - IW1[1]) * scaling;
Transform[1][2] = PageWidth - bottom;
break;
}
PenScaling = Transform[0][0] + Transform[0][1];
fprintf(stderr, "DEBUG: Transform = [ %.3f %.3f\n"
"DEBUG: %.3f %.3f\n"
"DEBUG: %.3f %.3f ]\n",
Transform[0][0], Transform[1][0], Transform[0][1],
Transform[1][1], Transform[0][2], Transform[1][2]);
if (WidthUnits)
PenScaling = page_width * scaling * 0.01f;
else
PenScaling = page_width / PageWidth * 72.0f / 25.4f;
if (PenScaling < 0.0)
PenScaling = -PenScaling;
if (PageDirty)
{
printf("/PenScaling %.3f def W%d\n", PenScaling, PenNumber);
if (IW1[0] != IW2[0] && IW1[1] != IW2[1])
{
iw1[0] = IW1[0] * 72.0f / 1016.0f;
iw1[1] = IW1[1] * 72.0f / 1016.0f;
iw2[0] = IW2[0] * 72.0f / 1016.0f;
iw2[1] = IW2[1] * 72.0f / 1016.0f;
printf("initclip MP %.3f %.3f MO %.3f %.3f LI %.3f %.3f LI %.3f %.3f LI CP clip\n",
iw1[0], iw1[1], iw1[0], iw2[1], iw2[0], iw2[1], iw2[0], iw1[1]);
}
}
}
@@ -219,7 +340,8 @@ IN_initialize(int num_params, /* I - Number of parameters */
PS_plot_size(0, NULL);
WU_width_units(0, NULL);
PW_pen_width(0, NULL);
SP_select_pen(0, NULL);
PenWidth = 1;
PenPosition[0] = PenPosition[1] = 0.0;
}
@@ -235,10 +357,10 @@ IP_input_absolute(int num_params, /* I - Number of parameters */
{
if (num_params == 0)
{
P1[0] = 0.0;
P1[1] = 0.0;
P2[0] = PlotSize[0] / 72.0f * 1016.0f;
P2[1] = PlotSize[1] / 72.0f * 1016.0f;
P1[0] = PageLeft / 72.0f * 1016.0f;
P1[1] = PageBottom / 72.0f * 1016.0f;
P2[0] = PageRight / 72.0f * 1016.0f;
P2[1] = PageTop / 72.0f * 1016.0f;
}
else if (num_params == 2)
{
@@ -262,6 +384,14 @@ IP_input_absolute(int num_params, /* I - Number of parameters */
IW2[0] = P2[0];
IW2[1] = P2[1];
if (ScalingType < 0)
{
Scaling1[0] = P1[0];
Scaling1[0] = P1[1];
Scaling2[0] = P2[0];
Scaling2[1] = P2[1];
}
update_transform();
}
@@ -303,6 +433,14 @@ IR_input_relative(int num_params, /* I - Number of parameters */
IW2[0] = P2[0];
IW2[1] = P2[1];
if (ScalingType < 0)
{
Scaling1[0] = P1[0];
Scaling1[0] = P1[1];
Scaling2[0] = P2[0];
Scaling2[1] = P2[1];
}
update_transform();
}
@@ -317,19 +455,44 @@ IW_input_window(int num_params, /* I - Number of parameters */
{
if (num_params == 0)
{
IW1[0] = P1[0];
IW1[1] = P1[1];
IW2[0] = P2[0];
IW2[1] = P2[1];
IW1[0] = PageLeft / 72.0f * 1016.0f;
IW1[1] = PageBottom / 72.0f * 1016.0f;
IW2[0] = PageRight / 72.0f * 1016.0f;
IW2[1] = PageTop / 72.0f * 1016.0f;
}
else if (num_params == 4)
{
IW1[0] = params[0].value.number;
IW1[1] = params[1].value.number;
IW2[0] = params[2].value.number;
IW2[1] = params[3].value.number;
if (ScalingType < 0)
{
IW1[0] = params[0].value.number;
IW1[1] = params[1].value.number;
IW2[0] = params[2].value.number;
IW2[1] = params[3].value.number;
}
else
{
IW1[0] = (Transform[0][0] * params[0].value.number +
Transform[0][1] * params[1].value.number +
Transform[0][2]) / 72.0f * 1016.0f;
IW1[1] = (Transform[1][0] * params[0].value.number +
Transform[1][1] * params[1].value.number +
Transform[1][2]) / 72.0f * 1016.0f;
IW2[0] = (Transform[0][0] * params[2].value.number +
Transform[0][1] * params[3].value.number +
Transform[0][2]) / 72.0f * 1016.0f;
IW2[1] = (Transform[1][0] * params[2].value.number +
Transform[1][1] * params[3].value.number +
Transform[1][2]) / 72.0f * 1016.0f;
}
fprintf(stderr, "DEBUG: IW%.0f,%.0f,%.0f,%.0f = [ %.0f %.0f %.0f %.0f ]\n",
params[0].value.number, params[1].value.number,
params[2].value.number, params[3].value.number,
IW1[0], IW1[1], IW2[0], IW2[1]);
}
update_transform();
}
@@ -368,13 +531,13 @@ PS_plot_size(int num_params, /* I - Number of parameters */
case 0 :
if (Rotation == 0 || Rotation == 180)
{
PlotSize[0] = PageRight - PageLeft;
PlotSize[1] = PageTop - PageBottom;
PlotSize[0] = PageWidth;
PlotSize[1] = PageLength;
}
else
{
PlotSize[0] = PageTop - PageBottom;
PlotSize[1] = PageRight - PageLeft;
PlotSize[0] = PageLength;
PlotSize[1] = PageWidth;
}
break;
case 1 :
@@ -450,7 +613,13 @@ SC_scale(int num_params, /* I - Number of parameters */
param_t *params) /* I - Parameters */
{
if (num_params == 0)
{
ScalingType = -1;
Scaling1[0] = P1[0];
Scaling1[0] = P1[1];
Scaling2[0] = P2[0];
Scaling2[1] = P2[1];
}
else if (num_params > 3)
{
Scaling1[0] = params[0].value.number;
@@ -461,7 +630,7 @@ SC_scale(int num_params, /* I - Number of parameters */
if (num_params > 4)
ScalingType = (int)params[4].value.number;
else
ScalingType = 0;
ScalingType = 1;
}
update_transform();
+1 -1
Ver Arquivo
@@ -161,7 +161,7 @@ ParseCommand(FILE *fp, /* I - File to read from */
break;
case '\"' :
fscanf(fp, "%[^\"]\"", buf);
fscanf(fp, "%262143[^\"]\"", buf);
if (num_params < MAX_PARAMS)
{
p[num_params].type = PARAM_STRING;
+7 -7
Ver Arquivo
@@ -128,7 +128,6 @@ main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
FILE *fp; /* Input file */
ppd_file_t *ppd; /* PPD file */
int num_params; /* Number of parameters */
param_t *params; /* Command parameters */
name_t *command, /* Command */
@@ -137,7 +136,6 @@ main(int argc, /* I - Number of command-line arguments */
cups_option_t *options; /* Print options */
const char *val; /* Option value */
int shading; /* -1 = black, 0 = grey, 1 = color */
float penwidth; /* Default pen width */
if (argc < 6 || argc > 7)
@@ -173,11 +171,13 @@ main(int argc, /* I - Number of command-line arguments */
options = NULL;
num_options = cupsParseOptions(argv[5], 0, &options);
if ((ppd = SetCommonOptions(num_options, options, 1)) != NULL)
ppdClose(ppd);
PPD = SetCommonOptions(num_options, options, 1);
PlotSize[0] = PageWidth;
PlotSize[1] = PageLength;
shading = 1;
penwidth = 1.0;
PenWidth = 1.0;
if ((val = cupsGetOption("blackplot", num_options, options)) != NULL)
shading = 0;
@@ -186,13 +186,13 @@ main(int argc, /* I - Number of command-line arguments */
FitPlot = 1;
if ((val = cupsGetOption("penwidth", num_options, options)) != NULL)
penwidth = (float)atof(val);
PenWidth = (float)atof(val);
/*
* Write the PostScript prolog and initialize the plotting "engine"...
*/
OutputProlog(argv[3], argv[2], shading, penwidth);
OutputProlog(argv[3], argv[2], shading);
IP_input_absolute(0, NULL);
+190 -5
Ver Arquivo
@@ -44,8 +44,7 @@
void
OutputProlog(char *title, /* I - Job title */
char *user, /* I - Username */
int shading, /* I - Type of shading */
float penwidth) /* I - Default pen width */
int shading) /* I - Type of shading */
{
FILE *prolog; /* Prolog file */
char line[255]; /* Line from prolog file */
@@ -73,7 +72,7 @@ OutputProlog(char *title, /* I - Job title */
puts("%%Orientation: Landscape");
puts("%%EndComments");
puts("%%BeginProlog");
printf("/DefaultPenWidth %.2f def\n", penwidth * 72.0 / 25.4);
printf("/DefaultPenWidth %.2f def\n", PenWidth * 72.0 / 25.4);
puts("3.0 setmiterlimit");
if (!shading) /* Black only */
puts("/setrgbcolor { pop pop pop } bind def");
@@ -124,6 +123,13 @@ Outputf(const char *format, /* I - Printf-style string */
{
va_list ap; /* Argument pointer */
int bytes; /* Number of bytes written */
float iw1[2], iw2[2]; /* Clipping window */
int i; /* Looping var */
ppd_size_t *size; /* Page size */
ppd_option_t *option; /* Page size option */
ppd_choice_t *choice; /* Page size choice */
float width, length; /* Page dimensions */
int landscape; /* Rotate for landscape orientation? */
/*
@@ -136,11 +142,179 @@ Outputf(const char *format, /* I - Printf-style string */
PageCount ++;
printf("%%%%Page: %d %d\n", PageCount, PageCount);
if (PPD != NULL && !FitPlot)
{
/*
* Set the page size for this page...
*/
if (Rotation == 0 || Rotation == 180)
{
width = PlotSize[0];
length = PlotSize[1];
}
else
{
width = PlotSize[1];
length = PlotSize[0];
}
landscape = 0;
/*
* Lookup the closest PageSize and set it...
*/
for (i = PPD->num_sizes, size = PPD->sizes; i > 0; i --, size ++)
if ((fabs(length - size->length) < 36.0 && size->width >= width) ||
(fabs(length - size->width) < 36.0 && size->length >= width))
break;
if (i == 0 && PPD->variable_sizes)
{
for (i = PPD->num_sizes, size = PPD->sizes; i > 0; i --, size ++)
if (strcasecmp(size->name, "custom") == 0)
break;
}
if (i > 0)
{
/*
* Found a matching size...
*/
option = ppdFindOption(PPD, "PageSize");
choice = ppdFindChoice(option, size->name);
puts("%%BeginPageSetup");
printf("%%%%BeginFeature: PageSize %s\n", size->name);
if (strcasecmp(size->name, "custom") == 0)
{
PageLeft = PPD->custom_margins[0];
PageRight = width - PPD->custom_margins[2];
PageWidth = width;
PageBottom = PPD->custom_margins[1];
PageTop = length - PPD->custom_margins[3];
PageLength = length;
printf("%.0f %.0f 0 0 0\n", width, length);
if (choice->code == NULL)
{
/*
* This can happen with certain buggy PPD files that don't include
* a CustomPageSize command sequence... We just use a generic
* Level 2 command sequence...
*/
puts("pop pop pop");
puts("<</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice\n");
}
else
{
/*
* Use the vendor-supplied command...
*/
printf("%s\n", choice->code);
}
}
else
{
if (choice->code)
printf("%s\n", choice->code);
if (fabs(length - size->width) < 36.0)
{
/*
* Do landscape orientation...
*/
PageLeft = size->bottom;
PageRight = size->top;
PageWidth = size->length;
PageBottom = size->left;
PageTop = size->right;
PageLength = size->width;
landscape = 1;
}
else
{
/*
* Do portrait orientation...
*/
PageLeft = size->left;
PageRight = size->right;
PageWidth = size->width;
PageBottom = size->bottom;
PageTop = size->top;
PageLength = size->length;
}
}
puts("%%EndFeature");
puts("%%EndSetup");
}
}
printf("/PenScaling %.3f def\n", PenScaling);
printf("/SA {\n"
" /%s%s%s%s findfont\n"
" [ %f %f %f %f 0.0 0.0 ] makefont\n"
" setfont\n"
"} bind def\n",
AlternateFont.typeface == 48 ? "Courier" : "Helvetica",
(AlternateFont.weight != 0 || AlternateFont.posture != 0) ? "-" : "",
AlternateFont.weight != 0 ? "Bold" : "",
AlternateFont.posture != 0 ? "Oblique" : "",
AlternateFont.x * AlternateFont.height,
-AlternateFont.y * AlternateFont.height,
AlternateFont.y * AlternateFont.height,
AlternateFont.x * AlternateFont.height);
printf("/SS {\n"
" /%s%s%s%s findfont\n"
" [ %f %f %f %f 0.0 0.0 ] makefont\n"
" setfont\n"
"} bind def\n",
StandardFont.typeface == 48 ? "Courier" : "Helvetica",
(StandardFont.weight != 0 || StandardFont.posture != 0) ? "-" : "",
StandardFont.weight != 0 ? "Bold" : "",
StandardFont.posture != 0 ? "Oblique" : "",
StandardFont.x * StandardFont.height,
-StandardFont.y * StandardFont.height,
StandardFont.y * StandardFont.height,
StandardFont.x * StandardFont.height);
if (CharFont)
puts("SA");
else
puts("SS");
printf("%.1f setmiterlimit\n", MiterLimit);
printf("%d setlinecap\n", LineCap);
printf("%d setlinejoin\n", LineJoin);
for (i = 0; i <= PenCount; i ++)
{
printf("/W%d { %.1f PenScaling mul setlinewidth } bind def\n", i,
Pens[i].width);
printf("/P%d { %.3f %.3f %.3f setrgbcolor } bind def\n",
i, Pens[i].rgb[0], Pens[i].rgb[1], Pens[i].rgb[2]);
}
puts("P1 W1");
puts("gsave");
if (Duplex && (PageCount & 1) == 0)
switch ((PageRotation / 90) & 3)
switch ((PageRotation / 90 + landscape) & 3)
{
case 0 :
printf("%.1f %.1f translate\n", PageWidth - PageRight, PageBottom);
@@ -157,7 +331,7 @@ Outputf(const char *format, /* I - Printf-style string */
break;
}
else
switch ((PageRotation / 90) & 3)
switch ((PageRotation / 90 + landscape) & 3)
{
case 0 :
printf("%.1f %.1f translate\n", PageLeft, PageBottom);
@@ -173,6 +347,17 @@ Outputf(const char *format, /* I - Printf-style string */
printf("%.1f %.1f translate\n", PageLength - PageTop, PageLeft);
break;
}
if (IW1[0] != IW2[0] && IW1[1] != IW2[1])
{
iw1[0] = IW1[0] * 72.0f / 1016.0f;
iw1[1] = IW1[1] * 72.0f / 1016.0f;
iw2[0] = IW2[0] * 72.0f / 1016.0f;
iw2[1] = IW2[1] * 72.0f / 1016.0f;
printf("initclip MP %.3f %.3f MO %.3f %.3f LI %.3f %.3f LI %.3f %.3f LI CP clip\n",
iw1[0], iw1[1], iw1[0], iw2[1], iw2[0], iw2[1], iw2[0], iw1[1]);
}
}
/*
+38 -2
Ver Arquivo
@@ -52,6 +52,31 @@ typedef struct
#define PARAM_STRING 2
/*
* Font information...
*/
typedef struct
{
int typeface, /* Typeface number */
posture, /* Posture number */
weight; /* Weight number */
float height; /* Height/size of font */
float x, y; /* X and Y direction/scaling */
} font_t;
/*
* Pen information...
*/
typedef struct
{
float rgb[3]; /* Pen color */
float width; /* Pen width */
} pen_t;
/*
* Globals...
*/
@@ -66,6 +91,8 @@ typedef struct
# define VALUE2(x,y)
#endif /* _HPGL_MAIN_C_ */
VAR ppd_file_t *PPD VALUE(NULL); /* PPD file */
VAR float P1[2], /* Lower-lefthand physical limit */
P2[2], /* Upper-righthand physical limit */
IW1[2], /* Window lower-lefthand limit */
@@ -78,9 +105,13 @@ VAR float Transform[2][3]; /* Transform matrix */
VAR int PageRotation VALUE(0); /* Page/plot rotation */
VAR char StringTerminator VALUE('\003'); /* Terminator for labels */
VAR font_t StandardFont, /* Standard font */
AlternateFont; /* Alternate font */
VAR float PenPosition[2] VALUE2(0.0f, 0.0f),
/* Current pen position */
PenScaling VALUE(1.0f); /* Pen width scaling factor */
PenScaling VALUE(1.0f), /* Pen width scaling factor */
PenWidth VALUE(1.0f); /* Default pen width */
VAR pen_t Pens[1024]; /* State of each pen */
VAR int PenMotion VALUE(0), /* 0 = absolute, 1 = relative */
PenNumber VALUE(1), /* Current pen number */
PenCount VALUE(8), /* Number of pens */
@@ -107,6 +138,11 @@ VAR float ColorRange[3][2] /* Range of color values */
#endif /* _HPGL_MAIN_C_ */
;
VAR int LineCap VALUE(0); /* Line capping */
VAR int LineJoin VALUE(0); /* Line joining */
VAR float MiterLimit VALUE(3.0f); /* Miter limit at joints */
/*
* Prototypes...
*/
@@ -187,7 +223,7 @@ extern void UL_user_line_type(int num_params, param_t *params);
extern void WU_width_units(int num_params, param_t *params);
/* hpgl-prolog.c */
extern void OutputProlog(char *title, char *user, int shading, float penwidth);
extern void OutputProlog(char *title, char *user, int shading);
extern void OutputTrailer(void);
extern int Outputf(const char *format, ...);
-5
Ver Arquivo
@@ -335,13 +335,8 @@ ImageRGBToCMYK(const ib_t *in, /* I - Input pixels */
y = 255 - *in++;
k = min(c, min(m, y));
#if 0
diff = 255 - (max(c, max(m, y)) - k);
k = k * diff / 255;
#else
if ((km = max(c, max(m, y))) > k)
k = k * k / km;
#endif /* 0 */
if (k == 255)
c = m = y = 0;
+1 -1
Ver Arquivo
@@ -255,7 +255,7 @@ ImageSetMaxTiles(image_t *img, /* I - Image to set */
if ((cache_env = getenv("RIP_MAX_CACHE")) != NULL)
{
switch (sscanf(cache_env, "%d%s", &max_size, cache_units))
switch (sscanf(cache_env, "%d%254s", &max_size, cache_units))
{
case 0 :
max_size = 32 * 1024 * 1024;
+2 -2
Ver Arquivo
@@ -132,11 +132,11 @@ main(int argc, /* I - Number of command-line arguments */
* separate-documents-collated-copies allows for uncollated copies.
*/
Collate = strcmp(val, "separate-documents-collated-copies") != 0;
Collate = strcasecmp(val, "separate-documents-collated-copies") != 0;
}
if ((val = cupsGetOption("Collate", num_options, options)) != NULL &&
strcmp(val, "True") == 0)
strcasecmp(val, "True") == 0)
Collate = 1;
if ((val = cupsGetOption("gamma", num_options, options)) != NULL)
+36 -8
Ver Arquivo
@@ -165,6 +165,7 @@ main(int argc, /* I - Number of command-line arguments */
char *resolution, /* Output resolution */
*media_type; /* Media type */
ppd_profile_t *profile; /* Color profile */
ppd_profile_t userprofile; /* User-specified profile */
cups_raster_t *ras; /* Raster stream */
cups_page_header_t header; /* Page header */
int num_options; /* Number of print options */
@@ -235,11 +236,11 @@ main(int argc, /* I - Number of command-line arguments */
* separate-documents-collated-copies allows for uncollated copies.
*/
Collate = strcmp(val, "separate-documents-collated-copies") != 0;
Collate = strcasecmp(val, "separate-documents-collated-copies") != 0;
}
if ((val = cupsGetOption("Collate", num_options, options)) != NULL &&
strcmp(val, "True") == 0)
strcasecmp(val, "True") == 0)
Collate = 1;
if ((val = cupsGetOption("gamma", num_options, options)) != NULL)
@@ -386,7 +387,31 @@ main(int argc, /* I - Number of command-line arguments */
* Find a color profile matching the current options...
*/
if (ppd != NULL)
if ((val = cupsGetOption("profile", num_options, options)) != NULL)
{
profile = &userprofile;
sscanf(val, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f",
&(userprofile.density), &(userprofile.gamma),
userprofile.matrix[0] + 0, userprofile.matrix[0] + 1,
userprofile.matrix[0] + 2,
userprofile.matrix[1] + 0, userprofile.matrix[1] + 1,
userprofile.matrix[1] + 2,
userprofile.matrix[2] + 0, userprofile.matrix[2] + 1,
userprofile.matrix[2] + 2);
userprofile.density *= 0.001f;
userprofile.gamma *= 0.001f;
userprofile.matrix[0][0] *= 0.001f;
userprofile.matrix[0][1] *= 0.001f;
userprofile.matrix[0][2] *= 0.001f;
userprofile.matrix[1][0] *= 0.001f;
userprofile.matrix[1][1] *= 0.001f;
userprofile.matrix[1][2] *= 0.001f;
userprofile.matrix[2][0] *= 0.001f;
userprofile.matrix[2][1] *= 0.001f;
userprofile.matrix[2][2] *= 0.001f;
}
else if (ppd != NULL)
{
fprintf(stderr, "DEBUG: Searching for profile \"%s/%s\"...\n",
resolution, media_type);
@@ -412,10 +437,13 @@ main(int argc, /* I - Number of command-line arguments */
* If we found a color profile, use it!
*/
if (i < ppd->num_profiles)
ImageSetProfile(profile->density, profile->gamma, profile->matrix);
if (i >= ppd->num_profiles)
profile = NULL;
}
if (profile)
ImageSetProfile(profile->density, profile->gamma, profile->matrix);
/*
* Create a gamma/brightness LUT...
*/
@@ -492,7 +520,7 @@ main(int argc, /* I - Number of command-line arguments */
yprint = yinches / ypages;
if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL &&
strcmp(choice->choice, "Custom") == 0)
strcasecmp(choice->choice, "Custom") == 0)
{
if (Orientation & 1)
{
@@ -950,9 +978,9 @@ exec_choice(cups_page_header_t *header, /* I - Page header */
else if (strcmp(name, "cupsMediaPosition") == 0)
header->MediaPosition = atoi(value);
else if (strcmp(name, "MediaType") == 0)
strcpy(header->MediaType, value);
strncpy(header->MediaType, value, sizeof(header->MediaType) - 1);
else if (strcmp(name, "OutputType") == 0)
strcpy(header->OutputType, value);
strncpy(header->OutputType, value, sizeof(header->OutputType) - 1);
}
}
+46 -24
Ver Arquivo
@@ -162,15 +162,15 @@ main(int argc, /* I - Number of command-line arguments */
* separate-documents-collated-copies allows for uncollated copies.
*/
Collate = strcmp(val, "separate-documents-collated-copies") != 0;
Collate = strcasecmp(val, "separate-documents-collated-copies") != 0;
}
if ((val = cupsGetOption("Collate", num_options, options)) != NULL &&
strcmp(val, "True") == 0)
strcasecmp(val, "True") == 0)
Collate = 1;
if ((val = cupsGetOption("OutputOrder", num_options, options)) != NULL &&
strcmp(val, "Reverse") == 0)
strcasecmp(val, "Reverse") == 0)
Order = 1;
if ((val = cupsGetOption("number-up", num_options, options)) != NULL)
@@ -536,9 +536,9 @@ check_range(int page) /* I - Page number */
* See if we only print even or odd pages...
*/
if (strcmp(PageSet, "even") == 0 && (page & 1))
if (strcasecmp(PageSet, "even") == 0 && (page & 1))
return (0);
if (strcmp(PageSet, "odd") == 0 && !(page & 1))
if (strcasecmp(PageSet, "odd") == 0 && !(page & 1))
return (0);
}
@@ -617,7 +617,7 @@ static void
end_nup(int number) /* I - Page number */
{
if (Flip || Orientation || NUp > 1)
puts("grestoreall");
puts("ESPsave restore");
switch (NUp)
{
@@ -702,14 +702,18 @@ start_nup(int number) /* I - Page number */
int x, y; /* Relative position of subpage */
float w, l, /* Width and length of subpage */
tx, ty; /* Translation values for subpage */
float pw, pl; /* Printable width and length of full page */
if (Flip || Orientation || NUp > 1)
puts("gsave");
puts("/ESPsave save def");
if (Flip)
printf("%.0f 0 translate -1 1 scale\n", PageWidth);
pw = PageRight - PageLeft;
pl = PageTop - PageBottom;
switch (Orientation)
{
case 1 : /* Landscape */
@@ -731,44 +735,49 @@ start_nup(int number) /* I - Page number */
if (Orientation & 1)
{
x = 1 - x;
w = PageLength;
w = pl;
l = w * PageLength / PageWidth;
if (l > (PageWidth * 0.5))
if (l > (pw * 0.5))
{
l = PageWidth * 0.5;
l = pw * 0.5;
w = l * PageWidth / PageLength;
}
tx = PageWidth * 0.5 - l;
ty = (PageLength - w) * 0.5;
tx = pw * 0.5 - l;
ty = (pl - w) * 0.5;
}
else
{
l = PageWidth;
l = pw;
w = l * PageWidth / PageLength;
if (w > (PageLength * 0.5))
if (w > (pl * 0.5))
{
w = PageLength * 0.5;
w = pl * 0.5;
l = w * PageLength / PageWidth;
}
tx = PageLength * 0.5 - w;
ty = (PageWidth - l) * 0.5;
tx = pl * 0.5 - w;
ty = (pw - l) * 0.5;
}
if (Duplex && (number & 2))
printf("%.0f %.0f translate\n", PageWidth - PageRight, PageBottom);
else
printf("%.0f %.0f translate\n", PageLeft, PageBottom);
if (Orientation & 1)
{
printf("0 %.0f translate -90 rotate\n", PageLength);
printf("0 %.0f translate -90 rotate\n", pl);
printf("%.0f %.0f translate %.3f %.3f scale\n",
ty, tx + l * x, w / PageWidth, l / PageLength);
ty, tx + l * x, w / pw, l / pl);
}
else
{
printf("%.0f 0 translate 90 rotate\n", PageWidth);
printf("%.0f 0 translate 90 rotate\n", pw);
printf("%.0f %.0f translate %.3f %.3f scale\n",
tx + w * x, ty, w / PageWidth, l / PageLength);
tx + w * x, ty, w / pw, l / pl);
}
printf("newpath\n"
@@ -783,10 +792,23 @@ start_nup(int number) /* I - Page number */
case 4 :
x = number & 1;
y = 1 - ((number & 2) != 0);
w = PageWidth * 0.5;
l = PageLength * 0.5;
printf("%.0f %.0f translate 0.5 0.5 scale\n", x * w, y * l);
w = pw * 0.5;
l = w * PageLength / PageWidth;
if (l > (pl * 0.5))
{
l = pl * 0.5;
w = l * PageWidth / PageLength;
}
if (Duplex && (number & 4))
printf("%.0f %.0f translate\n", PageWidth - PageRight, PageBottom);
else
printf("%.0f %.0f translate\n", PageLeft, PageBottom);
printf("%.0f %.0f translate %.3f %.3f scale\n", x * w, y * l,
w / PageWidth, l / PageLength);
printf("newpath\n"
"0 0 moveto\n"
"%.0f 0 lineto\n"
+2 -2
Ver Arquivo
@@ -188,7 +188,7 @@ WriteProlog(char *title, /* I - Title of job */
if ((fp = fopen(CUPS_DATADIR "/data/psglyphs", "r")) != NULL)
{
while (fscanf(fp, "%x%s", &unicode, glyph) == 2)
while (fscanf(fp, "%x%63s", &unicode, glyph) == 2)
Glyphs[unicode] = strdup(glyph);
fclose(fp);
@@ -198,7 +198,7 @@ WriteProlog(char *title, /* I - Title of job */
{
memset(chars, 0, sizeof(chars));
sprintf(filename, CUPS_DATADIR "/%s", charset + 4);
snprintf(filename, sizeof(filename), CUPS_DATADIR "/%s", charset + 4);
if ((fp = fopen(filename, "r")) != NULL)
{
+114 -113
Ver Arquivo
@@ -1,123 +1,124 @@
iso-8859-1
OK
Löschen
Hilfe
Beendet
Nah
Ja
Nein
Auf
Weg von
Außer
Ausschuß
Rückstellung
Optionen
Mehr INFO
Schwarzes
Farbe
Cyan-blau
Magenta
Gelb
Okay
Abbrechen
Hilfe
Beenden
Schließen
Ja
Nein
An
Aus
Speichern
Verwerfen
Default
Optionen
Mehr Info
Schwarz
Farbe
Cyan
Magenta
Gelb
Copyright 1993-1999 durch Easy Software Products, alle Rechte vorbehalten.
General
Drucker
BildOptionen
HP-GL/2 Optionen
Extrakosten
Dokument
Anderes
DruckSeiten:
Allgemein
Drucker
Bild Optionen
HP-GL/2 Optionen
Speziell
Dokument
Andere
Druckbereich:
Gesamtes Dokument
Seitenbereich:
RückOrdnung:
Seite Format:
1-Up
2-Up
4-Up
BildScaling:
Natürliche BildGröße Des Gebrauches
Zoom durch Percent
Zoom durch PPI
SpiegelBild:
Farbe Sättigung:
Farbe Farbe:
Passen Sie, um zu paginieren:
Schattierend:
FederBreite:
Gamma Korrektur:
Umgedrehte Reihenfolge:
Seitenformat:
normal
2 auf 1
4 auf 1
Bild-Skalierung:
Natürliche Bildgröße
Zoom in Prozent
Zoom in PPI
Gespiegelte Ausgabe:
Farbsättigung:
Farbton:
Auf Seite anpassen:
Schattiert:
Strichstärke:
Gamma-Korrektur:
Helligkeit:
Fügen Sie hinzu
Löschung
ändern Sie
DruckerURI
DruckerName
DruckerStandort
Drucker-cInfo
Drucker bilden und formen
EinheitURI
Formatierung Seite
Seite Druckend
InitialisierenDrucker
DruckerZustand
Jobs Annehmend
Jobs Nicht, Annehmend
Druckjobs
Kategorie
Hinzufügen
Löschen
Ändern
Drucker-URI
Drucker-Name
Drucker-Standort
Drucker-Info
Drucker-Modell
Device-URI
Formatiere Seite
Drucke Seite
Initialisiere Drucker
Drucker-Zustand
Bereit
Nicht bereit
Druckaufträge
Klasse
Lokal
Entfernte Station
Duplexing
Heftend
Schnelle Plattenkopierprogramme
Gemischte Exemplare
Bohrung Lochen
Bedeckung
Binden
Sortierend
Klein (bis 9.5x1în)
Medium (9.5x1în bis 13x19in)
Groß (13x19in und größeres)
Kundenspezifische Größe
Remote
Duplex
Hefter
Schnellkopien
Sortieren/Gruppieren
Locher
Deckblatt
Bindung
Sortieren
Klein (bis 14x35cm)
Medium (14x35cm bis 33x48cm)
Groß (33x48cm und größer)
Benutzerspezifische Größe
Leerlauf
Verarbeitend
In Arbeit
Gestoppt
Alles
Ungerade
Gleichmäßige Seiten
Dunkleres Heller
MediaGröße
MediaArt
MediaQuelle
Lagebestimmung:
Portrait
Landschaft
Job State
Job Name
User Name
Priority
Copies
File Size
Pending
Output Mode
Resolution
400 Ihre Datenbanksuchroutine sendete einen Antrag, den dieser Server nicht verstehen könnte.
Dieser Server könnte nicht überprüfen, daß Sie autorisiert sind, das Hilfsmittel zuzugreifen.
Sie müssen zahlen, diesen Server zuzugreifen.
Sie haben nicht Erlaubnis, das Hilfsmittel auf diesem Server zuzugreifen.
Das erbetene Hilfsmittel wurde nicht auf diesem Server gefunden.
Die erbetene Methode wird nicht mit dem Hilfsmittel erlaubt.
Eine passende Darstellung für das Hilfsmittel wurde nicht auf diesem Server gefunden.
Sie haben nicht Erlaubnis, diesen Server als Proxyhauptrechner zu benutzen.
Der Antrag hat zu lang genommen, um durchzuführen und ist abgebrochen worden.
Das erbetene Hilfsmittel hat mehr als einen Wert.
Das erbetene Hilfsmittel wird gegangen und ist nicht ersetzt worden.
Die erbetene Methode benötigt ein gültiges Content-Length.
Die Vorbedingung auf dem Antrag wertete zu falschem aus.
Der Antrag ist zu groß, damit dieser Server verarbeitet.
Der AntragcUri ist zu groß, damit dieser Server verarbeitet.
Das Antragformat wird nicht durch diesen Server verstanden.
500 Der Server hat einen unrecoverable Fehler ermittelt und nicht Ihren Antrag verarbeiten kann.
Die erbetene Methode wird nicht durch diesen Server eingeführt.
Das proxy server empfing eine unzulässige Antwort von einem aufwärts gerichteten Server.
Das erbetene Hilfsmittel ist aktuell auf diesem Server nicht erreichbar.
Das proxy server hat zu lang genommen, um auf diesen Server zu reagieren.
Dieser Server unterstützt nicht die HTTP-Version, die durch Ihre Datenbanksuchroutine angefordert wird.
Gerade Seiten
Dunkler Heller
Medien-Größe
Medium
Medien-Quelle
Ausrichtung:
Hochformat
Querformat
Job-Status
Job-Name
Benutzername
Priorität
Kopien
Dateigröße
In Warteposition
Ausgabe-Modus
Auflösung
400 Der Server versteht die Anfrage Ihres Browsers nicht.
Der Server konnte nicht Ihre Berechtigung überprüfen, diese Ressource zu benutzen.
Sie müssen bezahlen, um auf diesen Server zuzugreifen.
Sie sind nicht berechtigt, auf diese Ressource des Servers zuzugreifen.
Die gewünschte Ressource wurde auf diesem Server nicht gefunden.
Die gewünschte Methode ist mit dieser Ressource nicht erlaubt.
Eine passende Art der Ressource wurde auf diesem Server nicht gefunden.
Sie können diesen Server nicht als Proxy-Server verwenden.
Der Auftrag brauchte zu lang zur Beendigung und wurde abgebrochen.
Die gewünschte Ressource besitzt mehr als einen Wert.
Die gewünschte Ressource existiert nicht mehr und wurde nicht ersetzt.
Die gewünschte Methode benötigt eine gültige Länge des Inhalts.
Die Voraussetzungen für den Auftrag sind nicht erfüllt.
Der Auftrag ist zu groß, um auf diesem Server verarbeitet zu werden.
Die URI des Auftrags ist zu groß, um auf diesem Server verarbeitet zu werden.
Das Format des Auftrags wird von diesem Server nicht verstanden.
500 Der Server hat einen nicht behebbaren Fehler entdeckt und kann Ihren Auftrag nicht verarbeiten.
Die gewünschte Methode ist auf diesen Server nicht implementiert.
Der Proxy-Server empfing eine unzulässige Antwort von einem höheren Server.
Die gewünschte Ressource ist aktuell auf diesem Server nicht verfügbarr.
Der Proxy-Server braucht zu lang, um auf diesen Server zu reagieren.
Dieser Server unterstützt nicht die HTTP-Version, die Ihr Browser benötigt.
+62 -62
Ver Arquivo
@@ -3,16 +3,16 @@ OK
Annulation
Aide
Quitté
Étroit
Fermer
Oui
Non
Sur
Outre de
Économiser
Écart
Oui
Non
Sauver
Quitté
Défaut
Options
Plus D'Information
Plus d'information
Noir
Couleur
Cyan
@@ -21,86 +21,86 @@ Jaune
Copyright 1993-1999 par Easy Software Products, tous droits réservés.
Général
Imprimante
Options D'Image
Options D'HP-GL/2
Frais supplémentaires
Options d'Image
Options d'HP-GL/2
Options supplémentaires
Document
Autre
Pages D'Impression:
Entier Document
Chaîne De Page
Commande D'Inversion:
Format De Page:
1-Up
2-Up
4-Up
Graduation D'Image:
Taille Normale D'Image D'Utilisation
Zoom par Percent
Pages d'impression:
Entier document
Chaîne de page
Commande d'Inversion:
Pages par feuilles:
1
2
4
Graduation d'image:
Emploi taille normale d'image
Zoom par pourcent
Zoom par PPI
Image De Miroir:
Saturation De Couleur:
Tonalité De Couleur:
Adaptez pour paginer:
Image de miroir:
Saturation de couleur:
Teinture de couleur:
Correspondre au page:
Ombrageant:
Largeur De Crayon lecteur:
Gamma Correction:
Largeur de crayon lecteur:
Correction de Gamma:
Éclat:
Ajoutez
Effacement
Éffacer
Modifiez
URI D'Imprimante
Nom D'Imprimante
Emplacement D'Imprimante
Information D'Imprimante
L'imprimante font et modèlent
URI De Dispositif
Page De Formatage
Imprimant La Page
D' Initialisation Imprimante
État D'Imprimante
Recevant Les Travaux
URI de l'imprimante
Nom de l'imprimante
Emplacement de l'imprimante
Information de l'imprimante
Font et modèlent de l'imprimante
Dispositif de l'URI
Formatage du page
Imprimant la page
Initialisation de l'imprimante
État de l'Imprimante
Recevant les travaux
Ne recevant pas Les Travaux
Tirages
Classe
Local
Périphérique
Distant
Duplexage
Agrafant
Rapides Copies
Assemblées Copies
Poinçon De Trou
Copie Rapides
Copies Assemblées
Poinçon de trou
Bâche
Liant
Triant
Petit (jusqu'à 9.5x1în)
Support (9.5x1în à 13x19in)
Grand (13x19in et plus grand)
Faite sur commande Taille
Ralenti
Petit (jusqu'à 9.5x1pouce)
Moyen (9.5x1pouce à 13x19pouce)
Grand (13x19pouce et plus grand)
Taille faite sur commande
Arrêter
Traitant
Arrêté
Tout
Impair
Même Pages
Plus foncé Plus Lumineux
Taille De Medias
Type De Supports
Source De Medias
Dimension du medias
Sorte de medias
Source du medias
Orientation:
Verticale
Horizontal
Job State
Job Name
User Name
Priority
État du travail
Nom du travail
Nom de l'utilisateur
Priorité
Copies
File Size
Pending
Output Mode
Grandeur du fichier
Imminent
Method de sortie
Resolution
400 Votre browser a envoyé une demande que ce serveur ne pourrait pas comprendre.
Ce serveur ne pourrait pas vérifier que vous êtes autorisés à accéder à la ressource.
400 Votre browser a envoyé une demande que ce serveur ne pouvait pas comprendre.
Ce serveur ne pouvait pas vérifier que vous êtes autoriséz à accéder à la ressource.
Vous devez payer pour accéder à ce serveur.
Vous n'avez pas la permission d'accéder à la ressource sur ce serveur.
La ressource demandée n'a pas été trouvée sur ce serveur.
@@ -112,12 +112,12 @@ La ressource demand
La ressource demandée est allée et n'a pas été substituée.
La méthode demandée exige un Content-Length valide.
La condition préalable sur la demande a évalué à faux.
La demande est trop grande pour que ce serveur traite.
L'cUri de demande est trop grand pour que ce serveur traite.
La demande est trop grande pour ce serveur.
L'Uri de demande est trop grand pour ce serveur.
Le format de demande n'est pas compris par ce serveur.
500 Le serveur a détecté une erreur irrémédiable et ne peut pas traiter votre demande.
La méthode demandée n'est pas appliquée par ce serveur.
Le proxy server a reçu une réponse incorrecte d'un serveur ascendant.
La ressource demandée est actuel indisponible sur ce serveur.
La ressource demandée est actuellement indisponible sur ce serveur.
Le proxy server a pris trop longtemps pour répondre à ce serveur.
Ce serveur ne supporte pas la version de HTTP exigée par votre browser.
+84 -84
Ver Arquivo
@@ -1,123 +1,123 @@
iso-8859-1
GIUSTO
Annullamento
Procedi
Annulla
Aiuto
Rinunciato
Vicino
Esci
Chiudi
No
Su
Fuori di
Risparmi
Scarto
Difetto
Attivo
Inattivo
Salva
Scarta
Standard
Opzioni
Più Info
Più Informazioni
Nero
Colore
Ciano
Fucsina
Colore giallo
Copyright 1993-1999 da di Easy Software Products, tutti radrizza riservato.
Generalità
Fucsia
Giallo
Copyright 1993-1999 di Easy Software Products, tutti i diritti riservati.
Generale
Stampante
Opzioni Di Immagine
Opzioni Di HP-GL/2
Supplemento
Opzioni per immagini
Opzioni per HP-GL/2
Extra
Documento
Altro
Pagine Della Stampa:
Stampa delle pagine:
Intero Documento
Gamma Di Pagina:
Ordine D'inversione:
Formato Della Pagina:
Stampa intervallo:
Ordine inverso:
Formato della pagina:
1-Up
2-Up
4-Up
Scaling Di Immagine:
Formato Naturale Di Immagine Di Uso
Zoom da Percent
Zoom da PPI
Immagine Dello Specchio:
Saturazione Di Colore:
Tonalità Di Colore:
Adattare per paginare:
Proteggendo:
Larghezza Della Penna:
Scaling dell'immagine:
Usa formato naturale dell'immagine
Zoom in percentuale
Zoom in PPI
Immagine riflessa:
Saturazione del colore:
Tonalità del colore:
Adatta alla pagina:
Ombreggiatura:
Larghezza della penna:
Correzione Gamma:
Luminosità:
Aggiungere
Cancellazione
Modificare
URI Della Stampante
Nome Della Stampante
Posizione Della Stampante
Stampante Info
Stampante fa e modella
Aggiungi
Cancella
Modifica
URI della stampante
Nome della stampante
Collocazione della stampante
Informazioni sulla stampante
Produttore e modello della stampante
URI Del Dispositivo
Pagina Di Formattazione
Stampando Pagina
D' Inizializzazione Stampante
Condizione Della Stampante
Accettando I Lavori
Non accettando I Lavori
Lavori Di Stampa
Preparazione della pagina
Stampa della Pagina
Inizializzazione Stampante
Condizione della stampante
Sto accettando le richieste di stampa
Non sto accettando le richieste di stampa
Richieste di stampa
Codice categoria
Locale
Periferico
Utilizzazione per due usi
Cucendo con punti metallici
Veloci Copie
Fascicolate Copie
Perforazione Del Foro
Covering
Legandosi
Remoto
Fronte-retro
Sto cucendo con punti metallici
Copie veloci
Copie fascicolate
Perforazione delle pagine (per fascicolatura)
Inserendo copertina
Applicando fascicolatura
Ordinando
Piccolo (fino a 9.5x1în)
Media (9.5x1în - 13x19in)
Medio (9.5x1în - 13x19in)
Grande (13x19in e più grande)
Su ordinazione Formato
Formato personalizzato
Idle
Elaborando
Arrestato
Tutto
Dispari
Anche Pagine
Pagine pari
Più Scuro Più Luminoso
Formato Di Media
Tipo Di Media
Sorgente Di Media
Formato del supporto
Tipo del supporto
Sorgente del supporto
Orientamento:
Portrait
Paesaggio
Verticale
Orizzontale
Job State
Job Name
User Name
Priority
Copies
File Size
Pending
Priorita'
Copie
Dimensioni del file
In attesa
Output Mode
Resolution
400 Il vostro browser ha trasmesso una richiesta che questo server non potrebbe capire.
Questo server non potrebbe verificare che siete autorizzati ad accedere alla risorsa.
Risoluzione
400 Il vostro browser ha trasmesso una richiesta che questo server non ha capito
Questo server non ha potuto verificare che siete autorizzati ad accedere alla risorsa.
Dovete pagare accedere a questo server.
Non avete permesso accedere alla risorsa su questo server.
Non avete il permesso di accedere alla risorsa richiesta su questo server.
La risorsa chiesta non è stata trovata su questo server.
Il metodo chiesto non è permesso con la risorsa.
Il metodo richiesto non è consentito con la risorsa desiderata.
Una rappresentazione adatta per la risorsa non è stata trovata su questo server.
Non avete permesso utilizzare questo server come calcolatore centrale di procura.
La richiesta ha preso troppo lungamente per completare ed è stata abbandonata.
Non avete il permesso utilizzare questo server come proxy.
La richiesta ha impiegato troppo tempo per essere completata ed è stata abbandonata.
La risorsa chiesta ha più di un valore.
La risorsa chiesta è andata e non è stata sostituita.
Il metodo chiesto richiede un Content-Length valido.
Il presupposto sulla richiesta ha valutato a falso.
La richiesta è troppo grande affinchè questo server elabori.
Il URI di richiesta è troppo grande affinchè questo server elabori.
Il formato di richiesta non è capito da questo server.
500 Il server ha rilevato un errore unrecoverable e non può elaborare la vostra richiesta.
Il metodo chiesto non è effettuato da questo server.
Il proxy server ha ricevuto una risposta non valida da un server verso l'alto.
La risorsa chiesta non e' piu' disponibile e non è stata ancora rimpiazzata.
Il metodo chiesto richiede un campo "Content-Length" valido.
I prerequisiti per la richiesta non sono soddisfatti.
La richiesta è troppo grande per essere elaborata da questo server.
L'URI della richiesta è troppo grande per essere elaborato da questo server.
Il formato della richiesta non è capito da questo server.
500 Il server ha rilevato un errore non recuperabile e non può elaborare la vostra richiesta.
Il metodo chiesto non è implementato da questo server.
Il proxy server ha ricevuto una risposta non valida da un server di livello superiore.
La risorsa chiesta è attualmente non disponibile su questo server.
Il proxy server ha preso troppo lungamente per rispondere a questo server.
Questo server non sostiene la versione del HTTP richiesta dal vostro browser.
Il proxy server ha impiegato troppo tempo per rispondere a questo server.
Questo server non supporta la versione HTTP richiesta dal vostro browser.
+57 -49
Ver Arquivo
@@ -62,6 +62,13 @@
#include <math.h>
/*
* Globals...
*/
extern const char *cupsProfile;
/*
* Macros...
*/
@@ -779,18 +786,9 @@ cups_map_rgb_color(gx_device *pdev, /* I - Device info */
iy = gx_max_color_value - b;
ik = min(ic, min(im, iy));
#if 0
if (ik > 0)
{
diff = 1.0 - (float)(max(ic, max(im, iy)) - ik) /
(float)gx_max_color_value;
ik = (int)(diff * (float)ik);
}
#else
mk = max(ic, max(im, iy));
if (mk > ik)
ik = ik * ik / mk;
#endif /* 0 */
if (ik == gx_max_color_value)
{
@@ -860,18 +858,9 @@ cups_map_rgb_color(gx_device *pdev, /* I - Device info */
iy = gx_max_color_value - b;
ik = min(ic, min(im, iy));
#if 0
if (ik > 0)
{
diff = 1.0 - (float)(max(ic, max(im, iy)) - ik) /
(float)gx_max_color_value;
ik = (int)(diff * (float)ik);
}
#else
mk = max(ic, max(im, iy));
if (mk > ik)
ik = ik * ik / mk;
#endif /* 0 */
if (ik == gx_max_color_value)
{
@@ -966,18 +955,9 @@ cups_map_rgb_color(gx_device *pdev, /* I - Device info */
iy = gx_max_color_value - b;
ik = min(ic, min(im, iy));
#if 0
if (ik > 0)
{
diff = 1.0 - (float)(max(ic, max(im, iy)) - ik) /
(float)gx_max_color_value;
ik = (int)(diff * (float)ik);
}
#else
mk = max(ic, max(im, iy));
if (mk > ik)
ik = ik * ik / mk;
#endif /* 0 */
if (ik == gx_max_color_value)
{
@@ -1468,6 +1448,7 @@ cups_set_color_info(gx_device *pdev) /* I - Device info */
{
int i, j, k; /* Looping vars */
float d, g; /* Density and gamma correction */
float m[3][3]; /* Color correction matrix */
char resolution[41]; /* Resolution string */
ppd_profile_t *profile; /* Color profile information */
@@ -1575,7 +1556,27 @@ cups_set_color_info(gx_device *pdev) /* I - Device info */
cupsHaveProfile = 0;
if (cups->ppd != NULL && cups->header.cupsBitsPerColor == 8)
if (cupsProfile && cups->header.cupsBitsPerColor == 8)
{
cupsHaveProfile = 1;
sscanf(cupsProfile, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &d, &g,
m[0] + 0, m[0] + 1, m[0] + 2,
m[1] + 0, m[1] + 1, m[1] + 2,
m[2] + 0, m[2] + 1, m[2] + 2);
d *= 0.001f;
g *= 0.001f;
m[0][0] *= 0.001f;
m[0][1] *= 0.001f;
m[0][2] *= 0.001f;
m[1][0] *= 0.001f;
m[1][1] *= 0.001f;
m[1][2] *= 0.001f;
m[2][0] *= 0.001f;
m[2][1] *= 0.001f;
m[2][2] *= 0.001f;
}
else if (cups->ppd != NULL && cups->header.cupsBitsPerColor == 8)
{
/*
* Find the appropriate color profile...
@@ -1608,32 +1609,39 @@ cups_set_color_info(gx_device *pdev) /* I - Device info */
cupsHaveProfile = 1;
for (i = 0; i < 3; i ++)
for (j = 0; j < 3; j ++)
for (k = 0; k <= gx_max_color_value; k ++)
{
cupsMatrix[i][j][k] = (int)((float)k * profile->matrix[i][j] + 0.5);
#ifdef DEBUG
if ((k & 4095) == 0)
fprintf(stderr, "DEBUG: cupsMatrix[%d][%d][%d] = %d\n",
i, j, k, cupsMatrix[i][j][k]);
#endif /* DEBUG */
}
d = profile->density;
g = profile->gamma;
memcpy(m, profile->matrix, sizeof(m));
}
}
if (cupsHaveProfile)
{
for (i = 0; i < 3; i ++)
for (j = 0; j < 3; j ++)
for (k = 0; k <= gx_max_color_value; k ++)
{
cupsMatrix[i][j][k] = (int)((float)k * m[i][j] + 0.5);
for (k = 0; k <= gx_max_color_value; k ++)
{
cupsDensity[k] = (int)((float)gx_max_color_value * d *
pow((float)k / (float)gx_max_color_value, g) +
0.5);
#ifdef DEBUG
if ((k & 4095) == 0)
fprintf(stderr, "DEBUG: cupsDensity[%d] = %d\n", k, cupsDensity[k]);
if ((k & 4095) == 0)
fprintf(stderr, "DEBUG: cupsMatrix[%d][%d][%d] = %d\n",
i, j, k, cupsMatrix[i][j][k]);
#endif /* DEBUG */
}
for (k = 0; k <= gx_max_color_value; k ++)
{
cupsDensity[k] = (int)((float)gx_max_color_value * d *
pow((float)k / (float)gx_max_color_value, g) +
0.5);
#ifdef DEBUG
if ((k & 4095) == 0)
fprintf(stderr, "DEBUG: cupsDensity[%d] = %d\n", k, cupsDensity[k]);
#endif /* DEBUG */
}
}
}
}
+1 -1
Ver Arquivo
@@ -86,7 +86,7 @@ gdev_prn_alloc(gx_device *pdev)
if ((cache_env = getenv("RIP_MAX_CACHE")) != NULL)
{
switch (sscanf(cache_env, "%d%s", &cache_size, cache_units))
switch (sscanf(cache_env, "%d%254s", &cache_size, cache_units))
{
case 0 :
cache_size = 32 * 1024 * 1024;
+22 -1
Ver Arquivo
@@ -39,18 +39,22 @@
* Include necessary headers...
*/
#include <cups/string.h>
#define bool bool_ /* (maybe not needed) */
#define uchar uchar_
#define uint uint_
#define ushort ushort_
#define ulong ulong_
#include <cups/cups.h>
#include <cups/string.h>
#include <stdlib.h>
#undef bool
#undef uchar
#undef uint
#undef ushort
#undef ulong
#include "ghost.h"
#include "imain.h"
#include "iminst.h"
@@ -59,6 +63,13 @@
#include "store.h"
/*
* Globals...
*/
const char *cupsProfile = NULL;
/*
* Local functions...
*/
@@ -81,6 +92,8 @@ main(int argc, /* I - Number of command-line arguments */
int exit_code; /* Exit code */
ref error_object; /* Error object */
char *content_type; /* CONTENT_TYPE environment variable */
int num_options; /* Number of job options */
cups_option_t *options; /* Job options */
/*
@@ -101,6 +114,14 @@ main(int argc, /* I - Number of command-line arguments */
gs_get_real_stdio(stdfiles);
/*
* Grab any job options...
*/
num_options = cupsParseOptions(argv[5], 0, &options);
cupsProfile = cupsGetOption("profile", num_options, options);
/*
* Initialize basic interpreter stuff and read from the named file or
* from stdin...
+136 -15
Ver Arquivo
@@ -36,6 +36,7 @@
* IsAuthorized() - Check to see if the user is authorized...
* add_allow() - Add an allow mask to the location.
* add_deny() - Add a deny mask to the location.
* pam_func() - PAM conversation function.
*/
/*
@@ -51,6 +52,10 @@
#ifdef HAVE_CRYPT_H
# include <crypt.h>
#endif /* HAVE_CRYPT_H */
#ifdef HAVE_LIBPAM
# include <security/pam_appl.h>
#endif /* HAVE_LIBPAM */
/*
* Local functions...
@@ -60,6 +65,10 @@ static authmask_t *add_allow(location_t *loc);
static authmask_t *add_deny(location_t *loc);
static int check_auth(unsigned ip, char *name, int namelen,
int num_masks, authmask_t *masks);
#ifdef HAVE_LIBPAM
static int pam_func(int, const struct pam_message **,
struct pam_response **, void *);
#endif /* HAVE_LIBPAM */
/*
@@ -260,10 +269,16 @@ IsAuthorized(client_t *con) /* I - Connection */
int bestlen, /* Length of best match */
hostlen; /* Length of hostname */
struct passwd *pw; /* User password data */
struct group *grp; /* Group data */
char *pass; /* Encrypted password */
#ifdef HAVE_SHADOW_H
struct spwd *spw; /* Shadow password data */
#endif /* HAVE_SHADOW_H */
struct group *grp; /* Group data */
#ifdef HAVE_LIBPAM
pam_handle_t *pamh; /* PAM authentication handle */
int pamerr; /* PAM error code */
struct pam_conv pamdata; /* PAM conversation data */
#endif /* HAVE_LIBPAM */
/*
@@ -348,7 +363,7 @@ IsAuthorized(client_t *con) /* I - Connection */
con->username, con->password));
if (con->username[0] == '\0' || con->password[0] == '\0')
return (HTTP_UNAUTHORIZED); /* Non-anonymous needed user/pass */
return (HTTP_UNAUTHORIZED); /* Non-anonymous needs user/pass */
/*
* Check the user's password...
@@ -364,36 +379,71 @@ IsAuthorized(client_t *con) /* I - Connection */
return (HTTP_UNAUTHORIZED);
}
if (pw->pw_passwd[0] == '\0') /* Don't allow blank passwords! */
#ifdef HAVE_LIBPAM
/*
* Only use PAM to do authentication. This allows MD5 passwords, among
* other things...
*/
pamdata.conv = pam_func;
pamdata.appdata_ptr = con;
pamerr = pam_start("passwd", con->username, &pamdata, &pamh);
if (pamerr != PAM_SUCCESS)
{
LogMessage(LOG_WARN, "IsAuthorized: Username \"%s\" has no password; access denied.",
con->username);
LogMessage(LOG_ERROR, "IsAuthorized: pam_start() returned %d!\n",
pamerr);
pam_end(pamh, 0);
return (HTTP_UNAUTHORIZED);
}
DEBUG_printf(("pw->pw_passwd = \"%s\"\n", pw->pw_passwd));
pamerr = pam_authenticate(pamh, PAM_SILENT);
if (pamerr != PAM_SUCCESS)
{
LogMessage(LOG_ERROR, "IsAuthorized: pam_authenticate() returned %d!\n",
pamerr);
pam_end(pamh, 0);
return (HTTP_UNAUTHORIZED);
}
#ifdef HAVE_SHADOW_H
pamerr = pam_acct_mgmt(pamh, PAM_SILENT);
if (pamerr != PAM_SUCCESS)
{
LogMessage(LOG_ERROR, "IsAuthorized: pam_acct_mgmt() returned %d!\n",
pamerr);
pam_end(pamh, 0);
return (HTTP_UNAUTHORIZED);
}
pam_end(pamh, PAM_SUCCESS);
#else
# ifdef HAVE_SHADOW_H
spw = getspnam(con->username);
endspent();
if (spw == NULL && strcmp(pw->pw_passwd, "x") == 0)
{ /* Don't allow blank passwords! */
LogMessage(LOG_WARN, "IsAuthorized: Username \"%s\" has no shadow password; access denied.",
con->username);
return (HTTP_UNAUTHORIZED); /* No such user or bad shadow file */
}
# ifdef DEBUG
# ifdef DEBUG
if (spw != NULL)
printf("spw->sp_pwdp = \"%s\"\n", spw->sp_pwdp);
else
puts("spw = NULL");
# endif /* DEBUG */
# endif /* DEBUG */
if (spw != NULL && spw->sp_pwdp[0] == '\0')
if (spw != NULL && spw->sp_pwdp[0] == '\0' && pw->pw_passwd[0] == '\0')
# else
if (pw->pw_passwd[0] == '\0') /* Don't allow blank passwords! */
# endif /* HAVE_SHADOW_H */
{ /* Don't allow blank passwords! */
LogMessage(LOG_WARN, "IsAuthorized: Username \"%s\" has no password; access denied.",
con->username);
return (HTTP_UNAUTHORIZED);
}
#endif /* HAVE_SHADOW_H */
/*
* OK, the password isn't blank, so compare with what came from the client...
@@ -402,21 +452,28 @@ IsAuthorized(client_t *con) /* I - Connection */
DEBUG_printf(("IsAuthorized: pw_passwd = %s, crypt = %s\n",
pw->pw_passwd, crypt(con->password, pw->pw_passwd)));
if (strcmp(pw->pw_passwd, crypt(con->password, pw->pw_passwd)) != 0)
pass = crypt(con->password, pw->pw_passwd);
if (pass == NULL ||
strcmp(pw->pw_passwd, crypt(con->password, pw->pw_passwd)) != 0)
{
#ifdef HAVE_SHADOW_H
# ifdef HAVE_SHADOW_H
if (spw != NULL)
{
DEBUG_printf(("IsAuthorized: sp_pwdp = %s, crypt = %s\n",
spw->sp_pwdp, crypt(con->password, spw->sp_pwdp)));
if (strcmp(spw->sp_pwdp, crypt(con->password, spw->sp_pwdp)) != 0)
pass = crypt(con->password, spw->sp_pwdp);
if (pass == NULL ||
strcmp(spw->sp_pwdp, crypt(con->password, spw->sp_pwdp)) != 0)
return (HTTP_UNAUTHORIZED);
}
else
#endif /* HAVE_SHADOW_H */
# endif /* HAVE_SHADOW_H */
return (HTTP_UNAUTHORIZED);
}
#endif /* HAVE_LIBPAM */
/*
* OK, the password is good. See if we need normal user access, or group
@@ -597,6 +654,70 @@ check_auth(unsigned ip, /* I - Client address */
}
#ifdef HAVE_LIBPAM
/*
* 'pam_func()' - PAM conversation function.
*/
static int /* O - Success or failure */
pam_func(int num_msg, /* I - Number of messages */
const struct pam_message **msg, /* I - Messages */
struct pam_response **resp, /* O - Responses */
void *appdata_ptr) /* I - Pointer to connection */
{
int i; /* Looping var */
struct pam_response *replies; /* Replies */
client_t *client; /* Pointer client connection */
/*
* Allocate memory for the responses...
*/
if ((replies = malloc(sizeof(struct pam_response) * num_msg)) == NULL)
return (PAM_CONV_ERR);
/*
* Answer all of the messages...
*/
client = (client_t *)appdata_ptr;
for (i = 0; i < num_msg; i ++)
switch (msg[i]->msg_style)
{
case PAM_PROMPT_ECHO_ON:
replies[i].resp_retcode = PAM_SUCCESS;
replies[i].resp = strdup(client->username);
break;
case PAM_PROMPT_ECHO_OFF:
replies[i].resp_retcode = PAM_SUCCESS;
replies[i].resp = strdup(client->password);
break;
case PAM_TEXT_INFO:
case PAM_ERROR_MSG:
replies[i].resp_retcode = PAM_SUCCESS;
replies[i].resp = NULL;
break;
default:
free(replies);
return (PAM_CONV_ERR);
}
/*
* Return the responses back to PAM...
*/
*resp = replies;
return (PAM_SUCCESS);
}
#endif /* HAVE_LIBPAM */
/*
* End of "$Id$".
*/
+24 -22
Ver Arquivo
@@ -295,7 +295,7 @@ ReadClient(client_t *con) /* I - Client to read from */
* Grab the request line...
*/
switch (sscanf(line, "%63s%1023s%s", operation, con->uri, version))
switch (sscanf(line, "%63s%1023s%63s", operation, con->uri, version))
{
case 1 :
SendError(con, HTTP_BAD_REQUEST);
@@ -474,17 +474,17 @@ ReadClient(client_t *con) /* I - Client to read from */
if (strncmp(con->uri, "/printers", 9) == 0)
{
sprintf(command, "%s/cgi-bin/printers.cgi", ServerRoot);
snprintf(command, sizeof(command), "%s/cgi-bin/printers.cgi", ServerRoot);
options = con->uri + 9;
}
else if (strncmp(con->uri, "/classes", 8) == 0)
{
sprintf(command, "%s/cgi-bin/classes.cgi", ServerRoot);
snprintf(command, sizeof(command), "%s/cgi-bin/classes.cgi", ServerRoot);
options = con->uri + 8;
}
else
{
sprintf(command, "%s/cgi-bin/jobs.cgi", ServerRoot);
snprintf(command, sizeof(command), "%s/cgi-bin/jobs.cgi", ServerRoot);
options = con->uri + 5;
}
@@ -585,17 +585,17 @@ ReadClient(client_t *con) /* I - Client to read from */
if (strncmp(con->uri, "/printers", 9) == 0)
{
sprintf(command, "%s/cgi-bin/printers", ServerRoot);
snprintf(command, sizeof(command), "%s/cgi-bin/printers", ServerRoot);
options = con->uri + 9;
}
else if (strncmp(con->uri, "/classes", 8) == 0)
{
sprintf(command, "%s/cgi-bin/classes", ServerRoot);
snprintf(command, sizeof(command), "%s/cgi-bin/classes", ServerRoot);
options = con->uri + 8;
}
else
{
sprintf(command, "%s/cgi-bin/jobs", ServerRoot);
snprintf(command, sizeof(command), "%s/cgi-bin/jobs", ServerRoot);
options = con->uri + 5;
}
@@ -640,7 +640,7 @@ ReadClient(client_t *con) /* I - Client to read from */
* Send PPD file...
*/
sprintf(command, "/ppd/%s", con->uri + 10);
snprintf(command, sizeof(command), "/ppd/%s", con->uri + 10);
strcpy(con->uri, command);
}
@@ -773,9 +773,10 @@ ReadClient(client_t *con) /* I - Client to read from */
* Create a file as needed for the request data...
*/
sprintf(con->filename, "%s/requests/XXXXXX", ServerRoot);
snprintf(con->filename, sizeof(con->filename), "%s/requests/XXXXXX", ServerRoot);
con->file = mkstemp(con->filename);
fchmod(con->file, 0644);
fchmod(con->file, 0640);
fchown(con->file, User, Group);
LogMessage(LOG_DEBUG, "ReadClient() %d REQUEST %s", con->http.fd,
con->filename);
@@ -966,11 +967,12 @@ SendError(client_t *con, /* I - Connection */
* Send a human-readable error message.
*/
sprintf(message, "<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>"
"<BODY><H1>%s</H1>%s</BODY></HTML>\n",
code, httpStatus(code), httpStatus(code),
con->language ? con->language->messages[code] :
httpStatus(code));
snprintf(message, sizeof(message),
"<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>"
"<BODY><H1>%s</H1>%s</BODY></HTML>\n",
code, httpStatus(code), httpStatus(code),
con->language ? con->language->messages[code] :
httpStatus(code));
if (httpPrintf(HTTP(con), "Content-Type: text/html\r\n") < 0)
return (0);
@@ -1238,7 +1240,7 @@ decode_basic_auth(client_t *con) /* I - Client to decode to */
httpDecode64(value, s);
sscanf(value, "%[^:]:%[^\n]", con->username, con->password);
sscanf(value, "%31[^:]:%31s", con->username, con->password);
LogMessage(LOG_DEBUG, "decode_basic_auth() %d username=\"%s\"",
con->http.fd, con->username);
@@ -1263,12 +1265,12 @@ get_file(client_t *con, /* I - Client connection */
*/
if (strncmp(con->uri, "/ppd/", 5) == 0)
sprintf(filename, "%s%s", ServerRoot, con->uri);
snprintf(filename, sizeof(filename), "%s%s", ServerRoot, con->uri);
else if (con->language != NULL)
sprintf(filename, "%s/%s%s", DocumentRoot, con->language->language,
snprintf(filename, sizeof(filename), "%s/%s%s", DocumentRoot, con->language->language,
con->uri);
else
sprintf(filename, "%s%s", DocumentRoot, con->uri);
snprintf(filename, sizeof(filename), "%s%s", DocumentRoot, con->uri);
if ((params = strchr(filename, '?')) != NULL)
*params = '\0';
@@ -1286,7 +1288,7 @@ get_file(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/ppd/", 5) != 0)
{
sprintf(filename, "%s%s", DocumentRoot, con->uri);
snprintf(filename, sizeof(filename), "%s%s", DocumentRoot, con->uri);
status = stat(filename, filestats);
}
@@ -1430,8 +1432,8 @@ pipe_command(client_t *con, /* I - Client connection */
else
{
sprintf(content_length, "CONTENT_LENGTH=%d", con->http.data_remaining);
sprintf(content_type, "CONTENT_TYPE=%s",
con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
snprintf(content_type, sizeof(content_type), "CONTENT_TYPE=%s",
con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
envp[12] = "REQUEST_METHOD=POST";
envp[13] = content_length;
+11 -7
Ver Arquivo
@@ -177,14 +177,18 @@ ReadConfiguration(void)
else if (strcmp(language, "C") == 0 || strcmp(language, "POSIX") == 0)
language = "en";
strcpy(DefaultLanguage, language);
strncpy(DefaultLanguage, language, sizeof(DefaultLanguage) - 1);
DefaultLanguage[sizeof(DefaultLanguage) - 1] = '\0';
strcpy(DefaultCharset, DEFAULT_CHARSET);
strcpy(RIPCache, "8m");
if (getenv("TMPDIR") == NULL)
strcpy(TempDir, "/var/tmp");
else
strcpy(TempDir, getenv("TMPDIR"));
{
strncpy(TempDir, getenv("TMPDIR"), sizeof(TempDir) - 1);
TempDir[sizeof(TempDir) - 1] = '\0';
}
/*
* Find the default system group: "sys", "system", or "root"...
@@ -411,8 +415,8 @@ read_configuration(FILE *fp) /* I - File to read from */
if (get_address(value, INADDR_ANY, IPP_PORT,
&(Listeners[NumListeners].address)))
{
LogMessage(LOG_INFO, "Listening to %s:%d\n",
inet_ntoa(Listeners[NumListeners].address.sin_addr),
LogMessage(LOG_INFO, "Listening to %x:%d\n",
ntohl(Listeners[NumListeners].address.sin_addr.s_addr),
ntohs(Listeners[NumListeners].address.sin_port));
NumListeners ++;
}
@@ -434,8 +438,8 @@ read_configuration(FILE *fp) /* I - File to read from */
{
if (get_address(value, INADDR_NONE, BrowsePort, Browsers + NumBrowsers))
{
LogMessage(LOG_INFO, "Sending browsing info to %s:%d\n",
inet_ntoa(Browsers[NumBrowsers].sin_addr),
LogMessage(LOG_INFO, "Sending browsing info to %x:%d\n",
ntohl(Browsers[NumBrowsers].sin_addr.s_addr),
ntohs(Browsers[NumBrowsers].sin_port));
NumBrowsers ++;
}
@@ -837,7 +841,7 @@ get_address(char *value, /* I - Value string */
* Try to grab a hostname and port number...
*/
switch (sscanf(value, "%[^:]:%s", hostname, portname))
switch (sscanf(value, "%255[^:]:%255s", hostname, portname))
{
case 1 :
if (strchr(hostname, '.') == NULL)
+11 -5
Ver Arquivo
@@ -207,7 +207,7 @@ UpdateBrowseList(void)
packet[bytes] = '\0';
#endif /* DEBUG */
if (sscanf(packet, "%x%x%s", &type, &state, uri) != 3)
if (sscanf(packet, "%x%x%1023s", &type, &state, uri) != 3)
{
LogMessage(LOG_WARN, "UpdateBrowseList: Garbled browse packet - %s",
packet);
@@ -246,7 +246,7 @@ UpdateBrowseList(void)
*/
if (strncmp(resource, "/classes/", 9) == 0)
sprintf(name, "%s@%s", resource + 9, host);
snprintf(name, sizeof(name), "%s@%s", resource + 9, host);
else
return;
@@ -273,7 +273,10 @@ UpdateBrowseList(void)
}
}
else
strcpy(name, resource + 9);
{
strncpy(name, resource + 9, sizeof(name) - 1);
name[sizeof(name) - 1] = '\0';
}
if (p == NULL)
{
@@ -301,7 +304,7 @@ UpdateBrowseList(void)
*/
if (strncmp(resource, "/printers/", 10) == 0)
sprintf(name, "%s@%s", resource + 10, host);
snprintf(name, sizeof(name), "%s@%s", resource + 10, host);
else
return;
@@ -328,7 +331,10 @@ UpdateBrowseList(void)
}
}
else
strcpy(name, resource + 10);
{
strncpy(name, resource + 10, sizeof(name) - 1);
name[sizeof(name) - 1] = '\0';
}
if (p == NULL)
{
+204 -57
Ver Arquivo
@@ -287,7 +287,12 @@ ProcessIPPRequest(client_t *con) /* I - Client connection */
}
SendHeader(con, HTTP_OK, "application/ipp");
httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n", ippLength(con->response));
con->http.data_encoding = HTTP_ENCODE_LENGTH;
con->http.data_remaining = ippLength(con->response);
httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n",
con->http.data_remaining);
FD_SET(con->http.fd, &OutputSet);
}
@@ -323,6 +328,8 @@ accept_jobs(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "accept_jobs: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -339,8 +346,7 @@ accept_jobs(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("accept_jobs: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "accept_jobs: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -394,6 +400,8 @@ add_class(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "add_class: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -475,11 +483,23 @@ add_class(client_t *con, /* I - Client connection */
*/
if ((attr = ippFindAttribute(con->request, "printer-location", IPP_TAG_TEXT)) != NULL)
strcpy(pclass->location, attr->values[0].string.text);
{
strncpy(pclass->location, attr->values[0].string.text, sizeof(pclass->location) - 1);
pclass->location[sizeof(pclass->location) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "printer-info", IPP_TAG_TEXT)) != NULL)
strcpy(pclass->info, attr->values[0].string.text);
{
strncpy(pclass->info, attr->values[0].string.text, sizeof(pclass->info) - 1);
pclass->info[sizeof(pclass->info) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "printer-more-info", IPP_TAG_URI)) != NULL)
strcpy(pclass->more_info, attr->values[0].string.text);
{
strncpy(pclass->more_info, attr->values[0].string.text, sizeof(pclass->more_info) - 1);
pclass->more_info[sizeof(pclass->more_info) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
{
LogMessage(LOG_INFO, "Setting %s printer-is-accepting-jobs to %d (was %d.)",
@@ -544,8 +564,7 @@ add_class(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("add_class: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "add_class: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -567,6 +586,7 @@ add_class(client_t *con, /* I - Client connection */
SetPrinterAttrs(pclass);
SaveAllClasses();
CheckJobs();
LogMessage(LOG_INFO, "New class \'%s\' added by \'%s\'.", pclass->name,
con->username);
@@ -605,6 +625,8 @@ add_printer(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "add_printer: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -686,18 +708,33 @@ add_printer(client_t *con, /* I - Client connection */
*/
if ((attr = ippFindAttribute(con->request, "printer-location", IPP_TAG_TEXT)) != NULL)
strcpy(printer->location, attr->values[0].string.text);
{
strncpy(printer->location, attr->values[0].string.text, sizeof(printer->location) - 1);
printer->location[sizeof(printer->location) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "printer-info", IPP_TAG_TEXT)) != NULL)
strcpy(printer->info, attr->values[0].string.text);
{
strncpy(printer->info, attr->values[0].string.text, sizeof(printer->info) - 1);
printer->info[sizeof(printer->info) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "printer-more-info", IPP_TAG_URI)) != NULL)
strcpy(printer->more_info, attr->values[0].string.text);
{
strncpy(printer->more_info, attr->values[0].string.text, sizeof(printer->more_info) - 1);
printer->more_info[sizeof(printer->more_info) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "device-uri", IPP_TAG_URI)) != NULL)
{
LogMessage(LOG_INFO, "Setting %s device-uri to \"%s\" (was \"%s\".)",
printer->name, attr->values[0].string.text, printer->device_uri);
strcpy(printer->device_uri, attr->values[0].string.text);
strncpy(printer->device_uri, attr->values[0].string.text,
sizeof(printer->device_uri) - 1);
printer->device_uri[sizeof(printer->device_uri) - 1] = '\0';
}
if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
{
LogMessage(LOG_INFO, "Setting %s printer-is-accepting-jobs to %d (was %d.)",
@@ -775,8 +812,15 @@ add_printer(client_t *con, /* I - Client connection */
* interfaces directory and make it executable...
*/
rename(con->filename, filename);
chmod(filename, 0755);
if (rename(con->filename, filename))
{
LogMessage(LOG_ERROR, "add_printer: Unable to rename interface script - %s!",
strerror(errno));
send_ipp_error(con, IPP_INTERNAL_ERROR);
return;
}
else
chmod(filename, 0755);
}
sprintf(filename, "%s/ppd/%s.ppd", ServerRoot, printer->name);
@@ -788,8 +832,15 @@ add_printer(client_t *con, /* I - Client connection */
* ppd directory and make it readable by all...
*/
rename(con->filename, filename);
chmod(filename, 0644);
if (rename(con->filename, filename))
{
LogMessage(LOG_ERROR, "add_printer: Unable to rename PPD file - %s!",
strerror(errno));
send_ipp_error(con, IPP_INTERNAL_ERROR);
return;
}
else
chmod(filename, 0644);
}
else
{
@@ -815,6 +866,7 @@ add_printer(client_t *con, /* I - Client connection */
SetPrinterAttrs(printer);
SaveAllPrinters();
CheckJobs();
LogMessage(LOG_INFO, "New printer \'%s\' added by \'%s\'.", printer->name,
con->username);
@@ -853,6 +905,8 @@ cancel_all_jobs(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "cancel_all_jobs: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -882,8 +936,7 @@ cancel_all_jobs(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("cancel_all_jobs: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "cancel_all_jobs: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -919,10 +972,25 @@ cancel_job(client_t *con, /* I - Client connection */
resource[HTTP_MAX_URI];
/* Resource portion of URI */
int port; /* Port portion of URI */
job_t *job; /* Job information */
DEBUG_printf(("cancel_job(%08x, %08x)\n", con, uri));
/*
* Verify that the POST operation was done to a valid URI.
*/
if (strncmp(con->uri, "/classes/", 9) != 0 &&
strncmp(con->uri, "/jobs/", 5) != 0 &&
strncmp(con->uri, "/printers/", 10) != 0)
{
LogMessage(LOG_ERROR, "cancel_job: cancel request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
/*
* See if we have a job URI or a printer URI...
*/
@@ -969,17 +1037,39 @@ cancel_job(client_t *con, /* I - Client connection */
* See if the job exists...
*/
if (FindJob(jobid) == NULL)
if ((job = FindJob(jobid)) == NULL)
{
/*
* Nope - return a "not found" error...
*/
DEBUG_printf(("cancel_job: job #%d doesn't exist!\n", jobid));
LogMessage(LOG_ERROR, "cancel_job: job #%d doesn't exist!", jobid);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
/*
* See if the job is owned by the requesting user...
*/
if ((attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME)) != NULL)
{
strncpy(username, attr->values[0].string.text, sizeof(username) - 1);
username[sizeof(username) - 1] = '\0';
}
else if (con->username[0])
strcpy(username, con->username);
else
username[0] = '\0';
if (strcmp(username, job->username) != 0 && strcmp(username, "root") != 0)
{
LogMessage(LOG_ERROR, "cancel_job: \"%s\" not authorized to delete job id %d owned by \"%s\"!",
username, jobid, job->username);
send_ipp_error(con, IPP_FORBIDDEN);
return;
}
/*
* Cancel the job and return...
*/
@@ -1151,6 +1241,8 @@ delete_printer(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "delete_printer: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -1169,8 +1261,7 @@ delete_printer(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("get_printer_attrs: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "delete_printer: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -1290,8 +1381,7 @@ get_jobs(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("get_jobs: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "get_jobs: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -1672,8 +1762,7 @@ get_printer_attrs(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("get_printer_attrs: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "get_printer_attrs: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -1751,6 +1840,19 @@ print_job(client_t *con, /* I - Client connection */
DEBUG_printf(("print_job(%08x, %08x)\n", con, uri));
/*
* Verify that the POST operation was done to a valid URI.
*/
if (strncmp(con->uri, "/classes/", 9) != 0 &&
strncmp(con->uri, "/printers/", 10) != 0)
{
LogMessage(LOG_ERROR, "print_job: cancel request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
/*
* OK, see if the client is sending the document compressed - CUPS
* doesn't support compression yet...
@@ -1760,7 +1862,7 @@ print_job(client_t *con, /* I - Client connection */
{
DEBUG_puts("print_job: Unsupported compression attribute!");
send_ipp_error(con, IPP_ATTRIBUTES);
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED, IPP_TAG_KEYWORD,
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
"compression", NULL, attr->values[0].string.text);
return;
}
@@ -1780,19 +1882,28 @@ print_job(client_t *con, /* I - Client connection */
* Is it a format we support?
*/
if ((format = ippFindAttribute(con->request, "document-format", IPP_TAG_MIMETYPE)) == NULL)
if ((format = ippFindAttribute(con->request, "document-format", IPP_TAG_MIMETYPE)) != NULL)
{
DEBUG_puts("print_job: missing document-format attribute!");
send_ipp_error(con, IPP_BAD_REQUEST);
return;
}
/*
* Grab format from client...
*/
if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]", super, type) != 2)
if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]", super, type) != 2)
{
DEBUG_printf(("print_job: could not scan type \'%s\'!\n",
format->values[0].string.text));
send_ipp_error(con, IPP_BAD_REQUEST);
return;
}
}
else
{
DEBUG_printf(("print_job: could not scan type \'%s\'!\n",
format->values[0].string.text));
send_ipp_error(con, IPP_BAD_REQUEST);
return;
/*
* No document format attribute? Auto-type it!
*/
strcpy(super, "application");
strcpy(type, "octet-stream");
}
if (strcmp(super, "application") == 0 &&
@@ -1811,9 +1922,16 @@ print_job(client_t *con, /* I - Client connection */
* Replace the document-format attribute value with the auto-typed one.
*/
free(format->values[0].string.text);
sprintf(mimetype, "%s/%s", filetype->super, filetype->type);
format->values[0].string.text = strdup(mimetype);
if (format != NULL)
{
free(format->values[0].string.text);
format->values[0].string.text = strdup(mimetype);
}
else
ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
"document-format", NULL, mimetype);
}
}
else
@@ -1824,7 +1942,7 @@ print_job(client_t *con, /* I - Client connection */
DEBUG_printf(("print_job: Unsupported format \'%s\'!\n",
format->values[0].string.text));
send_ipp_error(con, IPP_DOCUMENT_FORMAT);
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED, IPP_TAG_MIMETYPE,
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_MIMETYPE,
"document-format", NULL, format->values[0].string.text);
return;
}
@@ -1844,8 +1962,7 @@ print_job(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("print_job: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "print_job: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -1861,6 +1978,8 @@ print_job(client_t *con, /* I - Client connection */
if (!printer->accepting)
{
LogMessage(LOG_INFO, "print_job: destination \'%s\' is not accepting jobs.",
dest);
send_ipp_error(con, IPP_NOT_ACCEPTING);
return;
}
@@ -1881,6 +2000,8 @@ print_job(client_t *con, /* I - Client connection */
if ((job = AddJob(priority, printer->name)) == NULL)
{
LogMessage(LOG_ERROR, "print_job: unable to add job for destination \'%s\'!",
dest);
send_ipp_error(con, IPP_INTERNAL_ERROR);
return;
}
@@ -1892,7 +2013,8 @@ print_job(client_t *con, /* I - Client connection */
con->request = NULL;
strcpy(job->filename, con->filename);
strcpy(job->title, title);
strncpy(job->title, title, sizeof(job->title) - 1);
con->filename[0] = '\0';
strcpy(job->username, con->username);
@@ -1970,6 +2092,8 @@ reject_jobs(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "reject_jobs: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -1986,8 +2110,7 @@ reject_jobs(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("reject_jobs: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "reject_jobs: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -2007,7 +2130,11 @@ reject_jobs(client_t *con, /* I - Client connection */
IPP_TAG_TEXT)) == NULL)
strcpy(printer->state_message, "Rejecting Jobs");
else
strcpy(printer->state_message, attr->values[0].string.text);
{
strncpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message) - 1);
printer->state_message[sizeof(printer->state_message) - 1] = '\0';
}
if (dtype == CUPS_PRINTER_CLASS)
LogMessage(LOG_INFO, "Class \'%s\' rejecting jobs (\'%s\').", name,
@@ -2034,6 +2161,7 @@ send_ipp_error(client_t *con, /* I - Client connection */
{
DEBUG_printf(("send_ipp_error(%08x, %04x)\n", con, status));
LogMessage(LOG_DEBUG, "Sending IPP error code %x.", status);
if (con->filename[0])
unlink(con->filename);
@@ -2070,6 +2198,8 @@ set_default(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "set_default: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -2086,8 +2216,7 @@ set_default(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("set_default: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "set_default: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -2145,6 +2274,8 @@ start_printer(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "start_printer: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -2161,8 +2292,7 @@ start_printer(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("start_printer: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "start_printer: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -2231,6 +2361,8 @@ stop_printer(client_t *con, /* I - Client connection */
if (strncmp(con->uri, "/admin/", 7) != 0)
{
LogMessage(LOG_ERROR, "stop_printer: admin request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
@@ -2247,8 +2379,7 @@ stop_printer(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("stop_printer: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "stop_printer: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
@@ -2273,7 +2404,11 @@ stop_printer(client_t *con, /* I - Client connection */
IPP_TAG_TEXT)) == NULL)
strcpy(printer->state_message, "Paused");
else
strcpy(printer->state_message, attr->values[0].string.text);
{
strncpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message) - 1);
printer->state_message[sizeof(printer->state_message) - 1] = '\0';
}
if (dtype == CUPS_PRINTER_CLASS)
LogMessage(LOG_INFO, "Class \'%s\' stopped by \'%s\'.", name,
@@ -2362,6 +2497,19 @@ validate_job(client_t *con, /* I - Client connection */
DEBUG_printf(("validate_job(%08x, %08x)\n", con, uri));
/*
* Verify that the POST operation was done to a valid URI.
*/
if (strncmp(con->uri, "/classes/", 9) != 0 &&
strncmp(con->uri, "/printers/", 10) != 0)
{
LogMessage(LOG_ERROR, "validate_job: request on bad resource \'%s\'!",
con->uri);
send_ipp_error(con, IPP_NOT_AUTHORIZED);
return;
}
/*
* OK, see if the client is sending the document compressed - CUPS
* doesn't support compression yet...
@@ -2371,7 +2519,7 @@ validate_job(client_t *con, /* I - Client connection */
{
DEBUG_puts("validate_job: Unsupported compression attribute!");
send_ipp_error(con, IPP_ATTRIBUTES);
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED, IPP_TAG_KEYWORD,
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
"compression", NULL, attr->values[0].string.text);
return;
}
@@ -2402,7 +2550,7 @@ validate_job(client_t *con, /* I - Client connection */
DEBUG_printf(("validate_job: Unsupported format \'%s\'!\n",
format->values[0].string.text));
send_ipp_error(con, IPP_DOCUMENT_FORMAT);
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED, IPP_TAG_MIMETYPE,
attr = ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_MIMETYPE,
"document-format", NULL, format->values[0].string.text);
return;
}
@@ -2419,8 +2567,7 @@ validate_job(client_t *con, /* I - Client connection */
* Bad URI...
*/
DEBUG_printf(("validate_job: resource name \'%s\' no good!\n",
resource));
LogMessage(LOG_ERROR, "validate_job: resource name \'%s\' no good!", resource);
send_ipp_error(con, IPP_NOT_FOUND);
return;
}
+3 -4
Ver Arquivo
@@ -404,8 +404,7 @@ StartJob(int id, /* I - Job ID */
(attr->value_tag == IPP_TAG_NAME ||
attr->value_tag == IPP_TAG_NAMELANG))
strcpy(title, attr->values[0].string.text);
else if ((attr->group_tag == IPP_TAG_JOB ||
attr->group_tag == IPP_TAG_EXTENSION) &&
else if (attr->group_tag == IPP_TAG_JOB &&
(optptr - options) < (sizeof(options) - 128))
{
if (attr->value_tag == IPP_TAG_MIMETYPE ||
@@ -662,7 +661,7 @@ StartJob(int id, /* I - Job ID */
if (strncmp(printer->device_uri, "file:", 5) != 0)
{
sscanf(printer->device_uri, "%[^:]", method);
sscanf(printer->device_uri, "%254[^:]", method);
sprintf(command, "%s/backend/%s", ServerRoot, method);
argv[0] = printer->device_uri;
@@ -858,7 +857,7 @@ UpdateJob(job_t *job) /* I - Job to check */
if (loglevel != LOG_INFO)
LogMessage(loglevel, "%s", message);
if ((loglevel >= LOG_INFO && !job->state) ||
if ((loglevel == LOG_INFO && !job->status) ||
loglevel < LOG_INFO)
strncpy(job->printer->state_message, message,
sizeof(job->printer->state_message) - 1);
+12 -5
Ver Arquivo
@@ -23,9 +23,10 @@
*
* Contents:
*
* LogMessage() - Log a message to the error log file.
* LogPage() - Log a page to the page log file.
* LogRequest() - Log an HTTP request in Common Log Format.
* LogMessage() - Log a message to the error log file.
* LogPage() - Log a page to the page log file.
* LogRequest() - Log an HTTP request in Common Log Format.
* get_datetime() - Returns a pointer to a date/time string.
*/
/*
@@ -347,6 +348,8 @@ get_datetime(time_t t) /* I - Time value */
* offset from GMT in seconds so that we are reporting local time in the
* log files. If you want GMT, set the TZ environment variable accordingly
* before starting the scheduler.
*
* (*BSD stores the timezone offset in the tm structure)
*/
date = localtime(&t);
@@ -354,8 +357,12 @@ get_datetime(time_t t) /* I - Time value */
sprintf(s, "[%02d/%s/%04d:%02d:%02d:%02d %+02d%02d]",
date->tm_mday, months[date->tm_mon], 1900 + date->tm_year,
date->tm_hour, date->tm_min, date->tm_sec,
timezone / 3600, (timezone / 60) % 60);
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
date->tm_gmtoff / 3600, (date->tm_gmtoff / 60) % 60);
#else
timezone / 3600, (timezone / 60) % 60);
#endif /* __*BSD__ */
return (s);
}
+73 -50
Ver Arquivo
@@ -60,10 +60,6 @@ AddPrinter(char *name) /* I - Name of printer */
printer_t *p, /* New printer */
*current, /* Current printer in list */
*prev; /* Previous printer in list */
#ifdef __sgi
char filename[1024]; /* Interface script filename */
FILE *fp; /* Interface script file */
#endif /* __sgi */
/*
@@ -117,48 +113,11 @@ AddPrinter(char *name) /* I - Name of printer */
p->next = current;
/*
* Write a new /etc/printcap file, and add a dummy interface and GUI scripts
* to fool SGI's stupid printing tools.
* Write a new /etc/printcap or /var/spool/lp/pstatus file.
*/
write_printcap();
#ifdef __sgi
sprintf(filename, "/var/spool/lp/interface/%s", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("#!/bin/sh\n", fp);
fprintf(fp, "NAME=\"%s\"\n", p->info);
if (p->type & CUPS_PRINTER_COLOR)
fputs("TYPE=ColorPostScript\n", fp);
else
fputs("TYPE=PostScript\n", fp);
fclose(fp);
chmod(filename, 0755);
}
sprintf(filename, "/var/spool/lp/gui_interface/ELF/%s.gui", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("#!/bin/sh\n", fp);
fprintf(fp, "/usr/bin/glpoptions -d %s -o \"$*\"\n", p->name);
fclose(fp);
chmod(filename, 0755);
}
sprintf(filename, "/var/spool/lp/activeicons/%s", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("#!/bin/sh\n", fp);
if (p->type & CUPS_PRINTER_COLOR)
fputs("#Tag 66240\n", fp);
else
fputs("#Tag 66208\n", fp);
fclose(fp);
chmod(filename, 0755);
}
#endif /* __sgi */
return (p);
}
@@ -192,7 +151,7 @@ AddPrinterFilter(printer_t *p, /* I - Printer to add to */
* super/type cost program
*/
if (sscanf(filter, "%[^/]/%s%d%s", super, type, &cost, program) != 4)
if (sscanf(filter, "%15[^/]/%31s%d%1023s", super, type, &cost, program) != 4)
{
LogMessage(LOG_ERROR, "AddPrinterFilter: Invalid filter string \"%s\"!",
filter);
@@ -732,6 +691,9 @@ SetPrinterAttrs(printer_t *p) /* I - Printer to setup */
};
int num_finishings;
ipp_finish_t finishings[5];
#ifdef __sgi
FILE *fp; /* Interface script file */
#endif /* __sgi */
DEBUG_printf(("SetPrinterAttrs: entering name = %s, type = %x\n", p->name,
@@ -853,7 +815,10 @@ SetPrinterAttrs(printer_t *p) /* I - Printer to setup */
*/
httpSeparate(p->device_uri, method, username, host, &port, resource);
sprintf(uri, "%s://%s:%d/%s", method, host, port, resource);
if (port)
sprintf(uri, "%s://%s:%d%s", method, host, port, resource);
else
sprintf(uri, "%s://%s%s", method, host, resource);
}
else
{
@@ -1002,11 +967,11 @@ SetPrinterAttrs(printer_t *p) /* I - Printer to setup */
else
{
/*
* Otherwise we have neither - treat this as a "generic" PostScript
* printer with no PPD file...
* Otherwise we have neither - treat this as a "dumb" printer
* with no PPD file...
*/
AddPrinterFilter(p, "application/vnd.cups-postscript 0 -");
AddPrinterFilter(p, "*/* 0 -");
}
}
@@ -1025,6 +990,64 @@ SetPrinterAttrs(printer_t *p) /* I - Printer to setup */
DEBUG_printf(("SetPrinterAttrs: leaving name = %s, type = %x\n", p->name,
p->type));
#ifdef __sgi
/*
* Add dummy interface and GUI scripts to fool SGI's "challenged" printing
* tools.
*/
sprintf(filename, "/var/spool/lp/interface/%s", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("#!/bin/sh\n", fp);
if ((attr = ippFindAttribute(p->attrs, "printer-make-and-model",
IPP_TAG_TEXT)) != NULL)
fprintf(fp, "NAME=\"%s\"\n", attr->values[0].string.text);
else if (p->type & CUPS_PRINTER_CLASS)
fputs("NAME=\"Printer Class\"\n", fp);
else
fputs("NAME=\"Remote Destination\"\n", fp);
if (p->type & CUPS_PRINTER_COLOR)
fputs("TYPE=ColorPostScript\n", fp);
else
fputs("TYPE=PostScript\n", fp);
fclose(fp);
chmod(filename, 0755);
}
sprintf(filename, "/var/spool/lp/member/%s", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("/dev/null\n", fp);
fclose(fp);
chmod(filename, 0644);
}
sprintf(filename, "/var/spool/lp/gui_interface/ELF/%s.gui", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("#!/bin/sh\n", fp);
fprintf(fp, "/usr/bin/glpoptions -d %s -o \"$3\"\n", p->name);
fclose(fp);
chmod(filename, 0755);
}
sprintf(filename, "/var/spool/lp/activeicons/%s", p->name);
if ((fp = fopen(filename, "w")) != NULL)
{
fputs("#!/bin/sh\n", fp);
if (p->type & CUPS_PRINTER_COLOR)
fputs("#Tag 66240\n", fp);
else
fputs("#Tag 66208\n", fp);
fclose(fp);
chmod(filename, 0755);
}
#endif /* __sgi */
}
@@ -1146,8 +1169,8 @@ StopPrinter(printer_t *p) /* I - Printer to stop */
static void
write_printcap(void)
{
FILE *fp; /* printcap file */
printer_t *p; /* Current printer */
FILE *fp; /* printcap file */
printer_t *p; /* Current printer */
/*
@@ -1175,7 +1198,7 @@ write_printcap(void)
fprintf(fp, "%s:\n", p->name);
/*
* Close the file and return...
* Close the file...
*/
fclose(fp);
+2 -2
Ver Arquivo
@@ -143,7 +143,7 @@ main(int argc, /* I - Number of command-line arguments */
* Accept/disable/enable/reject a destination...
*/
if (sscanf(argv[i], "%[^@]@%s", printer, hostname) == 1)
if (sscanf(argv[i], "%1023[^@]@%1023s", printer, hostname) == 1)
strcpy(hostname, "localhost");
if (http != NULL && strcasecmp(http->hostname, hostname) != 0)
@@ -185,7 +185,7 @@ main(int argc, /* I - Number of command-line arguments */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
sprintf(uri, "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
snprintf(uri, sizeof(uri), "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
+38 -18
Ver Arquivo
@@ -66,16 +66,7 @@ main(int argc, /* I - Number of command-line arguments */
op = IPP_CANCEL_JOB;
job_id = 0;
dest = NULL;
/*
* Open a connection to the server...
*/
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
{
fputs("cancel: Unable to contact server!\n", stderr);
return (1);
}
http = NULL;
/*
* Process command-line arguments...
@@ -90,7 +81,8 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'h' : /* Connect to host */
httpClose(http);
if (http != NULL)
httpClose(http);
if (argv[i][2] != '\0')
http = httpConnect(argv[i] + 2, ippPort());
@@ -134,7 +126,7 @@ main(int argc, /* I - Number of command-line arguments */
{
dest = name;
job_id = 0;
sscanf(argv[i], "%[^-]-%d", name, &job_id);
sscanf(argv[i], "%254[^-]-%d", name, &job_id);
if (job_id)
op = IPP_CANCEL_JOB;
@@ -144,7 +136,8 @@ main(int argc, /* I - Number of command-line arguments */
* Reconnect to the named host...
*/
httpClose(http);
if (http != NULL)
httpClose(http);
*host++ = '\0';
@@ -156,6 +149,17 @@ main(int argc, /* I - Number of command-line arguments */
}
}
/*
* Open a connection to the server...
*/
if (http == NULL)
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
{
fputs("cancel: Unable to contact server!\n", stderr);
return (1);
}
/*
* Build an IPP request, which requires the following
* attributes:
@@ -163,6 +167,7 @@ main(int argc, /* I - Number of command-line arguments */
* attributes-charset
* attributes-natural-language
* printer-uri + job-id *or* job-uri
* [requesting-user-name]
*/
request = ippNew();
@@ -180,7 +185,7 @@ main(int argc, /* I - Number of command-line arguments */
if (dest)
{
sprintf(uri, "ipp://localhost/printers/%s", dest);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
@@ -193,6 +198,9 @@ main(int argc, /* I - Number of command-line arguments */
uri);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
/*
* Do the request and get back a response...
*/
@@ -204,10 +212,22 @@ main(int argc, /* I - Number of command-line arguments */
if (response != NULL)
{
if (response->request.status.status_code == IPP_NOT_FOUND)
fputs("cancel: Job or printer not found!\n", stderr);
else if (response->request.status.status_code > IPP_OK_CONFLICT)
fputs("cancel: Unable to cancel job(s)!\n", stderr);
switch (response->request.status.status_code)
{
case IPP_NOT_FOUND :
fputs("cancel: Job or printer not found!\n", stderr);
break;
case IPP_NOT_AUTHORIZED :
fputs("cancel: Not authorized to cancel job(s)!\n", stderr);
break;
case IPP_FORBIDDEN :
fprintf(stderr, "cancel: You don't own job ID %d!\n", job_id);
break;
default :
if (response->request.status.status_code > IPP_OK_CONFLICT)
fputs("cancel: Unable to cancel job(s)!\n", stderr);
break;
}
ippDelete(response);
}
+46 -4
Ver Arquivo
@@ -23,7 +23,8 @@
*
* Contents:
*
* main() - Parse options and send files for printing.
* main() - Parse options and send files for printing.
* sighandler() - Signal catcher for when we print from stdin...
*/
/*
@@ -35,6 +36,25 @@
#include <cups/cups.h>
#ifndef WIN32
# include <signal.h>
/*
* Local functions.
*/
void sighandler(void);
#endif /* !WIN32 */
/*
* Globals...
*/
char tempfile[1024]; /* Temporary file for printing from stdin */
/*
* 'main()' - Parse options and send files for printing.
*/
@@ -53,7 +73,6 @@ main(int argc, /* I - Number of command-line arguments */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
int silent; /* Silent or verbose output? */
char tempfile[1024]; /* Temporary file for printing from stdin */
char buffer[8192]; /* Copy buffer */
FILE *temp; /* Temporary file pointer */
@@ -182,7 +201,8 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
fprintf(stderr, "lp: unable to print file \'%s\'.\n", argv[i]);
fprintf(stderr, "lp: unable to print file \'%s\' - error code %x.\n",
argv[i], cupsLastError());
return (1);
}
else if (!silent)
@@ -201,6 +221,10 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
#ifndef WIN32
signal(SIGTERM, sighandler);
#endif /* !WIN32 */
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "w");
if (temp == NULL)
@@ -230,7 +254,8 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
fputs("lp: unable to print stdin.\n", stderr);
fprintf(stderr, "lp: unable to print stdin - error code %x.\n",
cupsLastError());
return (1);
}
else if (!silent)
@@ -241,6 +266,23 @@ main(int argc, /* I - Number of command-line arguments */
}
#ifndef WIN32
/*
* 'sighandler()' - Signal catcher for when we print from stdin...
*/
void
sighandler(void)
{
/*
* Remove the temporary file we're using to print from stdin...
*/
unlink(tempfile);
}
#endif /* !WIN32 */
/*
* End of "$Id$".
*/
+13 -13
Ver Arquivo
@@ -185,11 +185,11 @@ main(int argc, /* I - Number of command-line arguments */
}
if (argv[i][2])
sprintf(filename, CUPS_DATADIR "/model/%s", argv[i] + 2);
snprintf(filename, sizeof(filename), CUPS_DATADIR "/model/%s", argv[i] + 2);
else
{
i ++;
sprintf(filename, CUPS_DATADIR "/model/%s", argv[i]);
snprintf(filename, sizeof(filename), CUPS_DATADIR "/model/%s", argv[i]);
}
set_printer_file(http, printer, filename);
@@ -393,7 +393,7 @@ add_printer_to_class(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/classes/%s", pclass);
snprintf(uri, sizeof(uri), "ipp://localhost/classes/%s", pclass);
request = ippNew();
@@ -463,7 +463,7 @@ add_printer_to_class(http_t *http, /* I - Server connection */
* OK, the printer isn't part of the class, so add it...
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
if (response != NULL &&
(members = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
@@ -520,7 +520,7 @@ default_printer(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
@@ -579,7 +579,7 @@ delete_printer(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
@@ -643,7 +643,7 @@ delete_printer_from_class(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/classes/%s", pclass);
snprintf(uri, sizeof(uri), "ipp://localhost/classes/%s", pclass);
request = ippNew();
@@ -804,7 +804,7 @@ enable_printer(http_t *http, /* I - Server connection */
* printer-is-accepting-jobs
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
@@ -870,7 +870,7 @@ set_printer_device(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
@@ -898,7 +898,7 @@ set_printer_device(http_t *http, /* I - Server connection */
* Convert filename to URI...
*/
sprintf(uri, "file:%s", device);
snprintf(uri, sizeof(uri), "file:%s", device);
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
uri);
}
@@ -985,7 +985,7 @@ set_printer_file(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
@@ -1050,7 +1050,7 @@ set_printer_info(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
@@ -1113,7 +1113,7 @@ set_printer_location(http_t *http, /* I - Server connection */
* printer-uri
*/
sprintf(uri, "ipp://localhost/printers/%s", printer);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
request = ippNew();
+2 -2
Ver Arquivo
@@ -277,7 +277,7 @@ show_accepting(http_t *http, /* I - HTTP connection to server */
for (attr = response->attrs; attr != NULL; attr = attr->next)
{
/*
* Skip leading attributes until we hit a job...
* Skip leading attributes until we hit a printer...
*/
while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
@@ -287,7 +287,7 @@ show_accepting(http_t *http, /* I - HTTP connection to server */
break;
/*
* Pull the needed attributes from this job...
* Pull the needed attributes from this printer...
*/
printer = NULL;