Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 11236b767a |
@@ -1,25 +0,0 @@
|
||||
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".
|
||||
@@ -37,7 +37,6 @@ DSO = @DSO@
|
||||
HTMLDOC = @HTMLDOC@
|
||||
LN = /bin/ln -sf
|
||||
MKDIR = @MKDIR@ -p
|
||||
MV = @MV@
|
||||
NROFF = @NROFF@
|
||||
PACK = @PACK@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
+21
-10
@@ -1,5 +1,15 @@
|
||||
README - CUPS v1.0 - 10/01/1999
|
||||
-------------------------------
|
||||
README - CUPS v1.0b6 - 07/30/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
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
@@ -10,8 +20,9 @@ and users. CUPS provides the System V and Berkeley command-line
|
||||
interfaces.
|
||||
|
||||
CUPS uses the Internet Printing Protocol (IETF-IPP) as the basis for
|
||||
managing print jobs and queues. The Line Printer Daemon (LPD, RFC1179)
|
||||
and AppSocket protocols are also supported with reduced functionality.
|
||||
managing print jobs and queues. The Line Printer Daemon (LPD,
|
||||
RFC1179), Server Message Block (SMB), and AppSocket protocols are also
|
||||
supported with reduced functionality.
|
||||
|
||||
CUPS adds network printer browsing and PostScript Printer Description
|
||||
("PPD")-based printing options to support real world applications under
|
||||
@@ -46,7 +57,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.36 with glibc2 or higher (tested with RedHat 5.2)
|
||||
- Solaris 2.5 or higher (SPARC or Intel)
|
||||
|
||||
|
||||
@@ -113,11 +124,6 @@ Similarly, for the sample LaserJet driver you can use "LaserJet" and
|
||||
For other printers and interfaces see the CUPS System Administator's
|
||||
Manual included with this software.
|
||||
|
||||
If you're interested in a complete, commercial printing solution for
|
||||
UNIX, check out our ESP Print Pro software at:
|
||||
|
||||
http://www.easysw.com/printpro
|
||||
|
||||
|
||||
PRINTING FILES
|
||||
|
||||
@@ -182,3 +188,8 @@ licensing information, please contact:
|
||||
Voice: +1.301.373.9603
|
||||
Email: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
|
||||
If you're interested in a complete, commercial printing solution for
|
||||
UNIX, check out our ESP Print Pro software at:
|
||||
|
||||
http://www.easysw.com/printpro
|
||||
|
||||
+14
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
TARGETS = ipp lpd parallel serial socket
|
||||
TARGETS = ipp lpd parallel serial smb socket
|
||||
OBJS = ipp.o lpd.o parallel.o serial.o socket.o
|
||||
|
||||
#
|
||||
@@ -91,6 +91,19 @@ serial: serial.o ../cups/$(LIBCUPS)
|
||||
|
||||
serial.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# smb
|
||||
#
|
||||
# Note: reading through these commands is a good way to get a headache... :)
|
||||
#
|
||||
|
||||
smb: smb.sh ../Makedefs
|
||||
echo Generating $@...
|
||||
$(RM) smb
|
||||
sedcmd="1,\$$s/^SMBCLIENT=.\*/SMBCLIENT=`echo $(SMBCLIENT) | sed -e '1,$$s/\\//\\\\\\//g'`/" ;\
|
||||
$(SED) -e "$$sedcmd" <smb.sh >smb
|
||||
$(CHMOD) +x smb
|
||||
|
||||
#
|
||||
# socket
|
||||
#
|
||||
|
||||
+7
-13
@@ -294,12 +294,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
if (httpPost(http, resource))
|
||||
{
|
||||
fputs("INFO: Unable to POST print request; retrying...\n", stderr);
|
||||
sleep(10);
|
||||
httpReconnect(http);
|
||||
continue;
|
||||
}
|
||||
if (httpPost(http, resource))
|
||||
{
|
||||
fputs("INFO: Unable to POST print request; retrying...\n", stderr);
|
||||
sleep(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
fputs("INFO: POST successful, sending IPP request...\n", stderr);
|
||||
|
||||
@@ -336,13 +336,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are chunking the output from stdin, make sure we end up with
|
||||
* a 0-length chunk at the end...
|
||||
*/
|
||||
|
||||
if (fp == stdin)
|
||||
httpWrite(http, buffer, 0);
|
||||
httpWrite(http, buffer, 0);
|
||||
|
||||
fputs("INFO: Print file sent; checking status...\n", stderr);
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
int bytes; /* Number of bytes read */
|
||||
|
||||
|
||||
if ((fp = fopen(cupsTempFile(filename, sizeof(filename)), "w")) == NULL)
|
||||
if ((fp = fopen(tmpnam(filename), "w")) == NULL)
|
||||
{
|
||||
perror("ERROR: unable to create temporary file");
|
||||
return (1);
|
||||
|
||||
Arquivo executável
+88
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# SMB printing script for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1993-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
|
||||
# 44145 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
SMBCLIENT=/usr/local/samba/bin/smbclient
|
||||
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# printer job user title copies options [filename]
|
||||
#
|
||||
|
||||
if [ $# -lt 5 -o $# -gt 6 ]; then
|
||||
# Too few or too many arguments
|
||||
echo 'Usage: smb job-id user title copies options [file]' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# If "filename" is not on the command-line, then we read the print
|
||||
# data from stdin and write it to a temporary file.
|
||||
#
|
||||
|
||||
if [ $# = 5 ]; then
|
||||
# Collect all print data and put it in a temporary file...
|
||||
if [ "$TMPDIR" = "" ]; then
|
||||
TMPDIR=/var/tmp
|
||||
fi
|
||||
|
||||
filename="$TMPDIR/$$.smb"
|
||||
cat >$filename
|
||||
else
|
||||
# Use the file on the command-line...
|
||||
filename="$6"
|
||||
fi
|
||||
|
||||
#
|
||||
# Take apart the URI in $0...
|
||||
#
|
||||
|
||||
uri="$0"
|
||||
host=`echo $uri | awk -F/ '{print substr($3, index($3, "@") + 1)}'`
|
||||
user=`echo $uri | awk -F/ '{print substr($3, 0, index($3, "@") - 1)}'`
|
||||
if [ "$user" != "" ]; then
|
||||
user="-U $user"
|
||||
fi
|
||||
printer=`echo $uri | awk -F/ '{print $4}'`
|
||||
|
||||
#
|
||||
# Send the file to the remote system...
|
||||
#
|
||||
|
||||
$SMBCLIENT //$host/$printer $user -P -N <<EOF
|
||||
print $filename
|
||||
EOF
|
||||
|
||||
#
|
||||
# Lastly, remove the temporary file as needed...
|
||||
#
|
||||
|
||||
if [ $# = 5 ]; then
|
||||
rm -f $filename
|
||||
fi
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -433,15 +433,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
if (strncmp(device, "file:", 5) == 0)
|
||||
printf("\tprinter is on device \'%s\' speed -1\n", device + 5);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Just show the method...
|
||||
*/
|
||||
|
||||
*strchr(device, ':') = '\0';
|
||||
printf("\tprinter is on device \'%s\' speed -1\n", device);
|
||||
}
|
||||
|
||||
printf("\tqueuing is %sabled\n", accepting ? "en" : "dis");
|
||||
printf("\tprinting is %sabled\n",
|
||||
pstate == IPP_PRINTER_STOPPED ? "dis" : "en");
|
||||
|
||||
+1
-3
@@ -209,7 +209,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "w");
|
||||
temp = fopen(tmpnam(tempfile), "w");
|
||||
|
||||
if (temp == NULL)
|
||||
{
|
||||
@@ -234,8 +234,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
job_id = cupsPrintFile(dest, tempfile, "(stdin)", num_options, options);
|
||||
|
||||
unlink(tempfile);
|
||||
|
||||
if (job_id < 1)
|
||||
{
|
||||
fputs("lpr: unable to print standard input.\n", stderr);
|
||||
|
||||
+1
-11
@@ -38,7 +38,6 @@
|
||||
#include <cups/cups.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
#include <config.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -100,24 +99,15 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10\">");
|
||||
else
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">");
|
||||
printf("<TITLE>%s on %s - " CUPS_SVERSION "</TITLE>\n",
|
||||
printf("<TITLE>%s on %s - Common UNIX Printing System</TITLE>\n",
|
||||
name == NULL ? "Classes" : name, getenv("SERVER_NAME"));
|
||||
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\">");
|
||||
#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\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
|
||||
#endif /* ESPPRINTPRO */
|
||||
puts("</MAP>");
|
||||
puts("</HEAD>");
|
||||
puts("<BODY>");
|
||||
|
||||
+3
-11
@@ -38,7 +38,6 @@
|
||||
#include <cups/cups.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
#include <config.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -63,6 +62,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
http_t *http; /* Connection to the server */
|
||||
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
/*
|
||||
* Get the request language...
|
||||
*/
|
||||
@@ -100,24 +101,15 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10\">");
|
||||
else
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">");
|
||||
printf("<TITLE>%s on %s - " CUPS_SVERSION "</TITLE>\n",
|
||||
printf("<TITLE>%s on %s - Common UNIX Printing System</TITLE>\n",
|
||||
job == NULL ? "Jobs" : job, getenv("SERVER_NAME"));
|
||||
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\">");
|
||||
#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\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
|
||||
#endif /* ESPPRINTPRO */
|
||||
puts("</MAP>");
|
||||
puts("</HEAD>");
|
||||
puts("<BODY>");
|
||||
|
||||
+1
-11
@@ -38,7 +38,6 @@
|
||||
#include <cups/cups.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
#include <config.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -100,24 +99,15 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10\">");
|
||||
else
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">");
|
||||
printf("<TITLE>%s on %s - " CUPS_SVERSION "</TITLE>\n",
|
||||
printf("<TITLE>%s on %s - Common UNIX Printing System</TITLE>\n",
|
||||
printer == NULL ? "Printers" : printer, getenv("SERVER_NAME"));
|
||||
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\">");
|
||||
#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\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
|
||||
#endif /* ESPPRINTPRO */
|
||||
puts("</MAP>");
|
||||
puts("</HEAD>");
|
||||
puts("<BODY>");
|
||||
|
||||
+2
-9
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: classes.conf 678 1999-09-22 18:10:55Z mike $"
|
||||
# "$Id: classes.conf 333 1999-05-17 18:03:40Z mike $"
|
||||
#
|
||||
# Sample class configuration file for the Common UNIX Printing System
|
||||
# (CUPS) scheduler.
|
||||
@@ -59,13 +59,6 @@
|
||||
|
||||
#Location Room 101 in the activities building
|
||||
|
||||
#
|
||||
# Accepting: is the class accepting jobs?
|
||||
#
|
||||
#Accepting Yes
|
||||
#Accepting No
|
||||
#
|
||||
|
||||
#
|
||||
# Printer: adds a printer to the class.
|
||||
#
|
||||
@@ -75,5 +68,5 @@
|
||||
#</Class>
|
||||
|
||||
#
|
||||
# End of "$Id: classes.conf 678 1999-09-22 18:10:55Z mike $".
|
||||
# End of "$Id: classes.conf 333 1999-05-17 18:03:40Z mike $".
|
||||
#
|
||||
|
||||
+8
-30
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: cupsd.conf 628 1999-08-23 15:24:48Z mike $"
|
||||
# "$Id: cupsd.conf 510 1999-07-09 14:20:15Z mike $"
|
||||
#
|
||||
# Sample configuration file for the Common UNIX Printing System (CUPS)
|
||||
# scheduler.
|
||||
@@ -70,25 +70,20 @@ Port 631
|
||||
# program is run...
|
||||
#
|
||||
|
||||
#User lp
|
||||
#Group sys
|
||||
User lp
|
||||
Group sys
|
||||
|
||||
#
|
||||
# SystemGroup: the group name for "System" (printer administration)
|
||||
# access. The default varies depending on the operating system, but
|
||||
# will be "sys", "system", or "root" (checked for in that order.)
|
||||
# access.
|
||||
#
|
||||
|
||||
#SystemGroup sys
|
||||
SystemGroup sys
|
||||
|
||||
#
|
||||
# ServerName: the hostname of your server, as advertised to the world.
|
||||
# By default CUPS will use the hostname of the system.
|
||||
#
|
||||
# This is also the name used by clients when connecting to the local
|
||||
# server, so you can use this to configure a client machine without
|
||||
# a local server running.
|
||||
#
|
||||
|
||||
#ServerName myhost.domain.com
|
||||
|
||||
@@ -310,23 +305,6 @@ LogLevel info
|
||||
# Deny: denies access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
# Both "Allow" and "Deny" accept the following notations for addresses:
|
||||
#
|
||||
# All
|
||||
# None
|
||||
# *.domain.com
|
||||
# .domain.com
|
||||
# host.domain.com
|
||||
# nnn.*
|
||||
# nnn.nnn.*
|
||||
# nnn.nnn.nnn.*
|
||||
# nnn.nnn.nnn.nnn
|
||||
# nnn.nnn.nnn.nnn/mm
|
||||
# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
|
||||
#
|
||||
# The host and domain address require that you enable hostname lookups
|
||||
# with "HostNameLookups On" above.
|
||||
#
|
||||
|
||||
<Location />
|
||||
</Location>
|
||||
@@ -351,8 +329,8 @@ LogLevel info
|
||||
#
|
||||
# You definitely will want to limit access to the administration tools.
|
||||
# The default configuration requires a local connection from a user who
|
||||
# is a member of the system group to do any admin tasks. You can change
|
||||
# the group name using the SystemGroup directive.
|
||||
# is a member of group "sys" to do any admin tasks. You can change the
|
||||
# group name using the SystemGroup directive.
|
||||
#
|
||||
|
||||
AuthType Basic
|
||||
@@ -365,5 +343,5 @@ Allow From 127.0.0.1
|
||||
</Location>
|
||||
|
||||
#
|
||||
# End of "$Id: cupsd.conf 628 1999-08-23 15:24:48Z mike $".
|
||||
# End of "$Id: cupsd.conf 510 1999-07-09 14:20:15Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# This is a dummy printcap file that is automatically generated by the
|
||||
# CUPS software for old applications that rely on it.
|
||||
+3
-10
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: printers.conf 678 1999-09-22 18:10:55Z mike $"
|
||||
# "$Id: printers.conf 334 1999-05-17 18:11:26Z mike $"
|
||||
#
|
||||
# Sample printer configuration file for the Common UNIX Printing System
|
||||
# (CUPS) scheduler.
|
||||
@@ -77,20 +77,13 @@
|
||||
# State: sets the initial state of the printer. Can be one of the
|
||||
# following:
|
||||
#
|
||||
# Idle - Printer is available to print new jobs.
|
||||
# Idle - Printer is available to accept new jobs.
|
||||
# Stopped - Printer is disabled but accepting new jobs.
|
||||
#
|
||||
|
||||
#State Idle
|
||||
|
||||
#
|
||||
# Accepting: is the printer accepting jobs?
|
||||
#
|
||||
#Accepting Yes
|
||||
#Accepting No
|
||||
|
||||
#</Printer>
|
||||
|
||||
#
|
||||
# End of "$Id: printers.conf 678 1999-09-22 18:10:55Z mike $".
|
||||
# End of "$Id: printers.conf 334 1999-05-17 18:11:26Z mike $".
|
||||
#
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
* Version of software...
|
||||
*/
|
||||
|
||||
#define CUPS_SVERSION "CUPS v1.0b9"
|
||||
#define CUPS_SVERSION "CUPS v1.0"
|
||||
|
||||
/*
|
||||
* Where are files stored?
|
||||
|
||||
+11
-13
@@ -46,7 +46,12 @@ AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
|
||||
OPTIM="-g "
|
||||
fi])
|
||||
AC_ARG_ENABLE(shared, [ --disable-shared turn off shared libraries [default=no]])
|
||||
if test "$disable_shared" != "yes"; then
|
||||
if eval "test x$disable_shared = xyes"; then
|
||||
PICFLAG=0
|
||||
LIBCUPS="libcups.a"
|
||||
LIBCUPSIMAGE="libcupsimage.a"
|
||||
DSO=":"
|
||||
else
|
||||
case "$uname" in
|
||||
SunOS* | UNIX_S*)
|
||||
LIBCUPS="libcups.so.1"
|
||||
@@ -58,7 +63,7 @@ if test "$disable_shared" != "yes"; then
|
||||
LIBCUPSIMAGE="libcupsimage.sl.1"
|
||||
DSO="ld -b -z +h \$@ -o"
|
||||
;;
|
||||
OSF1* | Linux* | FreeBSD*)
|
||||
OSF1* | Linux*)
|
||||
LIBCUPS="libcups.so.1"
|
||||
LIBCUPSIMAGE="libcupsimage.so.1"
|
||||
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
|
||||
@@ -76,11 +81,6 @@ if test "$disable_shared" != "yes"; then
|
||||
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
PICFLAG=0
|
||||
LIBCUPS="libcups.a"
|
||||
LIBCUPSIMAGE="libcupsimage.a"
|
||||
DSO=":"
|
||||
fi
|
||||
|
||||
dnl Checks for programs...
|
||||
@@ -91,14 +91,13 @@ AC_PROG_RANLIB
|
||||
AC_PATH_PROG(AR,ar)
|
||||
AC_PATH_PROG(CHMOD,chmod)
|
||||
AC_PATH_PROG(CP,cp)
|
||||
AC_PATH_PROG(MV,mv)
|
||||
AC_PATH_PROG(NROFF,nroff)
|
||||
if test "$NROFF" = ""; then
|
||||
AC_PATH_PROG(GROFF,groff)
|
||||
if test "$GROFF" = ""; then
|
||||
AC_PATH_PROG(NROFF,groff)
|
||||
if test "$NROFF" = ""; then
|
||||
NROFF="echo"
|
||||
else
|
||||
NROFF="$GROFF -T ascii"
|
||||
NROFF="$NROFF -T ascii"
|
||||
fi
|
||||
fi
|
||||
AC_PATH_PROG(HTMLDOC,htmldoc)
|
||||
@@ -213,7 +212,6 @@ else
|
||||
if test -z "$OPTIM"; then
|
||||
OPTIM="+O2"
|
||||
fi
|
||||
OPTIM="-Ae $OPTIM"
|
||||
;;
|
||||
SunOS*)
|
||||
# Solaris
|
||||
@@ -273,7 +271,7 @@ if test "$prefix" = "NONE"; then
|
||||
fi
|
||||
|
||||
dnl Fix "libdir" variable for IRIX 6.x...
|
||||
if test "$uname" = "IRIX" -a $uversion -ge 65; then
|
||||
if test "$uname" = "IRIX" -a $uversion -ge 62; then
|
||||
libdir="/usr/lib32"
|
||||
fi
|
||||
|
||||
|
||||
-309
@@ -1,309 +0,0 @@
|
||||
#
|
||||
# "$Id: cups.spec 714 1999-10-01 14:40:53Z mike $"
|
||||
#
|
||||
# RPM "spec" file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Original version by Jason McMullan <jmcc@ontv.com>.
|
||||
#
|
||||
# Copyright 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
|
||||
#
|
||||
|
||||
Summary: Common Unix Printing System
|
||||
Name: cups
|
||||
Version: 1.0
|
||||
Release: 0
|
||||
Copyright: GPL
|
||||
Group: System Environment/Daemons
|
||||
Source: ftp://ftp.easysw.com/pub/cups/beta/cups-1.0-source.tar.gz
|
||||
Url: http://www.cups.org
|
||||
Packager: Michael Sweet <mike@easysw.com>
|
||||
Vendor: Easy Software Products
|
||||
# use buildroot so as not to disturb the version already installed
|
||||
BuildRoot: /tmp/rpmbuild
|
||||
Conflicts: lpr
|
||||
|
||||
%package devel
|
||||
Summary: Common Unix Printing System - development environment
|
||||
Group: Development/Libraries
|
||||
|
||||
%description
|
||||
The Common UNIX Printing System provides a portable printing layer for
|
||||
UNIX® operating systems. It has been developed by Easy Software Products
|
||||
to promote a standard printing solution for all UNIX vendors and users.
|
||||
CUPS provides the System V and Berkeley command-line interfaces.
|
||||
|
||||
%description devel
|
||||
The Common UNIX Printing System provides a portable printing layer for
|
||||
UNIX® operating systems. This is the development package for creating
|
||||
additional printer drivers, and other CUPS services.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure
|
||||
|
||||
# If we got this far, all prerequisite libraries must be here.
|
||||
make
|
||||
|
||||
%install
|
||||
# these lines just make sure the directory structure in the
|
||||
# RPM_BUILD_ROOT exists
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/etc
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
|
||||
mkdir -p $RPM_BUILD_ROOT/usr
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/man
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/man/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/man/man5
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/man/man8
|
||||
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
|
||||
|
||||
ln -sf /var/cups/logs $RPM_BUILD_ROOT/var/logs/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
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add cups
|
||||
|
||||
%preun
|
||||
/sbin/chkconfig --del cups
|
||||
|
||||
%clean
|
||||
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
|
||||
%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
|
||||
%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
|
||||
%dir /var/cups/interfaces
|
||||
%dir /var/cups/logs
|
||||
%dir /var/cups/ppd
|
||||
%dir /var/cups/requests
|
||||
|
||||
%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
|
||||
|
||||
#
|
||||
# End of "$Id: cups.spec 714 1999-10-01 14:40:53Z mike $".
|
||||
#
|
||||
-150
@@ -1,150 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Support library Makefile 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.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
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
#
|
||||
# Object files...
|
||||
#
|
||||
|
||||
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
|
||||
OBJS = $(LIBOBJS) testhttp.o testmime.o testppd.o
|
||||
|
||||
#
|
||||
# Header files to install...
|
||||
#
|
||||
|
||||
HEADERS = cups.h http.h ipp.h language.h mime.h ppd.h raster.h
|
||||
|
||||
#
|
||||
# Targets in this directory...
|
||||
#
|
||||
|
||||
TARGETS = $(LIBCUPS) testhttp testmime testppd
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
#
|
||||
# Remove object and target files...
|
||||
#
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(TARGETS)
|
||||
|
||||
#
|
||||
# Install object and target files...
|
||||
#
|
||||
|
||||
install: all
|
||||
-$(MKDIR) $(INCLUDEDIR)/cups
|
||||
$(CP) $(HEADERS) $(INCLUDEDIR)/cups
|
||||
-$(MKDIR) $(LIBDIR)
|
||||
$(CP) $(LIBCUPS) $(LIBDIR)
|
||||
if test $(LIBCUPS) != "libcups.a"; then \
|
||||
$(LN) $(LIBCUPS) `basename $(LIBCUPS) .1`; \
|
||||
fi
|
||||
|
||||
#
|
||||
# libcups.so.1, libcups.sl.1
|
||||
#
|
||||
|
||||
libcups.so.1 libcups.sl.1: $(LIBOBJS) ../Makedefs
|
||||
echo Linking $@...
|
||||
$(DSO) $@ $(LIBOBJS)
|
||||
-$(LN) $@ `basename $@ .1`
|
||||
|
||||
#
|
||||
# libcups.a
|
||||
#
|
||||
|
||||
libcups.a: $(LIBOBJS)
|
||||
echo Archiving $@...
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
#
|
||||
# cups_C.h - the default POSIX locale that is compiled in.
|
||||
#
|
||||
|
||||
cups_C.h: ../locale/C/cups_C
|
||||
echo Generating $@...
|
||||
$(RM) cups_C.h
|
||||
$(AWK) '{print "\"" $$0 "\","}' < ../locale/C/cups_C > cups_C.h
|
||||
|
||||
emit.o: ppd.h ../config.h ../Makedefs
|
||||
filter.o: mime.h ../config.h ../Makedefs
|
||||
http.o: http.h ipp.h string.h ../config.h ../Makedefs
|
||||
ipp.o: http.h ipp.h ../config.h ../Makedefs
|
||||
language.o: cups_C.h language.h string.h ../config.h ../Makedefs
|
||||
mark.o: ppd.h ../config.h ../Makedefs
|
||||
mime.o: mime.h ../config.h ../Makedefs
|
||||
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
|
||||
string.o: string.h ../config.h ../Makedefs
|
||||
type.o: mime.h ../config.h ../Makedefs
|
||||
usersys.o: cups.h ../config.h ../Makedefs
|
||||
util.o: cups.h http.h ipp.h ../config.h ../Makedefs
|
||||
|
||||
#
|
||||
# testhttp (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testhttp: testhttp.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a $(NETLIBS)
|
||||
|
||||
testhttp.o: http.h ../Makedefs
|
||||
|
||||
#
|
||||
# testmime (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testmime: testmime.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testmime.o libcups.a
|
||||
|
||||
testmime.o: mime.h ../Makedefs
|
||||
|
||||
#
|
||||
# testppd (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testppd: testppd.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a $(NETLIBS)
|
||||
|
||||
testppd.o: ppd.h ../Makedefs
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
-176
@@ -1,176 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="cups" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=cups - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "cups.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "cups.mak" CFG="cups - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "cups - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "cups - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "cups - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\visualc" /I ".." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"cups.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "cups - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\visualc" /I ".." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"cupsd.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "cups - Win32 Release"
|
||||
# Name "cups - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\emit.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\filter.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\http.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ipp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\language.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mark.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mime.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\options.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\page.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ppd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\raster.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\string.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\type.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\util.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cups.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\http.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ipp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\language.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mime.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ppd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\raster.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* API definitions 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
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CUPS_H_
|
||||
# define _CUPS_CUPS_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <cups/ipp.h>
|
||||
# include <cups/mime.h>
|
||||
# include <cups/ppd.h>
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0
|
||||
# define CUPS_DATE_ANY -1
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef unsigned cups_ptype_t; /**** Printer Type/Capability Bits ****/
|
||||
enum /* Not a typedef'd enum so we can OR */
|
||||
{
|
||||
CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */
|
||||
CUPS_PRINTER_CLASS = 0x0001, /* Printer class */
|
||||
CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */
|
||||
CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */
|
||||
CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */
|
||||
CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */
|
||||
CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */
|
||||
CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */
|
||||
CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */
|
||||
CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */
|
||||
CUPS_PRINTER_COVER = 0x0200, /* Can cover output */
|
||||
CUPS_PRINTER_BIND = 0x0400, /* Can bind output */
|
||||
CUPS_PRINTER_SORT = 0x0800, /* Can sort output */
|
||||
CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */
|
||||
CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */
|
||||
CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */
|
||||
CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */
|
||||
CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */
|
||||
CUPS_PRINTER_OPTIONS = 0xfffc /* ~(CLASS | REMOTE | IMPLICIT) */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Types & structures...
|
||||
*/
|
||||
|
||||
typedef struct /**** Printer Information ****/
|
||||
{
|
||||
char name[IPP_MAX_NAME], /* Printer or class name */
|
||||
uri[HTTP_MAX_URI]; /* Universal resource identifier */
|
||||
unsigned char info[IPP_MAX_NAME], /* Printer or class info/description */
|
||||
location[IPP_MAX_NAME]; /* Location text */
|
||||
ipp_pstate_t state; /* Printer state */
|
||||
unsigned char message[IPP_MAX_NAME]; /* State text */
|
||||
cups_ptype_t type; /* Printer type/capability codes */
|
||||
} cups_browse_t;
|
||||
|
||||
typedef struct /**** Printer Options ****/
|
||||
{
|
||||
char *name; /* Name of option */
|
||||
char *value; /* Value of option */
|
||||
} cups_option_t;
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern int cupsCancelJob(const char *printer, int job);
|
||||
#define cupsDoRequest(http,request,resource) cupsDoFileRequest((http),(request),(resource),NULL)
|
||||
extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request,
|
||||
const char *resource, const char *filename);
|
||||
extern int cupsGetClasses(char ***classes);
|
||||
extern const char *cupsGetDefault(void);
|
||||
extern const char *cupsGetPPD(const char *printer);
|
||||
extern int cupsGetPrinters(char ***printers);
|
||||
extern int cupsPrintFile(const char *printer, const char *filename,
|
||||
const char *title, int num_options,
|
||||
cups_option_t *options);
|
||||
extern char *cupsTempFile(char *filename, int len);
|
||||
extern int cupsAddOption(const char *name, const char *value,
|
||||
int num_options, cups_option_t **options);
|
||||
extern void cupsFreeOptions(int num_options, cups_option_t *options);
|
||||
extern const char *cupsGetOption(const char *name, int num_options,
|
||||
cups_option_t *options);
|
||||
extern int cupsParseOptions(const char *arg, int num_options,
|
||||
cups_option_t **options);
|
||||
extern int cupsMarkOptions(ppd_file_t *ppd, int num_options,
|
||||
cups_option_t *options);
|
||||
|
||||
extern const char *cupsGetPassword(const char *prompt);
|
||||
extern const char *cupsServer(void);
|
||||
extern const char *cupsUser(void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_CUPS_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
"us-ascii",
|
||||
"OK",
|
||||
"Cancel",
|
||||
"Help",
|
||||
"Quit",
|
||||
"Close",
|
||||
"Yes",
|
||||
"No",
|
||||
"On",
|
||||
"Off",
|
||||
"Save",
|
||||
"Discard",
|
||||
"Default",
|
||||
"Options",
|
||||
"More Info",
|
||||
"Black",
|
||||
"Color",
|
||||
"Cyan",
|
||||
"Magenta",
|
||||
"Yellow",
|
||||
"Copyright 1993-1999 by Easy Software Products, All Rights Reserved.",
|
||||
"General",
|
||||
"Printer",
|
||||
"Image Options",
|
||||
"HP-GL/2 Options",
|
||||
"Extra",
|
||||
"Document",
|
||||
"Other",
|
||||
"Print Pages: ",
|
||||
"Entire Document",
|
||||
"Page Range:",
|
||||
"Reverse Order: ",
|
||||
"Page Format: ",
|
||||
" 1-Up",
|
||||
" 2-Up",
|
||||
" 4-Up",
|
||||
"Image Scaling: ",
|
||||
"Use Natural Image Size",
|
||||
"Zoom by Percent",
|
||||
"Zoom by PPI",
|
||||
"Mirror Image: ",
|
||||
"Color Saturation: ",
|
||||
"Color Hue: ",
|
||||
"Fit to Page: ",
|
||||
"Shading: ",
|
||||
"Pen Width: ",
|
||||
"Gamma Correction: ",
|
||||
"Brightness: ",
|
||||
"Add",
|
||||
"Delete",
|
||||
"Modify",
|
||||
"Printer URI",
|
||||
"Printer Name",
|
||||
"Printer Location",
|
||||
"Printer Info",
|
||||
"Printer Make and Model",
|
||||
"Device URI",
|
||||
"Formatting Page",
|
||||
"Printing Page",
|
||||
"Initializing Printer",
|
||||
"Printer State",
|
||||
"Accepting Jobs",
|
||||
"Not Accepting Jobs",
|
||||
"Print Jobs",
|
||||
"Class",
|
||||
"Local",
|
||||
"Remote",
|
||||
"Duplexing",
|
||||
"Stapling",
|
||||
"Fast Copies",
|
||||
"Collated Copies",
|
||||
"Hole Punching",
|
||||
"Covering",
|
||||
"Binding",
|
||||
"Sorting",
|
||||
"Small (up to 9.5x14in)",
|
||||
"Medium (9.5x14in to 13x19in)",
|
||||
"Large (13x19in and larger)",
|
||||
"Custom Size",
|
||||
"Idle",
|
||||
"Processing",
|
||||
"Stopped",
|
||||
"All",
|
||||
"Odd",
|
||||
"Even Pages",
|
||||
"Darker Lighter",
|
||||
"Media Size",
|
||||
"Media Type",
|
||||
"Media Source",
|
||||
"Orientation: ",
|
||||
"Portrait",
|
||||
"Landscape",
|
||||
"Job State",
|
||||
"Job Name",
|
||||
"User Name",
|
||||
"Priority",
|
||||
"Copies",
|
||||
"File Size",
|
||||
"Pending",
|
||||
"Output Mode",
|
||||
"Resolution",
|
||||
"400 Your browser sent a request that this server could not understand.",
|
||||
"This server could not verify that you are authorized to access the resource.",
|
||||
"You must pay to access this server.",
|
||||
"You don't have permission to access the resource on this server.",
|
||||
"The requested resource was not found on this server.",
|
||||
"The requested method is not allowed with the resource.",
|
||||
"An appropriate representation for the resource was not found on this server.",
|
||||
"You don't have permission to use this server as a proxy host.",
|
||||
"The request has taken too long to complete and has been aborted.",
|
||||
"The requested resource has more than one value.",
|
||||
"The requested resource is gone and has not been replaced.",
|
||||
"The requested method requires a valid Content-Length.",
|
||||
"The precondition on the request evaluated to false.",
|
||||
"The request is too large for this server to process.",
|
||||
"The request URI is too large for this server to process.",
|
||||
"The request format is not understood by this server.",
|
||||
"500 The server has detected an unrecoverable error and cannot process your request.",
|
||||
"The requested method is not implemented by this server.",
|
||||
"The proxy server received an invalid response from an upstream server.",
|
||||
"The requested resource is currently unavailable on this server.",
|
||||
"The proxy server has taken too long to respond to this server.",
|
||||
"This server does not support the HTTP version required by your browser.",
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Debugging macros 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
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_DEBUG_H_
|
||||
# define _CUPS_DEBUG_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
/*
|
||||
* The debug macros are used if you compile with DEBUG defined.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* DEBUG_puts("string")
|
||||
* DEBUG_printf(("format string", arg, arg, ...));
|
||||
*
|
||||
* Note the extra parenthesis around the DEBUG_printf macro...
|
||||
*/
|
||||
|
||||
# ifdef DEBUG
|
||||
# define DEBUG_puts(x) puts(x)
|
||||
# define DEBUG_printf(x) printf x
|
||||
# else
|
||||
# define DEBUG_puts(x)
|
||||
# define DEBUG_printf(x)
|
||||
# endif /* DEBUG */
|
||||
|
||||
#endif /* !_CUPS_DEBUG_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-301
@@ -1,301 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PPD code emission routines 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.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
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdEmit() - Emit code for marked options to a file.
|
||||
* ppdEmitFd() - Emit code for marked options to a file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "ppd.h"
|
||||
#include <stdlib.h>
|
||||
#include "string.h"
|
||||
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int ppd_sort(ppd_choice_t **c1, ppd_choice_t **c2);
|
||||
static int ppd_collect(ppd_file_t *ppd, ppd_section_t section,
|
||||
ppd_choice_t ***choices);
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdEmit()' - Emit code for marked options to a file.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
|
||||
FILE *fp, /* I - File to write to */
|
||||
ppd_section_t section) /* I - Section to write */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
count; /* Number of choices */
|
||||
ppd_choice_t **choices; /* Choices */
|
||||
ppd_size_t *size; /* Custom page size */
|
||||
|
||||
|
||||
if ((count = ppd_collect(ppd, section, &choices)) == 0)
|
||||
return (0);
|
||||
|
||||
for (i = 0; i < count; i ++)
|
||||
if (section != PPD_ORDER_EXIT && section != PPD_ORDER_JCL)
|
||||
{
|
||||
/*
|
||||
* Send DSC comments with option...
|
||||
*/
|
||||
|
||||
if (fprintf(fp, "%%%%BeginFeature: %s %s\n",
|
||||
((ppd_option_t *)choices[i]->option)->keyword,
|
||||
choices[i]->choice) < 0)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (strcmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 &&
|
||||
strcmp(choices[i]->choice, "Custom") == 0)
|
||||
{
|
||||
/*
|
||||
* Variable size; write out standard size options (this should
|
||||
* eventually be changed to use the parameter positions defined
|
||||
* in the PPD file...)
|
||||
*/
|
||||
|
||||
size = ppdPageSize(ppd, "Custom");
|
||||
fprintf(fp, "%.0f %.0f 0 0 0\n", size->width, size->length);
|
||||
|
||||
if (choices[i]->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...
|
||||
*/
|
||||
|
||||
fputs("pop pop pop\n", fp);
|
||||
fputs("<</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice\n", fp);
|
||||
}
|
||||
}
|
||||
|
||||
if (choices[i]->code != NULL && choices[i]->code[0] != '\0')
|
||||
{
|
||||
if (fputs(choices[i]->code, fp) < 0)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (choices[i]->code[strlen(choices[i]->code) - 1] != '\n')
|
||||
putc('\n', fp);
|
||||
}
|
||||
|
||||
if (fputs("%%EndFeature\n", fp) < 0)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else if (fputs(choices[i]->code, fp) < 0)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
free(choices);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdEmitFd()' - Emit code for marked options to a file.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
|
||||
int fd, /* I - File to write to */
|
||||
ppd_section_t section) /* I - Section to write */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
count; /* Number of choices */
|
||||
ppd_choice_t **choices; /* Choices */
|
||||
char buf[1024]; /* Output buffer for feature */
|
||||
|
||||
|
||||
if ((count = ppd_collect(ppd, section, &choices)) == 0)
|
||||
return (0);
|
||||
|
||||
for (i = 0; i < count; i ++)
|
||||
if (section != PPD_ORDER_EXIT && section != PPD_ORDER_JCL)
|
||||
{
|
||||
/*
|
||||
* Send DSC comments with option...
|
||||
*/
|
||||
|
||||
sprintf(buf, "%%%%BeginFeature: %s %s\n",
|
||||
((ppd_option_t *)choices[i]->option)->keyword, choices[i]->choice);
|
||||
|
||||
if (write(fd, buf, strlen(buf)) < 1)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (write(fd, choices[i]->code, strlen(choices[i]->code)) < 1)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (write(fd, "%%EndFeature\n", 13) < 1)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else if (write(fd, choices[i]->code, strlen(choices[i]->code)) < 1)
|
||||
{
|
||||
free(choices);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
free(choices);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_sort()' - Sort options by ordering numbers...
|
||||
*/
|
||||
|
||||
static int /* O - -1 if c1 < c2, 0 if equal, 1 otherwise */
|
||||
ppd_sort(ppd_choice_t **c1, /* I - First choice */
|
||||
ppd_choice_t **c2) /* I - Second choice */
|
||||
{
|
||||
if (((ppd_option_t *)(*c1)->option)->order < ((ppd_option_t *)(*c2)->option)->order)
|
||||
return (-1);
|
||||
else if (((ppd_option_t *)(*c1)->option)->order > ((ppd_option_t *)(*c2)->option)->order)
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_collect()' - Collect all marked options that reside in the specified
|
||||
* section.
|
||||
*/
|
||||
|
||||
static int /* O - Number of options marked */
|
||||
ppd_collect(ppd_file_t *ppd, /* I - PPD file data */
|
||||
ppd_section_t section, /* I - Section to collect */
|
||||
ppd_choice_t ***choices) /* O - Pointers to choices */
|
||||
{
|
||||
int i, j, k, m; /* Looping vars */
|
||||
ppd_group_t *g, /* Current group */
|
||||
*sg; /* Current sub-group */
|
||||
ppd_option_t *o; /* Current option */
|
||||
ppd_choice_t *c; /* Current choice */
|
||||
int count; /* Number of choices collected */
|
||||
ppd_choice_t **collect; /* Collected choices */
|
||||
|
||||
|
||||
if (ppd == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Allocate memory for up to 1000 selected choices...
|
||||
*/
|
||||
|
||||
count = 0;
|
||||
collect = calloc(sizeof(ppd_choice_t *), 1000);
|
||||
|
||||
/*
|
||||
* Loop through all options and add choices as needed...
|
||||
*/
|
||||
|
||||
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
|
||||
{
|
||||
for (j = g->num_options, o = g->options; j > 0; j --, o ++)
|
||||
if (o->section == section)
|
||||
for (k = o->num_choices, c = o->choices; k > 0; k --, c ++)
|
||||
if (c->marked && count < 1000)
|
||||
{
|
||||
collect[count] = c;
|
||||
count ++;
|
||||
}
|
||||
|
||||
for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
|
||||
for (k = sg->num_options, o = sg->options; k > 0; k --, o ++)
|
||||
if (o->section == section)
|
||||
for (m = o->num_choices, c = o->choices; m > 0; m --, c ++)
|
||||
if (c->marked && count < 1000)
|
||||
{
|
||||
collect[count] = c;
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have more than 1 marked choice, sort them...
|
||||
*/
|
||||
|
||||
if (count > 1)
|
||||
qsort(collect, count, sizeof(ppd_choice_t *),
|
||||
(int (*)(const void *, const void *))ppd_sort);
|
||||
|
||||
/*
|
||||
* Return the array and number of choices; if 0, free the array since
|
||||
* it isn't needed.
|
||||
*/
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
*choices = collect;
|
||||
return (count);
|
||||
}
|
||||
else
|
||||
{
|
||||
*choices = NULL;
|
||||
free(collect);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-297
@@ -1,297 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* File type conversion routines 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.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:
|
||||
*
|
||||
* mimeAddFilter() - Add a filter to the current MIME database.
|
||||
* mimeFilter() - Find the fastest way to convert from one type to another.
|
||||
* compare() - Compare two filter types...
|
||||
* lookup() - Lookup a filter...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "string.h"
|
||||
#include "mime.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int compare(mime_filter_t *, mime_filter_t *);
|
||||
static mime_filter_t *lookup(mime_t *, mime_type_t *, mime_type_t *);
|
||||
|
||||
|
||||
/*
|
||||
* 'mimeAddFilter()' - Add a filter to the current MIME database.
|
||||
*/
|
||||
|
||||
mime_filter_t * /* O - New filter */
|
||||
mimeAddFilter(mime_t *mime, /* I - MIME database */
|
||||
mime_type_t *src, /* I - Source type */
|
||||
mime_type_t *dst, /* I - Destination type */
|
||||
int cost, /* I - Relative time/resource cost */
|
||||
const char *filter) /* I - Filter program to run */
|
||||
{
|
||||
mime_filter_t *temp; /* New filter */
|
||||
|
||||
|
||||
/*
|
||||
* Range-check the input...
|
||||
*/
|
||||
|
||||
if (mime == NULL || src == NULL || dst == NULL || filter == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (strlen(filter) > (MIME_MAX_FILTER - 1))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* See if we already have an existing filter for the given source and
|
||||
* destination...
|
||||
*/
|
||||
|
||||
if ((temp = lookup(mime, src, dst)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Yup, does the existing filter have a higher cost? If so, copy the
|
||||
* filter and cost to the existing filter entry and return it...
|
||||
*/
|
||||
|
||||
if (temp->cost > cost)
|
||||
{
|
||||
temp->cost = cost;
|
||||
strcpy(temp->filter, filter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Nope, add a new one...
|
||||
*/
|
||||
|
||||
if (mime->num_filters == 0)
|
||||
temp = malloc(sizeof(mime_filter_t));
|
||||
else
|
||||
temp = realloc(mime->filters, sizeof(mime_filter_t) * (mime->num_filters + 1));
|
||||
|
||||
if (temp == NULL)
|
||||
return (NULL);
|
||||
|
||||
mime->filters = temp;
|
||||
temp += mime->num_filters;
|
||||
mime->num_filters ++;
|
||||
|
||||
/*
|
||||
* Copy the information over and sort if necessary...
|
||||
*/
|
||||
|
||||
temp->src = src;
|
||||
temp->dst = dst;
|
||||
temp->cost = cost;
|
||||
strcpy(temp->filter, filter);
|
||||
|
||||
if (mime->num_filters > 1)
|
||||
qsort(mime->filters, mime->num_filters, sizeof(mime_filter_t),
|
||||
(int (*)(const void *, const void *))compare);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the new/updated filter...
|
||||
*/
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mimeFilter()' - Find the fastest way to convert from one type to another.
|
||||
*/
|
||||
|
||||
mime_filter_t * /* O - Array of filters to run */
|
||||
mimeFilter(mime_t *mime, /* I - MIME database */
|
||||
mime_type_t *src, /* I - Source file type */
|
||||
mime_type_t *dst, /* I - Destination file type */
|
||||
int *num_filters) /* O - Number of filters to run */
|
||||
{
|
||||
int i, j, /* Looping vars */
|
||||
num_temp, /* Number of temporary filters */
|
||||
num_mintemp, /* Number of filters in the minimum */
|
||||
cost, /* Current cost */
|
||||
mincost; /* Current minimum */
|
||||
mime_filter_t *temp, /* Temporary filter */
|
||||
*mintemp, /* Current minimum */
|
||||
*mincurrent, /* Current filter for minimum */
|
||||
*current, /* Current filter */
|
||||
*filters; /* Filters to use */
|
||||
|
||||
|
||||
/*
|
||||
* Range-check the input...
|
||||
*/
|
||||
|
||||
if (mime == NULL || src == NULL || dst == NULL || num_filters == NULL)
|
||||
return (NULL);
|
||||
|
||||
*num_filters = 0;
|
||||
|
||||
/*
|
||||
* See if there is a filter that can convert the files directly...
|
||||
*/
|
||||
|
||||
if ((temp = lookup(mime, src, dst)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got a direct filter!
|
||||
*/
|
||||
|
||||
if ((filters = (mime_filter_t *)malloc(sizeof(mime_filter_t))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
memcpy(filters, temp, sizeof(mime_filter_t));
|
||||
*num_filters = 1;
|
||||
return (filters);
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, now look for filters from the source type to any other type...
|
||||
*/
|
||||
|
||||
mincost = 9999999;
|
||||
mintemp = NULL;
|
||||
|
||||
for (i = mime->num_filters, current = mime->filters; i > 0; i --, current ++)
|
||||
if (current->src == src)
|
||||
{
|
||||
/*
|
||||
* See if we have any filters that can convert from the destination type
|
||||
* of this filter to the final type...
|
||||
*/
|
||||
|
||||
if ((temp = mimeFilter(mime, current->dst, dst, &num_temp)) == NULL)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Found a match; see if this one is less costly than the last (if
|
||||
* any...)
|
||||
*/
|
||||
|
||||
for (j = 0, cost = 0; j < num_temp; j ++)
|
||||
cost += temp->cost;
|
||||
|
||||
if (cost < mincost)
|
||||
{
|
||||
if (mintemp != NULL)
|
||||
free(mintemp);
|
||||
|
||||
mincost = cost;
|
||||
mintemp = temp;
|
||||
num_mintemp = num_temp;
|
||||
mincurrent = current;
|
||||
}
|
||||
else
|
||||
free(temp);
|
||||
}
|
||||
|
||||
if (mintemp != NULL)
|
||||
{
|
||||
/*
|
||||
* Hey, we got a match! Add the current filter to the beginning of the
|
||||
* filter list...
|
||||
*/
|
||||
|
||||
filters = (mime_filter_t *)realloc(mintemp, sizeof(mime_filter_t) *
|
||||
(num_mintemp + 1));
|
||||
|
||||
if (filters == NULL)
|
||||
{
|
||||
*num_filters = 0;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
memmove(filters + 1, filters, num_mintemp * sizeof(mime_filter_t));
|
||||
memcpy(filters, mincurrent, sizeof(mime_filter_t));
|
||||
|
||||
*num_filters = num_mintemp + 1;
|
||||
|
||||
return (filters);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare()' - Compare two filter types...
|
||||
*/
|
||||
|
||||
static int /* O - Comparison result */
|
||||
compare(mime_filter_t *f0, /* I - First filter */
|
||||
mime_filter_t *f1) /* I - Second filter */
|
||||
{
|
||||
int i; /* Result of comparison */
|
||||
|
||||
|
||||
if ((i = strcmp(f0->src->super, f1->src->super)) == 0)
|
||||
if ((i = strcmp(f0->src->type, f1->src->type)) == 0)
|
||||
if ((i = strcmp(f0->dst->super, f1->dst->super)) == 0)
|
||||
i = strcmp(f0->dst->type, f1->dst->type);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'lookup()' - Lookup a filter...
|
||||
*/
|
||||
|
||||
static mime_filter_t * /* O - Filter for src->dst */
|
||||
lookup(mime_t *mime, /* I - MIME database */
|
||||
mime_type_t *src, /* I - Source type */
|
||||
mime_type_t *dst) /* I - Destination type */
|
||||
{
|
||||
mime_filter_t key; /* Key record for filter search */
|
||||
|
||||
|
||||
if (mime->num_filters == 0)
|
||||
return (NULL);
|
||||
|
||||
key.src = src;
|
||||
key.dst = dst;
|
||||
|
||||
return ((mime_filter_t *)bsearch(&key, mime->filters, mime->num_filters,
|
||||
sizeof(mime_filter_t),
|
||||
(int (*)(const void *, const void *))compare));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1483
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-293
@@ -1,293 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Hyper-Text Transport Protocol definitions 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.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
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_HTTP_H_
|
||||
# define _CUPS_HTTP_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <string.h>
|
||||
# include <time.h>
|
||||
# if defined(WIN32) || defined(__EMX__)
|
||||
# include <winsock.h>
|
||||
# else
|
||||
# include <unistd.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netdb.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <netinet/in_systm.h>
|
||||
# include <netinet/ip.h>
|
||||
# include <netinet/tcp.h>
|
||||
# endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Limits...
|
||||
*/
|
||||
|
||||
# define HTTP_MAX_URI 1024 /* Max length of URI string */
|
||||
# define HTTP_MAX_HOST 256 /* Max length of hostname string */
|
||||
# define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */
|
||||
# define HTTP_MAX_VALUE 256 /* Max header field value length */
|
||||
|
||||
|
||||
/*
|
||||
* HTTP state values...
|
||||
*/
|
||||
|
||||
typedef enum /* States are server-oriented */
|
||||
{
|
||||
HTTP_WAITING, /* Waiting for command */
|
||||
HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */
|
||||
HTTP_GET, /* GET command, waiting for blank line */
|
||||
HTTP_GET_SEND, /* GET command, sending data */
|
||||
HTTP_HEAD, /* HEAD command, waiting for blank line */
|
||||
HTTP_POST, /* POST command, waiting for blank line */
|
||||
HTTP_POST_RECV, /* POST command, receiving data */
|
||||
HTTP_POST_SEND, /* POST command, sending data */
|
||||
HTTP_PUT, /* PUT command, waiting for blank line */
|
||||
HTTP_PUT_RECV, /* PUT command, receiving data */
|
||||
HTTP_DELETE, /* DELETE command, waiting for blank line */
|
||||
HTTP_TRACE, /* TRACE command, waiting for blank line */
|
||||
HTTP_CLOSE, /* CLOSE command, waiting for blank line */
|
||||
HTTP_STATUS /* Command complete, sending status */
|
||||
} http_state_t;
|
||||
|
||||
|
||||
/*
|
||||
* HTTP version numbers...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HTTP_0_9 = 9, /* HTTP/0.9 */
|
||||
HTTP_1_0 = 100, /* HTTP/1.0 */
|
||||
HTTP_1_1 = 101 /* HTTP/1.1 */
|
||||
} http_version_t;
|
||||
|
||||
|
||||
/*
|
||||
* HTTP keep-alive values...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HTTP_KEEPALIVE_OFF = 0,
|
||||
HTTP_KEEPALIVE_ON
|
||||
} http_keepalive_t;
|
||||
|
||||
|
||||
/*
|
||||
* HTTP transfer encoding values...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */
|
||||
HTTP_ENCODE_CHUNKED /* Data is chunked */
|
||||
} http_encoding_t;
|
||||
|
||||
|
||||
/*
|
||||
* HTTP status codes...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HTTP_ERROR = -1, /* An error response from httpXxxx() */
|
||||
|
||||
HTTP_CONTINUE = 100, /* Everything OK, keep going... */
|
||||
|
||||
HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */
|
||||
HTTP_CREATED, /* PUT command was successful */
|
||||
HTTP_ACCEPTED, /* DELETE command was successful */
|
||||
HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */
|
||||
HTTP_NO_CONTENT, /* Successful command, no new data */
|
||||
HTTP_RESET_CONTENT, /* Content was reset/recreated */
|
||||
HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */
|
||||
|
||||
HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */
|
||||
HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */
|
||||
HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */
|
||||
HTTP_SEE_OTHER, /* See this other link... */
|
||||
HTTP_NOT_MODIFIED, /* File not modified */
|
||||
HTTP_USE_PROXY, /* Must use a proxy to access this URI */
|
||||
|
||||
HTTP_BAD_REQUEST = 400, /* Bad request */
|
||||
HTTP_UNAUTHORIZED, /* Unauthorized to access host */
|
||||
HTTP_PAYMENT_REQUIRED, /* Payment required */
|
||||
HTTP_FORBIDDEN, /* Forbidden to access this URI */
|
||||
HTTP_NOT_FOUND, /* URI was not found */
|
||||
HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */
|
||||
HTTP_NOT_ACCEPTABLE, /* Not Acceptable */
|
||||
HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */
|
||||
HTTP_REQUEST_TIMEOUT, /* Request timed out */
|
||||
HTTP_CONFLICT, /* Request is self-conflicting */
|
||||
HTTP_GONE, /* Server has gone away */
|
||||
HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */
|
||||
HTTP_PRECONDITION, /* Precondition failed */
|
||||
HTTP_REQUEST_TOO_LARGE, /* Request entity too large */
|
||||
HTTP_URI_TOO_LONG, /* URI too long */
|
||||
HTTP_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */
|
||||
|
||||
HTTP_SERVER_ERROR = 500, /* Internal server error */
|
||||
HTTP_NOT_IMPLEMENTED, /* Feature not implemented */
|
||||
HTTP_BAD_GATEWAY, /* Bad gateway */
|
||||
HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */
|
||||
HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
|
||||
HTTP_NOT_SUPPORTED /* HTTP version not supported */
|
||||
} http_status_t;
|
||||
|
||||
|
||||
/*
|
||||
* HTTP field names...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HTTP_FIELD_UNKNOWN = -1,
|
||||
HTTP_FIELD_ACCEPT_LANGUAGE,
|
||||
HTTP_FIELD_ACCEPT_RANGES,
|
||||
HTTP_FIELD_AUTHORIZATION,
|
||||
HTTP_FIELD_CONNECTION,
|
||||
HTTP_FIELD_CONTENT_ENCODING,
|
||||
HTTP_FIELD_CONTENT_LANGUAGE,
|
||||
HTTP_FIELD_CONTENT_LENGTH,
|
||||
HTTP_FIELD_CONTENT_LOCATION,
|
||||
HTTP_FIELD_CONTENT_MD5,
|
||||
HTTP_FIELD_CONTENT_RANGE,
|
||||
HTTP_FIELD_CONTENT_TYPE,
|
||||
HTTP_FIELD_CONTENT_VERSION,
|
||||
HTTP_FIELD_DATE,
|
||||
HTTP_FIELD_HOST,
|
||||
HTTP_FIELD_IF_MODIFIED_SINCE,
|
||||
HTTP_FIELD_IF_UNMODIFIED_SINCE,
|
||||
HTTP_FIELD_KEEP_ALIVE,
|
||||
HTTP_FIELD_LAST_MODIFIED,
|
||||
HTTP_FIELD_LINK,
|
||||
HTTP_FIELD_LOCATION,
|
||||
HTTP_FIELD_RANGE,
|
||||
HTTP_FIELD_REFERER,
|
||||
HTTP_FIELD_RETRY_AFTER,
|
||||
HTTP_FIELD_TRANSFER_ENCODING,
|
||||
HTTP_FIELD_UPGRADE,
|
||||
HTTP_FIELD_USER_AGENT,
|
||||
HTTP_FIELD_WWW_AUTHENTICATE,
|
||||
HTTP_FIELD_MAX
|
||||
} http_field_t;
|
||||
|
||||
|
||||
/*
|
||||
* HTTP connection structure...
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fd; /* File descriptor for this socket */
|
||||
int blocking; /* To block or not to block */
|
||||
int error; /* Last error on read */
|
||||
time_t activity; /* Time since last read/write */
|
||||
http_state_t state; /* State of client */
|
||||
http_status_t status; /* Status of last request */
|
||||
http_version_t version; /* Protocol version */
|
||||
http_keepalive_t keep_alive; /* Keep-alive supported? */
|
||||
struct sockaddr_in hostaddr; /* Address of connected host */
|
||||
char hostname[HTTP_MAX_HOST],
|
||||
/* Name of connected host */
|
||||
fields[HTTP_FIELD_MAX][HTTP_MAX_VALUE];
|
||||
/* Field values */
|
||||
char *data; /* Pointer to data buffer */
|
||||
http_encoding_t data_encoding; /* Chunked or not */
|
||||
int data_remaining; /* Number of bytes left */
|
||||
int used; /* Number of bytes used in buffer */
|
||||
char buffer[HTTP_MAX_BUFFER];
|
||||
/* Buffer for messages */
|
||||
} http_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
# define httpBlocking(http,b) (http)->blocking = (b)
|
||||
extern int httpCheck(http_t *http);
|
||||
# define httpClearFields(http) memset((http)->fields, 0, sizeof((http)->fields)),\
|
||||
httpSetField((http), HTTP_FIELD_HOST, (http)->hostname)
|
||||
extern void httpClose(http_t *http);
|
||||
extern http_t *httpConnect(const char *host, int port);
|
||||
extern int httpDelete(http_t *http, const char *uri);
|
||||
# define httpError(http) ((http)->error)
|
||||
extern void httpFlush(http_t *http);
|
||||
extern int httpGet(http_t *http, const char *uri);
|
||||
extern char *httpGets(char *line, int length, http_t *http);
|
||||
extern const char *httpGetDateString(time_t t);
|
||||
extern time_t httpGetDateTime(const char *s);
|
||||
# define httpGetField(http,field) (http)->fields[field]
|
||||
extern int httpHead(http_t *http, const char *uri);
|
||||
extern void httpInitialize(void);
|
||||
extern int httpOptions(http_t *http, const char *uri);
|
||||
extern int httpPost(http_t *http, const char *uri);
|
||||
extern int httpPrintf(http_t *http, const char *format, ...);
|
||||
extern int httpPut(http_t *http, const char *uri);
|
||||
extern int httpRead(http_t *http, char *buffer, int length);
|
||||
extern int httpReconnect(http_t *http);
|
||||
extern void httpSeparate(const char *uri, char *method, char *username,
|
||||
char *host, int *port, char *resource);
|
||||
extern void httpSetField(http_t *http, http_field_t field, const char *value);
|
||||
extern const char *httpStatus(http_status_t status);
|
||||
extern int httpTrace(http_t *http, const char *uri);
|
||||
extern http_status_t httpUpdate(http_t *http);
|
||||
extern int httpWrite(http_t *http, const char *buffer, int length);
|
||||
extern char *httpEncode64(char *out, const char *in);
|
||||
extern char *httpDecode64(char *out, const char *in);
|
||||
extern int httpGetLength(http_t *http);
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_HTTP_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1457
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-343
@@ -1,343 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Internet Printing Protocol definitions 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
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_IPP_H_
|
||||
# define _CUPS_IPP_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <cups/http.h>
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* IPP version string...
|
||||
*/
|
||||
|
||||
# define IPP_VERSION "\001\000"
|
||||
|
||||
/*
|
||||
* IPP registered port number... This is the default value - applications
|
||||
* should use the ippPort() function so that you can customize things in
|
||||
* /etc/services if needed!
|
||||
*/
|
||||
|
||||
# define IPP_PORT 631
|
||||
|
||||
/*
|
||||
* Common limits...
|
||||
*/
|
||||
|
||||
# define IPP_MAX_NAME 256
|
||||
# define IPP_MAX_VALUES 100
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef enum /**** Format tags for attribute formats... ****/
|
||||
{
|
||||
IPP_TAG_ZERO = 0x00,
|
||||
IPP_TAG_OPERATION,
|
||||
IPP_TAG_JOB,
|
||||
IPP_TAG_END,
|
||||
IPP_TAG_PRINTER,
|
||||
IPP_TAG_EXTENSION,
|
||||
IPP_TAG_UNSUPPORTED = 0x10,
|
||||
IPP_TAG_DEFAULT,
|
||||
IPP_TAG_UNKNOWN,
|
||||
IPP_TAG_NOVALUE,
|
||||
IPP_TAG_INTEGER = 0x21,
|
||||
IPP_TAG_BOOLEAN,
|
||||
IPP_TAG_ENUM,
|
||||
IPP_TAG_STRING = 0x30,
|
||||
IPP_TAG_DATE,
|
||||
IPP_TAG_RESOLUTION,
|
||||
IPP_TAG_RANGE,
|
||||
IPP_TAG_COLLECTION,
|
||||
IPP_TAG_TEXTLANG,
|
||||
IPP_TAG_NAMELANG,
|
||||
IPP_TAG_TEXT = 0x41,
|
||||
IPP_TAG_NAME,
|
||||
IPP_TAG_KEYWORD = 0x44,
|
||||
IPP_TAG_URI,
|
||||
IPP_TAG_URISCHEME,
|
||||
IPP_TAG_CHARSET,
|
||||
IPP_TAG_LANGUAGE,
|
||||
IPP_TAG_MIMETYPE
|
||||
} ipp_tag_t;
|
||||
|
||||
typedef enum /**** Resolution units... ****/
|
||||
{
|
||||
IPP_RES_PER_INCH = 3,
|
||||
IPP_RES_PER_CM
|
||||
} ipp_res_t;
|
||||
|
||||
typedef enum /**** Multiple Document Handling ****/
|
||||
{
|
||||
IPP_DOC_SINGLE,
|
||||
IPP_DOC_UNCOLLATED,
|
||||
IPP_DOC_COLLATED,
|
||||
IPP_DOC_SEPARATE
|
||||
} ipp_doc_t;
|
||||
|
||||
typedef enum /**** Finishings... ****/
|
||||
{
|
||||
IPP_FINISH_NONE = 3,
|
||||
IPP_FINISH_STAPLE,
|
||||
IPP_FINISH_PUNCH,
|
||||
IPP_FINISH_COVER,
|
||||
IPP_FINISH_BIND
|
||||
} ipp_finish_t;
|
||||
|
||||
typedef enum /**** Orientation... ****/
|
||||
{
|
||||
IPP_PORTRAIT = 3, /* No rotation */
|
||||
IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
|
||||
IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
|
||||
IPP_REVERSE_PORTRAIT /* 180 degrees */
|
||||
} ipp_orient_t;
|
||||
|
||||
typedef enum /**** Qualities... ****/
|
||||
{
|
||||
IPP_QUALITY_DRAFT = 3,
|
||||
IPP_QUALITY_NORMAL,
|
||||
IPP_QUALITY_HIGH
|
||||
} ipp_quality_t;
|
||||
|
||||
typedef enum /**** Job States.... */
|
||||
{
|
||||
IPP_JOB_PENDING = 3,
|
||||
IPP_JOB_HELD,
|
||||
IPP_JOB_PROCESSING,
|
||||
IPP_JOB_STOPPED,
|
||||
IPP_JOB_CANCELED,
|
||||
IPP_JOB_ABORTED,
|
||||
IPP_JOB_COMPLETED
|
||||
} ipp_jstate_t;
|
||||
|
||||
typedef enum /**** Printer States.... */
|
||||
{
|
||||
IPP_PRINTER_IDLE = 3,
|
||||
IPP_PRINTER_PROCESSING,
|
||||
IPP_PRINTER_STOPPED
|
||||
} ipp_pstate_t;
|
||||
|
||||
typedef enum /**** IPP states... ****/
|
||||
{
|
||||
IPP_ERROR = -1, /* An error occurred */
|
||||
IPP_IDLE, /* Nothing is happening/request completed */
|
||||
IPP_HEADER, /* The request header needs to be sent/received */
|
||||
IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */
|
||||
IPP_DATA /* IPP request data needs to be sent/received */
|
||||
} ipp_state_t;
|
||||
|
||||
typedef enum /**** IPP operations... ****/
|
||||
{
|
||||
IPP_PRINT_JOB = 0x0002,
|
||||
IPP_PRINT_URI,
|
||||
IPP_VALIDATE_JOB,
|
||||
IPP_CREATE_JOB,
|
||||
IPP_SEND_DOCUMENT,
|
||||
IPP_SEND_URI,
|
||||
IPP_CANCEL_JOB,
|
||||
IPP_GET_JOB_ATTRIBUTES,
|
||||
IPP_GET_JOBS,
|
||||
IPP_GET_PRINTER_ATTRIBUTES,
|
||||
IPP_HOLD_JOB = 0x000c,
|
||||
IPP_RELEASE_JOB,
|
||||
IPP_RESTART_JOB,
|
||||
IPP_PAUSE_PRINTER = 0x0010,
|
||||
IPP_RESUME_PRINTER,
|
||||
IPP_PURGE_JOBS,
|
||||
IPP_PRIVATE = 0x4000,
|
||||
CUPS_GET_DEFAULT,
|
||||
CUPS_GET_PRINTERS,
|
||||
CUPS_ADD_PRINTER,
|
||||
CUPS_DELETE_PRINTER,
|
||||
CUPS_GET_CLASSES,
|
||||
CUPS_ADD_CLASS,
|
||||
CUPS_DELETE_CLASS,
|
||||
CUPS_ACCEPT_JOBS,
|
||||
CUPS_REJECT_JOBS,
|
||||
CUPS_SET_DEFAULT
|
||||
} ipp_op_t;
|
||||
|
||||
typedef enum /**** IPP status codes... ****/
|
||||
{
|
||||
IPP_OK = 0x0000,
|
||||
IPP_OK_SUBST,
|
||||
IPP_OK_CONFLICT,
|
||||
IPP_BAD_REQUEST = 0x0400,
|
||||
IPP_FORBIDDEN,
|
||||
IPP_NOT_AUTHENTICATED,
|
||||
IPP_NOT_AUTHORIZED,
|
||||
IPP_NOT_POSSIBLE,
|
||||
IPP_TIMEOUT,
|
||||
IPP_NOT_FOUND,
|
||||
IPP_GONE,
|
||||
IPP_REQUEST_ENTITY,
|
||||
IPP_REQUEST_VALUE,
|
||||
IPP_DOCUMENT_FORMAT,
|
||||
IPP_ATTRIBUTES,
|
||||
IPP_URI_SCHEME,
|
||||
IPP_CHARSET,
|
||||
IPP_CONFLICT,
|
||||
IPP_INTERNAL_ERROR = 0x0500,
|
||||
IPP_OPERATION_NOT_SUPPORTED,
|
||||
IPP_SERVICE_UNAVAILABLE,
|
||||
IPP_VERSION_NOT_SUPPORTED,
|
||||
IPP_DEVICE_UNAVAILABLE,
|
||||
IPP_TEMPORARY_ERROR,
|
||||
IPP_NOT_ACCEPTING,
|
||||
IPP_PRINTER_BUSY
|
||||
} ipp_status_t;
|
||||
|
||||
typedef unsigned char ipp_uchar_t;/**** Unsigned 8-bit integer/character ****/
|
||||
|
||||
typedef union /**** Request Header ****/
|
||||
{
|
||||
struct /* Any Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
int op_status; /* Operation ID or status code*/
|
||||
int request_id; /* Request ID */
|
||||
} any;
|
||||
|
||||
struct /* Operation Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_op_t operation_id; /* Operation ID */
|
||||
int request_id; /* Request ID */
|
||||
} op;
|
||||
|
||||
struct /* Status Header */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_status_t status_code; /* Status code */
|
||||
int request_id; /* Request ID */
|
||||
} status;
|
||||
} ipp_request_t;
|
||||
|
||||
|
||||
typedef union /**** Attribute Value ****/
|
||||
{
|
||||
int integer; /* Integer/enumerated value */
|
||||
|
||||
char boolean; /* Boolean value */
|
||||
|
||||
ipp_uchar_t date[11]; /* Date/time value */
|
||||
|
||||
struct
|
||||
{
|
||||
int xres, /* Horizontal resolution */
|
||||
yres; /* Vertical resolution */
|
||||
ipp_res_t units; /* Resolution units */
|
||||
} resolution; /* Resolution value */
|
||||
|
||||
struct
|
||||
{
|
||||
int lower, /* Lower value */
|
||||
upper; /* Upper value */
|
||||
} range; /* Range of integers value */
|
||||
|
||||
struct
|
||||
{
|
||||
char *charset; /* Character set */
|
||||
char *text; /* String */
|
||||
} string; /* String with language value */
|
||||
} ipp_value_t;
|
||||
|
||||
typedef struct ipp_attribute_s /**** Attribute ****/
|
||||
{
|
||||
struct ipp_attribute_s *next;
|
||||
/* Next atrtribute in list */
|
||||
ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
|
||||
value_tag; /* What type of value is it? */
|
||||
char *name; /* Name of attribute */
|
||||
int num_values; /* Number of values */
|
||||
ipp_value_t values[1]; /* Values */
|
||||
} ipp_attribute_t;
|
||||
|
||||
typedef struct /**** Request State ****/
|
||||
{
|
||||
ipp_state_t state; /* State of request */
|
||||
ipp_request_t request; /* Request header */
|
||||
ipp_attribute_t *attrs, /* Attributes */
|
||||
*last, /* Last attribute in list */
|
||||
*current; /* Current attribute (for read/write) */
|
||||
ipp_tag_t curtag; /* Current attribute group tag */
|
||||
} ipp_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern time_t ippDateToTime(const ipp_uchar_t *date);
|
||||
extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group, const char *name, char value);
|
||||
extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const char *values);
|
||||
extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group, const char *name, const ipp_uchar_t *value);
|
||||
extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int value);
|
||||
extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const int *values);
|
||||
extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group, const char *name, int lower, int upper);
|
||||
extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const int *lower, const int *upper);
|
||||
extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_res_t units, int xres, int yres);
|
||||
extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, ipp_res_t units, const int *xres, const int *yres);
|
||||
extern ipp_attribute_t *ippAddSeparator(ipp_t *ipp);
|
||||
extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, const char *charset, const char *value);
|
||||
extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const char *charset, const char **values);
|
||||
extern void ippDelete(ipp_t *ipp);
|
||||
extern ipp_attribute_t *ippFindAttribute(ipp_t *ipp, const char *name, ipp_tag_t type);
|
||||
extern size_t ippLength(ipp_t *ipp);
|
||||
extern ipp_t *ippNew(void);
|
||||
extern ipp_state_t ippRead(http_t *http, ipp_t *ipp);
|
||||
extern const ipp_uchar_t *ippTimeToDate(time_t t);
|
||||
extern ipp_state_t ippWrite(http_t *http, ipp_t *ipp);
|
||||
extern int ippPort(void);
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_IPP_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,374 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* I18N/language support 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:
|
||||
*
|
||||
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
|
||||
* for the given language.
|
||||
* cupsLangFlush() - Flush all language data out of the cache.
|
||||
* cupsLangFree() - Free language data.
|
||||
* cupsLangGet() - Get a language.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "string.h"
|
||||
#include "language.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static cups_lang_t *lang_cache = NULL; /* Language string cache */
|
||||
static char *lang_blank = ""; /* Blank constant string */
|
||||
static char *lang_encodings[] = /* Encoding strings */
|
||||
{
|
||||
"us-ascii",
|
||||
"iso8859-1",
|
||||
"iso8859-2",
|
||||
"iso8859-3",
|
||||
"iso8859-4",
|
||||
"iso8859-5",
|
||||
"iso8859-6",
|
||||
"iso8859-7",
|
||||
"iso8859-8",
|
||||
"iso8859-9",
|
||||
"iso8859-10",
|
||||
"utf8"
|
||||
};
|
||||
static char *lang_default[] = /* Default POSIX locale */
|
||||
{
|
||||
#include "cups_C.h"
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLangEncoding()' - Return the character encoding (us-ascii, etc.)
|
||||
* for the given language.
|
||||
*/
|
||||
|
||||
char * /* O - Character encoding */
|
||||
cupsLangEncoding(cups_lang_t *lang) /* I - Language data */
|
||||
{
|
||||
if (lang == NULL)
|
||||
return (lang_encodings[0]);
|
||||
else
|
||||
return (lang_encodings[lang->encoding]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLangFlush()' - Flush all language data out of the cache.
|
||||
*/
|
||||
|
||||
void
|
||||
cupsLangFlush(void)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_lang_t *lang, /* Current language */
|
||||
*next; /* Next language */
|
||||
|
||||
|
||||
for (lang = lang_cache; lang != NULL; lang = next)
|
||||
{
|
||||
for (i = 0; i < CUPS_MSG_MAX; i ++)
|
||||
if (lang->messages[i] != NULL && lang->messages[i] != lang_blank)
|
||||
free(lang->messages[i]);
|
||||
|
||||
next = lang->next;
|
||||
free(lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLangFree()' - Free language data.
|
||||
*
|
||||
* This does not actually free anything; use cupsLangFlush() for that.
|
||||
*/
|
||||
|
||||
void
|
||||
cupsLangFree(cups_lang_t *lang) /* I - Language to free */
|
||||
{
|
||||
if (lang != NULL && lang->used > 0)
|
||||
lang->used --;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLangGet()' - Get a language.
|
||||
*/
|
||||
|
||||
cups_lang_t * /* O - Language data */
|
||||
cupsLangGet(const char *language) /* I - Language or locale */
|
||||
{
|
||||
int i, count; /* Looping vars */
|
||||
char langname[16], /* Requested language name */
|
||||
real[16], /* Real language name */
|
||||
filename[1024], /* Filename for language locale file */
|
||||
*localedir; /* Directory for locale files */
|
||||
FILE *fp; /* Language locale file pointer */
|
||||
char line[1024]; /* Line from file */
|
||||
cups_msg_t msg; /* Message number */
|
||||
char *text; /* Message text */
|
||||
cups_lang_t *lang; /* Current language... */
|
||||
|
||||
|
||||
/*
|
||||
* Convert the language string passed in to a locale string. "C" is the
|
||||
* 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.
|
||||
*/
|
||||
|
||||
if (language == NULL || language[0] == '\0' ||
|
||||
strcmp(language, "POSIX") == 0)
|
||||
strcpy(langname, "C");
|
||||
else
|
||||
strcpy(langname, language);
|
||||
|
||||
if (strlen(langname) < 2)
|
||||
strcpy(real, "C");
|
||||
else
|
||||
{
|
||||
real[0] = tolower(langname[0]);
|
||||
real[1] = tolower(langname[1]);
|
||||
|
||||
if (langname[2] == '_' || langname[2] == '-')
|
||||
{
|
||||
real[2] = '_';
|
||||
real[3] = toupper(langname[3]);
|
||||
real[4] = toupper(langname[4]);
|
||||
real[5] = '\0';
|
||||
langname[5] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
langname[2] = '\0';
|
||||
real[2] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Next try to open a locale file; we will try the country-localized file
|
||||
* first, and then look for generic language file. If all else fails we
|
||||
* will use the POSIX locale.
|
||||
*/
|
||||
|
||||
if ((localedir = getenv("LOCALEDIR")) == NULL)
|
||||
localedir = CUPS_LOCALEDIR;
|
||||
|
||||
sprintf(filename, "%s/%s/cups_%s", localedir, real, real);
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL)
|
||||
if (strlen(real) > 2)
|
||||
{
|
||||
/*
|
||||
* Nope, see if we can open a generic language file...
|
||||
*/
|
||||
|
||||
real[2] = '\0';
|
||||
sprintf(filename, "%s/%s/cups_%s", localedir, real, real);
|
||||
fp = fopen(filename, "r");
|
||||
}
|
||||
|
||||
/*
|
||||
* Then see if we already have this language loaded...
|
||||
*/
|
||||
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
if (strcmp(lang->language, langname) == 0)
|
||||
{
|
||||
lang->used ++;
|
||||
|
||||
if (fp != NULL)
|
||||
fclose(fp);
|
||||
|
||||
return (lang);
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, we have an open messages file; the first line will contain the
|
||||
* language encoding (us-ascii, iso-8859-1, etc.), and the rest will
|
||||
* be messages consisting of:
|
||||
*
|
||||
* #### SP message text
|
||||
*
|
||||
* or:
|
||||
*
|
||||
* message text
|
||||
*
|
||||
* If the line starts with a number, then message processing picks up
|
||||
* where the number indicates. Otherwise the last message number is
|
||||
* incremented.
|
||||
*
|
||||
* All leading whitespace is deleted.
|
||||
*/
|
||||
|
||||
if (fp == NULL)
|
||||
strcpy(line, lang_default[0]);
|
||||
else if (fgets(line, sizeof(line), fp) == NULL)
|
||||
{
|
||||
/*
|
||||
* Can't read encoding!
|
||||
*/
|
||||
|
||||
fclose(fp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
i = strlen(line) - 1;
|
||||
if (line[i] == '\n')
|
||||
line[i] = '\0'; /* Strip LF */
|
||||
|
||||
/*
|
||||
* See if there is a free language available; if so, use that
|
||||
* record...
|
||||
*/
|
||||
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
if (lang->used == 0)
|
||||
break;
|
||||
|
||||
if (lang == NULL)
|
||||
{
|
||||
/*
|
||||
* Allocate memory for the language and add it to the cache.
|
||||
*/
|
||||
|
||||
if ((lang = calloc(sizeof(cups_lang_t), 1)) == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
lang->next = lang_cache;
|
||||
lang_cache = lang;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free all old strings as needed...
|
||||
*/
|
||||
|
||||
for (i = 0; i < CUPS_MSG_MAX; i ++)
|
||||
{
|
||||
if (lang->messages[i] != NULL && lang->messages[i] != lang_blank)
|
||||
free(lang->messages[i]);
|
||||
|
||||
lang->messages[i] = lang_blank;
|
||||
}
|
||||
|
||||
/*
|
||||
* Then assign the language and encoding fields...
|
||||
*/
|
||||
|
||||
lang->used ++;
|
||||
strcpy(lang->language, langname);
|
||||
|
||||
for (i = 0; i < (sizeof(lang_encodings) / sizeof(lang_encodings[0])); i ++)
|
||||
if (strcmp(lang_encodings[i], line) == 0)
|
||||
{
|
||||
lang->encoding = (cups_encoding_t)i;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the strings from the file...
|
||||
*/
|
||||
|
||||
msg = (cups_msg_t)-1;
|
||||
count = 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/*
|
||||
* Read a line from memory or from a file...
|
||||
*/
|
||||
|
||||
if (fp == NULL)
|
||||
{
|
||||
if (lang_default[count] == NULL)
|
||||
break;
|
||||
|
||||
strcpy(line, lang_default[count]);
|
||||
}
|
||||
else if (fgets(line, sizeof(line), fp) == NULL)
|
||||
break;
|
||||
|
||||
count ++;
|
||||
|
||||
/*
|
||||
* Ignore blank lines...
|
||||
*/
|
||||
|
||||
i = strlen(line) - 1;
|
||||
if (line[i] == '\n')
|
||||
line[i] = '\0'; /* Strip LF */
|
||||
|
||||
if (line[0] == '\0')
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Grab the message number and text...
|
||||
*/
|
||||
|
||||
if (isdigit(line[0]))
|
||||
msg = (cups_msg_t)atoi(line);
|
||||
else
|
||||
msg ++;
|
||||
|
||||
if (msg < 0 || msg >= CUPS_MSG_MAX)
|
||||
continue;
|
||||
|
||||
text = line;
|
||||
while (isdigit(*text))
|
||||
text ++;
|
||||
while (isspace(*text))
|
||||
text ++;
|
||||
|
||||
lang->messages[msg] = strdup(text);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the file and return...
|
||||
*/
|
||||
|
||||
if (fp != NULL)
|
||||
fclose(fp);
|
||||
|
||||
return (lang);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Multi-language support 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
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_LANGUAGE_H_
|
||||
# define _CUPS_LANGUAGE_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <locale.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Messages...
|
||||
*/
|
||||
|
||||
typedef enum /**** Message Indices ****/
|
||||
{
|
||||
CUPS_MSG_OK,
|
||||
CUPS_MSG_CANCEL,
|
||||
CUPS_MSG_HELP,
|
||||
CUPS_MSG_QUIT,
|
||||
CUPS_MSG_CLOSE,
|
||||
CUPS_MSG_YES,
|
||||
CUPS_MSG_NO,
|
||||
CUPS_MSG_ON,
|
||||
CUPS_MSG_OFF,
|
||||
CUPS_MSG_SAVE,
|
||||
CUPS_MSG_DISCARD,
|
||||
CUPS_MSG_DEFAULT,
|
||||
CUPS_MSG_OPTIONS,
|
||||
CUPS_MSG_MORE_INFO,
|
||||
CUPS_MSG_BLACK,
|
||||
CUPS_MSG_COLOR,
|
||||
CUPS_MSG_CYAN,
|
||||
CUPS_MSG_MAGENTA,
|
||||
CUPS_MSG_YELLOW,
|
||||
CUPS_MSG_COPYRIGHT,
|
||||
CUPS_MSG_GENERAL,
|
||||
CUPS_MSG_PRINTER,
|
||||
CUPS_MSG_IMAGE,
|
||||
CUPS_MSG_HPGL2,
|
||||
CUPS_MSG_EXTRA,
|
||||
CUPS_MSG_DOCUMENT,
|
||||
CUPS_MSG_OTHER,
|
||||
CUPS_MSG_PRINT_PAGES,
|
||||
CUPS_MSG_ENTIRE_DOCUMENT,
|
||||
CUPS_MSG_PAGE_RANGE,
|
||||
CUPS_MSG_REVERSE_ORDER,
|
||||
CUPS_MSG_PAGE_FORMAT,
|
||||
CUPS_MSG_1_UP,
|
||||
CUPS_MSG_2_UP,
|
||||
CUPS_MSG_4_UP,
|
||||
CUPS_MSG_IMAGE_SCALING,
|
||||
CUPS_MSG_USE_NATURAL_IMAGE_SIZE,
|
||||
CUPS_MSG_ZOOM_BY_PERCENT,
|
||||
CUPS_MSG_ZOOM_BY_PPI,
|
||||
CUPS_MSG_MIRROR_IMAGE,
|
||||
CUPS_MSG_COLOR_SATURATION,
|
||||
CUPS_MSG_COLOR_HUE,
|
||||
CUPS_MSG_FIT_TO_PAGE,
|
||||
CUPS_MSG_SHADING,
|
||||
CUPS_MSG_DEFAULT_PEN_WIDTH,
|
||||
CUPS_MSG_GAMMA_CORRECTION,
|
||||
CUPS_MSG_BRIGHTNESS,
|
||||
CUPS_MSG_ADD,
|
||||
CUPS_MSG_DELETE,
|
||||
CUPS_MSG_MODIFY,
|
||||
CUPS_MSG_PRINTER_URI,
|
||||
CUPS_MSG_PRINTER_NAME,
|
||||
CUPS_MSG_PRINTER_LOCATION,
|
||||
CUPS_MSG_PRINTER_INFO,
|
||||
CUPS_MSG_PRINTER_MAKE_AND_MODEL,
|
||||
CUPS_MSG_DEVICE_URI,
|
||||
CUPS_MSG_FORMATTING_PAGE,
|
||||
CUPS_MSG_PRINTING_PAGE,
|
||||
CUPS_MSG_INITIALIZING_PRINTER,
|
||||
CUPS_MSG_PRINTER_STATE,
|
||||
CUPS_MSG_ACCEPTING_JOBS,
|
||||
CUPS_MSG_NOT_ACCEPTING_JOBS,
|
||||
CUPS_MSG_PRINT_JOBS,
|
||||
CUPS_MSG_CLASS,
|
||||
CUPS_MSG_LOCAL,
|
||||
CUPS_MSG_REMOTE,
|
||||
CUPS_MSG_DUPLEXING,
|
||||
CUPS_MSG_STAPLING,
|
||||
CUPS_MSG_FAST_COPIES,
|
||||
CUPS_MSG_COLLATED_COPIES,
|
||||
CUPS_MSG_PUNCHING,
|
||||
CUPS_MSG_COVERING,
|
||||
CUPS_MSG_BINDING,
|
||||
CUPS_MSG_SORTING,
|
||||
CUPS_MSG_SMALL,
|
||||
CUPS_MSG_MEDIUM,
|
||||
CUPS_MSG_LARGE,
|
||||
CUPS_MSG_VARIABLE,
|
||||
CUPS_MSG_IDLE,
|
||||
CUPS_MSG_PROCESSING,
|
||||
CUPS_MSG_STOPPED,
|
||||
CUPS_MSG_ALL,
|
||||
CUPS_MSG_ODD,
|
||||
CUPS_MSG_EVEN_PAGES,
|
||||
CUPS_MSG_DARKER_LIGHTER,
|
||||
CUPS_MSG_MEDIA_SIZE,
|
||||
CUPS_MSG_MEDIA_TYPE,
|
||||
CUPS_MSG_MEDIA_SOURCE,
|
||||
CUPS_MSG_ORIENTATION,
|
||||
CUPS_MSG_PORTRAIT,
|
||||
CUPS_MSG_LANDSCAPE,
|
||||
CUPS_MSG_JOB_STATE,
|
||||
CUPS_MSG_JOB_NAME,
|
||||
CUPS_MSG_USER_NAME,
|
||||
CUPS_MSG_PRIORITY,
|
||||
CUPS_MSG_COPIES,
|
||||
CUPS_MSG_FILE_SIZE,
|
||||
CUPS_MSG_PENDING,
|
||||
CUPS_MSG_OUTPUT_MODE,
|
||||
CUPS_MSG_RESOLUTION,
|
||||
CUPS_MSG_HTTP_BASE = 200,
|
||||
CUPS_MSG_HTTP_END = 505,
|
||||
CUPS_MSG_MAX
|
||||
} cups_msg_t;
|
||||
|
||||
typedef enum /**** Language Encodings ****/
|
||||
{
|
||||
CUPS_US_ASCII,
|
||||
CUPS_ISO8859_1,
|
||||
CUPS_ISO8859_2,
|
||||
CUPS_ISO8859_3,
|
||||
CUPS_ISO8859_4,
|
||||
CUPS_ISO8859_5,
|
||||
CUPS_ISO8859_6,
|
||||
CUPS_ISO8859_7,
|
||||
CUPS_ISO8859_8,
|
||||
CUPS_ISO8859_9,
|
||||
CUPS_ISO8859_10,
|
||||
CUPS_UTF8
|
||||
} cups_encoding_t;
|
||||
|
||||
typedef struct cups_lang_str /**** Language Cache Structure ****/
|
||||
{
|
||||
struct cups_lang_str *next; /* Next language in cache */
|
||||
int used; /* Number of times this entry has been used. */
|
||||
cups_encoding_t encoding; /* Text encoding */
|
||||
char language[16]; /* Language/locale name */
|
||||
char *messages[CUPS_MSG_MAX];
|
||||
/* Message array */
|
||||
} cups_lang_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
# ifdef WIN32
|
||||
# define cupsLangDefault() cupsLangGet(setlocale(LC_ALL, ""))
|
||||
# else /* This fix works around bugs in the Linux and HP-UX setlocale() */
|
||||
# define cupsLangDefault() cupsLangGet(getenv("LANG"))
|
||||
# endif /* WIN32 */
|
||||
|
||||
extern char *cupsLangEncoding(cups_lang_t *lang);
|
||||
extern void cupsLangFlush(void);
|
||||
extern void cupsLangFree(cups_lang_t *lang);
|
||||
extern cups_lang_t *cupsLangGet(const char *language);
|
||||
# define cupsLangString(lang,msg) (lang)->messages[(msg)]
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_LANGUAGE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-412
@@ -1,412 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Option marking routines 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.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
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdConflicts() - Check to see if there are any conflicts.
|
||||
* ppdFindChoice() - Return a pointer to an option choice.
|
||||
* ppdFindMarkedChoice() - Return the marked choice for the specified option.
|
||||
* ppdFindOption() - Return a pointer to the specified option.
|
||||
* ppdIsMarked() - Check to see if an option is marked...
|
||||
* ppdMarkDefaults() - Mark all default options in the PPD file.
|
||||
* ppdMarkOption() - Mark an option in a PPD file.
|
||||
* ppd_defaults() - Set the defaults for this group and all sub-groups.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "ppd.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdConflicts()' - Check to see if there are any conflicts.
|
||||
*/
|
||||
|
||||
int /* O - Number of conflicts found */
|
||||
ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
{
|
||||
int i, j, k, /* Looping variables */
|
||||
conflicts; /* Number of conflicts */
|
||||
ppd_const_t *c; /* Current constraint */
|
||||
ppd_group_t *g, *sg; /* Groups */
|
||||
ppd_option_t *o1, *o2; /* Options */
|
||||
ppd_choice_t *c1, *c2; /* Choices */
|
||||
|
||||
|
||||
if (ppd == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Clear all conflicts...
|
||||
*/
|
||||
|
||||
conflicts = 0;
|
||||
|
||||
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
|
||||
{
|
||||
for (j = g->num_options, o1 = g->options; j > 0; j --, o1 ++)
|
||||
o1->conflicted = 0;
|
||||
|
||||
for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
|
||||
for (k = sg->num_options, o1 = sg->options; k > 0; k --, o1 ++)
|
||||
o1->conflicted = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop through all of the UI constraints and flag any options
|
||||
* that conflict...
|
||||
*/
|
||||
|
||||
for (i = ppd->num_consts, c = ppd->consts; i > 0; i --, c ++)
|
||||
{
|
||||
/*
|
||||
* Grab pointers to the first option...
|
||||
*/
|
||||
|
||||
o1 = ppdFindOption(ppd, c->option1);
|
||||
|
||||
if (o1 == NULL)
|
||||
continue;
|
||||
else if (c->choice1[0] != '\0')
|
||||
{
|
||||
/*
|
||||
* This constraint maps to a specific choice.
|
||||
*/
|
||||
|
||||
c1 = ppdFindChoice(o1, c->choice1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This constraint applies to any choice for this option.
|
||||
*/
|
||||
|
||||
for (j = o1->num_choices, c1 = o1->choices; j > 0; j --, c1 ++)
|
||||
if (c1->marked)
|
||||
break;
|
||||
|
||||
if (j == 0)
|
||||
c1 = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab pointers to the second option...
|
||||
*/
|
||||
|
||||
o2 = ppdFindOption(ppd, c->option2);
|
||||
|
||||
if (o2 == NULL)
|
||||
continue;
|
||||
else if (c->choice2[0] != '\0')
|
||||
{
|
||||
/*
|
||||
* This constraint maps to a specific choice.
|
||||
*/
|
||||
|
||||
c2 = ppdFindChoice(o2, c->choice2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This constraint applies to any choice for this option.
|
||||
*/
|
||||
|
||||
for (j = o2->num_choices, c2 = o2->choices; j > 0; j --, c2 ++)
|
||||
if (c2->marked)
|
||||
break;
|
||||
|
||||
if (j == 0)
|
||||
c2 = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* If both options are marked then there is a conflict...
|
||||
*/
|
||||
|
||||
if (c1 != NULL && c1->marked &&
|
||||
c2 != NULL && c2->marked)
|
||||
{
|
||||
conflicts ++;
|
||||
o1->conflicted = 1;
|
||||
o2->conflicted = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the number of conflicts found...
|
||||
*/
|
||||
|
||||
return (conflicts);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindChoice()' - Return a pointer to an option choice.
|
||||
*/
|
||||
|
||||
ppd_choice_t * /* O - Choice pointer or NULL */
|
||||
ppdFindChoice(ppd_option_t *o, /* I - Pointer to option */
|
||||
const char *choice) /* I - Name of choice */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_choice_t *c; /* Current choice */
|
||||
|
||||
|
||||
if (o == NULL || choice == NULL)
|
||||
return (NULL);
|
||||
|
||||
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
|
||||
if (strcmp(c->choice, choice) == 0)
|
||||
return (c);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindMarkedChoice()' - Return the marked choice for the specified option.
|
||||
*/
|
||||
|
||||
ppd_choice_t * /* O - Pointer to choice or NULL */
|
||||
ppdFindMarkedChoice(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *option) /* I - Keyword/option name */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_option_t *o; /* Pointer to option */
|
||||
ppd_choice_t *c; /* Pointer to choice */
|
||||
|
||||
|
||||
if ((o = ppdFindOption(ppd, option)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
|
||||
if (c->marked)
|
||||
return (c);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindOption()' - Return a pointer to the specified option.
|
||||
*/
|
||||
|
||||
ppd_option_t * /* O - Pointer to option or NULL */
|
||||
ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */
|
||||
const char *option) /* I - Option/Keyword name */
|
||||
{
|
||||
int i, j, k; /* Looping vars */
|
||||
ppd_option_t *o; /* Pointer to option */
|
||||
ppd_group_t *g, /* Pointer to group */
|
||||
*sg; /* Pointer to subgroup */
|
||||
|
||||
|
||||
if (ppd == NULL || option == NULL)
|
||||
return (NULL);
|
||||
|
||||
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
|
||||
{
|
||||
for (j = g->num_options, o = g->options; j > 0; j --, o ++)
|
||||
if (strcmp(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)
|
||||
return (o);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdIsMarked()' - Check to see if an option is marked...
|
||||
*/
|
||||
|
||||
int /* O - Non-zero if option is marked */
|
||||
ppdIsMarked(ppd_file_t *ppd, /* I - PPD file data */
|
||||
const char *option, /* I - Option/Keyword name */
|
||||
const char *choice) /* I - Choice name */
|
||||
{
|
||||
ppd_option_t *o; /* Option pointer */
|
||||
ppd_choice_t *c; /* Choice pointer */
|
||||
|
||||
|
||||
if (ppd == NULL)
|
||||
return (0);
|
||||
|
||||
if ((o = ppdFindOption(ppd, option)) == NULL)
|
||||
return (0);
|
||||
|
||||
if ((c = ppdFindChoice(o, choice)) == NULL)
|
||||
return (0);
|
||||
|
||||
return (c->marked);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdMarkDefaults()' - Mark all default options in the PPD file.
|
||||
*/
|
||||
|
||||
void
|
||||
ppdMarkDefaults(ppd_file_t *ppd)/* I - PPD file record */
|
||||
{
|
||||
int i; /* Looping variables */
|
||||
ppd_group_t *g; /* Current group */
|
||||
ppd_option_t *o; /* PageSize option */
|
||||
|
||||
|
||||
if (ppd == NULL)
|
||||
return;
|
||||
|
||||
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
|
||||
ppd_defaults(ppd, g);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdMarkOption()' - Mark an option in a PPD file.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* -1 is returned if the given option would conflict with any currently
|
||||
* selected option.
|
||||
*/
|
||||
|
||||
int /* O - Number of conflicts */
|
||||
ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
|
||||
const char *option, /* I - Keyword */
|
||||
const char *choice) /* I - Option name */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_option_t *o; /* Option pointer */
|
||||
ppd_choice_t *c; /* Choice pointer */
|
||||
|
||||
|
||||
if (ppd == NULL)
|
||||
return (0);
|
||||
|
||||
if (strcmp(option, "PageSize") == 0 && strncmp(choice, "Custom.", 7) == 0)
|
||||
{
|
||||
/*
|
||||
* Handle variable page sizes...
|
||||
*/
|
||||
|
||||
ppdPageSize(ppd, choice);
|
||||
choice = "Custom";
|
||||
}
|
||||
|
||||
if ((o = ppdFindOption(ppd, option)) == NULL)
|
||||
return (0);
|
||||
|
||||
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
|
||||
if (strcmp(c->choice, choice) == 0)
|
||||
break;
|
||||
|
||||
if (i)
|
||||
{
|
||||
/*
|
||||
* Option found; mark it and then handle unmarking any other options.
|
||||
*/
|
||||
|
||||
c->marked = 1;
|
||||
|
||||
if (o->ui != PPD_UI_PICKMANY)
|
||||
for (i = o->num_choices, c = o->choices; i > 0; i --, c ++)
|
||||
if (strcmp(c->choice, choice) != 0)
|
||||
c->marked = 0;
|
||||
|
||||
if (strcmp(option, "PageSize") == 0 || strcmp(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;
|
||||
|
||||
/*
|
||||
* Unmark the current PageSize or PageRegion setting, as appropriate...
|
||||
*/
|
||||
|
||||
if (strcmp(option, "PageSize") == 0)
|
||||
{
|
||||
if ((o = ppdFindOption(ppd, "PageRegion")) != NULL)
|
||||
for (i = 0; i < o->num_choices; i ++)
|
||||
o->choices[i].marked = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((o = ppdFindOption(ppd, "PageSize")) != NULL)
|
||||
for (i = 0; i < o->num_choices; i ++)
|
||||
o->choices[i].marked = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (ppdConflicts(ppd));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_defaults()' - Set the defaults for this group and all sub-groups.
|
||||
*/
|
||||
|
||||
static void
|
||||
ppd_defaults(ppd_file_t *ppd, /* I - PPD file */
|
||||
ppd_group_t *g) /* I - Group to default */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_option_t *o; /* Current option */
|
||||
ppd_group_t *sg; /* Current sub-group */
|
||||
|
||||
|
||||
if (g == NULL)
|
||||
return;
|
||||
|
||||
for (i = g->num_options, o = g->options; i > 0; i --, o ++)
|
||||
if (strcmp(o->keyword, "PageRegion") != 0)
|
||||
ppdMarkOption(ppd, o->keyword, o->defchoice);
|
||||
|
||||
for (i = g->num_subgroups, sg = g->subgroups; i > 0; i --, sg ++)
|
||||
ppd_defaults(ppd, sg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-617
@@ -1,617 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* MIME database file routines 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.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:
|
||||
*
|
||||
* mimeDelete() - Delete (free) a MIME database.
|
||||
* mimeMerge() - Merge a MIME database from disk with the current one.
|
||||
* mimeNew() - Create a new, empty MIME database.
|
||||
* load_types() - Load a xyz.types file...
|
||||
* delete_rules() - Free all memory for the given rule tree.
|
||||
* load_convs() - Load a xyz.convs file...
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* $Log: mime.c,v $
|
||||
* Revision 1.14 1999/07/12 16:09:38 mike
|
||||
* Fixed all constant arrays to use "const" modifier.
|
||||
*
|
||||
* Revision 1.13 1999/06/18 18:36:10 mike
|
||||
* Fixed address to 44141 Airport View Drive...
|
||||
*
|
||||
* Revision 1.12 1999/04/21 21:19:33 mike
|
||||
* Changes for HP-UX.
|
||||
*
|
||||
* Revision 1.11 1999/04/21 19:31:29 mike
|
||||
* Changed the directory header stuff to use the autoconf-recommended
|
||||
* sequence of #ifdef's.
|
||||
*
|
||||
* Changed the language routines to look for the LOCALEDIR environment
|
||||
* variable, and if it is not defined to use the LOCALEDIR string defined
|
||||
* in config.h.
|
||||
*
|
||||
* Revision 1.10 1999/03/01 20:51:53 mike
|
||||
* Code cleanup - removed extraneous semi-colons...
|
||||
*
|
||||
* Revision 1.9 1999/02/26 22:00:51 mike
|
||||
* Added more debug statements.
|
||||
*
|
||||
* Fixed bugs in cupsPrintFile() - wasn't setting the IPP_TAG_MIMETYPE
|
||||
* value tag for the file type.
|
||||
*
|
||||
* Updated conversion filter code to handle wildcards for super-type.
|
||||
*
|
||||
* Revision 1.8 1999/02/20 16:04:38 mike
|
||||
* Updated mime.c to scan directories under WIN32.
|
||||
*
|
||||
* Fixed some compiler warnings under WIN32.
|
||||
*
|
||||
* Updated VC++ project files.
|
||||
*
|
||||
* Updated mime.types and mime.convs files for actual registered
|
||||
* MIME type names.
|
||||
*
|
||||
* Revision 1.7 1999/02/05 17:40:53 mike
|
||||
* Added IPP client read/write code.
|
||||
*
|
||||
* Added string functions missing from some UNIXs.
|
||||
*
|
||||
* Added option parsing functions.
|
||||
*
|
||||
* Added IPP convenience functions (not implemented yet).
|
||||
*
|
||||
* Updated source files to use local string.h as needed (for
|
||||
* missing string functions)
|
||||
*
|
||||
* Revision 1.6 1999/02/01 22:08:39 mike
|
||||
* Restored original directory-scanning functionality of mimeLoad().
|
||||
*
|
||||
* Revision 1.4 1999/01/27 18:31:56 mike
|
||||
* Updated PPD routines to handle emulations and patch files.
|
||||
*
|
||||
* Added DSC comments to emit output as appropriate.
|
||||
*
|
||||
* Revision 1.3 1999/01/24 14:18:43 mike
|
||||
* Check-in prior to CVS use.
|
||||
*
|
||||
* Revision 1.2 1998/08/06 14:38:38 mike
|
||||
* Finished coding and testing for CUPS 1.0.
|
||||
*
|
||||
* Revision 1.1 1998/06/11 20:50:53 mike
|
||||
* Initial revision
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "string.h"
|
||||
#include "mime.h"
|
||||
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <windows.h>
|
||||
#elif HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
typedef struct dirent DIRENT;
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
typedef struct direct DIRENT;
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void load_types(mime_t *mime, char *filename);
|
||||
static void load_convs(mime_t *mime, char *filename);
|
||||
static void delete_rules(mime_magic_t *rules);
|
||||
|
||||
|
||||
/*
|
||||
* 'mimeDelete()' - Delete (free) a MIME database.
|
||||
*/
|
||||
|
||||
void
|
||||
mimeDelete(mime_t *mime) /* I - MIME database */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (mime == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Loop through the file types and delete any rules...
|
||||
*/
|
||||
|
||||
for (i = 0; i < mime->num_types; i ++)
|
||||
{
|
||||
delete_rules(mime->types[i]->rules);
|
||||
free(mime->types[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the types and filters arrays, and then the MIME database structure.
|
||||
*/
|
||||
|
||||
free(mime->types);
|
||||
free(mime->filters);
|
||||
free(mime);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mimeMerge()' - Merge a MIME database from disk with the current one.
|
||||
*/
|
||||
|
||||
mime_t * /* O - Updated MIME database */
|
||||
mimeMerge(mime_t *mime, /* I - MIME database to add to */
|
||||
const char *pathname) /* I - Directory to load */
|
||||
{
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
HANDLE dir; /* Directory handle */
|
||||
WIN32_FIND_DATA dent; /* Directory entry */
|
||||
char filename[1024], /* Full filename of types/converts file */
|
||||
*pathsep; /* Last character in path */
|
||||
|
||||
|
||||
/*
|
||||
* First open the directory specified by pathname... Return NULL if nothing
|
||||
* was read or if the pathname is NULL...
|
||||
*/
|
||||
|
||||
if (pathname == NULL)
|
||||
return (NULL);
|
||||
|
||||
strcpy(filename, pathname);
|
||||
pathsep = filename + strlen(filename);
|
||||
if (pathsep == filename ||
|
||||
(pathsep[-1] != '/' && pathsep[-1] != '\\'))
|
||||
{
|
||||
strcpy(pathsep, "/");
|
||||
pathsep ++;
|
||||
}
|
||||
|
||||
strcpy(pathsep, "*.types");
|
||||
|
||||
if ((dir = FindFirstFile(filename, &dent)) == 0)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* If "mime" is NULL, make a new, blank database...
|
||||
*/
|
||||
|
||||
if (mime == NULL)
|
||||
if ((mime = mimeNew()) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Read all the .types files...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
/*
|
||||
* Load a mime.types file...
|
||||
*/
|
||||
|
||||
strcpy(pathsep, dent.cFileName);
|
||||
load_types(mime, filename);
|
||||
}
|
||||
while (FindNextFile(dir, &dent));
|
||||
|
||||
FindClose(dir);
|
||||
|
||||
/*
|
||||
* Read all the .convs files...
|
||||
*/
|
||||
|
||||
strcpy(pathsep, "*.convs");
|
||||
|
||||
if ((dir = FindFirstFile(filename, &dent)) == 0)
|
||||
return (mime);
|
||||
|
||||
do
|
||||
{
|
||||
/*
|
||||
* Load a mime.convs file...
|
||||
*/
|
||||
|
||||
strcpy(pathsep, dent.cFileName);
|
||||
load_convs(mime, filename);
|
||||
}
|
||||
while (FindNextFile(dir, &dent));
|
||||
|
||||
FindClose(dir);
|
||||
|
||||
return (mime);
|
||||
#else
|
||||
DIR *dir; /* Directory */
|
||||
DIRENT *dent; /* Directory entry */
|
||||
char filename[1024]; /* Full filename of types/converts file */
|
||||
|
||||
|
||||
/*
|
||||
* First open the directory specified by pathname... Return NULL if nothing
|
||||
* was read or if the pathname is NULL...
|
||||
*/
|
||||
|
||||
if (pathname == NULL)
|
||||
return (NULL);
|
||||
|
||||
if ((dir = opendir(pathname)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* If "mime" is NULL, make a new, blank database...
|
||||
*/
|
||||
|
||||
if (mime == NULL)
|
||||
if ((mime = mimeNew()) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Read all the .types files...
|
||||
*/
|
||||
|
||||
while ((dent = readdir(dir)) != NULL)
|
||||
{
|
||||
if (NAMLEN(dent) > 6 &&
|
||||
strcmp(dent->d_name + NAMLEN(dent) - 6, ".types") == 0)
|
||||
{
|
||||
/*
|
||||
* Load a mime.types file...
|
||||
*/
|
||||
|
||||
sprintf(filename, "%s/%s", pathname, dent->d_name);
|
||||
load_types(mime, filename);
|
||||
}
|
||||
}
|
||||
|
||||
rewinddir(dir);
|
||||
|
||||
/*
|
||||
* Read all the .convs files...
|
||||
*/
|
||||
|
||||
while ((dent = readdir(dir)) != NULL)
|
||||
{
|
||||
if (NAMLEN(dent) > 6 &&
|
||||
strcmp(dent->d_name + NAMLEN(dent) - 6, ".convs") == 0)
|
||||
{
|
||||
/*
|
||||
* Load a mime.convs file...
|
||||
*/
|
||||
|
||||
sprintf(filename, "%s/%s", pathname, dent->d_name);
|
||||
load_convs(mime, filename);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
return (mime);
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mimeNew()' - Create a new, empty MIME database.
|
||||
*/
|
||||
|
||||
mime_t * /* O - MIME database */
|
||||
mimeNew(void)
|
||||
{
|
||||
return ((mime_t *)calloc(1, sizeof(mime_t)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'load_types()' - Load a xyz.types file...
|
||||
*/
|
||||
|
||||
static void
|
||||
load_types(mime_t *mime, /* I - MIME database */
|
||||
char *filename) /* I - Types file to load */
|
||||
{
|
||||
FILE *fp; /* Types file */
|
||||
int linelen; /* Length of line */
|
||||
char line[65536], /* Input line from file */
|
||||
*lineptr, /* Current position in line */
|
||||
super[MIME_MAX_SUPER], /* Super-type name */
|
||||
type[MIME_MAX_TYPE], /* Type name */
|
||||
*temp; /* Temporary pointer */
|
||||
mime_type_t *typeptr; /* New MIME type */
|
||||
|
||||
|
||||
/*
|
||||
* First try to open the file...
|
||||
*/
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Then read each line from the file, skipping any comments in the file...
|
||||
*/
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL)
|
||||
{
|
||||
linelen = strlen(line);
|
||||
|
||||
/*
|
||||
* While the last character in the line is a backslash, continue on to the
|
||||
* next line (and the next, etc.)
|
||||
*/
|
||||
|
||||
if (line[linelen - 1] == '\n')
|
||||
{
|
||||
line[linelen - 1] = '\0';
|
||||
linelen --;
|
||||
}
|
||||
|
||||
while (line[linelen - 1] == '\\')
|
||||
{
|
||||
linelen --;
|
||||
|
||||
if (fgets(line + linelen, sizeof(line) - linelen, fp) == NULL)
|
||||
line[linelen] = '\0';
|
||||
else
|
||||
{
|
||||
linelen += strlen(line + linelen);
|
||||
if (line[linelen - 1] == '\n')
|
||||
{
|
||||
line[linelen - 1] = '\0';
|
||||
linelen --;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip blank lines and lines starting with a #...
|
||||
*/
|
||||
|
||||
if (line[0] == '\n' || line[0] == '#')
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Extract the super-type and type names from the beginning of the line.
|
||||
*/
|
||||
|
||||
lineptr = line;
|
||||
temp = super;
|
||||
|
||||
while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
|
||||
(temp - super + 1) < MIME_MAX_SUPER)
|
||||
*temp++ = tolower(*lineptr++);
|
||||
|
||||
*temp = '\0';
|
||||
|
||||
if (*lineptr != '/')
|
||||
continue;
|
||||
|
||||
lineptr ++;
|
||||
temp = type;
|
||||
|
||||
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\n' &&
|
||||
*lineptr != '\0' && (temp - type + 1) < MIME_MAX_TYPE)
|
||||
*temp++ = tolower(*lineptr++);
|
||||
|
||||
*temp = '\0';
|
||||
|
||||
/*
|
||||
* Add the type and rules to the MIME database...
|
||||
*/
|
||||
|
||||
typeptr = mimeAddType(mime, super, type);
|
||||
mimeAddTypeRule(typeptr, lineptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'load_convs()' - Load a xyz.convs file...
|
||||
*/
|
||||
|
||||
static void
|
||||
load_convs(mime_t *mime, /* I - MIME database */
|
||||
char *filename) /* I - Convs file to load */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
FILE *fp; /* Convs file */
|
||||
char line[1024], /* Input line from file */
|
||||
*lineptr, /* Current position in line */
|
||||
super[MIME_MAX_SUPER], /* Super-type name */
|
||||
type[MIME_MAX_TYPE], /* Type name */
|
||||
*temp, /* Temporary pointer */
|
||||
*filter; /* Filter program */
|
||||
mime_type_t **temptype, /* MIME type looping var */
|
||||
*dsttype; /* Destination MIME type */
|
||||
int cost; /* Cost of filter */
|
||||
|
||||
|
||||
/*
|
||||
* First try to open the file...
|
||||
*/
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Then read each line from the file, skipping any comments in the file...
|
||||
*/
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL)
|
||||
{
|
||||
/*
|
||||
* Skip blank lines and lines starting with a #...
|
||||
*/
|
||||
|
||||
if (line[0] == '\n' || line[0] == '#')
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Extract the destination super-type and type names from the middle of
|
||||
* the line.
|
||||
*/
|
||||
|
||||
lineptr = line;
|
||||
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\0')
|
||||
lineptr ++;
|
||||
|
||||
while (*lineptr == ' ' || *lineptr == '\t')
|
||||
lineptr ++;
|
||||
|
||||
temp = super;
|
||||
|
||||
while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
|
||||
(temp - super + 1) < MIME_MAX_SUPER)
|
||||
*temp++ = tolower(*lineptr++);
|
||||
|
||||
*temp = '\0';
|
||||
|
||||
if (*lineptr != '/')
|
||||
continue;
|
||||
|
||||
lineptr ++;
|
||||
temp = type;
|
||||
|
||||
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\n' &&
|
||||
*lineptr != '\0' && (temp - type + 1) < MIME_MAX_TYPE)
|
||||
*temp++ = tolower(*lineptr++);
|
||||
|
||||
*temp = '\0';
|
||||
|
||||
if (*lineptr == '\0' || *lineptr == '\n')
|
||||
continue;
|
||||
|
||||
if ((dsttype = mimeType(mime, super, type)) == NULL)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Then get the cost and filter program...
|
||||
*/
|
||||
|
||||
while (*lineptr == ' ' || *lineptr == '\t')
|
||||
lineptr ++;
|
||||
|
||||
if (*lineptr < '0' || *lineptr > '9')
|
||||
continue;
|
||||
|
||||
cost = atoi(lineptr);
|
||||
|
||||
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\0')
|
||||
lineptr ++;
|
||||
while (*lineptr == ' ' || *lineptr == '\t')
|
||||
lineptr ++;
|
||||
|
||||
if (*lineptr == '\0' || *lineptr == '\n')
|
||||
continue;
|
||||
|
||||
filter = lineptr;
|
||||
if (filter[strlen(filter) - 1] == '\n')
|
||||
filter[strlen(filter) - 1] = '\0';
|
||||
|
||||
/*
|
||||
* Finally, get the source super-type and type names from the beginning of
|
||||
* the line. We do it here so we can support wildcards...
|
||||
*/
|
||||
|
||||
lineptr = line;
|
||||
temp = super;
|
||||
|
||||
while (*lineptr != '/' && *lineptr != '\n' && *lineptr != '\0' &&
|
||||
(temp - super + 1) < MIME_MAX_SUPER)
|
||||
*temp++ = tolower(*lineptr++);
|
||||
|
||||
*temp = '\0';
|
||||
|
||||
if (*lineptr != '/')
|
||||
continue;
|
||||
|
||||
lineptr ++;
|
||||
temp = type;
|
||||
|
||||
while (*lineptr != ' ' && *lineptr != '\t' && *lineptr != '\n' &&
|
||||
*lineptr != '\0' && (temp - type + 1) < MIME_MAX_TYPE)
|
||||
*temp++ = tolower(*lineptr++);
|
||||
|
||||
*temp = '\0';
|
||||
|
||||
/*
|
||||
* Add the filter to the MIME database, supporting wildcards as needed...
|
||||
*/
|
||||
|
||||
for (temptype = mime->types, i = 0; i < mime->num_types; i ++, temptype ++)
|
||||
if ((super[0] == '*' || strcmp((*temptype)->super, super) == 0) &&
|
||||
(type[0] == '*' || strcmp((*temptype)->type, type) == 0))
|
||||
mimeAddFilter(mime, *temptype, dsttype, cost, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'delete_rules()' - Free all memory for the given rule tree.
|
||||
*/
|
||||
|
||||
static void
|
||||
delete_rules(mime_magic_t *rules) /* I - Rules to free */
|
||||
{
|
||||
mime_magic_t *next; /* Next rule to free */
|
||||
|
||||
|
||||
/*
|
||||
* Free the rules list, descending recursively to free any child rules.
|
||||
*/
|
||||
|
||||
while (rules != NULL)
|
||||
{
|
||||
next = rules->next;
|
||||
|
||||
if (rules->child != NULL)
|
||||
delete_rules(rules->child);
|
||||
|
||||
free(rules);
|
||||
rules = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* MIME type/conversion database definitions 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.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
|
||||
*/
|
||||
|
||||
#ifndef _MIME_H_
|
||||
# define _MIME_H_
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef _cplusplus
|
||||
extern "C" {
|
||||
# endif /* _cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define MIME_MAX_SUPER 16 /* Maximum size of supertype name */
|
||||
# define MIME_MAX_TYPE 32 /* Maximum size of type name */
|
||||
# define MIME_MAX_FILTER 256 /* Maximum size of filter pathname */
|
||||
# define MIME_MAX_BUFFER 8192 /* Maximum size of file buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Types/structures...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MIME_MAGIC_NOP, /* No operation */
|
||||
MIME_MAGIC_AND, /* Logical AND of all children */
|
||||
MIME_MAGIC_OR, /* Logical OR of all children */
|
||||
MIME_MAGIC_MATCH, /* Filename match */
|
||||
MIME_MAGIC_ASCII, /* ASCII characters in range */
|
||||
MIME_MAGIC_PRINTABLE, /* Printable characters (32-255) in range */
|
||||
MIME_MAGIC_STRING, /* String matches */
|
||||
MIME_MAGIC_CHAR, /* Character/byte matches */
|
||||
MIME_MAGIC_SHORT, /* Short/16-bit word matches */
|
||||
MIME_MAGIC_INT, /* Integer/32-bit word matches */
|
||||
MIME_MAGIC_LOCALE /* Current locale matches string */
|
||||
} mime_op_t;
|
||||
|
||||
typedef struct mime_magic_str /**** MIME Magic Data ****/
|
||||
{
|
||||
struct mime_magic_str *prev, /* Previous rule */
|
||||
*next, /* Next rule */
|
||||
*parent, /* Parent rules */
|
||||
*child; /* Child rules */
|
||||
short op, /* Operation code (see above) */
|
||||
invert; /* Invert the result */
|
||||
int offset, /* Offset in file */
|
||||
length; /* Length of data */
|
||||
union
|
||||
{
|
||||
char matchv[64]; /* Match value */
|
||||
char localev[64]; /* Locale value */
|
||||
char stringv[64]; /* String value */
|
||||
char charv; /* Byte value */
|
||||
short shortv; /* Short value */
|
||||
int intv; /* Integer value */
|
||||
} value;
|
||||
} mime_magic_t;
|
||||
|
||||
typedef struct /**** MIME Type Data ****/
|
||||
{
|
||||
char super[MIME_MAX_SUPER], /* Super-type name ("image", "application", etc.) */
|
||||
type[MIME_MAX_TYPE]; /* Type name ("png", "postscript", etc.) */
|
||||
mime_magic_t *rules; /* Rules used to detect this type */
|
||||
} mime_type_t;
|
||||
|
||||
typedef struct /**** MIME Conversion Filter Data ****/
|
||||
{
|
||||
mime_type_t *src, /* Source type */
|
||||
*dst; /* Destination type */
|
||||
int cost; /* Relative cost */
|
||||
char filter[MIME_MAX_FILTER];/* Filter program to use */
|
||||
} mime_filter_t;
|
||||
|
||||
typedef struct /**** MIME Database ****/
|
||||
{
|
||||
int num_types; /* Number of file types */
|
||||
mime_type_t **types; /* File types */
|
||||
int num_filters; /* Number of type conversion filters */
|
||||
mime_filter_t *filters; /* Type conversion filters */
|
||||
} mime_t;
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern void mimeDelete(mime_t *mime);
|
||||
#define mimeLoad(pathname) mimeMerge((mime_t *)0, (pathname));
|
||||
extern mime_t *mimeMerge(mime_t *mime, const char *pathname);
|
||||
extern mime_t *mimeNew(void);
|
||||
|
||||
extern mime_type_t *mimeAddType(mime_t *mime, const char *super, const char *type);
|
||||
extern int mimeAddTypeRule(mime_type_t *mt, const char *rule);
|
||||
extern mime_type_t *mimeFileType(mime_t *mime, const char *pathname);
|
||||
extern mime_type_t *mimeType(mime_t *mime, const char *super, const char *type);
|
||||
|
||||
extern mime_filter_t *mimeAddFilter(mime_t *mime, mime_type_t *src, mime_type_t *dst,
|
||||
int cost, const char *filter);
|
||||
extern mime_filter_t *mimeFilter(mime_t *mime, mime_type_t *src, mime_type_t *dst,
|
||||
int *num_filters);
|
||||
|
||||
# ifdef _cplusplus
|
||||
}
|
||||
# endif /* _cplusplus */
|
||||
#endif /* !_MIME_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,378 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Option routines 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:
|
||||
*
|
||||
* cupsAddOption() - Add an option to an option array.
|
||||
* cupsFreeOptions() - Free all memory used by options.
|
||||
* cupsGetOption() - Get an option value.
|
||||
* cupsParseOptions() - Parse options from a command-line argument.
|
||||
* cupsMarkOptions() - Mark command-line options in a PPD file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "string.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsAddOption()' - Add an option to an option array.
|
||||
*/
|
||||
|
||||
int /* O - Number of options */
|
||||
cupsAddOption(const char *name, /* I - Name of option */
|
||||
const char *value, /* I - Value of option */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t **options) /* IO - Pointer to options */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_option_t *temp; /* Pointer to new option */
|
||||
|
||||
|
||||
if (name == NULL || value == NULL || options == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Look for an existing option with the same name...
|
||||
*/
|
||||
|
||||
for (i = 0, temp = *options; i < num_options; i ++, temp ++)
|
||||
if (strcmp(temp->name, name) == 0)
|
||||
break;
|
||||
|
||||
if (i >= num_options)
|
||||
{
|
||||
/*
|
||||
* No matching option name...
|
||||
*/
|
||||
|
||||
if (num_options == 0)
|
||||
temp = (cups_option_t *)malloc(sizeof(cups_option_t));
|
||||
else
|
||||
temp = (cups_option_t *)realloc(*options, sizeof(cups_option_t) *
|
||||
(num_options + 1));
|
||||
|
||||
if (temp == NULL)
|
||||
return (0);
|
||||
|
||||
*options = temp;
|
||||
temp += num_options;
|
||||
temp->name = strdup(name);
|
||||
num_options ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Match found; free the old value...
|
||||
*/
|
||||
|
||||
free(temp->value);
|
||||
}
|
||||
|
||||
temp->value = strdup(value);
|
||||
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsFreeOptions()' - Free all memory used by options.
|
||||
*/
|
||||
|
||||
void
|
||||
cupsFreeOptions(int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Pointer to options */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (num_options == 0 || options == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
{
|
||||
free(options[i].name);
|
||||
free(options[i].value);
|
||||
}
|
||||
|
||||
free(options);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetOption()' - Get an option value.
|
||||
*/
|
||||
|
||||
const char * /* O - Option value or NULL */
|
||||
cupsGetOption(const char *name, /* I - Name of option */
|
||||
int num_options,/* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
if (name == NULL || num_options == 0 || options == NULL)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
if (strcmp(options[i].name, name) == 0)
|
||||
return (options[i].value);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsParseOptions()' - Parse options from a command-line argument.
|
||||
*/
|
||||
|
||||
int /* O - Number of options found */
|
||||
cupsParseOptions(const char *arg, /* I - Argument to parse */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t **options) /* O - Options found */
|
||||
{
|
||||
char *copyarg, /* Copy of input string */
|
||||
*ptr, /* Pointer into string */
|
||||
*name, /* Pointer to name */
|
||||
*value; /* Pointer to value */
|
||||
|
||||
|
||||
if (arg == NULL || options == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Make a copy of the argument string and then divide it up...
|
||||
*/
|
||||
|
||||
copyarg = strdup(arg);
|
||||
ptr = copyarg;
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/*
|
||||
* Get the name up to a SPACE, =, or end-of-string...
|
||||
*/
|
||||
|
||||
name = ptr;
|
||||
while (!isspace(*ptr) && *ptr != '=' && *ptr != '\0')
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
* Skip trailing spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr))
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (*ptr != '=')
|
||||
{
|
||||
/*
|
||||
* Start of another option...
|
||||
*/
|
||||
|
||||
num_options = cupsAddOption(name, "", num_options, options);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove = and parse the value...
|
||||
*/
|
||||
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (*ptr == '\'')
|
||||
{
|
||||
/*
|
||||
* Quoted string constant...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
value = ptr;
|
||||
|
||||
while (*ptr != '\'' && *ptr != '\0')
|
||||
ptr ++;
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else if (*ptr == '\"')
|
||||
{
|
||||
/*
|
||||
* Double-quoted string constant...
|
||||
*/
|
||||
|
||||
ptr ++;
|
||||
value = ptr;
|
||||
|
||||
while (*ptr != '\"' && *ptr != '\0')
|
||||
ptr ++;
|
||||
|
||||
if (*ptr != '\0')
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
value = ptr;
|
||||
|
||||
while (!isspace(*ptr) && *ptr != '\0')
|
||||
ptr ++;
|
||||
|
||||
while (isspace(*ptr))
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the string value...
|
||||
*/
|
||||
|
||||
num_options = cupsAddOption(name, value, num_options, options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the copy of the argument we made and return the number of options
|
||||
* found.
|
||||
*/
|
||||
|
||||
free(copyarg);
|
||||
|
||||
return (num_options);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsMarkOptions()' - Mark command-line options in a PPD file.
|
||||
*/
|
||||
|
||||
int /* O - 1 if conflicting */
|
||||
cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int conflict; /* Option conflicts */
|
||||
char *val, /* Pointer into value */
|
||||
*ptr, /* Pointer into string */
|
||||
s[255]; /* Temporary string */
|
||||
|
||||
|
||||
conflict = 0;
|
||||
|
||||
for (i = num_options; i > 0; i --, options ++)
|
||||
if (strcmp(options->name, "media") == 0)
|
||||
{
|
||||
/*
|
||||
* Loop through the option string, separating it at commas and
|
||||
* marking each individual option.
|
||||
*/
|
||||
|
||||
for (val = options->value; *val;)
|
||||
{
|
||||
/*
|
||||
* Extract the sub-option from the string...
|
||||
*/
|
||||
|
||||
for (ptr = s; *val && *val != ',' && (ptr - s) < (sizeof(s) - 1);)
|
||||
*ptr++ = *val++;
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (*val == ',')
|
||||
val ++;
|
||||
|
||||
/*
|
||||
* Mark it...
|
||||
*/
|
||||
|
||||
if (ppdMarkOption(ppd, "PageSize", s))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "InputSlot", s))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "MediaType", s))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "EFMediaQualityMode", s)) /* EFI */
|
||||
conflict = 1;
|
||||
if (strcasecmp(s, "manual") == 0)
|
||||
if (ppdMarkOption(ppd, "ManualFeed", "True"))
|
||||
conflict = 1;
|
||||
}
|
||||
}
|
||||
else if (strcmp(options->name, "sides") == 0)
|
||||
{
|
||||
if (strcmp(options->value, "one-sided") == 0)
|
||||
{
|
||||
if (ppdMarkOption(ppd, "Duplex", "None"))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "EFDuplex", "None")) /* EFI */
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "KD03Duplex", "None")) /* Kodak */
|
||||
conflict = 1;
|
||||
}
|
||||
else if (strcmp(options->value, "two-sided-long-edge") == 0)
|
||||
{
|
||||
if (ppdMarkOption(ppd, "Duplex", "DuplexNoTumble"))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "EFDuplex", "DuplexNoTumble")) /* EFI */
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "KD03Duplex", "DuplexNoTumble")) /* Kodak */
|
||||
conflict = 1;
|
||||
}
|
||||
else if (strcmp(options->value, "two-sided-short-edge") == 0)
|
||||
{
|
||||
if (ppdMarkOption(ppd, "Duplex", "DuplexTumble"))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "EFDuplex", "DuplexTumble")) /* EFI */
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "KD03Duplex", "DuplexTumble")) /* Kodak */
|
||||
conflict = 1;
|
||||
}
|
||||
}
|
||||
else if (strcmp(options->name, "resolution") == 0)
|
||||
{
|
||||
if (ppdMarkOption(ppd, "Resolution", options->value))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "SetResolution", options->value))
|
||||
/* Calcomp, Linotype, QMS, Summagraphics, Tektronix, Varityper */
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "JCLResolution", options->value)) /* HP */
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "CNRes_PGP", options->value)) /* Canon */
|
||||
conflict = 1;
|
||||
}
|
||||
else if (ppdMarkOption(ppd, options->name, options->value))
|
||||
conflict = 1;
|
||||
|
||||
return (conflict);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-189
@@ -1,189 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Page size functions 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.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
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdPageSize() - Get the page size record for the given size.
|
||||
* ppdPageWidth() - Get the page width for the given size.
|
||||
* ppdPageLength() - Get the page length for the given size.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "ppd.h"
|
||||
#include "string.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageSize()' - Get the page size record for the given size.
|
||||
*/
|
||||
|
||||
ppd_size_t * /* O - Size record for page or NULL */
|
||||
ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
|
||||
const char *name) /* I - Size name */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
float w, l; /* Width and length of page */
|
||||
char units[255]; /* Page size units... */
|
||||
|
||||
|
||||
if (ppd == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (name != NULL)
|
||||
{
|
||||
if (strncmp(name, "Custom.", 7) == 0 && ppd->variable_sizes)
|
||||
{
|
||||
/*
|
||||
* Find the custom page size...
|
||||
*/
|
||||
|
||||
for (i = 0; i < ppd->num_sizes; i ++)
|
||||
if (strcmp("Custom", ppd->sizes[i].name) == 0)
|
||||
break;
|
||||
|
||||
if (i == ppd->num_sizes)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Variable size; size name can be one of the following:
|
||||
*
|
||||
* Custom.WIDTHxLENGTHin - Size in inches
|
||||
* Custom.WIDTHxLENGTHcm - Size in centimeters
|
||||
* Custom.WIDTHxLENGTHmm - Size in millimeters
|
||||
* Custom.WIDTHxLENGTH[pt] - Size in points
|
||||
*/
|
||||
|
||||
units[0] = '\0';
|
||||
if (sscanf(name + 7, "%fx%f%s", &w, &l, units) < 2)
|
||||
return (NULL);
|
||||
|
||||
if (strcasecmp(units, "in") == 0)
|
||||
{
|
||||
ppd->sizes[i].width = w * 72.0;
|
||||
ppd->sizes[i].length = l * 72.0;
|
||||
ppd->sizes[i].left = ppd->custom_margins[0];
|
||||
ppd->sizes[i].bottom = ppd->custom_margins[1];
|
||||
ppd->sizes[i].right = w * 72.0 - ppd->custom_margins[2];
|
||||
ppd->sizes[i].top = l * 72.0 - ppd->custom_margins[3];
|
||||
}
|
||||
else if (strcasecmp(units, "cm") == 0)
|
||||
{
|
||||
ppd->sizes[i].width = w * 2.54 * 72.0;
|
||||
ppd->sizes[i].length = l * 2.54 * 72.0;
|
||||
ppd->sizes[i].left = ppd->custom_margins[0];
|
||||
ppd->sizes[i].bottom = ppd->custom_margins[1];
|
||||
ppd->sizes[i].right = w * 2.54 * 72.0 - ppd->custom_margins[2];
|
||||
ppd->sizes[i].top = l * 2.54 * 72.0 - ppd->custom_margins[3];
|
||||
}
|
||||
else if (strcasecmp(units, "mm") == 0)
|
||||
{
|
||||
ppd->sizes[i].width = w * 25.4 * 72.0;
|
||||
ppd->sizes[i].length = l * 25.4 * 72.0;
|
||||
ppd->sizes[i].left = ppd->custom_margins[0];
|
||||
ppd->sizes[i].bottom = ppd->custom_margins[1];
|
||||
ppd->sizes[i].right = w * 25.4 * 72.0 - ppd->custom_margins[2];
|
||||
ppd->sizes[i].top = l * 25.4 * 72.0 - ppd->custom_margins[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
ppd->sizes[i].width = w;
|
||||
ppd->sizes[i].length = l;
|
||||
ppd->sizes[i].left = ppd->custom_margins[0];
|
||||
ppd->sizes[i].bottom = ppd->custom_margins[1];
|
||||
ppd->sizes[i].right = w - ppd->custom_margins[2];
|
||||
ppd->sizes[i].top = l - ppd->custom_margins[3];
|
||||
}
|
||||
|
||||
return (ppd->sizes + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Lookup by name...
|
||||
*/
|
||||
|
||||
for (i = 0; i < ppd->num_sizes; i ++)
|
||||
if (strcmp(name, ppd->sizes[i].name) == 0)
|
||||
return (ppd->sizes + i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Find default...
|
||||
*/
|
||||
|
||||
for (i = 0; i < ppd->num_sizes; i ++)
|
||||
if (ppd->sizes[i].marked)
|
||||
return (ppd->sizes + i);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageWidth()' - Get the page width for the given size.
|
||||
*/
|
||||
|
||||
float /* O - Width of page in points or 0.0 */
|
||||
ppdPageWidth(ppd_file_t *ppd, /* I - PPD file record */
|
||||
const char *name) /* I - Size name */
|
||||
{
|
||||
ppd_size_t *size; /* Page size */
|
||||
|
||||
|
||||
if ((size = ppdPageSize(ppd, name)) == NULL)
|
||||
return (0.0);
|
||||
else
|
||||
return (size->width);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageLength()' - Get the page length for the given size.
|
||||
*/
|
||||
|
||||
float /* O - Length of page in points or 0.0 */
|
||||
ppdPageLength(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *name) /* I - Size name */
|
||||
{
|
||||
ppd_size_t *size; /* Page size */
|
||||
|
||||
|
||||
if ((size = ppdPageSize(ppd, name)) == NULL)
|
||||
return (0.0);
|
||||
else
|
||||
return (size->length);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1814
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-239
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PostScript Printer Description definitions 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.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
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PPD_H_
|
||||
# define _CUPS_PPD_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* PPD version...
|
||||
*/
|
||||
|
||||
# define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef enum /**** UI types ****/
|
||||
{
|
||||
PPD_UI_BOOLEAN, /* True or False option */
|
||||
PPD_UI_PICKONE, /* Pick one from a list */
|
||||
PPD_UI_PICKMANY /* Pick zero or more from a list */
|
||||
} ppd_ui_t;
|
||||
|
||||
typedef enum /**** Order dependency sections ****/
|
||||
{
|
||||
PPD_ORDER_ANY, /* Option code can be anywhere in the file */
|
||||
PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */
|
||||
PPD_ORDER_EXIT, /* ... must be sent prior to the document */
|
||||
PPD_ORDER_JCL, /* ... must be sent as a JCL command */
|
||||
PPD_ORDER_PAGE, /* ... must be in the PageSetup section */
|
||||
PPD_ORDER_PROLOG /* ... must be in the Prolog section */
|
||||
} ppd_section_t;
|
||||
|
||||
typedef enum /**** Colorspaces ****/
|
||||
{
|
||||
PPD_CS_CMYK = -4, /* CMYK colorspace */
|
||||
PPD_CS_CMY, /* CMY colorspace */
|
||||
PPD_CS_GRAY = 1, /* Grayscale colorspace */
|
||||
PPD_CS_RGB = 3, /* RGB colorspace */
|
||||
PPD_CS_RGBK, /* RGBK (K = gray) colorspace */
|
||||
PPD_CS_N /* DeviceN colorspace */
|
||||
} ppd_cs_t;
|
||||
|
||||
typedef struct /**** Option choices ****/
|
||||
{
|
||||
char marked, /* 0 if not selected, 1 otherwise */
|
||||
choice[41], /* Computer-readable option name */
|
||||
text[81], /* Human-readable option name */
|
||||
*code; /* Code to send for this option */
|
||||
void *option; /* Pointer to parent option structure */
|
||||
} ppd_choice_t;
|
||||
|
||||
typedef struct /**** Options ****/
|
||||
{
|
||||
char conflicted, /* 0 if no conflicts exist, 1 otherwise */
|
||||
keyword[41], /* Option keyword name ("PageSize", etc.) */
|
||||
defchoice[41], /* Default option choice */
|
||||
text[81]; /* Human-readable text */
|
||||
ppd_ui_t ui; /* Type of UI option */
|
||||
ppd_section_t section; /* Section for command */
|
||||
float order; /* Order number */
|
||||
int num_choices; /* Number of option choices */
|
||||
ppd_choice_t *choices; /* Option choices */
|
||||
} ppd_option_t;
|
||||
|
||||
typedef struct ppd_group_str /**** Groups ****/
|
||||
{
|
||||
char text[81]; /* Human-readable group name */
|
||||
int num_options; /* Number of options */
|
||||
ppd_option_t *options; /* Options */
|
||||
int num_subgroups; /* Number of sub-groups */
|
||||
struct ppd_group_str *subgroups;
|
||||
/* Sub-groups (max depth = 1) */
|
||||
} ppd_group_t;
|
||||
|
||||
typedef struct /**** Constraints ****/
|
||||
{
|
||||
char option1[41], /* First keyword */
|
||||
choice1[41], /* First option/choice (blank for all) */
|
||||
option2[41], /* Second keyword */
|
||||
choice2[41]; /* Second option/choice (blank for all) */
|
||||
} ppd_const_t;
|
||||
|
||||
typedef struct /**** Page Sizes ****/
|
||||
{
|
||||
int marked; /* Page size selected? */
|
||||
char name[41]; /* Media size option */
|
||||
float width, /* Width of media in points */
|
||||
length, /* Length of media in points */
|
||||
left, /* Left printable margin in points */
|
||||
bottom, /* Bottom printable margin in points */
|
||||
right, /* Right printable margin in points */
|
||||
top; /* Top printable margin in points */
|
||||
} ppd_size_t;
|
||||
|
||||
typedef struct /**** Emulators ****/
|
||||
{
|
||||
char name[41], /* Emulator name */
|
||||
*start, /* Code to switch to this emulation */
|
||||
*stop; /* Code to stop this emulation */
|
||||
} ppd_emul_t;
|
||||
|
||||
typedef struct /**** sRGB Color Profiles ****/
|
||||
{
|
||||
char resolution[41], /* Resolution or "-" */
|
||||
media_type[41]; /* Media type of "-" */
|
||||
float density, /* Ink density to use */
|
||||
gamma, /* Gamma correction to use */
|
||||
matrix[3][3]; /* Transform matrix */
|
||||
} ppd_profile_t;
|
||||
|
||||
typedef struct /**** Files ****/
|
||||
{
|
||||
int language_level, /* Language level of device */
|
||||
color_device, /* 1 = color device, 0 = grayscale */
|
||||
variable_sizes, /* 1 = supports variable sizes, 0 = doesn't */
|
||||
accurate_screens,/* 1 = supports accurate screens, 0 = not */
|
||||
contone_only, /* 1 = continuous tone only, 0 = not */
|
||||
landscape, /* -90 or 90 */
|
||||
model_number, /* Device-specific model number */
|
||||
manual_copies; /* 1 = Copies done manually, 0 = hardware */
|
||||
ppd_cs_t colorspace; /* Default colorspace */
|
||||
char *patches; /* Patch commands to be sent to printer */
|
||||
int num_emulations; /* Number of emulations supported */
|
||||
ppd_emul_t *emulations; /* Emulations and the code to invoke them */
|
||||
char *jcl_begin, /* Start JCL commands */
|
||||
*jcl_ps, /* Enter PostScript interpreter */
|
||||
*jcl_end, /* End JCL commands */
|
||||
*lang_encoding, /* Language encoding */
|
||||
*lang_version, /* Language version (English, Spanish, etc.) */
|
||||
*modelname, /* Model name (general) */
|
||||
*ttrasterizer, /* Truetype rasterizer */
|
||||
*manufacturer, /* Manufacturer name */
|
||||
*product, /* Product name (from PS RIP/interpreter) */
|
||||
*nickname, /* Nickname (specific) */
|
||||
*shortnickname; /* Short version of nickname */
|
||||
int num_groups; /* Number of UI groups */
|
||||
ppd_group_t *groups; /* UI groups */
|
||||
int num_sizes; /* Number of page sizes */
|
||||
ppd_size_t *sizes; /* Page sizes */
|
||||
float custom_min[2], /* Minimum variable page size */
|
||||
custom_max[2], /* Maximum variable page size */
|
||||
custom_margins[4];/* Margins around page */
|
||||
int num_consts; /* Number of UI/Non-UI constraints */
|
||||
ppd_const_t *consts; /* UI/Non-UI constraints */
|
||||
int num_fonts; /* Number of pre-loaded fonts */
|
||||
char **fonts; /* Pre-loaded fonts */
|
||||
int num_profiles; /* Number of sRGB color profiles */
|
||||
ppd_profile_t *profiles; /* sRGB color profiles */
|
||||
int num_filters; /* Number of filters */
|
||||
char **filters; /* Filter strings... */
|
||||
} ppd_file_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void ppdClose(ppd_file_t *ppd);
|
||||
extern int ppdConflicts(ppd_file_t *ppd);
|
||||
extern int ppdEmit(ppd_file_t *ppd, FILE *fp,
|
||||
ppd_section_t section);
|
||||
extern int ppdEmitFd(ppd_file_t *ppd, int fd,
|
||||
ppd_section_t section);
|
||||
extern int ppdIsMarked(ppd_file_t *ppd, const char *keyword,
|
||||
const char *option);
|
||||
extern void ppdMarkDefaults(ppd_file_t *ppd);
|
||||
extern int ppdMarkOption(ppd_file_t *ppd, const char *keyword,
|
||||
const char *option);
|
||||
extern ppd_choice_t *ppdFindChoice(ppd_option_t *o, const char *option);
|
||||
extern ppd_choice_t *ppdFindMarkedChoice(ppd_file_t *ppd, const char *keyword);
|
||||
extern ppd_option_t *ppdFindOption(ppd_file_t *ppd, const char *keyword);
|
||||
extern ppd_file_t *ppdOpen(FILE *fp);
|
||||
extern ppd_file_t *ppdOpenFd(int fd);
|
||||
extern ppd_file_t *ppdOpenFile(const char *filename);
|
||||
extern float ppdPageLength(ppd_file_t *ppd, const char *name);
|
||||
extern ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name);
|
||||
extern float ppdPageWidth(ppd_file_t *ppd, const char *name);
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_PPD_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-252
@@ -1,252 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Raster file routines 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 for the CUPS Raster source
|
||||
* files are outlined in the GNU Library General Public License, located
|
||||
* in the "pstoraster" directory. 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
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsRasterClose() - Close a raster stream.
|
||||
* cupsRasterOpen() - Open a raster stream.
|
||||
* cupsRasterReadHeader() - Read a raster page header.
|
||||
* cupsRasterReadPixels() - Read raster pixels.
|
||||
* cupsRasterWriteHeader() - Write a raster page header.
|
||||
* cupsRasterWritePixels() - Write raster pixels.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "raster.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsRasterClose()' - Close a raster stream.
|
||||
*/
|
||||
|
||||
void
|
||||
cupsRasterClose(cups_raster_t *r) /* I - Stream to close */
|
||||
{
|
||||
if (r != NULL)
|
||||
free(r);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsRasterOpen()' - Open a raster stream.
|
||||
*/
|
||||
|
||||
cups_raster_t * /* O - New stream */
|
||||
cupsRasterOpen(int fd, /* I - File descriptor */
|
||||
cups_mode_t mode) /* I - Mode */
|
||||
{
|
||||
cups_raster_t *r; /* New stream */
|
||||
|
||||
|
||||
if ((r = calloc(sizeof(cups_raster_t), 1)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
r->fd = fd;
|
||||
r->mode = mode;
|
||||
|
||||
if (mode == CUPS_RASTER_READ)
|
||||
{
|
||||
/*
|
||||
* Open for read - get sync word...
|
||||
*/
|
||||
|
||||
if (read(fd, &(r->sync), sizeof(r->sync)) < sizeof(r->sync))
|
||||
{
|
||||
free(r);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (r->sync != CUPS_RASTER_SYNC &&
|
||||
r->sync != CUPS_RASTER_REVSYNC)
|
||||
{
|
||||
free(r);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Open for write - put sync word...
|
||||
*/
|
||||
|
||||
r->sync = CUPS_RASTER_SYNC;
|
||||
if (write(fd, &(r->sync), sizeof(r->sync)) < sizeof(r->sync))
|
||||
{
|
||||
free(r);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsRasterReadHeader()' - Read a raster page header.
|
||||
*/
|
||||
|
||||
unsigned /* O - 1 on success, 0 on fail */
|
||||
cupsRasterReadHeader(cups_raster_t *r, /* I - Raster stream */
|
||||
cups_page_header_t *h) /* I - Pointer to header data */
|
||||
{
|
||||
int len; /* Number of words to swap */
|
||||
union swap_s /* Swapping structure */
|
||||
{
|
||||
unsigned char b[4];
|
||||
unsigned v;
|
||||
} *s;
|
||||
|
||||
|
||||
if (r == NULL || r->mode != CUPS_RASTER_READ)
|
||||
return (0);
|
||||
|
||||
if (cupsRasterReadPixels(r, (unsigned char *)h, sizeof(cups_page_header_t)) <
|
||||
sizeof(cups_page_header_t))
|
||||
return (0);
|
||||
|
||||
if (r->sync == CUPS_RASTER_REVSYNC)
|
||||
for (len = (sizeof(cups_page_header_t) - 256) / 4,
|
||||
s = (union swap_s *)&(h->AdvanceDistance);
|
||||
len > 0;
|
||||
len --, s ++)
|
||||
s->v = (((((s->b[3] << 8) | s->b[2]) << 8) | s->b[1]) << 8) | s->b[0];
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsRasterReadPixels()' - Read raster pixels.
|
||||
*/
|
||||
|
||||
unsigned /* O - Number of bytes read */
|
||||
cupsRasterReadPixels(cups_raster_t *r, /* I - Raster stream */
|
||||
unsigned char *p, /* I - Pointer to pixel buffer */
|
||||
unsigned len) /* I - Number of bytes to read */
|
||||
{
|
||||
int bytes; /* Bytes read */
|
||||
unsigned remaining; /* Bytes remaining */
|
||||
|
||||
|
||||
if (r == NULL || r->mode != CUPS_RASTER_READ)
|
||||
return (0);
|
||||
|
||||
remaining = len;
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
bytes = read(r->fd, p, remaining);
|
||||
|
||||
if (bytes <= 0)
|
||||
{
|
||||
if (errno != EAGAIN && errno != EINTR)
|
||||
return (0);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
remaining -= bytes;
|
||||
p += bytes;
|
||||
}
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsRasterWriteHeader()' - Write a raster page header.
|
||||
*/
|
||||
|
||||
unsigned
|
||||
cupsRasterWriteHeader(cups_raster_t *r,
|
||||
cups_page_header_t *h)
|
||||
{
|
||||
if (r == NULL || r->mode != CUPS_RASTER_WRITE)
|
||||
return (0);
|
||||
|
||||
return (cupsRasterWritePixels(r, (unsigned char *)h,
|
||||
sizeof(cups_page_header_t)) ==
|
||||
sizeof(cups_page_header_t));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsRasterWritePixels()' - Write raster pixels.
|
||||
*/
|
||||
|
||||
unsigned /* O - Number of bytes written */
|
||||
cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
|
||||
unsigned char *p, /* I - Bytes to write */
|
||||
unsigned len)/* I - Number of bytes to write */
|
||||
{
|
||||
int bytes; /* Bytes read */
|
||||
unsigned remaining; /* Bytes remaining */
|
||||
|
||||
|
||||
if (r == NULL || r->mode != CUPS_RASTER_WRITE)
|
||||
return (0);
|
||||
|
||||
remaining = len;
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
bytes = write(r->fd, p, remaining);
|
||||
|
||||
if (bytes <= 0)
|
||||
{
|
||||
if (errno != EAGAIN && errno != EINTR)
|
||||
return (0);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
remaining -= bytes;
|
||||
p += bytes;
|
||||
}
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-233
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Raster file definitions 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 for the CUPS Raster source
|
||||
* files are outlined in the GNU Library General Public License, located
|
||||
* in the "pstoraster" directory. 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
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_RASTER_H_
|
||||
# define _CUPS_RASTER_H_
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Every non-PostScript printer driver that supports raster images should
|
||||
* use the application/vnd.cups-raster image file format. Since both the
|
||||
* PostScript RIP (pstoraster, based on GNU Ghostscript 4.03) and Image RIP
|
||||
* (imagetoraster, located in the filter directory) use it, using this format
|
||||
* saves you a lot of work. Also, the PostScript RIP passes any printer
|
||||
* options that are in a PS file to your driver this way as well...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_RASTER_SYNC 0x52615374 /* RaSt */
|
||||
# define CUPS_RASTER_REVSYNC 0x74536152 /* tSaR */
|
||||
|
||||
|
||||
/*
|
||||
* Types...
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_RASTER_READ, /* Open stream for reading */
|
||||
CUPS_RASTER_WRITE /* Open stream for writing */
|
||||
} cups_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_FALSE, /* Logical false */
|
||||
CUPS_TRUE /* Logical true */
|
||||
} cups_bool_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_JOG_NONE, /* Never move pages */
|
||||
CUPS_JOG_FILE, /* Move pages after this file */
|
||||
CUPS_JOG_JOB, /* Move pages after this job */
|
||||
CUPS_JOG_SET /* Move pages after this set */
|
||||
} cups_jog_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_ORIENT_0, /* Don't rotate the page */
|
||||
CUPS_ORIENT_90, /* Rotate the page counter-clockwise */
|
||||
CUPS_ORIENT_180, /* Turn the page upside down */
|
||||
CUPS_ORIENT_270 /* Rotate the page clockwise */
|
||||
} cups_orient_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_CUT_NONE, /* Never cut the roll */
|
||||
CUPS_CUT_FILE, /* Cut the roll after this file */
|
||||
CUPS_CUT_JOB, /* Cut the roll after this job */
|
||||
CUPS_CUT_SET, /* Cut the roll after this set */
|
||||
CUPS_CUT_PAGE /* Cut the roll after this page */
|
||||
} cups_cut_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_ADVANCE_NONE, /* Never advance the roll */
|
||||
CUPS_ADVANCE_FILE, /* Advance the roll after this file */
|
||||
CUPS_ADVANCE_JOB, /* Advance the roll after this job */
|
||||
CUPS_ADVANCE_SET, /* Advance the roll after this set */
|
||||
CUPS_ADVANCE_PAGE /* Advance the roll after this page */
|
||||
} cups_adv_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_EDGE_TOP, /* Leading edge is the top of the page */
|
||||
CUPS_EDGE_RIGHT, /* Leading edge is the right of the page */
|
||||
CUPS_EDGE_BOTTOM, /* Leading edge is the bottom of the page */
|
||||
CUPS_EDGE_LEFT /* Leading edge is the left of the page */
|
||||
} cups_edge_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_ORDER_CHUNKED, /* CMYK CMYK CMYK ... */
|
||||
CUPS_ORDER_BANDED, /* CCC MMM YYY KKK ... */
|
||||
CUPS_ORDER_PLANAR /* CCC ... MMM ... YYY ... KKK ... */
|
||||
} cups_order_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUPS_CSPACE_W, /* Luminance */
|
||||
CUPS_CSPACE_RGB, /* Red, green, blue */
|
||||
CUPS_CSPACE_RGBA, /* Red, green, blue, alpha */
|
||||
CUPS_CSPACE_K, /* Black */
|
||||
CUPS_CSPACE_CMY, /* Cyan, magenta, yellow */
|
||||
CUPS_CSPACE_YMC, /* Yellow, magenta, cyan */
|
||||
CUPS_CSPACE_CMYK, /* Cyan, magenta, yellow, black */
|
||||
CUPS_CSPACE_YMCK, /* Yellow, magenta, cyan, black */
|
||||
CUPS_CSPACE_KCMY, /* Black, cyan, magenta, yellow */
|
||||
CUPS_CSPACE_KCMYcm, /* Black, cyan, magenta, yellow, *
|
||||
* light-cyan, light-magenta */
|
||||
CUPS_CSPACE_GMCK, /* Gold, magenta, yellow, black */
|
||||
CUPS_CSPACE_GMCS, /* Gold, magenta, yellow, silver */
|
||||
CUPS_CSPACE_WHITE, /* White ink (as black) */
|
||||
CUPS_CSPACE_GOLD, /* Gold foil */
|
||||
CUPS_CSPACE_SILVER /* Silver foil */
|
||||
} cups_cspace_t;
|
||||
|
||||
|
||||
/*
|
||||
* The page header structure contains the standard PostScript page device
|
||||
* dictionary, along with some CUPS-specific parameters that are provided
|
||||
* by the RIPs...
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**** Standard Page Device Dictionary String Values ****/
|
||||
char MediaClass[64]; /* MediaClass string */
|
||||
char MediaColor[64]; /* MediaColor string */
|
||||
char MediaType[64]; /* MediaType string */
|
||||
char OutputType[64]; /* OutputType string */
|
||||
|
||||
/**** Standard Page Device Dictionary Integer Values ****/
|
||||
unsigned AdvanceDistance; /* AdvanceDistance value in points */
|
||||
cups_adv_t AdvanceMedia; /* AdvanceMedia value (see above) */
|
||||
cups_bool_t Collate; /* Collated copies value */
|
||||
cups_cut_t CutMedia; /* CutMedia value (see above) */
|
||||
cups_bool_t Duplex; /* Duplexed (double-sided) value */
|
||||
unsigned HWResolution[2]; /* Resolution in dots-per-inch */
|
||||
unsigned ImagingBoundingBox[4]; /* Pixel region that is painted (points) */
|
||||
cups_bool_t InsertSheet; /* InsertSheet value */
|
||||
cups_jog_t Jog; /* Jog value (see above) */
|
||||
cups_edge_t LeadingEdge; /* LeadingEdge value (see above) */
|
||||
unsigned Margins[2]; /* Lower-lefthand margins in points */
|
||||
cups_bool_t ManualFeed; /* ManualFeed value */
|
||||
unsigned MediaPosition; /* MediaPosition value */
|
||||
unsigned MediaWeight; /* MediaWeight value in grams/m^2 */
|
||||
cups_bool_t MirrorPrint; /* MirrorPrint value */
|
||||
cups_bool_t NegativePrint; /* NegativePrint value */
|
||||
unsigned NumCopies; /* Number of copies to produce */
|
||||
cups_orient_t Orientation; /* Orientation value (see above) */
|
||||
cups_bool_t OutputFaceUp; /* OutputFaceUp value */
|
||||
unsigned PageSize[2]; /* Width and length of page in points */
|
||||
cups_bool_t Separations; /* Separations value */
|
||||
cups_bool_t TraySwitch; /* TraySwitch value */
|
||||
cups_bool_t Tumble; /* Tumble value */
|
||||
|
||||
/**** CUPS Page Device Dictionary Values ****/
|
||||
unsigned cupsWidth; /* Width of page image in pixels */
|
||||
unsigned cupsHeight; /* Height of page image in pixels */
|
||||
unsigned cupsMediaType; /* Media type code */
|
||||
unsigned cupsBitsPerColor; /* Number of bits for each color */
|
||||
unsigned cupsBitsPerPixel; /* Number of bits for each pixel */
|
||||
unsigned cupsBytesPerLine; /* Number of bytes per line */
|
||||
cups_order_t cupsColorOrder; /* Order of colors */
|
||||
cups_cspace_t cupsColorSpace; /* True colorspace */
|
||||
unsigned cupsCompression; /* Device compression to use */
|
||||
unsigned cupsRowCount; /* Rows per band */
|
||||
unsigned cupsRowFeed; /* Feed between bands */
|
||||
unsigned cupsRowStep; /* Spacing between lines */
|
||||
} cups_page_header_t;
|
||||
|
||||
|
||||
/*
|
||||
* The raster structure maintains information about a raster data
|
||||
* stream...
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned sync; /* Sync word from start of stream */
|
||||
int fd; /* File descriptor */
|
||||
cups_mode_t mode; /* Read/write mode */
|
||||
} cups_raster_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void cupsRasterClose(cups_raster_t *r);
|
||||
extern cups_raster_t *cupsRasterOpen(int fd, cups_mode_t mode);
|
||||
extern unsigned cupsRasterReadHeader(cups_raster_t *r,
|
||||
cups_page_header_t *h);
|
||||
extern unsigned cupsRasterReadPixels(cups_raster_t *r,
|
||||
unsigned char *p, unsigned len);
|
||||
extern unsigned cupsRasterWriteHeader(cups_raster_t *r,
|
||||
cups_page_header_t *h);
|
||||
extern unsigned cupsRasterWritePixels(cups_raster_t *r,
|
||||
unsigned char *p, unsigned len);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_RASTER_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* String 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:
|
||||
*
|
||||
* strdup() - Duplicate a string.
|
||||
* strcasecmp() - Do a case-insensitive comparison.
|
||||
* strncasecmp() - Do a case-insensitive comparison on up to N chars.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "string.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'strdup()' - Duplicate a string.
|
||||
*/
|
||||
|
||||
# ifndef HAVE_STRDUP
|
||||
char * /* O - New string pointer */
|
||||
strdup(const char *s) /* I - String to duplicate */
|
||||
{
|
||||
char *t; /* New string pointer */
|
||||
|
||||
|
||||
if (s == NULL)
|
||||
return (NULL);
|
||||
|
||||
if ((t = malloc(strlen(s) + 1)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
return (strcpy(t, s));
|
||||
}
|
||||
# endif /* !HAVE_STRDUP */
|
||||
|
||||
|
||||
/*
|
||||
* 'strcasecmp()' - Do a case-insensitive comparison.
|
||||
*/
|
||||
|
||||
# ifndef HAVE_STRCASECMP
|
||||
int /* O - Result of comparison (-1, 0, or 1) */
|
||||
strcasecmp(const char *s, /* I - First string */
|
||||
const char *t) /* I - Second string */
|
||||
{
|
||||
while (*s != '\0' && *t != '\0')
|
||||
{
|
||||
if (tolower(*s) < tolower(*t))
|
||||
return (-1);
|
||||
else if (tolower(*s) > tolower(*t))
|
||||
return (1);
|
||||
|
||||
s ++;
|
||||
t ++;
|
||||
}
|
||||
|
||||
if (*s == '\0' && *t == '\0')
|
||||
return (0);
|
||||
else if (*s != '\0')
|
||||
return (1);
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
# endif /* !HAVE_STRCASECMP */
|
||||
|
||||
/*
|
||||
* 'strncasecmp()' - Do a case-insensitive comparison on up to N chars.
|
||||
*/
|
||||
|
||||
# ifndef HAVE_STRNCASECMP
|
||||
int /* O - Result of comparison (-1, 0, or 1) */
|
||||
strncasecmp(const char *s, /* I - First string */
|
||||
const char *t, /* I - Second string */
|
||||
size_t n) /* I - Maximum number of characters to compare */
|
||||
{
|
||||
while (*s != '\0' && *t != '\0' && n > 0)
|
||||
{
|
||||
if (tolower(*s) < tolower(*t))
|
||||
return (-1);
|
||||
else if (tolower(*s) > tolower(*t))
|
||||
return (1);
|
||||
|
||||
s ++;
|
||||
t ++;
|
||||
n --;
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
return (0);
|
||||
else if (*s == '\0' && *t == '\0')
|
||||
return (0);
|
||||
else if (*s != '\0')
|
||||
return (1);
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
# endif /* !HAVE_STRNCASECMP */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* String definitions 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
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_STRING_H_
|
||||
# define _CUPS_STRING_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <config.h>
|
||||
# include <string.h>
|
||||
|
||||
|
||||
/*
|
||||
* Stuff for WIN32 and OS/2...
|
||||
*/
|
||||
|
||||
# if defined(WIN32) || defined(__EMX__)
|
||||
# define strcasecmp stricmp
|
||||
# define strncasecmp strnicmp
|
||||
# endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
# ifndef HAVE_STRDUP
|
||||
extern char *strdup(const char *);
|
||||
# endif /* !HAVE_STRDUP */
|
||||
|
||||
# ifndef HAVE_STRCASECMP
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
# endif /* !HAVE_STRCASECMP */
|
||||
|
||||
# ifndef HAVE_STRNCASECMP
|
||||
extern int strncasecmp(const char *, const char *, size_t n);
|
||||
# endif /* !HAVE_STRNCASECMP */
|
||||
|
||||
#endif /* !_CUPS_STRING_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTTP test program 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:
|
||||
*
|
||||
* main() - Main entry.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "http.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
http_t *http; /* HTTP connection */
|
||||
http_status_t status; /* Status of GET command */
|
||||
char buffer[1024]; /* Input buffer */
|
||||
int bytes; /* Number of bytes read */
|
||||
FILE *out; /* Output file */
|
||||
|
||||
#define HOST "dns.easysw.com"
|
||||
#define PORT 80
|
||||
|
||||
puts("Connecting to " HOST "...");
|
||||
|
||||
httpInitialize();
|
||||
http = httpConnect(HOST, PORT);
|
||||
if (http == NULL)
|
||||
{
|
||||
puts("Unable to connect to " HOST "!");
|
||||
return (1);
|
||||
}
|
||||
|
||||
puts("Connected to " HOST "...");
|
||||
|
||||
out = stdout;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if (strcmp(argv[i], "-o") == 0)
|
||||
{
|
||||
i ++;
|
||||
out = fopen(argv[i], "wb");
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("Requesting file \"%s\"...\n", argv[i]);
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
|
||||
httpGet(http, argv[i]);
|
||||
status = httpUpdate(http);
|
||||
|
||||
if (status == HTTP_OK)
|
||||
puts("GET OK:");
|
||||
else
|
||||
printf("GET failed with status %d...\n", status);
|
||||
|
||||
while ((bytes = httpRead(http, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
fwrite(buffer, bytes, 1, out);
|
||||
if (out != stdout)
|
||||
printf("Read %d bytes, %d total...\n", bytes, ftell(out));
|
||||
}
|
||||
}
|
||||
|
||||
puts("Closing connection to server...");
|
||||
httpClose(http);
|
||||
|
||||
if (out != stdout)
|
||||
fclose(out);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* MIME 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.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:
|
||||
*
|
||||
* main() - Main entry for the test program.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "mime.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void print_rules(mime_magic_t *rules);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for the test program.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line args */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char super[MIME_MAX_SUPER], /* Super-type name */
|
||||
type[MIME_MAX_TYPE]; /* Type name */
|
||||
mime_t *mime; /* MIME database */
|
||||
mime_type_t *src, /* Source type */
|
||||
*dst, /* Destination type */
|
||||
**types; /* File type array pointer */
|
||||
mime_filter_t *filters; /* Filters for the file */
|
||||
int num_filters; /* Number of filters for the file */
|
||||
|
||||
|
||||
mime = mimeLoad("../conf");
|
||||
|
||||
puts("MIME database types:");
|
||||
for (i = 0, types = mime->types; i < mime->num_types; i ++, types ++)
|
||||
{
|
||||
printf("\t%s/%s: ", (*types)->super, (*types)->type);
|
||||
print_rules((*types)->rules);
|
||||
puts("");
|
||||
}
|
||||
|
||||
puts("");
|
||||
|
||||
puts("MIME database filters:");
|
||||
for (i = 0, filters = mime->filters; i < mime->num_filters; i ++, filters ++)
|
||||
printf("\t%s/%s to %s/%s: %s (%d)\n",
|
||||
filters->src->super, filters->src->type,
|
||||
filters->dst->super, filters->dst->type,
|
||||
filters->filter, filters->cost);
|
||||
|
||||
puts("");
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
default :
|
||||
fputs("Usage: testmime source-file [destination-type]\n", stderr);
|
||||
return (1);
|
||||
|
||||
case 2 :
|
||||
src = mimeFileType(mime, argv[1]);
|
||||
|
||||
if (src != NULL)
|
||||
{
|
||||
printf("%s: %s/%s\n", argv[1], src->super, src->type);
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s: unknown\n", argv[1]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
case 3 :
|
||||
src = mimeFileType(mime, argv[1]);
|
||||
|
||||
sscanf(argv[2], "%[^/]/%s", super, type);
|
||||
dst = mimeType(mime, super, type);
|
||||
|
||||
filters = mimeFilter(mime, src, dst, &num_filters);
|
||||
|
||||
if (filters == NULL)
|
||||
{
|
||||
printf("No filters to convert from %s to %s.\n", argv[1], argv[2]);
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < num_filters; i ++)
|
||||
if (i < (num_filters - 1))
|
||||
printf("%s | ", filters[i].filter);
|
||||
else
|
||||
puts(filters[i].filter);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'print_rules()' - Print the rules for a file type...
|
||||
*/
|
||||
|
||||
static void
|
||||
print_rules(mime_magic_t *rules) /* I - Rules to print */
|
||||
{
|
||||
char logic; /* Logic separator */
|
||||
|
||||
|
||||
if (rules == NULL)
|
||||
return;
|
||||
|
||||
if (rules->parent == NULL ||
|
||||
rules->parent->op == MIME_MAGIC_OR)
|
||||
logic = ',';
|
||||
else
|
||||
logic = '+';
|
||||
|
||||
while (rules != NULL)
|
||||
{
|
||||
if (rules->prev != NULL)
|
||||
putchar(logic);
|
||||
|
||||
switch (rules->op)
|
||||
{
|
||||
case MIME_MAGIC_MATCH :
|
||||
printf("match(%s)", rules->value.matchv);
|
||||
break;
|
||||
case MIME_MAGIC_LOCALE :
|
||||
printf("locale(%s)", rules->value.localev);
|
||||
break;
|
||||
case MIME_MAGIC_ASCII :
|
||||
printf("ascii(%d,%d)", rules->offset, rules->length);
|
||||
break;
|
||||
case MIME_MAGIC_PRINTABLE :
|
||||
printf("printable(%d,%d)", rules->offset, rules->length);
|
||||
break;
|
||||
case MIME_MAGIC_STRING :
|
||||
printf("string(%d,%s)", rules->offset, rules->value.stringv);
|
||||
break;
|
||||
case MIME_MAGIC_CHAR :
|
||||
printf("char(%d,%d)", rules->offset, rules->value.charv);
|
||||
break;
|
||||
case MIME_MAGIC_SHORT :
|
||||
printf("short(%d,%d)", rules->offset, rules->value.shortv);
|
||||
break;
|
||||
case MIME_MAGIC_INT :
|
||||
printf("int(%d,%d)", rules->offset, rules->value.intv);
|
||||
break;
|
||||
default :
|
||||
if (rules->child != NULL)
|
||||
{
|
||||
putchar('(');
|
||||
print_rules(rules->child);
|
||||
putchar(')');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
rules = rules->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,102 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="testmime" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=testmime - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "testmime.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "testmime.mak" CFG="testmime - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "testmime - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "testmime - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "testmime - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 cups.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"testmime.exe"
|
||||
|
||||
!ELSEIF "$(CFG)" == "testmime - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "testmime___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "testmime___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 cupsd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"testmimed.exe" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "testmime - Win32 Release"
|
||||
# Name "testmime - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\testmime.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mime.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PPD 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.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
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for test program.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for test program.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i, j, k, m, n; /* Looping vars */
|
||||
const char *filename; /* File to load */
|
||||
ppd_file_t *ppd; /* PPD file record */
|
||||
ppd_size_t *size; /* Size record */
|
||||
ppd_group_t *group; /* UI group */
|
||||
ppd_option_t *option; /* Standard UI option */
|
||||
ppd_choice_t *choice; /* Standard UI option choice */
|
||||
static char *uis[] = { "BOOLEAN", "PICKONE", "PICKMANY" };
|
||||
static char *sections[] = { "ANY", "DOCUMENT", "EXIT",
|
||||
"JCL", "PAGE", "PROLOG" };
|
||||
|
||||
|
||||
/*
|
||||
* Display PPD files for each file listed on the command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
fputs("Usage: ppdtest filename1.ppd [... filenameN.ppd]\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if (strstr(argv[i], ".ppd"))
|
||||
filename = argv[i];
|
||||
else
|
||||
filename = cupsGetPPD(argv[i]);
|
||||
|
||||
if ((ppd = ppdOpenFile(filename)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Unable to open \'%s\' as a PPD file!\n", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("FILE: %s\n", filename);
|
||||
printf(" language_level = %d\n", ppd->language_level);
|
||||
printf(" color_device = %s\n", ppd->color_device ? "TRUE" : "FALSE");
|
||||
printf(" variable_sizes = %s\n", ppd->variable_sizes ? "TRUE" : "FALSE");
|
||||
printf(" landscape = %d\n", ppd->landscape);
|
||||
|
||||
switch (ppd->colorspace)
|
||||
{
|
||||
case PPD_CS_CMYK :
|
||||
puts(" colorspace = PPD_CS_CMYK");
|
||||
break;
|
||||
case PPD_CS_CMY :
|
||||
puts(" colorspace = PPD_CS_CMY");
|
||||
break;
|
||||
case PPD_CS_GRAY :
|
||||
puts(" colorspace = PPD_CS_GRAY");
|
||||
break;
|
||||
case PPD_CS_RGB :
|
||||
puts(" colorspace = PPD_CS_RGB");
|
||||
break;
|
||||
default :
|
||||
puts(" colorspace = <unknown>");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" num_emulations = %d\n", ppd->num_emulations);
|
||||
for (j = 0; j < ppd->num_emulations; j ++)
|
||||
printf(" emulations[%d] = %s\n", j, ppd->emulations[j].name);
|
||||
|
||||
printf(" lang_encoding = %s\n", ppd->lang_encoding);
|
||||
printf(" lang_version = %s\n", ppd->lang_version);
|
||||
printf(" modelname = %s\n", ppd->modelname);
|
||||
printf(" ttrasterizer = %s\n",
|
||||
ppd->ttrasterizer == NULL ? "None" : ppd->ttrasterizer);
|
||||
printf(" manufacturer = %s\n", ppd->manufacturer);
|
||||
printf(" product = %s\n", ppd->product);
|
||||
printf(" nickname = %s\n", ppd->nickname);
|
||||
printf(" shortnickname = %s\n", ppd->shortnickname);
|
||||
printf(" patches = %d bytes\n",
|
||||
ppd->patches == NULL ? 0 : strlen(ppd->patches));
|
||||
|
||||
printf(" num_groups = %d\n", ppd->num_groups);
|
||||
for (j = 0, group = ppd->groups; j < ppd->num_groups; j ++, group ++)
|
||||
{
|
||||
printf(" group[%d] = %s\n", j, group->text);
|
||||
|
||||
for (k = 0, option = group->options; k < group->num_options; k ++, option ++)
|
||||
{
|
||||
printf(" options[%d] = %s (%s) %s %s %.0f\n", k,
|
||||
option->keyword, option->text, uis[option->ui],
|
||||
sections[option->section], option->order);
|
||||
|
||||
if (strcmp(option->keyword, "PageSize") == 0 ||
|
||||
strcmp(option->keyword, "PageRegion") == 0)
|
||||
{
|
||||
for (m = option->num_choices, choice = option->choices;
|
||||
m > 0;
|
||||
m --, choice ++)
|
||||
{
|
||||
size = ppdPageSize(ppd, choice->choice);
|
||||
|
||||
if (size == NULL)
|
||||
printf(" %s (%s) = ERROR", choice->choice, choice->text);
|
||||
else
|
||||
printf(" %s (%s) = %.2fx%.2fin (%.1f,%.1f,%.1f,%.1f)", choice->choice,
|
||||
choice->text, size->width / 72.0, size->length / 72.0,
|
||||
size->left / 72.0, size->bottom / 72.0,
|
||||
size->right / 72.0, size->top / 72.0);
|
||||
|
||||
if (strcmp(option->defchoice, choice->choice) == 0)
|
||||
puts(" *");
|
||||
else
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (m = option->num_choices, choice = option->choices;
|
||||
m > 0;
|
||||
m --, choice ++)
|
||||
{
|
||||
printf(" %s (%s)", choice->choice, choice->text);
|
||||
|
||||
if (strcmp(option->defchoice, choice->choice) == 0)
|
||||
puts(" *");
|
||||
else
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ppdClose(ppd);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,102 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="testppd" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=testppd - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "testppd.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "testppd.mak" CFG="testppd - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "testppd - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "testppd - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "testppd - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 cups.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"testppd.exe"
|
||||
|
||||
!ELSEIF "$(CFG)" == "testppd - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "testppd___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "testppd___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 cupsd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"testppdd.exe" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "testppd - Win32 Release"
|
||||
# Name "testppd - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\testppd.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ppd.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
-1011
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* User, system, and password routines 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:
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups.h"
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
/*
|
||||
* WIN32 and OS/2 username and password stuff...
|
||||
*/
|
||||
|
||||
/*
|
||||
* 'cupsUser()' - Return the current user's name.
|
||||
*/
|
||||
|
||||
const char * /* O - User name */
|
||||
cupsUser(void)
|
||||
{
|
||||
return ("WindowsUser");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPassword()' - Get a password from the user...
|
||||
*/
|
||||
|
||||
const char * /* O - Password */
|
||||
cupsGetPassword(const char *prompt) /* I - Prompt string */
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* UNIX username and password stuff...
|
||||
*/
|
||||
|
||||
# include <pwd.h>
|
||||
|
||||
/*
|
||||
* 'cupsUser()' - Return the current user's name.
|
||||
*/
|
||||
|
||||
const char * /* O - User name */
|
||||
cupsUser(void)
|
||||
{
|
||||
struct passwd *pwd; /* User/password entry */
|
||||
|
||||
|
||||
/*
|
||||
* Rewind the password file...
|
||||
*/
|
||||
|
||||
setpwent();
|
||||
|
||||
/*
|
||||
* Lookup the password entry for the current user.
|
||||
*/
|
||||
|
||||
if ((pwd = getpwuid(getuid())) == NULL)
|
||||
return ("unknown"); /* Unknown user! */
|
||||
|
||||
/*
|
||||
* Rewind the password file again and return the username...
|
||||
*/
|
||||
|
||||
setpwent();
|
||||
|
||||
return (pwd->pw_name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPassword()' - Get a password from the user...
|
||||
*/
|
||||
|
||||
const char * /* O - Password */
|
||||
cupsGetPassword(const char *prompt) /* I - Prompt string */
|
||||
{
|
||||
return (getpass(prompt));
|
||||
}
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsServer()' - Return the hostname of the default server...
|
||||
*/
|
||||
|
||||
const char * /* O - Server name */
|
||||
cupsServer(void)
|
||||
{
|
||||
FILE *fp; /* cupsd.conf file */
|
||||
char *server; /* Pointer to server name */
|
||||
static char line[1024]; /* Line from file */
|
||||
|
||||
|
||||
/*
|
||||
* First see if the CUPS_SERVER environment variable is set...
|
||||
*/
|
||||
|
||||
if ((server = getenv("CUPS_SERVER")) != NULL)
|
||||
return (server);
|
||||
|
||||
/*
|
||||
* Next check to see if we have a cupsd.conf file...
|
||||
*/
|
||||
|
||||
if ((fp = fopen(CUPS_SERVERROOT "/conf/cupsd.conf", "r")) == NULL)
|
||||
return ("localhost");
|
||||
|
||||
/*
|
||||
* Read the cupsd.conf file and look for a ServerName line...
|
||||
*/
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL)
|
||||
if (strncmp(line, "ServerName ", 11) == 0)
|
||||
{
|
||||
/*
|
||||
* Got it! Drop any trailing newline and find the name...
|
||||
*/
|
||||
|
||||
server = line + strlen(line) - 1;
|
||||
if (*server == '\n')
|
||||
*server = '\0';
|
||||
|
||||
for (server = line + 11; isspace(*server); server ++);
|
||||
|
||||
if (*server)
|
||||
return (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* Didn't see a ServerName line, so return "localhost"...
|
||||
*/
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return ("localhost");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-989
@@ -1,989 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Printing utilities 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:
|
||||
*
|
||||
* cupsCancelJob() - Cancel a print job.
|
||||
* cupsDoFileRequest() - Do an IPP request...
|
||||
* cupsGetClasses() - Get a list of printer classes.
|
||||
* cupsGetDefault() - Get the default printer or class.
|
||||
* cupsGetPPD() - Get the PPD file for a printer.
|
||||
* cupsGetPrinters() - Get a list of printers.
|
||||
* cupsPrintFile() - Print a file to a printer or class.
|
||||
* cups_connect() - Connect to the specified host...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups.h"
|
||||
#include "ipp.h"
|
||||
#include "language.h"
|
||||
#include "string.h"
|
||||
#include "debug.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static http_t *cups_server = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static char *cups_connect(const char *name, char *printer, char *hostname);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsCancelJob()' - Cancel a print job.
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
cupsCancelJob(const char *name, /* I - Name of printer or class */
|
||||
int job) /* I - Job ID */
|
||||
{
|
||||
char printer[HTTP_MAX_URI], /* Printer name */
|
||||
hostname[HTTP_MAX_URI], /* Hostname */
|
||||
uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
cups_lang_t *language; /* Language info */
|
||||
|
||||
|
||||
/*
|
||||
* See if we can connect to the server...
|
||||
*/
|
||||
|
||||
if (!cups_connect(name, printer, hostname))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Build an IPP_CANCEL_JOB request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* job-id
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = IPP_CANCEL_JOB;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL,
|
||||
language != NULL ? language->language : "C");
|
||||
|
||||
sprintf(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);
|
||||
|
||||
/*
|
||||
* Do the request...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(cups_server, request, "/jobs/")) == NULL)
|
||||
return (0);
|
||||
|
||||
ippDelete(response);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsDoFileRequest()' - Do an IPP request...
|
||||
*/
|
||||
|
||||
ipp_t * /* O - Response data */
|
||||
cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
ipp_t *request, /* I - IPP request */
|
||||
const char *resource, /* I - HTTP resource for POST */
|
||||
const char *filename) /* I - File to send or NULL */
|
||||
{
|
||||
ipp_t *response; /* IPP response data */
|
||||
char length[255]; /* Content-Length field */
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
FILE *file; /* File to send */
|
||||
struct stat fileinfo; /* File information */
|
||||
int bytes; /* Number of bytes read/written */
|
||||
char buffer[8192]; /* Output buffer */
|
||||
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",
|
||||
http, request, resource, filename ? filename : "(null)"));
|
||||
|
||||
/*
|
||||
* See if we have a file to send...
|
||||
*/
|
||||
|
||||
if (filename != NULL)
|
||||
{
|
||||
if (stat(filename, &fileinfo))
|
||||
{
|
||||
/*
|
||||
* Can't get file information!
|
||||
*/
|
||||
|
||||
ippDelete(request);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((file = fopen(filename, "rb")) == NULL)
|
||||
{
|
||||
/*
|
||||
* Can't open file!
|
||||
*/
|
||||
|
||||
ippDelete(request);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop until we can send the request without authorization problems.
|
||||
*/
|
||||
|
||||
response = NULL;
|
||||
|
||||
while (response == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: setup...");
|
||||
|
||||
/*
|
||||
* Setup the HTTP variables needed...
|
||||
*/
|
||||
|
||||
if (filename != NULL)
|
||||
sprintf(length, "%u", ippLength(request) + (size_t)fileinfo.st_size);
|
||||
else
|
||||
sprintf(length, "%u", ippLength(request));
|
||||
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_LENGTH, length);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, authstring);
|
||||
|
||||
/*
|
||||
* Try the request...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: post...");
|
||||
|
||||
if (httpPost(http, resource))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Send the IPP data and wait for the response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: ipp write...");
|
||||
|
||||
request->state = IPP_IDLE;
|
||||
if (ippWrite(http, request) != IPP_ERROR)
|
||||
if (filename != NULL)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: file write...");
|
||||
|
||||
/*
|
||||
* Send the file...
|
||||
*/
|
||||
|
||||
rewind(file);
|
||||
|
||||
while ((bytes = fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||
if (httpWrite(http, buffer, bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the server's return status...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: update...");
|
||||
|
||||
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: unauthorized...");
|
||||
|
||||
/*
|
||||
* Flush any error message...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
|
||||
if ((password = cupsGetPassword("Password:")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got a password; send it to the server...
|
||||
*/
|
||||
|
||||
if (!password[0])
|
||||
break;
|
||||
sprintf(plain, "%s:%s", cupsUser(), password);
|
||||
httpEncode64(encode, plain);
|
||||
sprintf(authstring, "Basic %s", encode);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (status == HTTP_ERROR)
|
||||
{
|
||||
if (http->error != ENETDOWN && http->error != ENETUNREACH)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (status != HTTP_OK)
|
||||
{
|
||||
DEBUG_printf(("cupsDoFileRequest: error %d...\n", status));
|
||||
|
||||
/*
|
||||
* Flush any error message...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Read the response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: response...");
|
||||
|
||||
response = ippNew();
|
||||
|
||||
if (ippRead(http, response) == IPP_ERROR)
|
||||
{
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
response = NULL;
|
||||
|
||||
/*
|
||||
* Flush any remaining data...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the file if needed...
|
||||
*/
|
||||
|
||||
if (filename != NULL)
|
||||
fclose(file);
|
||||
|
||||
/*
|
||||
* Delete the original request and return the response...
|
||||
*/
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
return (response);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetClasses()' - Get a list of printer classes.
|
||||
*/
|
||||
|
||||
int /* O - Number of classes */
|
||||
cupsGetClasses(char ***classes) /* O - Classes */
|
||||
{
|
||||
int n; /* Number of classes */
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
|
||||
|
||||
/*
|
||||
* Try to connect to the server...
|
||||
*/
|
||||
|
||||
if (!cups_connect("default", NULL, NULL))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_CLASSES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = CUPS_GET_CLASSES;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
n = 0;
|
||||
*classes = NULL;
|
||||
|
||||
if ((response = cupsDoRequest(cups_server, request, "/classes/")) != NULL)
|
||||
{
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
if (strcmp(attr->name, "printer-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
{
|
||||
if (n == 0)
|
||||
*classes = malloc(sizeof(char *));
|
||||
else
|
||||
*classes = realloc(*classes, sizeof(char *) * (n + 1));
|
||||
|
||||
if (*classes == NULL)
|
||||
{
|
||||
ippDelete(response);
|
||||
return (0);
|
||||
}
|
||||
|
||||
(*classes)[n] = strdup(attr->values[0].string.text);
|
||||
n ++;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetDefault()' - Get the default printer or class.
|
||||
*/
|
||||
|
||||
const char * /* O - Default printer or NULL */
|
||||
cupsGetDefault(void)
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
static char def_printer[64];/* Default printer */
|
||||
|
||||
|
||||
/*
|
||||
* First see if the LPDEST or PRINTER environment variables are
|
||||
* set...
|
||||
*/
|
||||
|
||||
if (getenv("LPDEST") != NULL)
|
||||
return (getenv("LPDEST"));
|
||||
else if (getenv("PRINTER") != NULL)
|
||||
return (getenv("PRINTER"));
|
||||
|
||||
/*
|
||||
* Try to connect to the server...
|
||||
*/
|
||||
|
||||
if (!cups_connect("default", NULL, NULL))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_DEFAULT request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = CUPS_GET_DEFAULT;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(cups_server, request, "/printers/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
{
|
||||
strcpy(def_printer, attr->values[0].string.text);
|
||||
ippDelete(response);
|
||||
return (def_printer);
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPPD()' - Get the PPD file for a printer.
|
||||
*/
|
||||
|
||||
const char * /* O - Filename for PPD file */
|
||||
cupsGetPPD(const char *name) /* I - Printer name */
|
||||
{
|
||||
FILE *fp; /* PPD file */
|
||||
int bytes; /* Number of bytes read */
|
||||
char buffer[8192]; /* Buffer for file */
|
||||
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 */
|
||||
|
||||
|
||||
/*
|
||||
* See if we can connect to the server...
|
||||
*/
|
||||
|
||||
if (!cups_connect(name, printer, hostname))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Then check for the cache file...
|
||||
*/
|
||||
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
tempdir = "C:/WINDOWS/TEMP";
|
||||
|
||||
sprintf(filename, "%s/%s.ppd", tempdir, printer);
|
||||
#else
|
||||
if ((tempdir = getenv("TMPDIR")) == NULL)
|
||||
tempdir = "/tmp";
|
||||
|
||||
sprintf(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);
|
||||
|
||||
httpClearFields(cups_server);
|
||||
httpSetField(cups_server, HTTP_FIELD_HOST, hostname);
|
||||
httpGet(cups_server, resource);
|
||||
|
||||
switch (httpUpdate(cups_server))
|
||||
{
|
||||
case HTTP_OK : /* New file - get it! */
|
||||
break;
|
||||
default :
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, we need to copy the file; open the file and copy it...
|
||||
*/
|
||||
|
||||
unlink(filename);
|
||||
if ((fp = fopen(filename, "w")) == NULL)
|
||||
{
|
||||
/*
|
||||
* Can't open file; close the server connection and return NULL...
|
||||
*/
|
||||
|
||||
httpClose(cups_server);
|
||||
cups_server = NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
while ((bytes = httpRead(cups_server, buffer, sizeof(buffer))) > 0)
|
||||
fwrite(buffer, bytes, 1, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return (filename);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPrinters()' - Get a list of printers.
|
||||
*/
|
||||
|
||||
int /* O - Number of printers */
|
||||
cupsGetPrinters(char ***printers) /* O - Printers */
|
||||
{
|
||||
int n; /* Number of printers */
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
|
||||
|
||||
/*
|
||||
* Try to connect to the server...
|
||||
*/
|
||||
|
||||
if (!cups_connect("default", NULL, NULL))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_PRINTERS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = CUPS_GET_PRINTERS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
n = 0;
|
||||
*printers = NULL;
|
||||
|
||||
if ((response = cupsDoRequest(cups_server, request, "/printers/")) != NULL)
|
||||
{
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
if (strcmp(attr->name, "printer-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
{
|
||||
if (n == 0)
|
||||
*printers = malloc(sizeof(char *));
|
||||
else
|
||||
*printers = realloc(*printers, sizeof(char *) * (n + 1));
|
||||
|
||||
if (*printers == NULL)
|
||||
{
|
||||
ippDelete(response);
|
||||
return (0);
|
||||
}
|
||||
|
||||
(*printers)[n] = strdup(attr->values[0].string.text);
|
||||
n ++;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsPrintFile()' - Print a file to a printer or class.
|
||||
*/
|
||||
|
||||
int /* O - Job ID */
|
||||
cupsPrintFile(const char *name, /* I - Printer or class name */
|
||||
const char *filename, /* I - File to print */
|
||||
const char *title, /* I - Title of job */
|
||||
int num_options,/* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int n, n2; /* Attribute values */
|
||||
char *option, /* Name of option */
|
||||
*val, /* Pointer to option value */
|
||||
*s; /* Pointer into option value */
|
||||
ipp_t *request; /* IPP request */
|
||||
ipp_t *response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP job-id attribute */
|
||||
char hostname[HTTP_MAX_URI], /* Hostname */
|
||||
printer[HTTP_MAX_URI], /* Printer or class name */
|
||||
uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
cups_lang_t *language; /* Language to use */
|
||||
int jobid; /* New job ID */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsPrintFile(\'%s\', \'%s\', %d, %08x)\n",
|
||||
printer, filename, num_options, options));
|
||||
|
||||
if (name == NULL || filename == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Setup a connection and request data...
|
||||
*/
|
||||
|
||||
if ((request = ippNew()) == NULL)
|
||||
return (0);
|
||||
|
||||
if (!cups_connect(name, printer, hostname))
|
||||
{
|
||||
DEBUG_printf(("cupsPrintFile: Unable to open connection - %s.\n",
|
||||
strerror(errno)));
|
||||
ippDelete(request);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a standard CUPS URI for the printer and fill the standard IPP
|
||||
* attributes...
|
||||
*/
|
||||
|
||||
request->request.op.operation_id = IPP_PRINT_JOB;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
sprintf(uri, "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL,
|
||||
language != NULL ? language->language : "C");
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
|
||||
/*
|
||||
* Handle raw print files...
|
||||
*/
|
||||
|
||||
if (cupsGetOption("raw", num_options, options))
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
|
||||
NULL, "application/vnd.cups-raw");
|
||||
else
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
|
||||
NULL, "application/octet-stream");
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, cupsUser());
|
||||
|
||||
if (title)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, title);
|
||||
|
||||
/*
|
||||
* Then add all options on the command-line...
|
||||
*/
|
||||
|
||||
for (i = 0; i < num_options; i ++)
|
||||
{
|
||||
/*
|
||||
* Skip the "raw" option - handled above...
|
||||
*/
|
||||
|
||||
if (strcmp(options[i].name, "raw") == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* See what the option value is; for compatibility with older interface
|
||||
* scripts, we have to support single-argument options as well as
|
||||
* option=value, option=low-high, and option=MxN.
|
||||
*/
|
||||
|
||||
option = options[i].name;
|
||||
val = options[i].value;
|
||||
|
||||
if (*val == '\0')
|
||||
val = NULL;
|
||||
|
||||
if (val != NULL)
|
||||
{
|
||||
if (strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0)
|
||||
{
|
||||
/*
|
||||
* Boolean value - true...
|
||||
*/
|
||||
|
||||
n = 1;
|
||||
val = "";
|
||||
}
|
||||
else if (strcasecmp(val, "false") == 0 ||
|
||||
strcasecmp(val, "off") == 0 ||
|
||||
strcasecmp(val, "no") == 0)
|
||||
{
|
||||
/*
|
||||
* Boolean value - false...
|
||||
*/
|
||||
|
||||
n = 0;
|
||||
val = "";
|
||||
}
|
||||
|
||||
n = strtol(val, &s, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strncmp(option, "no", 2) == 0)
|
||||
{
|
||||
option += 2;
|
||||
n = 0;
|
||||
}
|
||||
else
|
||||
n = 1;
|
||||
|
||||
s = "";
|
||||
}
|
||||
|
||||
if (*s != '\0' && *s != '-' && (*s != 'x' || s == val))
|
||||
{
|
||||
/*
|
||||
* String value(s)...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsPrintFile: Adding string option \'%s\' with value \'%s\'...\n",
|
||||
option, val));
|
||||
|
||||
ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, option, NULL, val);
|
||||
}
|
||||
else if (val != NULL)
|
||||
{
|
||||
/*
|
||||
* Numeric value, range, or resolution...
|
||||
*/
|
||||
|
||||
if (*s == '-')
|
||||
{
|
||||
n2 = strtol(s + 1, NULL, 0);
|
||||
ippAddRange(request, IPP_TAG_JOB, option, n, n2);
|
||||
|
||||
DEBUG_printf(("cupsPrintFile: Adding range option \'%s\' with value %d-%d...\n",
|
||||
option, n, n2));
|
||||
}
|
||||
else if (*s == 'x')
|
||||
{
|
||||
n2 = strtol(s + 1, &s, 0);
|
||||
|
||||
if (strcmp(s, "dpc") == 0)
|
||||
ippAddResolution(request, IPP_TAG_JOB, option, IPP_RES_PER_CM, n, n2);
|
||||
else if (strcmp(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);
|
||||
|
||||
DEBUG_printf(("cupsPrintFile: Adding resolution option \'%s\' with value %s...\n",
|
||||
option, val));
|
||||
}
|
||||
else
|
||||
{
|
||||
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, option, n);
|
||||
|
||||
DEBUG_printf(("cupsPrintFile: Adding integer option \'%s\' with value %d...\n",
|
||||
option, n));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Boolean value...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsPrintFile: Adding boolean option \'%s\' with value %d...\n",
|
||||
option, n));
|
||||
ippAddBoolean(request, IPP_TAG_JOB, option, (char)n);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Try printing the file...
|
||||
*/
|
||||
|
||||
sprintf(uri, "/printers/%s", printer);
|
||||
|
||||
if ((response = cupsDoFileRequest(cups_server, request, uri, filename)) == NULL)
|
||||
jobid = 0;
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
DEBUG_printf(("IPP response code was 0x%x!\n",
|
||||
response->request.status.status_code));
|
||||
jobid = 0;
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
DEBUG_puts("No job ID!");
|
||||
jobid = 0;
|
||||
}
|
||||
else
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
if (response != NULL)
|
||||
ippDelete(response);
|
||||
|
||||
return (jobid);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsTempFile()' - Generate a temporary filename.
|
||||
*/
|
||||
|
||||
char * /* O - Filename */
|
||||
cupsTempFile(char *filename, /* I - Pointer to buffer */
|
||||
int len) /* I - Size of buffer */
|
||||
{
|
||||
char *tmpdir; /* TMPDIR environment var */
|
||||
static char buf[1024] = ""; /* Buffer if you pass in NULL and 0 */
|
||||
|
||||
|
||||
/*
|
||||
* See if a filename was specified...
|
||||
*/
|
||||
|
||||
if (filename == NULL)
|
||||
{
|
||||
filename = buf;
|
||||
len = sizeof(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if TMPDIR is defined...
|
||||
*/
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) == NULL)
|
||||
tmpdir = "/var/tmp";
|
||||
|
||||
if ((strlen(tmpdir) + 8) > len)
|
||||
{
|
||||
/*
|
||||
* The specified directory exceeds the size of the buffer; default it...
|
||||
*/
|
||||
|
||||
strcpy(buf, "/var/tmp/XXXXXX");
|
||||
return (mktemp(buf));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Make the temporary name using the specified directory...
|
||||
*/
|
||||
|
||||
sprintf(filename, "%s/XXXXXX", tmpdir);
|
||||
return (mktemp(filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_connect()' - Connect to the specified host...
|
||||
*/
|
||||
|
||||
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 hostbuf[HTTP_MAX_URI];
|
||||
/* Name of host */
|
||||
static char printerbuf[HTTP_MAX_URI];
|
||||
/* Name of printer or class */
|
||||
|
||||
|
||||
if (name == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (sscanf(name, "%[^@]@%s", printerbuf, hostbuf) == 1)
|
||||
strcpy(hostbuf, cupsServer());
|
||||
|
||||
if (hostname != NULL)
|
||||
strcpy(hostname, hostbuf);
|
||||
else
|
||||
hostname = hostbuf;
|
||||
|
||||
if (printer != NULL)
|
||||
strcpy(printer, printerbuf);
|
||||
else
|
||||
printer = printerbuf;
|
||||
|
||||
if (cups_server != NULL)
|
||||
{
|
||||
if (strcasecmp(cups_server->hostname, hostname) == 0)
|
||||
return (printer);
|
||||
|
||||
httpClose(cups_server);
|
||||
}
|
||||
|
||||
if ((cups_server = httpConnect(hostname, ippPort())) == NULL)
|
||||
return (NULL);
|
||||
else
|
||||
return (printer);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+2
-2
@@ -42,7 +42,7 @@ include ../Makedefs
|
||||
#
|
||||
|
||||
DOCUMENTS = cmp.shtml idd.shtml sam.shtml sdd.shtml ssr.shtml \
|
||||
stp.shtml sum.shtml
|
||||
stp.shtml sum.shtml svd.shtml
|
||||
DOCIMAGES = images/cups-block-diagram.gif images/cups-large.gif \
|
||||
images/cups-medium.gif images/cups-small.gif
|
||||
WEBPAGES = cups.css cupsdoc.css index.html documentation.html
|
||||
@@ -86,7 +86,7 @@ install:
|
||||
|
||||
overview.pdf: overview.html
|
||||
echo Formatting $@...
|
||||
htmldoc --duplex --compression=9 --jpeg --webpage -f overview.pdf overview.html
|
||||
htmldoc --duplex --compression=9 --jpeg --webpage -f $@ $<
|
||||
|
||||
sam.html: sam.shtml
|
||||
echo Formatting $@...
|
||||
|
||||
+3
-3
@@ -152,10 +152,10 @@ sections:
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft) </LI>
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1 </LI>
|
||||
<LI>IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>IPP/1.0: Implementers Guide </LI>
|
||||
<LI>IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol </LI>
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide </LI>
|
||||
</UL>
|
||||
<H1><A NAME=3>3 File Management</A></H1>
|
||||
<H2><A NAME=3_1>3.1 Directory Structure</A></H2>
|
||||
|
||||
+121
-118
@@ -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:19990521210307Z)/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
|
||||
@@ -400,10 +400,13 @@ endobj
|
||||
endobj
|
||||
198 0 obj<</Type/Page/Parent 191 0 R/Contents 199 0 R/Resources<</ProcSet[/PDF/Text]/Font<</F4 4 0 R/F8 7 0 R/F9 8 0 R/Fc 9 0 R>>>>>>endobj
|
||||
199 0 obj<</Length 200 0 R/Filter/FlateDecode>>stream
|
||||
xÚ•UMo"9½ó+J9%ÒЛB`oC¾„4™a�ŒöÀŸ«Á·«c»Aì¯ß²» E‹¢Hi»ªÞ{õÊ•·V
|
||||
xÚ•UMo"9½ó+J9%ÒЛB`oC¾„4™a�ŒöÀŸ«Á·«c»Aì¯ß²» E‹¢Hi»ªÞ{õÊ•·V
|
||||
×ü“Âmº}�Ek4oýñ8„tóœoú·=˜g—)Ì$•x5ÿUßÞ$ƒú¾}3Hêˆ$…q†Æ«\Iá™:¸iÚ„vúuè|H2¹ZU6†B!ŒXaÁéPja #YÕ_–6*C~�°ªøOæd!Ã
|
||||
j*cœ0QÆó¯0�ò€Ï¨i7éÔPàŽŠ‚Ñ^¾�ÿ†‰åheV0Û9�,./î^&³‹ÅüDë«4¹G¹ß
|
||||
‹É íÝá^{g_åÇíFáöñŸÓx, $ëÅR#Ÿ51ZìÐFí!wѹé»zÈ—.p Œ=¬…;’¿D4ûŽaË<·ƒY#�yPVIÏ�¦À¡ �LÁyn¬°Ù�‚#]EË¡ubƒ&#ë‚
|
||||
G¸•ãf&Zû»™�ޟѺÚWÔ¸ã±(x²vpm.$º¤©ºïb,Ç¥ëRãgКÉj<IÒìêøaþØO&쫨שz‚âØ…ø(~Ñ2J€·
|
||||
+6ëHηÀ+°÷ƒ�‹Ëo“û/0}¼KÓÛáâêÌxøþ�㱆‘&ùÊa³çQ¸
|
||||
‹É íÝá^{g_åÇíFáöñŸÓx, $ëÅR#Ÿ51ZìÐFí!wѹé»zÈ—.p Œ=¬…;’¿D4ûŽaË<·ƒY#�yPVIÏ�¦À¡ �LÁyn¬°Ù�‚#]EË¡ubƒ&#ë‚
|
||||
_ËrƇ'<Red¶AhGG�®*Ã$°i[å×`‘}â�¼22!´ò»“ýYæ€Û²%ûZ+dNKK[$r~&*ýAºx ¢°‹Éäž_D›[††€â}˜•Ó\™¤ÐÀ¸:Q–ºÙ*“a=¼§³zv]êª~²rž
|
||||
õcoš7I9<}�§õ�úâRVÖòÐ;¨‰Rþߨ^rÝ]\ñ
|
||||
Màu£Š`S®øMÇáAòùÃ�eáMì•2ímkÚê>_]¸ß/´ÿ± >ÛŽï‹‘ƒÈ®„‰ÍaG;'iß)ÆépÖ@²êXø;Ö¢Ó¿…ß™ðªo\öòÀpß´SY\¦˜#ÛÀÏõ¬Ô.§>†Ö?¿Ë<+¿ÇùsKUØ”SŒ&ñógaÌϪt¤ïâ”÷ÓyZ¾r…'Müìíî¬Ä'ÞQœ›â[¥lìC>h¢Úµ{éà:9þ¯Üã³!ƒ„Óðý0oýÕú‰ßksendstream
|
||||
endobj
|
||||
@@ -839,122 +842,122 @@ xref
|
||||
0000014295 00000 n
|
||||
0000014401 00000 n
|
||||
0000014635 00000 n
|
||||
0000015402 00000 n
|
||||
0000015451 00000 n
|
||||
0000015500 00000 n
|
||||
0000015549 00000 n
|
||||
0000015598 00000 n
|
||||
0000015647 00000 n
|
||||
0000015696 00000 n
|
||||
0000015745 00000 n
|
||||
0000015794 00000 n
|
||||
0000015843 00000 n
|
||||
0000015892 00000 n
|
||||
0000015941 00000 n
|
||||
0000015990 00000 n
|
||||
0000016039 00000 n
|
||||
0000016088 00000 n
|
||||
0000016137 00000 n
|
||||
0000016186 00000 n
|
||||
0000016235 00000 n
|
||||
0000016284 00000 n
|
||||
0000016333 00000 n
|
||||
0000016382 00000 n
|
||||
0000016431 00000 n
|
||||
0000016480 00000 n
|
||||
0000016529 00000 n
|
||||
0000016578 00000 n
|
||||
0000016627 00000 n
|
||||
0000016676 00000 n
|
||||
0000016725 00000 n
|
||||
0000016774 00000 n
|
||||
0000016823 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
|
||||
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
|
||||
0000014669 00000 n
|
||||
0000014703 00000 n
|
||||
0000015402 00000 n
|
||||
0000015451 00000 n
|
||||
0000015500 00000 n
|
||||
0000015549 00000 n
|
||||
0000015598 00000 n
|
||||
0000015647 00000 n
|
||||
0000015696 00000 n
|
||||
0000015745 00000 n
|
||||
0000015794 00000 n
|
||||
0000015843 00000 n
|
||||
0000015892 00000 n
|
||||
0000015941 00000 n
|
||||
0000015990 00000 n
|
||||
0000016039 00000 n
|
||||
0000016088 00000 n
|
||||
0000016137 00000 n
|
||||
0000016186 00000 n
|
||||
0000016235 00000 n
|
||||
0000016284 00000 n
|
||||
0000016333 00000 n
|
||||
0000016382 00000 n
|
||||
0000016431 00000 n
|
||||
0000016480 00000 n
|
||||
0000016529 00000 n
|
||||
0000016578 00000 n
|
||||
0000016627 00000 n
|
||||
0000016676 00000 n
|
||||
0000016725 00000 n
|
||||
0000016774 00000 n
|
||||
0000016823 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
|
||||
0000027216 00000 n
|
||||
0000027237 00000 n
|
||||
0000027350 00000 n
|
||||
0000027543 00000 n
|
||||
0000027564 00000 n
|
||||
0000027695 00000 n
|
||||
0000028308 00000 n
|
||||
0000028329 00000 n
|
||||
0000028442 00000 n
|
||||
0000028631 00000 n
|
||||
0000028652 00000 n
|
||||
0000028783 00000 n
|
||||
0000029727 00000 n
|
||||
0000029748 00000 n
|
||||
0000029879 00000 n
|
||||
0000030166 00000 n
|
||||
0000030187 00000 n
|
||||
0000030327 00000 n
|
||||
0000031243 00000 n
|
||||
0000031264 00000 n
|
||||
0000031395 00000 n
|
||||
0000031753 00000 n
|
||||
0000031774 00000 n
|
||||
0000031914 00000 n
|
||||
0000032410 00000 n
|
||||
0000032431 00000 n
|
||||
0000032562 00000 n
|
||||
0000033014 00000 n
|
||||
0000033035 00000 n
|
||||
0000033175 00000 n
|
||||
0000034315 00000 n
|
||||
0000034337 00000 n
|
||||
0000034477 00000 n
|
||||
0000035383 00000 n
|
||||
0000035404 00000 n
|
||||
0000035544 00000 n
|
||||
0000036470 00000 n
|
||||
0000036491 00000 n
|
||||
0000036631 00000 n
|
||||
0000037277 00000 n
|
||||
0000037298 00000 n
|
||||
0000037438 00000 n
|
||||
0000038258 00000 n
|
||||
0000038279 00000 n
|
||||
0000038419 00000 n
|
||||
0000039346 00000 n
|
||||
0000039367 00000 n
|
||||
0000039946 00000 n
|
||||
0000039507 00000 n
|
||||
0000039911 00000 n
|
||||
|
||||
+7
-7
@@ -75,10 +75,10 @@ The following non-CUPS documents are referenced by this document:
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft)
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1
|
||||
<LI>IPP/1.0: Encoding and Transport
|
||||
<LI>IPP/1.0: Implementers Guide
|
||||
<LI>IPP/1.0: Model and Semantics
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide
|
||||
</UL>
|
||||
|
||||
<H1>File Management</H1>
|
||||
@@ -334,12 +334,12 @@ extension of ".h".
|
||||
The top of each source file shall contain a header giving the name of 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 679 1999-09-22 20:06:27Z mike $" tag:
|
||||
information is provided by the CVS "$Id: cmp.shtml 351 1999-05-21 20:54:09Z mike $" tag:
|
||||
|
||||
<UL>
|
||||
<PRE>
|
||||
/*
|
||||
* "$Id: cmp.shtml 679 1999-09-22 20:06:27Z mike $"
|
||||
* "$Id: cmp.shtml 351 1999-05-21 20:54:09Z mike $"
|
||||
*
|
||||
* Description of file contents.
|
||||
*
|
||||
@@ -372,14 +372,14 @@ information is provided by the CVS "$Id: cmp.shtml 679 1999-09-22 20:06:27Z mike
|
||||
</UL>
|
||||
|
||||
The bottom of each source file shall contain a trailer giving the name
|
||||
of the file using the CVS "$Id: cmp.shtml 679 1999-09-22 20:06:27Z mike $" tag. The primary purpose of this is to
|
||||
of the file using the CVS "$Id: cmp.shtml 351 1999-05-21 20:54:09Z mike $" 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:
|
||||
|
||||
<UL>
|
||||
<PRE>
|
||||
/*
|
||||
* End of "$Id: cmp.shtml 679 1999-09-22 20:06:27Z mike $".
|
||||
* End of "$Id: cmp.shtml 351 1999-05-21 20:54:09Z mike $".
|
||||
*/
|
||||
</PRE>
|
||||
</UL>
|
||||
|
||||
@@ -55,6 +55,8 @@ The following documentation for CUPS is available on this server:
|
||||
<A HREF="ssr.html">HTML</A> |
|
||||
<A HREF="ssr.pdf">PDF</A> )
|
||||
|
||||
<LI>Software Test Plan (Not Yet Available)
|
||||
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
|
||||
+93
-146
@@ -1,13 +1,13 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>CUPS Interface Design Description</TITLE>
|
||||
<TITLE>DRAFT - CUPS Interface Design Description</TITLE>
|
||||
<META NAME="AUTHOR" CONTENT="Easy Software Products">
|
||||
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
|
||||
<META NAME="DOCNUMBER" CONTENT="CUPS-IDD-1.0">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<CENTER><A HREF=#contents><IMG SRC="images/cups-large.gif" BORDER=0><BR>
|
||||
<H1>CUPS Interface Design Description</H1></A><BR>
|
||||
<H1>DRAFT - CUPS Interface Design Description</H1></A><BR>
|
||||
CUPS-IDD-1.0<BR>
|
||||
Easy Software Products<BR>
|
||||
Copyright 1997-1999, All Rights Reserved<BR>
|
||||
@@ -53,24 +53,26 @@ Copyright 1997-1999, All Rights Reserved<BR>
|
||||
<LI><A HREF=#4_3>4.3 CUPS PostScript File</A></LI>
|
||||
<LI><A HREF=#4_4>4.4 CUPS Raster File</A></LI>
|
||||
<LI><A HREF=#4_5>4.5 CUPS Raw Files</A></LI>
|
||||
<LI><A HREF=#4_6>4.6 Internet Printing Protocol</A></LI>
|
||||
<LI><A HREF=#4_6>4.6 File Transfer Protocol</A></LI>
|
||||
<LI><A HREF=#4_7>4.7 Internet Printing Protocol</A></LI>
|
||||
<UL>
|
||||
<LI><A HREF=#4_6_1>4.6.1 Get Default Destination (CUPS_GET_DEFAULT =
|
||||
<LI><A HREF=#4_7_1>4.7.1 Get Default Destination (CUPS_GET_DEFAULT =
|
||||
0x4001)</A></LI>
|
||||
<LI><A HREF=#4_6_2>4.6.2 Get Printers (CUPS_GET_PRINTERS = 0x4002)</A></LI>
|
||||
<LI><A HREF=#4_6_3>4.6.3 Add Printer (CUPS_ADD_PRINTER = 0x4003)</A></LI>
|
||||
<LI><A HREF=#4_6_4>4.6.4 Delete Printer (CUPS_DELETE_PRINTER = 0x4004)</A>
|
||||
<LI><A HREF=#4_7_2>4.7.2 Get Printers (CUPS_GET_PRINTERS = 0x4002)</A></LI>
|
||||
<LI><A HREF=#4_7_3>4.7.3 Add Printer (CUPS_ADD_PRINTER = 0x4003)</A></LI>
|
||||
<LI><A HREF=#4_7_4>4.7.4 Delete Printer (CUPS_DELETE_PRINTER = 0x4004)</A>
|
||||
</LI>
|
||||
<LI><A HREF=#4_6_5>4.6.5 Get Classes (CUPS_GET_CLASSES = 0x4005)</A></LI>
|
||||
<LI><A HREF=#4_6_6>4.6.6 Add Class (CUPS_ADD_CLASS = 0x4006)</A></LI>
|
||||
<LI><A HREF=#4_6_7>4.6.7 Delete Class (CUPS_DELETE_CLASS = 0x4007)</A></LI>
|
||||
<LI><A HREF=#4_6_8>4.6.8 Accept Jobs (CUPS_ACCEPT_JOBS = 0x4008)</A></LI>
|
||||
<LI><A HREF=#4_6_9>4.6.9 Reject Jobs (CUPS_REJECT_JOBS = 0x4009)</A></LI>
|
||||
<LI><A HREF=#4_6_10>4.6.10 Set Default Destination (CUPS_SET_DEFAULT =
|
||||
<LI><A HREF=#4_7_5>4.7.5 Get Classes (CUPS_GET_CLASSES = 0x4005)</A></LI>
|
||||
<LI><A HREF=#4_7_6>4.7.6 Add Class (CUPS_ADD_CLASS = 0x4006)</A></LI>
|
||||
<LI><A HREF=#4_7_7>4.7.7 Delete Class (CUPS_DELETE_CLASS = 0x4007)</A></LI>
|
||||
<LI><A HREF=#4_7_8>4.7.8 Accept Jobs (CUPS_ACCEPT_JOBS = 0x4008)</A></LI>
|
||||
<LI><A HREF=#4_7_9>4.7.9 Reject Jobs (CUPS_REJECT_JOBS = 0x4009)</A></LI>
|
||||
<LI><A HREF=#4_7_10>4.7.10 Set Default Destination (CUPS_SET_DEFAULT =
|
||||
0x400A)</A></LI>
|
||||
</UL>
|
||||
<LI><A HREF=#4_7>4.7 Line Printer Daemon Protocol</A></LI>
|
||||
<LI><A HREF=#4_8>4.8 Server Message Block Protocol</A></LI>
|
||||
<LI><A HREF=#4_8>4.8 Line Printer Daemon Protocol</A></LI>
|
||||
<LI><A HREF=#4_9>4.9 Server Message Block Protocol</A></LI>
|
||||
<LI><A HREF=#4_10>4.10 Trivial File Transfer Protocol</A></LI>
|
||||
</UL>
|
||||
<B><A HREF=#5>5 5 - Directories</A></B>
|
||||
<BR>
|
||||
@@ -131,10 +133,10 @@ following sections: </P>
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft) </LI>
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1 </LI>
|
||||
<LI>IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>IPP/1.0: Implementers Guide </LI>
|
||||
<LI>IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol </LI>
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide </LI>
|
||||
</UL>
|
||||
<H1><A NAME=3>3 Internal Interfaces</A></H1>
|
||||
<H2><A NAME=3_1>3.1 Character Set Files</A></H2>
|
||||
@@ -283,18 +285,13 @@ understood:
|
||||
<TABLE BORDER=1 WIDTH=90%>
|
||||
<TR><TH WIDTH=25%>Directive</TH><TH>Description</TH></TR>
|
||||
<TR><TD><Class name>
|
||||
<BR> </Class></TD><TD>Surrounds a class definition.</TD></TR>
|
||||
<BR> </Class></TD><TD></TR>
|
||||
<TR><TD><DefaultClass name>
|
||||
<BR> </Class></TD><TD>Surrounds a class definition for the default
|
||||
destination.</TD></TR>
|
||||
<TR><TD>Accepting</TD><TD>Specifies whether the class is accepting new
|
||||
jobs. May be the names "Yes" or "No".</TD></TR>
|
||||
<TR><TD>Info</TD><TD>A textual description of the class.</TD></TR>
|
||||
<TR><TD>Location</TD><TD>A textual location of the class.</TD></TR>
|
||||
<TR><TD>MoreInfo</TD><TD>A URL pointing to additional information on
|
||||
the class.</TD></TR>
|
||||
<TR><TD>Printer</TD><TD>Specifies a printer that is a member of the
|
||||
class.</TD></TR>
|
||||
<BR> </Class></TD><TD></TR>
|
||||
<TR><TD>Info</TD><TD></TR>
|
||||
<TR><TD>Location</TD><TD></TR>
|
||||
<TR><TD>MoreInfo</TD><TD></TR>
|
||||
<TR><TD>Printer</TD><TD></TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
</P>
|
||||
@@ -307,92 +304,43 @@ understood:
|
||||
<CENTER>
|
||||
<TABLE BORDER=1 WIDTH=90%>
|
||||
<TR><TH WIDTH=25%>Directive</TH><TH>Default</TH><TH>Description</TH></TR>
|
||||
<TR><TD>AccessLog</TD><TD>logs/access_log</TD><TD>Specifies the
|
||||
location of the access log file.</TD></TR>
|
||||
<TR><TD>Allow</TD><TD>-</TD><TD>Allows connections from the specified
|
||||
host, network, or domain.</TD></TR>
|
||||
<TR><TD>AuthClass</TD><TD>-</TD><TD>Specifies what level of
|
||||
authentication is required; may be either "User", "System", or "Group".</TD>
|
||||
</TR>
|
||||
<TR><TD>AuthType</TD><TD>None</TD><TD>Specifies the type of
|
||||
authentication to perform; may be either "None" or "Basic".</TD></TR>
|
||||
<TR><TD>BrowseAddress</TD><TD>255.255.255.255</TD><TD>Specifies a
|
||||
broadcast address to send CUPS browsing packets to.</TD></TR>
|
||||
<TR><TD>BrowseInterval</TD><TD>30</TD><TD>Specifies the number of
|
||||
seconds between browsing updates.</TD></TR>
|
||||
<TR><TD>BrowsePort</TD><TD>631</TD><TD>Specifies the UDP port number to
|
||||
use for browse packets.</TD></TR>
|
||||
<TR><TD>BrowseTimeout</TD><TD>300</TD><TD>Specifies the number of
|
||||
seconds to wait until remote destinations are removed from the local
|
||||
destination list.</TD></TR>
|
||||
<TR><TD>Browsing</TD><TD>On</TD><TD>Specifies whether or not printer
|
||||
and class browsing is enabled; can be "On" or "Off".</TD></TR>
|
||||
<TR><TD>DefaultCharset</TD><TD>iso-8859-1</TD><TD>Specifies the default
|
||||
character set.</TD></TR>
|
||||
<TR><TD>DefaultLanguage</TD><TD>current locale</TD><TD>Specifies the
|
||||
default language.</TD></TR>
|
||||
<TR><TD>Deny</TD><TD>-</TD><TD>Refuses connections from the specified
|
||||
host, network, or domain.</TD></TR>
|
||||
<TR><TD>DocumentRoot</TD><TD>/usr/share/cups/doc</TD><TD>Specifies the
|
||||
document data root directory.</TD></TR>
|
||||
<TR><TD>ErrorLog</TD><TD>logs/error_log</TD><TD>Specifies the error log
|
||||
file location.</TD></TR>
|
||||
<TR><TD>Group</TD><TD>root, sys, system</TD><TD>Specifies the group
|
||||
name or ID that is used when running external programs.</TD></TR>
|
||||
<TR><TD>HostNameLookups</TD><TD>Off</TD><TD>Specifies whether or not to
|
||||
perform reverse IP address lookups to get the actual hostname; may be
|
||||
"On" or "Off". Hostname lookups can significantly degrade the
|
||||
performance of the CUPS server if one or more DNS servers is not
|
||||
functioning properly.</TD></TR>
|
||||
<TR><TD>ImplicitClasses</TD><TD>On</TD><TD>Specifies whether or not to
|
||||
automatically create printer classes when more than one printer or
|
||||
class of the same name is detected on the network; may be "On" or
|
||||
"Off".</TD></TR>
|
||||
<TR><TD>KeepAlive</TD><TD>On</TD><TD>Specifies whether or not to use
|
||||
the HTTP Keep-Alive feature; may be "On" or "Off".</TD></TR>
|
||||
<TR><TD>KeepAliveTimeout</TD><TD>30</TD><TD>Specifies the amount of
|
||||
time to keep the HTTP connection alive before closing it.</TD></TR>
|
||||
<TR><TD>AccessLog</TD><TD><TD>Specifies the location of the access log
|
||||
file (default "logs/access_log").</TD></TR>
|
||||
<TR><TD>Allow</TD><TD><TD></TR>
|
||||
<TR><TD>AuthClass</TD><TD><TD></TR>
|
||||
<TR><TD>AuthType</TD><TD><TD></TR>
|
||||
<TR><TD>BrowseAddress</TD><TD><TD></TR>
|
||||
<TR><TD>BrowseInterval</TD><TD><TD></TR>
|
||||
<TR><TD>BrowsePort</TD><TD><TD></TR>
|
||||
<TR><TD>BrowseTimeout</TD><TD><TD></TR>
|
||||
<TR><TD>Browsing</TD><TD><TD></TR>
|
||||
<TR><TD>DefaultCharset</TD><TD><TD></TR>
|
||||
<TR><TD>DefaultLanguage</TD><TD><TD></TR>
|
||||
<TR><TD>Deny</TD><TD><TD></TR>
|
||||
<TR><TD>DocumentRoot</TD><TD><TD></TR>
|
||||
<TR><TD>ErrorLog</TD><TD><TD></TR>
|
||||
<TR><TD>Group</TD><TD><TD></TR>
|
||||
<TR><TD>HostNameLookups</TD><TD><TD></TR>
|
||||
<TR><TD>ImplicitClasses</TD><TD><TD></TR>
|
||||
<TR><TD>KeepAlive</TD><TD><TD></TR>
|
||||
<TR><TD>KeepAliveTimeout</TD><TD><TD></TR>
|
||||
<TR><TD><Location path>
|
||||
<BR> </Location></TD><TD>-</TD><TD>Specifies a location to restrict
|
||||
access to.</TD></TR>
|
||||
<TR><TD>LogLevel</TD><TD>info</TD><TD>Controls the amount of
|
||||
information that is logged in the error log file. Can be one of
|
||||
"debug", "info", "warn", "error", or "none", in decreasing order or
|
||||
verbosity.</TD></TR>
|
||||
<TR><TD>MaxClients</TD><TD>100</TD><TD>Specifies the maximum number of
|
||||
simultaneous active clients. This value is internally limited to 1/3
|
||||
of the total number of availabel file descriptors.</TD></TR>
|
||||
<TR><TD>MaxLogSize</TD><TD>0</TD><TD>Specifies the maximum size of the
|
||||
access, error, and page log files in bytes. If set to 0 then no
|
||||
maximum size is set. Log files are rotated automatically when this
|
||||
size is exceeded.</TD></TR>
|
||||
<TR><TD>MaxRequestSize</TD><TD>0</TD><TD>Specifies the maximum size of
|
||||
HTTP requests in bytes. If set to 0 then there is no maximum.</TD></TR>
|
||||
<TR><TD>Order</TD><TD>Allow,Deny</TD><TD>Specifies the order of Allow
|
||||
and Deny directive processing; can be "Deny,Allow" to implicitly deny
|
||||
hosts unless they are allowed by an Allow line, or "Allow,Deny" to
|
||||
implicitly allow hosts unless they are denied by a Deny line.</TD></TR>
|
||||
<TR><TD>PageLog</TD><TD>logs/page_log</TD><TD>Specifies the location of
|
||||
the page log file.</TD></TR>
|
||||
<TR><TD>Port</TD><TD>631</TD><TD>Specifies a port number to listen to
|
||||
for HTTP connections.</TD></TR>
|
||||
<TR><TD>RIPCache</TD><TD>8m</TD><TD>Specifies the size of the memory
|
||||
cache in bytes that is used by RIP filters.</TD></TR>
|
||||
<TR><TD>ServerAdmin</TD><TD>root@ServerName</TD><TD>Specifies the
|
||||
person to contact with problems.</TD></TR>
|
||||
<TR><TD>ServerName</TD><TD>hostname</TD><TD>Specifies the hostname that
|
||||
is supplied to HTTP clients. This is also used to determine the
|
||||
default CUPS server for the CUPS IPP client applications.</TD></TR>
|
||||
<TR><TD>ServerRoot</TD><TD>/var/cups</TD><TD>Specifies the root
|
||||
directory for server data files.</TD></TR>
|
||||
<TR><TD>SystemGroup</TD><TD>root, sys, system</TD><TD>Specifies the
|
||||
group name used for System class authentication.</TD></TR>
|
||||
<TR><TD>TempDir</TD><TD>/var/tmp</TD><TD>Specifies the temporary
|
||||
directory to use.</TD></TR>
|
||||
<TR><TD>Timeout</TD><TD>300</TD><TD>The timeout in seconds before
|
||||
client connections are closed in the middle of a request.</TD></TR>
|
||||
<TR><TD>User</TD><TD>lp</TD><TD>Specifies the user that is used when
|
||||
running external programs.</TD></TR>
|
||||
<BR> </Location></TD><TD><TD></TR>
|
||||
<TR><TD>LogLevel</TD><TD><TD></TR>
|
||||
<TR><TD>MaxClients</TD><TD><TD></TR>
|
||||
<TR><TD>MaxLogSize</TD><TD><TD></TR>
|
||||
<TR><TD>MaxRequestSize</TD><TD><TD></TR>
|
||||
<TR><TD>Order</TD><TD><TD></TR>
|
||||
<TR><TD>PageLog</TD><TD><TD></TR>
|
||||
<TR><TD>Port</TD><TD><TD></TR>
|
||||
<TR><TD>RIPCache</TD><TD><TD></TR>
|
||||
<TR><TD>ServerAdmin</TD><TD><TD></TR>
|
||||
<TR><TD>ServerName</TD><TD><TD></TR>
|
||||
<TR><TD>ServerRoot</TD><TD><TD></TR>
|
||||
<TR><TD>SystemGroup</TD><TD><TD></TR>
|
||||
<TR><TD>TempDir</TD><TD><TD></TR>
|
||||
<TR><TD>Timeout</TD><TD><TD></TR>
|
||||
<TR><TD>User</TD><TD><TD></TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
</P>
|
||||
@@ -405,28 +353,22 @@ understood:
|
||||
<CENTER>
|
||||
<TABLE BORDER=1 WIDTH=90%>
|
||||
<TR><TH WIDTH=25%>Directive</TH><TH>Description</TH></TR>
|
||||
<TR><TD>Accepting</TD><TD>Specifies whether the printer is accepting
|
||||
new jobs. May be the names "Yes" or "No".</TD></TR>
|
||||
<TR><TD><DefaultPrinter name>
|
||||
<BR> </Printer></TD><TD>Surrounds the printer definition for a default
|
||||
destination.</TD></TR>
|
||||
<TR><TD>DeviceURI</TD><TD>Specifies the device-uri attribute for the
|
||||
printer.</TD></TR>
|
||||
<TR><TD>Info</TD><TD>A textual description of the printer.</TD></TR>
|
||||
<TR><TD>Location</TD><TD>A textual location of the printer.</TD></TR>
|
||||
<TR><TD>MoreInfo</TD><TD>A URL pointing to additional information on
|
||||
the printer.</TD></TR>
|
||||
<BR> </Printer></TD><TD></TR>
|
||||
<TR><TD>DeviceURI</TD><TD></TR>
|
||||
<TR><TD>Info</TD><TD></TR>
|
||||
<TR><TD>Location</TD><TD></TR>
|
||||
<TR><TD>MoreInfo</TD><TD></TR>
|
||||
<TR><TD><Printer name>
|
||||
<BR> </Printer></TD><TD>Surrounds the printer definition.</TD></TR>
|
||||
<TR><TD>State</TD><TD>Specifies the initial state of the printer; can
|
||||
be "Idle" or "Stopped".</TD></TR>
|
||||
<BR> </Printer></TD><TD></TR>
|
||||
<TR><TD>State</TD><TD></TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
</P>
|
||||
<H1><A NAME=4>4 External Interfaces</A></H1>
|
||||
<H2><A NAME=4_1>4.1 AppSocket Protocol</A></H2>
|
||||
<P>The AppSocket protocol is an 8-bit clean TCP/IP socket connection.
|
||||
The default IP service port is 9100. The URI method name is "socket". </P>
|
||||
The default IP service port is 9100. </P>
|
||||
<H2><A NAME=4_2>4.2 CUPS Browsing Protocol</A></H2>
|
||||
<P>The CUPS Browsing Protocol is a UDP/IP-based broadcast service. By
|
||||
default this service operates on IP service port 631. </P>
|
||||
@@ -603,7 +545,10 @@ application/vnd.cups-raster</CODE>. </P>
|
||||
<P>Raw files are printer-dependent print files that are in a format
|
||||
suitable to the destination printer (e.g. HP-PCL, HP-RTL, etc.) The
|
||||
MIME type for CUPS Raw files is <CODE>application/vnd.cups-raw</CODE>. </P>
|
||||
<H2><A NAME=4_6>4.6 Internet Printing Protocol</A></H2>
|
||||
<H2><A NAME=4_6>4.6 File Transfer Protocol</A></H2>
|
||||
<P>The File Transfer Protocol (FTP) is described by <A HREF=http://www.ietf.org/rfc/rfc959.txt>
|
||||
RFC 959: File Transfer Protocol</A>. </P>
|
||||
<H2><A NAME=4_7>4.7 Internet Printing Protocol</A></H2>
|
||||
<P>The Internet Printing Protocol is described by the following RFCs: </P>
|
||||
<UL>
|
||||
<LI><A HREF=http://www.ietf.org/rfc/rfc2565.txt>RFC 2565: Internet
|
||||
@@ -618,21 +563,20 @@ Protocol</A></LI>
|
||||
<LI><A HREF=http://www.ietf.org/rfc/rfc2569.txt>RFC 2569: Mapping
|
||||
between LPD and IPP Protocols</A></LI>
|
||||
</UL>
|
||||
<P>The URI method name for IPP is "ipp". </P>
|
||||
<P>CUPS defines the following extension operations to IPP. </P>
|
||||
<H3><A NAME=4_6_1>4.6.1 Get Default Destination (CUPS_GET_DEFAULT =
|
||||
<H3><A NAME=4_7_1>4.7.1 Get Default Destination (CUPS_GET_DEFAULT =
|
||||
0x4001)</A></H3>
|
||||
<P>The get default destination operation returns the printer attributes
|
||||
for the system default printer or class. The only required attributes
|
||||
are <CODE>attributes-charset</CODE> and <CODE>
|
||||
attributes-natural-language</CODE>. </P>
|
||||
<P>Get default destination will only return <CODE>ipp-ok</CODE>. </P>
|
||||
<H3><A NAME=4_6_2>4.6.2 Get Printers (CUPS_GET_PRINTERS = 0x4002)</A></H3>
|
||||
<H3><A NAME=4_7_2>4.7.2 Get Printers (CUPS_GET_PRINTERS = 0x4002)</A></H3>
|
||||
<P>The get printers operation returns the printer attributes for all
|
||||
printers known to the system. The only required attributes are <CODE>
|
||||
attributes-charset</CODE> and <CODE>attributes-natural-language</CODE>. </P>
|
||||
<P>Get printers will only return <CODE>ipp-ok</CODE>. </P>
|
||||
<H3><A NAME=4_6_3>4.6.3 Add Printer (CUPS_ADD_PRINTER = 0x4003)</A></H3>
|
||||
<H3><A NAME=4_7_3>4.7.3 Add Printer (CUPS_ADD_PRINTER = 0x4003)</A></H3>
|
||||
<P>The add printer operation adds or replaces the specified printer.
|
||||
The <CODE>attributes-charset</CODE>, <CODE>attributes-natural-language</CODE>
|
||||
and <CODE>printer-uri</CODE> attributes are required. </P>
|
||||
@@ -645,19 +589,19 @@ body. If a valid interface script or PPD file is not provided then the
|
||||
printer is treated as a generic PostScript device. </P>
|
||||
<P>Add printer will return <CODE>ipp-ok</CODE>, <CODE>ipp-not-authorized</CODE>
|
||||
, <CODE>ipp-bad-request</CODE>, or <CODE>ipp-attributes</CODE>. </P>
|
||||
<H3><A NAME=4_6_4>4.6.4 Delete Printer (CUPS_DELETE_PRINTER = 0x4004)</A>
|
||||
<H3><A NAME=4_7_4>4.7.4 Delete Printer (CUPS_DELETE_PRINTER = 0x4004)</A>
|
||||
</H3>
|
||||
<P>The delete printer operation removes the specified printer. The only
|
||||
required attributes are <CODE>attributes-charset</CODE>, <CODE>
|
||||
attributes-natural-language</CODE>, and <CODE>printer-uri</CODE>. </P>
|
||||
<P>Delete printer will return <CODE>ipp-ok</CODE>, <CODE>ipp-not-found</CODE>
|
||||
, or <CODE>ipp-not-authorized</CODE>. </P>
|
||||
<H3><A NAME=4_6_5>4.6.5 Get Classes (CUPS_GET_CLASSES = 0x4005)</A></H3>
|
||||
<H3><A NAME=4_7_5>4.7.5 Get Classes (CUPS_GET_CLASSES = 0x4005)</A></H3>
|
||||
<P>The get classes operation returns the printer attributes for all
|
||||
classes known to the system. The only required attributes are <CODE>
|
||||
attributes-charset</CODE> and <CODE>attributes-natural-language</CODE>. </P>
|
||||
<P>Get classes will only return <CODE>ipp-ok</CODE>. </P>
|
||||
<H3><A NAME=4_6_6>4.6.6 Add Class (CUPS_ADD_CLASS = 0x4006)</A></H3>
|
||||
<H3><A NAME=4_7_6>4.7.6 Add Class (CUPS_ADD_CLASS = 0x4006)</A></H3>
|
||||
<P>The add class operation adds or replaces the specified class. The <CODE>
|
||||
attributes-charset</CODE>, <CODE>attributes-natural-language</CODE>,
|
||||
and <CODE>printer-uri</CODE> attributes are required. </P>
|
||||
@@ -667,27 +611,27 @@ required when initially adding a printer and optional when modifying a
|
||||
printer. </P>
|
||||
<P>Add class will return <CODE>ipp-ok</CODE>, <CODE>ipp-not-authorized</CODE>
|
||||
, <CODE>ipp-bad-request</CODE>, or <CODE>ipp-attributes</CODE>. </P>
|
||||
<H3><A NAME=4_6_7>4.6.7 Delete Class (CUPS_DELETE_CLASS = 0x4007)</A></H3>
|
||||
<H3><A NAME=4_7_7>4.7.7 Delete Class (CUPS_DELETE_CLASS = 0x4007)</A></H3>
|
||||
<P>The delete class operation removes the specified class. The only
|
||||
required attributes are <CODE>attributes-charset</CODE>, <CODE>
|
||||
attributes-natural-language</CODE>, and <CODE>printer-uri</CODE>. </P>
|
||||
<P>Delete class will return <CODE>ipp-ok</CODE>, <CODE>ipp-not-found</CODE>
|
||||
, or <CODE>ipp-not-authorized</CODE>. </P>
|
||||
<H3><A NAME=4_6_8>4.6.8 Accept Jobs (CUPS_ACCEPT_JOBS = 0x4008)</A></H3>
|
||||
<H3><A NAME=4_7_8>4.7.8 Accept Jobs (CUPS_ACCEPT_JOBS = 0x4008)</A></H3>
|
||||
<P>The accept jobs operation allows jobs to be accepted by the
|
||||
specified destination. The only required attributes are <CODE>
|
||||
attributes-charset</CODE>, <CODE>attributes-natural-language</CODE>,
|
||||
and <CODE>printer-uri</CODE>. </P>
|
||||
<P>Accept jobs will return <CODE>ipp-ok</CODE>, <CODE>ipp-not-found</CODE>
|
||||
, or <CODE>ipp-not-authorized</CODE>. </P>
|
||||
<H3><A NAME=4_6_9>4.6.9 Reject Jobs (CUPS_REJECT_JOBS = 0x4009)</A></H3>
|
||||
<H3><A NAME=4_7_9>4.7.9 Reject Jobs (CUPS_REJECT_JOBS = 0x4009)</A></H3>
|
||||
<P>The reject jobs operation prevents jobs from being accepted by the
|
||||
specified destination. The only required attributes are <CODE>
|
||||
attributes-charset</CODE>, <CODE>attributes-natural-language</CODE>,
|
||||
and <CODE>printer-uri</CODE>. </P>
|
||||
<P>Reject jobs will return <CODE>ipp-ok</CODE>, <CODE>ipp-not-found</CODE>
|
||||
, or <CODE>ipp-not-authorized</CODE>. </P>
|
||||
<H3><A NAME=4_6_10>4.6.10 Set Default Destination (CUPS_SET_DEFAULT =
|
||||
<H3><A NAME=4_7_10>4.7.10 Set Default Destination (CUPS_SET_DEFAULT =
|
||||
0x400A)</A></H3>
|
||||
<P>The set default destination operation returns the printer attributes
|
||||
for the system default printer or class. The only required attributes
|
||||
@@ -696,24 +640,27 @@ are <CODE>attributes-charset</CODE>, <CODE>attributes-natural-language</CODE>
|
||||
<P>Set default destination will return <CODE>ipp-ok</CODE>, <CODE>
|
||||
ipp-not-authorized</CODE>, <CODE>ipp-bad-request</CODE>, or <CODE>
|
||||
ipp-not-found</CODE>. </P>
|
||||
<H2><A NAME=4_7>4.7 Line Printer Daemon Protocol</A></H2>
|
||||
<H2><A NAME=4_8>4.8 Line Printer Daemon Protocol</A></H2>
|
||||
<P>The Line Printer Daemon (LPD) protocol is described by <A HREF=http://www.ietf.org/rfc/rfc1179.txt>
|
||||
RFC 1179: Line Printer Daemon Protocol</A>. </P>
|
||||
<P>The URI method name for LPD is "lpd". </P>
|
||||
<H2><A NAME=4_8>4.8 Server Message Block Protocol</A></H2>
|
||||
<H2><A NAME=4_9>4.9 Server Message Block Protocol</A></H2>
|
||||
<P>The Server Message Block (SMB) and related Common Internet File
|
||||
System (CIFS) protocols are described at <A HREF=http://anu.samba.org/cifs>
|
||||
http://anu.samba.org/cifs</A>. </P>
|
||||
<P>The URI method name for SMB is "smb". </P>
|
||||
<H2><A NAME=4_10>4.10 Trivial File Transfer Protocol</A></H2>
|
||||
<P>The Trivial File Transfer Protocol (TFTP) is described by <A HREF=http://www.ietf.org/rfc/rfc1350.txt>
|
||||
RFC 1350: The TFTP Protocol (Revision 2)</A>. </P>
|
||||
<H1><A NAME=5>5 5 - Directories</A></H1>
|
||||
<DL>
|
||||
<DT>/usr/bin </DT>
|
||||
<DD>The <CODE>cancel</CODE>, <CODE>lp</CODE>, <CODE>lpq</CODE>, <CODE>
|
||||
lpr</CODE>, <CODE>lprm</CODE>, and <CODE>lpstat</CODE> commands reside
|
||||
here. </DD>
|
||||
<DT>/usr/lib </DT>
|
||||
<DD>The <CODE>accept</CODE>, <CODE>disable</CODE>, <CODE>enable</CODE>, <CODE>
|
||||
lpadmin</CODE>, and <CODE>reject</CODE> commands reside here. </DD>
|
||||
<DT>/usr/sbin </DT>
|
||||
<DD>The <CODE>accept</CODE>, <CODE>cupsd</CODE>, <CODE>lpadmin</CODE>, <CODE>
|
||||
lpc</CODE>, and <CODE>reject</CODE> commands reside here. </DD>
|
||||
<DD>The <CODE>lpc</CODE> and <CODE>cupsd</CODE> commands resize here. </DD>
|
||||
<DT>/usr/share/cups </DT>
|
||||
<DD>This is the root directory of the CUPS static data. </DD>
|
||||
<DT>/usr/share/cups/data </DT>
|
||||
|
||||
+1206
-1147
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+105
-136
@@ -3,7 +3,7 @@
|
||||
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
|
||||
<META NAME="DOCNUMBER" CONTENT="CUPS-IDD-1.0">
|
||||
<META NAME="Author" CONTENT="Easy Software Products">
|
||||
<TITLE>CUPS Interface Design Description</TITLE>
|
||||
<TITLE>DRAFT - CUPS Interface Design Description</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
@@ -74,10 +74,10 @@ sections:
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft)
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1
|
||||
<LI>IPP/1.0: Encoding and Transport
|
||||
<LI>IPP/1.0: Implementers Guide
|
||||
<LI>IPP/1.0: Model and Semantics
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide
|
||||
</UL>
|
||||
|
||||
<H1>Internal Interfaces</H1>
|
||||
@@ -269,33 +269,28 @@ followed by its value. The following directives are understood:
|
||||
<TR>
|
||||
<TD><Class name><BR>
|
||||
</Class></TD>
|
||||
<TD>Surrounds a class definition.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><DefaultClass name><BR>
|
||||
</Class></TD>
|
||||
<TD>Surrounds a class definition for the default destination.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Accepting</TD>
|
||||
<TD>Specifies whether the class is accepting new jobs. May be
|
||||
the names "Yes" or "No".</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Info</TD>
|
||||
<TD>A textual description of the class.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Location</TD>
|
||||
<TD>A textual location of the class.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>MoreInfo</TD>
|
||||
<TD>A URL pointing to additional information on the class.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Printer</TD>
|
||||
<TD>Specifies a printer that is a member of the class.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
|
||||
@@ -315,208 +310,180 @@ followed by its value. The following directives are understood:
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>AccessLog</TD>
|
||||
<TD>logs/access_log</TD>
|
||||
<TD>Specifies the location of the access log file.</TD>
|
||||
<TD></TD>
|
||||
<TD>Specifies the location of the access log file (default
|
||||
"logs/access_log").</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Allow</TD>
|
||||
<TD>-</TD>
|
||||
<TD>Allows connections from the specified host, network, or
|
||||
domain.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>AuthClass</TD>
|
||||
<TD>-</TD>
|
||||
<TD>Specifies what level of authentication is required; may be either
|
||||
"User", "System", or "Group".</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>AuthType</TD>
|
||||
<TD>None</TD>
|
||||
<TD>Specifies the type of authentication to perform; may be either
|
||||
"None" or "Basic".</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BrowseAddress</TD>
|
||||
<TD>255.255.255.255</TD>
|
||||
<TD>Specifies a broadcast address to send CUPS browsing packets to.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BrowseInterval</TD>
|
||||
<TD>30</TD>
|
||||
<TD>Specifies the number of seconds between browsing updates.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BrowsePort</TD>
|
||||
<TD>631</TD>
|
||||
<TD>Specifies the UDP port number to use for browse packets.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BrowseTimeout</TD>
|
||||
<TD>300</TD>
|
||||
<TD>Specifies the number of seconds to wait until remote destinations
|
||||
are removed from the local destination list.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Browsing</TD>
|
||||
<TD>On</TD>
|
||||
<TD>Specifies whether or not printer and class browsing is enabled; can
|
||||
be "On" or "Off".</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>DefaultCharset</TD>
|
||||
<TD>iso-8859-1</TD>
|
||||
<TD>Specifies the default character set.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>DefaultLanguage</TD>
|
||||
<TD>current locale</TD>
|
||||
<TD>Specifies the default language.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Deny</TD>
|
||||
<TD>-</TD>
|
||||
<TD>Refuses connections from the specified host, network, or
|
||||
domain.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>DocumentRoot</TD>
|
||||
<TD>/usr/share/cups/doc</TD>
|
||||
<TD>Specifies the document data root directory.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>ErrorLog</TD>
|
||||
<TD>logs/error_log</TD>
|
||||
<TD>Specifies the error log file location.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Group</TD>
|
||||
<TD>root, sys, system</TD>
|
||||
<TD>Specifies the group name or ID that is used when running
|
||||
external programs.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>HostNameLookups</TD>
|
||||
<TD>Off</TD>
|
||||
<TD>Specifies whether or not to perform reverse IP address lookups to
|
||||
get the actual hostname; may be "On" or "Off". Hostname lookups can
|
||||
significantly degrade the performance of the CUPS server if one or
|
||||
more DNS servers is not functioning properly.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>ImplicitClasses</TD>
|
||||
<TD>On</TD>
|
||||
<TD>Specifies whether or not to automatically create printer classes
|
||||
when more than one printer or class of the same name is detected on
|
||||
the network; may be "On" or "Off".</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>KeepAlive</TD>
|
||||
<TD>On</TD>
|
||||
<TD>Specifies whether or not to use the HTTP Keep-Alive feature; may
|
||||
be "On" or "Off".</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>KeepAliveTimeout</TD>
|
||||
<TD>30</TD>
|
||||
<TD>Specifies the amount of time to keep the HTTP connection alive
|
||||
before closing it.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><Location path><BR>
|
||||
</Location></TD>
|
||||
<TD>-</TD>
|
||||
<TD>Specifies a location to restrict access to.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>LogLevel</TD>
|
||||
<TD>info</TD>
|
||||
<TD>Controls the amount of information that is logged in the
|
||||
error log file. Can be one of "debug", "info", "warn", "error",
|
||||
or "none", in decreasing order or verbosity.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>MaxClients</TD>
|
||||
<TD>100</TD>
|
||||
<TD>Specifies the maximum number of simultaneous active clients.
|
||||
This value is internally limited to 1/3 of the total number of
|
||||
availabel file descriptors.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>MaxLogSize</TD>
|
||||
<TD>0</TD>
|
||||
<TD>Specifies the maximum size of the access, error, and page
|
||||
log files in bytes. If set to 0 then no maximum size is set.
|
||||
Log files are rotated automatically when this size is
|
||||
exceeded.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>MaxRequestSize</TD>
|
||||
<TD>0</TD>
|
||||
<TD>Specifies the maximum size of HTTP requests in bytes. If set to 0
|
||||
then there is no maximum.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Order</TD>
|
||||
<TD>Allow,Deny</TD>
|
||||
<TD>Specifies the order of Allow and Deny directive processing; can
|
||||
be "Deny,Allow" to implicitly deny hosts unless they are allowed by
|
||||
an Allow line, or "Allow,Deny" to implicitly allow hosts unless they
|
||||
are denied by a Deny line.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>PageLog</TD>
|
||||
<TD>logs/page_log</TD>
|
||||
<TD>Specifies the location of the page log file.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Port</TD>
|
||||
<TD>631</TD>
|
||||
<TD>Specifies a port number to listen to for HTTP connections.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>RIPCache</TD>
|
||||
<TD>8m</TD>
|
||||
<TD>Specifies the size of the memory cache in bytes that is used by
|
||||
RIP filters.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>ServerAdmin</TD>
|
||||
<TD>root@ServerName</TD>
|
||||
<TD>Specifies the person to contact with problems.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>ServerName</TD>
|
||||
<TD>hostname</TD>
|
||||
<TD>Specifies the hostname that is supplied to HTTP clients. This
|
||||
is also used to determine the default CUPS server for the CUPS IPP
|
||||
client applications.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>ServerRoot</TD>
|
||||
<TD>/var/cups</TD>
|
||||
<TD>Specifies the root directory for server data files.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>SystemGroup</TD>
|
||||
<TD>root, sys, system</TD>
|
||||
<TD>Specifies the group name used for System class authentication.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>TempDir</TD>
|
||||
<TD>/var/tmp</TD>
|
||||
<TD>Specifies the temporary directory to use.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Timeout</TD>
|
||||
<TD>300</TD>
|
||||
<TD>The timeout in seconds before client connections are closed
|
||||
in the middle of a request.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>User</TD>
|
||||
<TD>lp</TD>
|
||||
<TD>Specifies the user that is used when running external programs.</TD>
|
||||
<TD></TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
|
||||
@@ -533,41 +500,35 @@ followed by its value. The following directives are understood:
|
||||
<TH WIDTH="25%">Directive</TH>
|
||||
<TH>Description</TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Accepting</TD>
|
||||
<TD>Specifies whether the printer is accepting new jobs. May be
|
||||
the names "Yes" or "No".</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><DefaultPrinter name><BR>
|
||||
</Printer></TD>
|
||||
<TD>Surrounds the printer definition for a default destination.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>DeviceURI</TD>
|
||||
<TD>Specifies the device-uri attribute for the printer.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Info</TD>
|
||||
<TD>A textual description of the printer.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Location</TD>
|
||||
<TD>A textual location of the printer.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>MoreInfo</TD>
|
||||
<TD>A URL pointing to additional information on the printer.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><Printer name><BR>
|
||||
</Printer></TD>
|
||||
<TD>Surrounds the printer definition.</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>State</TD>
|
||||
<TD>Specifies the initial state of the printer; can be "Idle" or
|
||||
"Stopped".</TD>
|
||||
<TD></TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
|
||||
@@ -576,7 +537,7 @@ followed by its value. The following directives are understood:
|
||||
<H2>AppSocket Protocol</H2>
|
||||
|
||||
<P>The AppSocket protocol is an 8-bit clean TCP/IP socket connection.
|
||||
The default IP service port is 9100. The URI method name is "socket".
|
||||
The default IP service port is 9100.
|
||||
|
||||
<H2>CUPS Browsing Protocol</H2>
|
||||
|
||||
@@ -951,6 +912,12 @@ raster data for that page.
|
||||
to the destination printer (e.g. HP-PCL, HP-RTL, etc.) The MIME type for CUPS
|
||||
Raw files is <CODE>application/vnd.cups-raw</CODE>.
|
||||
|
||||
<H2>File Transfer Protocol</H2>
|
||||
|
||||
<P>The File Transfer Protocol (FTP) is described by
|
||||
<A HREF="http://www.ietf.org/rfc/rfc959.txt">RFC 959: File Transfer
|
||||
Protocol</A>.
|
||||
|
||||
<H2>Internet Printing Protocol</H2>
|
||||
|
||||
<P>The Internet Printing Protocol is described by the following RFCs:
|
||||
@@ -975,8 +942,6 @@ Raw files is <CODE>application/vnd.cups-raw</CODE>.
|
||||
|
||||
</UL>
|
||||
|
||||
<P>The URI method name for IPP is "ipp".
|
||||
|
||||
<P>CUPS defines the following extension operations to IPP.
|
||||
|
||||
<H3>Get Default Destination (CUPS_GET_DEFAULT = 0x4001)</H3>
|
||||
@@ -1097,15 +1062,17 @@ are <CODE>attributes-charset</CODE>,
|
||||
<A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179: Line Printer Daemon
|
||||
Protocol</A>.
|
||||
|
||||
<P>The URI method name for LPD is "lpd".
|
||||
|
||||
<H2>Server Message Block Protocol</H2>
|
||||
|
||||
<P>The Server Message Block (SMB) and related Common Internet File
|
||||
System (CIFS) protocols are described at
|
||||
<A HREF="http://anu.samba.org/cifs">http://anu.samba.org/cifs</A>.
|
||||
|
||||
<P>The URI method name for SMB is "smb".
|
||||
<H2>Trivial File Transfer Protocol</H2>
|
||||
|
||||
<P>The Trivial File Transfer Protocol (TFTP) is described by
|
||||
<A HREF="http://www.ietf.org/rfc/rfc1350.txt">RFC 1350: The TFTP Protocol
|
||||
(Revision 2)</A>.
|
||||
|
||||
<H1>5 - Directories</H1>
|
||||
|
||||
@@ -1116,10 +1083,12 @@ System (CIFS) protocols are described at
|
||||
<CODE>lpr</CODE>, <CODE>lprm</CODE>, and <CODE>lpstat</CODE> commands
|
||||
reside here.
|
||||
|
||||
<DT>/usr/lib
|
||||
<DD>The <CODE>accept</CODE>, <CODE>disable</CODE>, <CODE>enable</CODE>,
|
||||
<CODE>lpadmin</CODE>, and <CODE>reject</CODE> commands reside here.
|
||||
|
||||
<DT>/usr/sbin
|
||||
<DD>The <CODE>accept</CODE>, <CODE>cupsd</CODE>,
|
||||
<CODE>lpadmin</CODE>, <CODE>lpc</CODE>, and <CODE>reject</CODE>
|
||||
commands reside here.
|
||||
<DD>The <CODE>lpc</CODE> and <CODE>cupsd</CODE> commands resize here.
|
||||
|
||||
<DT>/usr/share/cups
|
||||
<DD>This is the root directory of the CUPS static data.
|
||||
|
||||
+9
-14
@@ -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>May 11, 1999<BR>
|
||||
Michael Sweet, Easy Software Products<BR>
|
||||
Copyright 1998-1999, All Rights Reserved.</P>
|
||||
</TD>
|
||||
@@ -163,9 +163,7 @@ Apache server configuration file and defines all of the access control
|
||||
properties for the server.
|
||||
|
||||
<P>The printer and class definition files list the available printer
|
||||
queues and classes. Printer classes are collections of printers. Jobs
|
||||
sent to a class are forwarded to the first available printer in the
|
||||
class, round-robin fashion.
|
||||
queues and classes.
|
||||
|
||||
<P>The MIME type files list the supported MIME types (text/plain,
|
||||
application/postscript, etc.) and "magic" rules for automatically
|
||||
@@ -176,16 +174,13 @@ when a <I>Print-Job</I> request is received with a
|
||||
<I>document-format</I> of <I>application/octet-stream</I>.
|
||||
|
||||
<P>The MIME conversion rule files list the available filters. These
|
||||
files are augmented by <I>cupsFilter</I> entries in the printer PPD
|
||||
files. The filters are used when a job is dispatched so that an
|
||||
application can send a convenient file format to the printing system
|
||||
files are augmented by <I>AddFilter</I> entries in the printer
|
||||
definition files. The filters are used when a job is dispatched so that
|
||||
an application can send a convenient file format to the printing system
|
||||
which then converts the document into a printable format as needed.
|
||||
Each filter has a relative cost associated with it, and the filtering
|
||||
algorithm chooses the set of filters that will convert the file to the
|
||||
needed format with the lowest total "cost".
|
||||
|
||||
<P>The PPD files describe the capabilities of PostScript printers.
|
||||
There is one PPD file for each printer.
|
||||
<P>The PPD files describe the capabilities of PostScript printers. There is
|
||||
one PPD file for each printer.
|
||||
|
||||
<H3>CUPS Interface Library</H3>
|
||||
|
||||
@@ -204,8 +199,8 @@ and job options. All output is sent to the standard output.
|
||||
<H3>Backends</H3>
|
||||
|
||||
A backend program is a special filter that writes incoming data to a
|
||||
device or network connection. Backends for serial, parallel, LPD,
|
||||
IPP, SMB, and AppSocket (JetDirect) connections are provided in
|
||||
device or network connection. Backends for serial, parallel, LPD, TFTP,
|
||||
FTP, IPP, SMB, and AppSocket (JetDirect) connections are provided in
|
||||
CUPS 1.0.
|
||||
|
||||
<H2>Berkeley and System V Commands</H2>
|
||||
|
||||
Arquivo binário não exibido.
+2
-2
@@ -1,13 +1,13 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>CUPS Software Administrators Manual</TITLE>
|
||||
<TITLE>DRAFT - 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">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<CENTER><A HREF=#contents><IMG SRC="images/cups-large.gif" BORDER=0><BR>
|
||||
<H1>CUPS Software Administrators Manual</H1></A><BR>
|
||||
<H1>DRAFT - CUPS Software Administrators Manual</H1></A><BR>
|
||||
CUPS-SAM-1.0.0<BR>
|
||||
Easy Software Products<BR>
|
||||
Copyright 1997-1999, All Rights Reserved<BR>
|
||||
|
||||
+493
-509
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+1
-1
@@ -3,7 +3,7 @@
|
||||
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
|
||||
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.0.0">
|
||||
<META NAME="Author" CONTENT="Easy Software Products">
|
||||
<TITLE>CUPS Software Administrators Manual</TITLE>
|
||||
<TITLE>DRAFT - CUPS Software Administrators Manual</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
|
||||
+67
-61
@@ -1,13 +1,13 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>CUPS Software Design Description</TITLE>
|
||||
<TITLE>DRAFT - CUPS Software Design Description</TITLE>
|
||||
<META NAME="AUTHOR" CONTENT="Easy Software Products">
|
||||
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
|
||||
<META NAME="DOCNUMBER" CONTENT="CUPS-SDD-1.0">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<CENTER><A HREF=#contents><IMG SRC="images/cups-large.gif" BORDER=0><BR>
|
||||
<H1>CUPS Software Design Description</H1></A><BR>
|
||||
<H1>DRAFT - CUPS Software Design Description</H1></A><BR>
|
||||
CUPS-SDD-1.0<BR>
|
||||
Easy Software Products<BR>
|
||||
Copyright 1997-1999, All Rights Reserved<BR>
|
||||
@@ -34,7 +34,8 @@ Copyright 1997-1999, All Rights Reserved<BR>
|
||||
<LI><A HREF=#3_1_2>3.1.2 lpd</A></LI>
|
||||
<LI><A HREF=#3_1_3>3.1.3 parallel</A></LI>
|
||||
<LI><A HREF=#3_1_4>3.1.4 serial</A></LI>
|
||||
<LI><A HREF=#3_1_5>3.1.5 socket</A></LI>
|
||||
<LI><A HREF=#3_1_5>3.1.5 smb</A></LI>
|
||||
<LI><A HREF=#3_1_6>3.1.6 socket</A></LI>
|
||||
</UL>
|
||||
<LI><A HREF=#3_2>3.2 Berkeley Commands</A></LI>
|
||||
<UL>
|
||||
@@ -44,9 +45,9 @@ Copyright 1997-1999, All Rights Reserved<BR>
|
||||
</UL>
|
||||
<LI><A HREF=#3_3>3.3 CGI</A></LI>
|
||||
<UL>
|
||||
<LI><A HREF=#3_3_1>3.3.1 classes.cgi</A></LI>
|
||||
<LI><A HREF=#3_3_2>3.3.2 jobs.cgi</A></LI>
|
||||
<LI><A HREF=#3_3_3>3.3.3 printers.cgi</A></LI>
|
||||
<LI><A HREF=#3_3_1>3.3.1 classes</A></LI>
|
||||
<LI><A HREF=#3_3_2>3.3.2 jobs</A></LI>
|
||||
<LI><A HREF=#3_3_3>3.3.3 printers</A></LI>
|
||||
</UL>
|
||||
<LI><A HREF=#3_4>3.4 CUPS Interface Library</A></LI>
|
||||
<UL>
|
||||
@@ -62,11 +63,8 @@ Copyright 1997-1999, All Rights Reserved<BR>
|
||||
<UL>
|
||||
<LI><A HREF=#3_5_1>3.5.1 hpgltops</A></LI>
|
||||
<LI><A HREF=#3_5_2>3.5.2 imagetops</A></LI>
|
||||
<LI><A HREF=#3_5_3>3.5.3 imagetoraster</A></LI>
|
||||
<LI><A HREF=#3_5_4>3.5.4 pstops</A></LI>
|
||||
<LI><A HREF=#3_5_5>3.5.5 pstoraster</A></LI>
|
||||
<LI><A HREF=#3_5_6>3.5.6 rastertohp</A></LI>
|
||||
<LI><A HREF=#3_5_7>3.5.7 texttops</A></LI>
|
||||
<LI><A HREF=#3_5_3>3.5.3 pstops</A></LI>
|
||||
<LI><A HREF=#3_5_4>3.5.4 texttops</A></LI>
|
||||
</UL>
|
||||
<LI><A HREF=#3_6>3.6 Scheduler</A></LI>
|
||||
<UL>
|
||||
@@ -77,9 +75,8 @@ Copyright 1997-1999, All Rights Reserved<BR>
|
||||
<LI><A HREF=#3_6_5>3.6.5 Directory Services</A></LI>
|
||||
<LI><A HREF=#3_6_6>3.6.6 IPP</A></LI>
|
||||
<LI><A HREF=#3_6_7>3.6.7 Jobs</A></LI>
|
||||
<LI><A HREF=#3_6_8>3.6.8 Logging</A></LI>
|
||||
<LI><A HREF=#3_6_9>3.6.9 Main</A></LI>
|
||||
<LI><A HREF=#3_6_10>3.6.10 Printers</A></LI>
|
||||
<LI><A HREF=#3_6_8>3.6.8 Main</A></LI>
|
||||
<LI><A HREF=#3_6_9>3.6.9 Printers</A></LI>
|
||||
</UL>
|
||||
<LI><A HREF=#3_7>3.7 System V Commands</A></LI>
|
||||
<UL>
|
||||
@@ -93,10 +90,12 @@ Copyright 1997-1999, All Rights Reserved<BR>
|
||||
<LI><A HREF=#3_7_8>3.7.8 reject</A></LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<B><A HREF=#4>A Glossary</A></B>
|
||||
<B><A HREF=#4>4 Detailed Design</A></B>
|
||||
<BR>
|
||||
<BR><B><A HREF=#5>A Glossary</A></B>
|
||||
<UL>
|
||||
<LI><A HREF=#4_1>A.1 Terms</A></LI>
|
||||
<LI><A HREF=#4_2>A.2 Acronyms</A></LI>
|
||||
<LI><A HREF=#5_1>A.1 Terms</A></LI>
|
||||
<LI><A HREF=#5_2>A.2 Acronyms</A></LI>
|
||||
</UL>
|
||||
<HR>
|
||||
<H1><A NAME=1>1 Scope</A></H1>
|
||||
@@ -127,6 +126,7 @@ can be used to support non-PostScript printers. </P>
|
||||
<LI>1 - Scope </LI>
|
||||
<LI>2 - References </LI>
|
||||
<LI>3 - Design Overview </LI>
|
||||
<LI>4 - Detailed Design </LI>
|
||||
<LI>A - Glossary </LI>
|
||||
</UL>
|
||||
<H1><A NAME=2>2 References</A></H1>
|
||||
@@ -148,10 +148,10 @@ can be used to support non-PostScript printers. </P>
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft) </LI>
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1 </LI>
|
||||
<LI>IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>IPP/1.0: Implementers Guide </LI>
|
||||
<LI>IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol </LI>
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide </LI>
|
||||
</UL>
|
||||
<H1><A NAME=3>3 Design Overview</A></H1>
|
||||
CUPS is composed of 7 software sub-systems that operate together to
|
||||
@@ -219,7 +219,17 @@ form:
|
||||
<LI><CODE>parity=<I>odd</I></CODE> - Sets odd parity checking. </LI>
|
||||
<LI><CODE>parity=<I>none</I></CODE> - Turns parity checking off. </LI>
|
||||
</UL>
|
||||
<H3><A NAME=3_1_5>3.1.5 socket</A></H3>
|
||||
<H3><A NAME=3_1_5>3.1.5 smb</A></H3>
|
||||
The smb backend sends the specified job to a network host using the
|
||||
Server Message Block protocol, which is used by most machines running
|
||||
Microsoft® Windows®. The URI is of the form:
|
||||
<UL>
|
||||
<PRE>smb://hostname/queue
|
||||
</PRE>
|
||||
</UL>
|
||||
Usernames and passwords required to access the printer are stored in
|
||||
an external file.
|
||||
<H3><A NAME=3_1_6>3.1.6 socket</A></H3>
|
||||
The socket backend sends the specified job to a network host using the
|
||||
AppSocket protocol commonly used by Hewlett-Packard and Tektronix
|
||||
printers. The URI is of the form:
|
||||
@@ -231,32 +241,41 @@ printers. The URI is of the form:
|
||||
<H2><A NAME=3_2>3.2 Berkeley Commands</A></H2>
|
||||
The Berkeley commands provide a simple command-line interface to CUPS
|
||||
to submit and control print jobs. It is provided for compatibility with
|
||||
existing software that is hard coded to use the Berkeley commands.
|
||||
existing software that is hard coded to use the Berkeley commands,
|
||||
however since printer options cannot be specified using the Berkeley
|
||||
commands their use it not encouraged.
|
||||
<H3><A NAME=3_2_1>3.2.1 lpc</A></H3>
|
||||
The lpc command allows users and administrators to check the status
|
||||
and control print queues. The version provided with CUPS supports the
|
||||
following commands:
|
||||
<UL>
|
||||
<LI>quit - Quits the lpc command. </LI>
|
||||
<LI>abort - Stops a printer or all printers and any active print jobs. </LI>
|
||||
<LI>disable - Prevents new jobs from being submitted to the specified
|
||||
printer or all printers. </LI>
|
||||
<LI>down - Stops a printer or all printers after completing the current
|
||||
print jobs. </LI>
|
||||
<LI>enable - Allows new jobs to be submitted. </LI>
|
||||
<LI>start - Starts a printer or all printers. </LI>
|
||||
<LI>status - Shows the status of printers and jobs in the queue. </LI>
|
||||
<LI>up - Starts a printer or all printers. </LI>
|
||||
</UL>
|
||||
<H3><A NAME=3_2_2>3.2.2 lpr</A></H3>
|
||||
The lpr command submits a job for printing. The CUPS version of lpr
|
||||
silently ignores the "i", "t", "m", "h", and "s" options.
|
||||
silently ignores the "i", "p", "t", "m", "h", and "s" options.
|
||||
<H3><A NAME=3_2_3>3.2.3 lprm</A></H3>
|
||||
The lprm removes one or more print jobs.
|
||||
<H2><A NAME=3_3>3.3 CGI</A></H2>
|
||||
The Common Gateway Interface (CGI) programs provide a web-based status
|
||||
interface to monitor the status of printers, classes, and jobs.
|
||||
<H3><A NAME=3_3_1>3.3.1 classes.cgi</A></H3>
|
||||
<H3><A NAME=3_3_1>3.3.1 classes</A></H3>
|
||||
The classes CGI lists the available printer classes and any pending
|
||||
jobs for the class. The user can click on individual classes to limit
|
||||
the display and click on jobs to see the job status.
|
||||
<H3><A NAME=3_3_2>3.3.2 jobs.cgi</A></H3>
|
||||
<H3><A NAME=3_3_2>3.3.2 jobs</A></H3>
|
||||
The jobs CGI lists the queued print jobs in order of priority. The
|
||||
list can be limited by printer or job. When the user displays the
|
||||
status of an individual print job all job options are displayed.
|
||||
<H3><A NAME=3_3_3>3.3.3 printers.cgi</A></H3>
|
||||
<H3><A NAME=3_3_3>3.3.3 printers</A></H3>
|
||||
The printers CGI lists the available printer queues and any pending
|
||||
jobs for the printer. The user can click on individual printers to
|
||||
limit the display and click on jobs to see the job status.
|
||||
@@ -265,9 +284,8 @@ limit the display and click on jobs to see the job status.
|
||||
language, MIME, PPD, and raster functions used by the CUPS software.
|
||||
<H3><A NAME=3_4_1>3.4.1 Convenience Functions</A></H3>
|
||||
Convenience functions are provided to submit an IPP request, send a
|
||||
print file, cancel a job, get a list of available printers, get a list
|
||||
of available classes, get the default printer or class, get the default
|
||||
server name, get the local username, and get a password string.
|
||||
print file, cancel a job, get a list of available printers, and get a
|
||||
list of available classes.
|
||||
<H3><A NAME=3_4_2>3.4.2 HTTP Functions</A></H3>
|
||||
The HTTP functions provide functions to connect to HTTP servers, issue
|
||||
requests, read data from a server, and write data to a server.
|
||||
@@ -311,24 +329,16 @@ necessary conversions from one file type to another.
|
||||
The hpgltops filter converts HP-GL/2 files into PostScript.
|
||||
<H3><A NAME=3_5_2>3.5.2 imagetops</A></H3>
|
||||
The imagetops filter converts image files into PostScript.
|
||||
<H3><A NAME=3_5_3>3.5.3 imagetoraster</A></H3>
|
||||
The imagetoraster filter converts image files into CUPS raster data.
|
||||
<H3><A NAME=3_5_4>3.5.4 pstops</A></H3>
|
||||
<H3><A NAME=3_5_3>3.5.3 pstops</A></H3>
|
||||
The pstops filter inserts printer-specific commands from PPD files and
|
||||
performs page filtering as requested by the user.
|
||||
<H3><A NAME=3_5_5>3.5.5 pstoraster</A></H3>
|
||||
The pstoraster filter converts PostScript program data into CUPS
|
||||
raster data.
|
||||
<H3><A NAME=3_5_6>3.5.6 rastertohp</A></H3>
|
||||
The rastertohp filter handles converting CUPS raster data to HP PCL
|
||||
and supports both color and black-and-white printers.
|
||||
<H3><A NAME=3_5_7>3.5.7 texttops</A></H3>
|
||||
<H3><A NAME=3_5_4>3.5.4 texttops</A></H3>
|
||||
The texttops filter converts text files into PostScript.
|
||||
<H2><A NAME=3_6>3.6 Scheduler</A></H2>
|
||||
The scheduler is a fully-functional HTTP/1.1 and IPP/1.0 server that
|
||||
manages the printers, classes, and jobs in the system. It also handles
|
||||
a simple broadcast-based directory service so that remote print queues
|
||||
and classes can be accessed transparently from the local system.
|
||||
The scheduler is a fully-functional HTTP/1.1 server that manages the
|
||||
printers, classes, and jobs in the system. It also handles a simple
|
||||
broadcast-based directory service so that remote print queues and
|
||||
classes can be accessed transparently from the local system.
|
||||
<H3><A NAME=3_6_1>3.6.1 Authorization</A></H3>
|
||||
The authorization module is responsible for performing access control
|
||||
and authentication for all HTTP and IPP requests entering the system.
|
||||
@@ -362,28 +372,24 @@ multiple addresses and ports as needed. </P>
|
||||
<H3><A NAME=3_6_6>3.6.6 IPP</A></H3>
|
||||
The IPP module handles IPP requests and acts accordingly. URI
|
||||
validation is also performed here, as a client can post IPP data to any
|
||||
URI on the server which might sidestep the access control or
|
||||
authentication of the HTTP server.
|
||||
URI on the server (which might sidestep the access control or
|
||||
authentication of the HTTP server.)
|
||||
<H3><A NAME=3_6_7>3.6.7 Jobs</A></H3>
|
||||
The jobs module manages print jobs, starts filter and backend
|
||||
processes for jobs to be printed, and monitors status messages from
|
||||
those filters and backends.
|
||||
<H3><A NAME=3_6_8>3.6.8 Logging</A></H3>
|
||||
The logging module manages the access, error, and page log files that
|
||||
are generated by the scheduler.
|
||||
<H3><A NAME=3_6_9>3.6.9 Main</A></H3>
|
||||
<H3><A NAME=3_6_8>3.6.8 Main</A></H3>
|
||||
The main module is responsible for timing out and dispatching input
|
||||
and output for client connections. It also watches for incoming <CODE>
|
||||
SIGHUP</CODE> and <CODE>SIGCHLD</CODE> signals, reloads the server
|
||||
configuration files as needed, and handles child process errors and
|
||||
exits.
|
||||
<H3><A NAME=3_6_10>3.6.10 Printers</A></H3>
|
||||
SIGHUP</CODE> signals and reloads the server configuration files as
|
||||
needed.
|
||||
<H3><A NAME=3_6_9>3.6.9 Printers</A></H3>
|
||||
The printers module is responsible for managing printers and PPD files
|
||||
in the system. The printers module also reads and writes the printers
|
||||
configuration file.
|
||||
<H2><A NAME=3_7>3.7 System V Commands</A></H2>
|
||||
The System V commands provide a robust command-line interface to CUPS
|
||||
to submit and control printers and jobs.
|
||||
to submit and control print jobs.
|
||||
<H3><A NAME=3_7_1>3.7.1 accept</A></H3>
|
||||
The accept command tells the scheduler to accept new jobs for specific
|
||||
printers.
|
||||
@@ -405,17 +411,17 @@ separate job ID for each file that is printed. Also, the Solaris "f",
|
||||
The lpadmin command manages printer queues and classes. The Solaris
|
||||
"A", "F", "I", "M", "P", "Q", "S", "T", "U", "W", "f", "l", "m", "o",
|
||||
"s", "t", and "u" options are not supported, and new options "P" (PPD
|
||||
file), "F" (filter), and "E" (enable and accept) are provided to
|
||||
configure CUPS-specific features such as PPD file and conversion
|
||||
filters.
|
||||
file) and "F" (filter) are provided to configure CUPS-specific features
|
||||
such as PPD file and conversion filters.
|
||||
<H3><A NAME=3_7_7>3.7.7 lpstat</A></H3>
|
||||
The lpstat command lists printers, classes, and jobs as requested by
|
||||
the user.
|
||||
<H3><A NAME=3_7_8>3.7.8 reject</A></H3>
|
||||
The reject command tells the scheduler not to accept new jobs for
|
||||
specific printers.
|
||||
<H1 TYPE=A VALUE=1><A NAME=4>A Glossary</A></H1>
|
||||
<H2><A NAME=4_1>A.1 Terms</A></H2>
|
||||
<H1><A NAME=4>4 Detailed Design</A></H1>
|
||||
<H1 TYPE=A VALUE=1><A NAME=5>A Glossary</A></H1>
|
||||
<H2><A NAME=5_1>A.1 Terms</A></H2>
|
||||
<DL>
|
||||
<DT>C </DT>
|
||||
<DD>A computer language. </DD>
|
||||
@@ -428,7 +434,7 @@ specific printers.
|
||||
<DT>socket </DT>
|
||||
<DD>A two-way network communications channel. </DD>
|
||||
</DL>
|
||||
<H2><A NAME=4_2>A.2 Acronyms</A></H2>
|
||||
<H2><A NAME=5_2>A.2 Acronyms</A></H2>
|
||||
<DL>
|
||||
<DT>ASCII </DT>
|
||||
<DD>American Standard Code for Information Interchange </DD>
|
||||
|
||||
+783
-793
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+52
-42
@@ -3,7 +3,7 @@
|
||||
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-1999, All Rights Reserved">
|
||||
<META NAME="DOCNUMBER" CONTENT="CUPS-SDD-1.0">
|
||||
<META NAME="Author" CONTENT="Easy Software Products">
|
||||
<TITLE>CUPS Software Design Description</TITLE>
|
||||
<TITLE>DRAFT - CUPS Software Design Description</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
@@ -48,6 +48,8 @@ following sections:
|
||||
|
||||
<LI>3 - Design Overview
|
||||
|
||||
<LI>4 - Detailed Design
|
||||
|
||||
<LI>A - Glossary
|
||||
|
||||
</UL>
|
||||
@@ -77,10 +79,10 @@ The following non-CUPS documents are referenced by this document:
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft)
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1
|
||||
<LI>IPP/1.0: Encoding and Transport
|
||||
<LI>IPP/1.0: Implementers Guide
|
||||
<LI>IPP/1.0: Model and Semantics
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide
|
||||
</UL>
|
||||
|
||||
<H1>Design Overview</H1>
|
||||
@@ -183,6 +185,18 @@ The options can be any combination of the following:
|
||||
|
||||
</UL>
|
||||
|
||||
<H3>smb</H3>
|
||||
|
||||
The smb backend sends the specified job to a network host using the Server
|
||||
Message Block protocol, which is used by most machines running Microsoft®
|
||||
Windows®. The URI is of the form:
|
||||
|
||||
<UL><PRE>smb://hostname/queue
|
||||
</PRE></UL>
|
||||
|
||||
Usernames and passwords required to access the printer are stored in an
|
||||
external file.
|
||||
|
||||
<H3>socket</H3>
|
||||
|
||||
The socket backend sends the specified job to a network host using the
|
||||
@@ -198,7 +212,9 @@ The default port number is 9100.
|
||||
|
||||
The Berkeley commands provide a simple command-line interface to CUPS
|
||||
to submit and control print jobs. It is provided for compatibility with
|
||||
existing software that is hard coded to use the Berkeley commands.
|
||||
existing software that is hard coded to use the Berkeley commands,
|
||||
however since printer options cannot be specified using the Berkeley
|
||||
commands their use it not encouraged.
|
||||
|
||||
<H3>lpc</H3>
|
||||
|
||||
@@ -208,16 +224,28 @@ commands:
|
||||
|
||||
<UL>
|
||||
|
||||
<LI>quit - Quits the lpc command.
|
||||
<LI>abort - Stops a printer or all printers and any active print jobs.
|
||||
|
||||
<LI>disable - Prevents new jobs from being submitted to the specified
|
||||
printer or all printers.
|
||||
|
||||
<LI>down - Stops a printer or all printers after completing the current
|
||||
print jobs.
|
||||
|
||||
<LI>enable - Allows new jobs to be submitted.
|
||||
|
||||
<LI>start - Starts a printer or all printers.
|
||||
|
||||
<LI>status - Shows the status of printers and jobs in the queue.
|
||||
|
||||
<LI>up - Starts a printer or all printers.
|
||||
|
||||
</UL>
|
||||
|
||||
<H3>lpr</H3>
|
||||
|
||||
The lpr command submits a job for printing. The CUPS version of lpr silently
|
||||
ignores the "i", "t", "m", "h", and "s" options.
|
||||
ignores the "i", "p", "t", "m", "h", and "s" options.
|
||||
|
||||
<H3>lprm</H3>
|
||||
|
||||
@@ -228,19 +256,19 @@ The lprm removes one or more print jobs.
|
||||
The Common Gateway Interface (CGI) programs provide a web-based status interface
|
||||
to monitor the status of printers, classes, and jobs.
|
||||
|
||||
<H3>classes.cgi</H3>
|
||||
<H3>classes</H3>
|
||||
|
||||
The classes CGI lists the available printer classes and any pending jobs for
|
||||
the class. The user can click on individual classes to limit the display and
|
||||
click on jobs to see the job status.
|
||||
|
||||
<H3>jobs.cgi</H3>
|
||||
<H3>jobs</H3>
|
||||
|
||||
The jobs CGI lists the queued print jobs in order of priority. The list can
|
||||
be limited by printer or job. When the user displays the status of an
|
||||
individual print job all job options are displayed.
|
||||
|
||||
<H3>printers.cgi</H3>
|
||||
<H3>printers</H3>
|
||||
|
||||
The printers CGI lists the available printer queues and any pending jobs for
|
||||
the printer. The user can click on individual printers to limit the display and
|
||||
@@ -254,9 +282,8 @@ language, MIME, PPD, and raster functions used by the CUPS software.
|
||||
<H3>Convenience Functions</H3>
|
||||
|
||||
Convenience functions are provided to submit an IPP request, send a print file,
|
||||
cancel a job, get a list of available printers, get a list of available
|
||||
classes, get the default printer or class, get the default server name, get
|
||||
the local username, and get a password string.
|
||||
cancel a job, get a list of available printers, and get a list of available
|
||||
classes.
|
||||
|
||||
<H3>HTTP Functions</H3>
|
||||
|
||||
@@ -327,34 +354,21 @@ The hpgltops filter converts HP-GL/2 files into PostScript.
|
||||
|
||||
The imagetops filter converts image files into PostScript.
|
||||
|
||||
<H3>imagetoraster</H3>
|
||||
|
||||
The imagetoraster filter converts image files into CUPS raster data.
|
||||
|
||||
<H3>pstops</H3>
|
||||
|
||||
The pstops filter inserts printer-specific commands from PPD files and
|
||||
performs page filtering as requested by the user.
|
||||
|
||||
<H3>pstoraster</H3>
|
||||
|
||||
The pstoraster filter converts PostScript program data into CUPS raster data.
|
||||
|
||||
<H3>rastertohp</H3>
|
||||
|
||||
The rastertohp filter handles converting CUPS raster data to HP PCL and
|
||||
supports both color and black-and-white printers.
|
||||
|
||||
<H3>texttops</H3>
|
||||
|
||||
The texttops filter converts text files into PostScript.
|
||||
|
||||
<H2>Scheduler</H2>
|
||||
|
||||
The scheduler is a fully-functional HTTP/1.1 and IPP/1.0 server that
|
||||
manages the printers, classes, and jobs in the system. It also handles
|
||||
a simple broadcast-based directory service so that remote print queues
|
||||
and classes can be accessed transparently from the local system.
|
||||
The scheduler is a fully-functional HTTP/1.1 server that manages the printers,
|
||||
classes, and jobs in the system. It also handles a simple broadcast-based
|
||||
directory service so that remote print queues and classes can be accessed
|
||||
transparently from the local system.
|
||||
|
||||
<H3>Authorization</H3>
|
||||
|
||||
@@ -399,8 +413,8 @@ ports as needed.
|
||||
|
||||
The IPP module handles IPP requests and acts accordingly. URI
|
||||
validation is also performed here, as a client can post IPP data to any
|
||||
URI on the server which might sidestep the access control or
|
||||
authentication of the HTTP server.
|
||||
URI on the server (which might sidestep the access control or
|
||||
authentication of the HTTP server.)
|
||||
|
||||
<H3>Jobs</H3>
|
||||
|
||||
@@ -408,17 +422,11 @@ The jobs module manages print jobs, starts filter and backend processes
|
||||
for jobs to be printed, and monitors status messages from those filters
|
||||
and backends.
|
||||
|
||||
<H3>Logging</H3>
|
||||
|
||||
The logging module manages the access, error, and page log files that are
|
||||
generated by the scheduler.
|
||||
|
||||
<H3>Main</H3>
|
||||
|
||||
The main module is responsible for timing out and dispatching input and output
|
||||
for client connections. It also watches for incoming <CODE>SIGHUP</CODE>
|
||||
and <CODE>SIGCHLD</CODE> signals, reloads the server configuration files as
|
||||
needed, and handles child process errors and exits.
|
||||
signals and reloads the server configuration files as needed.
|
||||
|
||||
<H3>Printers</H3>
|
||||
|
||||
@@ -429,7 +437,7 @@ configuration file.
|
||||
<H2>System V Commands</H2>
|
||||
|
||||
The System V commands provide a robust command-line interface to CUPS
|
||||
to submit and control printers and jobs.
|
||||
to submit and control print jobs.
|
||||
|
||||
<H3>accept</H3>
|
||||
|
||||
@@ -463,8 +471,8 @@ and "y" options are silently ignored.
|
||||
The lpadmin command manages printer queues and classes. The Solaris
|
||||
"A", "F", "I", "M", "P", "Q", "S", "T", "U", "W", "f", "l", "m", "o",
|
||||
"s", "t", and "u" options are not supported, and new options "P" (PPD
|
||||
file), "F" (filter), and "E" (enable and accept) are provided to configure
|
||||
CUPS-specific features such as PPD file and conversion filters.
|
||||
file) and "F" (filter) are provided to configure CUPS-specific features
|
||||
such as PPD file and conversion filters.
|
||||
|
||||
<H3>lpstat</H3>
|
||||
|
||||
@@ -476,6 +484,8 @@ user.
|
||||
The reject command tells the scheduler not to accept new jobs for specific
|
||||
printers.
|
||||
|
||||
<H1>Detailed Design</H1>
|
||||
|
||||
<H1 TYPE=A VALUE=1>Glossary</H1>
|
||||
|
||||
<H2>Terms</H2>
|
||||
|
||||
+9
-24
@@ -91,10 +91,10 @@ sections:</P>
|
||||
<UL>
|
||||
<LI>IEEE 1387.4, System Administration: Printing (draft) </LI>
|
||||
<LI>IPP/1.0: Additional Optional Operations - Set 1 </LI>
|
||||
<LI>IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>IPP/1.0: Implementers Guide </LI>
|
||||
<LI>IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 1179, Line Printer Daemon Protocol </LI>
|
||||
<LI>RFC 2565, IPP/1.0: Encoding and Transport </LI>
|
||||
<LI>RFC 2566, IPP/1.0: Model and Semantics </LI>
|
||||
<LI>RFC 2639, IPP/1.0: Implementers Guide </LI>
|
||||
</UL>
|
||||
<H1><A NAME=3>3 Local Access Risks</A></H1>
|
||||
<P>Local access risks are those that can be exploited only with a local
|
||||
@@ -102,32 +102,17 @@ user account. This section does not address issues related to
|
||||
dissemination of the root password or other security issues associated
|
||||
with the UNIX operating system. </P>
|
||||
<H2><A NAME=3_1>3.1 Security Breaches</A></H2>
|
||||
<P>There are two known security vulnerabilities with local access: </P>
|
||||
<OL>
|
||||
<LI>Since the default installation creates a world-readable request
|
||||
directory, it is possible for local users to read the contents of
|
||||
print files before they are printed.
|
||||
<P>This problem can be alleviated by making the request directory
|
||||
readable only by the user specified in the CUPS configuration file. </P>
|
||||
</LI>
|
||||
<LI>Device URIs are passed to backend filters in argv[0] and in an
|
||||
environment variable. Since device URIs can contain usernames and
|
||||
passwords it may be possible for a local user to gain access to a
|
||||
remote resource.
|
||||
<P>We recommend that any password-protected accounts used for remote
|
||||
printing have limited access priviledges so that the possible damages
|
||||
can be minimized. </P>
|
||||
<P>The device URI is "sanitized" (the username and password are
|
||||
removed) when sent to an IPP client so that a remote user cannot
|
||||
exploit this vulnerability. </P>
|
||||
</LI>
|
||||
</OL>
|
||||
<P>Since the default installation creates a world-readable request
|
||||
directory, it is possible for local users to read the contents of print
|
||||
files before they are printed. </P>
|
||||
<P>This problem can be alleviated by making the request directory
|
||||
readable only by the user specified in the CUPS configuration file. </P>
|
||||
<H1><A NAME=4>4 Remote Access Risks</A></H1>
|
||||
<P>Remote access risks are those that can be exploited without a local
|
||||
user account and/or from a remote system. This section does not address
|
||||
issues related to network or firewall security. </P>
|
||||
<H2><A NAME=4_1>4.1 Denial of Service Attacks</A></H2>
|
||||
<P>Like all Internet services, the CUPS server is vulnerable to denial
|
||||
<P>Like all internet services, the CUPS server is vulnerable to denial
|
||||
of service attacks, including: </P>
|
||||
<OL>
|
||||
<LI>Establishing multiple connections to the server until the server
|
||||
|
||||
+67
-59
@@ -1,6 +1,6 @@
|
||||
%PDF-1.2
|
||||
%âãÏÓ
|
||||
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19990922200511Z)/Title(DRAFT - CUPS Software Security Report)/Author(Easy Software Products)>>endobj
|
||||
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19990709142834Z)/Title(DRAFT - CUPS Software Security Report)/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
|
||||
@@ -194,10 +194,13 @@ endobj
|
||||
xÚ+ä2T0 | ||||