Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 13fab1a074 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.2.3@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
357 arquivos alterados com 15608 adições e 5785 exclusões
+292 -1
Ver Arquivo
@@ -1,6 +1,297 @@
CHANGES.txt - 2006-05-08
CHANGES.txt - 2006-08-29
------------------------
CHANGES IN CUPS V1.2.3
- The scheduler did not send job-state or
job-config-changed events when a job was held,
released, or changed (STR #1947)
- The scheduler now aborts if the configuration file and
directory checks fail (STR #1941)
- Fixed a problem with ippPort() not using the port
number that was set via the client.conf file or
CUPS_SERVER environment variable (STR #1945)
- HTTP headers were not buffered (STR #1899)
- Some IPP printers (HP) did not like UTF-8 job names
(STR #1837)
- The CUPS desktop icon is now localized for Polish (STR
#1920)
- Printer options were not always honored when printing
from Windows clients (STR #1839)
- The openssl command would lock up the scheduler when
generating an encryption certificate on some platforms
due to a lack of entropy for the random number
generator (STR #1876)
- The web admin page did not recognize that "Listen 631"
enabled remote access (STR #1908)
- The web admin page did not check whether changes were
made to the Basic Server Settings check boxes (STR
#1908)
- The IPP backend could generate N*N copies in certain
edge cases.
- The scheduler did not restore remote printers properly
when BrowseShortNames was enabled (STR #1893)
- Polling did not handle changes to the network
environment on Mac OS X (STR #1896)
- The "make test" subscription tests used invalid
notify-recipient-uri values (STR #1910)
- Printers could be left in an undefined state on system
sleep (STR #1905)
- The Berkeley and System V commands did not always use
the expected character set (STR #1915)
- Remote printing fixes (STR #1881)
- The cupstestppd utility did not validate translation
strings for custom options properly.
- Multi-language PPD files were not properly localized in
the web interface (STR #1913)
- The admin page's simple settings options did not check
for local domain socket or IPv6 addresses and did not
use "localhost" as the listen address.
- An empty BrowseProtocols, BrowseLocalProtocols, or
BrowseRemoteProtocols line would crash the scheduler
instead of disabling the corresponding browsing options.
- The scheduler now logs IPP operation status as debug
messages instead of info or error.
- cupsFileRewind() didn't clear the end-of-file state.
- cupstestppd didn't report the actual misspelling of the
1284DeviceID attribute (STR #1849)
- BrowseRelay didn't work on Debian (STR #1887)
- configure --without-languages didn't work (STR #1879)
- Manually added remote printers did not work (STR #1881)
- The <cups/backend.h> header was not installed.
- Updated the build files for Autoconf 2.60 (STR #1853)
- The scheduler incorrectly terminated the polling
processes after receiving a partial log line.
- The cups-lpd mini-daemon reported "No printer-state
attribute found" errors when reporting the queue status
(PR #6250, STR #1821)
- SNMP backend improvements (STR #1737, STR #1742, STR
#1790, STR #1835, STR #1880)
- The scheduler erroneously reported an error with the
CGI pipe (STR #1860)
- Fixed HP-UX compile problems (STR #1858, STR #1859)
- cupstestppd crashed with some PPD files (STR #1864)
- The <cups/dir.h> and <cups/file.h> header files did not
work with C++.
CHANGES IN CUPS V1.2.2
- Documentation updates (STR #1765, STR #1780)
- CUPS didn't know about alternate character set names
for Asian text (STR #1819)
- The lpoptions -o and -r options did not work unless you
specified a printer.
- The lpoptions command incorrectly allowed users to set
printer attributes like printer-type (STR #1791)
- httpWait() did not flush the write buffer, causing "bad
request" errors when communicating with CUPS 1.1.x
servers (STR #1717)
- Polling did not sanitize the printer description,
location, or make and model strings like broadcasts
did.
- Polled printers did not show the server's default
job-sheets option value.
- The Samba password prompt was not properly localized
(STR #1814)
- Added a German translation (STR #1842)
- The scheduler now creates self-signed SSL certficates
automatically when using OpenSSL and CDSA for
encryption, just as for GNU TLS.
- The SNMP backend sporatically reported some printers as
"unknown" (STR #1774)
- The scheduler now forces BrowseTimeout to be at least
twice the BrowseInterval value and non-zero to avoid
common configuration errors.
- The scheduler incorrectly returned printer URIs of the
form "ipp://server/printers/classname" for classes (STR
#1813)
- Updated Japanese localization (STR #1805)
- The scheduler's SSL certificate/key directory was not
created on installation (STR #1788)
- Added a mailto.conf man page and help page (STR #1754)
- The parallel and USB backends no longer wait for the
printer to go on-line - this caused problems with
certain printers that don't follow with the IEEE-1284
standard (STR #1738)
- The scheduler could crash on a reload when implicit
classes were present (STR #1828)
- The IPP backend incorrectly used the CUPS_ENCRYPTION
environment variable to determine the default
encryption mode when printing (STR #1820)
- USB printing did not work on Solaris (STR #1756)
- The scheduler sorted job priorities in the wrong order
(STR #1811)
- The scheduler did not automatically restart notifiers
that exited or crashed (STR #1793)
- IPv6 support did not work on NetBSD (STR #1834)
- The EPM packaging file did not work (STR #1804)
- The scheduler used up the CPU if BrowseRemoteProtocols
was empty (STR #1792)
- Custom page sizes did not work (STR #1787)
- The SNMP backend could crash on some systems when SNMP
logging was enabled (STR #1789)
- Browsing could produce some funny printer names when
ServerName was set to an IP address (STR #1799)
- Fixed the log message for BrowseRelay (STR #1798)
- Fixes to allow CUPS to compile on MirBSD (STR #1796)
- The scheduler incorrectly set the FINAL_CONTENT_TYPE
environment variable (STR #1795)
- The pdftops filter incorrectly embedded a "produced by"
comment, causing PDF printing not to work on some
operating systems (STR #1801)
- Sending raw jobs from a client system could cause the
client's scheduler to eventually crash (STR #1786)
- The scheduler now checks that the notifier exists prior
to accepting a new subscription request.
- The scheduler now reports the supported
notify-recipient schemes based on the contents of the
ServerBin/notifier directory.
- Event notifications did not include the
notify-sequence-number or other required attributes
(STR #1747)
- Allow/Deny addresses of the form "11.22.33.*" did not
work on Linux (STR #1769)
- cupsGetPPD() did not work if the scheduler was only
listening on a domain socket (STR #1766)
- The scheduler could crash advertising a class (STR
#1768)
- The scheduler could crash if the default printer was
deleted (STR #1776)
- Added a new default CUPS raster format (v3) which does
not compress the raster stream in order to provide the
same cupsRasterReadPixels() and cupsRasterWritePixels()
performance as CUPS 1.1.x.
- The cupsaddsmb man page listed the wrong files for the
CUPS driver.
- Some configure --with options did not work (STR #1746)
- "Allow @IF(name)" didn't work if "name" wasn't the
first network interface (STR #1758)
- The lpstat command did not use the correct character
set when reporting the date and time (STR #1751)
- The cupsaddsmb command and web interface did not update
the Windows PPD files properly, resulting in corrupt
PPD files for the Windows client to use (STR #1750)
- The cupsd.conf man page didn't describe the Listen
domain socket syntax (STR #1753)
- The scheduler no longer tries to support more than
FD_SETSIZE file descriptors.
- CDSA (encryption) support fixes for MacOS X.
- The lppasswd program needs to be setuid to root to
create and update the /etc/cups/passwd.md5 file (STR
#1735)
- 32/64-bit library installation was broken (STR #1741)
- The USB backend now reports a "no such device" error
when using the old filename-based USB URIs instead of
the "success" error.
- Increased the HTTP and IPP read timeouts to 10 seconds,
as 1 second was too short on congested networks (STR
#1719)
- The SNMP backend now uses the device description over
the printer-make-and-model attribute when the attribute
contains a generic name (STR #1728)
- Fixed another file descriptor leak when printing raw
files (STR #1736)
- Raw queues were not shared via LDAP (STR #1739)
- The pstops filter didn't always embed PageSetup
commands from the PPD file (STR #1740)
- "make install" didn't work if you disabled all of the
localizations.
- The scheduler didn't always choose the least costly
filter.
- Fixed parsing of IPv6 addresses in Allow, Deny,
BrowseAllow, BrowseDeny, and BrowseRelay directives
(STR #1713)
- Printers that were shared via LDAP did not get added to
the LDAP server properly (STR #1733)
- LDAP browsing would crash the scheduler if a required
value was missing (STR #1731)
- Special cases for the "localhost" hostname did not
work, causing printing to not work when the /etc/hosts
file did not contain a localhost entry (STR #1723)
- Updated the Spanish translation (STR #1720, STR #1770)
- Reverse-order page output was broken when N-up or
landscape orientations were used (STR #1725)
- The parallel, serial, socket, and USB backends needed
print data before they would report back-channel data,
causing problems with several new drivers (STR #1724)
CHANGES IN CUPS V1.2.1
- "lprm -h hostname" did not work (STR #1800)
- The web interface did not handle reloads properly for
MSIE (STR #1716)
- The configure script no longer adds linker rpath
options when they are unnecessary.
- The scheduler could crash printing a debug message on
Solaris (STR #1714)
- The --enable-32bit and --enable-64bit configure options
did not always work.
- The password prompt showed the domain socket address
instead of "localhost" for local authentication (STR
#1706)
- The web interface filtered the list of printers even if
the user wasn't logged in (STR #1700)
- The IPP backend did not work reliably with some Xerox
printers (STR #1704)
- Trailing banners were not added when printing a single
file (STR #1698)
- The web interface support programs crashed on Solaris
(STR #1699)
- cupstestppd incorrectly reported problems with
*1284DeviceID attributes (STR #1710)
- Browsing could get disabled after a restart (STR #1670)
- Custom page sizes were not parsed properly (STR #1709)
- The -U option wasn't supported by lpadmin (STR #1702)
- The -u option didn't work with lpadmin (STR #1703)
- The scheduler did not create non-blocking back-channel
pipes, which caused problems when the printer driver
did not read the back-channel data (STR #1705)
- The scheduler no longer uses chunking in responses to
clients - this caused problems with older versions of
CUPS like 1.1.17 (PR #6143)
- Automatic raw printing was broken (STR #1667)
- 6-up printing was broken (STR #1697)
- The pstops filter did not disable CTRL-D processing on
the printer/RIP.
- ppdOpen*() did not load custom options properly (STR
#1680)
- "Set Printer Options" in the web interface did not
update the DefaultImageableArea or
DefaultPaperDimension attributes in the PPD file (STR
#1689)
- Fixed compile errors (STR #1682, STR #1684, STR #1685,
STR #1690)
- The lpstat command displayed the wrong error message
for a missing destination (STR #1683)
- Revised and completed the Polish translation (STR
#1669)
- Stopped jobs did not show up in the list of active jobs
(STR #1676)
- The configure script did not use the GNU TLS
"libgnutls-config" script to find the proper compiler
and linker options.
- The imagetoraster filter did not correctly generate
several 1, 2, and 4-bit color modes.
- cupsRasterWritePixels() could lose track of the current
output row.
- cupsRasterReadPixels() did not automatically swap
12/16-bit chunked pixel data.
- Moved the private _cups_raster_s structure out of the
public header.
- Updated the CUPS raster format specification to include
encoding rules and colorspace definitions.
- The Zebra PPD files had the wrong PostScript code for
the "default" option choices.
- The imagetoraster filter did not generate correct CIE
XYZ or Lab color data.
- The cups-config script did not work when invoked from a
source directory (STR #1673)
- The SNMP backend did not compile on systems that used
the getifaddrs emulation functions (STR #1668)
CHANGES IN CUPS V1.2.0
- Documentation updates (STR #1618, STR #1620, STR #1622,
+10 -2
Ver Arquivo
@@ -78,6 +78,8 @@ CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
#
LANGUAGES = @LANGUAGES@
INSTALL_LANGUAGES = @INSTALL_LANGUAGES@
UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@
#
# Libraries...
@@ -127,9 +129,9 @@ CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
CXXLIBS = @CXXLIBS@
DSOFLAGS = @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
IMGLIBS = @IMGLIBS@ -lm
IMGLIBS = @IMGLIBS@
IMGFILTERS = @IMGFILTERS@
LDFLAGS = -L../cups -L../filter $(RC_CFLAGS) $(ARCHFLAGS) \
LDFLAGS = -L../cups -L../filter $(ARCHFLAGS) \
@LDFLAGS@ @PIEFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
LINKCUPSIMAGE = @LINKCUPSIMAGE@
@@ -149,6 +151,7 @@ LAUNCHDLIBS = @LAUNCHDLIBS@
#
ARCH32FLAGS = @ARCH32FLAGS@
DSO32FLAGS = @DSO32FLAGS@
INSTALL32 = @INSTALL32@
LIB32CUPS = @LIB32CUPS@
LIB32CUPSIMAGE = @LIB32CUPSIMAGE@
@@ -156,6 +159,7 @@ LIB32DIR = $(BUILDROOT)@LIB32DIR@
UNINSTALL32 = @UNINSTALL32@
ARCH64FLAGS = @ARCH64FLAGS@
DSO64FLAGS = @DSO64FLAGS@
INSTALL64 = @INSTALL64@
LIB64CUPS = @LIB64CUPS@
LIB64CUPSIMAGE = @LIB64CUPSIMAGE@
@@ -170,12 +174,16 @@ UNINSTALL64 = @UNINSTALL64@
# We have to define these first because autoconf uses ${prefix}
# and ${exec_prefix} for most of the other directories...
#
# The "datarootdir" variable may not get defined if you are using
# a version of autoconf prior to 2.60.
#
# This is immediately followed by definition in ALL CAPS for the
# needed directories...
#
bindir = @bindir@
datadir = @datadir@
datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
includedir = @includedir@
infodir = @infodir@
+29 -5
Ver Arquivo
@@ -99,8 +99,8 @@ install: installhdrs
echo Installing cups-config script...
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
echo Installing startup script...
if test "x$(INITDIR)" != x; then \
echo Installing init scripts...; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
@@ -115,13 +115,17 @@ install: installhdrs
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
echo Installing StartupItems files...; \
$(INSTALL_SCRIPT) init/PrintingServices $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
$(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
echo Installing LaunchDaemons configuration files...; \
$(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
$(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \
else \
echo Installing RC script...; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
fi \
fi
@@ -217,22 +221,42 @@ uninstall:
# Run the test suite...
#
check test: all
test: all
echo Running CUPS test suite...
cd test; ./run-stp-tests.sh
check: all
echo Running CUPS test suite with defaults...
cd test; ./run-stp-tests.sh 1 0 n
#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
#
EPMFLAGS = -v
EPMFLAGS = -v --output-dir dist $(EPMARCH)
aix bsd deb depot inst osx pkg rpm setld slackware swinstall tardist:
aix bsd deb depot inst pkg rpm setld slackware swinstall tardist:
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
epm:
epm $(EPMFLAGS) cups packaging/cups.list
epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
osx:
epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
.PHONEY: dist
dist: all
$(RM) -r dist
$(MAKE) $(MFLAGS) epm
case `uname` in \
*BSD*) $(MAKE) $(MFLAGS) bsd;; \
Darwin*) $(MAKE) $(MFLAGS) osx;; \
IRIX*) $(MAKE) $(MFLAGS) tardist;; \
Linux*) $(MAKE) $(MFLAGS) rpm;; \
SunOS*) $(MAKE) $(MFLAGS) pkg;; \
esac
#
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.2.0 - 2006-05-08
README - CUPS v1.2.3 - 2006-08-28
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
+22 -17
Ver Arquivo
@@ -9,26 +9,31 @@ lpd.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
lpd.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
lpd.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
lpd.o: ../cups/string.h
parallel.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
parallel.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
parallel.o: ../cups/language.h ../cups/string.h ../config.h ieee1284.c
parallel.o: ../cups/debug.h
pap.o: ../cups/http.h ../cups/md5.h
parallel.o: backend-private.h ../cups/backend.h ../cups/cups.h ../cups/ipp.h
parallel.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
parallel.o: ../cups/file.h ../cups/language.h ../cups/debug.h
parallel.o: ../cups/string.h ../config.h
scsi.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
scsi.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
scsi.o: ../cups/language.h ../cups/string.h ../config.h
serial.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
serial.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
serial.o: ../cups/language.h ../cups/string.h ../config.h
snmp.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
snmp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
snmp.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
snmp.o: ../cups/string.h ../cups/array.h ../cups/file.h ieee1284.c
snmp.o: ../cups/debug.h
socket.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
socket.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
socket.o: ../cups/string.h
test1284.o: ../cups/string.h ../config.h ieee1284.c ../cups/debug.h
serial.o: backend-private.h ../cups/backend.h ../cups/cups.h ../cups/ipp.h
serial.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
serial.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
serial.o: ../config.h
snmp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
snmp.o: ../cups/ipp-private.h ../cups/ipp.h backend-private.h
snmp.o: ../cups/backend.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
snmp.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
snmp.o: ../cups/array.h ../cups/file.h
socket.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
socket.o: ../cups/ipp-private.h ../cups/ipp.h backend-private.h
socket.o: ../cups/backend.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
socket.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
test1284.o: ../cups/string.h ../config.h ieee1284.c backend-private.h
test1284.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
test1284.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
test1284.o: ../cups/language.h ../cups/debug.h
usb.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
usb.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
usb.o: ../cups/language.h ../cups/string.h ../config.h
+24 -12
Ver Arquivo
@@ -28,7 +28,8 @@ include ../Makedefs
RBACKENDS = ipp lpd
UBACKENDS = $(PAP) parallel scsi serial snmp socket usb
TARGETS = betest test1284 $(RBACKENDS) $(UBACKENDS)
TARGETS = betest test1284 libbackend.a $(RBACKENDS) $(UBACKENDS)
LIBOBJS = ieee1284.o runloop.o
OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
serial.o snmp.o socket.o test1284.o usb.o
@@ -104,6 +105,17 @@ test1284: test1284.o ../cups/libcups.a
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# libbackend.a
#
libbackend.a: $(LIBOBJS)
echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
#
# ieee1394
#
@@ -149,9 +161,9 @@ pap: pap.o ../cups/$(LIBCUPS)
# parallel
#
parallel: parallel.o ../cups/$(LIBCUPS)
parallel: parallel.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o parallel parallel.o $(LIBS)
$(CC) $(LDFLAGS) -o parallel parallel.o libbackend.a $(LIBS)
#
@@ -169,37 +181,37 @@ scsi.o: scsi.c scsi-irix.c scsi-linux.c
# serial
#
serial: serial.o ../cups/$(LIBCUPS)
serial: serial.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
$(CC) $(LDFLAGS) -o serial serial.o libbackend.a $(BACKLIBS) $(LIBS)
#
# snmp
#
snmp: snmp.o ../cups/$(LIBCUPS)
snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o snmp snmp.o $(LIBS)
$(CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
#
# socket
#
socket: socket.o ../cups/$(LIBCUPS)
socket: socket.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o socket socket.o $(LIBS)
$(CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
#
# usb
#
usb: usb.o ../cups/$(LIBCUPS)
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c ieee1284.c
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c
#
+73
Ver Arquivo
@@ -0,0 +1,73 @@
/*
* "$Id$"
*
* Backend support definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*/
#ifndef _CUPS_BACKEND_PRIVATE_H_
# define _CUPS_BACKEND_PRIVATE_H_
/*
* Include necessary headers.
*/
# include <cups/backend.h>
# include <cups/cups.h>
# include <cups/debug.h>
# include <stdlib.h>
# include <errno.h>
# include <cups/string.h>
# include <signal.h>
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Prototypes...
*/
extern int backendGetDeviceID(int fd, char *device_id, int device_id_size,
char *make_model, int make_model_size,
const char *scheme, char *uri, int uri_size);
extern int backendGetMakeModel(const char *device_id, char *make_model,
int make_model_size);
extern ssize_t backendRunLoop(int print_fd, int device_fd, int use_bc);
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_BACKEND_PRIVATE_H_ */
/*
* End of "$Id$".
*/
-71
Ver Arquivo
@@ -1,71 +0,0 @@
Preliminary Design for CUPS Firewire Printer Backend - 03/19/2002
-----------------------------------------------------------------
OVERVIEW
Easy Software Products will develop an IEEE-1394, a.k.a.
Firewire, printing interface for its Common UNIX Printing
System ("CUPS") for initial use under the Linux operating
system. A follow-on implementation for MacOS X is
anticipated as well.
The operating system interfaces for IEEE-1394 ports vary
widely; the CUPS printing interface will abstract the OS
layer to a simpler interface geared towards discovering,
opening, reading from, writing to, and closing IEEE-1394
printers.
The initial development of the CUPS backend will be targeted
at the EPSON Stylus Pro 10000 large format printer, which
requires the bandwidth provided by Firewire in order to
print at full speed. This printer supports printing via
Serial Bus Protocol 2 (SBP-2) using the SCSI and PWG command
sets. The CUPS backend will implement the PWG command set on
LUN 0 only.
OS ABSTRACTION LAYER
The OS abstraction layer will be a thin client library that
implements the following functions:
ieee1394_list
ieee1394_open
ieee1394_close
ieee1394_read
ieee1394_write
ieee1394_error
The "ieee1394_list" function will list all of the available
printer devices on the bus. The device information will
consist of the device URI (ieee1394:/something) used to
access the device and the make and model information, if
available, for the device ("EPSON Stylus Printer").
The "ieee1394_open" and "ieee1394_close" functions will open
and close a connection to the printer, respectively.
The "ieee1394_read" and "ieee1394_write" functions will read
and write data to and from the printer, respectively. The
read function will be non-blocking, returning data only if
there is data coming back from the printer.
The "ieee1394_error" function will return a string
describing the last error or NULL if no error occurred.
The library will be responsible for creating any background
threads that are needed to monitor the connection to the
printer.
CUPS BACKEND
The CUPS backend will use the OS abstraction layer to list
and access the Firewire printers. The "main" function will
read and write printer data, while the "list_devices"
function will be called as necessary to identify the
available devices.
The CUPS 1.1 backend will record any status information in
the error log file, while the 1.2 backend will supply it to
the printer driver process.
-35
Ver Arquivo
@@ -1,35 +0,0 @@
Easy Software Products
44141 Airport View Drive
Suite 204
Hollywood, Maryland 20636
+1.301.373.9600
March 8, 2002
Subject: EPSON Firewire Printer Driver for Linux
Currently, no Firewire printer support exists for Linux. Since
the latest EPSON printer products depend on the Firewire
interface to print at full speed, a solution is needed to
support customers using Linux as their server platform.
The Linux Firewire subsystem provides a user-mode driver
interface that allows driver programs to access Firewire
devices. Easy Software Products will utilize this interface to
develop a "backend" program for the Common UNIX Printing System
that will allow users to print to EPSON printers using the
Firewire interface.
After examining the Linux interface, we estimate that it will
require approximately 30 hours of development time to write,
test, and document the Firewire backend, for a total cost of
$3,000. The new backend will become a standard part of the CUPS
software distribution and will be included with at least the
following Linux distributions:
- Caldera Linux
- Mandrake Linux
- Red Hat Linux
- SuSE Linux
ESP will provide EPSON with binaries for Red Hat Linux 7.2.
+37 -44
Ver Arquivo
@@ -25,51 +25,41 @@
*
* Contents:
*
* get_device_id() - Get the IEEE-1284 device ID string and corresponding
* URI.
* get_make_model() - Get the make and model string from the device ID.
* backendGetDeviceID() - Get the IEEE-1284 device ID string and
* corresponding URI.
* backendGetMakeModel() - Get the make and model string from the device ID.
*/
/*
* Include necessary headers.
*/
#include <cups/debug.h>
#include "backend-private.h"
#ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
# 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 */
/*
* Prototypes...
* 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
* corresponding URI.
*/
static int get_make_model(const char *device_id, char *make_model,
int make_model_size);
/*
* 'get_device_id()' - Get the IEEE-1284 device ID string and
* corresponding URI.
*/
#ifndef SNMP_BACKEND
# ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
# 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 */
int /* O - 0 on success, -1 on failure */
get_device_id(
backendGetDeviceID(
int fd, /* I - File descriptor */
char *device_id, /* O - 1284 device ID */
int device_id_size, /* I - Size of buffer */
@@ -93,7 +83,7 @@ get_device_id(
#endif /* __sun && ECPPIOC_GETDEVID */
DEBUG_printf(("get_device_id(fd=%d, device_id=%p, device_id_size=%d, "
DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
"make_model=%p, make_model_size=%d, scheme=\"%s\", "
"uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
make_model, make_model_size, scheme ? scheme : "(null)",
@@ -107,7 +97,7 @@ get_device_id(
!device_id || device_id_size < 32 ||
!make_model || make_model_size < 32)
{
DEBUG_puts("get_device_id: Bad args!");
DEBUG_puts("backendGetDeviceID: Bad args!");
return (-1);
}
@@ -155,7 +145,7 @@ get_device_id(
}
# ifdef DEBUG
else
printf("get_device_id: ioctl failed - %s\n", strerror(errno));
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __linux */
@@ -178,11 +168,11 @@ get_device_id(
}
# ifdef DEBUG
else
printf("get_device_id: ioctl failed - %s\n", strerror(errno));
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __sun && ECPPIOC_GETDEVID */
DEBUG_printf(("get_device_id: device_id=\"%s\"\n", device_id));
DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
if (!*device_id)
return (-1);
@@ -191,7 +181,7 @@ get_device_id(
* Get the make and model...
*/
get_make_model(device_id, make_model, make_model_size);
backendGetMakeModel(device_id, make_model, make_model_size);
/*
* Then generate a device URI...
@@ -243,6 +233,8 @@ get_device_id(
if (!strcasecmp(manufacturer, "Hewlett-Packard"))
strcpy(manufacturer, "HP");
else if (!strcasecmp(manufacturer, "Lexmark International"))
strcpy(manufacturer, "Lexmark");
}
else
{
@@ -303,15 +295,14 @@ get_device_id(
return (0);
}
#endif /* !SNMP_BACKEND */
/*
* 'get_make_model()' - Get the make and model string from the device ID.
* 'backendGetMakeModel()' - Get the make and model string from the device ID.
*/
int /* O - 0 on success, -1 on failure */
get_make_model(
backendGetMakeModel(
const char *device_id, /* O - 1284 device ID */
char *make_model, /* O - Make/model */
int make_model_size) /* I - Size of buffer */
@@ -322,7 +313,7 @@ get_make_model(
*mdl; /* Model string */
DEBUG_printf(("get_make_model(device_id=\"%s\", "
DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
"make_model=%p, make_model_size=%d)\n", device_id,
make_model, make_model_size));
@@ -332,7 +323,7 @@ get_make_model(
if (!device_id || !*device_id || !make_model || make_model_size < 32)
{
DEBUG_puts("get_make_model: Bad args!");
DEBUG_puts("backendGetMakeModel: Bad args!");
return (-1);
}
@@ -410,6 +401,8 @@ get_make_model(
{
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
strlcpy(make_model, "HP", make_model_size);
else if (!strncasecmp(mfg, "Lexmark International", 21))
strlcpy(make_model, "Lexmark", make_model_size);
else
strlcpy(make_model, mfg, make_model_size);
-877
Ver Arquivo
@@ -1,877 +0,0 @@
/*
* "$Id$"
*
* Linux IEEE-1394 glue for the Common UNIX Printing System (CUPS).
*
* Copyright 2002 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use
* of this software must display the following
* acknowledgement:
*
* This product includes software developed by Easy
* Software Products.
*
* 4. The name of Easy Software Products may not be used to
* endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* Contents:
*
* get_device_id() - Get the IEEE-1284 device ID for a node...
* get_unit_type() - Get the unit type for a node...
* show_data() - Show a data node...
* show_dir() - Show a directory list...
* ieee1394_list() - List the available printer devices.
* ieee1394_open() - Open a printer device.
* ieee1394_close() - Close a printer device.
* ieee1394_read() - Read from a printer device.
* ieee1394_write() - Write data to a printer device.
* ieee1394_error() - Return the last error.
*/
/*
* Include necessary headers.
*/
#include "ieee1394.h"
#include <cups/debug.h>
#include <libraw1394/raw1394.h>
#include <libraw1394/csr.h>
/*
* Limits...
*/
#define MAX_NODES 100
/*
* Structures...
*/
typedef struct
{
char uri[HTTP_MAX_URI],/* URI for this node... */
description[128],/* Description of port */
make_model[128];/* Make and model */
int port, /* Port where this node is found */
node; /* Node number */
unsigned long long addr; /* Management address */
} linux1394_node_t;
typedef struct
{
raw1394handle_t handle; /* Handle for printer device */
int node; /* Node number for printer device */
unsigned long long addr; /* Management address */
} linux1394_dev_t;
/*
* ORB messages for communication with the device...
*/
typedef struct /**** Login ORB Message */
{
unsigned char passwd_addr[8]; /* Password address */
unsigned char resp_addr[8]; /* Login response address */
unsigned char notify_excl; /* Notify and exclusive bits */
unsigned char recon_func; /* Reconnect time and function */
unsigned char lun[2]; /* Logical unit number */
unsigned char passwd_len[2]; /* Length of password */
unsigned char resp_len[2]; /* Length of login response */
unsigned char fifo_addr[8]; /* Local status FIFO address */
} login_orb_t;
typedef struct /**** Login Response Message ****/
{
unsigned char length[2]; /* Length of response */
unsigned char login_id[2]; /* Login ID */
unsigned char cmd_addr[8]; /* Command block agent address */
unsigned char reserved[2]; /* Reserved (0) */
unsigned char recon_hold[2]; /* Number of seconds to hold login */
} login_resp_t;
/*
* Local globals...
*/
static char error_string[1024] = "";
static int num_nodes;
static linux1394_node_t nodes[MAX_NODES];
/*
* 'get_device_id()' - Get the IEEE-1284 device ID for a node...
*/
static char * /* O - Device ID */
get_device_id(raw1394handle_t handle,/* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset,/* I - Offset to directory */
char *id, /* O - ID string */
int idlen) /* I - Size of ID string */
{
unsigned char data[1024], /* Data from ROM */
*dataptr; /* Pointer into data */
int length; /* Length of directory */
int datalen; /* Length of data */
unsigned long long dataoff; /* Offset of data */
DEBUG_printf(("get_device_id(handle = %p, node = %d, offset = %llx, id = %p, idlen = %d)\n",
handle, node, offset, id, idlen));
*id = '\0';
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (NULL);
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
DEBUG_printf((" length = %d\n", length));
/*
* Then read the directory, looking for unit directory or device tags...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (NULL);
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
data[2], data[3]));
if (data[0] == 0xd1)
{
/*
* Found the unit directory...
*/
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
return (get_device_id(handle, node, offset, id, idlen));
}
else if (data[0] == 0x81)
{
/*
* Found potential IEEE-1284 device ID...
*/
dataoff = offset + (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
if (raw1394_read(handle, 0xffc0 | node, dataoff, 4, (quadlet_t *)data) < 0)
return (NULL);
dataoff += 4;
/*
* Read the leaf value...
*/
datalen = (data[0] << 8) | data[1];
if (datalen > (sizeof(data) / 4))
datalen = sizeof(data) / 4;
for (dataptr = data; datalen > 0; datalen --, dataptr += 4, dataoff += 4)
if (raw1394_read(handle, 0xffc0 | node, dataoff, 4,
(quadlet_t *)dataptr) < 0)
return (NULL);
if (data[0] == 0 && memcmp(data + 8, "MFG:", 4) == 0)
{
/*
* Found the device ID...
*/
datalen = dataptr - data - 8;
if (datalen >= idlen)
datalen --;
memcpy(id, data + 8, datalen);
id[datalen] = '\0';
return (id);
}
}
offset += 4;
length --;
}
return (NULL);
}
/*
* 'get_man_addr()' - Get the management address for a node...
*/
static int /* O - Unit type */
get_man_addr(raw1394handle_t handle, /* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset) /* I - Offset to directory */
{
unsigned char data[4]; /* Data from ROM */
int length; /* Length of directory */
DEBUG_printf(("get_man_addr(handle = %p, node = %d, offset = %llx)\n",
handle, node, offset));
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
DEBUG_printf((" length = %d\n", length));
/*
* Then read the directory, looking for unit directory or type tags...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
data[2], data[3]));
if (data[0] == 0xd1)
{
/*
* Found the unit directory...
*/
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
return (get_man_addr(handle, node, offset));
}
else if (data[0] == 0x54)
{
/*
* Found the management address...
*/
return (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
}
offset += 4;
length --;
}
return (-1);
}
/*
* 'get_unit_type()' - Get the unit type for a node...
*/
static int /* O - Unit type */
get_unit_type(raw1394handle_t handle,/* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset)/* I - Offset to directory */
{
unsigned char data[4]; /* Data from ROM */
int length; /* Length of directory */
DEBUG_printf(("get_unit_type(handle = %p, node = %d, offset = %llx)\n",
handle, node, offset));
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
DEBUG_printf((" length = %d\n", length));
/*
* Then read the directory, looking for unit directory or type tags...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
data[2], data[3]));
if (data[0] == 0xd1)
{
/*
* Found the unit directory...
*/
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
return (get_unit_type(handle, node, offset));
}
else if (data[0] == 0x14)
{
/*
* Found the unit type...
*/
return (data[1] & 0x1f);
}
offset += 4;
length --;
}
return (-1);
}
#ifdef DEBUG
/*
* 'show_data()' - Show a data node...
*/
static void
show_data(raw1394handle_t handle, /* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset, /* I - Offset to directory */
int indent) /* Amount to indent */
{
int i; /* Looping var */
unsigned char data[4]; /* Data from ROM */
int length; /* Length of data */
/*
* Read the data length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
/*
* Then read the data...
*/
for (i = 0; i < indent; i ++)
putchar(' ');
printf("LEAF (%d quadlets)\n", length);
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
for (i = 0; i < indent; i ++)
putchar(' ');
printf("%02X %02X %02X %02X '%c%c%c%c'\n",
data[0], data[1], data[2], data[3],
(data[0] < ' ' || data[0] >= 0x7f) ? '.' : data[0],
(data[1] < ' ' || data[1] >= 0x7f) ? '.' : data[1],
(data[2] < ' ' || data[2] >= 0x7f) ? '.' : data[2],
(data[3] < ' ' || data[3] >= 0x7f) ? '.' : data[3]);
offset += 4;
length --;
}
}
/*
* 'show_dir()' - Show a directory list...
*/
static void
show_dir(raw1394handle_t handle, /* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset, /* I - Offset to directory */
int indent) /* Amount to indent */
{
int i; /* Looping var */
unsigned char data[4]; /* Data from ROM */
int length; /* Length of directory */
int value; /* Value in directory */
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
/*
* Then read the directory...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
for (i = 0; i < indent; i ++)
putchar(' ');
printf("%02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
value = (((data[1] << 8) | data[2]) << 8) | data[3];
switch (data[0] & 0xc0)
{
case 0x00 :
for (i = -4; i < indent; i ++)
putchar(' ');
printf("IMMEDIATE %d\n", value);
break;
case 0x40 :
for (i = -4; i < indent; i ++)
putchar(' ');
printf("CSR OFFSET +%06X\n", value);
break;
case 0x80 :
show_data(handle, node, offset + value * 4, indent + 4);
break;
case 0xc0 :
show_dir(handle, node, offset + value * 4, indent + 4);
break;
}
offset += 4;
length --;
}
}
#endif /* DEBUG */
/*
* 'ieee1394_list()' - List the available printer devices.
*/
ieee1394_info_t * /* O - Printer information */
ieee1394_list(int *num_devices) /* O - Number of printers */
{
int i, j; /* Looping vars */
raw1394handle_t handle; /* 1394 handle */
int num_ports; /* Number of ports */
struct raw1394_portinfo ports[100]; /* Port data... */
unsigned char guid[8]; /* Global unique ID */
int vendor; /* Vendor portion of GUID */
int unit_type; /* Unit type */
int addr; /* Management address offset */
char id[1024], /* Device ID string */
*idptr, /* Pointer into ID string */
*idsep; /* Pointer to separator */
ieee1394_info_t *devices; /* Device list */
/*
* Connect to the user-mode driver interface...
*/
handle = raw1394_new_handle();
num_ports = raw1394_get_port_info(handle, ports,
sizeof(ports) / sizeof(ports[0]));
DEBUG_printf(("num_ports = %d\n", num_ports));
/*
* Loop through the ports to discover what nodes are available.
*/
num_nodes = 0;
for (i = 0; i < num_ports; i ++)
{
DEBUG_printf(("ports[%d] = { nodes = %d, name = \"%s\" }\n", i,
ports[i].nodes, ports[i].name));
raw1394_set_port(handle, i);
for (j = 0; j < ports[i].nodes; j ++)
{
if (raw1394_read(handle, 0xffc0 | j,
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 12, 4,
(quadlet_t *)guid) < 0)
{
DEBUG_printf((" Node #%d: Unable to contact (%s)!\n", j,
strerror(errno)));
continue;
}
else
{
raw1394_read(handle, 0xffc0 | j,
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 16, 4,
(quadlet_t *)(guid + 4));
DEBUG_printf((" Node #%d: GUID = %02X%02X%02X%02X%02X%02X%02X%02X\n",
j, guid[0], guid[1], guid[2], guid[3], guid[4],
guid[5], guid[6], guid[7]));
vendor = (((guid[0] << 8) | guid[1]) << 8) | guid[2];
unit_type = get_unit_type(handle, j,
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
DEBUG_printf(("vendor = %x, unit_type = %d\n", vendor, unit_type));
if (unit_type == 2 && num_nodes < MAX_NODES)
{
/*
* Found a printer device; add it to the nodes list...
*/
#ifdef DEBUG
show_dir(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20, 0);
#endif /* DEBUG */
memset(nodes + num_nodes, 0, sizeof(linux1394_node_t));
sprintf(nodes[num_nodes].uri, "ieee1394://%02X%02X%02X%02X%02X%02X%02X%02X",
guid[0], guid[1], guid[2], guid[3], guid[4],
guid[5], guid[6], guid[7]);
nodes[num_nodes].port = i;
nodes[num_nodes].node = j;
addr = get_man_addr(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
if (addr < 0)
continue;
nodes[num_nodes].addr = CSR_REGISTER_BASE + addr;
DEBUG_printf(("Node address = %llx\n", nodes[num_nodes].addr));
get_device_id(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20,
id, sizeof(id));
if (id[0])
{
/*
* Grab the manufacturer and model name from the device ID
* string...
*/
idptr = id + 4;
idsep = strchr(id, ';');
if (idsep)
*idsep++ = '\0';
else
idsep = idptr;
snprintf(nodes[num_nodes].description,
sizeof(nodes[num_nodes].description),
"%s Firewire Printer", idptr);
if ((idptr = strstr(idsep, "DES:")) == NULL)
idptr = strstr(idsep, "MDL:");
if (idptr == NULL)
strcpy(nodes[num_nodes].make_model, "Unknown");
else
{
/*
* Grab the DES or MDL code...
*/
idptr += 4;
idsep = strchr(idptr, ';');
if (idsep)
*idsep = '\0';
if (strncmp(id + 4, idptr, strlen(id + 4)) == 0)
{
/*
* Use the description directly...
*/
strlcpy(nodes[num_nodes].make_model, idptr,
sizeof(nodes[num_nodes].make_model));
}
else
{
/*
* Add the manufacturer to the front of the name...
*/
snprintf(nodes[num_nodes].make_model,
sizeof(nodes[num_nodes].make_model),
"%s %s", id + 4, idptr);
}
}
}
else
{
/*
* Flag it as an unknown printer...
*/
sprintf(nodes[num_nodes].description,
"Unknown%06X Firewire Printer", vendor);
strcpy(nodes[num_nodes].make_model, "Unknown");
}
num_nodes ++;
}
}
}
}
/*
* Done querying the Firewire bus...
*/
raw1394_destroy_handle(handle);
/*
* Build an array of device info structures as needed...
*/
if (num_devices == NULL)
return (NULL);
*num_devices = num_nodes;
if (num_nodes)
{
if ((devices = calloc(sizeof(ieee1394_info_t), num_nodes)) != NULL)
{
for (i = 0; i < num_nodes; i ++)
{
strcpy(devices[i].uri, nodes[i].uri);
strcpy(devices[i].description, nodes[i].description);
strcpy(devices[i].make_model, nodes[i].make_model);
}
}
return (devices);
}
else
return (NULL);
}
/*
* 'ieee1394_open()' - Open a printer device.
*/
ieee1394_dev_t /* O - Printer device or NULL */
ieee1394_open(const char *uri) /* I - Device URI */
{
int i; /* Looping var */
linux1394_dev_t *ldev; /* Linux device */
/*
* Return early if we can't see any printers...
*/
if (num_nodes == 0)
ieee1394_list(NULL);
if (num_nodes == 0)
{
strcpy(error_string, "No IEEE-1394 printers found!");
return (NULL);
}
/*
* Look for the URI...
*/
for (i = 0; i < num_nodes; i ++)
if (strcmp(nodes[i].uri, uri) == 0)
break;
if (i >= num_nodes)
{
snprintf(error_string, sizeof(error_string), "Device %s not found!", uri);
return (NULL);
}
/*
* Now create a new device structure...
*/
if ((ldev = calloc(sizeof(linux1394_dev_t), 1)) == NULL)
{
strcpy(error_string, "Out of memory!");
return (NULL);
}
ldev->handle = raw1394_new_handle();
ldev->node = nodes[i].node;
ldev->addr = nodes[i].addr;
raw1394_set_port(ldev->handle, nodes[i].port);
error_string[0] = '\0';
return ((ieee1394_dev_t)ldev);
}
/*
* 'ieee1394_close()' - Close a printer device.
*/
int /* O - 0 on success, -1 on failure */
ieee1394_close(ieee1394_dev_t dev) /* I - Printer device */
{
linux1394_dev_t *ldev; /* Linux device */
ldev = (linux1394_dev_t *)dev;
raw1394_destroy_handle(ldev->handle);
free(ldev);
return (0);
}
/*
* 'ieee1394_read()' - Read from a printer device.
*/
int /* O - Number of bytes read or -1 */
ieee1394_read(ieee1394_dev_t dev, /* I - Printer device */
char *buffer, /* I - Read buffer */
int len) /* I - Max bytes to read */
{
linux1394_dev_t *ldev; /* Linux device */
ldev = (linux1394_dev_t *)dev;
return (0);
}
/*
* 'ieee1394_write()' - Write data to a printer device.
*/
int /* O - Number of bytes written or -1 */
ieee1394_write(ieee1394_dev_t dev, /* I - Printer device */
char *buffer, /* I - Buffer to write */
int len) /* I - Number of bytes to write */
{
linux1394_dev_t *ldev; /* Linux device */
ldev = (linux1394_dev_t *)dev;
/* if (raw1394_write(handle, 0xffc0 | j, 0, ,
(quadlet_t *)guid) < 0)*/
return (len);
}
/*
* 'ieee1394_error()' - Return the last error.
*/
const char * /* O - Error string or NULL */
ieee1394_error(void)
{
if (error_string[0])
return (error_string);
else
return (NULL);
}
/*
* End of "$Id$".
*/
-267
Ver Arquivo
@@ -1,267 +0,0 @@
/*
* "$Id$"
*
* IEEE-1394 backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2002 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use
* of this software must display the following
* acknowledgement:
*
* This product includes software developed by Easy
* Software Products.
*
* 4. The name of Easy Software Products may not be used to
* endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* Contents:
*
* main() - Send a file to the printer.
* list_devices() - List all known printer devices...
*/
/*
* Include necessary headers.
*/
#include "ieee1394.h"
/*
* Local functions...
*/
void list_devices(void);
/*
* 'main()' - Send a file to the printer.
*
* Usage:
*
* 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 */
{
ieee1394_dev_t dev; /* Printer device */
int fp; /* Print file */
int copies; /* Number of copies to print */
int rbytes; /* Number of bytes read from device */
size_t nbytes, /* Number of bytes read from file */
tbytes; /* Total number of bytes written */
char buffer[8192]; /* Input/output buffer */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
}
else if (argc < 6 || argc > 7)
{
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
argv[0]);
return (1);
}
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
*/
if (argc == 6)
{
fp = 0;
copies = 1;
}
else
{
/*
* Try to open the print file...
*/
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
}
/*
* Try to open the printer device...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
if ((dev = ieee1394_open(argv[0])) == NULL)
{
fputs("INFO: Firewire printer busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
}
while (dev == NULL);
fputs("STATE: -connecting-to-device\n", stderr);
/*
* 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;
if (ieee1394_write(dev, buffer, nbytes) < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
if ((rbytes = ieee1394_read(dev, buffer, sizeof(buffer))) > 0)
fprintf(stderr, "INFO: Read %d bytes from printer...\n", rbytes);
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
}
/*
* Close the printer device and input file and return...
*/
ieee1394_close(dev);
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
}
/*
* 'list_devices()' - List all known devices...
*/
void
list_devices(void)
{
int i, /* Looping var */
num_info; /* Number of devices */
ieee1394_info_t *info; /* Devices... */
/*
* Get the available devices...
*/
info = ieee1394_list(&num_info);
/*
* List them as needed...
*/
if (num_info > 0)
{
for (i = 0; i < num_info; i ++)
printf("direct %s \"%s\" \"%s\"\n", info[i].uri,
info[i].make_model, info[i].description);
free(info);
}
}
/*
* End of "$Id$".
*/
-103
Ver Arquivo
@@ -1,103 +0,0 @@
/*
* "$Id$"
*
* IEEE-1394 header for the Common UNIX Printing System (CUPS).
*
* Copyright 2002 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use
* of this software must display the following
* acknowledgement:
*
* This product includes software developed by Easy
* Software Products.
*
* 4. The name of Easy Software Products may not be used to
* endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
#endif /* WIN32 */
/*
* Device information structure...
*/
typedef struct
{
char uri[HTTP_MAX_URI], /* Device URI */
description[128], /* Description of port */
make_model[128]; /* Make and model */
} ieee1394_info_t;
/*
* Private device connection information...
*/
typedef void *ieee1394_dev_t;
/*
* Prototypes for standard IEEE-1394 interface...
*/
extern ieee1394_info_t *ieee1394_list(int *num_devices);
extern ieee1394_dev_t ieee1394_open(const char *uri);
extern int ieee1394_close(ieee1394_dev_t dev);
extern int ieee1394_read(ieee1394_dev_t dev, char *buffer, int len);
extern int ieee1394_write(ieee1394_dev_t dev, char *buffer, int len);
extern const char *ieee1394_error(void);
/*
* End of "$Id$".
*/
+36 -14
Ver Arquivo
@@ -132,13 +132,13 @@ main(int argc, /* I - Number of command-line args */
ipp_attribute_t *format_sup; /* document-format-supported */
ipp_attribute_t *printer_state; /* printer-state attribute */
ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */
int copies; /* Number of copies remaining */
int copies, /* Number of copies for job */
copies_remaining; /* Number of copies remaining */
const char *content_type; /* CONTENT_TYPE environment variable */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
int version; /* IPP version */
int reasons; /* Number of printer-state-reasons */
static const char * const pattrs[] =
{ /* Printer attributes we want */
"copies-supported",
@@ -211,7 +211,11 @@ main(int argc, /* I - Number of command-line args */
*/
if ((content_type = getenv("FINAL_CONTENT_TYPE")) == NULL)
content_type = "application/octet-stream";
if ((content_type = getenv("CONTENT_TYPE")) == NULL)
content_type = "application/octet-stream";
if (!strncmp(content_type, "printer/", 8))
content_type = "application/vnd.cups-raw";
/*
* Extract the hostname and printer name from the URI...
@@ -229,6 +233,8 @@ main(int argc, /* I - Number of command-line args */
if (!strcmp(method, "https"))
cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
else
cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
/*
* See if there are any options...
@@ -276,7 +282,7 @@ main(int argc, /* I - Number of command-line args */
*ptr++ = *optptr++;
*ptr = '\0';
if (*optptr == '+')
if (*optptr == '+' || *optptr == '&')
optptr ++;
}
else
@@ -733,19 +739,25 @@ main(int argc, /* I - Number of command-line args */
* See if the printer supports multiple copies...
*/
copies = atoi(argv[4]);
if (copies_sup || argc < 7)
copies = 1;
{
copies_remaining = 1;
if (argc < 7)
copies = 1;
}
else
copies = atoi(argv[4]);
copies_remaining = copies;
/*
* Then issue the print-job request...
*/
reasons = 0;
job_id = 0;
while (copies > 0)
while (copies_remaining > 0)
{
/*
* Build the IPP request...
@@ -772,7 +784,13 @@ main(int argc, /* I - Number of command-line args */
fprintf(stderr, "DEBUG: requesting-user-name = \"%s\"\n", argv[2]);
if (argv[3][0])
/*
* Only add a "job-name" attribute if the remote server supports
* copy generation - some IPP implementations like HP's don't seem
* to like UTF-8 job names (STR #1837)...
*/
if (argv[3][0] && copies_sup)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
argv[3]);
@@ -819,8 +837,9 @@ main(int argc, /* I - Number of command-line args */
* number of copies to 1...
*/
content_type = "application/postscript";
copies = 1;
content_type = "application/postscript";
copies = 1;
copies_remaining = 1;
}
}
#endif /* __APPLE__ */
@@ -848,8 +867,9 @@ main(int argc, /* I - Number of command-line args */
*/
cupsEncodeOptions(request, num_options, options);
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies",
atoi(argv[4]));
copies);
}
cupsFreeOptions(num_options, options);
@@ -949,13 +969,13 @@ main(int argc, /* I - Number of command-line args */
if (ipp_status <= IPP_OK_CONFLICT && argc > 6)
{
fprintf(stderr, "PAGE: 1 %d\n", copies_sup ? atoi(argv[4]) : 1);
copies --;
copies_remaining --;
}
else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
ipp_status == IPP_PRINTER_BUSY)
break;
else
copies --;
copies_remaining --;
/*
* Wait for the job to complete...
@@ -1297,6 +1317,8 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
#endif /* __APPLE__ */
exit(CUPS_BACKEND_AUTH_REQUIRED);
return (NULL); /* Eliminate compiler warning */
}
}
+1
Ver Arquivo
@@ -261,6 +261,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
/* We want to pass utf-8 characters, not re-map them (3071945) */
sanitize_title = 0;
/* Get the default timeout from a system preference... */
{
CFPropertyListRef pvalue; /* Preference value */
SInt32 toval; /* Timeout value */
+35 -192
Ver Arquivo
@@ -33,14 +33,7 @@
* Include necessary headers.
*/
#include <cups/backend.h>
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#include "ieee1284.c"
#include "backend-private.h"
#ifdef __hpux
# include <sys/time.h>
@@ -94,25 +87,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
int fp; /* Print file */
int print_fd, /* Print file */
device_fd; /* Parallel device */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int rbytes; /* Number of bytes read */
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 */
size_t tbytes; /* Total number of bytes written */
struct termios opts; /* Parallel port options */
fd_set input, /* Input set for select() */
output; /* Output set for select() */
int paperout; /* Paper out? */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
#ifdef __linux
unsigned int status; /* Port status (off-line, out-of-paper, etc.) */
#endif /* __linux */
/*
@@ -157,8 +139,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = 0;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -166,7 +148,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = open(argv[6], O_RDONLY)) < 0)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
@@ -206,7 +188,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
do
{
if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
if ((device_fd = open(resource, O_WRONLY | O_EXCL)) == -1)
{
if (getenv("CLASS") != NULL)
{
@@ -217,8 +199,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* available printer in the class.
*/
fputs("INFO: Unable to open parallel port, queuing on next printer in class...\n",
stderr);
fputs("INFO: Unable to open parallel port, queuing on next printer "
"in class...\n", stderr);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
@@ -231,23 +213,26 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (errno == EBUSY)
{
fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
fputs("INFO: Parallel 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);
fputs("INFO: Printer not connected; will retry in 30 seconds...\n",
stderr);
sleep(30);
}
else
{
fprintf(stderr, "ERROR: Unable to open parallel port device file \"%s\": %s\n",
fprintf(stderr,
"ERROR: Unable to open parallel port device file \"%s\": %s\n",
resource, strerror(errno));
return (CUPS_BACKEND_FAILED);
}
}
}
while (fd < 0);
while (device_fd < 0);
fputs("STATE: -connecting-to-device\n", stderr);
@@ -255,189 +240,47 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Set any options provided...
*/
tcgetattr(fd, &opts);
tcgetattr(device_fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Check printer status...
*/
paperout = 0;
#if defined(__linux) && defined(LP_POUTPA)
/*
* Show the printer status before we send the file...
*/
while (!ioctl(fd, LPGETSTATUS, &status))
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
if (status & LP_POUTPA)
{
fputs("WARNING: Media tray empty!\n", stderr);
fputs("STATUS: +media-tray-empty-error\n", stderr);
paperout = 1;
}
if (!(status & LP_PERRORP))
fputs("WARNING: Printer fault!\n", stderr);
else if (!(status & LP_PSELECD))
fputs("WARNING: Printer off-line.\n", stderr);
else
break;
sleep(5);
}
#endif /* __linux && LP_POUTPA */
/*
* 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 */
}
tcsetattr(device_fd, TCSANOW, &opts);
/*
* Finally, send the print file...
*/
wbytes = 0;
tbytes = 0;
while (copies > 0)
while (copies > 0 && tbytes >= 0)
{
copies --;
if (fp != 0)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
lseek(print_fd, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes = backendRunLoop(print_fd, device_fd, 1);
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
/*
* See if we are ready to read or write...
*/
do
{
FD_ZERO(&input);
FD_SET(fd, &input);
FD_ZERO(&output);
FD_SET(fd, &output);
}
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
if (FD_ISSET(fd, &input))
{
/*
* Read backchannel data...
*/
if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackChannelWrite(resource, rbytes, 1.0);
}
}
if (FD_ISSET(fd, &output))
{
/*
* Write print data...
*/
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
/*
* Check for retryable errors...
*/
if (errno == ENOSPC)
{
paperout = 1;
fputs("ERROR: Out of paper!\n", stderr);
fputs("STATUS: +media-tray-empty-error\n", stderr);
}
else if (errno != EAGAIN && errno != EINTR)
{
perror("ERROR: Unable to send print file to printer");
break;
}
}
else
{
/*
* Update count and pointer...
*/
if (paperout)
{
fputs("STATUS: -media-tray-empty-error\n", stderr);
paperout = 0;
}
nbytes -= wbytes;
bufptr += wbytes;
}
}
}
if (wbytes < 0)
break;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
if (print_fd != 0 && tbytes >= 0)
fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
CUPS_LLCAST tbytes);
}
/*
* Close the socket connection and input file and return...
*/
close(fd);
if (fp != 0)
close(fp);
close(device_fd);
return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
if (print_fd != 0)
close(print_fd);
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
@@ -485,9 +328,9 @@ list_devices(void)
* Now grab the IEEE 1284 device ID string...
*/
if (!get_device_id(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
NULL, NULL, 0))
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
NULL, NULL, 0))
printf("direct parallel:%s \"%s\" \"%s LPT #%d\" \"%s\"\n", device,
make_model, make_model, i + 1, device_id);
else
+262
Ver Arquivo
@@ -0,0 +1,262 @@
/*
* "$Id$"
*
* Common run loop API for the Common UNIX Printing System (CUPS).
*
* Copyright 2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* backendRunLoop() - Read and write print and back-channel data.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#ifdef __hpux
# include <sys/time.h>
#else
# include <sys/select.h>
#endif /* __hpux */
/*
* 'backendRunLoop()' - Read and write print and back-channel data.
*/
ssize_t /* O - Total bytes on success, -1 on error */
backendRunLoop(int print_fd, /* I - Print file descriptor */
int device_fd, /* I - Device file descriptor */
int use_bc) /* I - Use back-channel? */
{
int nfds; /* Maximum file descriptor value + 1 */
fd_set input, /* Input set for reading */
output; /* Output set for writing */
ssize_t print_bytes, /* Print bytes read */
bc_bytes, /* Backchannel bytes read */
total_bytes, /* Total bytes written */
bytes; /* Bytes written */
int paperout; /* "Paper out" status */
int offline; /* "Off-line" status */
char print_buffer[8192], /* Print data buffer */
*print_ptr, /* Pointer into print data buffer */
bc_buffer[1024]; /* Back-channel data buffer */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
fprintf(stderr, "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d)\n",
print_fd, device_fd, use_bc);
/*
* If we are printing data from a print driver on stdin, ignore SIGTERM
* so that the driver can finish out any page data, e.g. to eject the
* current page. We only do this for stdin printing as otherwise there
* is no way to cancel a raw print job...
*/
if (!print_fd)
{
#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 */
}
/*
* Figure out the maximum file descriptor value to use with select()...
*/
nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
/*
* Now loop until we are out of data from print_fd...
*/
for (print_bytes = 0, print_ptr = print_buffer, offline = 0, paperout = 0, total_bytes = 0;;)
{
/*
* Use select() to determine whether we have data to copy around...
*/
FD_ZERO(&input);
if (!print_bytes)
FD_SET(print_fd, &input);
if (use_bc)
FD_SET(device_fd, &input);
FD_ZERO(&output);
if (print_bytes || !use_bc)
FD_SET(device_fd, &output);
if (use_bc)
{
if (select(nfds, &input, &output, NULL, NULL) < 0)
{
/*
* Pause printing to clear any pending errors...
*/
if (errno == ENXIO && !offline)
{
fputs("STATE: +offline-error\n", stderr);
fputs("INFO: Printer is currently off-line.\n", stderr);
offline = 1;
}
sleep(1);
continue;
}
}
/*
* Check if we have back-channel data ready...
*/
if (FD_ISSET(device_fd, &input))
{
if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
{
fprintf(stderr,
"DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
CUPS_LLCAST bc_bytes);
cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
}
}
/*
* Check if we have print data ready...
*/
if (FD_ISSET(print_fd, &input))
{
if ((print_bytes = read(print_fd, print_buffer,
sizeof(print_buffer))) < 0)
{
/*
* Read error - bail if we don't see EAGAIN or EINTR...
*/
if (errno != EAGAIN || errno != EINTR)
{
perror("ERROR: Unable to read print data");
return (-1);
}
print_bytes = 0;
}
else if (print_bytes == 0)
{
/*
* End of file, break out of the loop...
*/
break;
}
print_ptr = print_buffer;
fprintf(stderr, "DEBUG: Read %d bytes of print data...\n",
(int)print_bytes);
}
/*
* Check if the device is ready to receive data and we have data to
* send...
*/
if (print_bytes && FD_ISSET(device_fd, &output))
{
if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
{
/*
* Write error - bail if we don't see an error we can retry...
*/
if (errno == ENOSPC)
{
if (!paperout)
{
fputs("ERROR: Out of paper!\n", stderr);
fputs("STATUS: +media-tray-empty-error\n", stderr);
paperout = 1;
}
}
else if (errno == ENXIO)
{
if (!offline)
{
fputs("STATE: +offline-error\n", stderr);
fputs("INFO: Printer is currently off-line.\n", stderr);
offline = 1;
}
}
else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
perror("ERROR: Unable to write print data");
return (-1);
}
}
else
{
if (paperout)
{
fputs("STATUS: -media-tray-empty-error\n", stderr);
paperout = 0;
}
if (offline)
{
fputs("STATE: -offline-error\n", stderr);
fputs("INFO: Printer is now on-line.\n", stderr);
offline = 0;
}
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
print_bytes -= bytes;
print_ptr += bytes;
total_bytes += bytes;
}
}
}
/*
* Return with success...
*/
return (total_bytes);
}
/*
* End of "$Id$".
*/
+188 -139
Ver Arquivo
@@ -33,13 +33,7 @@
* Include necessary headers.
*/
#include <cups/backend.h>
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#include "backend-private.h"
#ifdef __hpux
# include <sys/modem.h>
@@ -121,21 +115,23 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
int port; /* Port number (not used) */
int fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int rbytes; /* Number of bytes read */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
int print_fd, /* Print file */
device_fd; /* Serial device */
int nfds; /* Maximum file descriptor value + 1 */
fd_set input, /* Input set for reading */
output; /* Output set for writing */
ssize_t print_bytes, /* Print bytes read */
bc_bytes, /* Backchannel bytes read */
total_bytes, /* Total bytes written */
bytes; /* Bytes written */
int dtrdsr; /* Do dtr/dsr flow control? */
int bufsize; /* Size of output buffer for writes */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
int print_size; /* Size of output buffer for writes */
char print_buffer[8192], /* Print data buffer */
*print_ptr, /* Pointer into print data buffer */
bc_buffer[1024]; /* Back-channel data buffer */
struct termios opts; /* Serial port options */
struct termios origopts; /* Original port options */
fd_set input, /* Input set for select() */
output; /* Output set for select() */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -183,8 +179,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = 0;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -192,7 +188,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = open(argv[6], O_RDONLY)) < 0)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
@@ -232,7 +228,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
do
{
if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL | O_NDELAY)) == -1)
if ((device_fd = open(resource, O_RDWR | O_NOCTTY | O_EXCL |
O_NDELAY)) == -1)
{
if (getenv("CLASS") != NULL)
{
@@ -268,7 +265,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
}
}
while (fd < 0);
while (device_fd < 0);
fputs("STATE: -connecting-to-device\n", stderr);
@@ -276,16 +273,18 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Set any options provided...
*/
tcgetattr(fd, &origopts);
tcgetattr(fd, &opts);
tcgetattr(device_fd, &origopts);
tcgetattr(device_fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
opts.c_oflag &= ~OPOST; /* Don't post-process */
opts.c_lflag &= ~(ICANON | ECHO | ISIG);
/* Raw mode */
opts.c_oflag &= ~OPOST; /* Don't post-process */
bufsize = 96; /* 9600 baud / 10 bits/char / 10Hz */
dtrdsr = 0; /* No dtr/dsr flow control */
print_size = 96; /* 9600 baud / 10 bits/char / 10Hz */
dtrdsr = 0; /* No dtr/dsr flow control */
if (options != NULL)
if (options)
{
while (*options)
{
/*
@@ -310,7 +309,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
if (*options == '+' || *options == '&')
options ++;
}
else
@@ -326,7 +325,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Set the baud rate...
*/
bufsize = atoi(value) / 100;
print_size = atoi(value) / 100;
#if B19200 == 19200
cfsetispeed(&opts, atoi(value));
@@ -488,9 +487,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
}
}
}
tcsetattr(fd, TCSANOW, &opts);
fcntl(fd, F_SETFL, 0);
tcsetattr(device_fd, TCSANOW, &opts);
fcntl(device_fd, F_SETFL, 0);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
@@ -499,7 +499,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* stdin (otherwise you can't cancel raw jobs...)
*/
if (argc < 7)
if (print_fd != 0)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
@@ -515,133 +515,181 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
/*
* Finally, send the print file...
* Figure out the maximum file descriptor value to use with select()...
*/
if (bufsize > sizeof(buffer))
bufsize = sizeof(buffer);
nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
wbytes = 0;
/*
* Finally, send the print file. Ordinarily we would just use the
* backendRunLoop() function, however since we need to use smaller
* writes and may need to do DSR/DTR flow control, we duplicate much
* of the code here instead...
*/
if (print_size > sizeof(print_buffer))
print_size = sizeof(print_buffer);
total_bytes = 0;
while (copies > 0)
{
copies --;
if (fp != 0)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
lseek(print_fd, 0, SEEK_SET);
}
if (dtrdsr)
/*
* Now loop until we are out of data from print_fd...
*/
for (print_bytes = 0, print_ptr = print_buffer;;)
{
/*
* Check the port and sleep until DSR is set...
* Use select() to determine whether we have data to copy around...
*/
int status;
FD_ZERO(&input);
if (!print_bytes)
FD_SET(print_fd, &input);
FD_SET(device_fd, &input);
FD_ZERO(&output);
if (print_bytes)
FD_SET(device_fd, &output);
if (!ioctl(fd, TIOCMGET, &status))
if (!(status & TIOCM_DSR))
{
/*
* Wait for DSR to go high...
*/
if (select(nfds, &input, &output, NULL, NULL) < 0)
continue; /* Ignore errors here */
fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
do
{
sleep(1);
if (ioctl(fd, TIOCMGET, &status))
break;
}
while (!(status & TIOCM_DSR));
fputs("DEBUG: DSR is high; writing to device...\n", stderr);
}
}
tbytes = 0;
while ((nbytes = read(fp, buffer, bufsize)) > 0)
{
/*
* Write the print data to the printer...
* Check if we have back-channel data ready...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
if (FD_ISSET(device_fd, &input))
{
/*
* See if we are ready to read or write...
*/
do
if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
{
FD_ZERO(&input);
FD_SET(fd, &input);
FD_ZERO(&output);
FD_SET(fd, &output);
}
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
if (FD_ISSET(fd, &input))
{
/*
* Read backchannel data...
*/
if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackChannelWrite(resource, rbytes, 1.0);
}
}
if (FD_ISSET(fd, &output))
{
/*
* Write print data...
*/
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
/*
* Check for retryable errors...
*/
if (errno != EAGAIN && errno != EINTR)
{
perror("ERROR: Unable to send print file to printer");
break;
}
}
else
{
/*
* Update count and pointer...
*/
nbytes -= wbytes;
bufptr += wbytes;
}
fprintf(stderr,
"DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
CUPS_LLCAST bc_bytes);
cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
}
}
if (wbytes < 0)
break;
/*
* Check if we have print data ready...
*/
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
if (FD_ISSET(print_fd, &input))
{
if ((print_bytes = read(print_fd, print_buffer, print_size)) < 0)
{
/*
* Read error - bail if we don't see EAGAIN or EINTR...
*/
if (errno != EAGAIN || errno != EINTR)
{
perror("ERROR: Unable to read print data");
tcsetattr(device_fd, TCSADRAIN, &origopts);
close(device_fd);
if (print_fd != 0)
close(print_fd);
return (CUPS_BACKEND_FAILED);
}
print_bytes = 0;
}
else if (print_bytes == 0)
{
/*
* End of file, break out of the loop...
*/
break;
}
print_ptr = print_buffer;
}
/*
* Check if the device is ready to receive data and we have data to
* send...
*/
if (print_bytes && FD_ISSET(device_fd, &output))
{
if (dtrdsr)
{
/*
* Check the port and sleep until DSR is set...
*/
int status;
if (!ioctl(device_fd, TIOCMGET, &status))
if (!(status & TIOCM_DSR))
{
/*
* Wait for DSR to go high...
*/
fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
do
{
/*
* Poll every 100ms...
*/
usleep(100000);
if (ioctl(device_fd, TIOCMGET, &status))
break;
}
while (!(status & TIOCM_DSR));
fputs("DEBUG: DSR is high; writing to device...\n", stderr);
}
}
if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
{
/*
* Write error - bail if we don't see an error we can retry...
*/
if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
perror("ERROR: Unable to write print data");
tcsetattr(device_fd, TCSADRAIN, &origopts);
close(device_fd);
if (print_fd != 0)
close(print_fd);
return (CUPS_BACKEND_FAILED);
}
}
else
{
fprintf(stderr, "DEBUG: Wrote %d bytes...\n", (int)bytes);
print_bytes -= bytes;
print_ptr += bytes;
total_bytes += bytes;
}
}
}
}
@@ -649,13 +697,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Close the serial port and input file and return...
*/
tcsetattr(fd, TCSADRAIN, &origopts);
tcsetattr(device_fd, TCSADRAIN, &origopts);
close(fd);
if (fp != 0)
close(fp);
close(device_fd);
return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
if (print_fd != 0)
close(print_fd);
return (total_bytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
+286 -46
Ver Arquivo
@@ -52,6 +52,7 @@
* packed integer value.
* compare_cache() - Compare two cache entries.
* debug_printf() - Display some debugging information.
* do_request() - Do a non-blocking IPP request.
* fix_make_model() - Fix common problems in the make-and-model
* string.
* free_array() - Free an array of strings.
@@ -59,7 +60,7 @@
* get_interface_addresses() - Get the broadcast address(es) associated
* with an interface.
* hex_debug() - Output hex debugging data...
* list_devices() - List all of the devices we found...
* list_device() - List a device we found...
* open_snmp_socket() - Open the SNMP broadcast socket.
* password_cb() - Handle authentication requests.
* probe_device() - Probe a device to discover whether it is a
@@ -77,17 +78,10 @@
* Include necessary headers.
*/
#include <cups/backend.h>
#include <cups/http-private.h>
#include <cups/cups.h>
#include <cups/string.h>
#include "backend-private.h"
#include <cups/array.h>
#include <cups/file.h>
#include <errno.h>
#include <signal.h>
#define SNMP_BACKEND
#include "ieee1284.c"
/*
@@ -200,6 +194,13 @@ typedef struct snmp_packet_s /**** SNMP packet ****/
} snmp_packet_t;
/*
* Private CUPS API to set the last error...
*/
extern void _cupsSetError(ipp_status_t status, const char *message);
/*
* Local functions...
*/
@@ -245,6 +246,8 @@ static int asn1_size_oid(const int *oid);
static int asn1_size_packed(int integer);
static int compare_cache(snmp_cache_t *a, snmp_cache_t *b);
static void debug_printf(const char *format, ...);
static ipp_t *do_request(http_t *http, ipp_t *request,
const char *resource);
static void fix_make_model(char *make_model,
const char *old_make_model,
int make_model_size);
@@ -252,7 +255,7 @@ static void free_array(cups_array_t *a);
static void free_cache(void);
static http_addrlist_t *get_interface_addresses(const char *ifname);
static void hex_debug(unsigned char *buffer, size_t len);
static void list_devices(void);
static void list_device(snmp_cache_t *cache);
static int open_snmp_socket(void);
static const char *password_cb(const char *prompt);
static void probe_device(snmp_cache_t *device);
@@ -285,6 +288,7 @@ static int DeviceDescOID[] = { 1, 3, 6, 1, 2, 1, 25, 3,
static unsigned DeviceTypeRequest;
static unsigned DeviceDescRequest;
static int HostNameLookups = 0;
static int MaxRunTime = 10;
static struct timeval StartTime;
@@ -297,6 +301,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
int fd; /* SNMP socket */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
@@ -315,6 +322,23 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
cupsSetPasswordCB(password_cb);
/*
* Catch SIGALRM signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGALRM, alarm_handler);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGALRM);
action.sa_handler = alarm_handler;
sigaction(SIGALRM, &action, NULL);
#else
signal(SIGALRM, alarm_handler);
#endif /* HAVE_SIGSET */
/*
* Open the SNMP socket...
*/
@@ -336,12 +360,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
scan_devices(fd);
/*
* Display the results...
*/
list_devices();
/*
* Close, free, and return with no errors...
*/
@@ -391,7 +409,7 @@ add_cache(http_addr_t *addr, /* I - Device IP address */
debug_printf("DEBUG: add_cache(addr=%p, addrname=\"%s\", uri=\"%s\", "
"id=\"%s\", make_and_model=\"%s\")\n",
addr, addrname, uri, id ? id : "(null)",
addr, addrname, uri ? uri : "(null)", id ? id : "(null)",
make_and_model ? make_and_model : "(null)");
temp = calloc(1, sizeof(snmp_cache_t));
@@ -409,6 +427,9 @@ add_cache(http_addr_t *addr, /* I - Device IP address */
temp->make_and_model = strdup(make_and_model);
cupsArrayAdd(Devices, temp);
if (uri)
list_device(temp);
}
@@ -425,6 +446,10 @@ alarm_handler(int sig) /* I - Signal number */
(void)sig;
#if !defined(HAVE_SIGSET) && !defined(HAVE_SIGACTION)
signal(SIGALRM, alarm_handler);
#endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
if (DebugLevel)
write(2, "DEBUG: ALARM!\n", 14);
}
@@ -1210,7 +1235,7 @@ static int /* O - Result of comparison */
compare_cache(snmp_cache_t *a, /* I - First cache entry */
snmp_cache_t *b) /* I - Second cache entry */
{
return (a->address.ipv4.sin_addr.s_addr - b->address.ipv4.sin_addr.s_addr);
return (strcasecmp(a->addrname, b->addrname));
}
@@ -1234,6 +1259,173 @@ debug_printf(const char *format, /* I - Printf-style format string */
}
/*
* 'do_request()' - Do a non-blocking IPP request.
*/
static ipp_t * /* O - Response data or NULL */
do_request(http_t *http, /* I - HTTP connection to server */
ipp_t *request, /* I - IPP request */
const char *resource) /* I - HTTP resource for POST */
{
ipp_t *response; /* IPP response data */
http_status_t status; /* Status of HTTP request */
ipp_state_t state; /* State of IPP processing */
/*
* Setup the HTTP variables needed...
*/
httpClearFields(http);
httpSetLength(http, ippLength(request));
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
/*
* Do the POST request...
*/
debug_printf("DEBUG: %.3f POST %s...\n", run_time(), resource);
if (httpPost(http, resource))
{
if (httpReconnect(http))
{
_cupsSetError(IPP_DEVICE_ERROR, "Unable to reconnect");
return (NULL);
}
else if (httpPost(http, resource))
{
_cupsSetError(IPP_GONE, "Unable to POST");
return (NULL);
}
}
/*
* Send the IPP data...
*/
request->state = IPP_IDLE;
status = HTTP_CONTINUE;
while ((state = ippWrite(http, request)) != IPP_DATA)
if (state == IPP_ERROR)
{
status = HTTP_ERROR;
break;
}
else if (httpCheck(http))
{
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
break;
}
/*
* Get the server's return status...
*/
debug_printf("DEBUG: %.3f Getting response...\n", run_time());
while (status == HTTP_CONTINUE)
if (httpWait(http, 1000))
status = httpUpdate(http);
else
{
status = HTTP_ERROR;
http->error = ETIMEDOUT;
}
if (status != HTTP_OK)
{
/*
* Flush any error message...
*/
httpFlush(http);
response = NULL;
}
else
{
/*
* Read the response...
*/
response = ippNew();
while ((state = ippRead(http, response)) != IPP_DATA)
if (state == IPP_ERROR)
{
/*
* Delete the response...
*/
ippDelete(response);
response = NULL;
_cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno));
break;
}
}
/*
* Delete the original request and return the response...
*/
ippDelete(request);
if (response)
{
ipp_attribute_t *attr; /* status-message attribute */
attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
_cupsSetError(response->request.status.status_code,
attr ? attr->values[0].string.text :
ippErrorString(response->request.status.status_code));
}
else if (status != HTTP_OK)
{
switch (status)
{
case HTTP_NOT_FOUND :
_cupsSetError(IPP_NOT_FOUND, httpStatus(status));
break;
case HTTP_UNAUTHORIZED :
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
break;
case HTTP_FORBIDDEN :
_cupsSetError(IPP_FORBIDDEN, httpStatus(status));
break;
case HTTP_BAD_REQUEST :
_cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
break;
case HTTP_REQUEST_TOO_LARGE :
_cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
break;
case HTTP_NOT_IMPLEMENTED :
_cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
break;
case HTTP_NOT_SUPPORTED :
_cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
break;
default :
_cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
break;
}
}
return (response);
}
/*
* 'fix_make_model()' - Fix common problems in the make-and-model string.
*/
@@ -1295,6 +1487,16 @@ fix_make_model(
_cups_strcpy(mmptr, mmptr + 7);
}
if ((mmptr = strstr(make_model, " Network")) != NULL)
{
/*
* Drop unnecessary informational text, e.g. "Xerox DocuPrint N2025
* Network LaserJet - 2.12" becomes "Xerox DocuPrint N2025"...
*/
*mmptr = '\0';
}
if ((mmptr = strchr(make_model, ',')) != NULL)
{
/*
@@ -1429,24 +1631,18 @@ hex_debug(unsigned char *buffer, /* I - Buffer */
/*
* 'list_devices()' - List all of the devices we found...
* 'list_device()' - List a device we found...
*/
static void
list_devices(void)
list_device(snmp_cache_t *cache) /* I - Cached device */
{
snmp_cache_t *cache; /* Cached device */
for (cache = (snmp_cache_t *)cupsArrayFirst(Devices);
cache;
cache = (snmp_cache_t *)cupsArrayNext(Devices))
if (cache->uri)
printf("network %s \"%s\" \"%s %s\" \"%s\"\n",
cache->uri,
cache->make_and_model ? cache->make_and_model : "Unknown",
cache->make_and_model ? cache->make_and_model : "Unknown",
cache->addrname, cache->id ? cache->id : "");
if (cache->uri)
printf("network %s \"%s\" \"%s %s\" \"%s\"\n",
cache->uri,
cache->make_and_model ? cache->make_and_model : "Unknown",
cache->make_and_model ? cache->make_and_model : "Unknown",
cache->addrname, cache->id ? cache->id : "");
}
@@ -1531,7 +1727,29 @@ probe_device(snmp_cache_t *device) /* I - Device */
debug_printf("DEBUG: %.3f Probing %s...\n", run_time(), device->addrname);
if ((http = httpConnect(device->addrname, 631)) != NULL)
if (device->make_and_model &&
(!strncasecmp(device->make_and_model, "Xerox", 5) ||
!strncasecmp(device->make_and_model, "Kyocera", 7)))
{
/*
* Xerox and Kyocera printers often lock up on IPP probes, so exclude
* them from the IPP connection test...
*/
http = NULL;
}
else
{
/*
* Otherwise, try connecting for up to 1 second...
*/
alarm(1);
http = httpConnect(device->addrname, 631);
alarm(0);
}
if (http);
{
/*
* IPP is supported...
@@ -1558,8 +1776,6 @@ probe_device(snmp_cache_t *device) /* I - Device */
};
debug_printf("DEBUG: %s supports IPP!\n", device->addrname);
/*
* Use non-blocking IO...
*/
@@ -1575,6 +1791,13 @@ probe_device(snmp_cache_t *device) /* I - Device */
i < (int)(sizeof(resources) / sizeof(resources[0]));
i ++)
{
/*
* Stop early if we are out of time...
*/
if (MaxRunTime > 0 && run_time() >= MaxRunTime)
break;
/*
* Don't look past /ipp if we have found a working URI...
*/
@@ -1585,16 +1808,14 @@ probe_device(snmp_cache_t *device) /* I - Device */
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
device->addrname, 631, resources[i]);
debug_printf("DEBUG: Trying %s (num_uris=%d)\n", uri, num_uris);
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
response = cupsDoRequest(http, request, resources[i]);
response = do_request(http, request, resources[i]);
debug_printf("DEBUG: %s %s (%s)\n", uri,
debug_printf("DEBUG: %.3f %s %s (%s)\n", run_time(), uri,
ippErrorString(cupsLastError()), cupsLastErrorString());
if (response && response->request.status.status_code == IPP_OK)
@@ -1647,6 +1868,14 @@ probe_device(snmp_cache_t *device) /* I - Device */
!strchr(info->values[0].string.text, ';')))
info = NULL;
/*
* Don't use the printer-make-and-model if it contains a generic
* string like "Ricoh IPP Printer"...
*/
if (model && strstr(model->values[0].string.text, "IPP Printer"))
model = NULL;
/*
* If we don't have a printer-make-and-model string from the printer
* but do have the 1284 device ID string, generate a make-and-model
@@ -1656,7 +1885,9 @@ probe_device(snmp_cache_t *device) /* I - Device */
if (model)
strlcpy(temp, model->values[0].string.text, sizeof(temp));
else if (info)
get_make_model(info->values[0].string.text, temp, sizeof(temp));
backendGetMakeModel(info->values[0].string.text, temp, sizeof(temp));
else
temp[0] = '\0';
fix_make_model(make_model, temp, sizeof(make_model));
@@ -1723,6 +1954,7 @@ read_snmp_conf(const char *address) /* I - Single address to probe */
int linenum; /* Line number */
const char *cups_serverroot; /* CUPS_SERVERROOT env var */
const char *debug; /* CUPS_DEBUG_LEVEL env var */
const char *runtime; /* CUPS_MAX_RUN_TIME env var */
/*
@@ -1738,6 +1970,9 @@ read_snmp_conf(const char *address) /* I - Single address to probe */
if ((debug = getenv("CUPS_DEBUG_LEVEL")) != NULL)
DebugLevel = atoi(debug);
if ((runtime = getenv("CUPS_MAX_RUN_TIME")) != NULL)
MaxRunTime = atoi(runtime);
/*
* Find the snmp.conf file...
*/
@@ -1774,6 +2009,8 @@ read_snmp_conf(const char *address) /* I - Single address to probe */
!strcasecmp(value, "yes") ||
!strcasecmp(value, "true") ||
!strcasecmp(value, "double");
else if (!strcasecmp(line, "MaxRunTime"))
MaxRunTime = atoi(value);
else
fprintf(stderr, "ERROR: Unknown directive %s on line %d of %s!\n",
line, linenum, filename);
@@ -1871,8 +2108,8 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
* Find a matching device in the cache...
*/
key.address = addr;
device = (snmp_cache_t *)cupsArrayFind(Devices, &key);
key.addrname = addrname;
device = (snmp_cache_t *)cupsArrayFind(Devices, &key);
/*
* Process the message...
@@ -1928,8 +2165,8 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
* Description is the IEEE-1284 device ID...
*/
get_make_model(packet.object_value.string, make_model,
sizeof(make_model));
backendGetMakeModel(packet.object_value.string, make_model,
sizeof(make_model));
}
else
{
@@ -2072,7 +2309,9 @@ scan_devices(int fd) /* I - SNMP socket */
for (device = (snmp_cache_t *)cupsArrayFirst(Devices);
device;
device = (snmp_cache_t *)cupsArrayNext(Devices))
if (!device->uri)
if (MaxRunTime > 0 && run_time() >= MaxRunTime)
break;
else if (!device->uri)
probe_device(device);
debug_printf("DEBUG: %.3f Scan complete!\n", run_time());
@@ -2166,7 +2405,6 @@ try_connect(http_addr_t *addr, /* I - Socket address */
addr->ipv4.sin_port = htons(port);
signal(SIGALRM, alarm_handler);
alarm(1);
status = connect(fd, (void *)addr, httpAddrLength(addr));
@@ -2208,6 +2446,8 @@ update_cache(snmp_cache_t *device, /* I - Device */
device->make_and_model = strdup(make_model);
}
list_device(device);
}
+101 -206
Ver Arquivo
@@ -32,17 +32,11 @@
* Include necessary headers.
*/
#include <cups/backend.h>
#include <cups/http-private.h>
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include "backend-private.h"
#include <stdarg.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef WIN32
# include <winsock.h>
@@ -76,24 +70,19 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
name[255], /* Name of option */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
int fp; /* Print file */
int print_fd; /* Print file */
int copies; /* Number of copies to print */
int waiteof; /* Wait for end-of-file? */
int port; /* Port number */
char portname[255]; /* Port name */
int delay; /* Delay for retries... */
int fd; /* AppSocket */
int device_fd; /* AppSocket */
int error; /* Error code (if any) */
http_addrlist_t *addrlist; /* Address list */
int rbytes; /* Number of bytes read */
int wbytes; /* 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 */
ssize_t tbytes; /* Total number of bytes written */
struct timeval timeout; /* Timeout for select() */
fd_set input, /* Input set for select() */
output; /* Output set for select() */
fd_set input; /* Input set for select() */
ssize_t bc_bytes; /* Number of back-channel bytes read */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -142,8 +131,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = 0;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -151,7 +140,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = open(argv[6], O_RDONLY)) < 0)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
@@ -252,242 +241,148 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
hostname, port);
wbytes = 0;
fputs("STATE: +connecting-to-device\n", stderr);
while (copies > 0)
for (delay = 5;;)
{
fputs("STATE: +connecting-to-device\n", stderr);
for (delay = 5;;)
if (!httpAddrConnect(addrlist, &device_fd))
{
if (!httpAddrConnect(addrlist, &fd))
error = errno;
device_fd = -1;
if (getenv("CLASS") != NULL)
{
error = errno;
fd = -1;
/*
* If the CLASS environment variable is set, the job was submitted
* to a class and not to a specific queue. In this case, we want
* to abort immediately so that the job can be requeued on the next
* available printer in the class.
*/
if (getenv("CLASS") != NULL)
{
/*
* If the CLASS environment variable is set, the job was submitted
* to a class and not to a specific queue. In this case, we want
* to abort immediately so that the job can be requeued on the next
* available printer in the class.
*/
fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
hostname);
fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
hostname);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
sleep(5);
return (CUPS_BACKEND_FAILED);
}
return (CUPS_BACKEND_FAILED);
}
if (error == ECONNREFUSED || error == EHOSTDOWN ||
error == EHOSTUNREACH)
{
fprintf(stderr,
"INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
hostname, delay);
sleep(delay);
if (error == ECONNREFUSED || error == EHOSTDOWN ||
error == EHOSTUNREACH)
{
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
hostname, delay);
sleep(delay);
if (delay < 30)
delay += 5;
}
else
{
perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
sleep(30);
}
if (delay < 30)
delay += 5;
}
else
break;
{
perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
sleep(30);
}
}
else
break;
}
fputs("STATE: -connecting-to-device\n", stderr);
fputs("STATE: -connecting-to-device\n", stderr);
/*
* 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...)
*/
/*
* Print everything...
*/
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...
*/
tbytes = 0;
while (copies > 0 && tbytes >= 0)
{
copies --;
if (fp != 0)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
lseek(print_fd, 0, SEEK_SET);
}
fputs("INFO: Connected to host, sending print job...\n", stderr);
tbytes = backendRunLoop(print_fd, device_fd, 1);
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
if (print_fd != 0 && tbytes >= 0)
fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
CUPS_LLCAST tbytes);
}
if (waiteof)
{
/*
* Shutdown the socket and wait for the other end to finish...
*/
fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
shutdown(device_fd, 1);
for (;;)
{
/*
* Write the print data to the printer...
* Wait a maximum of 90 seconds for backchannel data or a closed
* connection...
*/
tbytes += nbytes;
bufptr = buffer;
timeout.tv_sec = 90;
timeout.tv_usec = 0;
while (nbytes > 0)
FD_ZERO(&input);
FD_SET(device_fd, &input);
#ifdef __hpux
if (select(device_fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
#else
if (select(device_fd + 1, &input, NULL, NULL, &timeout) > 0)
#endif /* __hpux */
{
/*
* See if we are ready to read or write...
* Grab the data coming back and spit it out to stderr...
*/
do
if ((bc_bytes = read(device_fd, resource, sizeof(resource))) > 0)
{
FD_ZERO(&input);
FD_SET(fd, &input);
FD_ZERO(&output);
FD_SET(fd, &output);
}
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
if (FD_ISSET(fd, &input))
{
/*
* Read backchannel data...
*/
if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackChannelWrite(resource, rbytes, 1.0);
}
}
if (FD_ISSET(fd, &output))
{
/*
* Write print data...
*/
if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
{
/*
* Check for retryable errors...
*/
if (errno != EAGAIN && errno != EINTR)
{
perror("ERROR: Unable to send print file to printer");
break;
}
}
else
{
/*
* Update count and pointer...
*/
nbytes -= wbytes;
bufptr += wbytes;
}
}
}
if (wbytes < 0)
break;
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
if (waiteof)
{
/*
* Shutdown the socket and wait for the other end to finish...
*/
fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
shutdown(fd, 1);
for (;;)
{
/*
* Wait a maximum of 90 seconds for backchannel data or a closed
* connection...
*/
timeout.tv_sec = 90;
timeout.tv_usec = 0;
FD_ZERO(&input);
FD_SET(fd, &input);
#ifdef __hpux
if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
#else
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
#endif /* __hpux */
{
/*
* Grab the data coming back and spit it out to stderr...
*/
if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackChannelWrite(resource, rbytes, 1.0);
}
else
break;
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
(int)bc_bytes);
cupsBackChannelWrite(resource, bc_bytes, 1.0);
}
else
break;
}
else
break;
}
/*
* Close the socket connection...
*/
close(fd);
}
/*
* Close the socket connection...
*/
close(device_fd);
httpAddrFreeList(addrlist);
/*
* Close the input file and return...
*/
if (fp != 0)
close(fp);
if (print_fd != 0)
close(print_fd);
if (wbytes >= 0)
if (tbytes >= 0)
fputs("INFO: Ready to print.\n", stderr);
return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
+3 -2
Ver Arquivo
@@ -41,6 +41,7 @@
# include <unistd.h>
# include <fcntl.h>
#endif /* WIN32 */
#define DEBUG
#include "ieee1284.c"
@@ -76,8 +77,8 @@ main(int argc, /* I - Number of command-line args */
printf("%s:\n", argv[i]);
get_device_id(fd, device_id, sizeof(device_id), make_model,
sizeof(make_model), "test", uri, sizeof(uri));
backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
sizeof(make_model), "test", uri, sizeof(uri));
printf(" device_id=\"%s\"\n", device_id);
printf(" make_model=\"%s\"\n", make_model);
+1 -1
Ver Arquivo
@@ -1310,7 +1310,7 @@ static void *read_thread(void *reference)
*/
start = mach_absolute_time();
rbytes = sizeof(readbuffer) - 1;
rbytes = sizeof(readbuffer);
readstatus = (*classdriver)->ReadPipe( classdriver, readbuffer, &rbytes );
if ( kIOReturnSuccess == readstatus && rbytes > 0 ) {
+87 -199
Ver Arquivo
@@ -27,8 +27,9 @@
*
* Contents:
*
* main() - Send a file to the specified USB port.
* print_device() - Print a file to a USB device.
* list_devices() - List all USB devices.
* open_device() - Open a USB device...
*/
/*
@@ -43,7 +44,7 @@
* Local functions...
*/
int open_device(const char *uri);
int open_device(const char *uri, int *use_bc);
/*
@@ -55,29 +56,16 @@ 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 print_fd, /* I - File descriptor to print */
int copies, /* I - Copies to print */
int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
int fd; /* USB device */
int rbytes; /* Number of bytes read */
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 */
backbuf[1024]; /* Backchannel buffer */
int use_bc; /* Use backchannel path? */
int device_fd; /* USB device */
size_t tbytes; /* Total number of bytes written */
struct termios opts; /* Parallel port options */
fd_set input, /* Input set for select() */
output; /* Output set for select() */
int paperout; /* Paper out? */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
#ifdef __linux
unsigned int status; /* Port status (off-line, out-of-paper, etc.) */
#endif /* __linux */
(void)argc;
(void)argv;
@@ -90,7 +78,15 @@ print_device(const char *uri, /* I - Device URI */
do
{
if ((fd = open_device(uri)) == -1)
/*
* Disable backchannel data when printing to Canon USB printers - apparently
* Canon printers will return the IEEE-1284 device ID over and over and over
* when they get a read request...
*/
use_bc = strcasecmp(hostname, "Canon") != 0;
if ((device_fd = open_device(uri, &use_bc)) == -1)
{
if (getenv("CLASS") != NULL)
{
@@ -118,7 +114,8 @@ print_device(const char *uri, /* I - Device URI */
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT || errno == ENODEV)
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
errno == ENODEV)
{
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
sleep(30);
@@ -131,7 +128,7 @@ print_device(const char *uri, /* I - Device URI */
}
}
}
while (fd < 0);
while (device_fd < 0);
fputs("STATE: -connecting-to-device\n", stderr);
@@ -139,187 +136,44 @@ print_device(const char *uri, /* I - Device URI */
* Set any options provided...
*/
tcgetattr(fd, &opts);
tcgetattr(device_fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Check printer status...
*/
paperout = 0;
#if defined(__linux) && defined(LP_POUTPA)
/*
* Show the printer status before we send the file...
*/
while (!ioctl(fd, LPGETSTATUS, &status))
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
if (status & LP_POUTPA)
{
fputs("WARNING: Media tray empty!\n", stderr);
fputs("STATUS: +media-tray-empty-error\n", stderr);
paperout = 1;
}
if (!(status & LP_PERRORP))
fputs("WARNING: Printer fault!\n", stderr);
else if (!(status & LP_PSELECD))
fputs("WARNING: Printer off-line.\n", stderr);
else
break;
sleep(5);
}
#endif /* __linux && LP_POUTPA */
/*
* 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 */
}
tcsetattr(device_fd, TCSANOW, &opts);
/*
* Finally, send the print file...
*/
wbytes = 0;
tbytes = 0;
while (copies > 0)
while (copies > 0 && tbytes >= 0)
{
copies --;
if (fp != 0)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
lseek(print_fd, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes = backendRunLoop(print_fd, device_fd, use_bc);
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
/*
* See if we are ready to read or write...
*/
do
{
FD_ZERO(&input);
FD_SET(fd, &input);
FD_ZERO(&output);
FD_SET(fd, &output);
}
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
if (FD_ISSET(fd, &input))
{
/*
* Read backchannel data...
*/
if ((rbytes = read(fd, backbuf, sizeof(backbuf))) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
rbytes);
cupsBackChannelWrite(backbuf, rbytes, 1.0);
}
}
if (FD_ISSET(fd, &output))
{
/*
* Write print data...
*/
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
/*
* Check for retryable errors...
*/
if (errno == ENOSPC)
{
paperout = 1;
fputs("ERROR: Out of paper!\n", stderr);
fputs("STATUS: +media-tray-empty-error\n", stderr);
}
else if (errno != EAGAIN && errno != EINTR)
{
perror("ERROR: Unable to send print file to printer");
break;
}
}
else
{
/*
* Update count and pointer...
*/
if (paperout)
{
fputs("STATUS: -media-tray-empty-error\n", stderr);
paperout = 0;
}
nbytes -= wbytes;
bufptr += wbytes;
}
}
}
if (wbytes < 0)
break;
if (fp)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
if (print_fd != 0 && tbytes >= 0)
fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
CUPS_LLCAST tbytes);
}
/*
* Close the USB port and return...
*/
close(fd);
close(device_fd);
return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
@@ -361,9 +215,9 @@ list_devices(void)
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (!get_device_id(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
@@ -388,11 +242,11 @@ list_devices(void)
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
{
if (!get_device_id(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
@@ -425,8 +279,12 @@ list_devices(void)
*/
int /* O - File descriptor or -1 on error */
open_device(const char *uri) /* I - Device URI */
open_device(const char *uri, /* I - Device URI */
int *use_bc) /* O - Set to 0 for unidirectional */
{
int fd; /* File descriptor */
/*
* The generic implementation just treats the URI as a device filename...
* Specific operating systems may also support using the device serial
@@ -435,7 +293,14 @@ open_device(const char *uri) /* I - Device URI */
if (!strncmp(uri, "usb:/dev/", 9))
#ifdef __linux
return (-1); /* Do not allow direct devices anymore */
{
/*
* Do not allow direct devices anymore...
*/
errno = ENODEV;
return (-1);
}
else if (!strncmp(uri, "usb://", 6))
{
/*
@@ -444,7 +309,6 @@ open_device(const char *uri) /* I - Device URI */
int i; /* Looping var */
int busy; /* Are any ports busy? */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
@@ -475,9 +339,9 @@ open_device(const char *uri) /* I - Device URI */
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
get_device_id(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri));
backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri));
}
else
{
@@ -534,7 +398,14 @@ open_device(const char *uri) /* I - Device URI */
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
return (-1); /* Do not allow direct devices anymore */
{
/*
* Do not allow direct devices anymore...
*/
errno = ENODEV;
return (-1);
}
else if (!strncmp(uri, "usb://", 6))
{
/*
@@ -543,7 +414,6 @@ open_device(const char *uri) /* I - Device URI */
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 */
@@ -560,10 +430,10 @@ open_device(const char *uri) /* I - Device URI */
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
get_device_id(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri));
if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri));
else
{
/*
@@ -578,7 +448,17 @@ open_device(const char *uri) /* I - Device URI */
}
if (!strcmp(uri, device_uri))
return (fd); /* Yes, return this file descriptor... */
{
/*
* Yes, return this file descriptor...
*/
fputs("DEBUG: Setting use_bc to 0!\n", stderr);
*use_bc = 0;
return (fd);
}
/*
* This wasn't the one...
@@ -611,7 +491,15 @@ open_device(const char *uri) /* I - Device URI */
return (-1);
}
#else
return (open(uri + 4, O_RDWR | O_EXCL));
{
if ((fd = open(uri + 4, O_RDWR | O_EXCL)) < 0)
{
fd = open(uri + 4, O_WRONLY | O_EXCL);
*use_bc = 0;
}
return (fd);
}
#endif /* __linux */
else
{
+11 -10
Ver Arquivo
@@ -63,7 +63,7 @@
void list_devices(void);
int print_device(const char *uri, const char *hostname,
const char *resource, const char *options,
int fp, int copies, int argc, char *argv[]);
int print_fd, int copies, int argc, char *argv[]);
/*
@@ -108,7 +108,7 @@ 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 print_fd, /* I - File descriptor to print */
int copies, /* I - Copies to print */
int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
@@ -124,7 +124,7 @@ print_device(const char *uri, /* I - Device URI */
(void)hostname;
(void)resource;
(void)options;
(void)fp;
(void)print_fd;
(void)copies;
(void)argc;
(void)argv;
@@ -146,7 +146,7 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
int fp; /* Print file */
int print_fd; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
int port; /* Port number (not used) */
@@ -232,8 +232,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = 0;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -241,7 +241,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = open(argv[6], O_RDONLY)) < 0)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
fprintf(stderr, "ERROR: unable to open print file %s - %s\n",
argv[6], strerror(errno));
@@ -255,14 +255,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Finally, send the print file...
*/
status = print_device(uri, hostname, resource, options, fp, copies, argc, argv);
status = print_device(uri, hostname, resource, options, print_fd, copies,
argc, argv);
/*
* Close the input file and return...
*/
if (fp != 0)
close(fp);
if (print_fd != 0)
close(print_fd);
return (status);
}
+2
Ver Arquivo
@@ -65,6 +65,8 @@ main(int argc, /* I - Number of command-line arguments */
*params; /* Pointer to parameters */
_cupsSetLocale();
/*
* Connect to the scheduler...
*/
+2 -3
Ver Arquivo
@@ -76,10 +76,9 @@ main(int argc, /* I - Number of command-line arguments */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
cups_lang_t *language; /* Language */
_cupsSetLocale();
/*
* Check for command-line options...
@@ -92,8 +91,8 @@ main(int argc, /* I - Number of command-line arguments */
interval = 0;
longstatus = 0;
all = 0;
language = cupsLangDefault();
num_dests = 0;
dests = NULL;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '+')
+2 -2
Ver Arquivo
@@ -87,13 +87,14 @@ main(int argc, /* I - Number of command-line arguments */
ssize_t bytes; /* Bytes copied */
off_t filesize; /* Size of temp file */
int temp; /* Temporary file descriptor */
cups_lang_t *language; /* Language information */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Signal action */
struct sigaction oldaction; /* Old signal action */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
_cupsSetLocale();
deletefile = 0;
printer = NULL;
num_dests = 0;
@@ -102,7 +103,6 @@ main(int argc, /* I - Number of command-line arguments */
options = NULL;
num_files = 0;
title = NULL;
language = cupsLangDefault();
for (i = 1; i < argc; i ++)
if (argv[i][0] == '-')
+24 -13
Ver Arquivo
@@ -55,12 +55,14 @@ main(int argc, /* I - Number of command-line arguments */
ipp_t *request; /* IPP request */
ipp_t *response; /* IPP response */
ipp_op_t op; /* Operation */
cups_lang_t *language; /* Language */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
cups_dest_t *dests, /* Destinations */
*defdest; /* Default destination */
http_encryption_t encryption; /* Encryption? */
_cupsSetLocale();
/*
* Setup to cancel individual print jobs...
*/
@@ -71,12 +73,6 @@ main(int argc, /* I - Number of command-line arguments */
response = NULL;
http = NULL;
encryption = cupsEncryption();
language = cupsLangDefault();
num_dests = cupsGetDests(&dests);
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
/*
* Open a connection to the server...
@@ -85,10 +81,13 @@ main(int argc, /* I - Number of command-line arguments */
if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL)
{
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
cupsFreeDests(num_dests, dests);
return (1);
}
num_dests = cupsGetDests2(http, &dests);
defdest = cupsGetDest(NULL, NULL, num_dests, dests);
dest = defdest ? defdest->name : NULL;
/*
* Process command-line arguments...
*/
@@ -102,6 +101,7 @@ main(int argc, /* I - Number of command-line arguments */
encryption = HTTP_ENCRYPT_REQUIRED;
httpEncryption(http, encryption);
cupsSetEncryption(encryption);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
@@ -152,9 +152,6 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'h' : /* Connect to host */
if (http != NULL)
httpClose(http);
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
@@ -172,6 +169,20 @@ main(int argc, /* I - Number of command-line arguments */
else
cupsSetServer(argv[i]);
}
httpClose(http);
cupsFreeDests(num_dests, dests);
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
encryption)) == NULL)
{
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
return (1);
}
num_dests = cupsGetDests2(http, &dests);
defdest = cupsGetDest(NULL, NULL, num_dests, dests);
dest = defdest ? defdest->name : NULL;
break;
default :
@@ -262,7 +273,7 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* If nothing has been cancelled yet, cancel the current job on the specified
* If nothing has been canceled yet, cancel the current job on the specified
* (or default) printer...
*/
+92 -29
Ver Arquivo
@@ -93,7 +93,8 @@ main(int argc, /* I - Number of command-line arguments */
if (!http)
{
perror("ERROR: Unable to connect to cupsd");
fprintf(stderr, "DEBUG: cupsServer()=\"%s\"\n", cupsServer());
fprintf(stderr, "DEBUG: cupsServer()=\"%s\"\n",
cupsServer() ? cupsServer() : "(null)");
fprintf(stderr, "DEBUG: ippPort()=%d\n", ippPort());
fprintf(stderr, "DEBUG: cupsEncryption()=%d\n", cupsEncryption());
exit(1);
@@ -481,7 +482,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
char refresh[1024]; /* Refresh URL */
cgiFormEncode(uri, name, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=/classes/%s",
snprintf(refresh, sizeof(refresh), "5;URL=/admin/?OP=redirect&URL=/classes/%s",
uri);
cgiSetVariable("refresh_page", refresh);
@@ -534,8 +535,9 @@ do_am_printer(http_t *http, /* I - HTTP connection */
};
ptr = cgiGetVariable("DEVICE_URI");
fprintf(stderr, "DEBUG: do_am_printer: DEVICE_URI=\"%s\"\n",
cgiGetVariable("DEVICE_URI"));
ptr ? ptr : "(null)");
title = cgiText(modify ? _("Modify Printer") : _("Add Printer"));
@@ -1041,7 +1043,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
"5;/admin/?OP=redirect&URL=/printers/%s", uri);
else
snprintf(refresh, sizeof(refresh),
"5;/admin/?OP=set-printer-options&PRINTER_NAME=%s", uri);
"5;URL=/admin/?OP=set-printer-options&PRINTER_NAME=%s", uri);
cgiSetVariable("refresh_page", refresh);
@@ -1489,7 +1491,9 @@ do_config_printer(http_t *http) /* I - HTTP connection */
*keyptr = '\0';
if (!strcmp(keyword, "PageRegion"))
if (!strcmp(keyword, "PageRegion") ||
!strcmp(keyword, "PaperDimension") ||
!strcmp(keyword, "ImageableArea"))
var = cgiGetVariable("PageSize");
else
var = cgiGetVariable(keyword);
@@ -1561,7 +1565,7 @@ do_config_printer(http_t *http) /* I - HTTP connection */
cgiFormEncode(uri, printer, sizeof(uri));
snprintf(refresh, sizeof(refresh),
"5;/admin/?OP=redirect&URL=/printers/%s", uri);
"5;URL=/admin/?OP=redirect&URL=/printers/%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
@@ -1593,39 +1597,97 @@ do_config_server(http_t *http) /* I - HTTP connection */
int num_settings; /* Number of server settings */
cups_option_t *settings; /* Server settings */
const char *debug_logging, /* DEBUG_LOGGING value */
*remote_admin, /* REMOTE_ADMIN value */
*remote_printers,
/* REMOTE_PRINTERS value */
*share_printers,/* SHARE_PRINTERS value */
*user_cancel_any;
/* USER_CANCEL_ANY value */
num_settings = 0;
num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
cgiGetVariable("DEBUG_LOGGING") ? "1" : "0",
num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
cgiGetVariable("REMOTE_ADMIN") ? "1" : "0",
num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
cgiGetVariable("REMOTE_PRINTERS") ? "1" : "0",
num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
cgiGetVariable("SHARE_PRINTERS") ? "1" : "0",
num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
cgiGetVariable("USER_CANCEL_ANY") ? "1" : "0",
num_settings, &settings);
/*
* Get the checkbox values from the form...
*/
debug_logging = cgiGetVariable("DEBUG_LOGGING") ? "1" : "0";
remote_admin = cgiGetVariable("REMOTE_ADMIN") ? "1" : "0";
remote_printers = cgiGetVariable("REMOTE_PRINTERS") ? "1" : "0";
share_printers = cgiGetVariable("SHARE_PRINTERS") ? "1" : "0";
user_cancel_any = cgiGetVariable("USER_CANCEL_ANY") ? "1" : "0";
if (!_cupsAdminSetServerSettings(http, num_settings, settings))
/*
* Get the current server settings...
*/
if (!_cupsAdminGetServerSettings(http, &num_settings, &settings))
{
cgiStartHTML(cgiText(_("Change Settings")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to change server settings:")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return;
}
/*
* See if the settings have changed...
*/
if (strcmp(debug_logging, cupsGetOption(CUPS_SERVER_DEBUG_LOGGING,
num_settings, settings)) ||
strcmp(remote_admin, cupsGetOption(CUPS_SERVER_REMOTE_ADMIN,
num_settings, settings)) ||
strcmp(remote_printers, cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS,
num_settings, settings)) ||
strcmp(share_printers, cupsGetOption(CUPS_SERVER_SHARE_PRINTERS,
num_settings, settings)) ||
strcmp(user_cancel_any, cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY,
num_settings, settings)))
{
/*
* Settings *have* changed, so save the changes...
*/
cupsFreeOptions(num_settings, settings);
num_settings = 0;
num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
debug_logging, num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
remote_admin, num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
remote_printers, num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
share_printers, num_settings, &settings);
num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
user_cancel_any, num_settings, &settings);
if (!_cupsAdminSetServerSettings(http, num_settings, settings))
{
cgiStartHTML(cgiText(_("Change Settings")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to change server settings:")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiCopyTemplateLang("error.tmpl");
}
else
{
cgiSetVariable("refresh_page", "5;URL=/admin/?OP=redirect");
cgiStartHTML(cgiText(_("Change Settings")));
cgiCopyTemplateLang("restart.tmpl");
}
}
else
{
cgiSetVariable("refresh_page", "5;/admin/?OP=redirect");
/*
* No changes...
*/
cgiSetVariable("refresh_page", "5;URL=/admin/?OP=redirect");
cgiStartHTML(cgiText(_("Change Settings")));
cgiCopyTemplateLang("restart.tmpl");
cgiCopyTemplateLang("norestart.tmpl");
}
cupsFreeOptions(num_settings, settings);
@@ -1717,7 +1779,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
}
else
{
cgiSetVariable("refresh_page", "5;/admin/?OP=redirect");
cgiSetVariable("refresh_page", "5;URL=/admin/?OP=redirect");
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiCopyTemplateLang("restart.tmpl");
@@ -2478,7 +2540,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
cgiRewriteURL(uri, url, sizeof(url), NULL);
cgiFormEncode(uri, url, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=%s", uri);
snprintf(refresh, sizeof(refresh), "5;URL=/admin/?OP=redirect&URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
@@ -2736,7 +2798,8 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
cgiRewriteURL(uri, url, sizeof(url), NULL);
cgiFormEncode(uri, url, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=%s", uri);
snprintf(refresh, sizeof(refresh), "5;URL=/admin/?OP=redirect&URL=%s",
uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(cgiText(_("Set Allowed Users")));
@@ -2826,7 +2889,7 @@ do_set_sharing(http_t *http) /* I - HTTP connection */
cgiRewriteURL(uri, url, sizeof(url), NULL);
cgiFormEncode(uri, url, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=%s", uri);
snprintf(refresh, sizeof(refresh), "5;URL=/admin/?OP=redirect&URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(cgiText(_("Set Publishing")));
+6 -6
Ver Arquivo
@@ -95,8 +95,7 @@ main(int argc, /* I - Number of command-line arguments */
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
user = getenv("REMOTE_USER");
/*
* Connect to the HTTP server...
@@ -187,7 +186,7 @@ main(int argc, /* I - Number of command-line arguments */
void
show_all_classes(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
const char *user) /* I - Username */
{
int i; /* Looping var */
ipp_t *request, /* IPP request */
@@ -221,8 +220,9 @@ show_all_classes(http_t *http, /* I - Connection to server */
request = ippNewRequest(CUPS_GET_CLASSES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
cgiGetAttributes(request, "classes.tmpl");
@@ -419,7 +419,7 @@ show_class(http_t *http, /* I - Connection to server */
*/
cgiFormEncode(uri, pclass, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;/classes/%s", uri);
snprintf(refresh, sizeof(refresh), "10;URL=/classes/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
+1 -1
Ver Arquivo
@@ -842,7 +842,7 @@ help_load_file(
if (isspace(*ptr & 255))
{
while (isspace(*ptr & 255))
*ptr ++;
ptr ++;
*text++ = ' ';
}
+2 -1
Ver Arquivo
@@ -187,7 +187,8 @@ main(int argc, /* I - Number of command-line arguments */
topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n", query, topic);
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
query ? query : "(null)", topic ? topic : "(null)");
if (si)
{
+2 -1
Ver Arquivo
@@ -175,7 +175,8 @@ cgi_null_passwd(const char *prompt) /* I - Prompt string (unused) */
{
(void)prompt;
fprintf(stderr, "DEBUG: cgi_null_passwd(prompt=\"%s\") called!\n", prompt);
fprintf(stderr, "DEBUG: cgi_null_passwd(prompt=\"%s\") called!\n",
prompt ? prompt : "(null)");
return (NULL);
}
+7 -4
Ver Arquivo
@@ -110,6 +110,7 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */
*/
num_attrs = 0;
attrs[0] = NULL; /* Eliminate compiler warning */
while ((ch = getc(in)) != EOF)
if (ch == '\\')
@@ -482,7 +483,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
{
cgiRewriteURL(job_printer_uri, resource, sizeof(resource), NULL);
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;%s", uri);
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
@@ -598,7 +599,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
*/
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;%s", uri);
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
@@ -774,7 +775,7 @@ cgiSetIPPObjectVars(
fprintf(stderr, "DEBUG2: cgiSetIPPObjectVars(obj=%p, prefix=\"%s\", "
"element=%d)\n",
obj, prefix, element);
obj, prefix ? prefix : "(null)", element);
/*
* Set common CGI template variables...
@@ -977,7 +978,9 @@ cgiSetIPPVars(ipp_t *response, /* I - Response data to be copied... */
fprintf(stderr, "DEBUG2: cgiSetIPPVars(response=%p, filter_name=\"%s\", "
"filter_value=\"%s\", prefix=\"%s\", parent_el=%d)\n",
response, filter_name, filter_value, prefix, parent_el);
response, filter_name ? filter_name : "(null)",
filter_value ? filter_value : "(null)",
prefix ? prefix : "(null)", parent_el);
/*
* Set common CGI template variables...
+8 -8
Ver Arquivo
@@ -98,8 +98,7 @@ main(int argc, /* I - Number of command-line arguments */
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
user = getenv("REMOTE_USER");
/*
* Connect to the HTTP server...
@@ -287,7 +286,7 @@ print_command(http_t *http, /* I - Connection to server */
*/
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;%s", uri);
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
@@ -331,7 +330,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
http, user);
http, user ? user : "(null)");
/*
* Show the standard header...
@@ -357,8 +356,9 @@ show_all_printers(http_t *http, /* I - Connection to server */
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type-mask", CUPS_PRINTER_CLASS);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
cgiGetAttributes(request, "printers.tmpl");
@@ -543,7 +543,7 @@ show_printer(http_t *http, /* I - Connection to server */
fprintf(stderr, "DEBUG: show_printer(http=%p, printer=\"%s\")\n",
http, printer);
http, printer ? printer : "(null)");
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
@@ -594,7 +594,7 @@ show_printer(http_t *http, /* I - Connection to server */
*/
cgiFormEncode(uri, printer, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri);
snprintf(refresh, sizeof(refresh), "10;URL=/printers/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
+4 -3
Ver Arquivo
@@ -60,7 +60,7 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
fprintf(stderr, "DEBUG: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
tmpl);
tmpl ? tmpl : "(null)");
/*
* Open the template file...
@@ -69,7 +69,7 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
if ((in = fopen(tmpl, "r")) == NULL)
{
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
tmpl, strerror(errno));
tmpl ? tmpl : "(null)", strerror(errno));
return;
}
@@ -102,7 +102,8 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
FILE *in; /* Input file */
fprintf(stderr, "DEBUG: cgiCopyTemplateLang(tmpl=\"%s\")\n", tmpl);
fprintf(stderr, "DEBUG: cgiCopyTemplateLang(tmpl=\"%s\")\n",
tmpl ? tmpl : "(null)");
/*
* Convert the language to a locale name...
+2 -1
Ver Arquivo
@@ -949,7 +949,8 @@ cgi_passwd(const char *prompt) /* I - Prompt (not used) */
{
(void)prompt;
fprintf(stderr, "DEBUG: cgi_passwd(prompt=\"%s\") called!\n", prompt);
fprintf(stderr, "DEBUG: cgi_passwd(prompt=\"%s\") called!\n",
prompt ? prompt : "(null)");
/*
* Send a 401 (unauthorized) status to the server, so it can notify
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-common.m4 5843 2006-08-17 18:49:31Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -29,7 +29,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Versio number information...
CUPS_VERSION="1.2svn"
CUPS_VERSION="1.2.3"
CUPS_REVISION=""
if test -z "$CUPS_REVISION" -a -d .svn; then
CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
@@ -265,5 +265,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
dnl End of "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-common.m4 5843 2006-08-17 18:49:31Z mike $".
dnl
+60 -75
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-compiler.m4 5473 2006-05-01 15:51:09Z mike $"
dnl "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -24,22 +24,31 @@ dnl
dnl Clear the debugging and non-shared library options unless the user asks
dnl for them...
ARCHFLAGS=""
OPTIM=""
AC_SUBST(ARCHFLAGS)
AC_SUBST(OPTIM)
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
AC_ARG_WITH(archflags, [ --with-arch="flags" set default architecture flags ])
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
[if test x$enable_debug = xyes; then
OPTIM="-g"
fi])
dnl Setup general architecture flags...
AC_ARG_WITH(archflags, [ --with-archflags="flags"
set default architecture flags ])
if test -z "$with_archflags"; then
ARCHFLAGS=""
else
ARCHFLAGS="$with_archflags"
fi
AC_SUBST(ARCHFLAGS)
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
AC_ARG_WITH(arch32flags, [ --with-arch32="flags" specifies 32-bit architecture flags])
AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
specifies 32-bit architecture flags])
ARCH32FLAGS=""
INSTALL32=""
@@ -56,7 +65,8 @@ AC_SUBST(LIB32DIR)
AC_SUBST(UNINSTALL32)
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
AC_ARG_WITH(arch64flags, [ --with-arch64="flags" specifies 64-bit architecture flags])
AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
specifies 64-bit architecture flags])
ARCH64FLAGS=""
INSTALL64=""
@@ -118,17 +128,6 @@ if test -n "$GCC"; then
fi
case "$uname" in
Darwin*)
if test -z "$with_archflags"; then
if test "x`uname -m`" = xi386; then
# Build universal binaries for OSX on Intel...
ARCHFLAGS="-arch i386 -arch ppc"
fi
else
ARCHFLAGS="$with_archflags"
fi
;;
IRIX)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
@@ -138,8 +137,8 @@ if test -n "$GCC"; then
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="libcups.32.so.2"
LIB32CUPSIMAGE="libcupsimage.32.so.2"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
@@ -149,8 +148,6 @@ if test -n "$GCC"; then
else
ARCHFLAGS="$with_arch64flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
@@ -162,8 +159,8 @@ if test -n "$GCC"; then
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="libcups.64.so.2"
LIB64CUPSIMAGE="libcupsimage.64.so.2"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
@@ -173,8 +170,6 @@ if test -n "$GCC"; then
else
ARCHFLAGS="$with_arch32flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
;;
@@ -188,8 +183,8 @@ if test -n "$GCC"; then
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="libcups.32.so.2"
LIB32CUPSIMAGE="libcupsimage.32.so.2"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib"
if test -d /usr/lib32; then
LIB32DIR="${LIB32DIR}32"
@@ -202,8 +197,6 @@ if test -n "$GCC"; then
else
ARCHFLAGS="$with_arch64flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
@@ -215,8 +208,8 @@ if test -n "$GCC"; then
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="libcups.64.so.2"
LIB64CUPSIMAGE="libcupsimage.64.so.2"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib"
if test -d /usr/lib64; then
LIB64DIR="${LIB64DIR}64"
@@ -229,8 +222,6 @@ if test -n "$GCC"; then
else
ARCHFLAGS="$with_arch32flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
;;
@@ -244,8 +235,8 @@ if test -n "$GCC"; then
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="libcups.32.so.2"
LIB32CUPSIMAGE="libcupsimage.32.so.2"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
@@ -255,8 +246,6 @@ if test -n "$GCC"; then
else
ARCHFLAGS="$with_arch64flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
@@ -268,8 +257,8 @@ if test -n "$GCC"; then
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="libcups.64.so.2"
LIB64CUPSIMAGE="libcupsimage.64.so.2"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib/64"
UNINSTALL64="uninstall64bit"
@@ -279,8 +268,6 @@ if test -n "$GCC"; then
else
ARCHFLAGS="$with_arch32flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
;;
@@ -310,10 +297,6 @@ else
# Warning 829 is passing constant string as char *
CXXFLAGS="+W336,829 $CXXFLAGS"
if test "x$with_optim" = x; then
OPTIM="+DAportable $OPTIM"
fi
if test $PICFLAG = 1; then
OPTIM="+z $OPTIM"
fi
@@ -339,8 +322,8 @@ else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="libcups.32.so.2"
LIB32CUPSIMAGE="libcupsimage.32.so.2"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
@@ -350,8 +333,6 @@ else
else
ARCHFLAGS="$with_arch64flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
@@ -363,8 +344,8 @@ else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="libcups.64.so.2"
LIB64CUPSIMAGE="libcupsimage.64.so.2"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
@@ -374,8 +355,6 @@ else
else
ARCHFLAGS="$with_arch32flags"
fi
else
ARCHFLAGS="$with_archflags"
fi
fi
;;
@@ -383,7 +362,7 @@ else
# Solaris
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-xO4"
OPTIM="-xO2"
else
OPTIM="$with_optim $OPTIM"
fi
@@ -398,8 +377,8 @@ else
# binaries with separate 32-bit libraries...
ARCH32FLAGS="-xarch=generic"
INSTALL32="install32bit"
LIB32CUPS="libcups.32.so.2"
LIB32CUPSIMAGE="libcupsimage.32.so.2"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
@@ -408,32 +387,38 @@ else
# warning messages, and default to
# 64-bit compiles of everything else...
OPTIM="-w $OPTIM"
CFLAGS="-xarch=generic64 $CFLAGS"
fi
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
ARCHFLAGS="-xarch=generic64"
else
ARCHFLAGS="$with_arch64flags"
fi
fi
else
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries...
ARCH64FLAGS="-xarch=generic64"
INSTALL64="install64bit"
LIB64CUPS="libcups.64.so.2"
LIB64CUPSIMAGE="libcupsimage.64.so.2"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib/64"
UNINSTALL64="uninstall64bit"
fi
if test "x$with_optim" = x; then
# Suppress all of Sun's questionable
# warning messages, and default to
# 32-bit compiles of everything else...
OPTIM="-w $OPTIM"
CFLAGS="-xarch=generic $CFLAGS"
fi
else
if test "x$with_optim" = x; then
# Suppress all of Sun's questionable
# warning messages, and default to
# 32-bit compiles of everything else...
OPTIM="-w $OPTIM"
CFLAGS="-xarch=generic $CFLAGS"
if test "x$with_optim" = x; then
# Suppress all of Sun's questionable
# warning messages, and default to
# 32-bit compiles of everything else...
OPTIM="-w $OPTIM"
fi
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-xarch=generic"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
@@ -475,5 +460,5 @@ if test $uname = HP-UX; then
fi
dnl
dnl End of "$Id: cups-compiler.m4 5473 2006-05-01 15:51:09Z mike $".
dnl End of "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $".
dnl
+31 -17
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-defaults.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-defaults.m4 5804 2006-08-04 16:51:58Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
@@ -24,13 +24,15 @@ dnl WWW: http://www.cups.org
dnl
dnl Default langugages...
AC_ARG_WITH(languages, [ --with-languages set installed languages, default="es ja" ],
LANGUAGES="$withval",
LANGUAGES="es ja pl sv")
AC_ARG_WITH(languages, [ --with-languages set installed languages, default="de es ja pl sv" ],
if test "x$withval" != xno; then
LANGUAGES="$withval"
fi,
LANGUAGES="de es ja pl sv")
AC_SUBST(LANGUAGES)
dnl Default ConfigFilePerm
AC_ARG_WITH(config_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
CUPS_CONFIG_FILE_PERM="$withval",
if test "x$uname" = xDarwin; then
CUPS_CONFIG_FILE_PERM="644"
@@ -41,7 +43,7 @@ AC_SUBST(CUPS_CONFIG_FILE_PERM)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
dnl Default LogFilePerm
AC_ARG_WITH(log_perm, [ --with-log-file-perm set default LogFilePerm value, default=0644],
AC_ARG_WITH(log_file_perm, [ --with-log-file-perm set default LogFilePerm value, default=0644],
CUPS_LOG_FILE_PERM="$withval",
CUPS_LOG_FILE_PERM="644")
AC_SUBST(CUPS_LOG_FILE_PERM)
@@ -59,7 +61,7 @@ fi
AC_SUBST(CUPS_BROWSING)
dnl Default BrowseLocalProtocols
AC_ARG_WITH(browse_local, [ --with-local-protocols set default BrowseLocalProtocols, default="CUPS"],
AC_ARG_WITH(local_protocols, [ --with-local-protocols set default BrowseLocalProtocols, default="CUPS"],
CUPS_BROWSE_LOCAL_PROTOCOLS="$withval",
CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS")
AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
@@ -67,7 +69,7 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS,
"$CUPS_BROWSE_LOCAL_PROTOCOLS")
dnl Default BrowseRemoteProtocols
AC_ARG_WITH(browse_remote, [ --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
AC_ARG_WITH(remote_protocols, [ --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
CUPS_BROWSE_REMOTE_PROTOCOLS="$withval",
CUPS_BROWSE_REMOTE_PROTOCOLS="CUPS")
AC_SUBST(CUPS_BROWSE_REMOTE_PROTOCOLS)
@@ -130,7 +132,7 @@ fi
AC_SUBST(CUPS_USE_NETWORK_DEFAULT)
dnl Determine the correct username and group for this OS...
AC_ARG_WITH(cups-user, [ --with-cups-user set default user for CUPS],
AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
CUPS_USER="$withval",
AC_MSG_CHECKING(for default print user)
if test -f /etc/passwd; then
@@ -152,7 +154,7 @@ AC_ARG_WITH(cups-user, [ --with-cups-user set default user for CUPS],
AC_MSG_RESULT(no password file, using "$CUPS_USER")
fi)
AC_ARG_WITH(cups-group, [ --with-cups-group set default group 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 -f /etc/group; then
@@ -175,7 +177,7 @@ AC_ARG_WITH(cups-group, [ --with-cups-group set default group for CUPS],
AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
fi)
AC_ARG_WITH(system-groups, [ --with-system-groups set default system groups for CUPS],
AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups for CUPS],
CUPS_SYSTEM_GROUPS="$withval",
if test x$uname = xDarwin; then
GROUP_LIST="admin"
@@ -221,13 +223,25 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_GROUPS, "$CUPS_SYSTEM_GROUPS")
dnl Default printcap file...
AC_ARG_WITH(printcap, [ --with-printcap set default printcap file],
default_printcap="$withval",
default_printcap="/etc/printcap")
default_printcap="default")
if test x$enable_printcap != xno -a x$default_printcap != xno; then
if test "x$default_printcap" = "x/etc/printcap" -a "$uname" = "Darwin" -a $uversion -ge 90; then
CUPS_DEFAULT_PRINTCAP=""
else
CUPS_DEFAULT_PRINTCAP="$default_printcap"
if test "x$default_printcap" = "xdefault"; then
case $uname in
Darwin*)
if test $uversion -ge 90; then
CUPS_DEFAULT_PRINTCAP=""
else
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
fi
;;
SunOS*)
CUPS_DEFAULT_PRINTCAP="/etc/printers.conf"
;;
*)
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
;;
esac
fi
else
CUPS_DEFAULT_PRINTCAP=""
@@ -236,5 +250,5 @@ fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl
dnl End of "$Id: cups-defaults.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-defaults.m4 5804 2006-08-04 16:51:58Z mike $".
dnl
+29 -13
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-directories.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-directories.m4 5905 2006-08-29 20:48:59Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -57,6 +57,15 @@ if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
sharedstatedir="/usr/com"
fi
dnl Fix "datarootdir" variable if it hasn't been specified...
if test "$datarootdir" = "\${prefix}/share"; then
if test "$prefix" = "/"; then
datarootdir="/usr/share"
else
datarootdir="$prefix/share"
fi
fi
dnl Fix "datadir" variable if it hasn't been specified...
if test "$datadir" = "\${prefix}/share"; then
if test "$prefix" = "/"; then
@@ -64,6 +73,8 @@ if test "$datadir" = "\${prefix}/share"; then
else
datadir="$prefix/share"
fi
elif test "$datadir" = "\${datarootdir}"; then
datadir="$datarootdir"
fi
dnl Fix "includedir" variable if it hasn't been specified...
@@ -115,7 +126,7 @@ AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$w
if test x$rcdir = x; then
case "$uname" in
FreeBSD* | OpenBSD*)
FreeBSD* | OpenBSD* | MirBsD* | ekkoBSD*)
# FreeBSD and OpenBSD
INITDIR=""
INITDDIR=""
@@ -130,9 +141,11 @@ if test x$rcdir = x; then
Darwin*)
# Darwin and MacOS X...
INITDIR=""
AC_CHECK_PROG(INITDDIR, launchd,
"/System/Library/LaunchDaemons",
"/System/Library/StartupItems/PrintingServices")
if test -x /sbin/launchd; then
INITDDIR="/System/Library/LaunchDaemons"
else
INITDDIR="/System/Library/StartupItems/PrintingServices"
fi
;;
Linux | GNU)
@@ -180,12 +193,15 @@ AC_SUBST(INITDDIR)
dnl Xinetd support...
XINETD=""
for dir in /private/etc/xinetd.d /etc/xinetd.d /usr/local/etc/xinetd.d; do
if test -d $dir; then
XINETD="$dir"
break
fi
done
if test ! -x /sbin/launchd; then
for dir in /private/etc/xinetd.d /etc/xinetd.d /usr/local/etc/xinetd.d; do
if test -d $dir; then
XINETD="$dir"
break
fi
done
fi
AC_SUBST(XINETD)
@@ -195,7 +211,7 @@ AC_ARG_WITH(cachedir, [ --with-cachedir set path for cache files],cache
if test x$cachedir = x; then
if test "x$uname" = xDarwin; then
CUPS_CACHEDIR="$localstatedir/tmp/cups"
CUPS_CACHEDIR="$localstatedir/spool/cups/cache"
else
CUPS_CACHEDIR="$localstatedir/cache/cups"
fi
@@ -300,5 +316,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-directories.m4 5905 2006-08-29 20:48:59Z mike $".
dnl
+14 -10
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-image.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-image.m4 5580 2006-05-23 19:30:23Z mike $"
dnl
dnl Image library/filter stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -38,10 +38,6 @@ fi
AC_SUBST(IMGFILTERS)
dnl Save the current libraries since we don't want the image libraries
dnl included with every program...
SAVELIBS="$LIBS"
dnl Check for image libraries...
AC_ARG_ENABLE(jpeg, [ --enable-jpeg turn on JPEG support, default=yes])
AC_ARG_ENABLE(png, [ --enable-png turn on PNG support, default=yes])
@@ -57,6 +53,14 @@ AC_SUBST(LIBPNG)
AC_SUBST(LIBTIFF)
AC_SUBST(LIBZ)
dnl Image libraries use math library functions...
AC_SEARCH_LIBS(pow, m)
dnl Save the current libraries since we don't want the image libraries
dnl included with every program...
SAVELIBS="$LIBS"
dnl JPEG library...
if test x$enable_jpeg != xno; then
AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
@@ -67,24 +71,24 @@ else
AC_MSG_NOTICE([JPEG support disabled with --disable-jpeg.])
fi
dnl ZLIB library...
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzgets,
AC_DEFINE(HAVE_LIBZ)
LIBZ="-lz"
LIBS="$LIBS -lz"))
dnl PNG library uses math library functions...
AC_CHECK_LIB(m, pow)
dnl PNG library...
if test x$enable_png != xno; then
AC_CHECK_HEADER(png.h,
AC_CHECK_LIB(png, png_create_read_struct,
AC_DEFINE(HAVE_LIBPNG)
LIBPNG="-lpng -lm"))
LIBPNG="-lpng"))
else
AC_MSG_NOTICE([PNG support disabled with --disable-png.])
fi
dnl TIFF library...
if test x$enable_tiff != xno; then
AC_CHECK_HEADER(tiff.h,
AC_CHECK_LIB(tiff, TIFFReadScanline,
@@ -110,5 +114,5 @@ AC_SUBST(EXPORT_LIBZ)
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
dnl
dnl End of "$Id: cups-image.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-image.m4 5580 2006-05-23 19:30:23Z mike $".
dnl
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-ldap.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-ldap.m4 5564 2006-05-22 00:59:11Z mike $"
dnl
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -36,7 +36,7 @@ LIBLDAP=""
if test x$enable_ldap != xno; then
AC_CHECK_HEADER(ldap.h,
AC_CHECK_LIB(ldap, ldap_value_free,
AC_CHECK_LIB(ldap, ldap_initialize,
AC_DEFINE(HAVE_LDAP)
AC_DEFINE(HAVE_OPENLDAP)
LIBLDAP="-lldap"))
@@ -46,5 +46,5 @@ AC_SUBST(LIBLDAP)
dnl
dnl End of "$Id: cups-ldap.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-ldap.m4 5564 2006-05-22 00:59:11Z mike $".
dnl
+9 -3
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-manpages.m4 5799 2006-08-03 00:54:38Z mike $"
dnl
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
@@ -23,6 +23,12 @@ dnl WWW: http://www.cups.org
dnl
dnl Fix "mandir" variable...
if test "$mandir" = "\${datarootdir}/man" -a "$prefix" = "/"; then
# New GNU "standards" break previous ones, so make sure we use
# the right default location for the operating system...
mandir="\${prefix}/man"
fi
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
case "$uname" in
Darwin* | Linux | GNU | *BSD* | AIX*)
@@ -103,5 +109,5 @@ AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-manpages.m4 5799 2006-08-03 00:54:38Z mike $".
dnl
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-network.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $"
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -46,7 +46,7 @@ else
maxfiles=4096
fi
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler ],
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler (deprecated) ],
maxfiles=$withval)
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
@@ -85,5 +85,5 @@ AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
dnl
dnl End of "$Id: cups-network.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $".
dnl
+52 -31
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-sharedlibs.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-sharedlibs.m4 5582 2006-05-24 01:00:35Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
@@ -33,31 +33,31 @@ if test x$enable_shared != xno; then
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-h,\$@ -G \$(OPTIM)"
DSOFLAGS="$DSOFLAGS -Wl,-h,\`basename \$@\` -G \$(OPTIM)"
;;
HP-UX*)
LIBCUPS="libcups.sl.2"
LIBCUPSIMAGE="libcupsimage.sl.2"
DSO="\$(LD)"
DSOFLAGS="$DSOFLAGS -b -z +h \$@"
DSOFLAGS="$DSOFLAGS -b -z +h \`basename \$@\`"
;;
IRIX)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi2.6,-soname,\$@ -shared \$(OPTIM)"
DSOFLAGS="$DSOFLAGS -set_version,sgi2.6,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
OSF1* | Linux | GNU | *BSD*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
Darwin*)
LIBCUPS="libcups.2.dylib"
LIBCUPSIMAGE="libcupsimage.2.dylib"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -single_module -lc"
DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
;;
AIX*)
LIBCUPS="libcups_s.a"
@@ -71,7 +71,7 @@ if test x$enable_shared != xno; then
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
esac
else
@@ -81,8 +81,15 @@ else
DSO=":"
fi
# 32-bit and 64-bit libraries need variations of the standard
# DSOFLAGS...
DSO32FLAGS="$DSOFLAGS"
DSO64FLAGS="$DSOFLAGS"
AC_SUBST(DSO)
AC_SUBST(DSOFLAGS)
AC_SUBST(DSO32FLAGS)
AC_SUBST(DSO64FLAGS)
AC_SUBST(LIBCUPS)
AC_SUBST(LIBCUPSIMAGE)
@@ -110,41 +117,55 @@ if test "$DSO" != ":"; then
# rather than to the executables. This makes things smaller if you
# are using any static libraries, and it also allows us to distribute
# a single DSO rather than a bunch...
DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
DSOLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
IMGLIBS=""
# The *BSD, HP-UX, and Solaris run-time linkers need help when
# deciding where to find a DSO. Add linker options to tell them
# where to find the DSO (usually in /usr/lib... duh!)
# Tell the run-time linkers where to find a DSO. Some platforms
# need this option, even when the library is installed in a
# standard location...
case $uname in
HP-UX*)
# HP-UX
# HP-UX needs the path, even for /usr/lib...
DSOFLAGS="+s +b $libdir $DSOFLAGS"
DSO32FLAGS="+s +b $LIB32DIR $DSO32FLAGS"
DSO64FLAGS="+s +b $LIB64DIR $DSO64FLAGS"
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"
;;
# Solaris...
if test $exec_prefix != /usr; then
DSOFLAGS="-R$libdir $DSOFLAGS"
DSO32FLAGS="-R$LIB32DIR $DSO32FLAGS"
DSO64FLAGS="-R$LIB64DIR $DSO64FLAGS"
LDFLAGS="$LDFLAGS -R$libdir"
EXPORT_LDFLAGS="-R$libdir"
fi
;;
*BSD*)
# *BSD
DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
EXPORT_LDFLAGS="-Wl,-R$libdir"
;;
Linux | GNU)
# Linux and HURD
DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
;;
# *BSD...
if test $exec_prefix != /usr; then
DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
DSO32FLAGS="-Wl,-R$LIB32DIR $DSO32FLAGS"
DSO64FLAGS="-Wl,-R$LIB64DIR $DSO64FLAGS"
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
EXPORT_LDFLAGS="-Wl,-R$libdir"
fi
;;
IRIX | Linux | GNU)
# IRIX, Linux, and HURD...
if test $exec_prefix != /usr; then
DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
DSO32FLAGS="-Wl,-rpath,$LIB32DIR $DSO32FLAGS"
DSO64FLAGS="-Wl,-rpath,$LIB64DIR $DSO64FLAGS"
LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
fi
;;
esac
else
DSOLIBS=""
IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
IMGLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
fi
AC_SUBST(DSOLIBS)
@@ -152,5 +173,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 5582 2006-05-24 01:00:35Z mike $".
dnl
+16 -14
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-ssl.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-ssl.m4 5630 2006-06-05 18:42:53Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -48,6 +48,7 @@ if test x$enable_ssl != xno; then
# certificates for CUPS, so don't enable encryption on
# /admin just yet...
#ENCRYPTION_REQUIRED=" Encryption Required"
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_CDSASSL)])
fi
@@ -55,18 +56,14 @@ if test x$enable_ssl != xno; then
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"
AC_CHECK_LIB(gnutls, gnutls_x509_crt_set_dn_by_oid,
[SSLLIBS="-lgnutls"
ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)])
LIBS="$SAVELIBS")
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
if test "x$LIBGNUTLSCONFIG" != x; then
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
fi
fi
dnl Check for the OpenSSL library last...
@@ -104,6 +101,11 @@ if test x$enable_ssl != xno; then
fi
fi
if test "x$SSLLIBS" != x; then
AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
fi
AC_SUBST(SSLFLAGS)
AC_SUBST(SSLLIBS)
AC_SUBST(ENCRYPTION_REQUIRED)
@@ -113,5 +115,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-ssl.m4 5630 2006-06-05 18:42:53Z mike $".
dnl
+7
Ver Arquivo
@@ -260,6 +260,13 @@
#undef HAVE_SSL
/*
* Do we have <Security/SecBasePriv.h>?
*/
#undef HAVE_SECBASEPRIV_H
/*
* Do we have the SLP library?
*/
+18 -3
Ver Arquivo
@@ -47,15 +47,30 @@ sinclude(config-scripts/cups-pap.m4)
sinclude(config-scripts/cups-pdf.m4)
sinclude(config-scripts/cups-scripting.m4)
INSTALL_LANGUAGES=""
UNINSTALL_LANGUAGES=""
LANGFILES=""
if test "x$LANGUAGES" != x; then
INSTALL_LANGUAGES="install-languages"
UNINSTALL_LANGUAGES="uninstall-languages"
for lang in $LANGUAGES; do
LANGFILES="$LANGFILES doc/$lang/index.html"
LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
LANGFILES="$LANGFILES templates/$lang/header.tmpl"
if test -f doc/$lang/index.html.in; then
LANGFILES="$LANGFILES doc/$lang/index.html"
fi
if test -f templates/$lang/edit-config.tmpl.in; then
LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
fi
if test -f templates/$lang/header.tmpl.in; then
LANGFILES="$LANGFILES templates/$lang/header.tmpl"
fi
done
fi
AC_SUBST(INSTALL_LANGUAGES)
AC_SUBST(UNINSTALL_LANGUAGES)
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
conf/cupsd.conf conf/pam.std doc/index.html
doc/help/standard.html man/client.conf.man
+25 -9
Ver Arquivo
@@ -31,6 +31,8 @@ exec_prefix=@exec_prefix@
bindir=@bindir@
includedir=@includedir@
libdir=@libdir@
imagelibdir=@libdir@
datarootdir=@datadir@
datadir=@datadir@
sysconfdir=@sysconfdir@
cups_datadir=@CUPS_DATADIR@
@@ -41,16 +43,30 @@ INSTALLSTATIC=@INSTALLSTATIC@
# flags for C++ compiler:
CFLAGS=""
LDFLAGS="@EXPORT_LDFLAGS@"
LIBS="@EXPORT_SSLLIBS@ @LIBS@"
IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@ @EXPORT_LIBZ@"
LIBS="@EXPORT_SSLLIBS@ @EXPORT_LIBZ@ @LIBS@"
IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@"
if test $includedir != /usr/include; then
CFLAGS="$CFLAGS -I$includedir"
# Check for local invocation...
selfdir=`dirname $0`
if test -f "$selfdir/cups/cups.h"; then
CFLAGS="-I$selfdir"
LDFLAGS="-L$selfdir/cups -L$selfdir/filter $LDFLAGS"
libdir="$selfdir/cups"
imagelibdir="$selfdir/filter"
if test ! -f "$selfdir/cups/raster.h"; then
ln -s ../filter/raster.h "$selfdir/cups"
fi
else
if test $includedir != /usr/include; then
CFLAGS="$CFLAGS -I$includedir"
fi
if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib64; then
LDFLAGS="$LDFLAGS -L$libdir"
fi
fi
if test $libdir != /usr/lib -a $libdir != /usr/lib32; then
LDFLAGS="$LDFLAGS -L$libdir"
fi
usage ()
{
@@ -100,13 +116,13 @@ while test $# -gt 0; do
if test $image = no; then
echo -lcups $LIBS
else
echo -lcupsimage $IMGLIBS -lcups $LIBS
echo -lcupsimage -lcups $IMGLIBS $LIBS
fi
else
if test $image = no; then
echo $libdir/libcups.a $LIBS
else
echo $libdir/libcupsimage.a $IMGLIBS $libdir/libcups.a $LIBS
echo $imagelibdir/libcupsimage.a $libdir/libcups.a $IMGLIBS $LIBS
fi
fi
;;
+150 -102
Ver Arquivo
@@ -1,20 +1,23 @@
# DO NOT DELETE
adminutil.o: adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
adminutil.o: language.h globals.h string.h ../config.h i18n.h transcode.h
adminutil.o: debug.h
adminutil.o: language.h globals.h string.h ../config.h http-private.h
adminutil.o: ipp-private.h i18n.h transcode.h debug.h
array.o: array.h string.h ../config.h debug.h
attr.o: ppd.h array.h file.h debug.h string.h ../config.h
auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
auth.o: array.h file.h language.h i18n.h transcode.h debug.h
auth.o: globals.h string.h ../config.h http-private.h http.h md5.h
auth.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
auth.o: transcode.h debug.h
backchannel.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
backend.o: backend.h string.h ../config.h
custom.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
custom.o: array.h file.h language.h i18n.h transcode.h debug.h
dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
dest.o: array.h file.h language.h i18n.h transcode.h
custom.o: globals.h string.h ../config.h http-private.h http.h md5.h
custom.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
custom.o: transcode.h debug.h
dest.o: globals.h string.h ../config.h http-private.h http.h md5.h
dest.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
dest.o: transcode.h
dir.o: dir.h string.h ../config.h debug.h
emit.o: ppd.h array.h file.h string.h ../config.h
emit.o: ppd.h array.h file.h string.h ../config.h debug.h
encode.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
encode.o: ipp-private.h string.h ../config.h debug.h
file.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
@@ -29,74 +32,90 @@ globals.o: transcode.h debug.h
http.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
http.o: string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
http.o: debug.h
http-addr.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
http-addr.o: array.h file.h language.h i18n.h transcode.h debug.h
http-addr.o: globals.h string.h ../config.h http-private.h http.h md5.h
http-addr.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
http-addr.o: i18n.h transcode.h debug.h
http-addrlist.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
http-addrlist.o: globals.h string.h cups.h ppd.h array.h file.h language.h
http-addrlist.o: i18n.h transcode.h debug.h
http-support.o: debug.h globals.h string.h ../config.h cups.h ipp.h http.h
http-support.o: md5.h ppd.h array.h file.h language.h i18n.h transcode.h
http-support.o: debug.h globals.h string.h ../config.h http-private.h http.h
http-support.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
http-support.o: language.h i18n.h transcode.h
ipp.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
ipp.o: string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
ipp.o: debug.h
ipp-support.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
ipp-support.o: array.h file.h language.h i18n.h transcode.h debug.h
langprintf.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
langprintf.o: array.h file.h language.h i18n.h transcode.h
language.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
language.o: array.h file.h language.h i18n.h transcode.h debug.h
localize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
localize.o: array.h file.h language.h i18n.h transcode.h debug.h
ipp-support.o: globals.h string.h ../config.h http-private.h http.h md5.h
ipp-support.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
ipp-support.o: i18n.h transcode.h debug.h
langprintf.o: globals.h string.h ../config.h http-private.h http.h md5.h
langprintf.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
langprintf.o: i18n.h transcode.h
language.o: globals.h string.h ../config.h http-private.h http.h md5.h
language.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
language.o: transcode.h debug.h
localize.o: globals.h string.h ../config.h http-private.h http.h md5.h
localize.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
localize.o: transcode.h debug.h
mark.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
mark.o: ../config.h debug.h
md5.o: md5.h string.h ../config.h
md5passwd.o: http.h md5.h string.h ../config.h
notify.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
notify.o: array.h file.h language.h i18n.h transcode.h
notify.o: globals.h string.h ../config.h http-private.h http.h md5.h
notify.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
notify.o: transcode.h
options.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
options.o: ../config.h debug.h
page.o: ppd.h array.h file.h string.h ../config.h
ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h
ppd.o: file.h language.h i18n.h transcode.h debug.h
request.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
request.o: array.h file.h language.h i18n.h transcode.h debug.h
ppd.o: globals.h string.h ../config.h http-private.h http.h md5.h
ppd.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
ppd.o: transcode.h debug.h
request.o: globals.h string.h ../config.h http-private.h http.h md5.h
request.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
request.o: transcode.h debug.h
snprintf.o: string.h ../config.h
string.o: array.h debug.h string.h ../config.h
tempfile.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
tempfile.o: array.h file.h language.h i18n.h transcode.h debug.h
transcode.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
transcode.o: array.h file.h language.h i18n.h transcode.h debug.h
tempfile.o: globals.h string.h ../config.h http-private.h http.h md5.h
tempfile.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
tempfile.o: transcode.h debug.h
transcode.o: globals.h string.h ../config.h http-private.h http.h md5.h
transcode.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
transcode.o: i18n.h transcode.h debug.h
usersys.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
usersys.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
usersys.o: transcode.h
util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
util.o: array.h file.h language.h i18n.h transcode.h debug.h
util.o: globals.h string.h ../config.h http-private.h http.h md5.h
util.o: ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
util.o: transcode.h debug.h
testadmin.o: adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
testadmin.o: language.h string.h ../config.h
testarray.o: ../cups/string.h ../config.h string.h array.h dir.h debug.h
testfile.o: string.h ../config.h file.h debug.h
testhttp.o: http.h md5.h string.h ../config.h
testi18n.o: i18n.h transcode.h language.h array.h string.h ../config.h
testipp.o: ../cups/string.h ../config.h string.h ipp.h http.h md5.h
testipp.o: ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h
testipp.o: md5.h
testlang.o: i18n.h transcode.h language.h array.h
testppd.o: ../cups/string.h ../config.h string.h ppd.h array.h file.h
# DO NOT DELETE
adminutil.32.o: adminutil.c adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
adminutil.32.o: adminutil.c language.h globals.h string.h ../config.h i18n.h transcode.h
adminutil.32.o: adminutil.c debug.h
adminutil.32.o: adminutil.c language.h globals.h string.h ../config.h http-private.h
adminutil.32.o: adminutil.c ipp-private.h i18n.h transcode.h debug.h
array.32.o: array.c array.h string.h ../config.h debug.h
attr.32.o: attr.c ppd.h array.h file.h debug.h string.h ../config.h
auth.32.o: auth.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
auth.32.o: auth.c array.h file.h language.h i18n.h transcode.h debug.h
auth.32.o: auth.c globals.h string.h ../config.h http-private.h http.h md5.h
auth.32.o: auth.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
auth.32.o: auth.c transcode.h debug.h
backchannel.32.o: backchannel.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
backend.32.o: backend.c backend.h string.h ../config.h
custom.32.o: custom.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
custom.32.o: custom.c array.h file.h language.h i18n.h transcode.h debug.h
dest.32.o: dest.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
dest.32.o: dest.c array.h file.h language.h i18n.h transcode.h
custom.32.o: custom.c globals.h string.h ../config.h http-private.h http.h md5.h
custom.32.o: custom.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
custom.32.o: custom.c transcode.h debug.h
dest.32.o: dest.c globals.h string.h ../config.h http-private.h http.h md5.h
dest.32.o: dest.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
dest.32.o: dest.c transcode.h
dir.32.o: dir.c dir.h string.h ../config.h debug.h
emit.32.o: emit.c ppd.h array.h file.h string.h ../config.h
emit.32.o: emit.c ppd.h array.h file.h string.h ../config.h debug.h
encode.32.o: encode.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h
file.32.o: file.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
@@ -111,74 +130,90 @@ globals.32.o: globals.c transcode.h debug.h
http.32.o: http.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
http.32.o: http.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
http.32.o: http.c debug.h
http-addr.32.o: http-addr.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
http-addr.32.o: http-addr.c array.h file.h language.h i18n.h transcode.h debug.h
http-addr.32.o: http-addr.c globals.h string.h ../config.h http-private.h http.h md5.h
http-addr.32.o: http-addr.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
http-addr.32.o: http-addr.c i18n.h transcode.h debug.h
http-addrlist.32.o: http-addrlist.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
http-addrlist.32.o: http-addrlist.c globals.h string.h cups.h ppd.h array.h file.h language.h
http-addrlist.32.o: http-addrlist.c i18n.h transcode.h debug.h
http-support.32.o: http-support.c debug.h globals.h string.h ../config.h cups.h ipp.h http.h
http-support.32.o: http-support.c md5.h ppd.h array.h file.h language.h i18n.h transcode.h
http-support.32.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
http-support.32.o: http-support.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
http-support.32.o: http-support.c language.h i18n.h transcode.h
ipp.32.o: ipp.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
ipp.32.o: ipp.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
ipp.32.o: ipp.c debug.h
ipp-support.32.o: ipp-support.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
ipp-support.32.o: ipp-support.c array.h file.h language.h i18n.h transcode.h debug.h
langprintf.32.o: langprintf.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
langprintf.32.o: langprintf.c array.h file.h language.h i18n.h transcode.h
language.32.o: language.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
language.32.o: language.c array.h file.h language.h i18n.h transcode.h debug.h
localize.32.o: localize.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
localize.32.o: localize.c array.h file.h language.h i18n.h transcode.h debug.h
ipp-support.32.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h md5.h
ipp-support.32.o: ipp-support.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
ipp-support.32.o: ipp-support.c i18n.h transcode.h debug.h
langprintf.32.o: langprintf.c globals.h string.h ../config.h http-private.h http.h md5.h
langprintf.32.o: langprintf.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
langprintf.32.o: langprintf.c i18n.h transcode.h
language.32.o: language.c globals.h string.h ../config.h http-private.h http.h md5.h
language.32.o: language.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
language.32.o: language.c transcode.h debug.h
localize.32.o: localize.c globals.h string.h ../config.h http-private.h http.h md5.h
localize.32.o: localize.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
localize.32.o: localize.c transcode.h debug.h
mark.32.o: mark.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
mark.32.o: mark.c ../config.h debug.h
md5.32.o: md5.c md5.h string.h ../config.h
md5passwd.32.o: md5passwd.c http.h md5.h string.h ../config.h
notify.32.o: notify.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
notify.32.o: notify.c array.h file.h language.h i18n.h transcode.h
notify.32.o: notify.c globals.h string.h ../config.h http-private.h http.h md5.h
notify.32.o: notify.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
notify.32.o: notify.c transcode.h
options.32.o: options.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
options.32.o: options.c ../config.h debug.h
page.32.o: page.c ppd.h array.h file.h string.h ../config.h
ppd.32.o: ppd.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h
ppd.32.o: ppd.c file.h language.h i18n.h transcode.h debug.h
request.32.o: request.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
request.32.o: request.c array.h file.h language.h i18n.h transcode.h debug.h
ppd.32.o: ppd.c globals.h string.h ../config.h http-private.h http.h md5.h
ppd.32.o: ppd.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
ppd.32.o: ppd.c transcode.h debug.h
request.32.o: request.c globals.h string.h ../config.h http-private.h http.h md5.h
request.32.o: request.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
request.32.o: request.c transcode.h debug.h
snprintf.32.o: snprintf.c string.h ../config.h
string.32.o: string.c array.h debug.h string.h ../config.h
tempfile.32.o: tempfile.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
tempfile.32.o: tempfile.c array.h file.h language.h i18n.h transcode.h debug.h
transcode.32.o: transcode.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
transcode.32.o: transcode.c array.h file.h language.h i18n.h transcode.h debug.h
tempfile.32.o: tempfile.c globals.h string.h ../config.h http-private.h http.h md5.h
tempfile.32.o: tempfile.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
tempfile.32.o: tempfile.c transcode.h debug.h
transcode.32.o: transcode.c globals.h string.h ../config.h http-private.h http.h md5.h
transcode.32.o: transcode.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
transcode.32.o: transcode.c i18n.h transcode.h debug.h
usersys.32.o: usersys.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
usersys.32.o: usersys.c globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
usersys.32.o: usersys.c transcode.h
util.32.o: util.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
util.32.o: util.c array.h file.h language.h i18n.h transcode.h debug.h
util.32.o: util.c globals.h string.h ../config.h http-private.h http.h md5.h
util.32.o: util.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
util.32.o: util.c transcode.h debug.h
testadmin.32.o: testadmin.c adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
testadmin.32.o: testadmin.c language.h string.h ../config.h
testarray.32.o: testarray.c ../cups/string.h ../config.h string.h array.h dir.h debug.h
testfile.32.o: testfile.c string.h ../config.h file.h debug.h
testhttp.32.o: testhttp.c http.h md5.h string.h ../config.h
testi18n.32.o: testi18n.c i18n.h transcode.h language.h array.h string.h ../config.h
testipp.32.o: testipp.c ../cups/string.h ../config.h string.h ipp.h http.h md5.h
testipp.32.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h
testipp.32.o: testipp.c md5.h
testlang.32.o: testlang.c i18n.h transcode.h language.h array.h
testppd.32.o: testppd.c ../cups/string.h ../config.h string.h ppd.h array.h file.h
# DO NOT DELETE
adminutil.64.o: adminutil.c adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
adminutil.64.o: adminutil.c language.h globals.h string.h ../config.h i18n.h transcode.h
adminutil.64.o: adminutil.c debug.h
adminutil.64.o: adminutil.c language.h globals.h string.h ../config.h http-private.h
adminutil.64.o: adminutil.c ipp-private.h i18n.h transcode.h debug.h
array.64.o: array.c array.h string.h ../config.h debug.h
attr.64.o: attr.c ppd.h array.h file.h debug.h string.h ../config.h
auth.64.o: auth.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
auth.64.o: auth.c array.h file.h language.h i18n.h transcode.h debug.h
auth.64.o: auth.c globals.h string.h ../config.h http-private.h http.h md5.h
auth.64.o: auth.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
auth.64.o: auth.c transcode.h debug.h
backchannel.64.o: backchannel.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
backend.64.o: backend.c backend.h string.h ../config.h
custom.64.o: custom.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
custom.64.o: custom.c array.h file.h language.h i18n.h transcode.h debug.h
dest.64.o: dest.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
dest.64.o: dest.c array.h file.h language.h i18n.h transcode.h
custom.64.o: custom.c globals.h string.h ../config.h http-private.h http.h md5.h
custom.64.o: custom.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
custom.64.o: custom.c transcode.h debug.h
dest.64.o: dest.c globals.h string.h ../config.h http-private.h http.h md5.h
dest.64.o: dest.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
dest.64.o: dest.c transcode.h
dir.64.o: dir.c dir.h string.h ../config.h debug.h
emit.64.o: emit.c ppd.h array.h file.h string.h ../config.h
emit.64.o: emit.c ppd.h array.h file.h string.h ../config.h debug.h
encode.64.o: encode.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h
file.64.o: file.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
@@ -193,54 +228,67 @@ globals.64.o: globals.c transcode.h debug.h
http.64.o: http.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
http.64.o: http.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
http.64.o: http.c debug.h
http-addr.64.o: http-addr.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
http-addr.64.o: http-addr.c array.h file.h language.h i18n.h transcode.h debug.h
http-addr.64.o: http-addr.c globals.h string.h ../config.h http-private.h http.h md5.h
http-addr.64.o: http-addr.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
http-addr.64.o: http-addr.c i18n.h transcode.h debug.h
http-addrlist.64.o: http-addrlist.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
http-addrlist.64.o: http-addrlist.c globals.h string.h cups.h ppd.h array.h file.h language.h
http-addrlist.64.o: http-addrlist.c i18n.h transcode.h debug.h
http-support.64.o: http-support.c debug.h globals.h string.h ../config.h cups.h ipp.h http.h
http-support.64.o: http-support.c md5.h ppd.h array.h file.h language.h i18n.h transcode.h
http-support.64.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
http-support.64.o: http-support.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
http-support.64.o: http-support.c language.h i18n.h transcode.h
ipp.64.o: ipp.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
ipp.64.o: ipp.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
ipp.64.o: ipp.c debug.h
ipp-support.64.o: ipp-support.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
ipp-support.64.o: ipp-support.c array.h file.h language.h i18n.h transcode.h debug.h
langprintf.64.o: langprintf.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
langprintf.64.o: langprintf.c array.h file.h language.h i18n.h transcode.h
language.64.o: language.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
language.64.o: language.c array.h file.h language.h i18n.h transcode.h debug.h
localize.64.o: localize.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
localize.64.o: localize.c array.h file.h language.h i18n.h transcode.h debug.h
ipp-support.64.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h md5.h
ipp-support.64.o: ipp-support.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
ipp-support.64.o: ipp-support.c i18n.h transcode.h debug.h
langprintf.64.o: langprintf.c globals.h string.h ../config.h http-private.h http.h md5.h
langprintf.64.o: langprintf.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
langprintf.64.o: langprintf.c i18n.h transcode.h
language.64.o: language.c globals.h string.h ../config.h http-private.h http.h md5.h
language.64.o: language.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
language.64.o: language.c transcode.h debug.h
localize.64.o: localize.c globals.h string.h ../config.h http-private.h http.h md5.h
localize.64.o: localize.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
localize.64.o: localize.c transcode.h debug.h
mark.64.o: mark.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
mark.64.o: mark.c ../config.h debug.h
md5.64.o: md5.c md5.h string.h ../config.h
md5passwd.64.o: md5passwd.c http.h md5.h string.h ../config.h
notify.64.o: notify.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
notify.64.o: notify.c array.h file.h language.h i18n.h transcode.h
notify.64.o: notify.c globals.h string.h ../config.h http-private.h http.h md5.h
notify.64.o: notify.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
notify.64.o: notify.c transcode.h
options.64.o: options.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
options.64.o: options.c ../config.h debug.h
page.64.o: page.c ppd.h array.h file.h string.h ../config.h
ppd.64.o: ppd.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h
ppd.64.o: ppd.c file.h language.h i18n.h transcode.h debug.h
request.64.o: request.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
request.64.o: request.c array.h file.h language.h i18n.h transcode.h debug.h
ppd.64.o: ppd.c globals.h string.h ../config.h http-private.h http.h md5.h
ppd.64.o: ppd.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
ppd.64.o: ppd.c transcode.h debug.h
request.64.o: request.c globals.h string.h ../config.h http-private.h http.h md5.h
request.64.o: request.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
request.64.o: request.c transcode.h debug.h
snprintf.64.o: snprintf.c string.h ../config.h
string.64.o: string.c array.h debug.h string.h ../config.h
tempfile.64.o: tempfile.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
tempfile.64.o: tempfile.c array.h file.h language.h i18n.h transcode.h debug.h
transcode.64.o: transcode.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
transcode.64.o: transcode.c array.h file.h language.h i18n.h transcode.h debug.h
tempfile.64.o: tempfile.c globals.h string.h ../config.h http-private.h http.h md5.h
tempfile.64.o: tempfile.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
tempfile.64.o: tempfile.c transcode.h debug.h
transcode.64.o: transcode.c globals.h string.h ../config.h http-private.h http.h md5.h
transcode.64.o: transcode.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
transcode.64.o: transcode.c i18n.h transcode.h debug.h
usersys.64.o: usersys.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
usersys.64.o: usersys.c globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
usersys.64.o: usersys.c transcode.h
util.64.o: util.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
util.64.o: util.c array.h file.h language.h i18n.h transcode.h debug.h
util.64.o: util.c globals.h string.h ../config.h http-private.h http.h md5.h
util.64.o: util.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h
util.64.o: util.c transcode.h debug.h
testadmin.64.o: testadmin.c adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
testadmin.64.o: testadmin.c language.h string.h ../config.h
testarray.64.o: testarray.c ../cups/string.h ../config.h string.h array.h dir.h debug.h
testfile.64.o: testfile.c string.h ../config.h file.h debug.h
testhttp.64.o: testhttp.c http.h md5.h string.h ../config.h
testi18n.64.o: testi18n.c i18n.h transcode.h language.h array.h string.h ../config.h
testipp.64.o: testipp.c ../cups/string.h ../config.h string.h ipp.h http.h md5.h
testipp.64.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h
testipp.64.o: testipp.c md5.h
testlang.64.o: testlang.c i18n.h transcode.h language.h array.h
testppd.64.o: testppd.c ../cups/string.h ../config.h string.h ppd.h array.h file.h
+19 -11
Ver Arquivo
@@ -93,6 +93,7 @@ OBJS = \
HEADERS = \
adminutil.h \
array.h \
backend.h \
cups.h \
dir.h \
file.h \
@@ -137,7 +138,8 @@ all: $(TARGETS)
clean:
$(RM) $(OBJS) $(TARGETS)
$(RM) libcups.so libcups.sl libcups.dylib libcups.32.so libcups.64.so
$(RM) libcups.so libcups.sl libcups.dylib
$(RM) -r 32bit 64bit
#
@@ -184,13 +186,13 @@ installhdrs:
install32bit:
$(INSTALL_DIR) -m 755 $(LIB32DIR)
$(INSTALL_LIB) libcups.32.so.2 $(LIB32DIR)/libcups.so.2
$(LN) libcups.so $(LIB32DIR)/libcups.so.2
$(INSTALL_LIB) 32bit/libcups.so.2 $(LIB32DIR)/libcups.so.2
$(LN) libcups.so.2 $(LIB32DIR)/libcups.so
install64bit:
$(INSTALL_DIR) -m 755 $(LIB64DIR)
$(INSTALL_LIB) libcups.64.so.2 $(LIB64DIR)/libcups.so.2
$(LN) libcups.so $(LIB64DIR)/libcups.so.2
$(INSTALL_LIB) 64bit/libcups.so.2 $(LIB64DIR)/libcups.so.2
$(LN) libcups.so.2 $(LIB64DIR)/libcups.so
#
@@ -235,21 +237,27 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
#
# libcups.32.so.2
# 32bit/libcups.so.2
#
libcups.32.so.2: $(LIB32OBJS)
32bit/libcups.so.2: $(LIB32OBJS)
echo Linking 32-bit $@...
$(DSO) $(ARCH32FLAGS) $(DSOFLAGS) -o $@ $(LIB32OBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
-mkdir 32bit
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 32bit/libcups.so
$(LN) libcups.so.2 32bit/libcups.so
#
# libcups.64.so.2
# 64bit/libcups.so.2
#
libcups.64.so.2: $(LIB64OBJS)
64bit/libcups.so.2: $(LIB64OBJS)
echo Linking 64-bit $@...
$(DSO) $(ARCH64FLAGS) $(DSOFLAGS) -o $@ $(LIB64OBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
-mkdir 64bit
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 64bit/libcups.so
$(LN) libcups.so.2 64bit/libcups.so
#
+40 -19
Ver Arquivo
@@ -103,7 +103,7 @@ cupsAdminCreateWindowsPPD(
linenum; /* Current line number */
time_t curtime; /* Current time */
struct tm *curdate; /* Current date */
static const char *pattrs[] = /* Printer attributes we want */
static const char * const pattrs[] = /* Printer attributes we want */
{
"job-hold-until-supported",
"job-hold-until-default",
@@ -222,18 +222,18 @@ cupsAdminCreateWindowsPPD(
*/
cupsFilePrintf(dstfp, "*%% Commented out for CUPS Windows Driver...\n"
"*%%%s", line + 1);
"*%%%s\n", line + 1);
continue;
}
else if (!strncmp(line, "*JCLOpenUI", 10))
{
jcloption = 1;
cupsFilePuts(dstfp, line);
cupsFilePrintf(dstfp, "%s\n", line);
}
else if (!strncmp(line, "*JCLCloseUI", 11))
{
jcloption = 0;
cupsFilePuts(dstfp, line);
cupsFilePrintf(dstfp, "%s\n", line);
}
else if (jcloption &&
strncmp(line, "*End", 4) &&
@@ -312,12 +312,13 @@ cupsAdminCreateWindowsPPD(
}
snprintf(ptr + 1, sizeof(line) - (ptr - line + 1),
"%%cupsJobTicket: %s=%s\n\"\n*End\n", option, choice);
"%%cupsJobTicket: %s=%s\n\"\n*End", option, choice);
cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s", line);
cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s\n",
line);
}
else
cupsFilePuts(dstfp, line);
cupsFilePrintf(dstfp, "%s\n", line);
}
cupsFileClose(srcfp);
@@ -771,19 +772,31 @@ _cupsAdminGetServerSettings(
if (!value)
continue;
if (!strcasecmp(line, "Port"))
{
remote_access = 1;
}
else if (!strcasecmp(line, "Listen"))
if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
{
char *port; /* Pointer to port number, if any */
if ((port = strrchr(value, ':')) != NULL)
*port = '\0';
else if (isdigit(*value & 255))
{
/*
* Listen on a port number implies remote access...
*/
if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1"))
remote_access = 1;
continue;
}
if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1")
#ifdef AF_LOCAL
&& *value != '/'
#endif /* AF_LOCAL */
#ifdef AF_INET6
&& strcmp(value, "::1")
#endif /* AF_INET6 */
)
remote_access = 1;
}
else if (!strcasecmp(line, "Browsing"))
@@ -859,7 +872,14 @@ _cupsAdminGetServerSettings(
in_location = 0;
}
else if (!strcasecmp(line, "Allow") && in_admin_location &&
strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1"))
strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
#ifdef AF_LOCAL
&& *value != '/'
#endif /* AF_LOCAL */
#ifdef AF_INET6
&& strcmp(value, "::1")
#endif /* AF_INET6 */
)
{
remote_admin = 1;
}
@@ -1083,7 +1103,7 @@ _cupsAdminSetServerSettings(
{
cupsFilePuts(temp, "# Only listen for connections from the local "
"machine.\n");
cupsFilePrintf(temp, "Listen 127.0.0.1:%d\n", ippPort());
cupsFilePrintf(temp, "Listen localhost:%d\n", ippPort());
}
#ifdef CUPS_DEFAULT_DOMAINSOCKET
@@ -1439,7 +1459,7 @@ _cupsAdminSetServerSettings(
{
cupsFilePuts(temp,
"# Only listen for connections from the local machine.\n");
cupsFilePrintf(temp, "Listen 127.0.0.1:%d\n", ippPort());
cupsFilePrintf(temp, "Listen localhost:%d\n", ippPort());
}
#ifdef CUPS_DEFAULT_DOMAINSOCKET
@@ -1680,8 +1700,9 @@ do_samba_command(const char *command, /* I - Command to run */
{
status = -1;
_cupsLangPrintf(stderr, _("cupsaddsmb: Unable to run \"%s\": %s\n"),
command, strerror(errno));
if (logfile)
_cupsLangPrintf(logfile, _("Unable to run \"%s\": %s\n"),
command, strerror(errno));
}
else
{
@@ -1766,7 +1787,7 @@ get_cupsd_conf(
* Read cupsd.conf via a HTTP GET request...
*/
if ((fd = cupsTempFd(name, sizeof(name))) < 0)
if ((fd = cupsTempFd(name, namesize)) < 0)
{
*name = '\0';
+40 -6
Ver Arquivo
@@ -44,14 +44,19 @@
* @since CUPS 1.1.19@
*/
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 * /* 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 */
ppd_attr_t key, /* Search key */
*attr; /* Current attribute */
int diff; /* Current difference */
DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
name ? name : "(null)", spec ? spec : "(null)"));
/*
* Range check input...
*/
@@ -72,7 +77,36 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
* Return the first matching attribute, if any...
*/
return ((ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key));
if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
return (attr);
else if (spec)
return (NULL);
/*
* No match found, loop through the sorted attributes to see if we can
* find a "wildcard" match for the attribute...
*/
for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
attr;
attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
{
if ((diff = strcasecmp(attr->name, name)) == 0)
break;
if (diff > 0)
{
/*
* All remaining attributes are > than the one we are trying to find...
*/
cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
return (NULL);
}
}
return (attr);
}
+2 -2
Ver Arquivo
@@ -112,8 +112,8 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
* Nope - get a new password from the user...
*/
snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(),
http->hostname);
snprintf(prompt, sizeof(prompt), _("Password for %s on %s? "), cupsUser(),
http->hostname[0] == '/' ? "localhost" : http->hostname);
http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
"Digest", 5) != 0;
+1 -1
Ver Arquivo
@@ -161,7 +161,7 @@ cupsBackChannelWrite(
* Write error - abort on fatal errors...
*/
if (errno != EINTR && errno != EAGAIN)
if (errno != EINTR)
return (-1);
}
else
+2 -2
Ver Arquivo
@@ -61,10 +61,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0200
# define CUPS_VERSION 1.0203
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 2
# define CUPS_VERSION_PATCH 0
# define CUPS_VERSION_PATCH 3
# define CUPS_DATE_ANY -1
+42 -9
Ver Arquivo
@@ -456,6 +456,7 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
int wrote; /* Wrote definition? */
cups_dest_t *dest; /* Current destination */
cups_option_t *option; /* Current option */
_ipp_option_t *match; /* Matching attribute for option */
FILE *fp; /* File pointer */
const char *home; /* HOME environment variable */
char filename[1024]; /* lpoptions file */
@@ -567,17 +568,24 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
for (j = dest->num_options, option = dest->options; j > 0; j --, option ++)
{
/*
* See if this option is a printer attribute; if so, skip it...
*/
if ((match = _ippFindOption(option->name)) != NULL &&
match->group_tag == IPP_TAG_PRINTER)
continue;
/*
* See if the server/global options match these; if so, don't
* write 'em.
*/
if (temp && (val = cupsGetOption(option->name, temp->num_options,
temp->options)) != NULL)
{
if (!strcasecmp(val, option->value))
continue;
}
if (temp &&
(val = cupsGetOption(option->name, temp->num_options,
temp->options)) != NULL &&
!strcasecmp(val, option->value))
continue;
/*
* Options don't match, write to the file...
@@ -593,10 +601,35 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
if (option->value[0])
{
if (strchr(option->value, ' ') != NULL)
fprintf(fp, " %s=\"%s\"", option->name, option->value);
else
if (strchr(option->value, ' ') ||
strchr(option->value, '\\') ||
strchr(option->value, '\"') ||
strchr(option->value, '\''))
{
/*
* Quote the value...
*/
fprintf(fp, " %s=\"", option->name);
for (val = option->value; *val; val ++)
{
if (strchr("\"\'\\", *val))
putc('\\', fp);
putc(*val, fp);
}
putc('\"', fp);
}
else
{
/*
* Store the literal value...
*/
fprintf(fp, " %s=%s", option->name, option->value);
}
}
else
fprintf(fp, " %s", option->name);
+5 -5
Ver Arquivo
@@ -5,7 +5,7 @@
*
* This set of APIs abstracts enumeration of directory entries.
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -39,9 +39,9 @@
* C++ magic...
*/
# ifdef _cplusplus
# ifdef __cplusplus
extern "C" {
# endif /* _cplusplus */
# endif /* __cplusplus */
/*
@@ -67,9 +67,9 @@ extern cups_dentry_t *cupsDirRead(cups_dir_t *dp);
extern void cupsDirRewind(cups_dir_t *dp);
# ifdef _cplusplus
# ifdef __cplusplus
}
# endif /* _cplusplus */
# endif /* __cplusplus */
#endif /* !_CUPS_DIR_H_ */
/*
+23
Ver Arquivo
@@ -50,6 +50,7 @@
#include <stdlib.h>
#include "string.h"
#include <errno.h>
#include "debug.h"
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
@@ -111,6 +112,9 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
ppd_choice_t **collect; /* Collected choices */
DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n",
ppd, section, min_order, choices));
if (ppd == NULL)
return (0);
@@ -132,6 +136,8 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
for (k = o->num_choices, c = o->choices; k > 0; k --, c ++)
if (c->marked && count < 1000)
{
DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword,
c->choice));
collect[count] = c;
count ++;
}
@@ -142,6 +148,8 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
for (m = o->num_choices, c = o->choices; m > 0; m --, c ++)
if (c->marked && count < 1000)
{
DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword,
c->choice));
collect[count] = c;
count ++;
}
@@ -155,6 +163,8 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
qsort(collect, count, sizeof(ppd_choice_t *),
(int (*)(const void *, const void *))ppd_sort);
DEBUG_printf(("ppdCollect2: %d marked choices...\n", count));
/*
* Return the array and number of choices; if 0, free the array since
* it isn't needed.
@@ -492,6 +502,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
struct lconv *loc; /* Locale data */
DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)\n",
ppd, section, min_order));
/*
* Range check input...
*/
@@ -527,6 +540,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
!strcasecmp(choices[i]->choice, "Custom"))
{
DEBUG_puts("ppdEmitString: Custom size set!");
bufsize += 37; /* %%BeginFeature: *CustomPageSize True\n */
bufsize += 50; /* Five 9-digit numbers + newline */
}
@@ -580,6 +595,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
* Allocate memory...
*/
DEBUG_printf(("ppdEmitString: Allocating %d bytes for string...\n", bufsize));
if ((buffer = calloc(1, bufsize)) == NULL)
{
free(choices);
@@ -608,6 +625,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
DEBUG_printf(("Adding code for %s=%s...\n", choices[i]->option->keyword,
choices[i]->choice));
if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
!strcasecmp(choices[i]->choice, "Custom"))
@@ -800,6 +820,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
strlcpy(bufptr, "%%EndFeature\n"
"} stopped cleartomark\n", bufend - bufptr + 1);
bufptr += strlen(bufptr);
DEBUG_printf(("ppdEmitString: Offset in string is %d...\n",
bufptr - buffer));
}
else
{
+31 -21
Ver Arquivo
@@ -28,6 +28,7 @@
* cupsEncodeOptions() - Encode printer options into IPP attributes.
* cupsEncodeOptions2() - Encode printer options into IPP attributes for
* a group.
* _ippFindOption() - Find the attribute information for an option.
* compare_ipp_options() - Compare two IPP options.
*/
@@ -49,13 +50,6 @@
* **** THIS LIST MUST BE SORTED ****
*/
typedef struct
{
const char *name;
ipp_tag_t value_tag;
ipp_tag_t group_tag;
} _ipp_option_t;
static const _ipp_option_t ipp_options[] =
{
{ "blackplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
@@ -114,6 +108,8 @@ static const _ipp_option_t ipp_options[] =
{ "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
{ "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
{ "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ "printer-error-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
{ "printer-is-accepting-jobs",IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
@@ -127,10 +123,10 @@ static const _ipp_option_t ipp_options[] =
{ "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ "printer-type", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ "printer-uri", IPP_TAG_URI, IPP_TAG_OPERATION },
{ "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
{ "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
{ "requesting-user-name-allowed", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ "requesting-user-name-denied", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ "resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB },
{ "resolution-default", IPP_TAG_RESOLUTION, IPP_TAG_PRINTER },
{ "saturation", IPP_TAG_INTEGER, IPP_TAG_JOB },
@@ -241,8 +237,7 @@ cupsEncodeOptions2(
for (i = num_options, option = options; i > 0; i --, option ++)
{
_ipp_option_t key, /* Search key */
*match; /* Matching attribute */
_ipp_option_t *match; /* Matching attribute */
/*
@@ -258,16 +253,7 @@ cupsEncodeOptions2(
* Figure out the proper value and group tags for this option...
*/
key.name = option->name;
match = (_ipp_option_t *)bsearch(&key, ipp_options,
sizeof(ipp_options) /
sizeof(ipp_options[0]),
sizeof(ipp_options[0]),
(int (*)(const void *,
const void *))
compare_ipp_options);
if (match)
if ((match = _ippFindOption(option->name)) != NULL)
{
if (match->group_tag != group_tag)
continue;
@@ -544,6 +530,30 @@ cupsEncodeOptions2(
}
/*
* '_ippFindOption()' - Find the attribute information for an option.
*/
_ipp_option_t * /* O - Attribute information */
_ippFindOption(const char *name) /* I - Option/attribute name */
{
_ipp_option_t key; /* Search key */
/*
* Lookup the proper value and group tags for this option...
*/
key.name = name;
return ((_ipp_option_t *)bsearch(&key, ipp_options,
sizeof(ipp_options) / sizeof(ipp_options[0]),
sizeof(ipp_options[0]),
(int (*)(const void *, const void *))
compare_ipp_options));
}
/*
* 'compare_ipp_options()' - Compare two IPP options.
*/
+1
Ver Arquivo
@@ -1260,6 +1260,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
fp->pos = 0;
fp->ptr = NULL;
fp->end = NULL;
fp->eof = 0;
return (0);
}
+5 -5
Ver Arquivo
@@ -8,7 +8,7 @@
* our own file functions allows us to provide transparent support of
* gzip'd print files, PPD files, etc.
*
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -47,9 +47,9 @@ typedef off_t ssize_t; /* @private@ */
* C++ magic...
*/
# ifdef _cplusplus
# ifdef __cplusplus
extern "C" {
# endif /* _cplusplus */
# endif /* __cplusplus */
/*
@@ -103,9 +103,9 @@ extern int cupsFileUnlock(cups_file_t *fp);
extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes);
# ifdef _cplusplus
# ifdef __cplusplus
}
# endif /* _cplusplus */
# endif /* __cplusplus */
#endif /* !_CUPS_FILE_H_ */
/*
+3 -2
Ver Arquivo
@@ -182,8 +182,9 @@ _cups_getifaddrs(struct ifaddrs **addrs)/* O - List of interfaces */
* Got it, make a copy...
*/
if ((temp->ifa_dstaddr = calloc(1, sizeof(request.ifr_broadaddr))) != NULL)
memcpy(temp->ifa_dstaddr, &(request.ifr_broadaddr),
if ((temp->ifa_broadaddr =
calloc(1, sizeof(request.ifr_broadaddr))) != NULL)
memcpy(temp->ifa_broadaddr, &(request.ifr_broadaddr),
sizeof(request.ifr_broadaddr));
}
}
+1
Ver Arquivo
@@ -32,6 +32,7 @@
*/
# include "string.h"
# include "http-private.h"
# include "cups.h"
# include "i18n.h"
+14 -2
Ver Arquivo
@@ -412,7 +412,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
if (host->h_addrtype == AF_INET6)
{
temp->addr.ipv6.sin6_family = AF_INET6;
memcpy(&(temp->addr.ipv6), host->h_addr_list[i],
memcpy(&(temp->addr.ipv6.sin6_addr), host->h_addr_list[i],
sizeof(temp->addr.ipv6));
temp->addr.ipv6.sin6_port = htons(portnum);
}
@@ -420,7 +420,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
# endif /* AF_INET6 */
{
temp->addr.ipv4.sin_family = AF_INET;
memcpy(&(temp->addr.ipv4), host->h_addr_list[i],
memcpy(&(temp->addr.ipv4.sin_addr), host->h_addr_list[i],
sizeof(temp->addr.ipv4));
temp->addr.ipv4.sin_port = htons(portnum);
}
@@ -506,6 +506,9 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
temp->addr.ipv6.sin6_addr.s6_addr32[3] = htonl(1);
# endif /* WIN32 */
if (!first)
first = temp;
addr = temp;
}
@@ -527,6 +530,9 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
temp->addr.ipv4.sin_port = htons(portnum);
temp->addr.ipv4.sin_addr.s_addr = htonl(0x7f000001);
if (!first)
first = temp;
if (addr)
addr->next = temp;
else
@@ -556,6 +562,9 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
temp->addr.ipv6.sin6_family = AF_INET6;
temp->addr.ipv6.sin6_port = htons(portnum);
if (!first)
first = temp;
addr = temp;
}
@@ -576,6 +585,9 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
temp->addr.ipv4.sin_family = AF_INET;
temp->addr.ipv4.sin_port = htons(portnum);
if (!first)
first = temp;
if (addr)
addr->next = temp;
else
+14 -2
Ver Arquivo
@@ -161,11 +161,23 @@ struct ifaddrs /**** Interface Structure ****/
char *ifa_name; /* Name of interface */
unsigned int ifa_flags; /* Flags (up, point-to-point, etc.) */
struct sockaddr *ifa_addr, /* Network address */
*ifa_netmask, /* Address mask */
*ifa_dstaddr; /* Broadcast or destination address */
*ifa_netmask; /* Address mask */
union
{
struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */
} ifa_ifu;
void *ifa_data; /* Interface statistics */
};
# ifndef ifa_broadaddr
# define ifa_broadaddr ifa_ifu.ifu_broadaddr
# endif /* !ifa_broadaddr */
# ifndef ifa_dstaddr
# define ifa_dstaddr ifa_ifu.ifu_dstaddr
# endif /* !ifa_dstaddr */
extern int _cups_getifaddrs(struct ifaddrs **addrs);
# define getifaddrs _cups_getifaddrs
extern void _cups_freeifaddrs(struct ifaddrs *addrs);
+43 -19
Ver Arquivo
@@ -866,7 +866,7 @@ httpGets(char *line, /* I - Line to read into */
* No newline; see if there is more data to be read...
*/
if (!http->blocking && !http_wait(http, 1000))
if (!http->blocking && !http_wait(http, 10000))
{
DEBUG_puts("httpGets: Timed out!");
http->error = ETIMEDOUT;
@@ -1100,15 +1100,20 @@ httpPrintf(http_t *http, /* I - HTTP connection */
DEBUG_printf(("httpPrintf: %s", buf));
if (http->wused)
if (http->data_encoding == HTTP_ENCODE_FIELDS)
return (httpWrite2(http, buf, bytes));
else
{
DEBUG_puts(" flushing existing data...");
if (http->wused)
{
DEBUG_puts(" flushing existing data...");
if (httpFlushWrite(http) < 0)
return (-1);
if (httpFlushWrite(http) < 0)
return (-1);
}
return (http_write(http, buf, bytes));
}
return (http_write(http, buf, bytes));
}
@@ -1222,7 +1227,7 @@ httpRead2(http_t *http, /* I - HTTP connection */
* Buffer small reads for better performance...
*/
if (!http->blocking && !httpWait(http, 1000))
if (!http->blocking && !httpWait(http, 10000))
return (0);
if (http->data_remaining > sizeof(http->buffer))
@@ -1285,7 +1290,7 @@ httpRead2(http_t *http, /* I - HTTP connection */
#ifdef HAVE_SSL
else if (http->tls)
{
if (!http->blocking && !httpWait(http, 1000))
if (!http->blocking && !httpWait(http, 10000))
return (0);
bytes = http_read_ssl(http, buffer, length);
@@ -1293,7 +1298,7 @@ httpRead2(http_t *http, /* I - HTTP connection */
#endif /* HAVE_SSL */
else
{
if (!http->blocking && !httpWait(http, 1000))
if (!http->blocking && !httpWait(http, 10000))
return (0);
DEBUG_printf(("httpRead2: reading %d bytes from socket...\n", length));
@@ -1415,13 +1420,11 @@ _httpReadCDSA(
*dataLength = 0;
if (bytes == 0)
result = errSSLClosedAbort;
result = errSSLClosedGraceful;
else if (errno == EAGAIN)
result = errSSLWouldBlock;
else if (errno == EPIPE)
result = errSSLClosedAbort;
else
result = errSSLInternal;
result = errSSLClosedAbort;
}
return result;
@@ -1810,6 +1813,16 @@ httpWait(http_t *http, /* I - HTTP connection */
if (http->used)
return (1);
/*
* Flush pending data, if any...
*/
if (http->wused)
{
if (httpFlushWrite(http) < 0)
return (0);
}
/*
* If not, check the SSL/TLS buffers and do a select() on the connection...
*/
@@ -1880,7 +1893,7 @@ httpWrite2(http_t *http, /* I - HTTP connection */
httpFlushWrite(http);
}
if ((length + http->wused) <= sizeof(http->wbuffer))
if ((length + http->wused) < sizeof(http->wbuffer))
{
/*
* Write to buffer...
@@ -1994,10 +2007,8 @@ _httpWriteCDSA(
if (errno == EAGAIN)
result = errSSLWouldBlock;
else if (errno == EPIPE)
result = errSSLClosedAbort;
else
result = errSSLInternal;
result = errSSLClosedAbort;
}
return result;
@@ -2148,11 +2159,20 @@ http_send(http_t *http, /* I - HTTP connection */
if (httpReconnect(http))
return (-1);
/*
* Flush any written data that is pending...
*/
if (http->wused)
httpFlushWrite(http);
/*
* Send the request header...
*/
http->state = request;
http->state = request;
http->data_encoding = HTTP_ENCODE_FIELDS;
if (request == HTTP_POST || request == HTTP_PUT)
http->state ++;
@@ -2205,6 +2225,7 @@ http_send(http_t *http, /* I - HTTP connection */
return (-1);
}
httpFlushWrite(http);
httpGetLength2(http);
httpClearFields(http);
@@ -2337,6 +2358,9 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
if (!error)
error = SSLSetAllowsAnyRoot(conn->session, true);
if (!error)
error = SSLSetProtocolVersionEnabled(conn->session, kSSLProtocol2, false);
if (!error)
{
while ((error = SSLHandshake(conn->session)) == errSSLWouldBlock)
+16 -4
Ver Arquivo
@@ -39,8 +39,8 @@
# include <winsock2.h>
# include <ws2tcpip.h>
# else
# ifdef __sgi /* IRIX needs this for IPv6 support!?! */
# define INET6
# ifdef __sgi
# define INET6 /* IRIX IPv6 support... */
# endif /* __sgi */
# include <unistd.h>
# include <sys/time.h>
@@ -53,6 +53,9 @@
# if !defined(__APPLE__) || !defined(TCP_NODELAY)
# include <netinet/tcp.h>
# endif /* !__APPLE__ || !TCP_NODELAY */
# if defined(AF_UNIX) && !defined(AF_LOCAL)
# define AF_LOCAL AF_UNIX /* Older UNIX's have old names... */
# endif /* AF_UNIX && !AF_LOCAL */
# ifdef AF_LOCAL
# include <sys/un.h>
# endif /* AF_LOCAL */
@@ -98,7 +101,7 @@ extern "C" {
#if defined(AF_INET6) && !defined(s6_addr32)
# if defined(__sun)
# define s6_addr32 _S6_un._S6_u32
# elif defined(__FreeBSD__) || defined(__APPLE__)
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
# define s6_addr32 __u6_addr.__u6_addr32
# elif defined(__osf__)
# define s6_addr32 s6_un.sa6_laddr
@@ -139,7 +142,8 @@ typedef enum http_auth_e /**** HTTP authentication types ****/
typedef enum http_encoding_e /**** HTTP transfer encoding values ****/
{
HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */
HTTP_ENCODE_CHUNKED /* Data is chunked */
HTTP_ENCODE_CHUNKED, /* Data is chunked */
HTTP_ENCODE_FIELDS /* Sending HTTP fields */
} http_encoding_t;
typedef enum http_encryption_e /**** HTTP encryption values ****/
@@ -322,6 +326,14 @@ typedef struct http_addrlist_s /**** Socket address list, which is
typedef struct _http_s /**** HTTP connection structure. ****/
{
/*
* DO NOT ACCESS MEMBERS OF THIS STRUCTURE DIRECTLY; INSTEAD, USE THE
* PROVIDED APIS FOR ACCESSING THE VALUES INSTEAD.
*
* This structure definition will be removed from the public headers in
* CUPS 1.3.
*/
int fd; /* File descriptor for this socket */
int blocking; /* To block or not to block */
int error; /* Last error on read */
+1
Ver Arquivo
@@ -105,6 +105,7 @@ extern const char *_cupsLangString(cups_lang_t *lang, const char *message);
extern void _cupsMessageFree(cups_array_t *a);
extern cups_array_t *_cupsMessageLoad(const char *filename);
extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
extern void _cupsSetLocale(void);
# ifdef __cplusplus
}
+13
Ver Arquivo
@@ -43,11 +43,24 @@ extern "C" {
# endif /* __cplusplus */
/*
* Structures...
*/
typedef struct /**** Attribute mapping data ****/
{
const char *name; /* Option/attribute name */
ipp_tag_t value_tag; /* Value tag for this attribute */
ipp_tag_t group_tag; /* Group tag for this attribute */
} _ipp_option_t;
/*
* Prototypes for private functions...
*/
extern ipp_attribute_t *_ippAddAttr(ipp_t *, int);
extern _ipp_option_t *_ippFindOption(const char *name);
extern void _ippFreeAttr(ipp_attribute_t *);
+31
Ver Arquivo
@@ -304,19 +304,48 @@ ippPort(void)
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
DEBUG_puts("ippPort()");
if (!cg->ipp_port)
{
/*
* See if the server definition includes the port number...
*/
DEBUG_puts("ippPort: Not initialized...");
cupsServer();
#ifdef DEBUG
if (cg->ipp_port)
puts("ippPort: Set via cupsServer()...");
#endif /* DEBUG */
}
if (!cg->ipp_port)
{
if ((ipp_port = getenv("IPP_PORT")) != NULL)
{
DEBUG_puts("ippPort: Set via IPP_PORT...");
portnum = atoi(ipp_port);
}
else if ((port = getservbyname("ipp", NULL)) == NULL)
{
DEBUG_puts("ippPort: Set via CUPS_DEFAULT_IPP_PORT...");
portnum = CUPS_DEFAULT_IPP_PORT;
}
else
{
DEBUG_puts("ippPort: Set via ipp service entry...");
portnum = ntohs(port->s_port);
}
if (portnum > 0)
cg->ipp_port = portnum;
}
DEBUG_printf(("ippPort: Returning %d...\n", cg->ipp_port));
return (cg->ipp_port);
}
@@ -328,6 +357,8 @@ ippPort(void)
void
ippSetPort(int p) /* I - Port number to use */
{
DEBUG_printf(("ippSetPort(p=%d)\n", p));
_cupsGlobals()->ipp_port = p;
}
+2 -2
Ver Arquivo
@@ -2742,10 +2742,10 @@ ipp_read_http(http_t *http, /* I - Client connection */
if (!http->blocking)
{
/*
* Wait up to 1 second for more data on non-blocking sockets...
* Wait up to 10 seconds for more data on non-blocking sockets...
*/
if (!httpWait(http, 1000))
if (!httpWait(http, 10000))
{
/*
* Signal no data...
+4 -2
Ver Arquivo
@@ -172,10 +172,11 @@ typedef enum ipp_jstate_e /**** Job States.... */
IPP_JOB_HELD, /* Job is held for printing */
IPP_JOB_PROCESSING, /* Job is currently printing */
IPP_JOB_STOPPED, /* Job has been stopped */
IPP_JOB_CANCELLED, /* Job has been cancelled */
IPP_JOB_CANCELED, /* Job has been canceled */
IPP_JOB_ABORTED, /* Job has aborted due to error */
IPP_JOB_COMPLETED /* Job has completed successfully */
} ipp_jstate_t;
#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
typedef enum ipp_pstate_e /**** Printer States.... */
{
@@ -304,10 +305,11 @@ typedef enum ipp_status_e /**** IPP status codes... ****/
IPP_TEMPORARY_ERROR, /* server-error-temporary-error */
IPP_NOT_ACCEPTING, /* server-error-not-accepting-jobs */
IPP_PRINTER_BUSY, /* server-error-busy */
IPP_ERROR_JOB_CANCELLED, /* server-error-job-canceled */
IPP_ERROR_JOB_CANCELED, /* server-error-job-canceled */
IPP_MULTIPLE_JOBS_NOT_SUPPORTED, /* server-error-multiple-document-jobs-not-supported */
IPP_PRINTER_IS_DEACTIVATED /* server-error-printer-is-deactivated */
} ipp_status_t;
#define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/
+46
Ver Arquivo
@@ -28,6 +28,7 @@
*
* _cupsLangPrintf() - Print a formatted message string to a file.
* _cupsLangPuts() - Print a static message string to a file.
* _cupsSetLocale() - Set the current locale.
*/
/*
@@ -138,6 +139,51 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */
}
/*
* '_cupsSetLocale()' - Set the current locale.
*/
void
_cupsSetLocale(void)
{
#ifdef LC_TIME
const char *lc_time; /* Current LC_TIME value */
char new_lc_time[255], /* New LC_TIME value */
*charset; /* Pointer to character set */
#endif /* LC_TIME */
/*
* Set the locale so that times, etc. are displayed properly.
*
* Unfortunately, while we need the localized time value, we *don't*
* want to use the localized charset for the time value, so we need
* to set LC_TIME to the locale name with .UTF-8 on the end (if
* the locale includes a character set specifier...)
*/
setlocale(LC_ALL, "");
#ifdef LC_TIME
if ((lc_time = setlocale(LC_TIME, NULL)) == NULL)
lc_time = setlocale(LC_ALL, NULL);
if (lc_time)
{
strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
if ((charset = strchr(new_lc_time, '.')) == NULL)
charset = new_lc_time + strlen(new_lc_time);
strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
}
else
strcpy(new_lc_time, "C");
setlocale(LC_TIME, new_lc_time);
#endif /* LC_TIME */
}
/*
* End of "$Id$".
*/
+19
Ver Arquivo
@@ -560,6 +560,23 @@ cupsLangGet(const char *language) /* I - Language or locale */
encoding = (cups_encoding_t)i;
break;
}
if (encoding == CUPS_AUTO_ENCODING)
{
/*
* Map alternate names for various character sets...
*/
if (!strcasecmp(charset, "iso-2022-jp") ||
!strcasecmp(charset, "sjis"))
encoding = CUPS_WINDOWS_932;
else if (!strcasecmp(charset, "iso-2022-cn"))
encoding = CUPS_WINDOWS_936;
else if (!strcasecmp(charset, "iso-2022-kr"))
encoding = CUPS_WINDOWS_949;
else if (!strcasecmp(charset, "big5"))
encoding = CUPS_WINDOWS_950;
}
}
DEBUG_printf(("cupsLangGet: encoding=%d(%s)\n", encoding,
@@ -1271,6 +1288,8 @@ cups_unquote(char *d, /* O - Unquoted string */
*d = *d * 8 + *s - '0';
s ++;
}
d ++;
}
else
{
+1
Ver Arquivo
@@ -16,6 +16,7 @@ _cupsMessageFree
_cupsMessageLoad
_cupsMessageLookup
_cupsSetError
_cupsSetLocale
_cupsStrAlloc
_cupsStrFlush
_cupsStrFormatd
+19 -2
Ver Arquivo
@@ -80,6 +80,8 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
* Range check input...
*/
DEBUG_printf(("ppdLocalize(ppd=%p)\n", ppd));
if (!ppd)
return (-1);
@@ -93,6 +95,9 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
strlcpy(ll_CC, lang->language, sizeof(ll_CC));
strlcpy(ll, lang->language, sizeof(ll));
DEBUG_printf((" lang->language=\"%s\", ll=\"%s\", ll_CC=\"%s\"...\n",
lang->language, ll, ll_CC));
/*
* Now lookup all of the groups, options, choices, etc.
*/
@@ -165,17 +170,29 @@ ppd_text(ppd_file_t *ppd, /* I - PPD file */
ppd_attr_t *attr; /* Current attribute */
DEBUG_printf(("ppd_text(ppd=%p, keyword=\"%s\", spec=\"%s\", "
"ll_CC=\"%s\", ll=\"%s\")\n",
ppd, keyword, spec, ll_CC, ll));
/*
* Look for Keyword.ll_CC, then Keyword.ll...
*/
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll_CC);
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll_CC, keyword);
if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL)
{
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll);
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll, keyword);
attr = ppdFindAttr(ppd, lkeyword, spec);
}
#ifdef DEBUG
if (attr)
printf(" *%s %s/%s: \"%s\"\n", attr->name, attr->spec, attr->text,
attr->value ? attr->value : "");
else
puts(" NOT FOUND");
#endif /* DEBUG */
/*
* Return text if we find it...
*/
+38 -8
Ver Arquivo
@@ -241,9 +241,6 @@ ppd_option_t * /* O - Pointer to option or NULL */
ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */
const char *option) /* I - Option/Keyword name */
{
ppd_option_t key; /* Option search key */
/*
* Range check input...
*/
@@ -251,13 +248,39 @@ ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */
if (!ppd || !option)
return (NULL);
/*
* Search...
*/
if (ppd->options)
{
/*
* Search in the array...
*/
strlcpy(key.keyword, option, sizeof(key.keyword));
ppd_option_t key; /* Option search key */
return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
strlcpy(key.keyword, option, sizeof(key.keyword));
return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
}
else
{
/*
* Search in each group...
*/
int i, j; /* Looping vars */
ppd_group_t *group; /* Current group */
ppd_option_t *optptr; /* Current option */
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
for (j = group->num_options, optptr = group->options;
j > 0;
j --, optptr ++)
if (!strcasecmp(optptr->keyword, option))
return (optptr);
return (NULL);
}
}
@@ -384,6 +407,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
ppd_cparam_t *cparam; /* Custom parameter */
char *units; /* Custom points units */
if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
{
if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL)
@@ -432,6 +456,12 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
}
}
}
/*
* Make sure that we keep the option marked below...
*/
choice = "Custom";
}
else if (choice[0] == '{')
{
+1 -1
Ver Arquivo
@@ -104,7 +104,7 @@ cupsNotifySubject(cups_lang_t *lang, /* I - Language data */
case IPP_JOB_STOPPED :
state = _cupsLangString(lang, _("stopped"));
break;
case IPP_JOB_CANCELLED :
case IPP_JOB_CANCELED :
state = _cupsLangString(lang, _("canceled"));
break;
case IPP_JOB_ABORTED :
+1 -1
Ver Arquivo
@@ -87,7 +87,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
if (!nameptr || *nameptr != 'x')
return (NULL);
l = _cupsStrScand(nameptr, &nameptr, loc);
l = _cupsStrScand(nameptr + 1, &nameptr, loc);
if (!nameptr)
return (NULL);
+1 -3
Ver Arquivo
@@ -2037,10 +2037,8 @@ ppd_compare_attrs(ppd_attr_t *a, /* I - First attribute */
if ((ret = strcasecmp(a->name, b->name)) != 0)
return (ret);
else if (a->spec[0] && b->spec[0])
return (strcasecmp(a->spec, b->spec));
else
return (0);
return (strcasecmp(a->spec, b->spec));
}
+11 -1
Ver Arquivo
@@ -70,6 +70,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
struct stat fileinfo; /* File information */
int bytes; /* Number of bytes read/written */
char buffer[32768]; /* Output buffer */
http_status_t expect; /* Expect: header to use */
DEBUG_printf(("cupsDoFileRequest(%p, %p, \'%s\', \'%s\')\n",
@@ -146,6 +147,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
response = NULL;
status = HTTP_ERROR;
expect = HTTP_CONTINUE;
while (response == NULL)
{
@@ -163,7 +165,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
httpSetLength(http, length);
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetExpect(http, HTTP_CONTINUE);
httpSetExpect(http, expect);
DEBUG_printf(("cupsDoFileRequest: authstring=\"%s\"\n", http->authstring));
@@ -312,6 +314,14 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
continue;
}
#endif /* HAVE_SSL */
else if (status == HTTP_EXPECTATION_FAILED)
{
/*
* Don't try using the Expect: header the next time around...
*/
expect = (http_status_t)0;
}
else if (status != HTTP_OK)
{
DEBUG_printf(("cupsDoFileRequest: error %d...\n", status));
+8 -2
Ver Arquivo
@@ -96,7 +96,10 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
if (*format == '*')
{
// Get width from argument...
/*
* Get width from argument...
*/
format ++;
width = va_arg(ap, int);
@@ -125,7 +128,10 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */
if (*format == '*')
{
// Get precision from argument...
/*
* Get precision from argument...
*/
format ++;
prec = va_arg(ap, int);
+15 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -311,9 +311,21 @@ main(int argc, /* I - Number of command-line arguments */
addrlist = httpAddrGetList(hostname, AF_UNSPEC, NULL);
if (addrlist)
{
for (i = 0, addr = addrlist; addr; i ++, addr = addr->next);
for (i = 0, addr = addrlist; addr; i ++, addr = addr->next)
{
char numeric[1024]; /* Numeric IP address */
httpAddrString(&(addr->addr), numeric, sizeof(numeric));
if (!strcmp(numeric, "UNKNOWN"))
break;
}
if (addr)
printf("FAIL (bad address for %s)\n", hostname);
else
printf("PASS (%d address(es) for %s)\n", i, hostname);
printf("PASS (%d address(es) for %s)\n", i, hostname);
httpAddrFreeList(addrlist);
}
else
+2 -3
Ver Arquivo
@@ -82,7 +82,6 @@ main(int argc, /* I - Argument Count */
/* "A != <CJK U+4E42>." - use Windows 950 (Big5) or EUC-TW */
cups_utf8_t utf8dest[1024]; /* UTF-8 destination string */
cups_utf32_t utf32dest[1024]; /* UTF-32 destination string */
_cups_vmap_t *vmap; /* VBCS charmap pointer */
/*
@@ -190,7 +189,7 @@ main(int argc, /* I - Argument Count */
fputs("_cupsCharmapGet(CUPS_EUC_JP): ", stdout);
if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(CUPS_EUC_JP)) == NULL)
if (!_cupsCharmapGet(CUPS_EUC_JP))
{
errors ++;
puts("FAIL");
@@ -204,7 +203,7 @@ main(int argc, /* I - Argument Count */
fputs("_cupsCharmapGet(CUPS_EUC_TW): ", stdout);
if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(CUPS_EUC_TW)) == NULL)
if (!_cupsCharmapGet(CUPS_EUC_TW))
{
errors ++;
puts("FAIL");
+14 -1
Ver Arquivo
@@ -36,7 +36,7 @@
#include <stdlib.h>
#include <cups/string.h>
#include <errno.h>
#include "ipp.h"
#include "ipp-private.h"
#ifdef WIN32
# include <io.h>
#else
@@ -282,6 +282,19 @@ main(int argc, /* I - Number of command-line arguments */
ippDelete(request);
/*
* Test _ippFindOption() private API...
*/
fputs("_ippFindOption(\"printer-type\"): ", stdout);
if (_ippFindOption("printer-type"))
puts("PASS");
else
{
puts("FAIL");
status = 1;
}
/*
* Summarize...
*/
+69 -2
Ver Arquivo
@@ -59,6 +59,39 @@ static const char *default_code =
"%%BeginFeature: *InputSlot Tray\n"
"InputSlot=Tray\n"
"%%EndFeature\n"
"} stopped cleartomark\n"
"[{\n"
"%%BeginFeature: *IntOption None\n"
"%%EndFeature\n"
"} stopped cleartomark\n"
"[{\n"
"%%BeginFeature: *StringOption None\n"
"%%EndFeature\n"
"} stopped cleartomark\n";
static const char *custom_code =
"[{\n"
"%%BeginFeature: *CustomPageSize True\n"
"400\n"
"500\n"
"0\n"
"0\n"
"0\n"
"PageSize=Custom\n"
"%%EndFeature\n"
"} stopped cleartomark\n"
"[{\n"
"%%BeginFeature: *InputSlot Tray\n"
"InputSlot=Tray\n"
"%%EndFeature\n"
"} stopped cleartomark\n"
"[{\n"
"%%BeginFeature: *IntOption None\n"
"%%EndFeature\n"
"} stopped cleartomark\n"
"[{\n"
"%%BeginFeature: *StringOption None\n"
"%%EndFeature\n"
"} stopped cleartomark\n";
@@ -107,7 +140,7 @@ main(int argc, /* I - Number of command-line arguments */
printf("FAIL (%d conflicts)\n", conflicts);
}
fputs("ppdEmitString: ", stdout);
fputs("ppdEmitString (defaults): ", stdout);
if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
!strcmp(s, default_code))
puts("PASS");
@@ -120,6 +153,24 @@ main(int argc, /* I - Number of command-line arguments */
puts(s);
}
if (s)
free(s);
fputs("ppdEmitString (custom size): ", stdout);
ppdMarkOption(ppd, "PageSize", "Custom.400x500");
if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
!strcmp(s, custom_code))
puts("PASS");
else
{
printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
(int)strlen(custom_code));
if (s)
puts(s);
}
if (s)
free(s);
@@ -141,10 +192,18 @@ main(int argc, /* I - Number of command-line arguments */
else
{
int i, j, k; /* Looping vars */
ppd_attr_t *attr; /* Current attribute */
ppd_group_t *group; /* Option group */
ppd_option_t *option; /* Option */
char lang[255]; /* LANG environment variable */
if (argc > 2)
{
snprintf(lang, sizeof(lang), "LANG=%s", argv[2]);
putenv(lang);
}
ppdLocalize(ppd);
for (i = ppd->num_groups, group = ppd->groups;
@@ -152,7 +211,7 @@ main(int argc, /* I - Number of command-line arguments */
i --, group ++)
{
printf("%s (%s):\n", group->name, group->text);
for (j = group->num_options, option = group->options;
j > 0;
j --, option ++)
@@ -164,6 +223,14 @@ main(int argc, /* I - Number of command-line arguments */
option->choices[k].text);
}
}
puts("Attributes:");
for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
attr;
attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
printf(" *%s %s/%s: \"%s\"\n", attr->name, attr->spec,
attr->text, attr->value ? attr->value : "");
}
}
+1 -3
Ver Arquivo
@@ -408,7 +408,6 @@ cupsUTF8ToUTF32(
const cups_utf8_t *src, /* I - Source string */
const int maxout) /* I - Max output */
{
size_t srclen; /* Source string length */
int i; /* Looping variable */
cups_utf8_t ch; /* Character value */
cups_utf8_t next; /* Next character value */
@@ -430,7 +429,6 @@ cupsUTF8ToUTF32(
*/
*dest++ = 0xfeff;
srclen = strlen((char *)src);
for (i = maxout - 1; *src && i > 0; i --)
{
@@ -1142,7 +1140,7 @@ free_vbcs_charmap(_cups_vmap_t *vmap) /* I - Character set */
*/
void * /* O - Charset map pointer */
static void * /* O - Charset map pointer */
get_charmap(
const cups_encoding_t encoding) /* I - Encoding */
{
+16
Ver Arquivo
@@ -49,6 +49,7 @@
#ifdef WIN32
# include <windows.h>
#endif /* WIN32 */
#include "debug.h"
/*
@@ -224,15 +225,21 @@ cupsServer(void)
linenum = 0;
while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum) != NULL)
{
DEBUG_printf(("cupsServer: %d: %s %s\n", linenum, line,
value ? value : "(null)"));
if (!strcasecmp(line, "ServerName") && value)
{
/*
* Got it!
*/
DEBUG_puts("cupsServer: Got a ServerName line!");
server = value;
break;
}
}
cupsFileClose(fp);
}
@@ -242,6 +249,8 @@ cupsServer(void)
* Copy the server name over and set the port number, if any...
*/
DEBUG_printf(("cupsServer: Using server \"%s\"...\n", server));
strlcpy(cg->server, server, sizeof(cg->server));
if (cg->server[0] != '/' && (port = strrchr(cg->server, ':')) != NULL &&
@@ -249,6 +258,7 @@ cupsServer(void)
{
*port++ = '\0';
DEBUG_printf(("cupsServer: Using port %d...\n", atoi(port)));
ippSetPort(atoi(port));
}
@@ -471,11 +481,17 @@ cups_open_client_conf(void)
snprintf(filename, sizeof(filename), "%s/.cups/client.conf", home);
if ((fp = cupsFileOpen(filename, "r")) != NULL)
{
DEBUG_printf(("cups_open_client_conf: Using \"%s\"...\n", filename));
return (fp);
}
snprintf(filename, sizeof(filename), "%s/.cupsrc", home);
if ((fp = cupsFileOpen(filename, "r")) != NULL)
{
DEBUG_printf(("cups_open_client_conf: Using \"%s\"...\n", filename));
return (fp);
}
}
snprintf(filename, sizeof(filename), "%s/client.conf", cg->cups_serverroot);
+25 -7
Ver Arquivo
@@ -800,6 +800,8 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
const char *name) /* I - Printer name */
{
int http_port; /* Port number */
char http_hostname[HTTP_MAX_HOST];
/* Hostname associated with connection */
http_t *http2; /* Alternate HTTP connection */
int fd; /* PPD file */
char localhost[HTTP_MAX_URI],/* Local hostname */
@@ -835,19 +837,25 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
resource, sizeof(resource), 0))
return (NULL);
DEBUG_printf(("Printer hostname=\"%s\", port=%d\n", hostname, port));
/*
* Remap local hostname to localhost...
*/
httpGetHostname(NULL, localhost, sizeof(localhost));
DEBUG_printf(("Local hostname=\"%s\"\n", localhost));
if (!strcasecmp(localhost, hostname))
strcpy(hostname, "localhost");
/*
* Get the port number we are connected to...
* Get the hostname and port number we are connected to...
*/
httpGetHostname(http, http_hostname, sizeof(http_hostname));
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
http_port = ntohs(http->hostaddr->ipv6.sin6_port);
@@ -858,11 +866,14 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */
else
http_port = ippPort();
DEBUG_printf(("Connection hostname=\"%s\", port=%d\n", http_hostname,
http_port));
/*
* Reconnect to the correct server as needed...
*/
if (!strcasecmp(http->hostname, hostname) && port == http_port)
if (!strcasecmp(http_hostname, hostname) && port == http_port)
http2 = http;
else if ((http2 = httpConnectEncrypt(hostname, port,
cupsEncryption())) == NULL)
@@ -1394,7 +1405,8 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
char *printer, /* O - Printer name [HTTP_MAX_URI] */
char *hostname) /* O - Hostname [HTTP_MAX_URI] */
{
char hostbuf[HTTP_MAX_URI]; /* Name of host */
char hostbuf[HTTP_MAX_URI], /* Name of host */
http_hostname[HTTP_MAX_HOST]; /* Hostname associated with connection */
_cups_globals_t *cg = _cupsGlobals();/* Pointer to library globals */
@@ -1415,6 +1427,8 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
strlcpy(hostbuf, cupsServer(), sizeof(hostbuf));
httpGetHostname(cg->http, http_hostname, sizeof(http_hostname));
if (hostname != NULL)
strlcpy(hostname, hostbuf, HTTP_MAX_URI);
else
@@ -1427,7 +1441,7 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */
if (cg->http != NULL)
{
if (!strcasecmp(cg->http->hostname, hostname))
if (!strcasecmp(http_hostname, hostname))
return (printer);
httpClose(cg->http);
@@ -1473,7 +1487,9 @@ cups_get_printer_uri(
char uri[HTTP_MAX_URI], /* printer-uri attribute */
scheme[HTTP_MAX_URI], /* Scheme name */
username[HTTP_MAX_URI], /* Username:password */
classname[255]; /* Temporary class name */
classname[255], /* Temporary class name */
http_hostname[HTTP_MAX_HOST];
/* Hostname associated with connection */
static const char * const requested_attrs[] =
{ /* Requested attributes */
"printer-uri-supported",
@@ -1505,9 +1521,11 @@ cups_get_printer_uri(
DEBUG_printf(("cups_get_printer_uri: printer-uri=\"%s\"\n", uri));
/*
* Get the port number we are connected to...
* Get the hostname and port number we are connected to...
*/
httpGetHostname(http, http_hostname, sizeof(http_hostname));
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
http_port = ntohs(http->hostaddr->ipv6.sin6_port);
@@ -1585,7 +1603,7 @@ cups_get_printer_uri(
* Found a class! Connect to the right server...
*/
if (!strcasecmp(http->hostname, host) && *port == http_port)
if (!strcasecmp(http_hostname, host) && *port == http_port)
http2 = http;
else if ((http2 = httpConnectEncrypt(host, *port,
cupsEncryption())) == NULL)
+6 -4
Ver Arquivo
@@ -1,14 +1,10 @@
[Desktop Entry]
Categories=Application;System;X-Red-Hat-Base;
Comment=CUPS Web Interface
Comment[en_US]=CUPS Web Interface
Encoding=UTF-8
Exec=htmlview http://localhost:631/
GenericName=
GenericName[en_US]=
Icon=cups
MimeType=
Name=Manage Printing
Path=
StartupNotify=false
Terminal=false
@@ -17,5 +13,11 @@ Type=Application
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=
Name=Manage Printing
Name[en_US]=Manage Printing
Comment=CUPS Web Interface
Comment[en_US]=CUPS Web Interface
Name[es]=Administrar impresión
Comment[es]=Interfaz Web de CUPS
Name[pl]=Zarządzanie drukowaniem
Comment[pl]=Interfejs WWW CUPS
+11 -5
Ver Arquivo
@@ -153,11 +153,13 @@ HELPFILES = \
help/network.html \
help/options.html \
help/overview.html \
help/policies.html \
help/ref-access_log.html \
help/ref-classes-conf.html \
help/ref-client-conf.html \
help/ref-cupsd-conf.html \
help/ref-error_log.html \
help/ref-mailto-conf.html \
help/ref-page_log.html \
help/ref-printers-conf.html \
help/ref-snmp-conf.html \
@@ -200,7 +202,7 @@ depend:
# Install all documentation files...
#
install: all
install: all $(INSTALL_LANGUAGES)
$(INSTALL_DIR) -m 755 $(DOCDIR)
for file in $(WEBPAGES); do \
$(INSTALL_MAN) $$file $(DOCDIR); \
@@ -213,6 +215,8 @@ install: all
for file in $(WEBIMAGES) $(WEBBUTTONS); do \
$(INSTALL_MAN) $$file $(DOCDIR)/images; \
done
install-languages:
for lang in $(LANGUAGES); do \
$(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
if test -f $$lang/index.html; then \
@@ -230,7 +234,7 @@ install: all
# Unnstall all documentation files...
#
uninstall:
uninstall: $(UNINSTALL_LANGUAGES)
for file in $(WEBPAGES); do \
$(RM) $(DOCDIR)/$$file; \
done
@@ -240,6 +244,11 @@ uninstall:
for file in $(WEBIMAGES) $(WEBBUTTONS); do \
$(INSTALL_MAN) $(DOCDIR)/images/$$file; \
done
-$(RMDIR) $(DOCDIR)/images
-$(RMDIR) $(DOCDIR)/help
-$(RMDIR) $(DOCDIR)
uninstall-languages:
-for lang in $(LANGUAGES); do \
$(RM) $(DOCDIR)/$$lang/index.html; \
for file in $(WEBBUTTONS); do \
@@ -248,9 +257,6 @@ uninstall:
$(RMDIR) $(DOCDIR)/$$lang/images; \
$(RMDIR) $(DOCDIR)/$$lang; \
done
-$(RMDIR) $(DOCDIR)/images
-$(RMDIR) $(DOCDIR)/help
-$(RMDIR) $(DOCDIR)
#
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 633 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 626 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 631 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 764 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 728 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 633 B

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 635 B

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