Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 6e9e4387b7 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.1.21rc2@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
962 arquivos alterados com 124366 adições e 56715 exclusões
+24
Ver Arquivo
@@ -6,4 +6,28 @@ configure
cups-config
cups.list
cups.sh
make.log
printpro.common
printpro.version
Makedefs
aix-4.3-powerpc
darwin-5.2-powerpc
darwin-5.3-powerpc
darwin-6.0-powerpc
freebsd-4.5-intel
hpux-10.20-hppa
hpux-11.00-hppa
irix-5.3-mips
irix-6.5-mips
linux-2.0-intel
linux-2.2-intel
linux-2.4-intel
solaris-2.5-intel
solaris-2.5-sparc
solaris-2.7-intel
solaris-2.7-sparc
solaris-2.8-intel
solaris-2.8-sparc
solaris-2.9-intel
solaris-2.9-sparc
tru64-4.0-alpha
+81
Ver Arquivo
@@ -0,0 +1,81 @@
CGI - CUPS v1.1.21 - 06/29/2004
-------------------------------
This file describes the experimental scripting/CGI support
provided by CUPS starting with CUPS 1.1.19.
WARNING: CGI support is not complete; you may run into problems
and limitations in the implementation of CGI in CUPS that are
not present in full-featured web servers like Apache.
OVERVIEW OF CGI SUPPORT IN CUPS
CUPS has traditionally provided a dynamic web interface through
four CGI programs that are executed when users open special
directories on the CUPS server. Each CGI performs
administration, class, job, and printer functions as directed by
the user, but the actual programs that are run and functions
that are available are limited to those that were originally
designed into the scheduler.
Starting with CUPS 1.1.19, support is now available for CGI
programs and specific scripting languages, currently Java, Perl,
PHP, and Python. The interpreters for these languages are
currently configured at compile time. Future versions may
expand the interface to allow for generic support of scripting
languages similar to the Apache "AddHandler" directive, but with
external programs instead of modules.
The following MIME types are reserved for the CGI support in
CUPS (the names have been chosen to mirror those used by
Apache):
application/x-httpd-cgi CGI script/program
application/x-httpd-java Java program
application/x-httpd-perl Perl script
application/x-httpd-php PHP script
application/x-httpd-python Python script
In order to enable the corresponding type, you must create a new
/etc/cups/cgi.types file which maps the filename extensions to
the appropriate MIME type, for example:
application/x-httpd-cgi cgi
application/x-httpd-php php
CGI scripts/programs (application/x-httpd-cgi) also must have
execution permissions to be treated as a CGI script or program.
LIMITATIONS
CUPS implements most of the CGI/1.1 specification, with the
following limitations:
- No Location: redirection support.
- No PATH_INFO or PATH_TRANSLATED support.
- Limited HTTP field support; only the Content-Length
(CONTENT_LENGTH), Cookie (HTTP_COOKIE), and User-Agent
(HTTP_USER_AGENT) fields are placed in environment
variables at this time.
REPORTING PROBLEMS
If you have problems, READ THE DOCUMENTATION FIRST! If the
documentation does not solve your problems please send an email
to "cups-support@cups.org". Include your operating system and
version, compiler and version, and any errors or problems you've
run into. The "/var/log/cups/error_log" file should also be sent,
as it often helps to determine the cause of your problem.
If you are running a version of Linux, be sure to provide the
Linux distribution you have, too.
Please note that the "cups-support@cups.org" email address goes
to the CUPS developers; they are busy people, so your email may
go unanswered for days or weeks. In general, only general build
or distribution problems will actually get answered - for
end-user support see the "README.txt" for a summary of the
resources available.
+1372 -1
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+10 -3
Ver Arquivo
@@ -1,4 +1,4 @@
CREDITS.txt - 01/27/2000
CREDITS.txt - 04/26/2003
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
@@ -8,19 +8,26 @@ like to thank the following individuals for their contributions:
N. Becker - setsid().
Jean-Eric Cuendet - GhostScript filters for CUPS.
Van Dang - HTTP and IPP policeman.
L. Peter Deutsch - MD5 code.
Dr. ZP Han - setgid()/setuid().
Guy Harris - *BSD shared libraries and lots of other fixes.
Bjoern Jacke - I18N stuff.
Wang Jian - CUPS RPM corrections.
Roderick Johnstone - Beta tester of the millenium.
Till Kamppeter - Bug fixes, beta testing, evangelism.
Kiko - Bug fixes.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Mark Lawrence - Microsoft interoperability testing.
Jeff Licquia - Bug fixes, beta testing, evangelism.
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Ulrich Oldendorf - German locale.
Giulio Orsero - Bug fixes and testing.
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
Gilles QUERRET - French man pages.
Petter Reinholdtsen - HP-UX compiler stuff.
Stuart Stevens - HP JetDirect IPP information.
Kiko - Bug fixes.
L. Peter Deutsch - MD5 code.
Andrea Suatoni - IRIX desktop integration and testing.
If I've missed someone, please let me know by sending an email to
"mike@easysw.com".
+14 -10
Ver Arquivo
@@ -1,5 +1,5 @@
ENCRYPTION - CUPS v1.1.7 - 02/21/2001
-------------------------------------
ENCRYPTION - CUPS v1.1.20 - 11/24/2003
--------------------------------------
This file describes the encryption support provided by CUPS.
@@ -17,15 +17,16 @@ LEGAL STUFF
BEFORE USING THE ENCRYPTION SUPPORT, PLEASE VERIFY THAT IT IS
LEGAL TO DO SO IN YOUR COUNTRY. CUPS by itself doesn't include
any encryption code, but it can link against the OpenSSL library
which does.
any encryption code, but it can link against the OpenSSL, GNU
TLS, or CDSA libraries which do.
OVERVIEW OF ENCRYPTION SUPPORT IN CUPS
CUPS supports SSL/2.0, SSL/3.0, and TLS/1.0 encryption using
keys as large as 128-bits. Encryption support is provided via
the OpenSSL library and some new hooks in the CUPS code.
the OpenSSL, GNU TLS, or CDSA libraries and some new hooks in
the CUPS code.
CUPS provides support for dedicated (https) and "upgrade" (TLS)
encryption of sessions. The "HTTP Upgrade" method is described
@@ -79,19 +80,22 @@ to /etc/cups/cupsd.conf.
BEFORE YOU BEGIN
You'll need the OpenSSL library from:
You'll need the OpenSSL, GNU TLS, or CDSA libraries from:
http://www.openssl.org
http://www.openssl.org/
http://www.gnutls.org/
http://www.intel.com/labs/archive/cdsa.htm
CONFIGURING WITH ENCRYPTION SUPPORT
Once you have the OpenSSL library installed, you'll need to
configure CUPS to use it with the "--enable-ssl" option:
Once you have the OpenSSL, GNU TLS, or CDSA libraries installed,
you'll need to configure CUPS to use it with the "--enable-ssl"
option:
./configure --enable-ssl
If the OpenSSL stuff is not in a standard location, make sure to
If the library stuff is not in a standard location, make sure to
define the CFLAGS, CXXFLAGS, and LDFLAGS environment variables
with the appropriate compiler and linker options first.
+12 -1
Ver Arquivo
@@ -1,4 +1,4 @@
INSTALL - CUPS v1.1.15 - 05/13/2002
INSTALL - CUPS v1.1.20 - 11/24/2003
-----------------------------------
This file describes how to compile and install CUPS from source
@@ -6,6 +6,10 @@ code. For more information on CUPS see the file called
"README.txt". A complete change log can be found in
"CHANGES.txt".
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO ****
**** NEED TO INSTALL ESP GHOSTSCRIPT OR A PATCHED VERSION ****
**** OF THE STANDARD GHOSTSCRIPT RELEASES. ****
BEFORE YOU BEGIN
@@ -29,6 +33,13 @@ Besides these tools you'll want the following libraries:
CUPS will compile and run without these, however you'll miss out on
many of the features provided by CUPS.
Also, please note that CUPS no longer includes the Ghostscript-
based pstoraster filter. You *must* download Ghostscript
separately and patch it using the files in the pstoraster
subdirectory, or download the ESP Ghostscript distribution from
the CUPS web site. For more information see the README file in
the pstoraster subdirectory.
COMPILING FROM CVS
+19
Ver Arquivo
@@ -0,0 +1,19 @@
INSTALL_fr - CUPS v1.1.19 - 04/08/2003
--------------------------------------
Vous cherchez des instructions d'installation ? Lisez le fichier
INSTALL.txt (anglais) et/ou reportez vous au "Manuel de
l'administrateur" (en français) situé dans le sous-répertoire
"doc/fr"
Vous trouverez deux autres manuels en français dans ce
sous-répertoire :
- Aperçu de CUPS
- Manuel de l'utilisateur
Une fois CUPS installé, si vous configurez votre navigateur
"web" pour que la langue de base soit le français, vous
disposerez également d'une interface "web" en français pour
l'administration et d'utilistation de CUPS.
+9 -10
Ver Arquivo
@@ -7,9 +7,9 @@
<H2 ALIGN="CENTER">Common UNIX Printing System License Agreement</H2>
<P ALIGN="CENTER">Copyright 1997-2002 by Easy Software Products<BR>
<P ALIGN="CENTER">Copyright 1997-2004 by Easy Software Products<BR>
44141 AIRPORT VIEW DR STE 204<BR>
HOLLYWOOD, MARYLAND 20636-3111 USA<BR>
HOLLYWOOD, MARYLAND 20636-3142 USA<BR>
<BR>
Voice: +1.301.373.9600<BR>
Email: <A HREF="mailto:cups-info@cups.org">cups-info@cups.org</A><BR>
@@ -138,13 +138,12 @@ derived work.
<H3>Trademarks</H3>
<P>Easy Software Products has trademarked the Common UNIX
Printing System, CUPS, and CUPS logo. These names and logos may
be used freely in any direct port or binary distribution of
CUPS. Please contract Easy Software Products for written
permission to use them in derivative products. Our intention is
to protect the value of these trademarks and ensure that any
derivative product meets the same high-quality standards as the
original.
Printing System, CUPS, and CUPS logo. You may use these names
and logos in any direct port or binary distribution of CUPS.
Please contact Easy Software Products for written permission to
use them in derivative products. Our intention is to protect the
value of these trademarks and ensure that any derivative product
meets the same high-quality standards as the original.
<H3>Binary Distribution Rights</H3>
@@ -185,7 +184,7 @@ Copyright 1989, 1991 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim
copies of this license document, but changing it is not allowed.
<PRE>
</PRE>
<H4>Preamble</H4>
+5 -5
Ver Arquivo
@@ -1,8 +1,8 @@
Common UNIX Printing System License Agreement
Copyright 1997-2002 by Easy Software Products
Copyright 1997-2004 by Easy Software Products
44141 AIRPORT VIEW DR STE 204
HOLLYWOOD, MARYLAND 20636-3111 USA
HOLLYWOOD, MARYLAND 20636-3142 USA
Voice: +1.301.373.9600
Email: cups-info@cups.org
@@ -107,9 +107,9 @@ derived work.
TRADEMARKS
Easy Software Products has trademarked the Common UNIX Printing
System, CUPS, and CUPS logo. These names and logos may be used
freely in any direct port or binary distribution of CUPS. Please
contract Easy Software Products for written permission to use
System, CUPS, and CUPS logo. You may use these names and logos
in any direct port or binary distribution of CUPS. Please
contact Easy Software Products for written permission to use
them in derivative products. Our intention is to protect the
value of these trademarks and ensure that any derivative product
meets the same high-quality standards as the original.
+56 -48
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -26,22 +26,22 @@
# Programs...
#
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
HTMLDOC = @HTMLDOC@
INSTALL = @INSTALL@
LIBTOOL = @LIBTOOL@
LN = /bin/ln -sf
MV = @MV@
NROFF = @NROFF@
RANLIB = @RANLIB@
RM = @RM@ -f
SED = @SED@
SHELL = /bin/sh
STRIP = @STRIP@
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
HTMLDOC = @HTMLDOC@
INSTALL = @INSTALL@
LIBTOOL = @LIBTOOL@
LN = @LN@ -sf
MV = @MV@
NROFF = @NROFF@
RANLIB = @RANLIB@
RM = @RM@ -f
SED = @SED@
SHELL = /bin/sh
STRIP = @STRIP@
#
# Installation programs...
@@ -65,14 +65,15 @@ CUPS_GROUP = @CUPS_GROUP@
# Libraries...
#
LIBCUPS = @LIBCUPS@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBJPEG = @LIBJPEG@
LIBMALLOC = @LIBMALLOC@
LIBPNG = @LIBPNG@
LIBSLP = @LIBSLP@
LIBTIFF = @LIBTIFF@
LIBZ = @LIBZ@
LIBCUPS = @LIBCUPS@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBJPEG = @LIBJPEG@
LIBMALLOC = @LIBMALLOC@
LIBPAPER = @LIBPAPER@
LIBPNG = @LIBPNG@
LIBSLP = @LIBSLP@
LIBTIFF = @LIBTIFF@
LIBZ = @LIBZ@
#
# Program options...
@@ -82,22 +83,25 @@ LIBZ = @LIBZ@
# extra debug info)
#
ARFLAGS = @ARFLAGS@
CFLAGS = $(RC_CFLAGS) @CFLAGS@ -I.. $(OPTIONS)
CXXFLAGS = $(RC_CFLAGS) @CXXFLAGS@ -I.. $(OPTIONS)
CXXLIBS = @CXXLIBS@
DSOFLAGS = @DSOFLAGS@
DSOLIBS = @DSOLIBS@
IMGLIBS = @IMGLIBS@ -lm
LDFLAGS = -L../cups -L../filter @LDFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(NETLIBS) @LIBS@
NETLIBS = @NETLIBS@
OPTIM = @OPTIM@
OPTIONS =
PAMLIBS = @PAMLIBS@
SSLLIBS = @SSLLIBS@
ARFLAGS = @ARFLAGS@
BACKLIBS = @BACKLIBS@
CFLAGS = $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ -I.. $(OPTIONS)
COMMONLIBS = @COMMONLIBS@
CXXFLAGS = $(RC_CFLAGS) @CPPFLAGS@ @CXXFLAGS@ -I.. $(OPTIONS)
CXXLIBS = @CXXLIBS@
DSOFLAGS = @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
IMGLIBS = @IMGLIBS@ -lm
LDFLAGS = -L../cups -L../filter $(RC_CFLAGS) @LDFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(NETLIBS) @LIBS@ $(COMMONLIBS)
NETLIBS = @NETLIBS@
OPTIM = @OPTIM@
OPTIONS =
PAMLIBS = @PAMLIBS@
SSLFLAGS = @SSLFLAGS@
SSLLIBS = @SSLLIBS@
#
# Directories...
@@ -141,7 +145,6 @@ LIBDIR = $(BUILDROOT)$(libdir)
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
MANDIR = $(BUILDROOT)@mandir@
PAMDIR = $(BUILDROOT)@PAMDIR@
PMANDIR = $(BUILDROOT)@PMANDIR@
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
SBINDIR = $(BUILDROOT)@sbindir@
@@ -155,6 +158,10 @@ CAT8EXT = @CAT8EXT@
MAN8EXT = @MAN8EXT@
MAN8DIR = @MAN8DIR@
PAMDIR = $(BUILDROOT)@PAMDIR@
PAMFILE = @PAMFILE@
#
# Rules...
#
@@ -173,10 +180,11 @@ MAN8DIR = @MAN8DIR@
-$(NROFF) -man $< >$@
.man.z:
echo Formatting $<...
$(RM) $@ t.z
-$(NROFF) -man $< >t
pack -f t
$(MV) t.z $@
$(RM) $@ $@.tmp $@.tmp.z
-$(NROFF) -man $< >$@.tmp
pack -f $@.tmp
$(MV) $@.tmp.z $@
#
# End of "$Id$"
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -105,7 +105,7 @@ install: installhdrs
if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
$(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(INSTALL_SCRIPT) cups.osx $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(INSTALL_DATA) cups.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
$(INSTALL_DATA) cups.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
+15 -15
Ver Arquivo
@@ -1,9 +1,13 @@
README - CUPS v1.1.14 - 02/13/2002
README - CUPS v1.1.20 - 11/24/2003
----------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
instead...
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO ****
**** NEED TO INSTALL ESP GHOSTSCRIPT OR A PATCHED VERSION ****
**** OF THE STANDARD GHOSTSCRIPT RELEASES. ****
INTRODUCTION
@@ -21,11 +25,12 @@ functionality. CUPS adds network printer browsing and
PostScript Printer Description ("PPD") based printing options to
support real-world printing under UNIX.
CUPS also includes a customized version of GNU Ghostscript
(currently based off GNU Ghostscript 5.50) and an image file RIP
that are used to support non-PostScript printers. Sample
drivers for HP and EPSON printers are included that use these
filters.
CUPS includes an image file RIP that supports printing of image
files to non-PostScript printers. A customized version of GNU
Ghostscript 7.05 for CUPS called ESP Ghostscript is available
separately to support printing of PostScript files within the
CUPS driver framework. Sample drivers for Dymo, EPSON, HP, and
OKIDATA printers are included that use these filters.
Drivers for thousands of printers are provided with our ESP
Print Pro software, available at:
@@ -243,17 +248,13 @@ file.
LEGAL STUFF
CUPS is Copyright 1993-2002 by Easy Software Products. CUPS,
CUPS is Copyright 1993-2004 by Easy Software Products. CUPS,
the CUPS logo, and the Common UNIX Printing System are the
trademark property of Easy Software Products.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
The PostScript RIP software (pstoraster) is based on the GNU
Ghostscript 5.50 core, Copyright 1986-1998 by Aladdin
Enterprises.
The PDF filter (pdftops) is based on the Xpdf 0.92 software,
The PDF filter (pdftops) is based on the Xpdf software,
Copyright 1996-2002 by Derek B. Noonburg.
This software is based in part on the work of the Independent
@@ -278,6 +279,5 @@ For commercial licensing information, please contact:
WWW: http://www.cups.org
Note that commercial licensors may also require a license from
Artifex Software Inc. which handles commercial licensing of the
Ghostscript software, and from Derek B. Noonburg who developed
the Xpdf software used to print PDF files.
Derek B. Noonburg who developed the Xpdf software used to print
PDF files.
+19
Ver Arquivo
@@ -0,0 +1,19 @@
README_fr - CUPS v1.1.19 - 04/08/2003
-------------------------------------
Vous cherchez des instructions d'installation ? Lisez le fichier
INSTALL.txt (anglais) et/ou reportez vous au "Manuel de
l'administrateur" (en français) situé dans le sous-répertoire
"doc/fr"
Vous trouverez deux autres manuels en français dans ce
sous-répertoire :
- Aperçu de CUPS
- Manuel de l'utilisateur
Une fois CUPS installé, si vous configurez votre navigateur
"web" pour que la langue de base soit le français, vous
disposerez également d'une interface "web" en français pour
l'administration et d'utilistation de CUPS.
+3 -2
Ver Arquivo
@@ -1,7 +1,8 @@
betest
ipp
lpd
usb
parallel
betest
scsi
serial
socket
usb
+2
Ver Arquivo
@@ -7,6 +7,8 @@ lpd.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lpd.o: ../cups/ppd.h ../cups/string.h ../config.h
parallel.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
parallel.o: ../cups/ppd.h ../cups/string.h ../config.h
scsi.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
scsi.o: ../cups/ppd.h ../cups/string.h ../config.h
serial.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
serial.o: ../cups/ppd.h ../cups/string.h ../config.h
socket.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
+6 -5
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Backend makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -122,7 +122,7 @@ scsi.o: scsi.c scsi-irix.c scsi-linux.c
serial: serial.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o serial serial.o $(LIBS)
$(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
#
@@ -140,7 +140,8 @@ socket: socket.o ../cups/$(LIBCUPS)
usb: usb.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o usb usb.o $(LIBS)
$(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c
#
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+682 -121
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+569 -286
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+23 -6
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -105,6 +105,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -231,6 +245,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Finally, send the print file...
*/
wbytes = 0;
while (copies > 0)
{
copies --;
@@ -267,6 +283,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
bufptr += wbytes;
}
if (wbytes < 0)
break;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
@@ -281,9 +300,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
return (wbytes < 0);
}
+2 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IRIX SCSI printer support for the Common UNIX Printing System (CUPS).
*
* Copyright 2002 by Easy Software Products, all rights reserved.
* Copyright 2003-2004 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
@@ -83,8 +83,7 @@ print_device(const char *resource, /* I - SCSI device */
int bytes; /* Number of bytes */
int try; /* Current try */
dsreq_t scsi_req; /* SCSI request */
char scsi_cmd[6], /* SCSI command data */
scsi_sense[32]; /* SCSI sense data */
char scsi_cmd[6]; /* SCSI command data */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Linux SCSI printer support for the Common UNIX Printing System (CUPS).
*
* Copyright 2002 by Easy Software Products, all rights reserved.
* Copyright 2003-2004 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
+18 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* SCSI printer backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2002 by Easy Software Products, all rights reserved.
* Copyright 2003-2004 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
@@ -113,6 +113,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int fp; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
@@ -121,6 +124,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -194,9 +211,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
if (!status)
fputs("INFO: Ready to print.\n", stderr);
return (status);
}
+115 -13
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -74,6 +74,13 @@
# endif /* CNEW_RTSCTS */
#endif /* !CRTSCTS */
#if defined(__APPLE__)
# include <CoreFoundation/CoreFoundation.h>
# include <IOKit/IOKitLib.h>
# include <IOKit/serial/IOSerialKeys.h>
# include <IOKit/IOBSD.h>
#endif /* __APPLE__ */
/*
* Local functions...
@@ -126,6 +133,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -230,7 +251,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
for (ptr = name; *options && *options != '=';)
*ptr++ = *options++;
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
@@ -242,7 +264,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
options ++;
for (ptr = value; *options && *options != '+';)
*ptr++ = *options++;
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
@@ -365,23 +388,23 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (strcasecmp(value, "none") == 0)
{
opts.c_iflag &= ~(IXON | IXOFF | IXANY);
opts.c_iflag &= ~(IXON | IXOFF);
opts.c_cflag &= ~CRTSCTS;
}
else if (strcasecmp(value, "soft") == 0)
{
opts.c_iflag |= IXON | IXOFF | IXANY;
opts.c_iflag |= IXON | IXOFF;
opts.c_cflag &= ~CRTSCTS;
}
else if (strcasecmp(value, "hard") == 0 ||
strcasecmp(value, "rtscts") == 0)
{
opts.c_iflag &= ~(IXON | IXOFF | IXANY);
opts.c_iflag &= ~(IXON | IXOFF);
opts.c_cflag |= CRTSCTS;
}
else if (strcasecmp(value, "dtrdsr") == 0)
{
opts.c_iflag &= ~(IXON | IXOFF | IXANY);
opts.c_iflag &= ~(IXON | IXOFF);
opts.c_cflag &= ~CRTSCTS;
dtrdsr = 1;
@@ -421,6 +444,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (bufsize > sizeof(buffer))
bufsize = sizeof(buffer);
wbytes = 0;
while (copies > 0)
{
copies --;
@@ -487,6 +512,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
bufptr += wbytes;
}
if (wbytes < 0)
break;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
@@ -503,9 +531,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
return (wbytes < 0);
}
@@ -539,7 +565,7 @@ list_devices(void)
# else
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# endif // _ARCH_PPC || powerpc || __powerpc
# endif /* _ARCH_PPC || powerpc || __powerpc */
}
}
@@ -884,7 +910,83 @@ list_devices(void)
device, i, j + 1);
}
}
#elif defined(__APPLE__)
/*
* Standard serial ports on MacOS X...
*/
kern_return_t kernResult;
mach_port_t masterPort;
io_iterator_t serialPortIterator;
CFMutableDictionaryRef classesToMatch;
io_object_t serialService;
printf("serial serial \"Unknown\" \"Serial Printer (serial)\"\n");
kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
if (KERN_SUCCESS != kernResult)
return;
/*
* Serial devices are instances of class IOSerialBSDClient.
*/
classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
if (classesToMatch != NULL)
{
CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey),
CFSTR(kIOSerialBSDRS232Type));
kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
&serialPortIterator);
if (kernResult == KERN_SUCCESS)
{
while ((serialService = IOIteratorNext(serialPortIterator)))
{
CFTypeRef serialNameAsCFString;
CFTypeRef bsdPathAsCFString;
char serialName[128];
char bsdPath[1024];
Boolean result;
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
{
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
{
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", bsdPath,
serialName);
}
}
}
IOObjectRelease(serialService);
}
IOObjectRelease(serialPortIterator); /* Release the iterator. */
}
}
#endif
}
+85 -20
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cups/http-private.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
@@ -54,6 +55,13 @@
#endif /* WIN32 */
/*
* Local functions...
*/
void print_backchannel(const unsigned char *buffer, int nbytes);
/*
* 'main()' - Send a file to the printer or server.
*
@@ -62,9 +70,9 @@
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
@@ -79,8 +87,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
struct sockaddr_in addr; /* Socket address */
struct hostent *hostaddr; /* Host address */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
int nbytes; /* Number of bytes read */
size_t tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct timeval timeout; /* Timeout for select() */
@@ -96,6 +104,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -153,7 +175,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((hostaddr = httpGetHostByName(hostname)) == NULL)
{
fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s\n",
hostname, strerror(errno));
hostname, hstrerror(h_errno));
return (1);
}
@@ -165,6 +187,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
addr.sin_family = hostaddr->h_addrtype;
addr.sin_port = htons(port);
wbytes = 0;
while (copies > 0)
{
for (delay = 5;;)
@@ -259,6 +283,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
bufptr += wbytes;
}
if (wbytes < 0)
break;
/*
* Check for possible data coming back from the printer...
*/
@@ -268,19 +295,18 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
FD_ZERO(&input);
FD_SET(fd, &input);
#ifdef __hpux
if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
#else
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
#endif /* __hpux */
{
/*
* Grab the data coming back and spit it out to stderr...
*/
if ((nbytes = recv(fd, buffer, sizeof(buffer), 0)) > 0)
fprintf(stderr, "INFO: Received %lu bytes of back-channel data!\n",
(unsigned long)nbytes);
{
fprintf(stderr, "INFO: Received %d bytes of back-channel data!\n",
nbytes);
print_backchannel((unsigned char *)buffer, nbytes);
}
}
else if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
@@ -319,9 +345,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if ((nbytes = recv(fd, buffer, sizeof(buffer), 0)) > 0)
fprintf(stderr, "INFO: Received %lu bytes of back-channel data!\n",
(unsigned long)nbytes);
else
{
fprintf(stderr, "INFO: Received %d bytes of back-channel data!\n",
nbytes);
print_backchannel((unsigned char *)buffer, nbytes);
}
else
break;
}
else
@@ -342,9 +371,45 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (wbytes < 0);
}
return (0);
/*
* 'print_backchannel()' - Print the contents of a back-channel buffer.
*/
void
print_backchannel(const unsigned char *buffer, /* I - Data buffer */
int nbytes) /* I - Number of bytes */
{
char line[255], /* Formatted line */
*lineptr; /* Pointer into line */
for (lineptr = line; nbytes > 0; buffer ++, nbytes --)
{
if (*buffer < 0x20 || *buffer >= 0x7f)
{
snprintf(lineptr, sizeof(line) - (lineptr - line), "<%02X>", *buffer);
lineptr += strlen(lineptr);
}
else
*lineptr++ = *buffer;
if ((lineptr - line) > 72)
{
*lineptr = '\0';
fprintf(stderr, "DEBUG: DATA: %s\n", line);
lineptr = line;
}
}
if (lineptr > line)
{
*lineptr = '\0';
fprintf(stderr, "DEBUG: DATA: %s\n", line);
}
}
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+807
Ver Arquivo
@@ -0,0 +1,807 @@
/*
* "$Id$"
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 1997-2004 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Send a file to the specified USB port.
* list_devices() - List all USB devices.
*/
/*
* Include necessary headers.
*/
#ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
/*
* Get device_id string
*/
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
#endif /* __linux */
#ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ioccom.h>
# include <sys/ecppsys.h>
# endif /* __sparc */
#endif /* __sun */
/*
* Local functions...
*/
void decode_device_id(int port, const char *device_id,
char *make_model, int mmsize,
char *uri, int urisize);
int open_device(const char *uri);
/*
* 'print_device()' - Print a file to a USB device.
*/
int /* O - Exit status */
print_device(const char *uri, /* I - Device URI */
const char *hostname, /* I - Hostname/manufacturer */
const char *resource, /* I - Resource/modelname */
const char *options, /* I - Device options/serial number */
int fp, /* I - File descriptor to print */
int copies) /* I - Copies to print */
{
int fd; /* USB device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
#ifdef __linux
unsigned char status; /* Port status (off-line, out-of-paper, etc.) */
#endif /* __linux */
/*
* Open the USB port device...
*/
do
{
if ((fd = open_device(uri)) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
{
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
fprintf(stderr, "ERROR: Unable to open USB device \"%s\": %s\n",
uri, strerror(errno));
return (1);
}
}
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
if (fp)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
#if defined(__linux) && defined(LP_POUTPA)
/*
* Show the printer status before we send the file; normally, we'd
* do this while we write data to the printer, however at least some
* Linux kernels have buggy USB drivers which don't like to be
* queried while sending data to the printer...
*
* Also, we're using the 8255 constants instead of the ones that are
* supposed to be used, as it appears that the USB driver also doesn't
* follow standards...
*/
if (ioctl(fd, LPGETSTATUS, &status) == 0)
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
if (status & LP_POUTPA)
fputs("WARNING: Media tray empty!\n", stderr);
else if (!(status & LP_PERRORP))
fputs("WARNING: Printer fault!\n", stderr);
else if (!(status & LP_PSELECD))
fputs("WARNING: Printer off-line.\n", stderr);
}
#endif /* __linux && LP_POUTPA */
/*
* Finally, send the print file...
*/
wbytes = 0;
while (copies > 0)
{
copies --;
if (fp != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (wbytes < 0)
break;
if (fp)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
}
/*
* Close the USB port and return...
*/
close(fd);
return (wbytes < 0);
}
/*
* 'decode_device_id()' - Decode the IEEE-1284 device ID string.
*/
void
decode_device_id(int port, /* I - Port number */
const char *device_id, /* I - 1284 device ID string */
char *make_model, /* O - Make/model */
int mmsize, /* I - Size of buffer */
char *uri, /* O - Device URI */
int urisize) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
*mfg, /* Manufacturer string */
*mdl, /* Model string */
serial_number[1024]; /* Serial number string */
/*
* Look for the description field...
*/
if ((attr = strstr(device_id, "DES:")) != NULL)
attr += 4;
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
attr += 12;
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
mfg += 4;
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
mdl += 4;
if (attr)
{
if (strncasecmp(attr, "Hewlett-Packard ", 16) == 0)
{
strlcpy(make_model, "HP ", mmsize);
strlcpy(make_model + 3, attr + 16, mmsize - 3);
}
else
{
strlcpy(make_model, attr, mmsize);
}
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
}
else if (mfg && mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
strlcpy(make_model, mfg, mmsize);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
strlcat(make_model, " ", mmsize);
strlcat(make_model, mdl, mmsize);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
}
else
{
/*
* Use "Unknown" as the printer make and model...
*/
strlcpy(make_model, "Unknown", mmsize);
}
/*
* Look for the serial number field...
*/
if ((attr = strstr(device_id, "SERN:")) != NULL)
attr += 5;
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, ";SN:")) != NULL)
attr += 4;
if (mfg)
{
/*
* Make sure manufacturer is truncated at delimiter...
*/
if ((delim = strchr(mfg, ';')) != NULL)
*delim = '\0';
}
if (mdl)
{
/*
* Make sure model is truncated at delimiter...
*/
if ((delim = strchr(mdl, ';')) != NULL)
*delim = '\0';
}
if (attr)
{
strlcpy(serial_number, attr, sizeof(serial_number));
if ((delim = strchr(serial_number, ';')) != NULL)
*delim = '\0';
}
else
serial_number[0] = '\0';
/*
* Generate the device URI from the make_model and serial number strings.
*/
strlcpy(uri, "usb://", urisize);
for (uriptr = uri + 6, delim = make_model;
*delim && uriptr < (uri + urisize - 1);
delim ++)
if (*delim == ' ')
{
delim ++;
*uriptr++ = '/';
break;
}
else
*uriptr++ = *delim;
for (; *delim && uriptr < (uri + urisize - 3); delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
*uriptr = '\0';
if (serial_number[0])
{
/*
* Add the serial number to the URI...
*/
strlcat(uri, "?serial=", urisize);
strlcat(uri, serial_number, urisize);
}
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int length; /* Length of device ID info */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* First figure out which USB printer filename to use...
*/
if (access("/dev/usblp0", 0) == 0)
strcpy(format, "/dev/usblp%d");
else if (access("/dev/usb/usblp0", 0) == 0)
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then open each USB device...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (ioctl(fd, LPIOC_GET_DEVICE_ID(sizeof(device_id)), device_id) == 0)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
/*
* Check to see if the length is larger than our buffer; first
* assume that the vendor incorrectly implemented the 1284 spec,
* and then limit the length to the size of our buffer...
*/
if (length > (sizeof(device_id) - 2))
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (sizeof(device_id) - 2))
length = sizeof(device_id) - 2;
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
#elif defined(__sgi)
#elif defined(__sun)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
# ifdef ECPPIOC_GETDEVID
struct ecpp_device_id did; /* Device ID buffer */
# endif /* ECPPIOC_GETDEVID */
/*
* Open each USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
# ifndef ECPPIOC_GETDEVID
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# else
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# endif /* !ECPPIOC_GETDEVID */
}
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
int i; /* Looping var */
char device[255]; /* Device filename */
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/ulpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
sprintf(device, "/dev/unlpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d (no reset)\"\n", device, i + 1);
}
#endif
}
/*
* 'open_device()' - Open a USB device...
*/
int /* O - File descriptor or -1 on error */
open_device(const char *uri) /* I - Device URI */
{
/*
* The generic implementation just treats the URI as a device filename...
* Specific operating systems may also support using the device serial
* number and/or make/model.
*/
if (strncmp(uri, "usb:/dev/", 9) == 0)
return (open(uri + 4, O_RDWR | O_EXCL));
#ifdef __linux
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Linux, try looking up the device serial number or model...
*/
int i; /* Looping var */
int busy; /* Are any ports busy? */
int length; /* Length of device ID info */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
/*
* First figure out which USB printer filename to use...
*/
if (access("/dev/usblp0", 0) == 0)
strcpy(format, "/dev/usblp%d");
else if (access("/dev/usb/usblp0", 0) == 0)
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then find the correct USB device...
*/
do
{
for (busy = 0, i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (ioctl(fd, LPIOC_GET_DEVICE_ID(sizeof(device_id)), device_id) == 0)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
else
device_id[0] = '\0';
}
else
{
/*
* If the open failed because it was busy, flag it so we retry
* as needed...
*/
if (errno == EBUSY)
busy = 1;
device_id[0] = '\0';
}
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
{
/*
* Yes, return this file descriptor...
*/
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", device);
return (fd);
}
}
/*
* This wasn't the one...
*/
if (fd >= 0)
close(fd);
}
/*
* If we get here and at least one of the printer ports showed up
* as "busy", then sleep for a bit and retry...
*/
if (busy)
{
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
stderr);
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Solaris, try looking up the device serial number or model...
*/
int i; /* Looping var */
int busy; /* Are any ports busy? */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
struct ecpp_device_id did; /* Device ID buffer */
/*
* Find the correct USB device...
*/
do
{
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
}
else
{
/*
* If the open failed because it was busy, flag it so we retry
* as needed...
*/
if (errno == EBUSY)
busy = 1;
device_id[0] = '\0';
}
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
return (fd); /* Yes, return this file descriptor... */
}
/*
* This wasn't the one...
*/
if (fd >= 0)
close(fd);
}
/*
* If we get here and at least one of the printer ports showed up
* as "busy", then sleep for a bit and retry...
*/
if (busy)
{
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
stderr);
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#endif /* __linux */
else
{
errno = ENODEV;
return (-1);
}
}
/*
* End of "$Id$".
*/
+142 -336
Ver Arquivo
@@ -3,7 +3,7 @@
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -25,14 +25,20 @@
*
* Contents:
*
* list_devices() - List all available USB devices to stdout.
* print_device() - Print a file to a USB device.
* main() - Send a file to the specified USB port.
* list_devices() - List all USB devices.
*/
/*
* Include necessary headers.
*/
#ifdef __APPLE__
/* A header order dependency requires this be first */
# include <ApplicationServices/ApplicationServices.h>
#endif /* __APPLE__ */
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
@@ -54,6 +60,73 @@
*/
void list_devices(void);
int print_device(const char *uri, const char *hostname,
const char *resource, const char *options,
int fp, int copies);
/*
* Include the vendor-specific USB implementation...
*/
#ifdef __APPLE__
# include "usb-darwin.c"
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include "usb-unix.c"
#else
/*
* Use dummy functions that do nothing on unsupported platforms...
* These can be used as templates for implementing USB printing on new
* platforms...
*/
/*
* 'list_devices()' - List all available USB devices to stdout.
*/
void
list_devices(void)
{
/*
* Don't have any devices to list... Use output of the form:
*
* direct usb:/make/model?serial=foo "Make Model" "USB Printer"
*
* Note that "Hewlett Packard" or any other variation MUST be mapped to
* "HP" for compatibility with the PPD and ICC specs.
*/
}
/*
* 'print_device()' - Print a file to a USB device.
*/
int /* O - Exit status */
print_device(const char *uri, /* I - Device URI */
const char *hostname, /* I - Hostname/manufacturer */
const char *resource, /* I - Resource/modelname */
const char *options, /* I - Device options/serial number */
int fp, /* I - File descriptor to print */
int copies) /* I - Copies to print */
{
/*
* Can't print, so just reference the arguments to eliminate compiler
* warnings and return and exit status of 1. Normally you would use the
* arguments to send a file to the printer and return 0 if everything
* worked OK and non-zero if there was an error.
*/
(void)uri;
(void)hostname;
(void)resource;
(void)options;
(void)fp;
(void)copies;
return (1);
}
#endif /* __APPLE__ */
/*
@@ -64,27 +137,22 @@ void list_devices(void);
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
int fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
int fp; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
int port; /* Port number (not used) */
const char *uri; /* Device URI */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -94,6 +162,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -105,10 +187,41 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: USB job-id user title copies options [file]\n", stderr);
fputs("Usage: usb job-id user title copies options [file]\n", stderr);
return (1);
}
/*
* Extract the device name and options from the URI...
*/
if (strncmp(argv[0], "usb:", 4))
uri = getenv("DEVICE_URI");
else
uri = argv[0];
if (!uri)
{
fputs("ERROR: No device URI found in argv[0] or in DEVICE_URI environment variable!\n", stderr);
return (1);
}
httpSeparate(argv[0], method, username, hostname, &port, resource);
/*
* See if there are any options...
*/
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
}
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
@@ -127,335 +240,28 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
fprintf(stderr, "ERROR: unable to open print file %s - %s\n",
argv[6], strerror(errno));
return (1);
}
copies = atoi(argv[4]);
}
/*
* Extract the device name and options from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
/*
* See if there are any options...
*/
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
}
/*
* Open the USB port device...
*/
do
{
if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
{
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
fprintf(stderr, "ERROR: Unable to open USB port device file \"%s\": %s\n",
resource, strerror(errno));
return (1);
}
}
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
if (argc < 7)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
/*
* Finally, send the print file...
*/
while (copies > 0)
{
copies --;
if (fp != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
}
status = print_device(uri, hostname, resource, options, fp, copies);
/*
* Close the socket connection and input file and return...
* Close the input file and return...
*/
close(fd);
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
FILE *probe; /* /proc/bus/usb/devices file */
char line[1024], /* Line from file */
*delim, /* Delimiter in file */
make[IPP_MAX_NAME], /* Make from file */
model[IPP_MAX_NAME]; /* Model from file */
/*
* First try opening one of the USB devices to load the driver
* module as needed...
*/
if ((fd = open("/dev/usb/lp0", O_WRONLY)) >= 0)
close(fd); /* 2.3.x and 2.4.x */
else if ((fd = open("/dev/usb/usblp0", O_WRONLY)) >= 0)
close(fd); /* Mandrake 7.x */
else if ((fd = open("/dev/usblp0", O_WRONLY)) >= 0)
close(fd); /* 2.2.x */
/*
* Then look at the device list for the USB bus...
*/
if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL)
{
/*
* Scan the device list...
*/
i = 0;
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
while (fgets(line, sizeof(line), probe) != NULL)
{
/*
* Strip trailing newline.
*/
if ((delim = strrchr(line, '\n')) != NULL)
*delim = '\0';
/*
* See if it is a printer device ("P: ...")
*/
if (strncmp(line, "S:", 2) == 0)
{
/*
* String attribute...
*/
if (strncmp(line, "S: Manufacturer=", 17) == 0)
{
strlcpy(make, line + 17, sizeof(make));
if (strcmp(make, "Hewlett-Packard") == 0)
strcpy(make, "HP");
}
else if (strncmp(line, "S: Product=", 12) == 0)
strlcpy(model, line + 12, sizeof(model));
}
else if (strncmp(line, "I:", 2) == 0 &&
(strstr(line, "Driver=printer") != NULL ||
strstr(line, "Driver=usblp") != NULL) &&
make[0] && model[0])
{
/*
* We were processing a printer device; send the info out...
*/
sprintf(device, "/dev/usb/lp%d", i);
if (access(device, 0))
{
sprintf(device, "/dev/usb/usblp%d", i);
if (access(device, 0))
sprintf(device, "/dev/usblp%d", i);
}
printf("direct usb:%s \"%s %s\" \"USB Printer #%d\"\n",
device, make, model, i + 1);
i ++;
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
}
}
fclose(probe);
/*
* Write empty device listings for unused USB devices...
*/
for (; i < 16; i ++)
{
sprintf(device, "/dev/usb/lp%d", i);
if (access(device, 0))
{
sprintf(device, "/dev/usb/usblp%d", i);
if (access(device, 0))
{
sprintf(device, "/dev/usblp%d", i);
if (access(device, 0))
continue;
}
}
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
}
else
{
/*
* Just check manually for USB devices...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, "/dev/usb/lp%d", i);
if (access(device, 0))
{
sprintf(device, "/dev/usb/usblp%d", i);
if (access(device, 0))
{
sprintf(device, "/dev/usblp%d", i);
if (access(device, 0))
continue;
}
}
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
}
#elif defined(__sgi)
#elif defined(__sun)
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__)
int i; /* Looping var */
char device[255]; /* Device filename */
for (i = 0; i < 3; i ++)
{
sprintf(device, "/dev/unlpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
#elif defined(__NetBSD__) || defined(__OpenBSD__)
int i; /* Looping var */
char device[255]; /* Device filename */
for (i = 0; i < 3; i ++)
{
sprintf(device, "/dev/ulpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
#endif
return (status);
}
+5 -4
Ver Arquivo
@@ -1,11 +1,12 @@
# DO NOT DELETE
lpc.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lpc.o: ../cups/ppd.h ../cups/language.h ../cups/debug.h
lpc.o: ../cups/ppd.h ../cups/language.h ../cups/debug.h ../cups/string.h
lpc.o: ../config.h
lpq.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
lpq.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/language.h
lpq.o: ../cups/debug.h
lpr.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lpr.o: ../cups/ppd.h
lpr.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
lpr.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h
lprm.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lprm.o: ../cups/ppd.h ../cups/language.h
lprm.o: ../cups/ppd.h ../cups/language.h ../cups/string.h ../config.h
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
+17 -12
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -40,6 +40,7 @@
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/debug.h>
#include <cups/string.h>
/*
@@ -98,18 +99,18 @@ main(int argc, /* I - Number of command-line arguments */
* Find any options in the string...
*/
while (isspace(line[0]))
strcpy(line, line + 1);
while (isspace(line[0] & 255))
cups_strcpy(line, line + 1);
for (params = line; *params != '\0'; params ++)
if (isspace(*params))
if (isspace(*params & 255))
break;
/*
* Remove whitespace between the command and parameters...
*/
while (isspace(*params))
while (isspace(*params & 255))
*params++ = '\0';
/*
@@ -220,7 +221,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
*jattr; /* Current job attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device; /* Device URI */
*device, /* Device URI */
*delimiter; /* Char search result */
ipp_pstate_t pstate; /* Printer state */
int accepting; /* Is printer accepting jobs? */
int jobcount; /* Count of current jobs */
@@ -350,7 +352,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip leading whitespace and commas...
*/
while (isspace(*dptr) || *dptr == ',')
while (isspace(*dptr & 255) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -364,7 +366,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
ptr ++, dptr ++);
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr)))
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr & 255)))
{
match = 1;
break;
@@ -374,9 +376,9 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip trailing junk...
*/
while (!isspace(*dptr) && *dptr != '\0')
while (!isspace(*dptr & 255) && *dptr != '\0')
dptr ++;
while (isspace(*dptr) || *dptr == ',')
while (isspace(*dptr & 255) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -453,8 +455,11 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Just show the method...
*/
*strchr(device, ':') = '\0';
printf("\tprinter is on device \'%s\' speed -1\n", device);
if ((delimiter = strchr(device, ':')) != NULL )
{
*delimiter = '\0';
printf("\tprinter is on device \'%s\' speed -1\n", device);
}
}
printf("\tqueuing is %sabled\n", accepting ? "en" : "dis");
+76 -19
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -26,6 +26,7 @@
* main() - Parse options and commands.
* show_jobs() - Show jobs.
* show_printer() - Show printer status.
* usage() - Show program usage.
*/
/*
@@ -51,6 +52,7 @@
static int show_jobs(http_t *, const char *, const char *, const int,
const int);
static void show_printer(http_t *, const char *);
static void usage(void);
/*
@@ -67,13 +69,14 @@ main(int argc, /* I - Number of command-line arguments */
*user; /* Desired user */
char *instance; /* Printer instance */
int id, /* Desired job ID */
all, /* All printers */
interval, /* Reporting interval */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
#ifdef HAVE_LIBSSL
#ifdef HAVE_SSL
http_encryption_t encryption; /* Encryption? */
#endif /* HAVE_LIBSSL */
#endif /* HAVE_SSL */
/*
@@ -96,13 +99,10 @@ main(int argc, /* I - Number of command-line arguments */
id = 0;
interval = 0;
longstatus = 0;
all = 0;
num_dests = cupsGetDests(&dests);
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '+')
interval = atoi(argv[i] + 1);
@@ -111,7 +111,7 @@ main(int argc, /* I - Number of command-line arguments */
switch (argv[i][1])
{
case 'E' : /* Encrypt */
#ifdef HAVE_LIBSSL
#ifdef HAVE_SSL
encryption = HTTP_ENCRYPT_REQUIRED;
if (http)
@@ -119,7 +119,7 @@ main(int argc, /* I - Number of command-line arguments */
#else
fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
argv[0]);
#endif /* HAVE_LIBSSL */
#endif /* HAVE_SSL */
break;
case 'P' : /* Printer */
@@ -128,15 +128,35 @@ main(int argc, /* I - Number of command-line arguments */
else
{
i ++;
if (i >= argc)
{
httpClose(http);
cupsFreeDests(num_dests, dests);
usage();
}
dest = argv[i];
}
if ((instance = strchr(dest, '/')) != NULL)
*instance = '\0';
*instance++ = '\0';
if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
{
if (instance)
fprintf(stderr, "lpq: Unknown destination \"%s/%s\"!\n",
dest, instance);
else
fprintf(stderr, "lpq: Unknown destination \"%s\"!\n", dest);
return (1);
}
break;
case 'a' : /* All printers */
dest = NULL;
all = 1;
break;
case 'l' : /* Long status */
@@ -144,17 +164,33 @@ main(int argc, /* I - Number of command-line arguments */
break;
default :
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
cupsFreeDests(num_dests, dests);
usage();
break;
}
}
else if (isdigit(argv[i][0]))
else if (isdigit(argv[i][0] & 255))
id = atoi(argv[i]);
else
user = argv[i];
if (dest == NULL && !all)
{
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
if (dest == NULL)
{
fputs("lpq: error - no default destination available.\n", stderr);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
}
}
/*
* Show the status in a loop...
*/
@@ -402,7 +438,16 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
strcpy(rankstr, "active");
else
{
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
/*
* Make the rank show the "correct" suffix for each number
* (11-13 are the only special cases, for English anyways...)
*/
if ((rank % 100) >= 11 && (rank % 100) <= 13)
snprintf(rankstr, sizeof(rankstr), "%dth", rank);
else
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
rank ++;
}
@@ -416,15 +461,15 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
else
strlcpy(namestr, jobname, sizeof(namestr));
printf("%s: %-34.34s[job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-40.40s%d bytes\n", namestr, jobsize);
printf("%s: %-33.33s [job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-39.39s %d bytes\n", namestr, jobsize);
}
else
#ifdef __osf__
printf("%-6s %-10.10s %-4d %-10d %-27.27s %d bytes\n", rankstr, jobuser,
jobpriority, jobid, jobname, jobsize);
#else
printf("%-7s %-8.8s%-8d%-32.32s%d bytes\n", rankstr, jobuser,
printf("%-7s %-7.7s %-7d %-31.31s %d bytes\n", rankstr, jobuser,
jobid, jobname, jobsize);
#endif /* __osf */
@@ -533,6 +578,18 @@ show_printer(http_t *http, /* I - HTTP connection to server */
}
/*
* 'usage()' - Show program usage.
*/
static void
usage(void)
{
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
exit(1);
}
/*
* End of "$Id$".
*/
+29 -23
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -33,12 +33,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <config.h>
#include <cups/string.h>
#include <cups/cups.h>
#ifndef WIN32
# include <unistd.h>
# include <signal.h>
@@ -102,12 +104,12 @@ main(int argc, /* I - Number of command-line arguments */
switch (ch = argv[i][1])
{
case 'E' : /* Encrypt */
#ifdef HAVE_LIBSSL
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
argv[0]);
#endif /* HAVE_LIBSSL */
#endif /* HAVE_SSL */
break;
case '1' : /* TROFF font set 1 */
@@ -228,12 +230,6 @@ main(int argc, /* I - Number of command-line arguments */
num_copies = atoi(argv[i]);
}
if (num_copies < 1 || num_copies > 100)
{
fputs("lpr: Number copies must be between 1 and 100.\n", stderr);
return (1);
}
sprintf(buffer, "%d", num_copies);
num_options = cupsAddOption("copies", buffer, num_options, &options);
break;
@@ -282,6 +278,13 @@ main(int argc, /* I - Number of command-line arguments */
* Print a file...
*/
if (access(argv[i], R_OK) != 0)
{
fprintf(stderr, "lpr: Unable to access \"%s\" - %s\n", argv[i],
strerror(errno));
return (1);
}
files[num_files] = argv[i];
num_files ++;
@@ -304,23 +307,25 @@ main(int argc, /* I - Number of command-line arguments */
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
for (j = 0, dest = dests; j < num_dests; j ++, dest ++)
if (dest->is_default)
{
printer = dests[j].name;
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL)
{
printer = dest->name;
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
break;
}
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
}
}
if (printer == NULL)
{
fputs("lpr: error - no default destination available.\n", stderr);
if (cupsLastError() == IPP_NOT_FOUND)
fputs("lpr: error - no default destination available.\n", stderr);
else
fputs("lpr: error - scheduler not responding!\n", stderr);
return (1);
}
@@ -367,7 +372,8 @@ main(int argc, /* I - Number of command-line arguments */
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
fputs("lpr: unable to create temporary file.\n", stderr);
fprintf(stderr, "lpr: unable to create temporary file \"%s\" - %s\n",
tempfile, strerror(errno));
return (1);
}
+14 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lprm" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -32,10 +32,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/string.h>
/*
@@ -98,14 +98,14 @@ main(int argc, /* I - Number of command-line arguments */
switch (argv[i][1])
{
case 'E' : /* Encrypt */
#ifdef HAVE_LIBSSL
#ifdef HAVE_SSL
encryption = HTTP_ENCRYPT_REQUIRED;
httpEncryption(http, encryption);
#else
fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
argv[0]);
#endif /* HAVE_LIBSSL */
#endif /* HAVE_SSL */
break;
case 'P' : /* Cancel jobs on a printer */
@@ -119,6 +119,14 @@ main(int argc, /* I - Number of command-line arguments */
if ((instance = strchr(dest, '/')) != NULL)
*instance = '\0';
if (cupsGetDest(dest, NULL, num_dests, dests) == NULL)
{
fprintf(stderr, "lprm: Unknown destination \"%s\"!\n", dest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return(1);
}
break;
default :
@@ -133,7 +141,8 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel a job or printer...
*/
if (isdigit(argv[i][0]))
if (isdigit(argv[i][0] & 255) &&
cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
{
dest = NULL;
op = IPP_CANCEL_JOB;
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# CGI makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products.
# Copyright 1997-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
+146 -43
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -119,6 +119,8 @@ main(int argc, /* I - Number of command-line arguments */
do_printer_op(http, language, CUPS_REJECT_JOBS);
else if (strcmp(op, "purge-jobs") == 0)
do_printer_op(http, language, IPP_PURGE_JOBS);
else if (strcmp(op, "set-as-default") == 0)
do_printer_op(http, language, CUPS_SET_DEFAULT);
else if (strcmp(op, "add-class") == 0)
do_am_class(http, language, 0);
else if (strcmp(op, "add-printer") == 0)
@@ -233,7 +235,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
@@ -256,17 +258,14 @@ do_am_class(http_t *http, /* I - HTTP connection */
}
name = cgiGetVariable("PRINTER_NAME");
if (isdigit(*name))
ptr = name;
else
for (ptr = name; *ptr; ptr ++)
if (!isalnum(*ptr) && *ptr != '_')
break;
for (ptr = name; *ptr; ptr ++)
if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/')
break;
if (*ptr || ptr == name)
if (*ptr || ptr == name || strlen(name) > 127)
{
cgiSetVariable("ERROR", "The class name may only contain letters, "
"numbers, and the underscore.");
cgiSetVariable("ERROR", "The class name may only contain up to 127 printable "
"characters and may not contain spaces.");
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
return;
}
@@ -450,7 +449,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_NOT_AUTHORIZED;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -551,7 +550,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
*/
if (oldinfo)
ippSetCGIVars(oldinfo, NULL, NULL);
ippSetCGIVars(oldinfo, NULL, NULL, NULL, 0);
cgiCopyTemplateLang(stdout, TEMPLATES, "modify-printer.tmpl", getenv("LANG"));
}
@@ -570,17 +569,14 @@ do_am_printer(http_t *http, /* I - HTTP connection */
return;
}
if (isdigit(*name))
ptr = name;
else
for (ptr = name; *ptr; ptr ++)
if (!isalnum(*ptr) && *ptr != '_')
break;
for (ptr = name; *ptr; ptr ++)
if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/')
break;
if (*ptr || ptr == name)
if (*ptr || ptr == name || strlen(name) > 127)
{
cgiSetVariable("ERROR", "The printer name may only contain letters, "
"numbers, and the underscore.");
cgiSetVariable("ERROR", "The printer name may only contain up to 127 printable "
"characters and may not contain spaces.");
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
return;
}
@@ -616,7 +612,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
@@ -782,7 +778,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
strlcpy(make, var, sizeof(make));
ippSetCGIVars(response, "ppd-make", make);
ippSetCGIVars(response, "ppd-make", make, NULL, 0);
cgiCopyTemplateLang(stdout, TEMPLATES, "choose-model.tmpl",
getenv("LANG"));
}
@@ -876,7 +872,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_NOT_AUTHORIZED;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -922,6 +918,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */
ppd_file_t *ppd; /* PPD file */
ppd_group_t *group; /* Option group */
ppd_option_t *option; /* Option */
ppd_attr_t *protocol; /* cupsProtocol attribute */
/*
@@ -941,14 +938,37 @@ do_config_printer(http_t *http, /* I - HTTP connection */
* Get the PPD file...
*/
cupsSetServer("localhost");
if ((filename = cupsGetPPD(printer)) == NULL)
{
cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
if (cupsLastError() == IPP_NOT_FOUND)
{
/*
* No PPD file for this printer, so we can't configure it!
*/
cgiSetVariable("ERROR", ippErrorString(IPP_NOT_POSSIBLE));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
}
else
{
/*
* Unable to access the PPD file for some reason...
*/
cgiSetVariable("ERROR", ippErrorString(cupsLastError()));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
}
return;
}
ppd = ppdOpenFile(filename);
if ((ppd = ppdOpenFile(filename)) == NULL)
{
cgiSetVariable("ERROR", ippErrorString(IPP_DEVICE_ERROR));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
return;
}
if (cgiGetVariable("job_sheets_start") != NULL ||
cgiGetVariable("job_sheets_end") != NULL)
@@ -956,19 +976,34 @@ do_config_printer(http_t *http, /* I - HTTP connection */
else
have_options = 0;
for (i = ppd->num_groups, group = ppd->groups;
i > 0 && !have_options;
i --, group ++)
for (j = group->num_options, option = group->options;
j > 0;
j --, option ++)
ppdMarkDefaults(ppd);
DEBUG_printf(("<P>ppd->num_groups = %d\n"
"<UL>\n", ppd->num_groups));
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
{
DEBUG_printf(("<LI>%s<UL>\n", group->text));
for (j = group->num_options, option = group->options; j > 0; j --, option ++)
if ((var = cgiGetVariable(option->keyword)) != NULL)
{
DEBUG_printf(("<LI>%s = \"%s\"</LI>\n", option->keyword, var));
have_options = 1;
break;
ppdMarkOption(ppd, option->keyword, var);
}
#ifdef DEBUG
else
printf("<LI>%s not defined!</LI>\n", option->keyword);
#endif /* DEBUG */
if (!have_options)
DEBUG_puts("</UL></LI>");
}
DEBUG_printf(("</UL>\n"
"<P>ppdConflicts(ppd) = %d\n", ppdConflicts(ppd)));
if (!have_options || ppdConflicts(ppd))
{
/*
* Show the options to the user...
@@ -977,6 +1012,21 @@ do_config_printer(http_t *http, /* I - HTTP connection */
cgiCopyTemplateLang(stdout, TEMPLATES, "config-printer.tmpl",
getenv("LANG"));
if (ppdConflicts(ppd))
{
for (i = ppd->num_groups, k = 0, group = ppd->groups; i > 0; i --, group ++)
for (j = group->num_options, option = group->options; j > 0; j --, option ++)
if (option->conflicted)
{
cgiSetArray("ckeyword", k, option->keyword);
cgiSetArray("ckeytext", k, option->text);
k ++;
}
cgiCopyTemplateLang(stdout, TEMPLATES, "option-conflict.tmpl",
getenv("LANG"));
}
for (i = ppd->num_groups, group = ppd->groups;
i > 0;
i --, group ++)
@@ -999,7 +1049,11 @@ do_config_printer(http_t *http, /* I - HTTP connection */
cgiSetVariable("KEYWORD", option->keyword);
cgiSetVariable("KEYTEXT", option->text);
cgiSetVariable("DEFCHOICE", option->defchoice);
if (option->conflicted)
cgiSetVariable("CONFLICTED", "1");
else
cgiSetVariable("CONFLICTED", "0");
cgiSetSize("CHOICES", option->num_choices);
cgiSetSize("TEXT", option->num_choices);
@@ -1007,6 +1061,9 @@ do_config_printer(http_t *http, /* I - HTTP connection */
{
cgiSetArray("CHOICES", k, option->choices[k].choice);
cgiSetArray("TEXT", k, option->choices[k].text);
if (option->choices[k].marked)
cgiSetVariable("DEFCHOICE", option->choices[k].choice);
}
switch (option->ui)
@@ -1104,6 +1161,45 @@ do_config_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
/*
* Binary protocol support...
*/
if (ppd->protocols && strstr(ppd->protocols, "BCP"))
{
protocol = ppdFindAttr(ppd, "cupsProtocol", NULL);
cgiSetVariable("GROUP", "PS Binary Protocol");
cgiCopyTemplateLang(stdout, TEMPLATES, "option-header.tmpl",
getenv("LANG"));
cgiSetSize("CHOICES", 2);
cgiSetSize("TEXT", 2);
cgiSetArray("CHOICES", 0, "None");
cgiSetArray("TEXT", 0, "None");
if (strstr(ppd->protocols, "TBCP"))
{
cgiSetArray("CHOICES", 1, "TBCP");
cgiSetArray("TEXT", 1, "TBCP");
}
else
{
cgiSetArray("CHOICES", 1, "BCP");
cgiSetArray("TEXT", 1, "BCP");
}
cgiSetVariable("KEYWORD", "protocol");
cgiSetVariable("KEYTEXT", "PS Binary Protocol");
cgiSetVariable("DEFCHOICE", protocol ? protocol->value : "None");
cgiCopyTemplateLang(stdout, TEMPLATES, "option-pickone.tmpl",
getenv("LANG"));
cgiCopyTemplateLang(stdout, TEMPLATES, "option-trailer.tmpl",
getenv("LANG"));
}
cgiCopyTemplateLang(stdout, TEMPLATES, "config-printer2.tmpl",
getenv("LANG"));
}
@@ -1127,7 +1223,9 @@ do_config_printer(http_t *http, /* I - HTTP connection */
while (get_line(line, sizeof(line), in) != NULL)
{
if (strncmp(line, "*Default", 8) != 0)
if (!strncmp(line, "*cupsProtocol:", 14) && cgiGetVariable("protocol"))
continue;
else if (strncmp(line, "*Default", 8))
fprintf(out, "%s\n", line);
else
{
@@ -1138,7 +1236,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */
strlcpy(keyword, line + 8, sizeof(keyword));
for (keyptr = keyword; *keyptr; keyptr ++)
if (*keyptr == ':' || isspace(*keyptr))
if (*keyptr == ':' || isspace(*keyptr & 255))
break;
*keyptr = '\0';
@@ -1155,6 +1253,9 @@ do_config_printer(http_t *http, /* I - HTTP connection */
}
}
if ((var = cgiGetVariable("protocol")) != NULL)
fprintf(out, "*cupsProtocol: %s\n", cgiGetVariable("protocol"));
fclose(in);
fclose(out);
close(outfd);
@@ -1201,7 +1302,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_NOT_AUTHORIZED;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1282,7 +1383,7 @@ do_delete_class(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1358,7 +1459,7 @@ do_delete_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1429,7 +1530,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1446,6 +1547,8 @@ do_printer_op(http_t *http, /* I - HTTP connection */
cgiCopyTemplateLang(stdout, TEMPLATES, "printer-reject.tmpl", getenv("LANG"));
else if (op == IPP_PURGE_JOBS)
cgiCopyTemplateLang(stdout, TEMPLATES, "printer-purge.tmpl", getenv("LANG"));
else if (op == CUPS_SET_DEFAULT)
cgiCopyTemplateLang(stdout, TEMPLATES, "printer-default.tmpl", getenv("LANG"));
}
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI support library definitions.
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
+35 -49
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -37,21 +37,25 @@
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
char *pclass; /* Printer class name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI];
/* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
cups_lang_t *language; /* Language information */
char *pclass; /* Printer class name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI]; /* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
static const char *def_attrs[] = /* Attributes for default printer */
{
"printer-name",
"printer-uri-supported"
};
/*
@@ -113,6 +117,10 @@ main(int argc, /* I - Number of command-line arguments */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
@@ -120,38 +128,12 @@ main(int argc, /* I - Number of command-line arguments */
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
const char *server; /* Name of server */
char url[HTTP_MAX_URI]; /* New URL */
/*
* Map localhost access to localhost...
*/
server = getenv("SERVER_NAME");
httpSeparate(attr->values[0].string.text, method, username,
hostname, &port, resource);
if (strcasecmp(hostname, server) == 0 &&
(strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
strcmp(getenv("REMOTE_HOST"), server) == 0))
strcpy(hostname, "localhost");
/*
* Rewrite URI with HTTP address...
*/
snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
resource);
cgiSetVariable("DEFAULT_URI", uri);
cgiSetVariable("DEFAULT_URI",
ippRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
}
ippDelete(response);
@@ -202,13 +184,15 @@ main(int argc, /* I - Number of command-line arguments */
uri);
}
ippGetAttributes(request, TEMPLATES, "classes.tmpl", getenv("LANG"));
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
@@ -253,13 +237,15 @@ main(int argc, /* I - Number of command-line arguments */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
ippGetAttributes(request, TEMPLATES, "jobs.tmpl", getenv("LANG"));
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
@@ -320,12 +306,12 @@ main(int argc, /* I - Number of command-line arguments */
CUPS_DATADIR "/data/testprint.ps")) != NULL)
{
status = response->request.status.status_code;
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
cgiSetVariable("PRINTER_NAME", pclass);
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI HTML functions.
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
+337 -62
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP variable routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -23,7 +23,10 @@
*
* Contents:
*
* ippGetAttributes() - Get the list of attributes that are needed
* by the template file.
* ippGetTemplateDir() - Get the templates directory...
* ippRewriteURL() - Rewrite a printer URI into a web browser URL...
* ippSetServerVersion() - Set the server name and CUPS version...
* ippSetCGIVars() - Set CGI variables from an IPP response.
*/
@@ -35,6 +38,130 @@
#include "ipp-var.h"
/*
* 'ippGetAttributes()' - Get the list of attributes that are needed
* by the template file.
*/
void
ippGetAttributes(ipp_t *request, /* I - IPP request */
const char *directory, /* I - Directory */
const char *tmpl, /* I - Base filename */
const char *lang) /* I - Language */
{
int num_attrs; /* Number of attributes */
char *attrs[1000]; /* Attributes */
int i; /* Looping var */
char filename[1024], /* Filename */
locale[16]; /* Locale name */
FILE *in; /* Input file */
int ch; /* Character from file */
char name[255], /* Name of variable */
*nameptr; /* Pointer into name */
/*
* Convert the language to a locale name...
*/
if (lang != NULL)
{
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i] & 255))
locale[i] = tolower(lang[i]);
else
locale[i] = '_';
locale[i] = '\0';
}
else
locale[0] = '\0';
/*
* See if we have a template file for this language...
*/
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
if (access(filename, 0))
{
locale[2] = '\0';
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
if (access(filename, 0))
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
}
/*
* Open the template file...
*/
if ((in = fopen(filename, "r")) == NULL)
return;
/*
* Loop through the file adding attribute names as needed...
*/
num_attrs = 0;
while ((ch = getc(in)) != EOF)
if (ch == '\\')
getc(in);
else if (ch == '{' && num_attrs < (sizeof(attrs) / sizeof(attrs[0])))
{
/*
* Grab the name...
*/
for (nameptr = name; (ch = getc(in)) != EOF;)
if (strchr("}]<>=! \t\n", ch))
break;
else if (nameptr > name && ch == '?')
break;
else if (nameptr < (name + sizeof(name) - 1))
{
if (ch == '_')
*nameptr++ = '-';
else
*nameptr++ = ch;
}
*nameptr = '\0';
if (!strncmp(name, "printer_state_history", 21))
strcpy(name, "printer_state_history");
/*
* Possibly add it to the list of attributes...
*/
for (i = 0; i < num_attrs; i ++)
if (!strcmp(attrs[i], name))
break;
if (i >= num_attrs)
{
attrs[num_attrs] = strdup(name);
num_attrs ++;
}
}
/*
* If we have attributes, add a requested-attributes attribute to the
* request...
*/
if (num_attrs > 0)
{
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", num_attrs, NULL, (const char **)attrs);
for (i = 0; i < num_attrs; i ++)
free(attrs[i]);
}
}
/*
* 'ippGetTemplateDir()' - Get the templates directory...
*/
@@ -62,6 +189,135 @@ ippGetTemplateDir(void)
}
/*
* 'ippRewriteURL()' - Rewrite a printer URI into a web browser URL...
*/
char * /* O - New URL */
ippRewriteURL(const char *uri, /* I - Current URI */
char *url, /* O - New URL */
int urlsize, /* I - Size of URL buffer */
const char *newresource) /* I - Replacement resource */
{
char method[HTTP_MAX_URI],
userpass[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
rawresource[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
/* URI components... */
*rawptr, /* Pointer into rawresource */
*resptr; /* Pointer into resource */
int port; /* Port number */
static int ishttps = -1; /* Using encryption? */
static const char *server; /* Name of server */
static char servername[1024];
/* Local server name */
static const char hexchars[] = "0123456789ABCDEF";
/* Hexadecimal conversion characters */
/*
* Check if we have been called before...
*/
if (ishttps < 0)
{
/*
* No, initialize static vars for the conversion...
*
* First get the server name associated with the client interface as
* well as the locally configured hostname. We'll check *both* of
* these to see if the printer URL is local...
*/
server = getenv("SERVER_NAME");
gethostname(servername, sizeof(servername));
/*
* Then flag whether we are using SSL on this connection...
*/
ishttps = getenv("HTTPS") != NULL;
}
/*
* Convert the URI to a URL...
*/
httpSeparate(uri, method, userpass, hostname, &port, rawresource);
if (strcmp(method, "ipp") == 0 ||
strcmp(method, "http") == 0)
{
if (newresource)
{
/*
* Force the specified resource name instead of the one in the URL...
*/
strlcpy(resource, newresource, sizeof(resource));
}
else
{
/*
* Rewrite the resource string so it doesn't contain any
* illegal chars...
*/
for (rawptr = rawresource, resptr = resource; *rawptr; rawptr ++)
if ((*rawptr & 128) || *rawptr == '%' || *rawptr == ' ' ||
*rawptr == '#' || *rawptr == '?' ||
*rawptr == '.') /* For MSIE */
{
if (resptr < (resource + sizeof(resource) - 3))
{
*resptr++ = '%';
*resptr++ = hexchars[(*rawptr >> 4) & 15];
*resptr++ = hexchars[*rawptr & 15];
}
}
else if (resptr < (resource + sizeof(resource) - 1))
*resptr++ = *rawptr;
*resptr = '\0';
}
/*
* Map local access to a local URI...
*/
if (strcasecmp(hostname, server) == 0 ||
strcasecmp(hostname, servername) == 0)
{
/*
* Make URI relative to the current server...
*/
strlcpy(url, resource, urlsize);
}
else
{
/*
* Rewrite URI with HTTP/HTTPS scheme...
*/
if (userpass[0])
snprintf(url, urlsize, "%s://%s@%s:%d%s",
ishttps ? "https" : "http",
userpass, hostname, port, resource);
else
snprintf(url, urlsize, "%s://%s:%d%s",
ishttps ? "https" : "http",
hostname, port, resource);
}
}
else
strlcpy(url, uri, urlsize);
return (url);
}
/*
* 'ippSetServerVersion()' - Set the server name and CUPS version...
*/
@@ -72,6 +328,10 @@ ippSetServerVersion(void)
cgiSetVariable("SERVER_NAME", getenv("SERVER_NAME"));
cgiSetVariable("REMOTE_USER", getenv("REMOTE_USER"));
cgiSetVariable("CUPS_VERSION", CUPS_SVERSION);
#ifdef LC_TIME
setlocale(LC_TIME, "");
#endif /* LC_TIME */
}
@@ -82,36 +342,42 @@ ippSetServerVersion(void)
void
ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
const char *filter_name, /* I - Filter name */
const char *filter_value) /* I - Filter value */
const char *filter_value, /* I - Filter value */
const char *prefix, /* I - Prefix for name or NULL */
int parent_el) /* I - Parent element number */
{
int element; /* Element in CGI array */
ipp_attribute_t *attr, /* Attribute in response... */
*filter; /* Filtering attribute */
int i; /* Looping var */
char name[1024], /* Name of attribute */
*nameptr, /* Pointer into name */
value[16384], /* Value(s) */
*valptr; /* Pointer into value */
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
int ishttps; /* Using encryption? */
const char *server; /* Name of server */
struct tm *date; /* Date information */
ippSetServerVersion();
DEBUG_printf(("<P>ippSetCGIVars(response=%p, filter_name=\"%s\", filter_value=\"%s\", prefix=\"%s\")\n",
response, filter_name, filter_value, prefix));
/*
* Set common CGI template variables...
*/
server = getenv("SERVER_NAME");
ishttps = getenv("HTTPS") != NULL;
if (!prefix)
ippSetServerVersion();
for (attr = response->attrs;
attr && attr->group_tag == IPP_TAG_OPERATION;
attr = attr->next);
/*
* Loop through the attributes and set them for the template...
*/
for (element = 0; attr != NULL; attr = attr->next, element ++)
attr = response->attrs;
if (!prefix)
while (attr && attr->group_tag == IPP_TAG_OPERATION)
attr = attr->next;
for (element = parent_el; attr != NULL; attr = attr->next, element ++)
{
/*
* Copy attributes to a separator...
@@ -150,20 +416,28 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
if (attr->name == NULL)
continue;
for (i = 0; attr->name[i]; i ++)
if (attr->name[i] == '-')
name[i] = '_';
else
name[i] = attr->name[i];
if (prefix)
{
snprintf(name, sizeof(name), "%s.", prefix);
nameptr = name + strlen(name);
}
else
nameptr = name;
name[i] = '\0';
for (i = 0; attr->name[i] && nameptr < (name + sizeof(name) - 1); i ++)
if (attr->name[i] == '-')
*nameptr++ = '_';
else
*nameptr++ = attr->name[i];
*nameptr = '\0';
/*
* Add "job_printer_name" variable if we have a "job_printer_uri"
* attribute...
*/
if (strcmp(name, "job_printer_uri") == 0)
if (!strcmp(name, "job_printer_uri"))
{
if ((valptr = strrchr(attr->values[0].string.text, '/')) == NULL)
valptr = "unknown";
@@ -173,6 +447,19 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
cgiSetArray("job_printer_name", element, valptr);
}
/*
* Add "admin_uri" variable if we have a "printer_uri_supported"
* attribute...
*/
if (!strcmp(name, "printer_uri_supported"))
{
ippRewriteURL(attr->values[0].string.text, value, sizeof(value),
"/admin/");
cgiSetArray("admin_uri", element, value);
}
/*
* Copy values...
*/
@@ -193,7 +480,11 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
case IPP_TAG_ENUM :
if (strncmp(name, "time_at_", 8) == 0)
{
date = localtime((time_t *)&(attr->values[i].integer));
time_t t; /* Temporary time value */
t = (time_t)attr->values[i].integer;
date = localtime(&t);
strftime(valptr, sizeof(value) - (valptr - value),
CUPS_STRFTIME_FORMAT, date);
}
@@ -228,43 +519,13 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
case IPP_TAG_URI :
if (strchr(attr->values[i].string.text, ':') != NULL)
{
httpSeparate(attr->values[i].string.text, method, username,
hostname, &port, resource);
/*
* Rewrite URIs...
*/
if (strcmp(method, "ipp") == 0 ||
strcmp(method, "http") == 0)
{
/*
* Map localhost access to localhost and local port...
*/
if (strcasecmp(hostname, server) == 0)
{
/*
* Make URI relative to the current server...
*/
strlcpy(uri, resource, sizeof(uri));
}
else
{
/*
* Rewrite URI with HTTP address...
*/
if (username[0])
snprintf(uri, sizeof(uri), "%s://%s@%s:%d%s",
ishttps ? "https" : "http",
username, hostname, port, resource);
else
snprintf(uri, sizeof(uri), "%s://%s:%d%s",
ishttps ? "https" : "http",
hostname, port, resource);
}
strlcat(valptr, uri, sizeof(value) - (valptr - value));
break;
}
ippRewriteURL(attr->values[i].string.text, valptr,
sizeof(value) - (valptr - value), NULL);
break;
}
case IPP_TAG_STRING :
@@ -273,10 +534,17 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
case IPP_TAG_KEYWORD :
case IPP_TAG_CHARSET :
case IPP_TAG_LANGUAGE :
case IPP_TAG_MIMETYPE :
strlcat(valptr, attr->values[i].string.text,
sizeof(value) - (valptr - value));
break;
case IPP_TAG_BEGIN_COLLECTION :
snprintf(value, sizeof(value), "%s%d", name, i + 1);
ippSetCGIVars(attr->values[i].collection, filter_name,
filter_value, value, element);
break;
default :
break; /* anti-compiler-warning-code */
}
@@ -286,12 +554,19 @@ ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
* Add the element...
*/
cgiSetArray(name, element, value);
if (attr->value_tag != IPP_TAG_BEGIN_COLLECTION)
{
cgiSetArray(name, element, value);
DEBUG_printf(("<P>%s[%d]=\"%s\"\n", name, element, value));
}
}
if (attr == NULL)
break;
}
DEBUG_puts("<P>Leaving ippSetCGIVars()...");
}
+6 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP variable definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -26,7 +26,6 @@
* Include necessary headers...
*/
#include <ctype.h>
#include <cups/cups.h>
#include <cups/debug.h>
#include <cups/language.h>
@@ -45,9 +44,13 @@
* Prototype...
*/
extern void ippGetAttributes(ipp_t *request, const char *directory,
const char *tmpl, const char *lang);
extern char *ippGetTemplateDir(void);
extern char *ippRewriteURL(const char *, char *, int, const char *);
extern void ippSetServerVersion(void);
extern void ippSetCGIVars(ipp_t *, const char *, const char *);
extern void ippSetCGIVars(ipp_t *, const char *, const char *,
const char *, int);
/*
+14 -13
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Job status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -45,16 +45,16 @@ static void do_job_op(http_t *http, cups_lang_t *language, ipp_op_t op);
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
http_t *http; /* Connection to the server */
const char *which_jobs; /* Which jobs to show */
ipp_t *request, /* IPP request */
*response; /* IPP response */
const char *op; /* Operation name */
cups_lang_t *language; /* Language information */
http_t *http; /* Connection to the server */
const char *which_jobs; /* Which jobs to show */
ipp_t *request, /* IPP request */
*response; /* IPP response */
const char *op; /* Operation name */
/*
@@ -139,13 +139,15 @@ main(int argc, /* I - Number of command-line arguments */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
ippGetAttributes(request, TEMPLATES, "jobs.tmpl", getenv("LANG"));
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
@@ -182,7 +184,6 @@ do_job_op(http_t *http, /* I - HTTP connection */
*response; /* IPP response */
char uri[HTTP_MAX_URI]; /* Job URI */
const char *job; /* Job ID */
const char *printer; /* Printer name (purge-jobs) */
ipp_status_t status; /* Operation status... */
@@ -237,7 +238,7 @@ do_job_op(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
+47 -51
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -37,22 +37,26 @@
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
char *printer; /* Printer name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI];
/* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
cups_lang_t *language; /* Language information */
char *printer; /* Printer name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI]; /* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
static const char *def_attrs[] = /* Attributes for default printer */
{
"printer-name",
"printer-uri-supported"
};
/*
* Get any form variables...
@@ -77,7 +81,8 @@ main(int argc, /* I - Number of command-line arguments */
* Tell the client to expect HTML...
*/
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
printf("Content-Type: text/html;charset=%s\r\n\r\n",
cupsLangEncoding(language));
/*
* See if we need to show a list of printers or the status of a
@@ -113,6 +118,10 @@ main(int argc, /* I - Number of command-line arguments */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
@@ -120,38 +129,12 @@ main(int argc, /* I - Number of command-line arguments */
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
const char *server; /* Name of server */
char url[HTTP_MAX_URI]; /* New URL */
/*
* Map localhost access to localhost...
*/
server = getenv("SERVER_NAME");
httpSeparate(attr->values[0].string.text, method, username,
hostname, &port, resource);
if (strcasecmp(hostname, server) == 0 &&
(strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
strcmp(getenv("REMOTE_HOST"), server) == 0))
strcpy(hostname, "localhost");
/*
* Rewrite URI with HTTP address...
*/
snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
resource);
cgiSetVariable("DEFAULT_URI", uri);
cgiSetVariable("DEFAULT_URI",
ippRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
}
ippDelete(response);
@@ -202,15 +185,23 @@ main(int argc, /* I - Number of command-line arguments */
uri);
}
ippGetAttributes(request, TEMPLATES, "printers.tmpl", getenv("LANG"));
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
else if (printer)
fprintf(stderr, "ERROR: Get-Printer-Attributes request failed - %s (%x)\n",
ippErrorString(cupsLastError()), cupsLastError());
else
fprintf(stderr, "ERROR: CUPS-Get-Printers request failed - %s (%x)\n",
ippErrorString(cupsLastError()), cupsLastError());
/*
* Write the report...
@@ -253,17 +244,22 @@ main(int argc, /* I - Number of command-line arguments */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
ippGetAttributes(request, TEMPLATES, "jobs.tmpl", getenv("LANG"));
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
}
else
fprintf(stderr, "ERROR: Get-Jobs request failed - %s (%x)\n",
ippErrorString(cupsLastError()), cupsLastError());
}
}
else
@@ -320,12 +316,12 @@ main(int argc, /* I - Number of command-line arguments */
CUPS_DATADIR "/data/testprint.ps")) != NULL)
{
status = response->request.status.status_code;
ippSetCGIVars(response, NULL, NULL);
ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
cgiSetVariable("PRINTER_NAME", printer);
+9 -9
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI template function.
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -96,7 +96,7 @@ cgiCopyTemplateLang(FILE *out, /* I - Output file */
if (lang != NULL)
{
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i]))
if (isalnum(lang[i] & 255))
locale[i] = tolower(lang[i]);
else
locale[i] = '_';
@@ -189,7 +189,7 @@ cgi_copy(FILE *out, /* I - Output file */
*s = '\0';
if (s == name && isspace(ch))
if (s == name && isspace(ch & 255))
{
if (out)
{
@@ -210,7 +210,7 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert value only if it exists...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
{
*nameptr++ = '\0';
@@ -222,7 +222,7 @@ cgi_copy(FILE *out, /* I - Output file */
outptr = outval;
}
}
if ((value = cgiGetArray(name + 1, element)) != NULL)
else if ((value = cgiGetArray(name + 1, element)) != NULL)
outptr = value;
else
{
@@ -254,7 +254,7 @@ cgi_copy(FILE *out, /* I - Output file */
int count; /* Number of elements */
if (isdigit(name[1]))
if (isdigit(name[1] & 255))
count = atoi(name + 1);
else
count = cgiGetSize(name + 1);
@@ -280,7 +280,7 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert variable or variable name (if element is NULL)...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
{
*nameptr++ = '\0';
if ((value = cgiGetArray(name, atoi(nameptr) - 1)) == NULL)
@@ -332,7 +332,7 @@ cgi_copy(FILE *out, /* I - Output file */
* Test for existance...
*/
result = cgiGetArray(name, element) != NULL && outval[0];
result = cgiGetArray(name, element) != NULL && outptr[0];
}
else
{
@@ -367,7 +367,7 @@ cgi_copy(FILE *out, /* I - Output file */
if (innername[0] == '#')
sprintf(s, "%d", cgiGetSize(innername + 1));
else if ((innerptr = strrchr(innername, '-')) != NULL &&
isdigit(innerptr[1]))
isdigit(innerptr[1] & 255))
{
*innerptr++ = '\0';
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
+5 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI form variable and array functions.
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -242,7 +242,7 @@ cgiSetArray(const char *name, /* I - Name of variable */
var_t *var; /* Returned variable */
if (name == NULL || value == NULL || element < 0)
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
if ((var = cgi_find_variable(name)) == NULL)
@@ -286,7 +286,7 @@ cgiSetSize(const char *name, /* I - Name of variable */
var_t *var; /* Returned variable */
if (name == NULL || size < 0)
if (name == NULL || size < 0 || size > 100000)
return;
if ((var = cgi_find_variable(name)) == NULL)
@@ -361,7 +361,7 @@ cgi_add_variable(const char *name, /* I - Variable name */
var_t *var; /* New variable */
if (name == NULL || value == NULL)
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
#ifdef DEBUG
@@ -622,7 +622,7 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Add the string to the variable "database"...
*/
if ((s = strrchr(name, '-')) != NULL && isdigit(s[1]))
if ((s = strrchr(name, '-')) != NULL && isdigit(s[1] & 255))
{
*s++ = '\0';
if (value[0])
+2
Ver Arquivo
@@ -0,0 +1,2 @@
cupsd.conf
pam.conf
+7 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1993-2002 by Easy Software Products.
# Copyright 1993-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -65,6 +65,10 @@ install:
fi ; \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
done
-if test x$(PAMDIR) != x$(BUILDROOT); then \
$(INSTALL_DIR) $(PAMDIR); \
$(INSTALL_DATA) $(PAMFILE) $(PAMDIR)/cups; \
fi
#
+3 -3
Ver Arquivo
@@ -1,10 +1,10 @@
#
# "$Id: classes.conf 2010 2002-01-02 17:59:21Z mike $"
# "$Id: classes.conf 4088 2004-02-25 20:15:27Z mike $"
#
# Sample class configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -85,5 +85,5 @@
#</Class>
#
# End of "$Id: classes.conf 2010 2002-01-02 17:59:21Z mike $".
# End of "$Id: classes.conf 4088 2004-02-25 20:15:27Z mike $".
#
+6 -4
Ver Arquivo
@@ -1,10 +1,10 @@
#
# "$Id: client.conf 2010 2002-01-02 17:59:21Z mike $"
# "$Id: client.conf 4088 2004-02-25 20:15:27Z mike $"
#
# Sample client configuration file for the Common UNIX Printing System
# (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -34,7 +34,9 @@
#
# ServerName: the hostname of your server. By default CUPS will use the
# hostname of the system or the value of the CUPS_SERVER environment
# variable.
# variable. ONLY ONE SERVER NAME MAY BE SPECIFIED AT A TIME. To use
# more than one server you must use a local scheduler with browsing
# and possibly polling.
#
#ServerName myhost.domain.com
@@ -61,5 +63,5 @@
#
# End of "$Id: client.conf 2010 2002-01-02 17:59:21Z mike $".
# End of "$Id: client.conf 4088 2004-02-25 20:15:27Z mike $".
#
+98 -4
Ver Arquivo
@@ -4,7 +4,7 @@
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler.
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -16,9 +16,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -134,6 +134,16 @@
#ErrorLog @CUPS_LOGDIR@/error_log
#
# FileDevice: determines whether the scheduler will allow new printers
# to be added using device URIs of the form "file:/foo/bar". The default
# is not to allow file devices due to the potential security vulnerability
# and due to the fact that file devices do not support raw printing.
#
#FileDevice No
#
# FontPath: the path to locate all font files (currently only for pstoraster)
# By default "@CUPS_FONTPATH@".
@@ -194,6 +204,13 @@ LogLevel info
#AutoPurgeJobs No
#
# MaxCopies: maximum number of copies that a user can request. Default is
# 100.
#
#MaxCopies 100
#
# MaxJobs: maximum number of jobs to keep in memory (active and completed.)
# Default is 500; the value 0 is used for no limit.
@@ -201,6 +218,28 @@ LogLevel info
#MaxJobs 500
#
# MaxJobsPerPrinter: maximum number of active jobs per printer. The default
# is 0 for no limit.
#
#MaxJobsPerPrinter 0
#
# MaxJobsPerUser: maximum number of active jobs per user. The default
# is 0 for no limit.
#
#MaxJobsPerUser 0
#
# MaxPrinterHistory: controls the maximum number of history collections
# in the printer-state-history attribute. Set to 0 to disable history
# data.
#
#MaxPrinterHistory 10
#
# Printcap: the name of the printcap file. Default is /etc/printcap.
# Leave blank to disable printcap file generation.
@@ -257,6 +296,41 @@ LogLevel info
#ServerRoot @CUPS_SERVERROOT@
#
# ServerTokens: specifies what information in provided in the Server
# header of HTTP responses. The default is Minor.
#
# ServerTokens None
# ServerTokens ProductOnly CUPS
# ServerTokens Major CUPS/1
# ServerTokens Minor CUPS/1.1
# ServerTokens Minimal CUPS/@CUPS_VERSION@
# ServerTokens OS CUPS/@CUPS_VERSION@ (uname)
# ServerTokens Full CUPS/@CUPS_VERSION@ (uname) IPP/1.1
#
#ServerTokens Minor
########
######## Fax Support
########
#
# FaxRetryLimit: the number of times a fax job is retried.
# The default is 5 times.
#
#FaxRetryLimit 5
#
# FaxRetryInterval: the number of seconds between fax job retries.
# The default is 300 seconds/5 minutes.
#
#FaxRetryInterval 300
########
######## Encryption Support
########
@@ -344,6 +418,10 @@ LogLevel info
# for encryption. If you want to support web-based encryption you'll
# probably need to listen on port 443 (the "https" port...)
#
# NOTE 2: In order for the command-line and web interfaces to work, you
# must have at least one Port or Listen line that allows access from the
# local loopback address (localhost).
#
#Port 80
#Port 443
@@ -377,6 +455,15 @@ Port 631
#MaxClients 100
#
# MaxClientsPerHost: controls the maximum number of simultaneous clients that
# will be handled from a specific host. Defaults to 10 or 1/10th of the
# MaxClients setting, whichever is larger. A value of 0 specifies the
# automatic (10 or 1/10th) setting.
#
#MaxClientsPerHost 0
#
# MaxRequestSize: controls the maximum size of HTTP requests and print files.
# Set to 0 to disable this feature (defaults to 0.)
@@ -415,7 +502,7 @@ Port 631
# NOTE: If you choose to use SLPv2, it is *strongly* recommended that
# you have at least one SLP Directory Agent (DA) on your
# network. Otherwise, browse updates can take several seconds,
# during which the scheduler will not response to client
# during which the scheduler will not respond to client
# requests.
#
@@ -601,6 +688,13 @@ Port 631
#SystemGroup @CUPS_GROUP@
#
# RootCertDuration: How frequently the root certificate is regenerated.
# Defaults to 300 seconds.
#
#RootCertDuration 300
#
# Access permissions for each directory served by the scheduler.
# Locations are relative to DocumentRoot...
+34 -5
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: mime.convs 2355 2002-04-23 17:54:04Z mike $"
# "$Id: mime.convs 4087 2004-02-25 20:14:54Z mike $"
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products.
# Copyright 1997-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -46,12 +46,27 @@
application/pdf application/postscript 33 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
image/* application/vnd.cups-postscript 66 imagetops
application/x-cshell application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/plain application/postscript 33 texttops
text/html application/postscript 33 texttops
image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
image/jpeg application/vnd.cups-postscript 66 imagetops
image/tiff application/vnd.cups-postscript 66 imagetops
image/x-bitmap application/vnd.cups-postscript 66 imagetops
image/x-photocd application/vnd.cups-postscript 66 imagetops
image/x-portable-anymap application/vnd.cups-postscript 66 imagetops
image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops
image/x-portable-graymap application/vnd.cups-postscript 66 imagetops
image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops
image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops
image/x-xbitmap application/vnd.cups-postscript 66 imagetops
image/x-xpixmap application/vnd.cups-postscript 66 imagetops
#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
image/x-sun-raster application/vnd.cups-postscript 66 imagetops
########################################################################
#
@@ -68,7 +83,21 @@ text/html application/postscript 33 texttops
# Raster filters...
#
image/* application/vnd.cups-raster 100 imagetoraster
image/gif application/vnd.cups-raster 100 imagetoraster
image/png application/vnd.cups-raster 100 imagetoraster
image/jpeg application/vnd.cups-raster 100 imagetoraster
image/tiff application/vnd.cups-raster 100 imagetoraster
image/x-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-photocd application/vnd.cups-raster 100 imagetoraster
image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
# pstoraster is now part of ESP Ghostscript...
#application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
@@ -85,5 +114,5 @@ image/* application/vnd.cups-raster 100 imagetoraster
#application/octet-stream application/vnd.cups-raw 0 -
#
# End of "$Id: mime.convs 2355 2002-04-23 17:54:04Z mike $".
# End of "$Id: mime.convs 4087 2004-02-25 20:14:54Z mike $".
#
+19 -15
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: mime.types 2233 2002-03-19 15:47:47Z mike $"
# "$Id: mime.types 4087 2004-02-25 20:14:54Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products.
# Copyright 1997-2004 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -41,6 +41,8 @@
# printable(offset,length) True if bytes are printable 8-bit chars
# (CR, NL, TAB, BS, 32-126, 128-254)
# string(offset,"string") True if bytes are identical to string
# istring(offset,"string") True if bytes are identical to
# case-insensitive string
# char(offset,value) True if byte is identical
# short(offset,value) True if 16-bit integer is identical
# int(offset,value) True if 32-bit integer is identical
@@ -68,17 +70,21 @@
# Application-generated files...
#
application/msword doc string(0,<D0CF11E0A1B11AE1>)
#application/msword doc string(0,<D0CF11E0A1B11AE1>)
application/pdf pdf string(0,%PDF)
application/postscript ai eps ps string(0,%!) string(0,<04>%!)
application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=POSTSCRIPT") \
contains(0,1024,"LANGUAGE = Postscript") \
contains(0,1024,"LANGUAGE = POSTSCRIPT"))
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
string(0,<1B>E<1B>%0B) \
string(0,<1B>%-1B) string(0,<201B>)\
string(0,BP;) string(0,IN;) string(0,DF;) \
string(0,BPINPS;) \
(contains(0,128,<1B>%-12345X) + \
(contains(9,512,"LANGUAGE=HPGL") \
contains(9,512,"LANGUAGE = HPGL")))
(contains(0,1024,"LANGUAGE=HPGL") \
contains(0,1024,"LANGUAGE = HPGL")))
########################################################################
#
@@ -101,7 +107,7 @@ image/x-portable-pixmap ppm string(0,P3) string(0,P6)
image/x-sgi-rgb rgb sgi bw icon short(0,474)
image/x-xbitmap xbm
image/x-xpixmap xpm ascii(0,1024) + string(3,"XPM")
image/x-xwindowdump xwd
#image/x-xwindowdump xwd string(4,<00000007>)
image/x-sun-raster ras string(0,<59a66a95>)
#image/fpx fpx
@@ -114,7 +120,7 @@ image/x-bitmap bmp string(0,BM) && !printable(2,14)
#
text/html html htm printable(0,1024) +\
(string(0,"<HTML>") string(0,"<!DOCTYPE"))
(istring(0,"<HTML>") istring(0,"<!DOCTYPE"))
application/x-cshell csh printable(0,1024) + string(0,#!) +\
(contains(2,80,/csh) contains(2,80,/tcsh))
application/x-perl pl printable(0,1024) + string(0,#!) +\
@@ -129,17 +135,15 @@ text/plain txt printable(0,1024)
# CUPS-specific types...
#
application/vnd.cups-command string(0,'#CUPS-COMMAND')
application/vnd.cups-form string(0,"<CUPSFORM>")
application/vnd.cups-postscript contains(0,128,<1B>%-12345X) + \
(contains(9,512,"LANGUAGE=POSTSCRIPT") \
contains(9,512,"LANGUAGE = Postscript") \
contains(9,512,"LANGUAGE = POSTSCRIPT"))
application/vnd.cups-postscript
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,128,<1B>%-12345X) + \
(contains(9,512,"LANGUAGE=PCL") \
contains(9,512,"LANGUAGE = PCL")))
(contains(0,1024,"LANGUAGE=PCL") \
contains(0,1024,"LANGUAGE = PCL")))
########################################################################
#
@@ -153,5 +157,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
#application/octet-stream
#
# End of "$Id: mime.types 2233 2002-03-19 15:47:47Z mike $".
# End of "$Id: mime.types 4087 2004-02-25 20:14:54Z mike $".
#
+7
Ver Arquivo
@@ -0,0 +1,7 @@
# cups: auth account password session
auth sufficient pam_securityserver.so
auth sufficient pam_unix.so
auth required pam_deny.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so
Ver Arquivo
+2
Ver Arquivo
@@ -0,0 +1,2 @@
auth required @PAMMOD@ nullok shadow
account required @PAMMOD@
+3 -3
Ver Arquivo
@@ -1,10 +1,10 @@
#
# "$Id: printers.conf 2010 2002-01-02 17:59:21Z mike $"
# "$Id: printers.conf 4088 2004-02-25 20:15:27Z mike $"
#
# Sample printer configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -92,5 +92,5 @@
#</Printer>
#
# End of "$Id: printers.conf 2010 2002-01-02 17:59:21Z mike $".
# End of "$Id: printers.conf 4088 2004-02-25 20:15:27Z mike $".
#
+68 -12
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-common.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-common.m4 4374 2004-08-19 13:54:38Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -28,6 +28,12 @@ AC_PREREQ(2.50)
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="1.1.21rc2"
AC_SUBST(CUPS_VERSION)
AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION")
AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION")
dnl Default compiler flags...
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
@@ -47,11 +53,12 @@ fi
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(LN,ln)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(NROFF,nroff)
if test "$NROFF" = ""; then
if test "x$NROFF" = x; then
AC_PATH_PROG(GROFF,groff)
if test "$GROFF" = ""; then
if test "x$GROFF" = x; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
@@ -61,6 +68,16 @@ AC_PATH_PROG(RM,rm)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(STRIP,strip)
if test "x$AR" = x; then
AC_MSG_ERROR([Unable to find required library archive command.])
fi
if test "x$CC" = x; then
AC_MSG_ERROR([Unable to find required C compiler command.])
fi
if test "x$CXX" = x; then
AC_MSG_ERROR([Unable to find required C++ compiler command.])
fi
dnl Architecture checks...
AC_C_BIGENDIAN
@@ -84,14 +101,29 @@ fi
AC_SUBST(LIBMALLOC)
dnl Check for libpaper support...
AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
if test x$enable_libpaper = xyes; then
AC_CHECK_LIB(paper,systempapername,
AC_DEFINE(HAVE_LIBPAPER)
LIBPAPER="-lpaper",
LIBPAPER="")
else
LIBPAPER=""
fi
AC_SUBST(LIBPAPER)
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
@@ -107,7 +139,7 @@ dnl Check OS version and use appropriate format string for strftime...
AC_MSG_CHECKING(for correct format string to use with strftime)
case "$uname" in
IRIX* | SunOS*)
IRIX | SunOS*)
# IRIX and SunOS
AC_MSG_RESULT(NULL)
AC_DEFINE(CUPS_STRFTIME_FORMAT, NULL)
@@ -122,13 +154,22 @@ esac
dnl Checks for mkstemp and mkstemps functions.
AC_CHECK_FUNCS(mkstemp mkstemps)
dnl Checks for vsyslog function.
dnl Check for geteuid function.
AC_CHECK_FUNCS(geteuid)
dnl Check for vsyslog function.
AC_CHECK_FUNCS(vsyslog)
dnl Checks for signal functions.
if test "$uname" != "Linux"; then
AC_CHECK_FUNCS(sigset)
fi
case "$uname" in
Linux | GNU)
# Do not use sigset on Linux or GNU HURD
;;
*)
# Use sigset on other platforms, if available
AC_CHECK_FUNCS(sigset)
;;
esac
AC_CHECK_FUNCS(sigaction)
@@ -156,6 +197,21 @@ esac
AC_SUBST(ARFLAGS)
dnl Extra platform-specific libraries...
case $uname in
Darwin*)
BACKLIBS="-framework IOKit"
COMMONLIBS="-framework CoreFoundation"
;;
*)
BACKLIBS=""
COMMONLIBS=""
;;
esac
AC_SUBST(BACKLIBS)
AC_SUBST(COMMONLIBS)
dnl
dnl End of "$Id: cups-common.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-common.m4 4374 2004-08-19 13:54:38Z mike $".
dnl
+39 -23
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-compiler.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-compiler.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -55,13 +55,17 @@ if test -n "$GCC"; then
AC_MSG_CHECKING(if libsupc++ is required)
SUPC="`$CXX -print-file-name=libsupc++.a 2>/dev/null`"
if test -n "$SUPC" -a "$SUPC" != "libsupc++.a"; then
# This is gcc 3.x, and it knows of libsupc++, so we need it
CXXLIBS="-lsupc++"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
case "$SUPC" in
libsupc++.a*)
# Library not found, so this is and older GCC...
AC_MSG_RESULT(no)
;;
*)
# This is gcc 3.x, and it knows of libsupc++, so we need it
CXXLIBS="-lsupc++"
AC_MSG_RESULT(yes)
;;
esac
CXX="$CC"
@@ -115,7 +119,7 @@ else
OPTIM="+z $OPTIM"
fi
;;
IRIX*)
IRIX)
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-O2"
@@ -129,7 +133,16 @@ else
fi
if test "x$with_optim" = x; then
OPTIM="-fullwarn $OPTIM"
# Show most warnings, but suppress the
# ones about arguments not being used,
# string constants assigned to const
# char *'s, etc. We only set the warning
# options on IRIX 6.2 and higher because
# of limitations in the older SGI compiler
# tools.
if test $uversion -ge 62; then
OPTIM="-fullwarn -woff 1183,1209,1349,3201 $OPTIM"
fi
fi
;;
SunOS*)
@@ -143,7 +156,9 @@ else
fi
if test "x$with_optim" = x; then
OPTIM="$OPTIM -xarch=generic"
# Specify "generic" SPARC output and suppress
# all of Sun's questionable warning messages...
OPTIM="-w $OPTIM -xarch=generic"
fi
if test $PICFLAG = 1; then
@@ -176,15 +191,16 @@ else
esac
fi
case $uname in
*BSD | Darwin*)
ARFLAGS="-rcv"
;;
*)
ARFLAGS="crvs"
;;
esac
if test $uname = HP-UX; then
# HP-UX 10.20 (at least) needs this definition to get the
# h_errno global...
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
# HP-UX 11.00 (at least) needs this definition to get the
# u_short type used by the IP headers...
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
fi
dnl
dnl End of "$Id: cups-compiler.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-compiler.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+14 -10
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-directories.m4 2138 2002-02-12 19:05:39Z mike $"
dnl "$Id: cups-directories.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -81,6 +81,10 @@ if test "$sysconfdir" = "\${prefix}/etc"; then
fi
dnl Fix "libdir" variable for IRIX 6.x...
if test "$libdir" = "\${exec_prefix}/lib"; then
libdir="$exec_prefix/lib"
fi
if test "$uname" = "IRIX" -a $uversion -ge 62; then
libdir="$exec_prefix/lib32"
fi
@@ -111,8 +115,8 @@ if test x$rcdir = x; then
INITDDIR="/System/Library/StartupItems/PrintingServices"
;;
Linux*)
# Linux seems to choose an init.d directory at random...
Linux | GNU)
# Linux/HURD seems to choose an init.d directory at random...
if test -d /sbin/init.d; then
# SuSE
INITDIR="/sbin/init.d"
@@ -180,8 +184,8 @@ case "$uname" in
*)
# All others
INSTALL_SYSV="install-sysv"
CUPS_SERVERBIN="$exec_prefix/lib/cups"
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
CUPS_SERVERBIN="$libdir/cups"
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$libdir/cups")
;;
esac
@@ -193,7 +197,7 @@ AC_SUBST(CUPS_REQUESTS)
dnl Set the CUPS_LOCALE directory...
case "$uname" in
Linux* | *BSD* | Darwin*)
Linux | GNU | *BSD* | Darwin*)
CUPS_LOCALEDIR="$datadir/locale"
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$datadir/locale")
;;
@@ -234,5 +238,5 @@ AC_SUBST(CUPS_FONTPATH)
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
dnl
dnl End of "$Id: cups-directories.m4 2138 2002-02-12 19:05:39Z mike $".
dnl End of "$Id: cups-directories.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+15 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-image.m4 2013 2002-01-02 18:50:43Z mike $"
dnl "$Id: cups-image.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Image library stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -65,8 +65,18 @@ AC_CHECK_HEADER(tiff.h,
dnl Restore original LIBS settings...
LIBS="$SAVELIBS"
EXPORT_LIBJPEG="$LIBJPEG"
EXPORT_LIBPNG="$LIBPNG"
EXPORT_LIBTIFF="$LIBTIFF"
EXPORT_LIBZ="$LIBZ"
AC_SUBST(EXPORT_LIBJPEG)
AC_SUBST(EXPORT_LIBPNG)
AC_SUBST(EXPORT_LIBTIFF)
AC_SUBST(EXPORT_LIBZ)
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
dnl
dnl End of "$Id: cups-image.m4 2013 2002-01-02 18:50:43Z mike $".
dnl End of "$Id: cups-image.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-libtool.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-libtool.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -45,5 +45,5 @@ if test x$LIBTOOL != x; then
fi
dnl
dnl End of "$Id: cups-libtool.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-libtool.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+8 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-manpages.m4 2013 2002-01-02 18:50:43Z mike $"
dnl "$Id: cups-manpages.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -25,13 +25,13 @@ dnl
dnl Fix "mandir" variable...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
case "$uname" in
Darwin* | Linux* | *BSD* | AIX*)
# Darwin, MacOS X, Linux, *BSD, and AIX
Darwin* | Linux | GNU | *BSD* | AIX*)
# Darwin, MacOS X, Linux, GNU HURD, *BSD, and AIX
mandir="/usr/share/man"
AMANDIR="/usr/share/man"
PMANDIR="/usr/share/man"
;;
IRIX*)
IRIX)
# SGI IRIX
mandir="/usr/share/catman/u_man"
AMANDIR="/usr/share/catman/a_man"
@@ -100,5 +100,5 @@ AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 2013 2002-01-02 18:50:43Z mike $".
dnl End of "$Id: cups-manpages.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+24 -6
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-network.m4 2309 2002-03-28 22:13:20Z mike $"
dnl "$Id: cups-network.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -29,13 +29,31 @@ if test "$uname" != "IRIX"; then
AC_CHECK_LIB(nsl,gethostbyaddr,NETLIBS="$NETLIBS -lnsl")
fi
AC_CHECK_FUNCS(rresvport getifaddrs)
AC_CHECK_FUNCS(rresvport getifaddrs hstrerror)
AC_CHECK_MEMBER(struct sockaddr.sa_len,,,[#include <sys/socket.h>])
AC_CHECK_HEADER(sys/sockio.h,AC_DEFINE(HAVE_SYS_SOCKIO_H))
AC_SUBST(NETLIBS)
if test "$uname" = "SunOS"; then
case "$uversion" in
55* | 56*)
maxfiles=1024
;;
*)
maxfiles=4096
;;
esac
else
maxfiles=4096
fi
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler ],
maxfiles=$withval)
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
dnl
dnl End of "$Id: cups-network.m4 2309 2002-03-28 22:13:20Z mike $".
dnl End of "$Id: cups-network.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-openslp.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-openslp.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -44,5 +44,5 @@ AC_SUBST(LIBSLP)
dnl
dnl End of "$Id: cups-openslp.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-openslp.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+71 -29
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-openssl.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-openssl.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl OpenSSL stuff for the Common UNIX Printing System (CUPS).
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,14 +15,17 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=yes])
AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=yes])
AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=yes])
AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
@@ -31,40 +34,79 @@ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenS
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
SSLFLAGS=""
SSLLIBS=""
if test x$enable_ssl != xno; then
AC_CHECK_HEADER(openssl/ssl.h,
dnl Save the current libraries so the crypto stuff isn't always
dnl included...
SAVELIBS="$LIBS"
dnl Check for the OpenSSL library first, which has precedence over
dnl CDSA and GNUTLS...
if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
AC_CHECK_HEADER(openssl/ssl.h,
dnl Save the current libraries so the crypto stuff isn't always
dnl included...
SAVELIBS="$LIBS"
dnl Some ELF systems can't resolve all the symbols in libcrypto
dnl if libcrypto was linked against RSAREF, and fail to link the
dnl test program correctly, even though a correct installation
dnl of OpenSSL exists. So we test the linking three times in
dnl case the RSAREF libraries are needed.
dnl Some ELF systems can't resolve all the symbols in libcrypto
dnl if libcrypto was linked against RSAREF, and fail to link the
dnl test program correctly, even though a correct installation
dnl of OpenSSL exists. So we test the linking three times in
dnl case the RSAREF libraries are needed.
for libcrypto in \
"-lcrypto" \
"-lcrypto -lrsaref" \
"-lcrypto -lRSAglue -lrsaref"
do
AC_CHECK_LIB(ssl,SSL_new,
[SSLLIBS="-lssl $libcrypto"
AC_DEFINE(HAVE_LIBSSL)],,
$libcrypto)
for libcrypto in \
"-lcrypto" \
"-lcrypto -lrsaref" \
"-lcrypto -lRSAglue -lrsaref"
do
AC_CHECK_LIB(ssl,SSL_new,
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
SSLLIBS="-lssl $libcrypto"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_LIBSSL)],,
$libcrypto)
if test "x${SSLLIBS}" != "x"; then
break
fi
done
if test "x${SSLLIBS}" != "x"; then
break
fi
done
LIBS="$SAVELIBS")
LIBS="$SAVELIBS")
fi
dnl If OpenSSL wasn't found, look for CDSA...
if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
if test $uname = Darwin; then
AC_CHECK_HEADER(Security/SecureTransport.h,
[SSLLIBS="-framework CoreFoundation -framework Security"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_CDSASSL)])
fi
fi
dnl Then look for GNU TLS...
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
AC_CHECK_HEADER(gnutls/gnutls.h,
dnl Save the current libraries so the crypto stuff isn't always
dnl included...
SAVELIBS="$LIBS"
TEST_GNUTLS_LIBS=`libgnutls-config --libs`
AC_CHECK_LIB(gnutls, gnutls_init,
[SSLLIBS=$TEST_GNUTLS_LIBS
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)],,
$TEST_GNUTLS_LIBS)
LIBS="$SAVELIBS")
fi
fi
AC_SUBST(SSLFLAGS)
AC_SUBST(SSLLIBS)
EXPORT_SSLLIBS="$SSLLIBS"
AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-openssl.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-openssl.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+37 -28
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-opsys.m4 2193 2002-03-08 19:49:00Z mike $"
dnl "$Id: cups-opsys.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -25,9 +25,17 @@ dnl
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test x$uname = xIRIX64; then
uname="IRIX"
fi
case "$uname" in
GNU* | GNU/*)
uname="GNU"
;;
IRIX*)
uname="IRIX"
;;
Linux*)
uname="Linux"
;;
esac
dnl Determine the correct username and group for this OS...
AC_ARG_WITH(cups-user, [ --with-cups-user set default user for CUPS],
@@ -55,28 +63,29 @@ AC_ARG_WITH(cups-user, [ --with-cups-user set default user for CUPS],
AC_ARG_WITH(cups-group, [ --with-cups-group set default group for CUPS],
CUPS_GROUP="$withval",
AC_MSG_CHECKING(for default print group)
if test x$uname = xDarwin; then
CUPS_GROUP="admin"
AC_MSG_RESULT(Darwin, using "$CUPS_GROUP")
else
if test -f /etc/group; then
CUPS_GROUP=""
for group in sys system root; do
if test "`grep \^${group}: /etc/group`" != ""; then
CUPS_GROUP="$group"
AC_MSG_RESULT($group)
break;
fi
done
if test x$CUPS_GROUP = x; then
CUPS_GROUP="${GROUP:=nobody}"
AC_MSG_RESULT(not found, using "$CUPS_GROUP")
fi
if test -f /etc/group; then
if test x$uname = xDarwin; then
GROUP_LIST="lp admin"
else
CUPS_GROUP="${GROUP:=nobody}"
AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
GROUP_LIST="sys system root"
fi
CUPS_GROUP=""
for group in $GROUP_LIST; do
if test "`grep \^${group}: /etc/group`" != ""; then
CUPS_GROUP="$group"
AC_MSG_RESULT($group)
break;
fi
done
if test x$CUPS_GROUP = x; then
CUPS_GROUP="${GROUP:=nobody}"
AC_MSG_RESULT(not found, using "$CUPS_GROUP")
fi
else
CUPS_GROUP="${GROUP:=nobody}"
AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
fi)
AC_SUBST(CUPS_USER)
@@ -86,5 +95,5 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
dnl
dnl "$Id: cups-opsys.m4 2193 2002-03-08 19:49:00Z mike $"
dnl "$Id: cups-opsys.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
+41 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-pam.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl PAM stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -30,7 +30,9 @@ if test $uname = AIX; then
fi
PAMDIR=""
PAMFILE=""
PAMLIBS=""
PAMMOD="pam_unknown.so"
if test x$enable_pam != xno; then
SAVELIBS="$LIBS"
@@ -40,22 +42,53 @@ if test x$enable_pam != xno; then
AC_CHECK_HEADER(pam/pam_appl.h,AC_DEFINE(HAVE_PAM_PAM_APPL_H))
if test x$ac_cv_lib_pam_pam_start != xno; then
# Set the necessary libraries for PAM...
if test x$ac_cv_lib_dl_dlopen != xno; then
PAMLIBS="-lpam -ldl"
else
PAMLIBS="-lpam"
fi
if test -d /etc/pam.d; then
PAMDIR="/etc/pam.d"
fi
# Find the PAM configuration directory, if any...
for dir in /private/etc/pam.d /etc/pam.d; do
if test -d $dir; then
PAMDIR=$dir
break;
fi
done
fi
LIBS="$SAVELIBS"
case "$uname" in
Darwin*)
# Darwin, MacOS X
PAMFILE="pam.darwin"
;;
IRIX)
# SGI IRIX
PAMFILE="pam.irix"
;;
*)
# All others; this test might need to be updated
# as Linux distributors move things around...
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
if test -f /lib/security/$mod; then
PAMMOD="$mod"
break;
fi
done
PAMFILE="pam.std"
;;
esac
fi
AC_SUBST(PAMDIR)
AC_SUBST(PAMFILE)
AC_SUBST(PAMLIBS)
AC_SUBST(PAMMOD)
dnl
dnl End of "$Id: cups-pam.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-pam.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+91
Ver Arquivo
@@ -0,0 +1,91 @@
dnl
dnl "$Id: cups-scripting.m4 4213 2004-06-29 03:44:53Z mike $"
dnl
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Do we have Java?
AC_ARG_WITH(java, [ --with-java set Java interpreter for web interfaces ],
CUPS_JAVA="$withval",
CUPS_JAVA="")
if test "x$CUPS_JAVA" = x; then
AC_PATH_PROG(JAVA,java)
CUPS_JAVA="$JAVA"
fi
AC_DEFINE_UNQUOTED(CUPS_JAVA, "$CUPS_JAVA")
if test "x$CUPS_JAVA" != x; then
AC_DEFINE(HAVE_JAVA)
fi
dnl Do we have Perl?
AC_ARG_WITH(perl, [ --with-perl set Perl interpreter for web interfaces ],
CUPS_PERL="$withval",
CUPS_PERL="")
if test "x$CUPS_PERL" = x; then
AC_PATH_PROG(PERL,perl)
CUPS_PERL="$PERL"
fi
AC_DEFINE_UNQUOTED(CUPS_PERL, "$CUPS_PERL")
if test "x$CUPS_PERL" != x; then
AC_DEFINE(HAVE_PERL)
fi
dnl Do we have PHP?
AC_ARG_WITH(php, [ --with-php set PHP interpreter for web interfaces ],
CUPS_PHP="$withval",
CUPS_PHP="")
if test "x$CUPS_PHP" = x; then
AC_PATH_PROG(PHP,php)
CUPS_PHP="$PHP"
fi
AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
if test "x$CUPS_PHP" != x; then
AC_DEFINE(HAVE_PHP)
fi
dnl Do we have Python?
AC_ARG_WITH(python, [ --with-python set Python interpreter for web interfaces ],
CUPS_PYTHON="$withval",
CUPS_PYTHON="")
if test "x$CUPS_PYTHON" = x; then
AC_PATH_PROG(PYTHON,python)
CUPS_PYTHON="$PYTHON"
fi
AC_DEFINE_UNQUOTED(CUPS_PYTHON, "$CUPS_PYTHON")
if test "x$CUPS_PYTHON" != x; then
AC_DEFINE(HAVE_PYTHON)
fi
dnl
dnl End of "$Id: cups-scripting.m4 4213 2004-06-29 03:44:53Z mike $".
dnl
+22 -15
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-sharedlibs.m4 2476 2002-06-04 20:58:55Z mike $"
dnl "$Id: cups-sharedlibs.m4 4358 2004-08-11 14:39:26Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -41,13 +41,13 @@ if test x$enable_shared != xno; then
DSO="ld"
DSOFLAGS="$DSOFLAGS -b -z +h \$@"
;;
IRIX*)
IRIX)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi2.4,-soname,\$@ -shared \$(OPTIM)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi2.5,-soname,\$@ -shared \$(OPTIM)"
;;
OSF1* | Linux* | *BSD*)
OSF1* | Linux | GNU | *BSD*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
@@ -63,7 +63,7 @@ if test x$enable_shared != xno; then
LIBCUPS="libcups_s.a"
LIBCUPSIMAGE="libcupsimage_s.a"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry"
DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry,-blibpath:\$(libdir)"
;;
*)
echo "Warning: shared libraries may not be supported. Trying -shared"
@@ -87,8 +87,8 @@ AC_SUBST(LIBCUPS)
AC_SUBST(LIBCUPSIMAGE)
if test x$enable_shared = xno; then
LINKCUPS="-lcups \$(SSLLIBS)"
LINKCUPSIMAGE="-lcupsimage"
LINKCUPS="../cups/libcups.a \$(SSLLIBS)"
LINKCUPSIMAGE="../filter/libcupsimage.a"
else
if test $uname = AIX; then
LINKCUPS="-lcups_s"
@@ -103,6 +103,8 @@ AC_SUBST(LINKCUPS)
AC_SUBST(LINKCUPSIMAGE)
dnl Update libraries for DSOs...
EXPORT_LDFLAGS=""
if test "$DSO" != ":"; then
# When using DSOs the image libraries are linked to libcupsimage.so
# rather than to the executables. This makes things smaller if you
@@ -117,23 +119,27 @@ if test "$DSO" != ":"; then
case $uname in
HP-UX*)
# HP-UX
DSOFLAGS="+b $libdir +fb $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,+b,$libdir,+fb"
DSOFLAGS="+s +b $libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,+s,+b,$libdir"
EXPORT_LDFLAGS="-Wl,+s,+b,$libdir"
;;
SunOS*)
# Solaris
DSOFLAGS="-R$libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -R$libdir"
EXPORT_LDFLAGS="-R$libdir"
;;
*BSD*)
# *BSD
DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
EXPORT_LDFLAGS="-Wl,-R$libdir"
;;
Linux*)
# Linux
Linux | GNU)
# Linux and HURD
DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
;;
esac
else
@@ -143,7 +149,8 @@ fi
AC_SUBST(DSOLIBS)
AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 2476 2002-06-04 20:58:55Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 4358 2004-08-11 14:39:26Z mike $".
dnl
+71 -5
Ver Arquivo
@@ -5,7 +5,7 @@
*
* @configure_input@
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -17,18 +17,22 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
#ifndef _CUPS_CONFIG_H_
#define _CUPS_CONFIG_H_
/*
* Version of software...
*/
#define CUPS_SVERSION "CUPS v1.1.15"
#define CUPS_SVERSION "CUPS v1.1.21"
#define CUPS_MINIMAL "CUPS/1.1.21"
/*
@@ -39,6 +43,13 @@
#define CUPS_DEFAULT_GROUP "sys"
/*
* Maximum number of file descriptors to support.
*/
#define CUPS_MAX_FDS 4096
/*
* Where are files stored?
*/
@@ -113,11 +124,12 @@
/*
* Use <string.h>, <strings.h>, or both?
* Use <string.h>, <strings.h>, and/or <bstring.h>?
*/
#undef HAVE_STRING_H
#undef HAVE_STRINGS_H
#undef HAVE_BSTRING_H
/*
@@ -131,6 +143,13 @@
#undef HAVE_STRLCPY
/*
* Do we have the geteuid() function?
*/
#undef HAVE_GETEUID
/*
* Do we have the vsyslog() function?
*/
@@ -171,10 +190,20 @@
/*
* Do we have the OpenSSL library?
* Do we have the langinfo.h header file?
*/
#undef HAVE_LANGINFO_H
/*
* Which encryption libraries do we have?
*/
#undef HAVE_CDSASSL
#undef HAVE_GNUTLS
#undef HAVE_LIBSSL
#undef HAVE_SSL
/*
@@ -184,6 +213,13 @@
#undef HAVE_LIBSLP
/*
* Do we have libpaper?
*/
#undef HAVE_LIBPAPER
/*
* Do we have <sys/ioctl.h>?
*/
@@ -220,6 +256,13 @@
#undef HAVE_GETIFADDRS
/*
* Do we have hstrerror()?
*/
#undef HAVE_HSTRERROR
/*
* Do we have the <sys/sockio.h> header file?
*/
@@ -234,6 +277,29 @@
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
/*
* Do we have the AIX usersec.h header file?
*/
#undef HAVE_USERSEC_H
/*
* Various scripting languages...
*/
#undef HAVE_JAVA
#define CUPS_JAVA "/usr/bin/java"
#undef HAVE_PERL
#define CUPS_PERL "/usr/bin/perl"
#undef HAVE_PHP
#define CUPS_PHP "/usr/bin/php"
#undef HAVE_PYTHON
#define CUPS_PYTHON "/usr/bin/python"
#endif /* !_CUPS_CONFIG_H_ */
/*
* End of "$Id$".
*/
+6 -4
Ver Arquivo
@@ -3,7 +3,7 @@ dnl "$Id$"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2002 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2004 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636-3142 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
@@ -39,7 +39,9 @@ sinclude(config-scripts/cups-openslp.m4)
sinclude(config-scripts/cups-openssl.m4)
sinclude(config-scripts/cups-pam.m4)
AC_OUTPUT(Makedefs cups.list cups.sh cups-config conf/cupsd.conf)
sinclude(config-scripts/cups-scripting.m4)
AC_OUTPUT(Makedefs cups.list cups.sh cups-config conf/cupsd.conf conf/pam.std)
chmod +x cups-config
+7 -7
Ver Arquivo
@@ -4,7 +4,7 @@
#
# CUPS configuration utility.
#
# Copyright 2001 by Easy Software Products, all rights reserved.
# Copyright 2001-2004 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
@@ -16,14 +16,14 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
VERSION="1.1.15"
VERSION="@CUPS_VERSION@"
APIVERSION="1.1"
prefix=@prefix@
@@ -39,9 +39,9 @@ cups_serverroot=@CUPS_SERVERROOT@
# flags for C++ compiler:
CFLAGS=""
LDFLAGS=""
LIBS="@SSLLIBS@ @NETLIBS@"
IMGLIBS="@LIBTIFF@ @LIBJPEG@ @LIBPNG@ @LIBZ@"
LDFLAGS="@EXPORT_LDFLAGS@"
LIBS="@EXPORT_SSLLIBS@ @NETLIBS@ @COMMONLIBS@"
IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@ @EXPORT_LIBZ@"
if test $includedir != /usr/include; then
CFLAGS="$CFLAGS -I$includedir"
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "cups"=.\cups\cups.dsp - Package Owner=<4>
Project: "cups"=".\cups\cups.dsp" - Package Owner=<4>
Package=<5>
{{{
+105 -63
Ver Arquivo
@@ -4,7 +4,7 @@
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -16,25 +16,39 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
# Product information
%product Common UNIX Printing System
%copyright 1993-2002 by Easy Software Products, All Rights Reserved.
%copyright 1993-2004 by Easy Software Products, All Rights Reserved.
%vendor Easy Software Products
%license LICENSE.txt
%readme README.txt
%version 1.1.15
%provides cupsys
%version @CUPS_VERSION@
%description The Common UNIX Printing System provides a portable printing
%description layer for UNIX® operating systems. It has been developed by
%description Easy Software Products to promote a standard printing solution
%description for all UNIX vendors and users. CUPS provides the System V and
%description Berkeley command-line interfaces.
%provides cups-devel
%provides cups-libs
%provides cupsys
%provides cupsys-bsd
%provides cupsys-client
%provides cupsys-devel
%provides libcups1
%provides libcups.so.2
%provides libcupsys2
%provides libcupsys2-dev
%format rpm deb portable
%provides @LIBCUPS@
%provides @LIBCUPSIMAGE@
%format all
#
# GNU variables...
@@ -89,6 +103,8 @@ $CAT8EXT=@CAT8EXT@
$MAN8EXT=@MAN8EXT@
$MAN8DIR=@MAN8DIR@
$DSOLIBS=@DSOLIBS@
# Make sure the MD5 password file is now owned by CUPS_USER...
%postinstall if test -f $SERVERROOT/passwd.md5; then
%postinstall chown $CUPS_USER $SERVERROOT/passwd.md5
@@ -123,22 +139,26 @@ d 0555 root sys $SERVERBIN/daemon -
f 0555 root sys $SERVERBIN/daemon/cups-lpd scheduler/cups-lpd
f 0555 root sys $SERVERBIN/daemon/cups-polld scheduler/cups-polld
d 0555 root sys $SERVERBIN/filter -
f 0555 root sys $SERVERBIN/filter/pdftops pdftops/pdftops
f 0555 root sys $SERVERBIN/filter/gziptoany filter/gziptoany
f 0555 root sys $SERVERBIN/filter/hpgltops filter/hpgltops
f 0555 root sys $SERVERBIN/filter/imagetops filter/imagetops
f 0555 root sys $SERVERBIN/filter/imagetoraster filter/imagetoraster
f 0555 root sys $SERVERBIN/filter/pdftops pdftops/pdftops
f 0555 root sys $SERVERBIN/filter/pstops filter/pstops
f 0555 root sys $SERVERBIN/filter/texttops filter/texttops
f 0555 root sys $SERVERBIN/filter/rastertodymo filter/rastertodymo
f 0555 root sys $SERVERBIN/filter/rastertoepson filter/rastertoepson
f 0555 root sys $SERVERBIN/filter/rastertohp filter/rastertohp
f 0555 root sys $SERVERBIN/filter/hpgltops filter/hpgltops
f 0555 root sys $SERVERBIN/filter/imagetoraster filter/imagetoraster
f 0555 root sys $SERVERBIN/filter/texttops filter/texttops
# Admin commands
d 0555 root sys $BINDIR -
l 0555 root sys $BINDIR/disable $SBINDIR/accept
l 0555 root sys $BINDIR/enable $SBINDIR/accept
l 0555 root sys $LIBDIR/accept $SBINDIR/accept
d 0555 root sys $LIBDIR -
l 0555 root sys $LIBDIR/lpadmin $SBINDIR/lpadmin
l 0555 root sys $LIBDIR/reject accept
d 0555 root sys $SBINDIR -
f 0555 root sys $SBINDIR/accept systemv/accept
f 0555 root sys $SBINDIR/cupsaddsmb systemv/cupsaddsmb
f 0555 root sys $SBINDIR/lpadmin systemv/lpadmin
@@ -153,6 +173,7 @@ l 0555 root sys /usr/etc/lpc $SBINDIR/lpc
# User commands
f 0555 root sys $BINDIR/cancel systemv/cancel
f 0555 root sys $BINDIR/cupstestppd systemv/cupstestppd
f 0555 root sys $BINDIR/lp systemv/lp
f 0555 root sys $BINDIR/lpoptions systemv/lpoptions
f 4555 $CUPS_USER sys $BINDIR/lppasswd systemv/lppasswd
@@ -168,6 +189,7 @@ l 0555 root sys /usr/bsd/lprm $BINDIR/lprm
%system all
# DSOs
%if DSOLIBS
%system hpux
f 0555 root sys $LIBDIR/libcups.sl.2 cups/libcups.sl.2
l 0555 root sys $LIBDIR/libcups.sl libcups.sl.2
@@ -187,6 +209,7 @@ l 0555 root sys $LIBDIR/libcups.so libcups.so.2
f 0555 root sys $LIBDIR/libcupsimage.so.2 filter/libcupsimage.so.2
l 0555 root sys $LIBDIR/libcupsimage.so libcupsimage.so.2
%system all
%endif
# Directories
d 0755 root sys $LOGDIR -
@@ -199,14 +222,14 @@ f 0444 root sys $LOCALEDIR/be/cups_be locale/be/cups_be
f 0444 root sys $LOCALEDIR/cs/cups_cs locale/cs/cups_cs
f 0444 root sys $LOCALEDIR/de/cups_de locale/de/cups_de
f 0444 root sys $LOCALEDIR/en/cups_en locale/en/cups_en
f 0444 root sys $LOCALEDIR/en_US/cups_en_US locale/en_US/cups_en_US
f 0444 root sys $LOCALEDIR/es/cups_es locale/es/cups_es
f 0444 root sys $LOCALEDIR/fr/cups_fr locale/fr/cups_fr
f 0444 root sys $LOCALEDIR/it/cups_it locale/it/cups_it
f 0444 root sys $LOCALEDIR/ru_RU.cp1251/cups_ru_RU.cp1251 locale/ru_RU.cp1251/cups_ru_RU.cp1251
f 0444 root sys $LOCALEDIR/ru_RU.koi8r/cups_ru_RU.koi8r locale/ru_RU.koi8r/cups_ru_RU.koi8r
f 0444 root sys $LOCALEDIR/ru_RU/cups_ru_RU locale/ru_RU/cups_ru_RU
f 0444 root sys $LOCALEDIR/sv/cups_sv locale/sv/cups_sv
f 0444 root sys $LOCALEDIR/uk/cups_uk locale/uk/cups_uk
f 0444 root sys $LOCALEDIR/uk_UA.cp1251/cups_uk_UA.cp1251 locale/uk_UA.cp1251/cups_uk_UA.cp1251
f 0444 root sys $LOCALEDIR/uk_UA/cups_uk_UA locale/uk_UA/cups_uk_UA
f 0444 root sys $LOCALEDIR/zh_CN/cups_zh_CN locale/zh_CN/cups_zh_CN
d 0555 root sys $DATADIR -
@@ -260,6 +283,18 @@ f 0444 root sys $DATADIR/model ppd/*.ppd
d 0555 root sys $DATADIR/templates -
c 0444 root sys $DATADIR/templates templates/*.tmpl
d 0555 root sys $DATADIR/templates/be -
c 0444 root sys $DATADIR/templates/be templates/be/*.tmpl
d 0555 root sys $DATADIR/templates/de -
c 0444 root sys $DATADIR/templates/de templates/de/*.tmpl
d 0555 root sys $DATADIR/templates/es -
c 0444 root sys $DATADIR/templates/es templates/es/*.tmpl
d 0555 root sys $DATADIR/templates/fr -
c 0444 root sys $DATADIR/templates/fr templates/fr/*.tmpl
# Config files
d 0555 root sys $SERVERROOT -
d 0711 $CUPS_USER $CUPS_GROUP $SERVERROOT/certs -
@@ -269,21 +304,10 @@ c 0600 root sys $SERVERROOT conf/*.conf
c 0600 root sys $SERVERROOT/mime.convs conf/mime.convs
c 0600 root sys $SERVERROOT/mime.types conf/mime.types
%system linux
%if PAMDIR
d 0555 root sys $PAMDIR -
c 0644 root sys $PAMDIR/cups data/cups.pam
c 0644 root sys $PAMDIR/cups.suse data/cups.suse
%install if test -f /lib/security/pam_unix.so; then
%install mv $PAMDIR/cups.suse $PAMDIR/cups
%install fi
# IRIX doesn't normally support PAM, but the freeware project
# includes a version of PAM that can be used...
%system irix
d 0555 root sys $PAMDIR -
c 0644 root sys $PAMDIR/cups data/cups.irix
%system all
c 0644 root sys $PAMDIR/cups conf/@PAMFILE@
%endif
# Developer files
f 0555 root sys $BINDIR/cups-config cups-config
@@ -298,12 +322,30 @@ f 0444 root sys $INCLUDEDIR/cups/ppd.h cups/ppd.h
f 0444 root sys $INCLUDEDIR/cups/raster.h filter/raster.h
f 0444 root sys $LIBDIR/libcups.a cups/libcups.a
f 0444 root sys $LIBDIR/libcupsimage.a filter/libcupsimage.a
# Documentation files
d 0555 root sys $DOCDIR -
f 0444 root sys $DOCDIR doc/*.css
f 0444 root sys $DOCDIR doc/*.html
f 0444 root sys $DOCDIR doc/*.pdf
f 0444 root sys $DOCDIR/robots.txt doc/robots.txt
d 0555 root sys $DOCDIR/be -
f 0444 root sys $DOCDIR/be doc/be/*.css
f 0444 root sys $DOCDIR/be doc/be/*.html
f 0444 root sys $DOCDIR/be doc/be/*.pdf
d 0555 root sys $DOCDIR/de -
f 0444 root sys $DOCDIR/de doc/de/*.css
f 0444 root sys $DOCDIR/de doc/de/*.html
f 0444 root sys $DOCDIR/de doc/de/*.pdf
d 0555 root sys $DOCDIR/es -
f 0444 root sys $DOCDIR/es doc/es/*.css
f 0444 root sys $DOCDIR/es doc/es/*.html
f 0444 root sys $DOCDIR/es doc/es/*.pdf
d 0555 root sys $DOCDIR/fr -
f 0444 root sys $DOCDIR/fr doc/fr/*.css
f 0444 root sys $DOCDIR/fr doc/fr/*.html
f 0444 root sys $DOCDIR/fr doc/fr/*.pdf
d 0555 root sys $DOCDIR/images -
f 0444 root sys $DOCDIR/images doc/images/*.gif
@@ -321,6 +363,8 @@ d 0555 root sys $PMANDIR/cat3 -
d 0555 root sys $PMANDIR/man3 -
f 0444 root sys $MANDIR/cat1/backend.$CAT1EXT man/backend.$CAT1EXT
f 0444 root sys $MANDIR/cat1/cups-config.$CAT1EXT man/cups-config.$CAT1EXT
f 0444 root sys $MANDIR/cat1/cupstestppd.$CAT1EXT man/cupstestppd.$CAT1EXT
f 0444 root sys $MANDIR/cat1/filter.$CAT1EXT man/filter.$CAT1EXT
f 0444 root sys $MANDIR/cat1/lpoptions.$CAT1EXT man/lpoptions.$CAT1EXT
f 0444 root sys $MANDIR/cat1/lppasswd.$CAT1EXT man/lppasswd.$CAT1EXT
@@ -331,8 +375,6 @@ f 0444 root sys $MANDIR/cat1/lpstat.$CAT1EXT man/lpstat.$CAT1EXT
f 0444 root sys $MANDIR/cat1/lp.$CAT1EXT man/lp.$CAT1EXT
l 0444 root sys $MANDIR/cat1/cancel.$CAT1EXT lp.$CAT1EXT
f 0444 root sys $PMANDIR/cat3/cups-config.$CAT3EXT man/cups-config.$CAT3EXT
f 0444 root sys $MANDIR/cat5/classes.conf.$CAT5EXT man/classes.conf.$CAT5EXT
f 0444 root sys $MANDIR/cat5/cupsd.conf.$CAT5EXT man/cupsd.conf.$CAT5EXT
f 0444 root sys $MANDIR/cat5/mime.convs.$CAT5EXT man/mime.convs.$CAT5EXT
@@ -352,24 +394,24 @@ f 0444 root sys $AMANDIR/cat$MAN8DIR/lpc.$CAT8EXT man/lpc.$CAT8EXT
f 0444 root sys $AMANDIR/cat$MAN8DIR/lpinfo.$CAT8EXT man/lpinfo.$CAT8EXT
f 0444 root sys $AMANDIR/cat$MAN8DIR/lpmove.$CAT8EXT man/lpmove.$CAT8EXT
f 0444 root sys $MANDIR/man1/backend.$MAN1EXT man/backend.man
f 0444 root sys $MANDIR/man1/filter.$MAN1EXT man/filter.man
f 0444 root sys $MANDIR/man1/lpoptions.$MAN1EXT man/lpoptions.man
f 0444 root sys $MANDIR/man1/lppasswd.$MAN1EXT man/lppasswd.man
f 0444 root sys $MANDIR/man1/lpq.$MAN1EXT man/lpq.man
f 0444 root sys $MANDIR/man1/lprm.$MAN1EXT man/lprm.man
f 0444 root sys $MANDIR/man1/lpr.$MAN1EXT man/lpr.man
f 0444 root sys $MANDIR/man1/lpstat.$MAN1EXT man/lpstat.man
f 0444 root sys $MANDIR/man1/lp.$MAN1EXT man/lp.man
l 0444 root sys $MANDIR/man1/cancel.$MAN1EXT lp.$MAN1EXT
f 0444 root sys $MANDIR/man1/backend.1 man/backend.man
f 0444 root sys $MANDIR/man1/cups-config.1 man/cups-config.man
f 0444 root sys $MANDIR/man1/cupstestppd.1 man/cupstestppd.man
f 0444 root sys $MANDIR/man1/filter.1 man/filter.man
f 0444 root sys $MANDIR/man1/lpoptions.1 man/lpoptions.man
f 0444 root sys $MANDIR/man1/lppasswd.1 man/lppasswd.man
f 0444 root sys $MANDIR/man1/lpq.1 man/lpq.man
f 0444 root sys $MANDIR/man1/lprm.1 man/lprm.man
f 0444 root sys $MANDIR/man1/lpr.1 man/lpr.man
f 0444 root sys $MANDIR/man1/lpstat.1 man/lpstat.man
f 0444 root sys $MANDIR/man1/lp.1 man/lp.man
l 0444 root sys $MANDIR/man1/cancel.1 lp.1
f 0444 root sys $PMANDIR/man3/cups-config.$MAN3EXT man/cups-config.man
f 0444 root sys $MANDIR/man5/classes.conf.$MAN5EXT man/classes.conf.man
f 0444 root sys $MANDIR/man5/cupsd.conf.$MAN5EXT man/cupsd.conf.man
f 0444 root sys $MANDIR/man5/mime.convs.$MAN5EXT man/mime.convs.man
f 0444 root sys $MANDIR/man5/mime.types.$MAN5EXT man/mime.types.man
f 0444 root sys $MANDIR/man5/printers.conf.$MAN5EXT man/printers.conf.man
f 0444 root sys $MANDIR/man5/classes.conf.5 man/classes.conf.man
f 0444 root sys $MANDIR/man5/cupsd.conf.5 man/cupsd.conf.man
f 0444 root sys $MANDIR/man5/mime.convs.5 man/mime.convs.man
f 0444 root sys $MANDIR/man5/mime.types.5 man/mime.types.man
f 0444 root sys $MANDIR/man5/printers.conf.5 man/printers.conf.man
f 0444 root sys $AMANDIR/man$MAN8DIR/accept.$MAN8EXT man/accept.man
l 0444 root sys $AMANDIR/man$MAN8DIR/reject.$MAN8EXT accept.$MAN8EXT
@@ -428,24 +470,24 @@ f 0444 root sys $AMANDIR/fr/cat$MAN8DIR/lpc.$CAT8EXT man/lpc.$CAT8EXT
f 0444 root sys $AMANDIR/fr/cat$MAN8DIR/lpinfo.$CAT8EXT man/lpinfo.$CAT8EXT
f 0444 root sys $AMANDIR/fr/cat$MAN8DIR/lpmove.$CAT8EXT man/lpmove.$CAT8EXT
f 0444 root sys $MANDIR/fr/man1/backend.$MAN1EXT man/backend.man
f 0444 root sys $MANDIR/fr/man1/filter.$MAN1EXT man/filter.man
f 0444 root sys $MANDIR/fr/man1/lpoptions.$MAN1EXT man/lpoptions.man
f 0444 root sys $MANDIR/fr/man1/lppasswd.$MAN1EXT man/lppasswd.man
f 0444 root sys $MANDIR/fr/man1/lpq.$MAN1EXT man/lpq.man
f 0444 root sys $MANDIR/fr/man1/lprm.$MAN1EXT man/lprm.man
f 0444 root sys $MANDIR/fr/man1/lpr.$MAN1EXT man/lpr.man
f 0444 root sys $MANDIR/fr/man1/lpstat.$MAN1EXT man/lpstat.man
f 0444 root sys $MANDIR/fr/man1/lp.$MAN1EXT man/lp.man
l 0444 root sys $MANDIR/fr/man1/cancel.$MAN1EXT lp.$MAN1EXT
f 0444 root sys $MANDIR/fr/man1/backend.1 man/backend.man
f 0444 root sys $MANDIR/fr/man1/filter.1 man/filter.man
f 0444 root sys $MANDIR/fr/man1/lpoptions.1 man/lpoptions.man
f 0444 root sys $MANDIR/fr/man1/lppasswd.1 man/lppasswd.man
f 0444 root sys $MANDIR/fr/man1/lpq.1 man/lpq.man
f 0444 root sys $MANDIR/fr/man1/lprm.1 man/lprm.man
f 0444 root sys $MANDIR/fr/man1/lpr.1 man/lpr.man
f 0444 root sys $MANDIR/fr/man1/lpstat.1 man/lpstat.man
f 0444 root sys $MANDIR/fr/man1/lp.1 man/lp.man
l 0444 root sys $MANDIR/fr/man1/cancel.1 lp.1
f 0444 root sys $PMANDIR/fr/man3/cups-config.$MAN3EXT man/cups-config.man
f 0444 root sys $PMANDIR/fr/man3/cups-config.3 man/cups-config.man
f 0444 root sys $MANDIR/fr/man5/classes.conf.$MAN5EXT man/classes.conf.man
f 0444 root sys $MANDIR/fr/man5/cupsd.conf.$MAN5EXT man/cupsd.conf.man
f 0444 root sys $MANDIR/fr/man5/mime.convs.$MAN5EXT man/mime.convs.man
f 0444 root sys $MANDIR/fr/man5/mime.types.$MAN5EXT man/mime.types.man
f 0444 root sys $MANDIR/fr/man5/printers.conf.$MAN5EXT man/printers.conf.man
f 0444 root sys $MANDIR/fr/man5/classes.conf.5 man/classes.conf.man
f 0444 root sys $MANDIR/fr/man5/cupsd.conf.5 man/cupsd.conf.man
f 0444 root sys $MANDIR/fr/man5/mime.convs.5 man/mime.convs.man
f 0444 root sys $MANDIR/fr/man5/mime.types.5 man/mime.types.man
f 0444 root sys $MANDIR/fr/man5/printers.conf.5 man/printers.conf.man
f 0444 root sys $AMANDIR/fr/man$MAN8DIR/accept.$MAN8EXT man/accept.man
l 0444 root sys $AMANDIR/fr/man$MAN8DIR/reject.$MAN8EXT accept.$MAN8EXT
+39
Ver Arquivo
@@ -0,0 +1,39 @@
#!/bin/sh
##
# PrintingServices - a.k.a. CUPS
##
. /etc/rc.common
StartService ()
{
if [ "${CUPS:=-YES-}" = "-YES-" ]; then
ConsoleMessage "Starting printing services"
/usr/sbin/cupsd
fi
}
StopService ()
{
# Until cupsd has a pid file...
pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
if test "$pid" != ""; then
ConsoleMessage "Stopping printing services"
kill "${pid}"
fi
}
RestartService ()
{
# Until cupsd has a pid file...
pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
if test "x$pid" != x; then
ConsoleMessage "Restarting printing services"
kill -HUP "${pid}"
else
StartService
fi
}
RunService "$1"
+3 -7
Ver Arquivo
@@ -1,11 +1,7 @@
{
Description = "Printing Services";
Provides = ("Printing");
Provides = ("PrintingServices");
Requires = ("Resolver");
OrderPreference = "None";
Messages =
{
start = "Starting printing services";
stop = "Stopping printing services";
};
Uses = ("Network Time");
OrderPreference = "Late";
}
+61 -30
Ver Arquivo
@@ -4,7 +4,7 @@
#
# Startup/shutdown script for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -16,9 +16,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -47,10 +47,21 @@
case "`uname`" in
IRIX*)
IS_ON=/sbin/chkconfig
if $IS_ON verbose; then
ECHO=echo
else
ECHO=:
fi
ECHO_OK=:
ECHO_ERROR=:
;;
*BSD*)
IS_ON=:
ECHO=echo
ECHO_OK=:
ECHO_ERROR=:
;;
Darwin*)
@@ -61,44 +72,59 @@ case "`uname`" in
fi
IS_ON=:
ECHO=ConsoleMessage
ECHO_OK=:
ECHO_ERROR=:
;;
Linux*)
# Set the timezone, if possible...
if test -f /etc/TIMEZONE; then
. /etc/TIMEZONE
else
if test -f /etc/sysconfig/clock; then
. /etc/sysconfig/clock
TZ="$ZONE"
export TZ
fi
fi
IS_ON=/bin/true
if test -f /etc/init.d/functions; then
. /etc/init.d/functions
ECHO=echo
ECHO_OK="echo_success"
ECHO_ERROR="echo_failure"
else
ECHO=echo
ECHO_OK=:
ECHO_ERROR=:
fi
;;
*)
IS_ON=/bin/true
ECHO=echo
ECHO_OK=:
ECHO_ERROR=:
;;
esac
#### OS-Independent Stuff
#
# The verbose flag controls the printing of the names of
# daemons as they are started. Currently always echos for
# all but IRIX, which can configure verbose bootup messages.
# Set the timezone, if possible... This allows the
# scheduler and all child processes to know the local
# timezone when reporting dates and times to the user.
# If no timezone information is found, then Greenwich
# Mean Time (GMT) will probably be used.
#
if test "`uname`" = "Darwin"; then
ECHO=ConsoleMessage
else
if $IS_ON verbose; then
ECHO=echo
else
ECHO=:
for file in /etc/TIMEZONE /etc/rc.config /etc/sysconfig/clock; do
if test -f $file; then
. $file
fi
done
if test "x$ZONE" != x; then
TZ="$ZONE"
fi
if test "x$TIMEZONE" != x; then
TZ="$TIMEZONE"
fi
if test "x$TZ" != x; then
export TZ
fi
#
@@ -140,25 +166,30 @@ case $1 in
prefix=@prefix@
exec_prefix=@exec_prefix@
@sbindir@/cupsd
if test $? != 0; then
$ECHO_FAIL
$ECHO "cups: unable to $1 scheduler."
exit 1
fi
fi
$ECHO "cups: scheduler ${1}ed."
else
$ECHO "cups: scheduler stopped."
$ECHO_OK
$ECHO "cups: ${1}ed scheduler."
fi
;;
stop)
if test "$pid" != ""; then
kill $pid
$ECHO "cups: scheduler stopped."
$ECHO_OK
$ECHO "cups: stopped scheduler."
fi
;;
status)
if test "$pid" != ""; then
echo "cups: Scheduler is running."
echo "cups: scheduler is running."
else
echo "cups: Scheduler is not running."
echo "cups: scheduler is not running."
fi
;;
+76 -26
Ver Arquivo
@@ -1,11 +1,11 @@
#
# "$Id: cups.spec 2429 2002-05-21 19:59:43Z mike $"
# "$Id: cups.spec 4208 2004-06-29 03:14:19Z mike $"
#
# RPM "spec" file for the Common UNIX Printing System (CUPS).
#
# Original version by Jason McMullan <jmcc@ontv.com>.
#
# Copyright 1999-2002 by Easy Software Products, all rights reserved.
# Copyright 1999-2004 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
@@ -17,17 +17,17 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
Summary: Common Unix Printing System
Name: cups
Version: 1.1.15
Release: 0
Version: 1.1.21rc2
Release: 1
Copyright: GPL
Group: System Environment/Daemons
Source: ftp://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.gz
@@ -46,6 +46,10 @@ Provides: libcupsimage.so.2
%package devel
Summary: Common Unix Printing System - development environment
Group: Development/Libraries
%package libs
Summary: Common Unix Printing System - shared libraries
Group: System Environment/Libraries
Provides: libcups1
%description
@@ -59,6 +63,10 @@ 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.
%description libs
The Common UNIX Printing System provides a portable printing layer for
UNIX® operating systems. This package contains the CUPS shared libraries.
%prep
%setup
@@ -127,26 +135,31 @@ rm -rf $RPM_BUILD_ROOT
# RC dirs are a pain under Linux... Uncomment the appropriate ones if you
# don't use Red Hat or Mandrake...
# OLD RedHat/Mandrake
/etc/rc.d/init.d/*
/etc/rc.d/rc0.d/*
/etc/rc.d/rc2.d/*
/etc/rc.d/rc3.d/*
/etc/rc.d/rc5.d/*
#/etc/init.d/*
#/etc/rc0.d/*
#/etc/rc3.d/*
#/etc/rc5.d/*
#/sbin/rc.d/*
#/sbin/rc.d/rc0.d/*
#/sbin/rc.d/rc2.d/*
#/sbin/rc.d/rc3.d/*
#/sbin/rc.d/rc5.d/*
# NEW RedHat/Mandrake
#/etc/init.d/*
#/etc/rc0.d/*
#/etc/rc2.d/*
#/etc/rc3.d/*
#/etc/rc5.d/*
/usr/bin/cancel
/usr/bin/cupstestppd
/usr/bin/disable
/usr/bin/enable
/usr/bin/lp*
/usr/lib/*.so*
%dir /usr/lib/cups
/usr/lib/cups/*
/usr/sbin/*
@@ -158,26 +171,62 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/locale/*
%dir /usr/share/man/cat1
/usr/share/man/cat1/*
/usr/share/man/cat1/backend.1
/usr/share/man/cat1/cupstestppd.1
/usr/share/man/cat1/filter.1
/usr/share/man/cat1/lp.1
/usr/share/man/cat1/lpoptions.1
/usr/share/man/cat1/lppasswd.1
/usr/share/man/cat1/lpq.1
/usr/share/man/cat1/lpr.1
/usr/share/man/cat1/lprm.1
/usr/share/man/cat1/lpstat.1
%dir /usr/share/man/cat5
/usr/share/man/cat5/*
%dir /usr/share/man/cat8
/usr/share/man/cat8/*
%dir /usr/share/man/man1
/usr/share/man/man1/*
/usr/share/man/man1/backend.1.gz
/usr/share/man/man1/cupstestppd.1.gz
/usr/share/man/man1/filter.1.gz
/usr/share/man/man1/lp.1.gz
/usr/share/man/man1/lpoptions.1.gz
/usr/share/man/man1/lppasswd.1.gz
/usr/share/man/man1/lpq.1.gz
/usr/share/man/man1/lpr.1.gz
/usr/share/man/man1/lprm.1.gz
/usr/share/man/man1/lpstat.1.gz
%dir /usr/share/man/man5
/usr/share/man/man5/*
%dir /usr/share/man/man8
/usr/share/man/man8/*
%dir /usr/share/man/fr/cat1
/usr/share/man/fr/cat1/*
/usr/share/man/fr/cat1/backend.1
/usr/share/man/fr/cat1/cupstestppd.1
/usr/share/man/fr/cat1/filter.1
/usr/share/man/fr/cat1/lp.1
/usr/share/man/fr/cat1/lpoptions.1
/usr/share/man/fr/cat1/lppasswd.1
/usr/share/man/fr/cat1/lpq.1
/usr/share/man/fr/cat1/lpr.1
/usr/share/man/fr/cat1/lprm.1
/usr/share/man/fr/cat1/lpstat.1
%dir /usr/share/man/fr/cat5
/usr/share/man/fr/cat5/*
%dir /usr/share/man/fr/cat8
/usr/share/man/fr/cat8/*
%dir /usr/share/man/fr/man1
/usr/share/man/fr/man1/*
/usr/share/man/fr/man1/backend.1.gz
/usr/share/man/fr/man1/cupstestppd.1.gz
/usr/share/man/fr/man1/filter.1.gz
/usr/share/man/fr/man1/lp.1.gz
/usr/share/man/fr/man1/lpoptions.1.gz
/usr/share/man/fr/man1/lppasswd.1.gz
/usr/share/man/fr/man1/lpq.1.gz
/usr/share/man/fr/man1/lpr.1.gz
/usr/share/man/fr/man1/lprm.1.gz
/usr/share/man/fr/man1/lpstat.1.gz
%dir /usr/share/man/fr/man5
/usr/share/man/fr/man5/*
%dir /usr/share/man/fr/man8
@@ -187,21 +236,22 @@ rm -rf $RPM_BUILD_ROOT
%attr(1700,lp,root) %dir /var/spool/cups/tmp
%files devel
%dir /usr/share/man/cat1
/usr/share/man/cat1/cups-config.1
%dir /usr/share/man/fr/cat1
/usr/share/man/fr/cat1/cups-config.1
%dir /usr/share/man/man1
/usr/share/man/man1/cups-config.1.gz
%dir /usr/share/man/fr/man1
/usr/share/man/fr/man1/cups-config.1.gz
/usr/bin/cups-config
%dir /usr/include/cups
/usr/include/cups/*
/usr/lib/*.a
%dir /usr/share/man/cat3
/usr/share/man/cat3/*
%dir /usr/share/man/man3
/usr/share/man/man3/*
%dir /usr/share/man/fr/cat3
/usr/share/man/fr/cat3/*
%dir /usr/share/man/fr/man3
/usr/share/man/fr/man3/*
%files libs
/usr/lib/*.so*
#
# End of "$Id: cups.spec 2429 2002-05-21 19:59:43Z mike $".
# End of "$Id: cups.spec 4208 2004-06-29 03:14:19Z mike $".
#
+9
Ver Arquivo
@@ -1,4 +1,13 @@
libcups.a
libcups.la
libcups.sl
libcups.sl.2
libcups.so
libcups.so.2
libcups_s.a
libcups.2.dylib
libcups.dylib
testhttp
testipp
testlang
testppd
+21 -12
Ver Arquivo
@@ -1,22 +1,31 @@
# DO NOT DELETE
dest.o: cups.h ipp.h http.h md5.h ppd.h language.h string.h ../config.h
attr.o: ppd.h debug.h string.h ../config.h
auth.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h language.h
auth.o: debug.h
dest.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h language.h
emit.o: ppd.h string.h ../config.h
encode.o: cups.h ipp.h http.h md5.h ppd.h string.h ../config.h debug.h
http.o: string.h ../config.h http.h md5.h ipp.h debug.h
ipp.o: string.h ../config.h language.h ipp.h http.h md5.h debug.h
language.o: string.h ../config.h language.h cups_C.h
encode.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h debug.h
getputfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h language.h
getputfile.o: debug.h
http.o: http-private.h ../config.h http.h string.h md5.h debug.h
http-addr.o: string.h ../config.h http.h md5.h
http-support.o: string.h ../config.h http.h md5.h ipp.h
ipp.o: string.h ../config.h ipp.h http.h md5.h debug.h
ipp-support.o: string.h ../config.h language.h ipp.h http.h md5.h debug.h
language.o: string.h ../config.h language.h debug.h cups_C.h
mark.o: ppd.h string.h ../config.h debug.h
md5.o: md5.h string.h ../config.h
md5passwd.o: http.h md5.h string.h ../config.h
options.o: cups.h ipp.h http.h md5.h ppd.h string.h ../config.h debug.h
md5passwd.o: http.h string.h ../config.h md5.h
options.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h debug.h
page.o: ppd.h string.h ../config.h
ppd.o: ppd.h string.h ../config.h language.h debug.h
snprintf.o: string.h ../config.h
string.o: string.h ../config.h
tempfile.o: cups.h ipp.h http.h md5.h ppd.h string.h ../config.h debug.h
usersys.o: cups.h ipp.h http.h md5.h ppd.h string.h ../config.h
util.o: cups.h ipp.h http.h md5.h ppd.h language.h string.h ../config.h
tempfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h debug.h
usersys.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h
util.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h language.h
util.o: debug.h
testhttp.o: http.h md5.h
testppd.o: cups.h ipp.h http.h md5.h ppd.h string.h ../config.h
testhttp.o: http.h string.h ../config.h md5.h
testipp.o: ../cups/string.h ../config.h string.h ipp.h http.h md5.h
testlang.o: language.h
+28 -32
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Support library Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2002 by Easy Software Products, all rights reserved.
# Copyright 1997-2004 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -30,10 +30,11 @@ include ../Makedefs
# Object files...
#
LIBOBJS = dest.o emit.o encode.o http.o ipp.o language.o mark.o md5.o \
md5passwd.o options.o page.o ppd.o snprintf.o string.o \
tempfile.o usersys.o util.o
OBJS = $(LIBOBJS) testhttp.o testlang.o testppd.o ppd-debug.o
LIBOBJS = attr.o auth.o dest.o emit.o encode.o getputfile.o \
http.o http-addr.o http-support.o ipp.o ipp-support.o \
language.o mark.o md5.o md5passwd.o options.o page.o \
ppd.o snprintf.o string.o tempfile.o usersys.o util.o
OBJS = $(LIBOBJS) testhttp.o testipp.o testlang.o
#
@@ -47,7 +48,8 @@ HEADERS = cups.h http.h ipp.h language.h md5.h ppd.h
# Targets in this directory...
#
TARGETS = $(LIBCUPS) libcups.a
TARGETS = $(LIBCUPS) libcups.a \
testhttp testipp testlang
#
@@ -81,18 +83,17 @@ install: all installhdrs
$(INSTALL_DIR) $(LIBDIR)
$(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
$(INSTALL_LIB) libcups.a $(LIBDIR); \
$(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
$(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
fi
if test $(LIBCUPS) = "libcups.2.dylib"; then \
$(STRIP) -x $(LIBDIR)/$(LIBCUPS); \
$(INSTALL_LIB) libcups.a $(LIBDIR); \
$(RM) $(LIBDIR)/libcups.dylib; \
$(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
fi
if test $(LIBCUPS) = "libcups_s.a"; then \
if test $(LIBCUPS) != "libcups.a"; then \
$(INSTALL_LIB) libcups.a $(LIBDIR); \
$(RANLIB) $(LIBDIR)/libcups.a; \
fi
installhdrs:
@@ -108,7 +109,7 @@ installhdrs:
libcups.so.2 libcups.sl.2: $(LIBOBJS) ../Makedefs
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS) $(SSLLIBS)
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS)
$(RM) `basename $@ .2`
$(LN) $@ `basename $@ .2`
@@ -121,9 +122,9 @@ libcups.2.dylib: $(LIBOBJS) ../Makedefs
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/$@ \
-current_version 2.0.4 \
-current_version 2.7.0 \
-compatibility_version 2.0.0 \
$(LIBOBJS) $(SSLLIBS)
$(LIBOBJS) $(SSLLIBS) $(COMMONLIBS)
$(RM) libcups.dylib
$(LN) $@ libcups.dylib
@@ -136,7 +137,7 @@ libcups_s.a: $(LIBOBJS) ../Makedefs
echo Creating $@...
$(RM) libcups_s.exp
(echo _ipp_add_attr; echo _ipp_free_attr) >libcups_s.exp
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(SSLLIBS) -lm
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) -lm
$(RM) $@
$(AR) $(ARFLAGS) $@ libcups_s.o
@@ -148,7 +149,7 @@ libcups_s.a: $(LIBOBJS) ../Makedefs
libcups.la: $(LIBOBJS) ../Makedefs
echo Linking $@...
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
-version-info 2:4 $(SSLLIBS)
-version-info 2:7 $(SSLLIBS) $(COMMONLIBS)
#
@@ -178,7 +179,16 @@ cups_C.h: ../locale/C/cups_C
testhttp: testhttp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a $(NETLIBS) $(SSLLIBS)
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a $(NETLIBS) $(SSLLIBS) $(COMMONLIBS)
#
# testipp (dependency on static CUPS library is intentional)
#
testipp: testipp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testipp.o libcups.a $(NETLIBS) $(SSLLIBS) $(COMMONLIBS)
#
@@ -187,21 +197,7 @@ testhttp: testhttp.o libcups.a
testlang: testlang.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testlang.o libcups.a $(NETLIBS) $(SSLLIBS)
#
# testppd
#
testppd: testppd.o ppd-debug.o language.o mark.o page.o string.o
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testppd.o ppd-debug.o language.o mark.o page.o \
string.o
ppd-debug.o: ppd.c ppd.h string.h ../config.h language.h debug.h
echo Compiling $< with debugging...
$(CC) $(OPTIM) $(CFLAGS) -DDEBUG -c -o $@ $<
$(CC) $(LDFLAGS) -o $@ testlang.o libcups.a $(NETLIBS) $(SSLLIBS) $(COMMONLIBS)
#
+180
Ver Arquivo
@@ -0,0 +1,180 @@
/*
* "$Id$"
*
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* ppdFindAttr() - Find the first matching attribute...
* ppdFindNextAttr() - Find the next matching attribute...
*/
/*
* Include necessary headers...
*/
#include "ppd.h"
#include "debug.h"
#include "string.h"
#include <stdlib.h>
/*
* Private function...
*/
extern int _ppd_attr_compare(ppd_attr_t **a, ppd_attr_t **b);
/*
* 'ppdFindAttr()' - Find the first matching attribute...
*/
ppd_attr_t * /* O - Attribute or NULL if not found */
ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
const char *name, /* I - Attribute name */
const char *spec) /* I - Specifier string or NULL */
{
ppd_attr_t key, /* Search key */
*keyptr, /* Pointer to key */
**match; /* Matching attribute */
/*
* Range check input...
*/
if (ppd == NULL || name == NULL || ppd->num_attrs == 0)
return (NULL);
/*
* Do a binary search for a matching attribute...
*/
memset(&key, 0, sizeof(key));
strncpy(key.name, name, sizeof(key.name) - 1);
if (spec)
strncpy(key.spec, spec, sizeof(key.spec) - 1);
keyptr = &key;
match = bsearch(&keyptr, ppd->attrs, ppd->num_attrs, sizeof(ppd_attr_t *),
(int (*)(const void *, const void *))_ppd_attr_compare);
if (match == NULL)
{
/*
* No match!
*/
ppd->cur_attr = -1;
return (NULL);
}
if (match > ppd->attrs && spec == NULL)
{
/*
* Find the first attribute with the same name...
*/
while (match > ppd->attrs)
{
if (strcmp(match[-1]->name, name) != 0)
break;
match --;
}
}
/*
* Save the current attribute and return its value...
*/
ppd->cur_attr = match - ppd->attrs;
return (*match);
}
/*
* 'ppdFindNextAttr()' - Find the next matching attribute...
*/
ppd_attr_t * /* O - Attribute or NULL if not found */
ppdFindNextAttr(ppd_file_t *ppd, /* I - PPD file data */
const char *name, /* I - Attribute name */
const char *spec) /* I - Specifier string or NULL */
{
ppd_attr_t **match; /* Matching attribute */
/*
* Range check input...
*/
if (ppd == NULL || name == NULL || ppd->num_attrs == 0 || ppd->cur_attr < 0)
return (NULL);
/*
* See if there are more attributes to return...
*/
ppd->cur_attr ++;
if (ppd->cur_attr >= ppd->num_attrs)
{
/*
* Nope...
*/
ppd->cur_attr = -1;
return (NULL);
}
/*
* Check the next attribute to see if it is a match...
*/
match = ppd->attrs + ppd->cur_attr;
if (strcmp((*match)->name, name) != 0 ||
(spec != NULL && strcmp((*match)->spec, spec) != 0))
{
/*
* Nope...
*/
ppd->cur_attr = -1;
return (NULL);
}
/*
* Return the next attribute's value...
*/
return (*match);
}
/*
* End of "$Id$".
*/
+249
Ver Arquivo
@@ -0,0 +1,249 @@
/*
* "$Id$"
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* cupsDoAuthentication() - Authenticate a request...
* cups_local_auth() - Get the local authorization certificate if
* available/applicable...
*/
/*
* 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 <fcntl.h>
#include <sys/stat.h>
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
#else
# include <unistd.h>
#endif /* WIN32 || __EMX__ */
/*
* Local functions...
*/
static int cups_local_auth(http_t *http);
/*
* 'cupsDoAuthentication()' - Authenticate a request...
*/
int /* O - 0 on success, -1 on error */
cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
const char *method,/* I - Request method (GET, POST, PUT) */
const char *resource)
/* I - Resource path */
{
const char *password; /* Password string */
char prompt[1024], /* Prompt for user */
realm[HTTP_MAX_VALUE], /* realm="xyz" string */
nonce[HTTP_MAX_VALUE], /* nonce="xyz" string */
encode[512]; /* Encoded username:password */
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")\n",
http, method, resource));
DEBUG_printf(("cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"\n",
http->digest_tries, http->userpass));
/*
* Clear the current authentication string...
*/
http->authstring[0] = '\0';
/*
* See if we can do local authentication...
*/
if (!cups_local_auth(http))
{
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
return (0);
}
/*
* Nope, see if we should retry the current username:password...
*/
if (http->digest_tries > 1 || !http->userpass[0])
{
/*
* Nope - get a new password from the user...
*/
snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(),
http->hostname);
http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
"Basic", 5) == 0;
http->userpass[0] = '\0';
if ((password = cupsGetPassword(prompt)) == NULL)
return (-1);
if (!password[0])
return (-1);
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
password);
}
else if (http->status == HTTP_UNAUTHORIZED)
http->digest_tries ++;
/*
* Got a password; encode it for the server...
*/
if (strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0)
{
/*
* Basic authentication...
*/
httpEncode64(encode, http->userpass);
snprintf(http->authstring, sizeof(http->authstring), "Basic %s", encode);
}
else
{
/*
* Digest authentication...
*/
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
httpMD5(cupsUser(), realm, strchr(http->userpass, ':') + 1, encode);
httpMD5Final(nonce, method, resource, encode);
snprintf(http->authstring, sizeof(http->authstring),
"Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", "
"uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce,
resource, encode);
}
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
return (0);
}
/*
* 'cups_local_auth()' - Get the local authorization certificate if
* available/applicable...
*/
static int /* O - 0 if available, -1 if not */
cups_local_auth(http_t *http) /* I - HTTP connection to server */
{
#if defined(WIN32) || defined(__EMX__)
/*
* Currently WIN32 and OS-2 do not support the CUPS server...
*/
return (-1);
#else
int pid; /* Current process ID */
FILE *fp; /* Certificate file */
char filename[1024], /* Certificate filename */
certificate[33]; /* Certificate string */
const char *root; /* Server root directory */
DEBUG_printf(("cups_local_auth(http=%p) hostaddr=%08x, hostname=\"%s\"\n",
http, ntohl(http->hostaddr.sin_addr.s_addr), http->hostname));
/*
* See if we are accessing localhost...
*/
if (ntohl(http->hostaddr.sin_addr.s_addr) != 0x7f000001 &&
strcasecmp(http->hostname, "localhost") != 0)
{
DEBUG_puts("cups_local_auth: Not a local connection!");
return (-1);
}
/*
* Try opening a certificate file for this PID. If that fails,
* try the root certificate...
*/
if ((root = getenv("CUPS_SERVERROOT")) == NULL)
root = CUPS_SERVERROOT;
pid = getpid();
snprintf(filename, sizeof(filename), "%s/certs/%d", root, pid);
if ((fp = fopen(filename, "r")) == NULL && pid > 0)
{
DEBUG_printf(("cups_local_auth: Unable to open file %s: %s\n",
filename, strerror(errno)));
snprintf(filename, sizeof(filename), "%s/certs/0", root);
fp = fopen(filename, "r");
}
if (fp == NULL)
{
DEBUG_printf(("cups_local_auth: Unable to open file %s: %s\n",
filename, strerror(errno)));
return (-1);
}
/*
* Read the certificate from the file...
*/
fgets(certificate, sizeof(certificate), fp);
fclose(fp);
/*
* Set the authorization string and return...
*/
snprintf(http->authstring, sizeof(http->authstring), "Local %s", certificate);
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
http->authstring));
return (0);
#endif /* WIN32 || __EMX__ */
}
/*
* End of "$Id$".
*/
+34 -2
Ver Arquivo
@@ -41,7 +41,7 @@ RSC=rc.exe
# 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 CPP /nologo /MD /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
@@ -64,7 +64,7 @@ LIB32=link.exe -lib
# 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 ".." /I "../visualc" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /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
@@ -85,6 +85,10 @@ LIB32=link.exe -lib
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\auth.c
# End Source File
# Begin Source File
SOURCE=.\dest.c
# End Source File
# Begin Source File
@@ -93,10 +97,30 @@ SOURCE=.\emit.c
# End Source File
# Begin Source File
SOURCE=.\encode.c
# End Source File
# Begin Source File
SOURCE=.\getputfile.c
# End Source File
# Begin Source File
SOURCE=".\http-addr.c"
# End Source File
# Begin Source File
SOURCE=".\http-support.c"
# End Source File
# Begin Source File
SOURCE=.\http.c
# End Source File
# Begin Source File
SOURCE=".\ipp-support.c"
# End Source File
# Begin Source File
SOURCE=.\ipp.c
# End Source File
# Begin Source File
@@ -137,6 +161,10 @@ SOURCE=.\string.c
# End Source File
# Begin Source File
SOURCE=.\tempfile.c
# End Source File
# Begin Source File
SOURCE=.\usersys.c
# End Source File
# Begin Source File
@@ -173,6 +201,10 @@ SOURCE=.\language.h
# End Source File
# Begin Source File
SOURCE=..\oemlicense\license.h
# End Source File
# Begin Source File
SOURCE=.\md5.h
# End Source File
# Begin Source File
+39 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* API definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -48,7 +48,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0115
# define CUPS_VERSION 1.0120
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 1
# define CUPS_VERSION_PATCH 20
# define CUPS_DATE_ANY -1
@@ -78,7 +81,9 @@ enum /* Not a typedef'd enum so we can OR */
CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */
CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */
CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
CUPS_PRINTER_OPTIONS = 0xfffc /* ~(CLASS | REMOTE | IMPLICIT) */
CUPS_PRINTER_FAX = 0x40000, /* Fax queue */
CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT) */
};
typedef struct /**** Printer Options ****/
@@ -166,6 +171,35 @@ extern void cupsSetServer(const char *server);
extern void cupsSetUser(const char *user);
extern const char *cupsUser(void);
/**** New in CUPS 1.1.20 ****/
extern int cupsDoAuthentication(http_t *http, const char *method,
const char *resource);
extern http_status_t cupsGetFile(http_t *http, const char *resource,
const char *filename);
extern http_status_t cupsGetFd(http_t *http, const char *resource, int fd);
extern http_status_t cupsPutFile(http_t *http, const char *resource,
const char *filename);
extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd);
/**** New in CUPS 1.1.21 ****/
extern const char *cupsGetDefault2(http_t *http);
extern int cupsGetDests2(http_t *http, cups_dest_t **dests);
extern int cupsGetJobs2(http_t *http, cups_job_t **jobs,
const char *dest, int myjobs,
int completed);
extern const char *cupsGetPPD2(http_t *http, const char *printer);
extern int cupsPrintFile2(http_t *http, const char *printer,
const char *filename,
const char *title, int num_options,
cups_option_t *options);
extern int cupsPrintFiles2(http_t *http, const char *printer,
int num_files, const char **files,
const char *title, int num_options,
cups_option_t *options);
extern int cupsSetDests2(http_t *http, int num_dests,
cups_dest_t *dests);
# ifdef __cplusplus
}
# endif /* __cplusplus */
+1 -1
Ver Arquivo
@@ -18,7 +18,7 @@
"Cyan",
"Magenta",
"Yellow",
"Copyright 1993-2002 by Easy Software Products, All Rights Reserved.",
"Copyright 1993-2004 by Easy Software Products, All Rights Reserved.",
"General",
"Printer",
"Image",
+136
Ver Arquivo
@@ -0,0 +1,136 @@
cupsAddDest
cupsAddOption
cupsCancelJob
cupsDoAuthentication
cupsDoFileRequest
cupsEncodeOptions
cupsEncryption
cupsFreeDests
cupsFreeJobs
cupsFreeOptions
cupsGetClasses
cupsGetDefault
cupsGetDest
cupsGetDests
cupsGetFd
cupsGetFile
cupsGetJobs
cupsGetOption
cupsGetPassword
cupsGetPPD
cupsGetPrinters
cupsLangEncoding
cupsLangFlush
cupsLangFree
cupsLangGet
cupsLastError
cupsMarkOptions
cupsParseOptions
cupsPrintFile
cupsPrintFiles
cupsPutFd
cupsPutFile
cupsServer
cupsSetDests
cupsSetEncryption
cupsSetPasswordCB
cupsSetServer
cupsSetUser
cupsTempFd
cupsTempFile
cupsUser
httpCheck
httpClearCookie
httpClose
httpConnect
httpConnectEncrypt
httpDecode64
httpDelete
httpEncode64
httpEncryption
httpFlush
httpGet
httpGetDateString
httpGetDateTime
httpGetHostByName
httpGetLength
httpGets
httpGetSubField
httpHead
httpInitialize
httpMD5
httpMD5Final
httpMD5String
httpOptions
httpPost
httpPrintf
httpPut
httpRead
httpReconnect
httpSeparate
httpSetCookie
httpSetField
httpStatus
httpTrace
httpUpdate
httpWait
httpWrite
_ipp_add_attr
ippAddBoolean
ippAddBooleans
ippAddCollection
ippAddCollections
ippAddDate
ippAddInteger
ippAddIntegers
ippAddRange
ippAddRanges
ippAddResolution
ippAddResolutions
ippAddSeparator
ippAddString
ippAddStrings
ippDateToTime
ippDelete
ippDeleteAttribute
ippErrorString
ippFindAttribute
ippFindNextAttribute
_ipp_free_attr
ippLength
ippNew
ippPort
ippRead
ippReadFile
ippReadIO
ippSetPort
ippTimeToDate
ippWrite
ippWriteFile
ippWriteIO
md5_append
md5_finish
md5_init
ppdClose
ppdCollect
ppdConflicts
ppdEmit
ppdEmitFd
ppdEmitJCL
ppdErrorString
ppdFindAttr
ppdFindChoice
ppdFindMarkedChoice
ppdFindNextAttr
ppdFindOption
ppdIsMarked
ppdLastError
ppdMarkDefaults
ppdMarkOption
ppdOpen
ppdOpenFd
ppdOpenFile
ppdPageLength
ppdPageSize
ppdPageWidth
ppdSetConformance
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Debugging macros for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
+90 -32
Ver Arquivo
@@ -4,7 +4,7 @@
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -30,6 +30,7 @@
* cupsFreeDests() - Free the memory used by the list of destinations.
* cupsGetDest() - Get the named destination from the list.
* cupsGetDests() - Get the list of destinations.
* cupsGetDests2() - Get the list of destinations using a HTTP connection.
* cupsSetDests() - Set the list of destinations.
* cups_get_dests() - Get destinations from a file.
* cups_get_sdests() - Get destinations from a server.
@@ -52,7 +53,7 @@
static int cups_get_dests(const char *filename, int num_dests,
cups_dest_t **dests);
static int cups_get_sdests(ipp_op_t op, int num_dests,
static int cups_get_sdests(http_t *http, ipp_op_t op, int num_dests,
cups_dest_t **dests);
@@ -208,6 +209,33 @@ cupsGetDest(const char *name, /* I - Name of destination */
int /* O - Number of destinations */
cupsGetDests(cups_dest_t **dests) /* O - Destinations */
{
int num_dests; /* Number of destinations */
http_t *http; /* HTTP connection */
/*
* Connect to the CUPS server and get the destination list and options...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
num_dests = cupsGetDests2(http, dests);
if (http)
httpClose(http);
return (num_dests);
}
/*
* 'cupsGetDests2()' - Get the list of destinations.
*/
int /* O - Number of destinations */
cupsGetDests2(http_t *http, /* I - HTTP connection */
cups_dest_t **dests) /* O - Destinations */
{
int i; /* Looping var */
int num_dests; /* Number of destinations */
@@ -221,6 +249,13 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
cups_dest_t *reals; /* Real queues */
/*
* Range check the input...
*/
if (!http || !dests)
return (0);
/*
* Initialize destination array...
*/
@@ -232,8 +267,8 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
* Grab the printers and classes...
*/
num_dests = cups_get_sdests(CUPS_GET_PRINTERS, num_dests, dests);
num_dests = cups_get_sdests(CUPS_GET_CLASSES, num_dests, dests);
num_dests = cups_get_sdests(http, CUPS_GET_PRINTERS, num_dests, dests);
num_dests = cups_get_sdests(http, CUPS_GET_CLASSES, num_dests, dests);
/*
* Make a copy of the "real" queues for a later sanity check...
@@ -259,7 +294,7 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
* Grab the default destination...
*/
if ((defprinter = cupsGetDefault()) != NULL)
if ((defprinter = cupsGetDefault2(http)) != NULL)
{
/*
* Grab printer and instance name...
@@ -362,6 +397,31 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
void
cupsSetDests(int num_dests, /* I - Number of destinations */
cups_dest_t *dests) /* I - Destinations */
{
http_t *http; /* HTTP connection */
/*
* Connect to the CUPS server and save the destination list and options...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
cupsSetDests2(http, num_dests, dests);
if (http)
httpClose(http);
}
/*
* 'cupsSetDests()' - Set the list of destinations.
*/
int /* O - 0 on success, -1 on error */
cupsSetDests2(http_t *http, /* I - HTTP connection */
int num_dests, /* I - Number of destinations */
cups_dest_t *dests) /* I - Destinations */
{
int i, j; /* Looping vars */
int wrote; /* Wrote definition? */
@@ -376,12 +436,19 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
const char *val; /* Value of temporary option */
/*
* Range check the input...
*/
if (!http || !num_dests || !dests)
return (-1);
/*
* Get the server destinations...
*/
num_temps = cups_get_sdests(CUPS_GET_PRINTERS, 0, &temps);
num_temps = cups_get_sdests(CUPS_GET_CLASSES, num_temps, &temps);
num_temps = cups_get_sdests(http, CUPS_GET_PRINTERS, 0, &temps);
num_temps = cups_get_sdests(http, CUPS_GET_CLASSES, num_temps, &temps);
/*
* Figure out which file to write to...
@@ -417,7 +484,7 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
if ((fp = fopen(filename, "w")) == NULL)
{
cupsFreeDests(num_temps, temps);
return;
return (-1);
}
/*
@@ -495,7 +562,9 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
* Close the file and return...
*/
fclose(fp);
fclose(fp);
return (0);
}
@@ -547,9 +616,9 @@ cups_get_dests(const char *filename, /* I - File to read from */
* See what type of line it is...
*/
if (strncasecmp(line, "dest", 4) == 0 && isspace(line[4]))
if (strncasecmp(line, "dest", 4) == 0 && isspace(line[4] & 255))
lineptr = line + 4;
else if (strncasecmp(line, "default", 7) == 0 && isspace(line[7]))
else if (strncasecmp(line, "default", 7) == 0 && isspace(line[7] & 255))
lineptr = line + 7;
else
continue;
@@ -558,7 +627,7 @@ cups_get_dests(const char *filename, /* I - File to read from */
* Skip leading whitespace...
*/
while (isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
if (!*lineptr)
@@ -570,7 +639,7 @@ cups_get_dests(const char *filename, /* I - File to read from */
* Search for an instance...
*/
while (!isspace(*lineptr) && *lineptr && *lineptr != '/')
while (!isspace(*lineptr & 255) && *lineptr && *lineptr != '/')
lineptr ++;
if (!*lineptr)
@@ -589,7 +658,7 @@ cups_get_dests(const char *filename, /* I - File to read from */
* Search for an instance...
*/
while (!isspace(*lineptr) && *lineptr)
while (!isspace(*lineptr & 255) && *lineptr)
lineptr ++;
}
else
@@ -656,32 +725,25 @@ cups_get_dests(const char *filename, /* I - File to read from */
*/
static int /* O - Number of destinations */
cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
cups_get_sdests(http_t *http, /* I - HTTP connection */
ipp_op_t op, /* I - get-printers or get-classes */
int num_dests, /* I - Number of destinations */
cups_dest_t **dests) /* IO - Destinations */
{
cups_dest_t *dest; /* Current destination */
http_t *http; /* HTTP connection */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
const char *name; /* printer-name attribute */
char job_sheets[1024]; /* job-sheets option */
static const char *pattrs[] = /* Attributes we're interested in */
static const char * const pattrs[] = /* Attributes we're interested in */
{
"printer-name",
"job-sheets-default"
};
/*
* Connect to the CUPS server...
*/
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
return (num_dests);
/*
* Build a CUPS_GET_PRINTERS or CUPS_GET_CLASSES request, which require
* the following attributes:
@@ -703,6 +765,8 @@ cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
cupsLangFree(language);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
NULL, pattrs);
@@ -779,12 +843,6 @@ cups_get_sdests(ipp_op_t op, /* I - get-printers or get-classes */
ippDelete(response);
}
/*
* Close the server connection...
*/
httpClose(http);
/*
* Return the count...
*/
+225 -35
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD code emission routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -196,26 +196,85 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
* 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 ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
{
/*
* Variable size; write out standard size options (this should
* eventually be changed to use the parameter positions defined
* in the PPD file...)
* Variable size; write out standard size options, using the
* parameter positions defined in the PPD file...
*/
ppd_attr_t *attr; /* PPD attribute */
int pos, /* Position of custom value */
values[5], /* Values for custom command */
orientation; /* Orientation to use */
fputs("%%BeginFeature: *CustomPageSize True\n", fp);
size = ppdPageSize(ppd, "Custom");
fprintf(fp, "%.0f %.0f 0 0 0\n", size->width, size->length);
memset(values, 0, sizeof(values));
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 0;
}
else
pos = 0;
values[pos] = (int)size->width;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 1;
}
else
pos = 1;
values[pos] = (int)size->length;
if (size->width < size->length)
orientation = 1;
else
orientation = 0;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize",
"Orientation")) != NULL)
{
int min_orient, max_orient; /* Minimum and maximum orientations */
if (sscanf(attr->value, "%d%*s%d%d", &pos, &min_orient,
&max_orient) != 3)
pos = 4;
else
{
pos --;
if (pos < 0 || pos > 4)
pos = 4;
if (orientation > max_orient)
orientation = max_orient;
else if (orientation < min_orient)
orientation = min_orient;
}
}
else
pos = 4;
values[pos] = orientation;
fprintf(fp, "%d %d %d %d %d\n", values[0], values[1],
values[2], values[3], values[4]);
if (choices[i]->code == NULL)
{
@@ -228,6 +287,13 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
fputs(ppd_custom_code, fp);
}
}
else if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice) < 0)
{
free(choices);
return (-1);
}
if (choices[i]->code != NULL && choices[i]->code[0] != '\0')
{
@@ -274,7 +340,8 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
ppd_section_t section) /* I - Section to write */
{
int i, /* Looping var */
count; /* Number of choices */
count, /* Number of choices */
custom_size; /* Non-zero if this option is a custom size */
ppd_choice_t **choices; /* Choices */
ppd_size_t *size; /* Custom page size */
char buf[1024]; /* Output buffer for feature */
@@ -311,9 +378,22 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice);
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
{
custom_size = 1;
strcpy(buf, "%%BeginFeature: *CustomPageSize True\n");
}
else
{
custom_size = 0;
snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice);
}
if (write(fd, buf, strlen(buf)) < 1)
{
@@ -321,19 +401,81 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
return (-1);
}
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
if (custom_size)
{
/*
* Variable size; write out standard size options (this should
* eventually be changed to use the parameter positions defined
* in the PPD file...)
* Variable size; write out standard size options, using the
* parameter positions defined in the PPD file...
*/
ppd_attr_t *attr; /* PPD attribute */
int pos, /* Position of custom value */
values[5], /* Values for custom command */
orientation; /* Orientation to use */
size = ppdPageSize(ppd, "Custom");
snprintf(buf, sizeof(buf), "%.0f %.0f 0 0 0\n", size->width,
size->length);
memset(values, 0, sizeof(values));
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 0;
}
else
pos = 0;
values[pos] = (int)size->width;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 1;
}
else
pos = 1;
values[pos] = (int)size->length;
if (size->width < size->length)
orientation = 1;
else
orientation = 0;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize",
"Orientation")) != NULL)
{
int min_orient, max_orient; /* Minimum and maximum orientations */
if (sscanf(attr->value, "%d%*s%d%d", &pos, &min_orient,
&max_orient) != 3)
pos = 4;
else
{
pos --;
if (pos < 0 || pos > 4)
pos = 4;
if (orientation > max_orient)
orientation = max_orient;
else if (orientation < min_orient)
orientation = min_orient;
}
}
else
pos = 4;
values[pos] = orientation;
snprintf(buf, sizeof(buf), "%d %d %d %d %d\n", values[0], values[1],
values[2], values[3], values[4]);
if (write(fd, buf, strlen(buf)) < 1)
{
@@ -400,7 +542,8 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
const char *user, /* I - Username */
const char *title) /* I - Title */
{
const char *ptr; /* Pointer into JCL string */
char *ptr; /* Pointer into JCL string */
char temp[81]; /* Local title string */
/*
@@ -419,9 +562,13 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
/*
* This printer uses HP PJL commands for output; filter the output
* so that we only have a single "@PJL JOB" command in the header...
*
* To avoid bugs in the PJL implementation of certain vendors' products
* (Xerox in particular), we add a dummy "@PJL" command at the beginning
* of the PJL commands to initialize PJL processing.
*/
fputs("\033%-12345X", fp);
fputs("\033%-12345X@PJL\n", fp);
for (ptr = ppd->jcl_begin + 9; *ptr;)
if (strncmp(ptr, "@PJL JOB", 8) == 0)
{
@@ -460,18 +607,29 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
if ((ptr = strrchr(title, '/')) != NULL)
title = ptr + 1;
/*
* Replace double quotes with single quotes so that the title
* does not cause a PJL syntax error.
*/
strlcpy(temp, title, sizeof(temp));
for (ptr = temp; *ptr; ptr ++)
if (*ptr == '\"')
*ptr = '\'';
/*
* Send PJL JOB command before we enter PostScript mode...
*/
fprintf(fp, "@PJL JOB NAME = \"%s\" DISPLAY = \"%d %s %s\"\n", title,
job_id, user, title);
fprintf(fp, "@PJL JOB NAME = \"%s\" DISPLAY = \"%d %s %s\"\n", temp,
job_id, user, temp);
}
else
fputs(ppd->jcl_begin, stdout);
fputs(ppd->jcl_begin, fp);
ppdEmit(ppd, stdout, PPD_ORDER_JCL);
fputs(ppd->jcl_ps, stdout);
ppdEmit(ppd, fp, PPD_ORDER_JCL);
fputs(ppd->jcl_ps, fp);
return (0);
}
@@ -485,8 +643,10 @@ static void
ppd_handle_media(ppd_file_t *ppd)
{
ppd_choice_t *manual_feed, /* ManualFeed choice, if any */
*input_slot; /* InputSlot choice, if any */
*input_slot, /* InputSlot choice, if any */
*page; /* PageSize/PageRegion */
ppd_size_t *size; /* Current media size */
ppd_attr_t *rpr; /* RequiresPageRegion value */
/*
@@ -502,6 +662,14 @@ ppd_handle_media(ppd_file_t *ppd)
manual_feed = ppdFindMarkedChoice(ppd, "ManualFeed");
input_slot = ppdFindMarkedChoice(ppd, "InputSlot");
if (input_slot != NULL)
rpr = ppdFindAttr(ppd, "RequiresPageRegion", input_slot->choice);
else
rpr = NULL;
if (!rpr)
rpr = ppdFindAttr(ppd, "RequiresPageRegion", "All");
if (strcasecmp(size->name, "Custom") == 0 ||
(manual_feed == NULL && input_slot == NULL) ||
(manual_feed != NULL && strcasecmp(manual_feed->choice, "False") == 0) ||
@@ -522,6 +690,28 @@ ppd_handle_media(ppd_file_t *ppd)
*/
ppdMarkOption(ppd, "PageRegion", size->name);
/*
* RequiresPageRegion does not apply to manual feed so we need to
* check that we are not doing manual feed before unmarking PageRegion.
*/
if (!(manual_feed && !strcasecmp(manual_feed->choice, "True")) &&
((rpr && rpr->value && !strcmp(rpr->value, "False")) ||
(!rpr && !ppd->num_filters)))
{
/*
* Either the PPD file specifies no PageRegion code or the PPD file
* not for a CUPS raster driver and thus defaults to no PageRegion
* code... Unmark the PageRegion choice so that we don't output the
* code...
*/
page = ppdFindMarkedChoice(ppd, "PageRegion");
if (page)
page->marked = 0;
}
}
}
+17 -31
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option encoding routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -49,7 +49,7 @@ typedef struct
ipp_tag_t value_tag;
} ipp_option_t;
static ipp_option_t ipp_options[] =
static const ipp_option_t ipp_options[] =
{
{ "blackplot", IPP_TAG_BOOLEAN },
{ "brightness", IPP_TAG_INTEGER },
@@ -59,8 +59,13 @@ static ipp_option_t ipp_options[] =
{ "fitplot", IPP_TAG_BOOLEAN },
{ "gamma", IPP_TAG_INTEGER },
{ "hue", IPP_TAG_INTEGER },
{ "job-k-limit", IPP_TAG_INTEGER },
{ "job-page-limit", IPP_TAG_INTEGER },
{ "job-priority", IPP_TAG_INTEGER },
{ "job-quota-period", IPP_TAG_INTEGER },
{ "landscape", IPP_TAG_BOOLEAN },
{ "media", IPP_TAG_KEYWORD },
{ "mirror", IPP_TAG_BOOLEAN },
{ "natural-scaling", IPP_TAG_INTEGER },
{ "number-up", IPP_TAG_INTEGER },
{ "orientation-requested", IPP_TAG_ENUM },
@@ -76,6 +81,7 @@ static ipp_option_t ipp_options[] =
{ "print-quality", IPP_TAG_ENUM },
{ "saturation", IPP_TAG_INTEGER },
{ "scaling", IPP_TAG_INTEGER },
{ "sides", IPP_TAG_KEYWORD },
{ "wrap", IPP_TAG_BOOLEAN }
};
@@ -195,7 +201,8 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
attr->group_tag = IPP_TAG_JOB;
if (strncasecmp(options[i].name, "no", 2) == 0)
if (strcasecmp(options[i].value, "true") == 0 ||
strcasecmp(options[i].value, "false") == 0)
attr->value_tag = IPP_TAG_BOOLEAN;
else
attr->value_tag = IPP_TAG_NAME;
@@ -253,7 +260,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
* Scan the value string for values...
*/
for (j = 0; *val != '\0' || j == 0; val = sep, j ++)
for (j = 0; j < count; val = sep, j ++)
{
/*
* Find the end of this value and mark it if needed...
@@ -283,28 +290,9 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
break;
case IPP_TAG_BOOLEAN :
if (!*val)
{
/*
* Add a boolean option without a value, so the option is
* passed in as "name" or "noname" for true/false...
*/
if (strncasecmp(attr->name, "no", 2) == 0)
{
DEBUG_puts("cupsEncodeOptions: Added boolean false value...");
strcpy(attr->name, attr->name + 2);
attr->values[0].boolean = 0;
}
else
{
DEBUG_puts("cupsEncodeOptions: Added boolean true value...");
attr->values[0].boolean = 1;
}
}
else if (strcasecmp(val, "true") == 0 ||
strcasecmp(val, "on") == 0 ||
strcasecmp(val, "yes") == 0)
if (!strcasecmp(val, "true") ||
!strcasecmp(val, "on") ||
!strcasecmp(val, "yes"))
{
/*
* Boolean value - true...
@@ -314,9 +302,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
DEBUG_puts("cupsEncodeOptions: Added boolean true value...");
}
else if (strcasecmp(val, "false") == 0 ||
strcasecmp(val, "off") == 0 ||
strcasecmp(val, "no") == 0)
else
{
/*
* Boolean value - false...
+419
Ver Arquivo
@@ -0,0 +1,419 @@
/*
* "$Id$"
*
* Get/put file functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* cupsGetFd() - Get a file from the server.
* cupsGetFile() - Get a file from the server.
* cupsPutFd() - Put a file on the server.
* cupsPutFile() - Put a file on the server.
*/
/*
* 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 <fcntl.h>
#include <sys/stat.h>
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
#else
# include <unistd.h>
#endif /* WIN32 || __EMX__ */
/*
* 'cupsGetFd()' - Get a file from the server.
*/
http_status_t /* O - Status */
cupsGetFd(http_t *http, /* I - HTTP connection to server */
const char *resource, /* I - Resource name */
int fd) /* I - File descriptor */
{
int bytes; /* Number of bytes read */
char buffer[8192]; /* Buffer for file */
http_status_t status; /* HTTP status from server */
/*
* Range check input...
*/
DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)\n", http,
resource, fd));
if (!http || !resource || fd < 0)
{
if (http)
http->error = EINVAL;
return (HTTP_ERROR);
}
/*
* Then send GET requests to the HTTP server...
*/
do
{
httpClearFields(http);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
if (httpGet(http, resource))
{
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
else
{
status = HTTP_UNAUTHORIZED;
continue;
}
}
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
if (status == HTTP_UNAUTHORIZED)
{
/*
* Flush any error message...
*/
httpFlush(http);
/*
* See if we can do authentication...
*/
if (cupsDoAuthentication(http, "GET", resource))
break;
httpReconnect(http);
continue;
}
#ifdef HAVE_SSL
else if (status == HTTP_UPGRADE_REQUIRED)
{
/* Flush any error message... */
httpFlush(http);
/* Reconnect... */
httpReconnect(http);
/* Upgrade with encryption... */
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
/* Try again, this time with encryption enabled... */
continue;
}
#endif /* HAVE_SSL */
}
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
/*
* See if we actually got the file or an error...
*/
if (status == HTTP_OK)
{
/*
* Yes, copy the file...
*/
while ((bytes = httpRead(http, buffer, sizeof(buffer))) > 0)
write(fd, buffer, bytes);
}
else
httpFlush(http);
/*
* Return the request status...
*/
return (status);
}
/*
* 'cupsGetFile()' - Get a file from the server.
*/
http_status_t /* O - Status */
cupsGetFile(http_t *http, /* I - HTTP connection to server */
const char *resource, /* I - Resource name */
const char *filename) /* I - Filename */
{
int fd; /* File descriptor */
http_status_t status; /* Status */
/*
* Range check input...
*/
if (!http || !resource || !filename)
{
if (http)
http->error = EINVAL;
return (HTTP_ERROR);
}
/*
* Create the file...
*/
if ((fd = open(filename, O_WRONLY | O_EXCL | O_TRUNC)) < 0)
{
/*
* Couldn't open the file!
*/
http->error = errno;
return (HTTP_ERROR);
}
/*
* Get the file...
*/
status = cupsGetFd(http, resource, fd);
/*
* If the file couldn't be gotten, then remove the file...
*/
close(fd);
if (status != HTTP_OK)
unlink(filename);
/*
* Return the HTTP status code...
*/
return (status);
}
/*
* 'cupsPutFd()' - Put a file on the server.
*/
http_status_t /* O - Status */
cupsPutFd(http_t *http, /* I - HTTP connection to server */
const char *resource, /* I - Resource name */
int fd) /* I - File descriptor */
{
int bytes; /* Number of bytes read */
char buffer[8192]; /* Buffer for file */
http_status_t status; /* HTTP status from server */
/*
* Range check input...
*/
DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)\n", http,
resource, fd));
if (!http || !resource || fd < 0)
{
if (http)
http->error = EINVAL;
return (HTTP_ERROR);
}
/*
* Then send PUT requests to the HTTP server...
*/
do
{
DEBUG_printf(("cupsPutFd: starting attempt, authstring=\"%s\"...\n",
http->authstring));
httpClearFields(http);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetField(http, HTTP_FIELD_TRANSFER_ENCODING, "chunked");
if (httpPut(http, resource))
{
if (httpReconnect(http))
{
status = HTTP_ERROR;
break;
}
else
{
status = HTTP_UNAUTHORIZED;
continue;
}
}
/*
* Copy the file...
*/
lseek(fd, 0, SEEK_SET);
status = HTTP_CONTINUE;
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
if (httpCheck(http))
{
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
break;
}
else
httpWrite(http, buffer, bytes);
if (status == HTTP_CONTINUE)
{
httpWrite(http, buffer, 0);
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
}
DEBUG_printf(("cupsPutFd: status=%d\n", status));
if (status == HTTP_UNAUTHORIZED)
{
/*
* Flush any error message...
*/
httpFlush(http);
/*
* See if we can do authentication...
*/
if (cupsDoAuthentication(http, "PUT", resource))
break;
httpReconnect(http);
continue;
}
#ifdef HAVE_SSL
else if (status == HTTP_UPGRADE_REQUIRED)
{
/* Flush any error message... */
httpFlush(http);
/* Reconnect... */
httpReconnect(http);
/* Upgrade with encryption... */
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
/* Try again, this time with encryption enabled... */
continue;
}
#endif /* HAVE_SSL */
}
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
/*
* See if we actually put the file or an error...
*/
if (status != HTTP_CREATED)
httpFlush(http);
return (status);
}
/*
* 'cupsPutFile()' - Put a file on the server.
*/
http_status_t /* O - Status */
cupsPutFile(http_t *http, /* I - HTTP connection to server */
const char *resource, /* I - Resource name */
const char *filename) /* I - Filename */
{
int fd; /* File descriptor */
http_status_t status; /* Status */
/*
* Range check input...
*/
if (!http || !resource || !filename)
{
if (http)
http->error = EINVAL;
return (HTTP_ERROR);
}
/*
* Open the local file...
*/
if ((fd = open(filename, O_RDONLY)) < 0)
{
/*
* Couldn't open the file!
*/
http->error = errno;
return (HTTP_ERROR);
}
/*
* Put the file...
*/
status = cupsPutFd(http, resource, fd);
close(fd);
return (status);
}
/*
* End of "$Id$".
*/
+122
Ver Arquivo
@@ -0,0 +1,122 @@
/*
* "$Id$"
*
* HTTP host/address routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* httpGetHostByName() - Lookup a hostname or IP address, and return
* address records for the specified name.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "string.h"
#include "http.h"
/*
* 'httpGetHostByName()' - Lookup a hostname or IP address, and return
* address records for the specified name.
*/
struct hostent * /* O - Host entry */
httpGetHostByName(const char *name) /* I - Hostname or IP address */
{
const char *nameptr; /* Pointer into name */
unsigned ip[4]; /* IP address components */
static unsigned packed_ip; /* Packed IPv4 address */
static char *packed_ptr[2]; /* Pointer to packed address */
static struct hostent host_ip; /* Host entry for IP address */
#if defined(__APPLE__)
/* OS X hack to avoid it's ocassional long delay in lookupd */
static const char sLoopback[] = "127.0.0.1";
if (strcmp(name, "localhost") == 0)
name = sLoopback;
#endif /* __APPLE__ */
/*
* This function is needed because some operating systems have a
* buggy implementation of gethostbyname() that does not support
* IP addresses. If the first character of the name string is a
* number, then sscanf() is used to extract the IP components.
* We then pack the components into an IPv4 address manually,
* since the inet_aton() function is deprecated. We use the
* htonl() macro to get the right byte order for the address.
*/
for (nameptr = name; isdigit(*nameptr & 255) || *nameptr == '.'; nameptr ++);
if (!*nameptr)
{
/*
* We have an IP address; break it up and provide the host entry
* to the caller. Currently only supports IPv4 addresses, although
* it should be trivial to support IPv6 in CUPS 1.2.
*/
if (sscanf(name, "%u.%u.%u.%u", ip, ip + 1, ip + 2, ip + 3) != 4)
return (NULL); /* Must have 4 numbers */
if (ip[0] > 255 || ip[1] > 255 || ip[2] > 255 || ip[3] > 255)
return (NULL); /* Invalid byte ranges! */
packed_ip = htonl(((((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8) | ip[3]));
/*
* Fill in the host entry and return it...
*/
host_ip.h_name = (char *)name;
host_ip.h_aliases = NULL;
host_ip.h_addrtype = AF_INET;
host_ip.h_length = 4;
host_ip.h_addr_list = packed_ptr;
packed_ptr[0] = (char *)(&packed_ip);
packed_ptr[1] = NULL;
return (&host_ip);
}
else
{
/*
* Use the gethostbyname() function to get the IP address for
* the name...
*/
return (gethostbyname(name));
}
}
/*
* End of "$Id$".
*/
+102
Ver Arquivo
@@ -0,0 +1,102 @@
/*
* "$Id$"
*
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*/
#ifndef _CUPS_HTTP_PRIVATE_H_
# define _CUPS_HTTP_PRIVATE_H_
/*
* Include necessary headers...
*/
# include "config.h"
# ifdef __sun
/*
* Define FD_SETSIZE to CUPS_MAX_FDS on Solaris to get the correct version of
* select() for large numbers of file descriptors.
*/
# define FD_SETSIZE CUPS_MAX_FDS
# include <sys/select.h>
# endif /* __sun */
# include "http.h"
# if defined HAVE_LIBSSL
/*
* The OpenSSL library provides its own SSL/TLS context structure for its
* IO and protocol management...
*/
# include <openssl/err.h>
# include <openssl/rand.h>
# include <openssl/ssl.h>
typedef SSL http_tls_t;
# elif defined HAVE_GNUTLS
/*
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
*/
# include <gnutls/gnutls.h>
typedef struct
{
gnutls_session session; /* GNU TLS session object */
void *credentials; /* GNU TLS credentials object */
} http_tls_t;
# elif defined(HAVE_CDSASSL)
/*
* Darwin's Security framework provides its own SSL/TLS context structure
* for its IO and protocol management...
*/
# include <Security/SecureTransport.h>
typedef SSLConnectionRef http_tls_t;
# endif /* HAVE_LIBSSL */
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
# ifndef HAVE_HSTRERROR
extern const char *cups_hstrerror(int error);
# define hstrerror cups_hstrerror
# elif defined(_AIX) || defined(__osf__)
/*
* AIX and Tru64 UNIX don't provide a prototype but do provide the function...
*/
extern const char *hstrerror(int error);
# endif /* !HAVE_HSTRERROR */
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
/*
* End of "$Id$".
*/
+378
Ver Arquivo
@@ -0,0 +1,378 @@
/*
* "$Id$"
*
* HTTP support routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* httpSeparate() - Separate a Universal Resource Identifier into its
* components.
* httpSeparate2() - Separate a Universal Resource Identifier into its
* components.
* httpStatus() - Return a short string describing a HTTP status code.
* cups_hstrerror() - hstrerror() emulation function for Solaris and others...
* http_copy_decode() - Copy and decode a URI.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include "string.h"
#include "http.h"
#include "ipp.h"
/*
* Local functions...
*/
static const char *http_copy_decode(char *dst, const char *src,
int dstsize, const char *term);
/*
* 'httpSeparate()' - Separate a Universal Resource Identifier into its
* components.
*/
void
httpSeparate(const char *uri, /* I - Universal Resource Identifier */
char *method, /* O - Method [32] (http, https, etc.) */
char *username, /* O - Username [1024] */
char *host, /* O - Hostname [1024] */
int *port, /* O - Port number to use */
char *resource) /* O - Resource/filename [1024] */
{
httpSeparate2(uri, method, 32, username, HTTP_MAX_URI, host, HTTP_MAX_URI,
port, resource, HTTP_MAX_URI);
}
/*
* 'httpSeparate2()' - Separate a Universal Resource Identifier into its
* components.
*/
void
httpSeparate2(const char *uri, /* I - Universal Resource Identifier */
char *method, /* O - Method (http, https, etc.) */
int methodlen, /* I - Size of method buffer */
char *username, /* O - Username */
int usernamelen, /* I - Size of username buffer */
char *host, /* O - Hostname */
int hostlen, /* I - Size of hostname buffer */
int *port, /* O - Port number to use */
char *resource, /* O - Resource/filename */
int resourcelen) /* I - Size of resource buffer */
{
char *ptr; /* Pointer into string... */
const char *atsign, /* @ sign */
*slash; /* Separator */
/*
* Range check input...
*/
if (uri == NULL || method == NULL || username == NULL || host == NULL ||
port == NULL || resource == NULL)
return;
/*
* Grab the method portion of the URI...
*/
if (strncmp(uri, "//", 2) == 0)
{
/*
* Workaround for HP IPP client bug...
*/
strlcpy(method, "ipp", methodlen);
}
else
{
/*
* Standard URI with method...
*/
uri = http_copy_decode(host, uri, hostlen, ":");
if (*uri == ':')
uri ++;
/*
* If the method contains a period or slash, then it's probably
* hostname/filename...
*/
if (strchr(host, '.') != NULL || strchr(host, '/') != NULL || *uri == '\0')
{
if ((ptr = strchr(host, '/')) != NULL)
{
strlcpy(resource, ptr, resourcelen);
*ptr = '\0';
}
else
resource[0] = '\0';
if (isdigit(*uri & 255))
{
/*
* OK, we have "hostname:port[/resource]"...
*/
*port = strtol(uri, (char **)&uri, 10);
if (*uri == '/')
strlcpy(resource, uri, resourcelen);
}
else
*port = 631;
strlcpy(method, "http", methodlen);
username[0] = '\0';
return;
}
else
strlcpy(method, host, methodlen);
}
/*
* If the method starts with less than 2 slashes then it is a local resource...
*/
if (strncmp(uri, "//", 2) != 0)
{
strlcpy(resource, uri, resourcelen);
username[0] = '\0';
host[0] = '\0';
*port = 0;
return;
}
/*
* Grab the username, if any...
*/
uri += 2;
if ((slash = strchr(uri, '/')) == NULL)
slash = uri + strlen(uri);
if ((atsign = strchr(uri, '@')) != NULL && atsign < slash)
{
/*
* Got a username:password combo...
*/
uri = http_copy_decode(username, uri, usernamelen, "@") + 1;
}
else
username[0] = '\0';
/*
* Grab the hostname...
*/
uri = http_copy_decode(host, uri, hostlen, ":/");
if (*uri != ':')
{
if (strcasecmp(method, "http") == 0)
*port = 80;
else if (strcasecmp(method, "https") == 0)
*port = 443;
else if (strcasecmp(method, "ipp") == 0)
*port = 631;
else if (strcasecmp(method, "lpd") == 0)
*port = 515;
else if (strcasecmp(method, "socket") == 0) /* Not registered yet... */
*port = 9100;
else
*port = 0;
}
else
{
/*
* Parse port number...
*/
*port = strtol(uri + 1, (char **)&uri, 10);
}
if (*uri == '\0')
{
/*
* Hostname but no port or path...
*/
resource[0] = '/';
resource[1] = '\0';
return;
}
/*
* The remaining portion is the resource string...
*/
http_copy_decode(resource, uri, resourcelen, "");
}
/*
* 'httpStatus()' - Return a short string describing a HTTP status code.
*/
const char * /* O - String or NULL */
httpStatus(http_status_t status) /* I - HTTP status code */
{
switch (status)
{
case HTTP_CONTINUE :
return ("Continue");
case HTTP_SWITCHING_PROTOCOLS :
return ("Switching Protocols");
case HTTP_OK :
return ("OK");
case HTTP_CREATED :
return ("Created");
case HTTP_ACCEPTED :
return ("Accepted");
case HTTP_NO_CONTENT :
return ("No Content");
case HTTP_NOT_MODIFIED :
return ("Not Modified");
case HTTP_BAD_REQUEST :
return ("Bad Request");
case HTTP_UNAUTHORIZED :
return ("Unauthorized");
case HTTP_FORBIDDEN :
return ("Forbidden");
case HTTP_NOT_FOUND :
return ("Not Found");
case HTTP_REQUEST_TOO_LARGE :
return ("Request Entity Too Large");
case HTTP_URI_TOO_LONG :
return ("URI Too Long");
case HTTP_UPGRADE_REQUIRED :
return ("Upgrade Required");
case HTTP_NOT_IMPLEMENTED :
return ("Not Implemented");
case HTTP_NOT_SUPPORTED :
return ("Not Supported");
default :
return ("Unknown");
}
}
#ifndef HAVE_HSTRERROR
/*
* 'cups_hstrerror()' - hstrerror() emulation function for Solaris and others...
*/
const char * /* O - Error string */
cups_hstrerror(int error) /* I - Error number */
{
static const char * const errors[] = /* Error strings */
{
"OK",
"Host not found.",
"Try again.",
"Unrecoverable lookup error.",
"No data associated with name."
};
if (error < 0 || error > 4)
return ("Unknown hostname lookup error.");
else
return (errors[error]);
}
#endif /* !HAVE_HSTRERROR */
/*
* 'http_copy_decode()' - Copy and decode a URI.
*/
static const char * /* O - New source pointer */
http_copy_decode(char *dst, /* O - Destination buffer */
const char *src, /* I - Source pointer */
int dstsize, /* I - Destination size */
const char *term) /* I - Terminating characters */
{
char *ptr, /* Pointer into buffer */
*end; /* End of buffer */
int quoted; /* Quoted character */
/*
* Copy the src to the destination until we hit a terminating character
* or the end of the string.
*/
for (ptr = dst, end = dst + dstsize - 1; *src && !strchr(term, *src); src ++)
if (ptr < end)
{
if (*src == '%' && isxdigit(src[1] & 255) && isxdigit(src[2] & 255))
{
/*
* Grab a hex-encoded character...
*/
src ++;
if (isalpha(*src))
quoted = (tolower(*src) - 'a' + 10) << 4;
else
quoted = (*src - '0') << 4;
src ++;
if (isalpha(*src))
quoted |= tolower(*src) - 'a' + 10;
else
quoted |= *src - '0';
*ptr++ = quoted;
}
else
*ptr++ = *src;
}
*ptr = '\0';
return (src);
}
/*
* End of "$Id$".
*/
+818 -538
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+29 -3
Ver Arquivo
@@ -4,7 +4,7 @@
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products, all rights reserved.
* Copyright 1997-2004 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
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -281,6 +281,16 @@ typedef struct
int nonce_count; /* Nonce count */
void *tls; /* TLS state information */
http_encryption_t encryption; /* Encryption requirements */
/**** New in CUPS 1.1.19 ****/
fd_set *input_set; /* select() set for httpWait() */
http_status_t expect; /* Expect: header */
char *cookie; /* Cookie value(s) */
/**** New in CUPS 1.1.20 ****/
char authstring[HTTP_MAX_VALUE],
/* Current Authentication value */
userpass[HTTP_MAX_VALUE];
/* Username:password string */
int digest_tries; /* Number of tries for digest auth */
} http_t;
@@ -338,6 +348,22 @@ extern char *httpMD5Final(const char *, const char *, const char *,
char [33]);
extern char *httpMD5String(const md5_byte_t *, char [33]);
/**** New in CUPS 1.1.19 ****/
extern void httpClearCookie(http_t *http);
#define httpGetCookie(http) ((http)->cookie)
extern void httpSetCookie(http_t *http, const char *cookie);
extern int httpWait(http_t *http, int msec);
/**** New in CUPS 1.1.21 ****/
extern char *httpDecode64_2(char *out, int *outlen, const char *in);
extern char *httpEncode64_2(char *out, int outlen, const char *in,
int inlen);
extern void httpSeparate2(const char *uri,
char *method, int methodlen,
char *username, int usernamelen,
char *host, int hostlen, int *port,
char *resource, int resourcelen);
/*
* C++ magic...
+175
Ver Arquivo
@@ -0,0 +1,175 @@
/*
* "$Id$"
*
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
*
* Copyright 1997-2004 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-3142 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* ippErrorString() - Return a textual message for the given error
* message.
* ippPort() - Return the default IPP port number.
* ippSetPort() - Set the default port number.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include "string.h"
#include "language.h"
#include "ipp.h"
#include "debug.h"
#include <ctype.h>
/*
* Local globals...
*/
static int ipp_port = 0;
/*
* 'ippErrorString()' - Return a textual message for the given error message.
*/
const char * /* O - Text string */
ippErrorString(ipp_status_t error) /* I - Error status */
{
static char unknown[255]; /* Unknown error statuses */
static const char * const status_oks[] =
{ /* "OK" status codes */
"successful-ok",
"successful-ok-ignored-or-substituted-attributes",
"successful-ok-conflicting-attributes",
"successful-ok-ignored-subscriptions",
"successful-ok-ignored-notifications",
"successful-ok-too-many-events",
"successful-ok-but-cancel-subscription"
},
* const status_400s[] = /* Client errors */
{
"client-error-bad-request",
"client-error-forbidden",
"client-error-not-authenticated",
"client-error-not-authorized",
"client-error-not-possible",
"client-error-timeout",
"client-error-not-found",
"client-error-gone",
"client-error-request-entity-too-large",
"client-error-request-value-too-long",
"client-error-document-format-not-supported",
"client-error-attributes-or-values-not-supported",
"client-error-uri-scheme-not-supported",
"client-error-charset-not-supported",
"client-error-conflicting-attributes",
"client-error-compression-not-supported",
"client-error-compression-error",
"client-error-document-format-error",
"client-error-document-access-error",
"client-error-attributes-not-settable",
"client-error-ignored-all-subscriptions",
"client-error-too-many-subscriptions",
"client-error-ignored-all-notifications",
"client-error-print-support-file-not-found"
},
* const status_500s[] = /* Server errors */
{
"server-error-internal-error",
"server-error-operation-not-supported",
"server-error-service-unavailable",
"server-error-version-not-supported",
"server-error-device-error",
"server-error-temporary-error",
"server-error-not-accepting-jobs",
"server-error-busy",
"server-error-job-canceled",
"server-error-multiple-document-jobs-not-supported",
"server-error-printer-is-deactivated"
};
/*
* See if the error code is a known value...
*/
if (error >= IPP_OK && error <= IPP_OK_BUT_CANCEL_SUBSCRIPTION)
return (status_oks[error]);
else if (error == IPP_REDIRECTION_OTHER_SITE)
return ("redirection-other-site");
else if (error >= IPP_BAD_REQUEST && error <= IPP_PRINT_SUPPORT_FILE_NOT_FOUND)
return (status_400s[error - IPP_BAD_REQUEST]);
else if (error >= IPP_INTERNAL_ERROR && error <= IPP_PRINTER_IS_DEACTIVATED)
return (status_500s[error - IPP_INTERNAL_ERROR]);
/*
* No, build an "unknown-xxxx" error string...
*/
sprintf(unknown, "unknown-%04x", error);
return (unknown);
}
/*
* 'ippPort()' - Return the default IPP port number.
*/
int /* O - Port number */
ippPort(void)
{
const char *server_port; /* SERVER_PORT environment variable */
struct servent *port; /* Port number info */
if (ipp_port)
return (ipp_port);
else if ((server_port = getenv("IPP_PORT")) != NULL)
return (ipp_port = atoi(server_port));
else if ((port = getservbyname("ipp", NULL)) == NULL)
return (ipp_port = IPP_PORT);
else
return (ipp_port = ntohs(port->s_port));
}
/*
* 'ippSetPort()' - Set the default port number.
*/
void
ippSetPort(int p) /* I - Port number to use */
{
ipp_port = p;
}
/*
* End of "$Id$".
*/
+1032 -538
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+42 -9
Ver Arquivo
@@ -4,7 +4,7 @@
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
* Copyright 1997-2002 by Easy Software Products.
* Copyright 1997-2004 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -16,9 +16,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636-3142 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -51,9 +51,11 @@ extern "C" {
# define IPP_VERSION "\001\001"
/*
* 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!
* IPP registered port number...
*
* Note: Applications should never use IPP_PORT, but instead use the
* ippPort() function to allow overrides via the IPP_PORT environment
* variable and services file if needed!
*/
# define IPP_PORT 631
@@ -305,6 +307,10 @@ typedef enum /**** IPP status codes... ****/
typedef unsigned char ipp_uchar_t;/**** Unsigned 8-bit integer/character ****/
/**** New in CUPS 1.1.19 ****/
typedef int (*ipp_iocb_t)(void *, ipp_uchar_t *, int);
/**** IPP IO Callback Function ****/
typedef union /**** Request Header ****/
{
struct /* Any Header */
@@ -327,8 +333,18 @@ typedef union /**** Request Header ****/
ipp_status_t status_code; /* Status code */
int request_id; /* Request ID */
} status;
/**** New in CUPS 1.1.19 ****/
struct /* Event Header */
{
ipp_uchar_t version[2]; /* Protocol version number */
int status_code; /* Status code */
int request_id; /* Request ID */
} event;
} ipp_request_t;
/**** New in CUPS 1.1.19 ****/
typedef struct ipp_str ipp_t;
typedef union /**** Attribute Value ****/
{
@@ -362,6 +378,9 @@ typedef union /**** Attribute Value ****/
int length; /* Length of attribute */
void *data; /* Data in attribute */
} unknown; /* Unknown attribute type */
/**** New in CUPS 1.1.19 ****/
ipp_t *collection; /* Collection value */
} ipp_value_t;
typedef struct ipp_attribute_s /**** Attribute ****/
@@ -374,7 +393,7 @@ typedef struct ipp_attribute_s /**** Attribute ****/
ipp_value_t values[1]; /* Values */
} ipp_attribute_t;
typedef struct /**** Request State ****/
struct ipp_str /**** IPP Request/Response/Notification ****/
{
ipp_state_t state; /* State of request */
ipp_request_t request; /* Request header */
@@ -382,7 +401,7 @@ typedef struct /**** Request State ****/
*last, /* Last attribute in list */
*current; /* Current attribute (for read/write) */
ipp_tag_t curtag; /* Current attribute group tag */
} ipp_t;
};
/*
@@ -400,7 +419,7 @@ extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group, const char
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 ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const char *charset, const char * const *values);
extern time_t ippDateToTime(const ipp_uchar_t *date);
extern void ippDelete(ipp_t *ipp);
extern const char *ippErrorString(ipp_status_t error);
@@ -416,6 +435,20 @@ extern ipp_state_t ippWrite(http_t *http, ipp_t *ipp);
extern int ippPort(void);
extern void ippSetPort(int p);
/**** New in CUPS 1.1.19 ****/
extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_t *value);
extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const ipp_t **values);
extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr);
extern ipp_state_t ippReadFile(int fd, ipp_t *ipp);
extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp);
extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
/*
* "Private" functions used internally by CUPS...
*/
extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int);
extern void _ipp_free_attr(ipp_attribute_t *);

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