Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 8ef505f309 |
@@ -44,7 +44,6 @@ RANLIB = @RANLIB@
|
||||
RM = @RM@ -f
|
||||
SED = @SED@
|
||||
SHELL = /bin/sh
|
||||
SMBCLIENT = @SMBCLIENT@
|
||||
|
||||
#
|
||||
# Libraries...
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
README - CUPS v1.0 - 10/01/1999
|
||||
-------------------------------
|
||||
README - CUPS v1.0.1 - 10/26/1999
|
||||
---------------------------------
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
|
||||
+12
-2
@@ -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
|
||||
#
|
||||
|
||||
@@ -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$".
|
||||
*/
|
||||
+20
-10
@@ -133,7 +133,7 @@ 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);
|
||||
snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, hostname, port, resource);
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
@@ -166,7 +166,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 +175,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 +219,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 +250,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 +273,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)
|
||||
{
|
||||
@@ -369,9 +373,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;
|
||||
|
||||
+12
-7
@@ -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...
|
||||
@@ -175,7 +178,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 +311,21 @@ 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);
|
||||
|
||||
|
||||
+2
-1
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
+11
-10
@@ -105,10 +105,10 @@ 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=\"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\">");
|
||||
#else
|
||||
@@ -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;
|
||||
|
||||
+7
-8
@@ -105,10 +105,10 @@ 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=\"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\">");
|
||||
#else
|
||||
@@ -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 ||
|
||||
|
||||
+11
-10
@@ -105,10 +105,10 @@ 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=\"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\">");
|
||||
#else
|
||||
@@ -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
@@ -28,7 +28,7 @@
|
||||
* Version of software...
|
||||
*/
|
||||
|
||||
#define CUPS_SVERSION "CUPS v1.0b9"
|
||||
#define CUPS_SVERSION "CUPS v1.0.1"
|
||||
|
||||
/*
|
||||
* 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
@@ -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"
|
||||
|
||||
@@ -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
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: cups.spec 714 1999-10-01 14:40:53Z mike $"
|
||||
# "$Id: cups.spec 755 1999-10-26 20:40:13Z mike $"
|
||||
#
|
||||
# RPM "spec" file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
@@ -26,11 +26,11 @@
|
||||
|
||||
Summary: Common Unix Printing System
|
||||
Name: cups
|
||||
Version: 1.0
|
||||
Version: 1.0.1
|
||||
Release: 0
|
||||
Copyright: GPL
|
||||
Group: System Environment/Daemons
|
||||
Source: ftp://ftp.easysw.com/pub/cups/beta/cups-1.0-source.tar.gz
|
||||
Source: ftp://ftp.easysw.com/pub/cups/1.0.1/cups-1.0.1-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 714 1999-10-01 14:40:53Z mike $".
|
||||
# End of "$Id: cups.spec 755 1999-10-26 20:40:13Z mike $".
|
||||
#
|
||||
|
||||
+3
-2
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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),
|
||||
|
||||
+49
-26
@@ -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';
|
||||
}
|
||||
|
||||
|
||||
@@ -779,22 +790,29 @@ httpWrite(http_t *http, /* I - HTTP data */
|
||||
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 (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;
|
||||
@@ -828,6 +846,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 +993,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 +1081,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 +1325,10 @@ httpEncode64(char *out, /* I - String to write to */
|
||||
|
||||
in ++;
|
||||
if (*in == '\0')
|
||||
{
|
||||
*outptr ++ = '=';
|
||||
break;
|
||||
}
|
||||
|
||||
*outptr ++ = base64[((in[0] << 2) | (in[1] >> 6)) & 63];
|
||||
|
||||
|
||||
+2
-2
@@ -593,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)))
|
||||
@@ -801,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
@@ -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$".
|
||||
*/
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -340,7 +340,7 @@ extension of ".h".
|
||||
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 "$Id: cmp.shtml,v
|
||||
1.3 1999/05/21 20:54:04 mike Exp $" tag:
|
||||
1.4 1999/09/22 20:06:18 mike Exp $" tag:
|
||||
<UL>
|
||||
<PRE>
|
||||
/*
|
||||
@@ -376,7 +376,7 @@ name and revision information is provided by the CVS "$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 "$Id: cmp.shtml,v 1.3 1999/05/21 20:54:04
|
||||
of the file using the CVS "$Id: cmp.shtml,v 1.4 1999/09/22 20:06:18
|
||||
mike Exp $" 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
@@ -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
|
||||
xÚ�VMSÛ0½çWìpjgˆ'’Þ€�N/�”¤\Y^'flÉ•d(ÿ¾»’çchÃ!±õôöí7¿1Œè/†«1L¦ ËÁÍjðå~ñV�L¯.`•~º„¥ÎÜ«0X °h?¯žò2šìðrtÃ#›k?ê2A“«uÀ_@7èñ4 o-–P#pƒ8¬„qðÒ(O | ||||