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
2332 arquivos alterados com 488478 adições e 371015 exclusões
+217
Ver Arquivo
@@ -0,0 +1,217 @@
CHANGES-1.0.txt
---------------
CHANGES IN CUPS v1.0.5
- The HP-GL/2 filter did not correctly set the pen color
for pens other than #1.
- The scheduler would only accept 26 simultaneous jobs
under some OS releases (mkstemp() limitation.) It now
handles up to 2^32 simultaneous jobs.
- The PostScript filter loaded the printer's PPD file
twice.
- The PAM authentication code now uses pam_strerror() to
provide a textual error message in the error_log file.
- The scheduler now copies PPD and interface script
files instead of moving them; this fixes installations
with a separate requests directory.
- The PostScript RIP did not generate correct 6-color
output.
- Several filters were marking PPD options twice when
they didn't need to.
- The scheduler did not save the printer or class state
after an accept-jobs or reject-jobs operation.
- The cupsGetDefault() function now ignores the PRINTER
environment variable if it is set to "lp".
- New ippErrorString() function to get textual error
messages.
- Better error reporting in the System V commands.
- The lpadmin and lpstat commands always tried to
connect to the default server.
- The text filter didn't load the charset files from the
correct location.
- Wasn't sending a WWW-Authenticate: field to HTTP
clients when authentication was required.
- httpSeparate() didn't always set the default port
number for known methods.
- The HP-GL/2 filter now looks for "PSwidth,length"
instead of (the correct) "PSlength,width" as
documented by HP. It appears that many major CAD
applications are broken and this change allows the
auto-rotation to work with them.
- The IPP "printer-resolution" option was not being
translated.
- The charset files did not include the Microsoft
"standard" characters from 128 to 159 (unused by the
ISO-8859-x charsets)
- The scheduler was chunking the Content-Type field from
CGI programs; this problem was most noticeable with
Microsoft Internet Explorer 5.
- By popular demand, the printers, jobs, and classes
CGIs no longer force a reload of the page every 10/30
seconds.
- The scheduler incorrectly required that the IPP client
provide a document-format attribute for the
validate-job operation.
- Clients that sent bad IPP requests without the
required attributes-natural-language and
attributes-charset attributes would crash the
scheduler.
CHANGES IN CUPS v1.0.4
- Documentation updates.
- Jobs would get stuck in the queue and wouldn't print
until you enabled the queue.
- The lp and lpr commands now catch SIGHUP and SIGINTR.
- The lp and lpr commands now use sigaction or sigset
when available.
- CUPS library updates for WIN32/OS-2
CHANGES IN CUPS v1.0.3
- Documentation updates.
- The lpq man page was missing.
- The configure script was not properly detecting the
image libraries.
- The top-level makefile was calling "make" instead of
"$(MAKE)".
- PostScript filter fixes for number-up, OutputOrder,
and %Trailer.
- The imagetops filter didn't end the base-85 encoding
properly if the image data was not a multiple of 4
bytes in length.
- The imagetoraster filter didn't generate good banded
RGB or CMY data (was dividing the line width by 4
instead of 3...)
- The imagetoraster filter now records the bounding
box of the image on the page.
- The CUPS image library cache code wasn't working as
designed; images larger than the maximum RIP cache
would eventually thrash using the same cache tile.
- The CUPS image library TIFF loading code didn't
handle unknown resolution units properly; the fixed
code uses a default resolution of 128 PPI.
- cupsGetClasses() and cupsGetPrinters() did not free
existing strings if they ran out of memory.
- The scheduler logs incorrectly contained 3 digits for
the timezone offset instead of 4.
- The scheduler now does a lookup for the default user
and group ID; the previous hardcoded values caused
problems with the LPD backend.
- The cancel-job operation now allows any user in the
system group to cancel any job.
- The cancel-job operation stopped the print queue if
the job was being printed.
- Now only stop printers if the backend fails. If the
filter fails then the failure is noted in the
error_log and printing continues with the next file in
the queue.
- Now log whether a filter fails because of a signal
or because it returned a non-zero exit status.
- The root user now always passes the system group test.
- Printers with an interface script and remote printers
and classes didn't have a printer-make-and-model
attribute.
- Added logging of lost/timed-out remote printers.
- The HP-GL/2 filter was scaling the pen width twice.
- Updated the HP-GL/2 filter to use a single SP (Set
Pen) procedure. This makes the output smaller and is
more appropriate since the filter keeps track of the
pen states already.
- The scheduler didn't handle passwords with spaces.
- The IPP backend now does multiple copies and retries
if the destination server requires it (e.g. HP
JetDirect.)
- The disable command didn't implement the "-c" option
(cancel all jobs.)
- Changed the CMYK generation function for the image file
and PostScript RIPs.
- The lp command didn't support the "-h" option as
documented.
- The AppSocket, IPP, and LPD backends now retry on all
network errors. This should prevent stopped queues
caused by a printer being disconnected from the
network or powered off.
- The scheduler now restarts a job if the corresponding
printer is modified.
- The image RIPs now rotate the image if needed to fit
on the page.
CHANGES IN CUPS v1.0.2
- The HP-GL/2 filter didn't always scale the output
correctly.
- The HP-GL/2 filter now supports changing the page size
automatically when the "fitplot" option is not used.
- The cancel-job operation was expecting a resource name
of the form "/job/#" instead of "/jobs/#"; this
prevented the cancel and lprm commands from working.
- The backends didn't log pages when files were printed
using the "-oraw" option.
- The authorization code did not work with the Slackware
long shadow password package because its crypt() can
return NULL.
- The chunking code didn't work for reading the response
of a POST request.
- cupsGetPPD() now does authentication as needed.
- The N-up code in the PostScript filter didn't work
with some printers (grestoreall would restore the
default blank page and device settings).
- The N-up code in the PostScript filter didn't scale
the pages to fit within the imageable area of the
page.
- Wasn't doing an fchown() on the request files. This
caused problems when the default root account group
and CUPS group were not the same.
CHANGES IN CUPS v1.0.1
- Documentation updates.
- Fixed a bunch of possible buffer-overflow conditions.
- The scheduler now supports authentication using PAM.
- Updated the Italian message file.
- httpEncode64() didn't add an extra "=" if there was
only one byte in the last three-byte group.
- Now drop any trailing character set from the locale
string (e.g. "en_US.ISO_8859-1" becomes "en_US")
- Fixed "timezone" vs "tm_gmtoff" usage for BSD-based
operating systems.
- Updated IPP security so that "get" operations can be
done from any resource name; this allows the CGIs to
work with printer authentication enabled so long as
authentication isn't turned on for the whole "site".
- The IPP code didn't properly handle the "unsupported"
group; this caused problems with the HP JetDirect since
it doesn't seem to support the "copies" attribute.
- The HTTP chunking code was missing a CR LF pair at the
end of a 0-length chunk.
- The httpSeparate() function didn't handle embedded
usernames and passwords in the URI properly.
- Doing "lpadmin -p printer -E" didn't restart printing
if there were pending jobs.
- The cancel-job operation now requires either a
requesting-user-name attribute or an authenticated
username.
- The add-printer code did not report errors if the
interface script or PPD file could not be renamed.
- Request files are now created without world read
permissions.
- Added a cupsLastError() function to the CUPS API to
retrieve the IPP error code from the last request.
- Options are now case-insensitive.
- The lpq command now provides 10 characters for the
username instead of the original (Berkeley standard)
7.
- The cancel command needed a local CUPS server to work
(or the appropriate ServerName in cupsd.conf)
- The cancel and lprm commands didn't report the IPP
error if the job could not be cancelled.
- The lp and lpr commands didn't intercept SIGTERM to
remove temporary files when printing from stdin.
- The lp and lpr commands didn't report the IPP error if
the job could not be printed.
+3462
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+828 -636
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+33 -18
Ver Arquivo
@@ -1,26 +1,41 @@
CREDITS.txt - 01/27/2000
CREDITS.txt - 2006-04-17
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
like to thank the following individuals for their contributions:
Nathaniel Barbour - Lots of testing and feedback.
N. Becker - setsid().
Jean-Eric Cuendet - GhostScript filters for CUPS.
Van Dang - HTTP and IPP policeman.
Dr. ZP Han - setgid()/setuid().
Guy Harris - *BSD shared libraries and lots of other fixes.
Wang Jian - CUPS RPM corrections.
Roderick Johnstone - Beta tester of the millenium.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Mark Lawrence - Microsoft interoperability testing.
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Ulrich Oldendorf - German locale.
Petter Reinholdtsen - HP-UX compiler stuff.
Stuart Stevens - HP JetDirect IPP information.
Kiko - Bug fixes.
L. Peter Deutsch - MD5 code.
Nathaniel Barbour - Lots of testing and feedback.
N. Becker - setsid().
Jean-Eric Cuendet - GhostScript filters for CUPS.
Van Dang - HTTP and IPP policeman.
L. Peter Deutsch - MD5 code.
Dr. ZP Han - setgid()/setuid().
Guy Harris - *BSD shared libraries and lots of other
fixes.
Bjoern Jacke - I18N stuff.
Wang Jian - CUPS RPM corrections.
Roderick Johnstone - Beta tester of the millenium.
Till Kamppeter - Bug fixes, beta testing, evangelism.
Kenshi Muto - Japanese localization, patches, and
testing.
Kiko - Bug fixes.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Mark Lawrence - Microsoft interoperability testing.
Jeff Licquia - Bug fixes, beta testing, evangelism.
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Daniel Nylander - Swedish localization.
Giulio Orsero - Bug fixes and testing.
Michal Osowiecki - Polish localization.
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
Petter Reinholdtsen - HP-UX compiler stuff.
Juan Pablo González Riopedre - Spanish localization
Stuart Stevens - HP JetDirect IPP information.
Andrea Suatoni - IRIX desktop integration and testing.
Tomohiro Kato - Japanese localization.
Tim Waugh - Lots of patches, testing, and Linux
integration.
Yugami - LDAP browsing support.
If I've missed someone, please let me know by sending an email to
"mike@easysw.com".
+174
Ver Arquivo
@@ -0,0 +1,174 @@
INSTALL - CUPS v1.2.0 - 2006-05-08
----------------------------------
This file describes how to compile and install CUPS from source
code. For more information on CUPS see the file called
"README.txt". A complete change log can be found in
"CHANGES.txt".
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO ****
**** NEED TO INSTALL ESP GHOSTSCRIPT AFTER YOU INSTALL CUPS ****
BEFORE YOU BEGIN
You'll need ANSI-compliant C and C++ compilers, plus a make
program and Bourne shell. The GNU compiler tools work well -
we've tested the current CUPS code against several versions
of GCC with excellent results.
The makefiles used by the project should work with all
versions of make. We've tested them with GNU make as well as
the make programs shipped by Compaq, HP, SGI, and Sun.
FreeBSD users should use GNU make (gmake).
Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB
libraries for image support, the CDSA, GNU TLS, or OpenSSL
libraries for encryption support, and the OpenLDAP and
OpenSLP libraries for directory services support. CUPS will
compile and run without these, however you'll miss out on
many of the features provided by CUPS.
Also, please note that CUPS no longer includes the
Ghostscript- based pstoraster filter. You *must* download
ESP Ghostscript separately from the CUPS web site if you want
to print PostScript files to non-PostScript printers.
COMPILING FROM SUBVERSION
The CUPS Subversion repository doesn't hold a copy of the
pre-built configure script. You'll need to run the GNU
autoconf software (2.52 or higher) before compiling the
software from Subversion:
autoconf -f
CONFIGURATION
CUPS uses GNU autoconf, so you should find the usual
"configure" script in the main CUPS source directory. To
configure CUPS for your system, type:
./configure
The default installation will put the CUPS software in the
"/etc", "/usr", and "/var" directories on your system, which
will overwrite any existing printing commands on your system.
Use the "--prefix" option to install the CUPS software in
another location:
./configure --prefix=/some/directory
To see a complete list of configuration options, use the
--help option:
./configure --help
If any of the dependent libraries are not installed in a
system default location (typically "/usr/include" and
"/usr/lib") you'll need to set the CFLAGS, CPPFLAGS,
CXXFLAGS, DSOFLAGS, and LDFLAGS environment variables prior
to running configure:
setenv CFLAGS "-I/some/directory"
setenv CPPFLAGS "-I/some/directory"
setenv CXXFLAGS "-I/some/directory"
setenv DSOFLAGS "-L/some/directory"
setenv LDFLAGS "-L/some/directory"
./configure ...
or:
CFLAGS="-I/some/directory" \
CPPFLAGS="-I/some/directory" \
CXXFLAGS="-I/some/directory" \
DSOFLAGS="-L/some/directory" \
LDFLAGS="-L/some/directory" \
./configure ...
Once you have configured things, just type:
make ENTER
or if you have FreeBSD, NetBSD, or OpenBSD type:
gmake ENTER
to build the software.
INSTALLING THE SOFTWARE
Once you have built the software you need to install it. The
"install" target provides a quick way to install the software
on your local system:
make install ENTER
or for FreeBSD, NetBSD, or OpenBSD:
gmake install ENTER
You can also build binary packages that can be installed on
other machines using the RPM spec file
("packaging/cups.spec") or EPM list file
("packaging/cups.list"). The latter also supports building
of binary RPMs, so it may be more convenient to use - we use
EPM to build all of our binary distributions.
You can find the RPM software at:
http://www.rpm.org/
The EPM software is available at:
http://www.easysw.com/epm/
CREATING BINARY DISTRIBUTIONS WITH EPM
The top level makefile supports generation of many types of binary
distributions using EPM. To build a binary distribution type:
make <format> ENTER
or
gmake <format> ENTER
for FreeBSD, NetBSD, and OpenBSD. The <format> target is one of
the following:
epm - Builds a script + tarfile package
aix - Builds an AIX package
bsd - Builds a *BSD package
deb - Builds a Debian package
depot - Builds a HP-UX package (also swinstall)
inst - Builds an IRIX package (also tardist)
osx - Builds a MacOS X package
pkg - Builds a Solaris package
rpm - Builds a RPM package
setld - Build a Tru64 UNIX package
slackware - Build a Slackware package
swinstall - Build a HP-UX package (also depot)
tardist - Builds an IRIX package (also inst)
REPORTING PROBLEMS
If you have problems, READ THE DOCUMENTATION FIRST! If the
documentation does not solve your problems, please post a
message on the "cups.general" forum at:
http://www.cups.org/newsgroups.php
Include your operating system and version, compiler and
version, and any errors or problems you've run into. The
"config.log" file and the output from the configure script
and make should also be sent, as it often helps to determine
the cause of your problem.
If you are running a version of Linux, be sure to provide the
Linux distribution you have, too.
-895
Ver Arquivo
@@ -1,895 +0,0 @@
<HTML>
<HEAD>
<TITLE>Software License Agreement - Common UNIX Printing System</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" TEXT="#000000">
<H2 ALIGN="CENTER">Common UNIX Printing System License Agreement</H2>
<P ALIGN="CENTER">Copyright 1997-2000 by Easy Software Products<BR>
44141 AIRPORT VIEW DR STE 204<BR>
HOLLYWOOD, MARYLAND 20636-3111 USA<BR>
<BR>
Voice: +1.301.373.9603<BR>
Email: <A HREF="mailto:cups-info@cups.org">cups-info@cups.org</A><BR>
WWW: <A HREF="http://www.cups.org">http://www.cups.org</A>
<H3>Introduction</H3>
<P>The Common UNIX Printing System<SUP>TM</SUP>, ("CUPS<SUP>TM</SUP>"),
is provided under the GNU General Public License ("GPL") and GNU
Library General Public License ("LGPL"), Version 2. A copy of these
licenses follow this introduction.
<P>The GNU LGPL applies to the CUPS API library, located in the "cups"
subdirectory of the CUPS source distribution and in the
"/usr/include/cups" directory and "libcups.a", "libcups.sl", or
"libcups.so" files in the binary distributions.
<P>The GNU GPL applies to the remainder of the CUPS distribution,
including the "pstoraster" filter which is based upon GNU Ghostscript
5.50 and the "pdftops" filter which is based upon Xpdf 0.90.
<P>For those not familiar with the GNU GPL, the license basically
allows you to:
<UL>
<LI>Use the CUPS software at no charge.
<LI>Distribute verbatim copies of the software in source or
binary form.
<LI>Sell verbatim copies of the software for a media fee, or
sell support for the software.
<LI>Distribute or sell printer drivers and filters that use
CUPS so long as source code is made available under the GPL.
</UL>
<P>What this license <B>does not</B> allow you to do is make changes or
add features to CUPS and then sell a binary distribution without source
code. You must provide source for any new drivers, changes, or
additions to the software, and all code must be provided under the GPL
or LGPL as appropriate.
<P>The GNU LGPL relaxes the "link-to" restriction, allowing you to
develop applications that use the CUPS API library under other licenses
and/or conditions as appropriate for your application.
<H3>Trademarks</H3>
<P>Easy Software Products has trademarked the Common UNIX Printing
System, CUPS, and CUPS logo. These names and logos may be used freely
in any direct port or binary distribution of CUPS. To use them in
derivative products, please contract Easy Software Products for written
permission. Our intention is to protect the value of these trademarks and
ensure that any derivative product meets the same high-quality
standards as the original.
<H3>Binary Distribution Rights</H3>
<P>Easy Software Products also sells rights to the CUPS source code
under a binary distribution license for vendors that are unable to
release source code for their drivers, additions, and modifications to
CUPS under the GNU GPL and LGPL. For information please contact us at
the address shown above.
<P>The Common UNIX Printing System provides a "pstoraster" filter that
utilizes the GNU GhostScript 5.50 core to convert PostScript files into
a stream of raster images. For binary distribution licensing of this
software, please contact:
<BLOCKQUOTE>
Miles Jones<BR>
Director of Marketing<BR>
Artifex Software Inc.<BR>
454 Las Gallinas Ave., Suite 108<BR>
San Rafael, CA 94903 USA<BR>
Voice: +1.415.492.9861<BR>
Fax: +1.415.492.9862<BR>
EMail: <A HREF="mailto:info@arsoft.com">info@arsoft.com</A>
</BLOCKQUOTE>
<P>The "pdftops" filter is based on the Xpdf 0.90 software. For binary
distribution licensing of this software, please contact:
<BLOCKQUOTE>
Derek B. Noonburg<BR>
Email: <A HREF="mailto:derekn@foolabs.com">derekn@foolabs.com</A><BR>
WWW: <A HREF="http://www.foolabs.com/xpdf/">http://www.foolabs.com/xpdf/</A>
</BLOCKQUOTE>
<H3>Support</H3>
<P>Easy Software Products sells software support for CUPS as well as a
commercial printing product based on CUPS called ESP Print Pro. You can
find out more at our web site:
<UL><PRE>
<A HREF="http://www.easysw.com">http://www.easysw.com</A>
</PRE></UL>
<!-- NEW PAGE -->
<H2>GNU GENERAL PUBLIC LICENSE</H2>
<P>Version 2, June 1991
<PRE>
Copyright 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim
copies of this license document, but changing it is not allowed.
<PRE>
<H4>Preamble</H4>
<P>The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
<P>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
<P>To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
<P>For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
<P>We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
<P>Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
<P>Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
<P>The precise terms and conditions for copying, distribution and
modification follow.
<H4>GNU GENERAL PUBLIC LICENSE<BR>
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H4>
<OL START="0">
<LI>This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
<P>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
<LI>You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
<P>You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
<LI>You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
<OL TYPE="a">
<LI>You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
<LI>You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
<LI>if the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
</OL>
<P>These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
<P>Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
<P>In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
<LI>You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
<OL TYPE="a">
<LI>Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
<LI>Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
<LI>Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
</OL>
<P>The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
<P>If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
<LI>You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
<LI>You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
<LI>Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
<LI>If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
<P>If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
<P>It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
<P>This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
<LI>If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
<LI>The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
<P>Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
<LI>If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
</OL>
<H4>NO WARRANTY</H4>
<OL START="11">
<LI>BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
<LI>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
</OL>
<H4>END OF TERMS AND CONDITIONS</H4>
<!-- NEW PAGE -->
<H2>GNU LIBRARY GENERAL PUBLIC LICENSE</H2>
<P>Version 2, June 1991
<PRE>
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
</PRE>
<H4>Preamble</H4>
<P>The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
<P>This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
<P>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
<P>To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
<P>For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
<P>Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
<P>Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
<P>Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
<P>Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
<P>The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
<P>Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
<P>However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
<P>The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
<P>Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
<H4>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H4>
<P><STRONG>0.</STRONG>
This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
<P>A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
<P>The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
<P>"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
<P>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
<P><STRONG>1.</STRONG>
You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
<P>You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
<P><STRONG>2.</STRONG>
You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
<OL TYPE="a">
<LI>The modified work must itself be a software library.
<P>
<LI>You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
<P>
<LI>You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
<P>
<LI>If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
<P>(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
</OL>
<P>These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
<P>Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
<P>In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
<P><STRONG>3.</STRONG>
You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
<P>Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
<P>This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
<P><STRONG>4.</STRONG>
You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
<P>If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
<P><STRONG>5.</STRONG>
A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
<P>However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
<P>When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
<P>If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
<P>Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
<P><STRONG>6.</STRONG>
As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
<P>You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
<OL TYPE="a">
<LI>Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
<P>
<LI>Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
<P>
<LI>If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
<P>
<LI>Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
</OL>
<P>For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
<P>It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
<P><STRONG>7.</STRONG>
You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
<OL TYPE="a">
<LI>Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
<P>
<LI>Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
</OL>
<P><STRONG>8.</STRONG>
You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
<P><STRONG>9.</STRONG>
You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
<P><STRONG>10.</STRONG>
Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
<P><STRONG>11.</STRONG>
If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
<P>If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
<P>It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
<P>This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
<P><STRONG>12.</STRONG>
If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
<P><STRONG>13.</STRONG>
The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
<P>Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
<P><STRONG>14.</STRONG>
If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
<P><STRONG>NO WARRANTY</STRONG>
<P><STRONG>15.</STRONG>
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
<P><STRONG>16.</STRONG>
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
<H4>END OF TERMS AND CONDITIONS</H4>
</BODY>
</HTML>
+964
Ver Arquivo
@@ -0,0 +1,964 @@
Common UNIX Printing System License Agreement
Copyright 1997-2006 by Easy Software Products
44141 AIRPORT VIEW DR STE 204
HOLLYWOOD, MARYLAND 20636 USA
Voice: +1.301.373.9600
Email: cups-info@cups.org
WWW: http://www.cups.org
INTRODUCTION
The Common UNIX Printing System(tm), ("CUPS(tm)"), is provided
under the GNU General Public License ("GPL") and GNU Library
General Public License ("LGPL"), Version 2, with exceptions for
Apple operating systems and the OpenSSL toolkit. A copy of the
exceptions and licenses follow this introduction.
The GNU LGPL applies to the CUPS API library, located in the
"cups" subdirectory of the CUPS source distribution and in the
"cups" include directory and library files in the binary
distributions. The GNU GPL applies to the remainder of the CUPS
distribution, including the "pdftops" filter which is based upon
Xpdf and the CUPS imaging library.
For those not familiar with the GNU GPL, the license basically
allows you to:
- Use the CUPS software at no charge.
- Distribute verbatim copies of the software in source or
binary form.
- Sell verbatim copies of the software for a media fee, or
sell support for the software.
- Distribute or sell printer drivers and filters that use
CUPS so long as source code is made available under the
GPL.
What this license *does not* allow you to do is make changes or
add features to CUPS and then sell a binary distribution without
source code. You must provide source for any new drivers,
changes, or additions to the software, and all code must be
provided under the GPL or LGPL as appropriate. The only
exceptions to this are the portions of the CUPS software covered
by the Apple operating system license exceptions outlined later
in this license agreement.
The GNU LGPL relaxes the "link-to" restriction, allowing you to
develop applications that use the CUPS API library under other
licenses and/or conditions as appropriate for your application.
LICENSE EXCEPTIONS
In addition, as the copyright holder of CUPS, Easy Software
Products grants the following special exceptions:
1. Apple Operating System Development License Exception;
a. Software that is developed by any person or entity
for an Apple Operating System ("Apple OS-Developed
Software"), including but not limited to Apple and
third party printer drivers, filters, and backends
for an Apple Operating System, that is linked to the
CUPS imaging library or based on any sample filters
or backends provided with CUPS shall not be
considered to be a derivative work or collective work
based on the CUPS program and is exempt from the
mandatory source code release clauses of the GNU GPL.
You may therefore distribute linked combinations of
the CUPS imaging library with Apple OS-Developed
Software without releasing the source code of the
Apple OS-Developed Software. You may also use sample
filters and backends provided with CUPS to develop
Apple OS-Developed Software without releasing the
source code of the Apple OS-Developed Software.
b. An Apple Operating System means any operating system
software developed and/or marketed by Apple Computer,
Inc., including but not limited to all existing
releases and versions of Apple's Darwin, Mac OS X,
and Mac OS X Server products and all follow-on
releases and future versions thereof.
c. This exception is only available for Apple
OS-Developed Software and does not apply to software
that is distributed for use on other operating
systems.
d. All CUPS software that falls under this license
exception have the following text at the top of each
source file:
This file is subject to the Apple OS-Developed
Software exception.
2. OpenSSL Toolkit License Exception;
a. Easy Software Products explicitly allows the
compilation and distribution of the CUPS software
with the OpenSSL Toolkit.
No developer is required to provide these exceptions in a
derived work.
TRADEMARKS
Easy Software Products has trademarked the Common UNIX Printing
System, CUPS, and CUPS logo. You may use these names and logos
in any direct port or binary distribution of CUPS. Please
contact Easy Software Products for written permission to use
them in derivative products. Our intention is to protect the
value of these trademarks and ensure that any derivative product
meets the same high-quality standards as the original.
BINARY DISTRIBUTION RIGHTS
Easy Software Products also sells rights to the CUPS source code
under a binary distribution license for vendors that are unable
to release source code for their drivers, additions, and
modifications to CUPS under the GNU GPL and LGPL. For
information please contact us at the address shown above.
The Common UNIX Printing System provides a "pdftops" filter that
is based on the Xpdf software. For binary distribution licensing
of this software, please contact:
Derek B. Noonburg
Email: derekn@glyphandcog.com
WWW: http://www.glyphandcog.com/
SUPPORT
Easy Software Products sells software support for CUPS as well
as a commercial printing product based on CUPS called ESP Print
Pro. You can find out more at our web site:
http://www.easysw.com/
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
+184 -76
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -26,67 +26,145 @@
# Programs...
#
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CHMOD = @CHMOD@
CHOWN = @CHOWN@
CP = @CP@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
HTMLDOC = @HTMLDOC@
LIBTOOL = @LIBTOOL@
LN = /bin/ln -sf
MKDIR = @MKDIR@ -p
MV = @MV@
NROFF = @NROFF@
RANLIB = @RANLIB@
RM = @RM@ -f
SED = @SED@
SHELL = /bin/sh
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
HTMLDOC = @HTMLDOC@
INSTALL = @INSTALL@
LD = @LD@
LIBTOOL = @LIBTOOL@
LN = @LN@ -sf
MV = @MV@
PHPCONFIG = @PHPCONFIG@
RANLIB = @RANLIB@
RM = @RM@ -f
RMDIR = @RMDIR@
SED = @SED@
SHELL = /bin/sh
STRIP = @STRIP@
#
# Installation programs...
#
INSTALL_BIN = $(LIBTOOL) $(CP)
INSTALL_DATA = $(CP)
INSTALL_LIB = $(LIBTOOL) $(CP)
INSTALL_MAN = $(CP)
INSTALL_SCRIPT = $(CP)
INSTALL_SYSV = @INSTALL_SYSV@
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_SCRIPT = $(INSTALL) -m 755
#
# Default user, group, and system groups for the scheduler...
#
CUPS_USER = @CUPS_USER@
CUPS_GROUP = @CUPS_GROUP@
CUPS_SYSTEM_GROUPS = @CUPS_SYSTEM_GROUPS@
CUPS_PRIMARY_SYSTEM_GROUP = @CUPS_PRIMARY_SYSTEM_GROUP@
#
# Default permissions...
#
CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
#
# Languages to install...
#
LANGUAGES = @LANGUAGES@
INSTALL_LANGUAGES = @INSTALL_LANGUAGES@
UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@
#
# Libraries...
#
LIBCUPS = @LIBCUPS@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBJPEG = @LIBJPEG@
LIBPNG = @LIBPNG@
LIBTIFF = @LIBTIFF@
LIBZ = @LIBZ@
LIBCUPS = @LIBCUPS@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBJPEG = @LIBJPEG@
LIBLDAP = @LIBLDAP@
LIBMALLOC = @LIBMALLOC@
LIBPAPER = @LIBPAPER@
LIBPNG = @LIBPNG@
LIBSLP = @LIBSLP@
LIBTIFF = @LIBTIFF@
LIBZ = @LIBZ@
#
# Install static libraries?
#
INSTALLSTATIC = @INSTALLSTATIC@
#
# Program options...
#
# OPTIM defines the common compiler optimization/debugging options.
# OPTIONS defines other compile-time options (currently only -dDEBUG for
# extra debug info)
# ARCHFLAGS Defines the default architecture build options, used
# when compiling separate 32/64-bit libraries.
# ARCH32FLAGS Defines the 32-bit architecture build options, used
# when compiling separate 32/64-bit libraries.
# ARCH64FLAGS Defines the 64-bit architecture build options, used
# when compiling separate 32/64-bit libraries.
# OPTIM Defines the common compiler optimization/debugging options
# for all architectures.
# OPTIONS Defines other compile-time options (currently only -DDEBUG
# for extra debug info)
#
ARFLAGS = crvs
CFLAGS = @CFLAGS@ $(OPTIM) -I.. $(OPTIONS)
CXXFLAGS = @CXXFLAGS@ $(OPTIM) -I.. $(OPTIONS)
DSOLIBS = @DSOLIBS@
IMGLIBS = @IMGLIBS@ -lm
LDFLAGS = @LDFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(NETLIBS) @LIBS@
NETLIBS = @NETLIBS@
OPTIM = @OPTIM@
OPTIONS =
ARCHFLAGS = @ARCHFLAGS@
ARFLAGS = @ARFLAGS@
BACKLIBS = @BACKLIBS@
CFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
COMMONLIBS = @LIBS@
CUPSDLIBS = @CUPSDLIBS@
CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
CXXLIBS = @CXXLIBS@
DSOFLAGS = @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
IMGLIBS = @IMGLIBS@
IMGFILTERS = @IMGFILTERS@
LDFLAGS = -L../cups -L../filter $(ARCHFLAGS) \
@LDFLAGS@ @PIEFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(COMMONLIBS)
OPTIM = @OPTIM@
OPTIONS =
PAMLIBS = @PAMLIBS@
PAP = @PAP@
PDFTOPS = @PDFTOPS@
PHPDIR = @PHPDIR@
SSLFLAGS = @SSLFLAGS@
SSLLIBS = @SSLLIBS@
LAUNCHDLIBS = @LAUNCHDLIBS@
#
# Separate 32/64-bit library support...
#
ARCH32FLAGS = @ARCH32FLAGS@
DSO32FLAGS = @DSO32FLAGS@
INSTALL32 = @INSTALL32@
LIB32CUPS = @LIB32CUPS@
LIB32CUPSIMAGE = @LIB32CUPSIMAGE@
LIB32DIR = $(BUILDROOT)@LIB32DIR@
UNINSTALL32 = @UNINSTALL32@
ARCH64FLAGS = @ARCH64FLAGS@
DSO64FLAGS = @DSO64FLAGS@
INSTALL64 = @INSTALL64@
LIB64CUPS = @LIB64CUPS@
LIB64CUPSIMAGE = @LIB64CUPSIMAGE@
LIB64DIR = $(BUILDROOT)@LIB64DIR@
UNINSTALL64 = @UNINSTALL64@
#
# Directories...
@@ -96,12 +174,16 @@ OPTIONS =
# 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@
@@ -117,48 +199,74 @@ srcdir = @srcdir@
sysconfdir = @sysconfdir@
top_srcdir = @top_srcdir@
BINDIR = @bindir@
DATADIR = @CUPS_DATADIR@
DOCDIR = @CUPS_DOCROOT@
INCLUDEDIR = $(includedir)
BUILDROOT = $(DSTROOT)
AMANDIR = $(BUILDROOT)@AMANDIR@
BINDIR = $(BUILDROOT)@bindir@
CACHEDIR = $(BUILDROOT)@CUPS_CACHEDIR@
DATADIR = $(BUILDROOT)@CUPS_DATADIR@
DOCDIR = $(BUILDROOT)@CUPS_DOCROOT@
INCLUDEDIR = $(BUILDROOT)$(includedir)
INITDIR = @INITDIR@
INITDDIR = @INITDDIR@
LIBDIR = $(libdir)
LOCALEDIR = @CUPS_LOCALEDIR@
LOGDIR = @CUPS_LOGDIR@
MANDIR = @mandir@
PAMDIR = @PAMDIR@
REQUESTS = @CUPS_REQUESTS@
SBINDIR = @sbindir@
SERVERBIN = @CUPS_SERVERBIN@
SERVERROOT = @CUPS_SERVERROOT@
LIBDIR = $(BUILDROOT)$(libdir)
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
MANDIR = $(BUILDROOT)@mandir@
PMANDIR = $(BUILDROOT)@PMANDIR@
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
SBINDIR = $(BUILDROOT)@sbindir@
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
XINETD = @XINETD@
MAN1EXT = @MAN1EXT@
MAN5EXT = @MAN5EXT@
MAN7EXT = @MAN7EXT@
MAN8EXT = @MAN8EXT@
MAN8DIR = @MAN8DIR@
PAMDIR = @PAMDIR@
PAMFILE = @PAMFILE@
DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
DBUSDIR = @DBUSDIR@
CAT1EXT = @CAT1EXT@
CAT5EXT = @CAT5EXT@
CAT8EXT = @CAT8EXT@
#
# Rules...
#
.SILENT:
.SUFFIXES: .a .c .cxx .h .man .o .0 .1 .5 .8 .z
.SUFFIXES: .1 .1.gz .1m .1m.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
.c.o:
echo Compiling $<...
$(CC) $(CFLAGS) -c $<
$(CC) $(ARCHFLAGS) $(OPTIM) $(CFLAGS) -c $<
.c.32.o:
echo Compiling 32-bit $<...
$(CC) $(ARCH32FLAGS) $(OPTIM) $(CFLAGS) -c -o $@ $<
.c.64.o:
echo Compiling 64-bit $<...
$(CC) $(ARCH64FLAGS) $(OPTIM) $(CFLAGS) -c -o $@ $<
.cxx.o:
echo Compiling $<...
$(CXX) $(CXXFLAGS) -c $<
.man.0 .man.1 .man.5 .man.8:
echo Formatting $<...
$(CXX) $(ARCHFLAGS) $(OPTIM) $(CXXFLAGS) -c $<
.man.1 .man.1m .man.5 .man.7 .man.8:
echo Linking $<...
$(RM) $@
$(NROFF) -man $< >$@
.man.z:
echo Formatting $<...
$(RM) $@ t.z
$(NROFF) -man $< >t
pack -f t
$(MV) t.z $@
$(LN) $< $@
.man.1.gz .man.1m.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
echo -n Compressing $<...
$(RM) $@
gzip -v9 <$< >$@
#
# End of "$Id$"
+194 -46
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636-3142 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -28,19 +28,24 @@ include Makedefs
# Directories to make...
#
DIRS = cups backend berkeley cgi-bin filter man pdftops pstoraster \
scheduler systemv
DIRS = cups backend berkeley cgi-bin filter locale man monitor \
notifier $(PDFTOPS) scheduler systemv test \
$(PHPDIR) \
conf data doc fonts ppd templates
#
# Make all targets...
#
all:
chmod +x cups-config
for dir in $(DIRS); do\
echo Making all in $$dir... ;\
(cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
done
#
# Remove object and target files...
#
@@ -51,65 +56,208 @@ clean:
(cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
done
#
# Remove all non-distribution files...
#
distclean: clean
$(RM) Makedefs config.h config.log config.status
$(RM) cups-config conf/cupsd.conf conf/pam.std
$(RM) doc/help/standard.html doc/index.html
$(RM) init/cups.sh init/cups-lpd
$(RM) man/cups-deviced.man man/cups-driverd.man
$(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
$(RM) man/cupsd.conf.man man/lpoptions.man
$(RM) packaging/cups templates/edit-config.tmpl templates/header.tmpl
-$(RM) doc/*/index.html
-$(RM) templates/*/edit-config.tmpl
-$(RM) templates/*/header.tmpl
-$(RM) -r autom4te*.cache
#
# Make dependencies
#
depend:
for dir in $(DIRS); do\
echo Making dependencies in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
done
#
# Install object and target files...
#
install:
install: installhdrs
for dir in $(DIRS); do\
echo Installing in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install) || exit 1;\
done
echo Installing in conf...
(cd conf; $(MAKE) $(MFLAGS) install)
echo Installing in data...
(cd data; $(MAKE) $(MFLAGS) install)
echo Installing in doc...
(cd doc; $(MAKE) $(MFLAGS) install)
echo Installing in fonts...
(cd fonts; $(MAKE) $(MFLAGS) install)
echo Installing in locale...
(cd locale; $(MAKE) $(MFLAGS) install)
echo Installing in templates...
(cd templates; $(MAKE) $(MFLAGS) install)
echo Installing startup script...
if test "x$INITDIR" != "x"; then \
$(INSTALL_SCRIPT) cups.sh $prefix/$INITDIR/init.d/cups; \
$(CHMOD) ugo+rx $prefix/$INITDIR/init.d/cups; \
ln -s $INITDDIR/cups $prefix/$INITDIR/rc0.d/K00cups; \
ln -s $INITDDIR/cups $prefix/$INITDIR/rc2.d/S99cups; \
echo Installing cups-config script...
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
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; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc3.d; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc5.d; \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
fi
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
if test "x$(DBUSDIR)" != x; then \
echo Installing cups.conf in $(DBUSDIR)...;\
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR); \
$(INSTALL_DATA) packaging/cups-dbus.conf $(BUILDROOT)$(DBUSDIR)/cups.conf; \
fi
if test "x$(XINETD)" != x; then \
echo Installing xinetd configuration file for cups-lpd...; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
$(INSTALL_DATA) init/cups-lpd $(BUILDROOT)$(XINETD)/cups-lpd; \
fi
if test -d /usr/share/applications; then \
echo Installing desktop icons...; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)/usr/share/applications; \
$(INSTALL_DATA) desktop/cups.desktop $(BUILDROOT)/usr/share/applications; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps; \
$(INSTALL_DATA) desktop/cups-16.png $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps; \
$(INSTALL_DATA) desktop/cups-32.png $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps; \
$(INSTALL_DATA) desktop/cups-64.png $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png; \
$(INSTALL_DIR) -m 755 $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps; \
$(INSTALL_DATA) desktop/cups-128.png $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png; \
fi
#
# Make software distributions using EPM (http://www.easysw.com/epm)...
# Install source and header files...
#
EPMFLAGS = -v \
BINDIR=$(BINDIR) DATADIR=$(DATADIR) \
DOCDIR=$(DOCDIR) ESP_ROOT=$(ESP_ROOT) \
INCLUDEDIR=$(INCLUDEDIR) LIBDIR=$(LIBDIR) \
LOCALEDIR=$(LOCALEDIR) LOGDIR=$(LOGDIR) \
MANDIR=$(MANDIR) PAMDIR=$(PAMDIR) \
REQUESTS=$(REQUESTS) SBINDIR=$(SBINDIR) \
SERVERBIN=$(SERVERBIN) SERVERROOT=$(SERVERROOT)
installsrc:
gnutar --dereference --exclude=.svn -cf - . | gnutar -C $(SRCROOT) -xf -
installhdrs:
(cd cups ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;\
(cd filter ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;
#
# Uninstall object and target files...
#
uninstall:
for dir in $(DIRS); do\
echo Uninstalling in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
done
echo Uninstalling cups-config script...
$(RM) $(BINDIR)/cups-config
-$(RMDIR) $(BINDIR)
echo Uninstalling startup script...
if test "x$(INITDIR)" != x; then \
$(RM) $(BUILDROOT)$(INITDIR)/init.d/cups; \
$(RMDIR) $(BUILDROOT)$(INITDIR)/init.d; \
$(RM) $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
$(RM) $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
$(RM) $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
$(RM) $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
fi
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
$(RM) $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(RM) $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
$(RM) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
$(RMDIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
$(RM) $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
else \
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
fi \
$(RMDIR) $(BUILDROOT)$(INITDDIR); \
fi
if test "x$(DBUSDIR)" != x; then \
echo Uninstalling cups.conf in $(DBUSDIR)...;\
$(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
$(RMDIR) $(BUILDROOT)$(DBUSDIR); \
fi
$(RM) $(BUILDROOT)/etc/xinetd.d/cups-lpd
$(RM) $(BUILDROOT)/usr/share/applications/cups.desktop
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png
#
# Run the test suite...
#
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 --output-dir dist $(EPMARCH)
aix bsd deb depot inst pkg rpm setld slackware swinstall tardist:
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
epm:
epm $(EPMFLAGS) cups
epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
rpm:
epm $(EPMFLAGS) -f rpm cups
osx:
epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
deb:
epm $(EPMFLAGS) -f deb cups
.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
depot:
epm $(EPMFLAGS) -f depot cups
pkg:
epm $(EPMFLAGS) -f pkg cups
tardist:
epm $(EPMFLAGS) -f tardist cups
#
# End of "$Id$".
+146 -206
Ver Arquivo
@@ -1,266 +1,206 @@
README - CUPS v1.1.2 - 08/04/2000
README - CUPS v1.2.3 - 2006-08-28
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
instead...
INTRODUCTION
CUPS provides a portable printing layer for UNIX(r)-based operating
systems. It has been developed by Easy Software Products to promote a
standard printing solution for all UNIX vendors and users. CUPS
provides the System V and Berkeley command-line interfaces.
CUPS provides a portable printing layer for UNIX(r)-based
operating systems. It has been developed by Easy Software
Products to promote a standard printing solution for all UNIX
vendors and users. CUPS provides the System V and Berkeley
command-line interfaces.
CUPS uses the Internet Printing Protocol ("IPP") as the basis for
managing print jobs and queues. The Line Printer Daemon ("LPD") Server
Message Block ("SMB"), and AppSocket (a.k.a. JetDirect) protocols are
also supported with reduced functionality. CUPS adds network printer
browsing and PostScript Printer Description ("PPD") based printing
options to support real-world printing under UNIX.
CUPS uses the Internet Printing Protocol ("IPP") as the basis
for managing print jobs and queues. The Line Printer Daemon
("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
JetDirect) protocols are also supported with reduced
functionality. CUPS adds network printer browsing and
PostScript Printer Description ("PPD") based printing options
to support real-world printing under UNIX.
CUPS also includes a customized version of GNU Ghostscript (currently
based off GNU Ghostscript 5.50) and an image file RIP that are used to
support non-PostScript printers. Sample drivers for HP and EPSON
printers are included that use these filters.
CUPS includes an image file RIP that supports printing of
image files to non-PostScript printers. A customized version
of GPL Ghostscript for CUPS called ESP Ghostscript is
available separately to support printing of PostScript files
within the CUPS driver framework. Sample drivers for Dymo,
EPSON, HP, OKIDATA, and Zebra printers are included that use
these filters.
Drivers for over 2300 printers are provided with our ESP Print Pro
software, available at:
Drivers for thousands of printers are provided with our ESP
Print Pro software, available at:
http://www.easysw.com/printpro
http://www.easysw.com/printpro/
CUPS is licensed under the GNU General Public License and GNU Library
General Public License. Please contact Easy Software Products for
commercial support and "binary distribution" rights.
SYSTEM REQUIREMENTS
Binary distributions require a minimum of 10MB of free disk space. We
do not recommend using CUPS on a workstation with less than 32MB of RAM
or a PC with less than 16MB of RAM.
If you are installing from source you'll need ANSI-compliant C and C++
compilers and optionally one or more image file support libraries.
Complete source installation instructions can be found in the CUPS
System Administrator's Manual in the files "doc/sam.html" or
"doc/sam.pdf".
SOFTWARE REQUIREMENTS
The following operating system software is required to install one of
the binary distributions from Easy Software Products:
- Digital UNIX (aka OSF1 aka Compaq Tru64 UNIX) 4.0 or higher
- HP-UX 10.20 or higher
- IRIX 5.3 or higher
- Linux 2.0 with glibc2 or higher
- Solaris 2.5 or higher (SPARC or Intel)
INSTALLING "PORTABLE" CUPS DISTRIBUTIONS
We are currently distributing "portable" CUPS binary distributions in
TAR format with installation and removal scripts generated by our ESP
Package Manager (EPM) software, which is available from:
http://www.easysw.com/epm
WARNING: Installing CUPS will overwrite your existing printing system.
Backup files are made by the installation script and restored by the
removal script, so if you experience problems you should be able to
remove the CUPS software to restore your previous configuration.
However, Easy Software Products makes no warranty for this and will not
be liable for any lost revenues, etc.
To install the CUPS software you will need to be logged in as root
(doing an "su" is good enough). Once you are the root user, run the
installation script with:
./cups.install ENTER
After asking you a few yes/no questions the CUPS software will be
installed and the scheduler will be started automatically.
INSTALLING HOST-SPECIFIC (RPM, DEBIAN, ETC.) DISTRIBUTIONS
The host-specific distributions use the operating system software
installation tools. To install a host-specific distribution please
consult the CUPS Software Administrators Manual or your operating
system documentation.
CUPS is licensed under the GNU General Public License and GNU
Library General Public License. Please contact Easy Software
Products for commercial support and "binary distribution"
rights.
READING THE DOCUMENTATION
Once you have installed the software you can access the documentation
(and a bunch of other stuff) on-line at:
Once you have installed the software you can access the
documentation (and a bunch of other stuff) on-line at:
http://localhost:631
http://localhost:631/
If you're having trouble getting that far, the documentation is located
in the "/usr/share/doc/cups" directory in the binary distributions, and
under the "doc" directory in the source archives.
If you're having trouble getting that far, the documentation
is located under the "doc/help" directory.
Please read the documentation before asking questions.
Please read the documentation before asking questions.
GETTING SUPPORT AND OTHER RESOURCES
If you have problems, READ THE DOCUMENTATION FIRST! We also
provide many discussion forums which are available at:
http://www.cups.org/newsgroups.php
Commercial support (with a guaranteed response time) is
available from Easy Software Products. For more information
see:
http://www.easysw.com/cups/
See the CUPS web site at "http://www.cups.org/" for other
site links.
SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
CUPS 1.1 includes a new web-based administration tool that allows you
to manage printers, classes, and jobs on your server. To access the
printer administration tools open the following URL in your browser:
CUPS 1.2 includes a web-based administration tool that allows
you to manage printers, classes, and jobs on your server.
Open the following URL in your browser to access the printer
administration tools:
http://localhost:631/admin
http://localhost:631/admin/
You will be asked for the administration password (root or any other
user in the sys/system/root group on your system) and then shown a
menu of available functions.
DO NOT use the hostname for your machine - it will not work
with the default CUPS configuration. To enable
administration access on other addresses, check the "Allow
Remote Administration" box and click on the "Change Settings"
button.
DO NOT use the hostname for your machine - it will not work with the
default CUPS configuration. To enable administration access on other
addresses, consult the CUPS Software Administrators Manual.
You will be asked for the administration password (root or
any other user in the sys/system/root group on your system)
when performing any administrative function.
SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
CUPS works best with PPD (PostScript Printer Description) files. In a
pinch you can also use System V style printer interface scripts.
CUPS works best with PPD (PostScript Printer Description)
files. In a pinch you can also use System V style printer
interface scripts.
Six sample PPD files are provided with this distribution that utilize
the PostScript and image file RIPs and the sample EPSON and HP printer
drivers. To add the sample DeskJet driver to the system for a printer
connected to the parallel port, use one of the following commands:
CUPS includes several sample PPD files you can use:
Digital UNIX:
Driver PPD File
----------------------------- ------------
Dymo Label Printers dymo.ppd
EPSON Stylus Color Series stcolor.ppd
EPSON Stylus Photo Series stphoto.ppd
EPSON Stylus New Color Series stcolor2.ppd
EPSON Stylus New Photo Series stphoto2.ppd
EPSON 9-pin Series epson9.ppd
EPSON 24-pin Series epson24.ppd
HP DeskJet Series deskjet.ppd
HP New DeskJet Series deskjet2.ppd
HP LaserJet Series laserjet.ppd
OKIDATA 9-Pin Series okidata9.ppd
OKIDATA 24-Pin Series okidat24.ppd
Zebra CPCL Label Printer zebracpl.ppd
Zebra EPL1 Label Printer zebraep1.ppd
Zebra EPL2 Label Printer zebraep2.ppd
Zebra ZPL Label Printer zebra.ppd
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp0 -E
Run the "lpinfo" command to list the available printers:
HP-UX:
lpinfo -v
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/c2t0d0_lp -E
Then use the correct URI to add the printer using the
"lpadmin" command:
IRIX:
lpadmin -p printername -E -v URI -m filename.ppd
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/plp -E
Network printers typically use "socket" or "lpd" URIs:
Linux:
lpadmin -p printername -E -v socket://11.22.33.44 -m filename.ppd
lpadmin -p printername -E -v lpd://11.22.33.44/ -m filename.ppd
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp0 -E
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp1 -E
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp2 -E
The sample drivers provide basic printing capabilities, but
generally do not exercise the full potential of the printers
or CUPS. For fully-functional commercial printer drivers
check out our ESP Print Pro software at:
Solaris:
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/bpp0 -E
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/ecpp0 -E
Similarly, for the other sample drivers you can use:
Driver PPD File
-------------------------- ------------
HP DeskJet Series deskjet.ppd
HP LaserJet Series laserjet.ppd
EPSON Stylus Color Series stcolor.ppd
EPSON Stylus Photo Series stphoto.ppd
EPSON 9-pin Series epson9.ppd
EPSON 24-pin Series epson24.ppd
These sample drivers provide basic printing capabilities, but generally
do not exercise the full potential of the printers or CUPS. For
commercial printer drivers check out our ESP Print Pro software at:
http://www.easysw.com/printpro
http://www.easysw.com/printpro/
PRINTING FILES
CUPS provides both the System V "lp" and Berkeley "lpr" commands for
printing:
CUPS provides both the System V "lp" and Berkeley "lpr"
commands for printing:
lp filename
lpr filename
lp filename
lpr filename
Both the "lp" and "lpr" commands support printing options for the
driver:
Both the "lp" and "lpr" commands support printing options for
the driver:
lp -omedia=A4 -oresolution=600dpi filename
lpr -omedia=A4 -oresolution=600dpi filename
lp -omedia=A4 -oresolution=600dpi filename
lpr -omedia=A4 -oresolution=600dpi filename
CUPS recognizes many types of images files as well as PDF, PostScript,
HP-GL/2, and text files, so you can print those files directly rather
than through an application.
CUPS recognizes many types of images files as well as PDF,
PostScript, HP-GL/2, and text files, so you can print those
files directly rather than through an application.
If you have an application that generates output specifically for your
printer then you need to use the "-oraw" or "-l" options:
If you have an application that generates output specifically
for your printer then you need to use the "-oraw" or "-l"
options:
lp -oraw filename
lpr -l filename
lp -oraw filename
lpr -l filename
This will prevent the filters from misinterpreting your print file.
REPORTING PROBLEMS
If you have problems, READ THE DOCUMENTATION FIRST! If the
documentation does not solve your problems please send an email to
cups-support@cups.org. Include your operating system and version,
compiler and version, and any errors or problems you've run into. The
/var/log/error_log file should also be sent, as it often helps to
determine the cause of your problem.
If you are running a version of Linux, be sure to provide the Linux
distribution you have, too.
Please note that the "cups-support@cups.org" email address goes to the
CUPS developers; they are busy people, so your email may go unanswered
for days or weeks. Commercial support (with a guaranteed response
time) is available from Easy Software Products.
OTHER RESOURCES
See the CUPS web site at "http://www.cups.org" for other site links.
You can subscribe to the CUPS mailing list by sending a message
containing "subscribe cups" to majordomo@cups.org. This list is
provided to discuss problems, questions, and improvements to the CUPS
software. New releases of CUPS are announced to this list as well.
This will prevent the filters from misinterpreting your print
file.
LEGAL STUFF
CUPS is Copyright 1993-2000 by Easy Software Products. CUPS, the CUPS
logo, and the Common UNIX Printing System are the trademark property of
Easy Software Products.
CUPS is Copyright 1993-2006 by Easy Software Products. CUPS,
the CUPS logo, and the Common UNIX Printing System are the
trademark property of Easy Software Products.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
The PostScript RIP software (pstoraster) is based on the GNU
Ghostscript 5.50 core, Copyright 1986-1998 by Aladdin Enterprises.
The PDF filter (pdftops) is based on the Xpdf software,
Copyright 1996-2005 by Derek B. Noonburg.
The PDF filter (pdftops) is based on the Xpdf 0.90 software, Copyright
1996-1999 by Derek B. Noonburg.
This software is based in part on the work of the Independent
JPEG Group.
This software is based in part on the work of the Independent JPEG
Group.
CUPS is provided under the terms of the GNU General Public
License and GNU Library General Public License. This program
is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
"doc/help/license.html" or "LICENSE.txt" files for more
information.
CUPS is provided under the terms of the GNU General Public License and
GNU Library General Public License. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the "LICENSE.html", "LICENSE.txt", or "cups.license" files
for more information.
For commercial licensing information, please contact:
For commercial licensing information, please contact:
Attn: CUPS Licensing Information
Easy Software Products
44141 Airport View Drive, Suite 204
Hollywood, Maryland 20636 USA
Attn: CUPS Licensing Information
Easy Software Products
44141 Airport View Drive, Suite 204
Hollywood, Maryland 20636-3111 USA
Voice: +1.301.373.9600
Email: cups-info@cups.org
WWW: http://www.cups.org/
Voice: +1.301.373.9603
Email: cups-info@cups.org
WWW: http://www.cups.org
Note that commercial licensors may also require a license from Artifex
Software Inc. which handles commercial licensing of the Ghostscript
software, and from Derek B. Noonburg who developed the Xpdf software
used to print PDF files.
Note that commercial licensors may also require a license from
Derek B. Noonburg who developed the Xpdf software used to print
PDF files.
+39
Ver Arquivo
@@ -0,0 +1,39 @@
# DO NOT DELETE
betest.o: ../cups/string.h ../config.h
ipp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
ipp.o: ../cups/ipp-private.h ../cups/ipp.h ../cups/backend.h ../cups/cups.h
ipp.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
ipp.o: ../cups/language.h ../cups/string.h
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
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: 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
+114 -29
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Backend makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 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
@@ -15,18 +15,23 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
# This file is subject to the Apple OS-Developed Software exception.
#
include ../Makedefs
BACKENDS = ipp lpd parallel serial socket usb
TARGETS = betest $(BACKENDS)
OBJS = betest.o ipp.o lpd.o parallel.o serial.o socket.o usb.o
RBACKENDS = ipp lpd
UBACKENDS = $(PAP) parallel scsi serial snmp socket usb
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
#
@@ -41,22 +46,46 @@ all: $(TARGETS)
#
clean:
$(RM) $(OBJS) $(TARGETS)
$(RM) $(OBJS) $(TARGETS) http
#
# Update dependencies (without system header dependencies...)
#
depend:
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
#
# Install all targets...
#
install:
-$(MKDIR) $(SERVERBIN)/backend
$(CHMOD) ugo+rx $(SERVERBIN)
$(CHMOD) ugo+rx $(SERVERBIN)/backend
$(INSTALL_BIN) $(BACKENDS) $(SERVERBIN)/backend
install: all
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
for file in $(RBACKENDS); do \
$(LIBTOOL) $(INSTALL) -m 700 $$file $(SERVERBIN)/backend; \
done
for file in $(UBACKENDS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
done
$(RM) $(SERVERBIN)/backend/http
$(LN) ipp $(SERVERBIN)/backend/http
#
# Uninstall all targets...
#
uninstall:
for file in $(RBACKENDS) $(UBACKENDS); do \
$(RM) $(SERVERBIN)/backend/$$file; \
done
$(RM) $(SERVERBIN)/backend/http
-$(RMDIR) $(SERVERBIN)/backend
-$(RMDIR) $(SERVERBIN)
#
# betest
#
@@ -65,7 +94,38 @@ betest: betest.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o betest betest.o $(LIBS)
betest.o: ../cups/string.h ../Makedefs
#
# test1284
#
test1284: test1284.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# libbackend.a
#
libbackend.a: $(LIBOBJS)
echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
#
# ieee1394
#
ieee1394: ieee1394.o ieee1394-linux.o
echo Linking $@...
$(CC) $(LDFLAGS) -o ieee1394 ieee1394.o ieee1394-linux.o -lraw1394 $(LIBS)
ieee1394.o: ieee1394.h
ieee1394-linux.o: ieee1394.h
#
@@ -78,8 +138,6 @@ ipp: ipp.o ../cups/$(LIBCUPS)
$(RM) http
$(LN) ipp http
ipp.o: ../cups/cups.h ../Makedefs
#
# lpd
@@ -89,51 +147,78 @@ lpd: lpd.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
lpd.o: ../cups/cups.h ../Makedefs
#
# pap
#
pap: pap.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o pap pap.o $(BACKLIBS) $(LIBS) -framework AppleTalk
#
# 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)
parallel.o: ../cups/cups.h ../Makedefs
#
# scsi
#
scsi: scsi.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o scsi scsi.o $(LIBS)
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 $(LIBS)
$(CC) $(LDFLAGS) -o serial serial.o libbackend.a $(BACKLIBS) $(LIBS)
serial.o: ../cups/cups.h ../Makedefs
#
# snmp
#
snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(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)
socket.o: ../cups/cups.h ../Makedefs
$(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 $(LIBS)
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c
usb.o: ../cups/cups.h ../Makedefs
#
# Dependencies...
#
include Dependencies
#
+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$".
*/
+5 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 by Easy Software Products, all rights reserved.
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
@@ -15,12 +15,14 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Run the named backend.
+503
Ver Arquivo
@@ -0,0 +1,503 @@
/*
* "$Id$"
*
* IEEE-1284 support functions 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.
*
* Contents:
*
* 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 "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 */
/*
* 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
* corresponding URI.
*/
int /* O - 0 on success, -1 on failure */
backendGetDeviceID(
int fd, /* I - File descriptor */
char *device_id, /* O - 1284 device ID */
int device_id_size, /* I - Size of buffer */
char *make_model, /* O - Make/model */
int make_model_size, /* I - Size of buffer */
const char *scheme, /* I - URI scheme */
char *uri, /* O - Device URI */
int uri_size) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
manufacturer[256], /* Manufacturer string */
serial_number[1024]; /* Serial number string */
int manulen; /* Length of manufacturer string */
#ifdef __linux
int length; /* Length of device ID info */
#endif /* __linux */
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
struct ecpp_device_id did; /* Device ID buffer */
#endif /* __sun && ECPPIOC_GETDEVID */
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)",
uri, uri_size));
/*
* Range check input...
*/
if (fd < 0 ||
!device_id || device_id_size < 32 ||
!make_model || make_model_size < 32)
{
DEBUG_puts("backendGetDeviceID: Bad args!");
return (-1);
}
*device_id = '\0';
*make_model = '\0';
if (uri)
*uri = '\0';
/*
* Get the device ID string...
*/
#ifdef __linux
if (!ioctl(fd, LPIOC_GET_DEVICE_ID(device_id_size), device_id))
{
/*
* Extract the length of the device ID string from the first two
* bytes. The 1284 spec says the length is stored MSB first...
*/
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
/*
* Check to see if the length is larger than our buffer; first
* assume that the vendor incorrectly implemented the 1284 spec,
* and then limit the length to the size of our buffer...
*/
if (length > (device_id_size - 2))
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (device_id_size - 2))
length = device_id_size - 2;
/*
* Copy the device ID text to the beginning of the buffer and
* nul-terminate.
*/
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
# ifdef DEBUG
else
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __linux */
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
did.mode = ECPP_CENTRONICS;
did.len = device_id_size - 1;
did.rlen = 0;
did.addr = device_id;
if (!ioctl(fd, ECPPIOC_GETDEVID, &did))
{
/*
* Nul-terminate the device ID text.
*/
if (did.rlen < (device_id_size - 1))
device_id[did.rlen] = '\0';
else
device_id[device_id_size - 1] = '\0';
}
# ifdef DEBUG
else
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __sun && ECPPIOC_GETDEVID */
DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
if (!*device_id)
return (-1);
/*
* Get the make and model...
*/
backendGetMakeModel(device_id, make_model, make_model_size);
/*
* Then generate a device URI...
*/
if (scheme && uri && uri_size > 32)
{
/*
* Look for the serial number field...
*/
if ((attr = strstr(device_id, "SERN:")) != NULL)
attr += 5;
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, ";SN:")) != NULL)
attr += 4;
if (attr)
{
strlcpy(serial_number, attr, sizeof(serial_number));
if ((delim = strchr(serial_number, ';')) != NULL)
*delim = '\0';
}
else
serial_number[0] = '\0';
/*
* Generate the device URI from the manufacturer, make_model, and
* serial number strings.
*/
snprintf(uri, uri_size, "%s://", scheme);
if ((attr = strstr(device_id, "MANUFACTURER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, "Manufacturer:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, "MFG:")) != NULL)
attr += 4;
if (attr)
{
strlcpy(manufacturer, attr, sizeof(manufacturer));
if ((delim = strchr(manufacturer, ';')) != NULL)
*delim = '\0';
if (!strcasecmp(manufacturer, "Hewlett-Packard"))
strcpy(manufacturer, "HP");
else if (!strcasecmp(manufacturer, "Lexmark International"))
strcpy(manufacturer, "Lexmark");
}
else
{
strlcpy(manufacturer, make_model, sizeof(manufacturer));
if ((delim = strchr(manufacturer, ' ')) != NULL)
*delim = '\0';
}
manulen = strlen(manufacturer);
for (uriptr = uri + strlen(uri), delim = manufacturer;
*delim && uriptr < (uri + uri_size - 3);
delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
*uriptr++ = '/';
if (!strncasecmp(make_model, manufacturer, manulen))
{
delim = make_model + manulen;
while (isspace(*delim & 255))
delim ++;
}
else
delim = make_model;
for (; *delim && uriptr < (uri + uri_size - 3); delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
if (serial_number[0])
{
/*
* Add the serial number to the URI...
*/
strlcpy(uriptr, "?serial=", uri_size - (uriptr - uri));
strlcat(uriptr, serial_number, uri_size - (uriptr - uri));
}
else
*uriptr = '\0';
}
return (0);
}
/*
* 'backendGetMakeModel()' - Get the make and model string from the device ID.
*/
int /* O - 0 on success, -1 on failure */
backendGetMakeModel(
const char *device_id, /* O - 1284 device ID */
char *make_model, /* O - Make/model */
int make_model_size) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*mfg, /* Manufacturer string */
*mdl; /* Model string */
DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
"make_model=%p, make_model_size=%d)\n", device_id,
make_model, make_model_size));
/*
* Range check input...
*/
if (!device_id || !*device_id || !make_model || make_model_size < 32)
{
DEBUG_puts("backendGetMakeModel: Bad args!");
return (-1);
}
*make_model = '\0';
/*
* Look for the description field...
*/
if ((attr = strstr(device_id, "DES:")) != NULL)
attr += 4;
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
attr += 12;
if (attr)
{
/*
* Make sure the description contains something useful, since some
* printer manufacturers (HP) apparently don't follow the standards
* they helped to define...
*
* Here we require the description to be 8 or more characters in length,
* containing at least one space and one letter.
*/
if ((delim = strchr(attr, ';')) == NULL)
delim = attr + strlen(attr);
if ((delim - attr) < 8)
attr = NULL;
else
{
char *ptr; /* Pointer into description */
int letters, /* Number of letters seen */
spaces; /* Number of spaces seen */
for (ptr = attr, letters = 0, spaces = 0; ptr < delim; ptr ++)
{
if (isspace(*ptr & 255))
spaces ++;
else if (isalpha(*ptr & 255))
letters ++;
if (spaces && letters)
break;
}
if (!spaces || !letters)
attr = NULL;
}
}
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "Manufacturer:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
mfg += 4;
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "Model:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
mdl += 4;
if (mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
if (mfg)
{
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);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
if (!strncasecmp(make_model, mdl, strlen(make_model)))
{
/*
* Just copy model string, since it has the manufacturer...
*/
strlcpy(make_model, mdl, make_model_size);
}
else
{
/*
* Concatenate the make and model...
*/
strlcat(make_model, " ", make_model_size);
strlcat(make_model, mdl, make_model_size);
}
}
else
{
/*
* Just copy model string, since it has the manufacturer...
*/
strlcpy(make_model, mdl, make_model_size);
}
}
else if (attr)
{
/*
* Use description...
*/
if (!strncasecmp(attr, "Hewlett-Packard hp ", 19))
{
/*
* Check for a common HP bug...
*/
strlcpy(make_model, "HP ", make_model_size);
strlcpy(make_model + 3, attr + 19, make_model_size - 3);
}
else if (!strncasecmp(attr, "Hewlett-Packard ", 16))
{
strlcpy(make_model, "HP ", make_model_size);
strlcpy(make_model + 3, attr + 16, make_model_size - 3);
}
else
{
strlcpy(make_model, attr, make_model_size);
}
}
else
{
/*
* Use "Unknown" as the printer make and model...
*/
strlcpy(make_model, "Unknown", make_model_size);
}
/*
* Strip trailing data...
*/
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
/*
* Strip trailing whitespace...
*/
for (delim = make_model + strlen(make_model) - 1; delim >= make_model; delim --)
if (isspace(*delim & 255))
*delim = '\0';
else
break;
/*
* Return...
*/
if (make_model[0])
return (0);
else
return (-1);
}
/*
* End of "$Id$".
*/
+1361 -437
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+925 -226
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+1568
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+175 -157
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,12 +15,14 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Send a file to the specified parallel port.
@@ -31,20 +33,22 @@
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#include "backend-private.h"
#if defined(WIN32) || defined(__EMX__)
#ifdef __hpux
# include <sys/time.h>
#else
# include <sys/select.h>
#endif /* __hpux */
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
#endif /* WIN32 || __EMX__ */
# include <sys/socket.h>
#endif /* WIN32 */
#ifdef __sgi
# include <invent.h>
@@ -73,39 +77,59 @@ void list_devices(void);
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
int print_fd, /* Print file */
device_fd; /* Parallel device */
int copies; /* Number of copies to print */
size_t tbytes; /* Total number of bytes written */
struct termios opts; /* Parallel port options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: parallel job-id user title copies options [file]\n", stderr);
return (1);
return (CUPS_BACKEND_FAILED);
}
/*
@@ -115,8 +139,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = stdin;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -124,10 +148,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = fopen(argv[6], "rb")) == NULL)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
return (CUPS_BACKEND_FAILED);
}
copies = atoi(argv[4]);
@@ -137,7 +161,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the device name and options from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
/*
* See if there are any options...
@@ -157,108 +184,103 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Open the parallel port device...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
if ((device_fd = open(resource, O_WRONLY | O_EXCL)) == -1)
{
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.
*/
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...
*/
sleep(5);
return (CUPS_BACKEND_FAILED);
}
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);
sleep(30);
}
else
{
perror("ERROR: Unable to open parallel port device file");
return (1);
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);
/*
* 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);
/*
* 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...
*/
#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...
*/
while (copies > 0)
tbytes = 0;
while (copies > 0 && tbytes >= 0)
{
copies --;
if (fp != stdin)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
lseek(print_fd, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes = backendRunLoop(print_fd, device_fd, 1);
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", 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 != stdin)
fclose(fp);
close(device_fd);
return (0);
if (print_fd != 0)
close(print_fd);
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
@@ -269,78 +291,52 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
void
list_devices(void)
{
#if defined(__hpux) || defined(__sgi) || defined(__sun)
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
/* Funky hex numbering used for some devices */
#endif /* __hpux || __sgi || __sun */
#ifdef __linux
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
FILE *probe; /* /proc/parport/n/autoprobe file */
char line[1024], /* Line from file */
*delim, /* Delimiter in file */
make[IPP_MAX_NAME], /* Make from file */
model[IPP_MAX_NAME]; /* Model from file */
char device[255], /* Device filename */
basedevice[255], /* Base device filename for ports */
device_id[1024], /* Device ID string */
make_model[1024]; /* Make and model */
if (!access("/dev/parallel/", 0))
strcpy(basedevice, "/dev/parallel/");
else if (!access("/dev/printers/", 0))
strcpy(basedevice, "/dev/printers/");
else
strcpy(basedevice, "/dev/lp");
for (i = 0; i < 4; i ++)
{
sprintf(device, "/proc/parport/%d/autoprobe", i);
if ((probe = fopen(device, "r")) != NULL)
/*
* Open the port, if available...
*/
sprintf(device, "%s%d", basedevice, i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
fd = open(device, O_WRONLY);
if (fd >= 0)
{
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
strcpy(model, "Unknown");
/*
* Now grab the IEEE 1284 device ID string...
*/
while (fgets(line, sizeof(line), probe) != NULL)
{
/*
* Strip trailing ; and/or newline.
*/
if ((delim = strrchr(line, ';')) != NULL)
*delim = '\0';
else if ((delim = strrchr(line, '\n')) != NULL)
*delim = '\0';
/*
* Look for MODEL and MANUFACTURER lines...
*/
if (strncmp(line, "MODEL:", 6) == 0 &&
strncmp(line, "MODEL:Unknown", 13) != 0)
strncpy(model, line + 6, sizeof(model) - 1);
else if (strncmp(line, "MANUFACTURER:", 13) == 0 &&
strncmp(line, "MANUFACTURER:Unknown", 20) != 0)
strncpy(make, line + 13, sizeof(make) - 1);
}
fclose(probe);
if (make[0])
printf("direct parallel:/dev/lp%d \"%s %s\" \"Parallel Port #%d\"\n",
i, make, model, i + 1);
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
printf("direct parallel:/dev/lp%d \"%s\" \"Parallel Port #%d\"\n",
i, model, i + 1);
}
else
{
sprintf(device, "/dev/lp%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
else
{
sprintf(device, "/dev/par%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
}
printf("direct parallel:%s \"Unknown\" \"LPT #%d\"\n", device, i + 1);
close(fd);
}
}
#elif defined(__sgi)
@@ -540,7 +536,7 @@ list_devices(void)
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
}
#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD)
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
@@ -550,6 +546,28 @@ list_devices(void)
{
sprintf(device, "/dev/lpt%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d (interrupt-driven)\"\n", device, i + 1);
}
sprintf(device, "/dev/lpa%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d (polled)\"\n", device, i + 1);
}
}
#elif defined(_AIX)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/lp%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
+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$".
*/
+235
Ver Arquivo
@@ -0,0 +1,235 @@
/*
* "$Id$"
*
* IRIX SCSI printer support for the Common UNIX Printing System (CUPS).
*
* Copyright 2003-2005 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:
*
* list_devices() - List the available SCSI printer devices.
* print_device() - Print a file to a SCSI device.
*/
/*
* Include necessary headers.
*/
#include <bstring.h> /* memcpy() and friends */
#include <sys/dsreq.h> /* SCSI interface stuff */
/*
* 'list_devices()' - List the available SCSI printer devices.
*/
void
list_devices(void)
{
puts("direct scsi \"Unknown\" \"SCSI Printer\"");
}
/*
* 'print_device()' - Print a file to a SCSI device.
*/
int /* O - Print status */
print_device(const char *resource, /* I - SCSI device */
int fd, /* I - File to print */
int copies) /* I - Number of copies to print */
{
int scsi_fd; /* SCSI file descriptor */
char buffer[8192]; /* Data buffer */
int bytes; /* Number of bytes */
int try; /* Current try */
dsreq_t scsi_req; /* SCSI request */
char scsi_cmd[6]; /* SCSI command data */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure we have a valid resource name...
*/
if (strncmp(resource, "/dev/scsi/", 10) != 0)
{
fprintf(stderr, "ERROR: Bad SCSI device file \"%s\"!\n", resource);
return (CUPS_BACKEND_STOP);
}
/*
* Open the SCSI device file...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
{
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.
*/
fputs("INFO: Unable to open SCSI device, queuing on next printer in class...\n",
stderr);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
return (1);
}
if (errno != EAGAIN && errno != EBUSY)
{
fprintf(stderr, "ERROR: Unable to open SCSI device \"%s\" - %s\n",
resource, strerror(errno));
return (CUPS_BACKEND_FAILED);
}
else
{
fprintf(stderr, "INFO: SCSI device \"%s\" busy; retrying...\n",
resource);
sleep(30);
}
}
}
while (scsi_fd == -1);
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 (fd != 0)
{
#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 */
}
/*
* Copy the print file to the device...
*/
while (copies > 0)
{
if (fd != 0)
lseek(fd, 0, SEEK_SET);
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
{
memset(&scsi_req, 0, sizeof(scsi_req));
scsi_req.ds_flags = DSRQ_WRITE;
scsi_req.ds_time = 60 * 1000;
scsi_req.ds_cmdbuf = scsi_cmd;
scsi_req.ds_cmdlen = 6;
scsi_req.ds_databuf = buffer;
scsi_req.ds_datalen = bytes;
scsi_cmd[0] = 0x0a; /* Group 0 print command */
scsi_cmd[1] = 0x00;
scsi_cmd[2] = bytes / 65536;
scsi_cmd[3] = bytes / 256;
scsi_cmd[4] = bytes;
scsi_cmd[5] = 0x00;
for (try = 0; try < 10; try ++)
if (ioctl(scsi_fd, DS_ENTER, &scsi_req) < 0 ||
scsi_req.ds_status != 0)
{
fprintf(stderr, "WARNING: SCSI command timed out (%d); retrying...\n",
scsi_req.ds_status);
sleep(try + 1);
}
else
break;
if (try >= 10)
{
fprintf(stderr, "ERROR: Unable to send print data (%d)\n",
scsi_req.ds_status);
close(scsi_fd);
return (CUPS_BACKEND_FAILED);
}
}
copies --;
}
/*
* Close the device and return...
*/
close(fd);
return (CUPS_BACKEND_OK);
}
/*
* End of "$Id$".
*/
+253
Ver Arquivo
@@ -0,0 +1,253 @@
/*
* "$Id$"
*
* Linux SCSI printer support for the Common UNIX Printing System (CUPS).
*
* Copyright 2003-2005 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:
*
* list_devices() - List the available SCSI printer devices.
* print_device() - Print a file to a SCSI device.
*/
/*
* Include necessary headers.
*/
#include <scsi/sg.h>
/*
* We currently only support the Linux 2.4 generic SCSI interface.
*/
#ifndef SG_DXFER_TO_DEV
/*
* Dummy functions that do nothing on unsupported platforms...
*/
void list_devices(void) {}
int print_device(const char *resource, int fd, int copies) { return (1); }
#else
/*
* 'list_devices()' - List the available SCSI printer devices.
*/
void
list_devices(void)
{
puts("direct scsi \"Unknown\" \"SCSI Printer\"");
}
/*
* 'print_device()' - Print a file to a SCSI device.
*/
int /* O - Print status */
print_device(const char *resource, /* I - SCSI device */
int fd, /* I - File to print */
int copies) /* I - Number of copies to print */
{
int scsi_fd; /* SCSI file descriptor */
char buffer[8192]; /* Data buffer */
int bytes; /* Number of bytes */
int try; /* Current try */
sg_io_hdr_t scsi_req; /* SCSI request */
unsigned char scsi_cmd[6], /* SCSI command data */
scsi_sense[32]; /* SCSI sense data */
# if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
# endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure we have a valid resource name...
*/
if (strncmp(resource, "/dev/sg", 7) != 0)
{
fprintf(stderr, "ERROR: Bad SCSI device file \"%s\"!\n", resource);
return (CUPS_BACKEND_STOP);
}
/*
* Open the SCSI device file...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
{
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.
*/
fputs("INFO: Unable to open SCSI device, queuing on next printer in class...\n",
stderr);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
return (CUPS_BACKEND_FAILED);
}
if (errno != EAGAIN && errno != EBUSY)
{
fprintf(stderr, "ERROR: Unable to open SCSI device \"%s\" - %s\n",
resource, strerror(errno));
return (CUPS_BACKEND_FAILED);
}
else
{
fprintf(stderr, "INFO: SCSI device \"%s\" busy; retrying...\n",
resource);
sleep(30);
}
}
}
while (scsi_fd == -1);
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 (fd != 0)
{
# 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 */
}
/*
* Copy the print file to the device...
*/
while (copies > 0)
{
if (fd != 0)
lseek(fd, 0, SEEK_SET);
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
{
memset(&scsi_req, 0, sizeof(scsi_req));
scsi_req.interface_id = 'S';
scsi_req.dxfer_direction = SG_DXFER_TO_DEV;
scsi_req.cmd_len = 6;
scsi_req.mx_sb_len = sizeof(scsi_sense);
scsi_req.iovec_count = 0;
scsi_req.dxfer_len = bytes;
scsi_req.dxferp = buffer;
scsi_req.cmdp = scsi_cmd;
scsi_req.sbp = scsi_sense;
scsi_req.timeout = 60 * 1000;
scsi_cmd[0] = 0x0a; /* Group 0 print command */
scsi_cmd[1] = 0x00;
scsi_cmd[2] = bytes / 65536;
scsi_cmd[3] = bytes / 256;
scsi_cmd[4] = bytes;
scsi_cmd[5] = 0x00;
for (try = 0; try < 10; try ++)
if (ioctl(scsi_fd, SG_IO, &scsi_req) < 0 ||
scsi_req.status != 0)
{
fprintf(stderr, "WARNING: SCSI command timed out (%d); retrying...\n",
scsi_req.status);
sleep(try + 1);
}
else
break;
if (try >= 10)
{
fprintf(stderr, "ERROR: Unable to send print data (%d)\n",
scsi_req.status);
close(scsi_fd);
return (CUPS_BACKEND_FAILED);
}
}
copies --;
}
/*
* Close the device and return...
*/
close(fd);
return (CUPS_BACKEND_OK);
}
#endif /* !SG_DXFER_TO_DEV */
/*
* End of "$Id$".
*/
+224
Ver Arquivo
@@ -0,0 +1,224 @@
/*
* "$Id$"
*
* SCSI printer backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2003-2006 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 specified SCSI printer.
*/
/*
* 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>
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
# endif /* HAVE_SYS_IOCTL_H */
#endif /* WIN32 */
/*
* Local functions...
*/
void list_devices(void);
int print_device(const char *resource, int fd, int copies);
#ifdef __linux__
# include "scsi-linux.c"
#elif defined(__sgi)
# include "scsi-irix.c"
#else
/*
* Dummy functions that do nothing on unsupported platforms...
*/
void list_devices(void) {}
int print_device(const char *resource, int fd, int copies) { return (CUPS_BACKEND_FAILED); }
#endif /* __linux */
/*
* 'main()' - Send a file to the specified SCSI 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 */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
int fp; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
#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);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: scsi:/dev/file job-id user title copies options [file]\n", stderr);
return (CUPS_BACKEND_FAILED);
}
/*
* 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 (CUPS_BACKEND_FAILED);
}
copies = atoi(argv[4]);
}
/*
* Extract the device name and options from the URI...
*/
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
/*
* See if there are any options...
*/
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
}
/*
* Finally, send the print file...
*/
status = print_device(resource, fp, copies);
/*
* Close input file and return...
*/
if (fp != 0)
close(fp);
return (status);
}
/*
* End of "$Id$".
*/
+618 -101
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,12 +15,14 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Send a file to the printer or server.
@@ -31,20 +33,27 @@
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#include "backend-private.h"
#if defined(WIN32) || defined(__EMX__)
#ifdef __hpux
# include <sys/modem.h>
#endif /* __hpux */
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
#endif /* WIN32 || __EMX__ */
# ifdef __hpux
# include <sys/time.h>
# else
# include <sys/select.h>
# endif /* __hpux */
# ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
# endif /* HAVE_SYS_IOCTL_H */
#endif /* WIN32 */
#ifdef __sgi
# include <invent.h>
@@ -57,6 +66,26 @@
# endif /* !INV_EPP_ECP_PLP */
#endif /* __sgi */
#ifndef CRTSCTS
# ifdef CNEW_RTSCTS
# define CRTSCTS CNEW_RTSCTS
# else
# define CRTSCTS 0
# endif /* CNEW_RTSCTS */
#endif /* !CRTSCTS */
#if defined(__APPLE__)
# include <CoreFoundation/CoreFoundation.h>
# include <IOKit/IOKitLib.h>
# include <IOKit/serial/IOSerialKeys.h>
# include <IOKit/IOBSD.h>
#endif /* __APPLE__ */
#if defined(__linux) && defined(TIOCGSERIAL)
# include <linux/serial.h>
# include <linux/ioctl.h>
#endif /* __linux && TIOCGSERIAL */
/*
* Local functions...
@@ -73,42 +102,74 @@ void list_devices(void);
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options, /* Pointer to options */
name[255], /* Name of option */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
int port; /* Port number (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options, /* Pointer to options */
name[255], /* Name of option */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
int port; /* Port number (not used) */
int copies; /* Number of copies to print */
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 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 */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: serial job-id user title copies options [file]\n", stderr);
return (1);
return (CUPS_BACKEND_FAILED);
}
/*
@@ -118,8 +179,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = stdin;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -127,10 +188,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = fopen(argv[6], "rb")) == NULL)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
return (CUPS_BACKEND_FAILED);
}
copies = atoi(argv[4]);
@@ -140,7 +201,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the device name and options from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
/*
* See if there are any options...
@@ -160,10 +224,34 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Open the serial port device...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL)) == -1)
if ((device_fd = open(resource, O_RDWR | O_NOCTTY | O_EXCL |
O_NDELAY)) == -1)
{
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.
*/
fputs("INFO: Unable to open serial port, queuing on next printer in class...\n",
stderr);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
return (CUPS_BACKEND_FAILED);
}
if (errno == EBUSY)
{
fputs("INFO: Serial port busy; will retry in 30 seconds...\n", stderr);
@@ -171,22 +259,32 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
else
{
perror("ERROR: Unable to open serial port device file");
return (1);
fprintf(stderr, "ERROR: Unable to open serial 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);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
tcgetattr(device_fd, &origopts);
tcgetattr(device_fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
opts.c_lflag &= ~(ICANON | ECHO | ISIG);
/* Raw mode */
opts.c_oflag &= ~OPOST; /* Don't post-process */
if (options != NULL)
print_size = 96; /* 9600 baud / 10 bits/char / 10Hz */
dtrdsr = 0; /* No dtr/dsr flow control */
if (options)
{
while (*options)
{
/*
@@ -194,7 +292,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
for (ptr = name; *options && *options != '=';)
*ptr++ = *options++;
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
@@ -205,11 +304,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
options ++;
for (ptr = value; *options && *options != '+';)
*ptr++ = *options++;
for (ptr = value; *options && *options != '+' && *options != '&';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
if (*options == '+' || *options == '&')
options ++;
}
else
@@ -219,12 +319,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Process the option...
*/
if (strcasecmp(name, "baud") == 0)
if (!strcasecmp(name, "baud"))
{
/*
* Set the baud rate...
*/
print_size = atoi(value) / 100;
#if B19200 == 19200
cfsetispeed(&opts, atoi(value));
cfsetospeed(&opts, atoi(value));
@@ -255,13 +357,31 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
cfsetispeed(&opts, B38400);
cfsetospeed(&opts, B38400);
break;
# ifdef B57600
case 57600 :
cfsetispeed(&opts, B57600);
cfsetospeed(&opts, B57600);
break;
# endif /* B57600 */
# ifdef B115200
case 115200 :
cfsetispeed(&opts, B115200);
cfsetospeed(&opts, B115200);
break;
# endif /* B115200 */
# ifdef B230400
case 230400 :
cfsetispeed(&opts, B230400);
cfsetospeed(&opts, B230400);
break;
# endif /* B230400 */
default :
fprintf(stderr, "WARNING: Unsupported baud rate %s!\n", value);
break;
}
#endif /* B19200 == 19200 */
}
else if (strcasecmp(name, "bits") == 0)
else if (!strcasecmp(name, "bits"))
{
/*
* Set number of data bits...
@@ -282,101 +402,309 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
break;
}
}
else if (strcasecmp(name, "parity") == 0)
else if (!strcasecmp(name, "parity"))
{
/*
* Set parity checking...
*/
if (strcasecmp(value, "even") == 0)
if (!strcasecmp(value, "even"))
{
opts.c_cflag |= PARENB;
opts.c_cflag &= ~PARODD;
}
else if (strcasecmp(value, "odd") == 0)
else if (!strcasecmp(value, "odd"))
{
opts.c_cflag |= PARENB;
opts.c_cflag |= PARODD;
}
else if (strcasecmp(value, "none") == 0)
else if (!strcasecmp(value, "none"))
opts.c_cflag &= ~PARENB;
else if (!strcasecmp(value, "space"))
{
/*
* Note: we only support space parity with 7 bits per character...
*/
opts.c_cflag &= ~CSIZE;
opts.c_cflag |= CS8;
opts.c_cflag &= ~PARENB;
}
else if (!strcasecmp(value, "mark"))
{
/*
* Note: we only support mark parity with 7 bits per character
* and 1 stop bit...
*/
opts.c_cflag &= ~CSIZE;
opts.c_cflag |= CS7;
opts.c_cflag &= ~PARENB;
opts.c_cflag |= CSTOPB;
}
}
else if (!strcasecmp(name, "flow"))
{
/*
* Set flow control...
*/
if (!strcasecmp(value, "none"))
{
opts.c_iflag &= ~(IXON | IXOFF);
opts.c_cflag &= ~CRTSCTS;
}
else if (!strcasecmp(value, "soft"))
{
opts.c_iflag |= IXON | IXOFF;
opts.c_cflag &= ~CRTSCTS;
}
else if (!strcasecmp(value, "hard") ||
!strcasecmp(value, "rtscts"))
{
opts.c_iflag &= ~(IXON | IXOFF);
opts.c_cflag |= CRTSCTS;
}
else if (!strcasecmp(value, "dtrdsr"))
{
opts.c_iflag &= ~(IXON | IXOFF);
opts.c_cflag &= ~CRTSCTS;
dtrdsr = 1;
}
}
else if (!strcasecmp(name, "stop"))
{
switch (atoi(value))
{
case 1 :
opts.c_cflag &= ~CSTOPB;
break;
case 2 :
opts.c_cflag |= CSTOPB;
break;
}
}
}
}
tcsetattr(fd, TCSANOW, &opts);
tcsetattr(device_fd, TCSANOW, &opts);
fcntl(device_fd, F_SETFL, 0);
/*
* 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...
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
if (print_fd != 0)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
/*
* Finally, send the print file...
* Figure out the maximum file descriptor value to use with select()...
*/
nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
/*
* 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 != stdin)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
lseek(print_fd, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
/*
* Now loop until we are out of data from print_fd...
*/
for (print_bytes = 0, print_ptr = print_buffer;;)
{
/*
* Write the print data to the printer...
* Use select() to determine whether we have data to copy around...
*/
tbytes += nbytes;
bufptr = buffer;
FD_ZERO(&input);
if (!print_bytes)
FD_SET(print_fd, &input);
FD_SET(device_fd, &input);
while (nbytes > 0)
FD_ZERO(&output);
if (print_bytes)
FD_SET(device_fd, &output);
if (select(nfds, &input, &output, NULL, NULL) < 0)
continue; /* Ignore errors here */
/*
* Check if we have back-channel data ready...
*/
if (FD_ISSET(device_fd, &input))
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
{
perror("ERROR: Unable to send print file to printer");
break;
fprintf(stderr,
"DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
CUPS_LLCAST bc_bytes);
cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
/*
* Check if we have print data ready...
*/
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;
}
}
}
}
/*
* Close the socket connection and input file and return...
* Close the serial port and input file and return...
*/
close(fd);
if (fp != stdin)
fclose(fp);
tcsetattr(device_fd, TCSADRAIN, &origopts);
return (0);
close(device_fd);
if (print_fd != 0)
close(print_fd);
return (total_bytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
@@ -387,25 +715,85 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
void
list_devices(void)
{
#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
/* Funky hex numbering used for some devices */
/* Funky hex numbering used for some *
* devices */
#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ */
#ifdef __linux
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
# ifdef TIOCGSERIAL
struct serial_struct serinfo; /* serial port info */
# endif /* TIOCGSERIAL */
for (i = 0; i < 4; i ++)
for (i = 0; i < 100; i ++)
{
sprintf(device, "/dev/ttyS%d", i);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
# ifdef TIOCGSERIAL
/*
* See if this port exists...
*/
serinfo.reserved_char[0] = 0;
if (!ioctl(fd, TIOCGSERIAL, &serinfo))
{
if (serinfo.type == PORT_UNKNOWN)
{
/*
* Nope...
*/
close(fd);
continue;
}
}
# endif /* TIOCGSERIAL */
close(fd);
# if defined(_ARCH_PPC) || defined(powerpc) || defined(__powerpc)
printf("serial serial:%s?baud=230400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# else
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# endif /* _ARCH_PPC || powerpc || __powerpc */
}
}
for (i = 0; i < 16; i ++)
{
sprintf(device, "/dev/usb/ttyUSB%d", i);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
}
}
for (i = 0; i < 64; i ++)
{
for (j = 0; j < 8; j ++)
{
sprintf(device, "/dev/ttyQ%02de%d", i, j);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" "
"\"Equinox ESP %d Port #%d\"\n",
device, i, j + 1);
}
}
}
#elif defined(__sgi)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
@@ -433,7 +821,7 @@ list_devices(void)
*/
for (n = 0; n < 6; n ++)
printf("serial serial:/dev/ttyd%d?baud=19200 \"Unknown\" \"CDSIO Board %d Serial Port #%d\"\n",
printf("serial serial:/dev/ttyd%d?baud=38400 \"Unknown\" \"CDSIO Board %d Serial Port #%d\"\n",
n + 5 + 8 * inv->inv_controller, inv->inv_controller, n + 1);
}
else if (inv->inv_type == INV_EPC_SERIAL)
@@ -448,7 +836,7 @@ list_devices(void)
i = 41 + 4 * (int)inv->inv_controller;
for (n = 0; n < (int)inv->inv_state; n ++)
printf("serial serial:/dev/ttyd%d?baud=19200 \"Unknown\" \"EPC Serial Port %d, Ebus slot %d\"\n",
printf("serial serial:/dev/ttyd%d?baud=38400 \"Unknown\" \"EPC Serial Port %d, Ebus slot %d\"\n",
n + i, n + 1, (int)inv->inv_controller);
}
else if (inv->inv_state > 1)
@@ -458,7 +846,7 @@ list_devices(void)
*/
for (n = 0; n < (int)inv->inv_state; n ++)
printf("serial serial:/dev/ttyd%d?baud=19200 \"Unknown\" \"Onboard Serial Port %d\"\n",
printf("serial serial:/dev/ttyd%d?baud=38400 \"Unknown\" \"Onboard Serial Port %d\"\n",
n + (int)inv->inv_unit + 1, n + (int)inv->inv_unit + 1);
}
else
@@ -517,8 +905,13 @@ list_devices(void)
{
sprintf(device, "/dev/cua/%c", 'a' + i);
if (access(device, 0) == 0)
# ifdef B115200
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# else
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# endif /* B115200 */
}
/*
@@ -614,7 +1007,7 @@ list_devices(void)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD)
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
@@ -649,6 +1042,14 @@ list_devices(void)
printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Port #%d\"\n",
device, i, j + 1);
}
sprintf(device, "/dev/ttyC%d%c", i, funky_hex[j]);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Port #%d\"\n",
device, i, j + 1);
}
}
/*
@@ -696,6 +1097,122 @@ list_devices(void)
device, i + 1);
}
}
#elif defined(__NetBSD__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
/*
* Standard serial ports...
*/
for (i = 0; i < 4; i ++)
{
sprintf(device, "/dev/tty%02d", i);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
}
/*
* Cyclades-Z ports...
*/
for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
for (j = 0; j < 64; j ++)
{
sprintf(device, "/dev/ttyCZ%02d%02d", i, j);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Prt #%d\"\n",
device, i, j + 1);
}
}
#elif defined(__APPLE__)
/*
* Standard serial ports on MacOS X...
*/
kern_return_t kernResult;
mach_port_t masterPort;
io_iterator_t serialPortIterator;
CFMutableDictionaryRef classesToMatch;
io_object_t serialService;
kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
if (KERN_SUCCESS != kernResult)
return;
/*
* Serial devices are instances of class IOSerialBSDClient.
*/
classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
if (classesToMatch != NULL)
{
CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey),
CFSTR(kIOSerialBSDRS232Type));
kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
&serialPortIterator);
if (kernResult == KERN_SUCCESS)
{
while ((serialService = IOIteratorNext(serialPortIterator)))
{
CFTypeRef serialNameAsCFString;
CFTypeRef bsdPathAsCFString;
char serialName[128];
char bsdPath[1024];
Boolean result;
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
{
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
{
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
bsdPath, serialName);
}
}
}
IOObjectRelease(serialService);
}
/*
* Release the iterator.
*/
IOObjectRelease(serialPortIterator);
}
}
#endif
}
+2456
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+172
Ver Arquivo
@@ -0,0 +1,172 @@
snmp.txt - 2006-04-19
---------------------
This file lists the "interesting" bits from the command:
snmpwalk -v 1 -c public HOST .1
for many network print servers and internal cards. It is mainly here
for SNMP documentation and development purposes.
AXIS 5600
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM J.sp.00,JETDIRECT EX,JD28,EEPROM 6.16.5
SNMPv2-MIB::sysName.0 = STRING:
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Hewlett-Packard hp LaserJet 3380
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Axis AXIS 5600
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: Axis AXIS 5600
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrDeviceID.3 = OID: SNMPv2-SMI::zeroDotZero
SNMPv2-SMI::enterprises.11.2.4.3.10.8.0 = STRING: "AXIS433AE8"
SNMPv2-SMI::enterprises.368.2.3.2.601.0 = INTEGER: 9100
SNMPv2-SMI::enterprises.368.2.3.2.602.0 = INTEGER: 9101
SNMPv2-SMI::enterprises.368.2.3.2.603.0 = INTEGER: 9102
SNMPv2-SMI::enterprises.368.2.3.10.901.0 = STRING: "AXIS433AE8"
AXIS OfficeBasic
SNMPv2-MIB::sysDescr.0 = STRING: AXIS OfficeBasic Parallel Network Print Server V6.43 Sep 4 2003
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: EPSON Stylus Photo 870
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
DLink DP-301P+
SNMPv2-MIB::sysDescr.0 = STRING: D-Link DP-301P+ Print Server
Genicom ML280
SNMPv2-MIB::sysDescr.0 = STRING: GENICOM microLaser 280
SNMPv2-MIB::sysName.0 = STRING: PRQ_004F75
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: MANUFACTURER:GENICOM;MODEL:microLaser 280;
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.3369.1.1.2.4
EPSON Type-B Network Card
SNMPv2-MIB::sysDescr.0 = STRING: EPSON Type-B 10Base-T/100Base-TX Print Server
SNMPv2-MIB::sysName.0 = STRING: StylusPro7600-BB87A8
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: EPSON Stylus Pro 7600
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.1248.1.2.1.22.69.109.117.108.97.116.101.83.116.121.108.117.115.32.80.114.111.32.55.54.48.48
SNMPv2-SMI::enterprises.11.2.3.9.1.1.7.0 = STRING: "MFG:EPSON;CMD:ESCPL2,BDC;MDL:Stylus Pro 7600;CLS:PRINTER;DES:EPSON Stylus Pro 7600;"
SNMPv2-SMI::enterprises.1248.1.2.2.1.1.1.1.1 = STRING: "MFG:EPSON;CMD:ESCPL2,BDC;MDL:Stylus Pro 7600;CLS:PRINTER;DES:EPSON Stylus Pro 7600;"
EPSON Wireless 802.11b Print Server
SNMPv2-MIB::sysDescr.0 = STRING: EPSON Wireless LAN Print Interface compatible with an HP JETDIRECT EX
SNMPv2-MIB::sysName.0 = STRING: EAI_0F550B
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING:
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
HP JetDirect EX3plus
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM D.04.03,JETDIRECT EX,JD26,EEPROM D.05.22
SNMPv2-MIB::sysName.0 = STRING: NPID1EC0F
HP LJ4000
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM G.05.34,JETDIRECT,JD30,EEPROM G.08.32
SNMPv2-MIB::sysName.0 = STRING:
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP LaserJet 4000 Series
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1.2.5
HP CLJ4550
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM L.20.07,JETDIRECT,JD84,EEPROM L.21.22,CIDATE 07/06/2001
SNMPv2-MIB::sysName.0 = STRING: NPI02FDE7
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP Color LaserJet 4550
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Hewlett-Packard Dynamic RAM Disk
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1.2.14
Lexmark C522
SNMPv2-MIB::sysDescr.0 = STRING: Lexmark C522 version NS.NP.N212 kernel 2.6.6 All-N-1
SNMPv2-MIB::sysName.0 = STRING: ET0004000D0CCA
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDeviceProcessor
HOST-RESOURCES-MIB::hrDeviceType.4 = OID: HOST-RESOURCES-TYPES::hrDeviceSerialPort
HOST-RESOURCES-MIB::hrDeviceType.5 = OID: HOST-RESOURCES-TYPES::hrDeviceNetwork
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Lexmark C522 9421TTV LS.FA.P129
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Nonvolatile RAM
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: IBM 750 Rev CXr
HOST-RESOURCES-MIB::hrDeviceDescr.4 = STRING: USB Interface
HOST-RESOURCES-MIB::hrDeviceDescr.5 = STRING: Network Interface
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrDeviceID.3 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrDeviceID.4 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrDeviceID.5 = OID: SNMPv2-SMI::enterprises.641.1
SNMPv2-SMI::enterprises.641.2.1.2.1.2.1 = STRING: "Lexmark C522"
SNMPv2-SMI::enterprises.641.2.1.2.1.3.1 = STRING: "MANUFACTURER:Lexmark International;COMMAND SET:;MODEL:Lexmark C522"
Linksys EPSX3
SNMPv2-MIB::sysDescr.0 = STRING: ETHERNET MULTI-ENVIRONMENT.ROM, JETDIRECT EX, EEPROM 6016
NetGear PS113
SNMPv2-MIB::sysDescr.0 = STRING: A SNMP proxy agent.
Okidata C7200
SNMPv2-MIB::sysDescr.0 = STRING: OkiLAN 6200e
SNMPv2-MIB::sysName.0 = STRING: OKI7009715
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolat
ileMemory
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: C7200
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: FLASH0
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.2001.1.1.1.1
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
SNMPv2-SMI::mib-2.43.14.1.1.3.1.1 = STRING: "IEEE 1284"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.2 = STRING: "EtherTalk Phase 2"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.3 = STRING: "LPD"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.4 = STRING: "Netware Rprinter"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.5 = STRING: "Netware Bindery or NDS Pserver"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.6 = STRING: "Raw TCP Port 9100"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.7 = STRING: "FTP"
SNMPv2-SMI::mib-2.43.14.1.1.3.1.8 = STRING: "DLC/LLC"
SNMPv2-SMI::enterprises.2001.1.1.1.1.1.3530.0 = STRING: "C7200"
Xerox N2025
SNMPv2-MIB::sysDescr.0 = STRING: Xerox DocuPrint N2025 Network Laser Printer - 2.12-02
SNMPv2-MIB::sysName.0 = STRING:
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceParallelPort
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDeviceNetwork
HOST-RESOURCES-MIB::hrDeviceType.6 = OID: HOST-RESOURCES-TYPES::hrDeviceProcessor
HOST-RESOURCES-MIB::hrDeviceType.7 = OID: HOST-RESOURCES-TYPES::hrDeviceOther
HOST-RESOURCES-MIB::hrDeviceType.9 = OID: HOST-RESOURCES-TYPES::hrDeviceVolatileMemory
HOST-RESOURCES-MIB::hrDeviceType.10 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Xerox DocuPrint N2025 Network Laser Printer - 2.12-02
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: IEEE 1284 port
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: Ethernet port
HOST-RESOURCES-MIB::hrDeviceDescr.6 = STRING: Motorola Power PC
HOST-RESOURCES-MIB::hrDeviceDescr.7 = STRING: USB Port
HOST-RESOURCES-MIB::hrDeviceDescr.9 = STRING: RAM Memory
HOST-RESOURCES-MIB::hrDeviceDescr.10 = STRING: ROM Memory
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.253.8.62.1.3.2.17.1
+240 -130
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,12 +15,14 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Send a file to the printer or server.
@@ -30,24 +32,22 @@
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <cups/http-private.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>
#if defined(WIN32) || defined(__EMX__)
#ifdef WIN32
# include <winsock.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
#endif /* WIN32 || __EMX__ */
#endif /* WIN32 */
/*
@@ -58,43 +58,70 @@
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024]; /* Resource info (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int port; /* Port number */
int fd; /* AppSocket */
int error; /* Error code (if any) */
struct sockaddr_in addr; /* Socket address */
struct hostent *hostaddr; /* Host address */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct timeval timeout; /* Timeout for select() */
fd_set input; /* Input set for select() */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (not used) */
*options, /* Pointer to options */
name[255], /* Name of option */
value[255], /* Value of option */
*ptr; /* Pointer into name or value */
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 device_fd; /* AppSocket */
int error; /* Error code (if any) */
http_addrlist_t *addrlist; /* Address list */
ssize_t tbytes; /* Total number of bytes written */
struct timeval timeout; /* Timeout 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 */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc == 1)
{
puts("network socket \"Unknown\" \"AppSocket/HP JetDirect\"");
return (0);
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
{
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
argv[0]);
return (1);
return (CUPS_BACKEND_FAILED);
}
/*
@@ -104,8 +131,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
fp = stdin;
copies = 1;
print_fd = 0;
copies = 1;
}
else
{
@@ -113,10 +140,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((fp = fopen(argv[6], "rb")) == NULL)
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
return (CUPS_BACKEND_FAILED);
}
copies = atoi(argv[4]);
@@ -126,153 +153,236 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the hostname and port number from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (port == 0)
port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */
/*
* Get options, if any...
*/
waiteof = 1;
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
/*
* Parse options...
*/
while (*options)
{
/*
* Get the name...
*/
for (ptr = name; *options && *options != '=';)
if (ptr < (name + sizeof(name) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
{
/*
* Get the value...
*/
options ++;
for (ptr = value; *options && *options != '+' && *options != '&';)
if (ptr < (value + sizeof(value) - 1))
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+' || *options == '&')
options ++;
}
else
value[0] = '\0';
/*
* Process the option...
*/
if (!strcasecmp(name, "waiteof"))
{
/*
* Set the wait-for-eof value...
*/
waiteof = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
}
}
/*
* Then try to connect to the remote host...
*/
if ((hostaddr = gethostbyname(hostname)) == NULL)
sprintf(portname, "%d", port);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
{
fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s",
hostname, strerror(errno));
return (1);
fprintf(stderr, "ERROR: Unable to locate printer \'%s\'!\n", hostname);
return (CUPS_BACKEND_STOP);
}
fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
hostname, port);
memset(&addr, 0, sizeof(addr));
memcpy(&(addr.sin_addr), hostaddr->h_addr, hostaddr->h_length);
addr.sin_family = hostaddr->h_addrtype;
addr.sin_port = htons(port);
fputs("STATE: +connecting-to-device\n", stderr);
while (copies > 0)
for (delay = 5;;)
{
for (;;)
if (!httpAddrConnect(addrlist, &device_fd))
{
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
error = errno;
device_fd = -1;
if (getenv("CLASS") != NULL)
{
perror("ERROR: Unable to create socket");
return (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.
*/
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);
return (CUPS_BACKEND_FAILED);
}
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
if (error == ECONNREFUSED || error == EHOSTDOWN ||
error == EHOSTUNREACH)
{
error = errno;
close(fd);
fd = -1;
fprintf(stderr,
"INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
hostname, delay);
sleep(delay);
if (error == ECONNREFUSED)
{
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in 30 seconds...\n",
hostname);
sleep(30);
}
else
{
perror("ERROR: Unable to connect to printer");
sleep(30);
}
if (delay < 30)
delay += 5;
}
else
break;
{
perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
sleep(30);
}
}
else
break;
}
/*
* 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...
*/
fputs("STATE: -connecting-to-device\n", stderr);
#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));
/*
* Print everything...
*/
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 != stdin)
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
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 = fread(buffer, 1, sizeof(buffer), fp)) > 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;
while (nbytes > 0)
{
if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
/*
* Check for possible data coming back from the printer...
*/
timeout.tv_sec = 0;
timeout.tv_sec = 90;
timeout.tv_usec = 0;
FD_ZERO(&input);
FD_SET(fd, &input);
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
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 */
{
/*
* Grab the data coming back and spit it out to stderr...
*/
if ((nbytes = recv(fd, buffer, sizeof(buffer), 0)) > 0)
fprintf(stderr, "INFO: Received %u bytes of back-channel data!\n",
nbytes);
if ((bc_bytes = read(device_fd, resource, sizeof(resource))) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
(int)bc_bytes);
cupsBackChannelWrite(resource, bc_bytes, 1.0);
}
else
break;
}
else if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
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 != stdin)
fclose(fp);
if (print_fd != 0)
close(print_fd);
return (0);
if (tbytes >= 0)
fputs("INFO: Ready to print.\n", stderr);
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
+96
Ver Arquivo
@@ -0,0 +1,96 @@
/*
* "$Id$"
*
* IEEE-1284 support functions test program 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.
*
* Contents:
*
*/
/*
* Include necessary headers.
*/
#include <cups/string.h>
#include <stdlib.h>
#include <errno.h>
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
#endif /* WIN32 */
#define DEBUG
#include "ieee1284.c"
/*
* 'main()' - Test the device-ID functions.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int i, /* Looping var */
fd; /* File descriptor */
char device_id[1024], /* 1284 device ID string */
make_model[1024], /* make-and-model string */
uri[1024]; /* URI string */
if (argc < 2)
{
puts("Usage: test1284 device-file [... device-file-N]");
exit(1);
}
for (i = 1; i < argc; i ++)
{
if ((fd = open(argv[i], O_RDWR)) < 0)
{
perror(argv[i]);
return (errno);
}
printf("%s:\n", argv[i]);
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);
printf(" uri=\"%s\"\n", uri);
close(fd);
}
return (0);
}
/*
* End of "$Id$".
*/
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+514
Ver Arquivo
@@ -0,0 +1,514 @@
/*
* "$Id$"
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 1997-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:
*
* print_device() - Print a file to a USB device.
* list_devices() - List all USB devices.
* open_device() - Open a USB device...
*/
/*
* Include necessary headers.
*/
#include "ieee1284.c"
#include <sys/select.h>
/*
* Local functions...
*/
int open_device(const char *uri, int *use_bc);
/*
* 'print_device()' - Print a file to a USB device.
*/
int /* O - Exit status */
print_device(const char *uri, /* I - Device URI */
const char *hostname, /* I - Hostname/manufacturer */
const char *resource, /* I - Resource/modelname */
const char *options, /* I - Device options/serial number */
int 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 use_bc; /* Use backchannel path? */
int device_fd; /* USB device */
size_t tbytes; /* Total number of bytes written */
struct termios opts; /* Parallel port options */
(void)argc;
(void)argv;
/*
* Open the USB port device...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
/*
* 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)
{
/*
* 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.
*/
fputs("INFO: Unable to open USB device, queuing on next printer in class...\n",
stderr);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
return (CUPS_BACKEND_FAILED);
}
if (errno == EBUSY)
{
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
errno == ENODEV)
{
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
fprintf(stderr, "ERROR: Unable to open USB device \"%s\": %s\n",
uri, strerror(errno));
return (CUPS_BACKEND_FAILED);
}
}
}
while (device_fd < 0);
fputs("STATE: -connecting-to-device\n", stderr);
/*
* Set any options provided...
*/
tcgetattr(device_fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(device_fd, TCSANOW, &opts);
/*
* Finally, send the print file...
*/
tbytes = 0;
while (copies > 0 && tbytes >= 0)
{
copies --;
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, use_bc);
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(device_fd);
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int fd; /* File descriptor */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* First figure out which USB printer filename to use...
*/
if (!access("/dev/usblp0", 0))
strcpy(format, "/dev/usblp%d");
else if (!access("/dev/usb/usblp0", 0))
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then open each USB device...
*/
for (i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
if (!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);
close(fd);
}
}
#elif defined(__sgi)
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* Open each USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
{
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);
close(fd);
}
}
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
int i; /* Looping var */
char device[255]; /* Device filename */
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/ulpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
sprintf(device, "/dev/unlpt%d", i);
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d (no reset)\"\n", device, i + 1);
}
#endif
}
/*
* 'open_device()' - Open a USB device...
*/
int /* O - File descriptor or -1 on error */
open_device(const char *uri, /* I - Device URI */
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
* number and/or make/model.
*/
if (!strncmp(uri, "usb:/dev/", 9))
#ifdef __linux
{
/*
* Do not allow direct devices anymore...
*/
errno = ENODEV;
return (-1);
}
else if (!strncmp(uri, "usb://", 6))
{
/*
* For Linux, try looking up the device serial number or model...
*/
int i; /* Looping var */
int busy; /* Are any ports busy? */
char format[255], /* Format for device filename */
device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
/*
* First figure out which USB printer filename to use...
*/
if (!access("/dev/usblp0", 0))
strcpy(format, "/dev/usblp%d");
else if (!access("/dev/usb/usblp0", 0))
strcpy(format, "/dev/usb/usblp%d");
else
strcpy(format, "/dev/usb/lp%d");
/*
* Then find the correct USB device...
*/
do
{
for (busy = 0, i = 0; i < 16; i ++)
{
sprintf(device, format, i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri));
}
else
{
/*
* If the open failed because it was busy, flag it so we retry
* as needed...
*/
if (errno == EBUSY)
busy = 1;
device_uri[0] = '\0';
}
if (!strcmp(uri, device_uri))
{
/*
* Yes, return this file descriptor...
*/
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", device);
return (fd);
}
/*
* This wasn't the one...
*/
if (fd >= 0)
close(fd);
}
/*
* If we get here and at least one of the printer ports showed up
* as "busy", then sleep for a bit and retry...
*/
if (busy)
{
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
stderr);
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
{
/*
* Do not allow direct devices anymore...
*/
errno = ENODEV;
return (-1);
}
else if (!strncmp(uri, "usb://", 6))
{
/*
* For Solaris, try looking up the device serial number or model...
*/
int i; /* Looping var */
int busy; /* Are any ports busy? */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
/*
* Find the correct USB device...
*/
do
{
for (i = 0, busy = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
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
{
/*
* If the open failed because it was busy, flag it so we retry
* as needed...
*/
if (errno == EBUSY)
busy = 1;
device_uri[0] = '\0';
}
if (!strcmp(uri, device_uri))
{
/*
* Yes, return this file descriptor...
*/
fputs("DEBUG: Setting use_bc to 0!\n", stderr);
*use_bc = 0;
return (fd);
}
/*
* This wasn't the one...
*/
if (fd >= 0)
close(fd);
}
/*
* If we get here and at least one of the printer ports showed up
* as "busy", then sleep for a bit and retry...
*/
if (busy)
{
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
stderr);
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#else
{
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
{
errno = ENODEV;
return (-1);
}
}
/*
* End of "$Id$".
*/
+161 -257
Ver Arquivo
@@ -3,7 +3,7 @@
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,22 +15,31 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* list_devices() - List all available USB devices to stdout.
* print_device() - Print a file to a USB device.
* main() - Send a file to the specified USB port.
* list_devices() - List all USB devices.
*/
/*
* Include necessary headers.
*/
#ifdef __APPLE__
/* A header order dependency requires this be first */
# include <ApplicationServices/ApplicationServices.h>
#endif /* __APPLE__ */
#include <cups/backend.h>
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
@@ -38,13 +47,13 @@
#include <cups/string.h>
#include <signal.h>
#if defined(WIN32) || defined(__EMX__)
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
#endif /* WIN32 || __EMX__ */
#endif /* WIN32 */
/*
@@ -52,6 +61,77 @@
*/
void list_devices(void);
int print_device(const char *uri, const char *hostname,
const char *resource, const char *options,
int print_fd, int copies, int argc, char *argv[]);
/*
* Include the vendor-specific USB implementation...
*/
#ifdef __APPLE__
# include "usb-darwin.c"
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# include "usb-unix.c"
#else
/*
* Use dummy functions that do nothing on unsupported platforms...
* These can be used as templates for implementing USB printing on new
* platforms...
*/
/*
* 'list_devices()' - List all available USB devices to stdout.
*/
void
list_devices(void)
{
/*
* Don't have any devices to list... Use output of the form:
*
* direct usb:/make/model?serial=foo "Make Model" "USB Printer"
*
* Note that "Hewlett Packard" or any other variation MUST be mapped to
* "HP" for compatibility with the PPD and ICC specs.
*/
}
/*
* 'print_device()' - Print a file to a USB device.
*/
int /* O - Exit status */
print_device(const char *uri, /* I - Device URI */
const char *hostname, /* I - Hostname/manufacturer */
const char *resource, /* I - Resource/modelname */
const char *options, /* I - Device options/serial number */
int 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 */
{
/*
* Can't print, so just reference the arguments to eliminate compiler
* warnings and return and exit status of 1. Normally you would use the
* arguments to send a file to the printer and return 0 if everything
* worked OK and non-zero if there was an error.
*/
(void)uri;
(void)hostname;
(void)resource;
(void)options;
(void)print_fd;
(void)copies;
(void)argc;
(void)argv;
return (CUPS_BACKEND_FAILED);
}
#endif /* __APPLE__ */
/*
@@ -62,71 +142,74 @@ void list_devices(void);
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
int port; /* Port number (not used) */
FILE *fp; /* Print file */
int copies; /* Number of copies to print */
int fd; /* Parallel device */
int wbytes; /* Number of bytes written */
size_t nbytes, /* Number of bytes read */
tbytes; /* Total number of bytes written */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
int print_fd; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
int port; /* Port number (not used) */
const char *uri; /* Device URI */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (device and options) */
*options; /* Pointer to options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: USB job-id user title copies options [file]\n", stderr);
return (1);
}
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
*/
if (argc == 6)
{
fp = stdin;
copies = 1;
}
else
{
/*
* Try to open the print file...
*/
if ((fp = fopen(argv[6], "rb")) == NULL)
{
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
fputs("Usage: usb job-id user title copies options [file]\n", stderr);
return (CUPS_BACKEND_FAILED);
}
/*
* Extract the device name and options from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
uri = cupsBackendDeviceURI(argv);
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri,
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource)) < HTTP_URI_OK)
{
fputs("ERROR: No device URI found in argv[0] or in DEVICE_URI environment variable!\n", stderr);
return (1);
}
/*
* See if there are any options...
@@ -143,225 +226,46 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
/*
* Open the USB port device...
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
*/
do
if (argc == 6)
{
if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
perror("ERROR: Unable to open USB port device file");
return (1);
}
}
print_fd = 0;
copies = 1;
}
while (fd < 0);
else
{
/*
* Try to open the print file...
*/
/*
* Set any options provided...
*/
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
fprintf(stderr, "ERROR: unable to open print file %s - %s\n",
argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page...
*/
#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 */
copies = atoi(argv[4]);
}
/*
* Finally, send the print file...
*/
while (copies > 0)
{
copies --;
if (fp != stdin)
{
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
}
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
bufptr = buffer;
while (nbytes > 0)
{
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
wbytes = write(fd, bufptr, nbytes);
if (wbytes < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
nbytes -= wbytes;
bufptr += wbytes;
}
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
}
}
status = print_device(uri, hostname, resource, options, print_fd, copies,
argc, argv);
/*
* Close the socket connection and input file and return...
* Close the input file and return...
*/
close(fd);
if (fp != stdin)
fclose(fp);
if (print_fd != 0)
close(print_fd);
return (0);
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
FILE *probe; /* /proc/parport/n/autoprobe file */
char line[1024], /* Line from file */
*delim, /* Delimiter in file */
make[IPP_MAX_NAME], /* Make from file */
model[IPP_MAX_NAME]; /* Model from file */
if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL)
{
i = 0;
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
while (fgets(line, sizeof(line), probe) != NULL)
{
/*
* Strip trailing newline.
*/
if ((delim = strrchr(line, '\n')) != NULL)
*delim = '\0';
/*
* See if it is a printer device ("P: ...")
*/
if (strncmp(line, "S:", 2) == 0)
{
/*
* String attribute...
*/
if (strncmp(line, "S: Manufacturer=", 17) == 0)
{
strncpy(make, line + 17, sizeof(make) - 1);
if (strcmp(make, "Hewlett-Packard") == 0)
strcpy(make, "HP");
}
else if (strncmp(line, "S: Product=", 12) == 0)
strncpy(model, line + 12, sizeof(model) - 1);
}
else if (strncmp(line, "I:", 2) == 0 &&
strstr(line, "Driver=printer") != NULL &&
make[0] && model[0])
{
/*
* We were processing a printer device; send the info out...
*/
printf("direct usb:/dev/usb/lp%d \"%s %s\" \"USB Printer #%d\"\n",
i, make, model, i + 1);
i ++;
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
}
}
fclose(probe);
}
else
{
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/lp%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
sprintf(device, "/dev/usblp%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
}
}
}
#elif defined(__sgi)
#elif defined(__sun)
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
for (i = 0; i < 3; i ++)
{
sprintf(device, "/dev/ulpt%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct usb:%s \"Unknown\" \"USB Port #%d\"\n", device, i + 1);
}
}
#endif
return (status);
}
+14
Ver Arquivo
@@ -0,0 +1,14 @@
# DO NOT DELETE
lpc.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lpc.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
lpc.o: ../cups/i18n.h ../cups/debug.h ../cups/string.h ../config.h
lpq.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
lpq.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
lpq.o: ../cups/file.h ../cups/language.h ../cups/i18n.h ../cups/debug.h
lpr.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
lpr.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
lpr.o: ../cups/file.h ../cups/language.h ../cups/i18n.h
lprm.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
lprm.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
lprm.o: ../cups/i18n.h ../cups/string.h ../config.h
+36 -16
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 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
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -43,19 +43,40 @@ clean:
$(RM) $(OBJS) $(TARGETS)
#
# Update dependencies (without system header dependencies...)
#
depend:
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
#
# Install all targets...
#
install:
-$(MKDIR) $(BINDIR)
$(CHMOD) ugo+rx $(BINDIR)
$(INSTALL_BIN) lpq lpr lprm $(BINDIR)
-$(MKDIR) $(SBINDIR)
$(CHMOD) ugo+rx $(SBINDIR)
install: all
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_BIN) lpq $(BINDIR)
$(INSTALL_BIN) lpr $(BINDIR)
$(INSTALL_BIN) lprm $(BINDIR)
$(INSTALL_DIR) -m 755 $(SBINDIR)
$(INSTALL_BIN) lpc $(SBINDIR)
#
# Uninstall all targets...
#
uninstall:
$(RM) $(BINDIR)/lpq
$(RM) $(BINDIR)/lpr
$(RM) $(BINDIR)/lprm
$(RM) $(SBINDIR)/lpc
-$(RMDIR) $(SBINDIR)
-$(RMDIR) $(BINDIR)
#
# lpc
#
@@ -64,8 +85,6 @@ lpc: lpc.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
lpc.o: ../cups/cups.h ../Makedefs
#
# lpq
@@ -75,8 +94,6 @@ lpq: lpq.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
lpq.o: ../cups/cups.h ../Makedefs
#
# lpr
@@ -86,8 +103,6 @@ lpr: lpr.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
lpr.o: ../cups/cups.h ../Makedefs
#
# lprm
@@ -97,7 +112,12 @@ lprm: lprm.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
lprm.o: ../cups/cups.h ../Makedefs
#
# Dependencies...
#
include Dependencies
#
+187 -129
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -36,20 +36,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/i18n.h>
#include <cups/debug.h>
#include <cups/string.h>
/*
* Local functions...
*/
static int compare_strings(char *, char *, int);
static void do_command(http_t *, char *, char *);
static void show_help(char *);
static void show_status(http_t *, char *);
static int compare_strings(const char *, const char *, int);
static void do_command(http_t *, const char *, const char *);
static void show_help(const char *);
static void show_status(http_t *, const char *);
/*
@@ -57,19 +57,21 @@ static void show_status(http_t *, char *);
*/
int
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
http_t *http; /* Connection to server */
char line[1024], /* Input line from user */
*params; /* Pointer to parameters */
http_t *http; /* Connection to server */
char line[1024], /* Input line from user */
*params; /* Pointer to parameters */
_cupsSetLocale();
/*
* Connect to the scheduler...
*/
http = httpConnect(cupsServer(), ippPort());
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
if (argc > 1)
{
@@ -85,39 +87,59 @@ main(int argc, /* I - Number of command-line arguments */
* Do the command prompt thing...
*/
printf("lpc> ");
_cupsLangPuts(stdout, _("lpc> "));
while (fgets(line, sizeof(line), stdin) != NULL)
{
/*
* Strip the trailing newline...
* Strip trailing whitespace...
*/
line[strlen(line) - 1] = '\0';
for (params = line + strlen(line) - 1; params >= line;)
if (!isspace(*params & 255))
break;
else
*params-- = '\0';
/*
* Strip leading whitespace...
*/
for (params = line; isspace(*params & 255); params ++);
if (params > line)
_cups_strcpy(line, params);
if (!line[0])
{
/*
* Nothing left, just show a prompt...
*/
_cupsLangPuts(stdout, _("lpc> "));
continue;
}
/*
* Find any options in the string...
*/
while (isspace(line[0]))
strcpy(line, line + 1);
for (params = line; *params != '\0'; params ++)
if (isspace(*params))
if (isspace(*params & 255))
break;
/*
* Remove whitespace between the command and parameters...
*/
while (isspace(*params))
while (isspace(*params & 255))
*params++ = '\0';
/*
* The "quit" and "exit" commands exit; otherwise, process as needed...
*/
if (compare_strings(line, "quit", 1) == 0 ||
compare_strings(line, "exit", 2) == 0)
if (!compare_strings(line, "quit", 1) ||
!compare_strings(line, "exit", 2))
break;
if (*params == '\0')
@@ -129,7 +151,7 @@ main(int argc, /* I - Number of command-line arguments */
* Put another prompt out to the user...
*/
printf("lpc> ");
_cupsLangPuts(stdout, _("lpc> "));
}
}
@@ -147,12 +169,12 @@ main(int argc, /* I - Number of command-line arguments */
* 'compare_strings()' - Compare two command-line strings.
*/
static int /* O - -1 or 1 = no match, 0 = match */
compare_strings(char *s, /* I - Command-line string */
char *t, /* I - Option string */
int tmin) /* I - Minimum number of unique chars in option */
static int /* O - -1 or 1 = no match, 0 = match */
compare_strings(const char *s, /* I - Command-line string */
const char *t, /* I - Option string */
int tmin) /* I - Minimum number of unique chars in option */
{
int slen; /* Length of command-line string */
int slen; /* Length of command-line string */
slen = strlen(s);
@@ -168,17 +190,18 @@ compare_strings(char *s, /* I - Command-line string */
*/
static void
do_command(http_t *http, /* I - HTTP connection to server */
char *command, /* I - Command string */
char *params) /* I - Parameters for command */
do_command(http_t *http, /* I - HTTP connection to server */
const char *command, /* I - Command string */
const char *params) /* I - Parameters for command */
{
if (compare_strings(command, "status", 4) == 0)
if (!compare_strings(command, "status", 4))
show_status(http, params);
else if (compare_strings(command, "help", 1) == 0 ||
strcmp(command, "?") == 0)
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
show_help(params);
else
puts("?Invalid command");
_cupsLangPrintf(stdout,
_("%s is not implemented by the CUPS version of lpc.\n"),
command);
}
@@ -187,21 +210,21 @@ do_command(http_t *http, /* I - HTTP connection to server */
*/
static void
show_help(char *command) /* I - Command to describe or NULL */
show_help(const char *command) /* I - Command to describe or NULL */
{
if (command == NULL)
if (!command)
{
puts("Commands may be abbreviated. Commands are:");
puts("");
puts("exit help quit status ?");
_cupsLangPrintf(stdout,
_("Commands may be abbreviated. Commands are:\n"
"\n"
"exit help quit status ?\n"));
}
else if (compare_strings(command, "help", 1) == 0 ||
strcmp(command, "?") == 0)
puts("help\t\tget help on commands");
else if (compare_strings(command, "status", 4) == 0)
puts("status\t\tshow status of daemon and queue");
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
_cupsLangPrintf(stdout, _("help\t\tget help on commands\n"));
else if (!compare_strings(command, "status", 4))
_cupsLangPrintf(stdout, _("status\t\tshow status of daemon and queue\n"));
else
puts("?Invalid help command unknown");
_cupsLangPrintf(stdout, _("?Invalid help command unknown\n"));
}
@@ -210,27 +233,36 @@ show_help(char *command) /* I - Command to describe or NULL */
*/
static void
show_status(http_t *http, /* I - HTTP connection to server */
char *dests) /* I - Destinations */
show_status(http_t *http, /* I - HTTP connection to server */
const char *dests) /* I - Destinations */
{
ipp_t *request, /* IPP Request */
*response, /* IPP Response */
*jobs; /* IPP Get Jobs response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device; /* Device URI */
ipp_pstate_t pstate; /* Printer state */
int accepting; /* Is printer accepting jobs? */
int jobcount; /* Count of current jobs */
char *dptr, /* Pointer into destination list */
*ptr; /* Pointer into printer name */
int match; /* Non-zero if this job matches */
ipp_t *request, /* IPP Request */
*response, /* IPP Response */
*jobs; /* IPP Get Jobs response */
ipp_attribute_t *attr, /* Current attribute */
*jattr; /* Current job attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device, /* Device URI */
*delimiter; /* Char search result */
ipp_pstate_t pstate; /* Printer state */
int accepting; /* Is printer accepting jobs? */
int jobcount; /* Count of current jobs */
const char *dptr, /* Pointer into destination list */
*ptr; /* Pointer into printer name */
int match; /* Non-zero if this job matches */
char printer_uri[HTTP_MAX_URI];
/* Printer URI */
/* Printer URI */
static const char *requested[] = /* Requested attributes */
{
"printer-name",
"device-uri",
"printer-state",
"printer-is-accepting-jobs"
};
DEBUG_printf(("show_status(%08x, %08x)\n", http, dests));
DEBUG_printf(("show_status(http=%p, dests=\"%s\")\n", http, dests));
if (http == NULL)
return;
@@ -250,17 +282,21 @@ show_status(http_t *http, /* I - HTTP connection to server */
language = cupsLangDefault();
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(requested) / sizeof(requested[0]),
NULL, requested);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/printers/")) != NULL)
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
DEBUG_puts("show_status: request succeeded...");
@@ -293,19 +329,19 @@ show_status(http_t *http, /* I - HTTP connection to server */
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
if (strcmp(attr->name, "printer-name") == 0 &&
if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
printer = attr->values[0].string.text;
if (strcmp(attr->name, "device-uri") == 0 &&
if (!strcmp(attr->name, "device-uri") &&
attr->value_tag == IPP_TAG_URI)
device = attr->values[0].string.text;
if (strcmp(attr->name, "printer-state") == 0 &&
if (!strcmp(attr->name, "printer-state") &&
attr->value_tag == IPP_TAG_ENUM)
pstate = (ipp_pstate_t)attr->values[0].integer;
if (strcmp(attr->name, "printer-is-accepting-jobs") == 0 &&
if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
attr->value_tag == IPP_TAG_BOOLEAN)
accepting = attr->values[0].boolean;
@@ -324,6 +360,13 @@ show_status(http_t *http, /* I - HTTP connection to server */
continue;
}
/*
* A single 'all' printer name is special, meaning all printers.
*/
if (dests != NULL && !strcmp(dests, "all"))
dests = NULL;
/*
* See if this is a printer we're interested in...
*/
@@ -338,7 +381,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip leading whitespace and commas...
*/
while (isspace(*dptr) || *dptr == ',')
while (isspace(*dptr & 255) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -352,7 +395,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
ptr ++, dptr ++);
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr)))
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr & 255)))
{
match = 1;
break;
@@ -362,9 +405,9 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip trailing junk...
*/
while (!isspace(*dptr) && *dptr != '\0')
while (!isspace(*dptr & 255) && *dptr != '\0')
dptr ++;
while (isspace(*dptr) || *dptr == ',')
while (isspace(*dptr & 255) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -379,77 +422,92 @@ show_status(http_t *http, /* I - HTTP connection to server */
if (match)
{
/*
* If the printer state is "IPP_PRINTER_PROCESSING", then grab the
* current job for the printer.
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* limit
*/
if (pstate == IPP_PRINTER_PROCESSING)
request = ippNew();
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL,
cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language->language);
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
"ipp", NULL, "localhost", 631, "/printers/%s",
printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "job-id");
if ((jobs = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* limit
* Grab the number of jobs for the printer.
*/
request = ippNew();
for (jattr = jobs->attrs; jattr != NULL; jattr = jattr->next)
if (jattr->name && !strcmp(jattr->name, "job-id"))
jobcount ++;
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL,
cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL,
language->language);
snprintf(printer_uri, sizeof(printer_uri),
"ipp://localhost/printers/%s", printer);
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer_uri);
if ((jobs = cupsDoRequest(http, request, "/jobs/")) != NULL)
{
for (attr = jobs->attrs; attr != NULL; attr = attr->next)
if (strcmp(attr->name, "job-id") == 0)
jobcount ++;
ippDelete(jobs);
}
}
ippDelete(jobs);
}
/*
* Display it...
*/
printf("%s:\n", printer);
if (strncmp(device, "file:", 5) == 0)
printf("\tprinter is on device \'%s\' speed -1\n", device + 5);
if (!strncmp(device, "file:", 5))
_cupsLangPrintf(stdout,
_("\tprinter is on device \'%s\' speed -1\n"),
device + 5);
else
{
/*
* Just show the method...
* Just show the scheme...
*/
*strchr(device, ':') = '\0';
printf("\tprinter is on device \'%s\' speed -1\n", device);
if ((delimiter = strchr(device, ':')) != NULL )
{
*delimiter = '\0';
_cupsLangPrintf(stdout,
_("\tprinter is on device \'%s\' speed -1\n"),
device);
}
}
printf("\tqueuing is %sabled\n", accepting ? "en" : "dis");
printf("\tprinting is %sabled\n",
pstate == IPP_PRINTER_STOPPED ? "dis" : "en");
if (jobcount == 0)
puts("\tno entries");
if (accepting)
_cupsLangPuts(stdout, _("\tqueuing is enabled\n"));
else
printf("\t%d entries\n", jobcount);
puts("\tdaemon present");
_cupsLangPuts(stdout, _("\tqueuing is disabled\n"));
if (pstate != IPP_PRINTER_STOPPED)
_cupsLangPuts(stdout, _("\tprinting is enabled\n"));
else
_cupsLangPuts(stdout, _("\tprinting is disabled\n"));
if (jobcount == 0)
_cupsLangPuts(stdout, _("\tno entries\n"));
else
_cupsLangPrintf(stdout, _("\t%d entries\n"), jobcount);
_cupsLangPuts(stdout, _("\tdaemon present\n"));
}
if (attr == NULL)
+299 -120
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -26,6 +26,7 @@
* main() - Parse options and commands.
* show_jobs() - Show jobs.
* show_printer() - Show printer status.
* usage() - Show program usage.
*/
/*
@@ -38,9 +39,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cups/string.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/i18n.h>
#include <cups/debug.h>
@@ -48,9 +49,11 @@
* Local functions...
*/
static int show_jobs(http_t *, const char *, const char *, const int,
const int);
static void show_printer(http_t *, const char *);
static http_t *connect_server(const char *, http_t *);
static int show_jobs(const char *, http_t *, const char *,
const char *, const int, const int);
static void show_printer(const char *, http_t *, const char *);
static void usage(void);
/*
@@ -58,32 +61,38 @@ static void show_printer(http_t *, const char *);
*/
int
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
int i; /* Looping var */
http_t *http; /* Connection to server */
const char *dest, /* Desired printer */
*user; /* Desired user */
int id, /* Desired job ID */
interval, /* Reporting interval */
longstatus; /* Show file details */
int i; /* Looping var */
http_t *http; /* Connection to server */
const char *dest, /* Desired printer */
*user, /* Desired user */
*val; /* Environment variable name */
char *instance; /* Printer instance */
int id, /* Desired job ID */
all, /* All printers */
interval, /* Reporting interval */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
/*
* Connect to the scheduler...
*/
http = httpConnect(cupsServer(), ippPort());
_cupsSetLocale();
/*
* Check for command-line options...
*/
dest = cupsGetDefault();
http = NULL;
dest = NULL;
user = NULL;
id = 0;
interval = 0;
longstatus = 0;
all = 0;
num_dests = 0;
dests = NULL;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '+')
@@ -92,14 +101,107 @@ main(int argc, /* I - Number of command-line arguments */
{
switch (argv[i][1])
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
if (http)
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
argv[0]);
#endif /* HAVE_SSL */
break;
case 'U' : /* Username */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
}
cupsSetUser(argv[i]);
}
break;
case 'P' : /* Printer */
if (argv[i][2])
dest = argv[i] + 2;
else
{
i ++;
if (i >= argc)
{
httpClose(http);
cupsFreeDests(num_dests, dests);
usage();
}
dest = argv[i];
}
if ((instance = strchr(dest, '/')) != NULL)
*instance++ = '\0';
http = connect_server(argv[0], http);
if (num_dests == 0)
num_dests = cupsGetDests2(http, &dests);
if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
{
if (instance)
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s/%s\"!\n"),
argv[0], dest, instance);
else
_cupsLangPrintf(stderr,
_("%s: Unknown destination \"%s\"!\n"),
argv[0], dest);
return (1);
}
break;
case 'a' : /* All printers */
all = 1;
break;
case 'h' : /* Connect to host */
if (http)
{
httpClose(http);
http = NULL;
}
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
"\'-h\' option!\n"),
argv[0]);
return (1);
}
else
cupsSetServer(argv[i]);
}
break;
case 'l' : /* Long status */
@@ -107,15 +209,61 @@ main(int argc, /* I - Number of command-line arguments */
break;
default :
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
return (1);
httpClose(http);
cupsFreeDests(num_dests, dests);
usage();
break;
}
}
else if (isdigit(argv[i][0]))
else if (isdigit(argv[i][0] & 255))
id = atoi(argv[i]);
else
user = argv[i];
http = connect_server(argv[0], http);
if (dest == NULL && !all)
{
if (num_dests == 0)
num_dests = cupsGetDests2(http, &dests);
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
if (dest == NULL)
{
val = NULL;
if ((dest = getenv("LPDEST")) == NULL)
{
if ((dest = getenv("PRINTER")) != NULL)
{
if (!strcmp(dest, "lp"))
dest = NULL;
else
val = "PRINTER";
}
}
else
val = "LPDEST";
if (dest && !cupsGetDest(dest, NULL, num_dests, dests))
_cupsLangPrintf(stderr,
_("%s: error - %s environment variable names "
"non-existent destination \"%s\"!\n"),
argv[0], val, dest);
else
_cupsLangPrintf(stderr,
_("%s: error - no default destination available.\n"),
argv[0]);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
}
}
/*
* Show the status in a loop...
*/
@@ -123,9 +271,9 @@ main(int argc, /* I - Number of command-line arguments */
for (;;)
{
if (dest)
show_printer(http, dest);
show_printer(argv[0], http, dest);
i = show_jobs(http, dest, user, id, longstatus);
i = show_jobs(argv[0], http, dest, user, id, longstatus);
if (i && interval)
{
@@ -140,43 +288,68 @@ main(int argc, /* I - Number of command-line arguments */
* Close the connection to the server and return...
*/
cupsFreeDests(num_dests, dests);
httpClose(http);
return (0);
}
/*
* 'connect_server()' - Connect to the server as necessary...
*/
static http_t * /* O - New HTTP connection */
connect_server(const char *command, /* I - Command name */
http_t *http) /* I - Current HTTP connection */
{
if (!http)
{
http = httpConnectEncrypt(cupsServer(), ippPort(),
cupsEncryption());
if (http == NULL)
{
_cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command);
exit(1);
}
}
return (http);
}
/*
* 'show_jobs()' - Show jobs.
*/
static int /* O - Number of jobs in queue */
show_jobs(http_t *http, /* I - HTTP connection to server */
const char *dest, /* I - Destination */
const char *user, /* I - User */
const int id, /* I - Job ID */
const int longstatus)/* I - 1 if long report desired */
static int /* O - Number of jobs in queue */
show_jobs(const char *command, /* I - Command name */
http_t *http, /* I - HTTP connection to server */
const char *dest, /* I - Destination */
const char *user, /* I - User */
const int id, /* I - Job ID */
const int longstatus) /* I - 1 if long report desired */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
const char *jobdest, /* Pointer into job-printer-uri */
*jobuser, /* Pointer to job-originating-user-name */
*jobname; /* Pointer to job-name */
ipp_jstate_t jobstate; /* job-state */
int jobid, /* job-id */
jobsize, /* job-k-octets */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
const char *jobdest, /* Pointer into job-printer-uri */
*jobuser, /* Pointer to job-originating-user-name */
*jobname; /* Pointer to job-name */
ipp_jstate_t jobstate; /* job-state */
int jobid, /* job-id */
jobsize, /* job-k-octets */
#ifdef __osf__
jobpriority, /* job-priority */
jobpriority, /* job-priority */
#endif /* __osf__ */
jobcount, /* Number of jobs */
jobcopies, /* Number of copies */
rank; /* Rank of job */
char resource[1024]; /* Resource string */
char rankstr[255]; /* Rank string */
char namestr[1024]; /* Job name string */
static const char *ranks[10] =/* Ranking strings */
jobcount, /* Number of jobs */
jobcopies, /* Number of copies */
rank; /* Rank of job */
char resource[1024]; /* Resource string */
char rankstr[255]; /* Rank string */
char namestr[1024]; /* Job name string */
static const char *ranks[10] = /* Ranking strings */
{
"th",
"st",
@@ -206,18 +379,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
* job-uri or printer-uri
*/
request = ippNew();
request->request.op.operation_id = id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
request->request.op.request_id = 1;
language = cupsLangDefault();
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
if (dest == NULL)
{
@@ -231,7 +393,8 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
}
else
{
snprintf(resource, sizeof(resource), "ipp://localhost/printers/%s", dest);
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
NULL, "localhost", 0, "/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, resource);
@@ -254,8 +417,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
fprintf(stderr, "lpq: get-jobs failed: %s\n",
ippErrorString(response->request.status.status_code));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
ippDelete(response);
return (0);
}
@@ -295,38 +457,38 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
{
if (strcmp(attr->name, "job-id") == 0 &&
if (!strcmp(attr->name, "job-id") &&
attr->value_tag == IPP_TAG_INTEGER)
jobid = attr->values[0].integer;
if (strcmp(attr->name, "job-k-octets") == 0 &&
if (!strcmp(attr->name, "job-k-octets") &&
attr->value_tag == IPP_TAG_INTEGER)
jobsize = attr->values[0].integer * 1024;
jobsize = attr->values[0].integer;
#ifdef __osf__
if (strcmp(attr->name, "job-priority") == 0 &&
if (!strcmp(attr->name, "job-priority") &&
attr->value_tag == IPP_TAG_INTEGER)
jobpriority = attr->values[0].integer;
#endif /* __osf__ */
if (strcmp(attr->name, "job-state") == 0 &&
if (!strcmp(attr->name, "job-state") &&
attr->value_tag == IPP_TAG_ENUM)
jobstate = (ipp_jstate_t)attr->values[0].integer;
if (strcmp(attr->name, "job-printer-uri") == 0 &&
if (!strcmp(attr->name, "job-printer-uri") &&
attr->value_tag == IPP_TAG_URI)
if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL)
jobdest ++;
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
if (!strcmp(attr->name, "job-originating-user-name") &&
attr->value_tag == IPP_TAG_NAME)
jobuser = attr->values[0].string.text;
if (strcmp(attr->name, "job-name") == 0 &&
if (!strcmp(attr->name, "job-name") &&
attr->value_tag == IPP_TAG_NAME)
jobname = attr->values[0].string.text;
if (strcmp(attr->name, "copies") == 0 &&
if (!strcmp(attr->name, "copies") &&
attr->value_tag == IPP_TAG_INTEGER)
jobcopies = attr->values[0].integer;
@@ -347,9 +509,13 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
if (!longstatus && jobcount == 0)
#ifdef __osf__
puts("Rank Owner Pri Job Files Total Size");
_cupsLangPuts(stdout,
_("Rank Owner Pri Job Files"
" Total Size\n"));
#else
puts("Rank Owner Job Files Total Size");
_cupsLangPuts(stdout,
_("Rank Owner Job File(s)"
" Total Size\n"));
#endif /* __osf__ */
jobcount ++;
@@ -362,33 +528,44 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
strcpy(rankstr, "active");
else
{
sprintf(rankstr, "%d%s", rank, ranks[rank % 10]);
/*
* Make the rank show the "correct" suffix for each number
* (11-13 are the only special cases, for English anyways...)
*/
if ((rank % 100) >= 11 && (rank % 100) <= 13)
snprintf(rankstr, sizeof(rankstr), "%dth", rank);
else
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
rank ++;
}
if (longstatus)
{
puts("");
_cupsLangPuts(stdout, "\n");
if (jobcopies > 1)
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
jobname);
else
{
strncpy(namestr, jobname, sizeof(namestr) - 1);
namestr[sizeof(namestr) - 1] = '\0';
}
strlcpy(namestr, jobname, sizeof(namestr));
printf("%s: %-31s [job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-31.31s %d bytes\n", namestr, jobsize);
_cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]\n"),
jobuser, rankstr, jobid);
_cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes\n"),
namestr, 1024.0 * jobsize);
}
else
#ifdef __osf__
printf("%-6s %-10.10s %-4d %-10d %-27.27s %d bytes\n", rankstr, jobuser,
jobpriority, jobid, jobname, jobsize);
_cupsLangPrintf(stdout,
_("%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"),
rankstr, jobuser, jobpriority, jobid, jobname,
1024.0 * jobsize);
#else
printf("%-6s %-10.10s %-15d %-27.27s %d bytes\n", rankstr, jobuser,
jobid, jobname, jobsize);
_cupsLangPrintf(stdout,
_("%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"),
rankstr, jobuser, jobid, jobname, 1024.0 * jobsize);
#endif /* __osf */
if (attr == NULL)
@@ -399,12 +576,12 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
}
else
{
fprintf(stderr, "lpq: get-jobs failed: %s\n", ippErrorString(cupsLastError()));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
return (0);
}
if (jobcount == 0)
puts("no entries");
_cupsLangPuts(stdout, _("no entries\n"));
return (jobcount);
}
@@ -415,16 +592,15 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
*/
static void
show_printer(http_t *http, /* I - HTTP connection to server */
const char *dest) /* I - Destination */
show_printer(const char *command, /* I - Command name */
http_t *http, /* I - HTTP connection to server */
const char *dest) /* I - Destination */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
ipp_pstate_t state; /* Printer state */
char uri[HTTP_MAX_URI];
/* Printer URI */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
ipp_pstate_t state; /* Printer state */
char uri[HTTP_MAX_URI]; /* Printer URI */
if (http == NULL)
@@ -439,20 +615,10 @@ show_printer(http_t *http, /* I - HTTP connection to server */
* printer-uri
*/
request = ippNew();
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
sprintf(uri, "ipp://localhost/printers/%s", dest);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
@@ -464,8 +630,7 @@ show_printer(http_t *http, /* I - HTTP connection to server */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
fprintf(stderr, "lpq: get-printer-attributes failed: %s\n",
ippErrorString(response->request.status.status_code));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
ippDelete(response);
return;
}
@@ -478,21 +643,35 @@ show_printer(http_t *http, /* I - HTTP connection to server */
switch (state)
{
case IPP_PRINTER_IDLE :
printf("%s is ready\n", dest);
_cupsLangPrintf(stdout, _("%s is ready\n"), dest);
break;
case IPP_PRINTER_PROCESSING :
printf("%s is ready and printing\n", dest);
_cupsLangPrintf(stdout, _("%s is ready and printing\n"),
dest);
break;
case IPP_PRINTER_STOPPED :
printf("%s is not ready\n", dest);
_cupsLangPrintf(stdout, _("%s is not ready\n"), dest);
break;
}
ippDelete(response);
}
else
fprintf(stderr, "lpq: get-printer-attributes failed: %s\n",
ippErrorString(cupsLastError()));
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
}
/*
* 'usage()' - Show program usage.
*/
static void
usage(void)
{
_cupsLangPuts(stderr,
_("Usage: lpq [-P dest] [-U username] [-h hostname[:port]] "
"[-l] [+interval]\n"));
exit(1);
}
+248 -69
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -33,10 +33,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <cups/cups.h>
#include <errno.h>
#include <cups/string.h>
#include <cups/cups.h>
#include <cups/i18n.h>
#ifndef WIN32
# include <unistd.h>
# include <signal.h>
@@ -60,30 +64,37 @@ char tempfile[1024]; /* Temporary file for printing from stdin */
*/
int
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
int i, j; /* Looping var */
int job_id; /* Job ID */
char *printer, /* Destination printer or class */
*instance; /* Instance */
const char *title; /* Job title */
int num_copies; /* Number of copies per file */
int num_files; /* Number of files to print */
const char *files[1000]; /* Files to print */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Selected destination */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
int deletefile; /* Delete file after print? */
char buffer[8192]; /* Copy buffer */
FILE *temp; /* Temporary file pointer */
#ifdef HAVE_SIGACTION
struct sigaction action; /* Signal action */
#endif /* HAVE_SIGACTION */
int i, j; /* Looping var */
int job_id; /* Job ID */
char ch; /* Option character */
char *printer, /* Destination printer or class */
*instance; /* Instance */
const char *title, /* Job title */
*val; /* Environment variable name */
int num_copies; /* Number of copies per file */
int num_files; /* Number of files to print */
const char *files[1000]; /* Files to print */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Selected destination */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
int deletefile; /* Delete file after print? */
char buffer[8192]; /* Copy buffer */
ssize_t bytes; /* Bytes copied */
off_t filesize; /* Size of temp file */
int temp; /* Temporary file descriptor */
#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;
@@ -95,12 +106,76 @@ main(int argc, /* I - Number of command-line arguments */
for (i = 1; i < argc; i ++)
if (argv[i][0] == '-')
switch (argv[i][1])
switch (ch = argv[i][1])
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
argv[0]);
#endif /* HAVE_SSL */
break;
case 'U' : /* Username */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
}
cupsSetUser(argv[i]);
}
break;
case 'H' : /* Connect to host */
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
"\'-H\' option!\n"),
argv[0]);
return (1);
}
else
cupsSetServer(argv[i]);
}
break;
case '1' : /* TROFF font set 1 */
case '2' : /* TROFF font set 2 */
case '3' : /* TROFF font set 3 */
case '4' : /* TROFF font set 4 */
case 'i' : /* indent */
case 'w' : /* width */
if (argv[i][2] == '\0')
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected value after \'-%c\' "
"option!\n"), argv[0], ch);
return (1);
}
}
case 'c' : /* CIFPLOT */
case 'd' : /* DVI */
case 'f' : /* FORTRAN */
@@ -108,8 +183,10 @@ main(int argc, /* I - Number of command-line arguments */
case 'n' : /* Ditroff */
case 't' : /* Troff */
case 'v' : /* Raster image */
fprintf(stderr, "Warning: \'%c\' format modifier not supported - output may not be correct!\n",
argv[i][1]);
_cupsLangPrintf(stderr,
_("%s: Warning - \'%c\' format modifier not "
"supported - output may not be correct!\n"),
argv[0], ch);
break;
case 'o' : /* Option */
@@ -118,24 +195,51 @@ main(int argc, /* I - Number of command-line arguments */
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: error - expected option=value after "
"\'-o\' option!\n"),
argv[0]);
return (1);
}
num_options = cupsParseOptions(argv[i], num_options, &options);
}
break;
case 'l' : /* Literal/raw */
num_options = cupsParseOptions("raw", num_options, &options);
num_options = cupsAddOption("raw", "", num_options, &options);
break;
case 'p' : /* Prettyprint */
num_options = cupsParseOptions("prettyprint", num_options, &options);
num_options = cupsAddOption("prettyprint", "", num_options,
&options);
break;
case 'h' : /* Suppress burst page */
num_options = cupsAddOption("job-sheets", "none", num_options,
&options);
break;
case 's' : /* Don't use symlinks */
break;
case 'm' : /* Mail on completion */
fputs("Warning: email notification is not supported!\n", stderr);
{
char email[1024]; /* EMail address */
snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(),
httpGetHostname(NULL, buffer, sizeof(buffer)));
num_options = cupsAddOption("notify-recipient", email,
num_options, &options);
}
break;
case 'q' : /* Queue file but don't print */
num_options = cupsAddOption("job-hold-until", "indefinite",
num_options, &options);
break;
case 'r' : /* Remove file after printing */
@@ -148,6 +252,15 @@ main(int argc, /* I - Number of command-line arguments */
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected destination after "
"\'-P\' option!\n"),
argv[0]);
return (1);
}
printer = argv[i];
}
@@ -160,7 +273,8 @@ main(int argc, /* I - Number of command-line arguments */
if ((dest = cupsGetDest(printer, instance, num_dests, dests)) != NULL)
{
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
if (cupsGetOption(dest->options[j].name, num_options,
options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
@@ -173,13 +287,16 @@ main(int argc, /* I - Number of command-line arguments */
else
{
i ++;
num_copies = atoi(argv[i]);
}
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected copy count after "
"\'-#\' option!\n"),
argv[0]);
return (1);
}
if (num_copies < 1 || num_copies > 100)
{
fputs("lpr: Number copies must be between 1 and 100.\n", stderr);
return (1);
num_copies = atoi(argv[i]);
}
sprintf(buffer, "%d", num_copies);
@@ -194,12 +311,22 @@ main(int argc, /* I - Number of command-line arguments */
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected name after \'-%c\' "
"option!\n"), argv[0], ch);
return (1);
}
title = argv[i];
}
break;
default :
fprintf(stderr, "lpr: Unknown option \'%c\'!\n", argv[i][1]);
_cupsLangPrintf(stderr,
_("%s: Error - unknown option \'%c\'!\n"),
argv[0], argv[i][1]);
return (1);
}
else if (num_files < 1000)
@@ -208,6 +335,14 @@ main(int argc, /* I - Number of command-line arguments */
* Print a file...
*/
if (access(argv[i], R_OK) != 0)
{
_cupsLangPrintf(stderr,
_("%s: Error - unable to access \"%s\" - %s\n"),
argv[0], argv[i], strerror(errno));
return (1);
}
files[num_files] = argv[i];
num_files ++;
@@ -220,7 +355,9 @@ main(int argc, /* I - Number of command-line arguments */
}
}
else
fprintf(stderr, "lpr: Too many files - \"%s\"\n", argv[i]);
_cupsLangPrintf(stderr,
_("%s: Error - too many files - \"%s\"\n"),
argv[0], argv[i]);
/*
* See if we have any files to print; if not, print from stdin...
*/
@@ -230,23 +367,49 @@ main(int argc, /* I - Number of command-line arguments */
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
for (j = 0, dest = dests; j < num_dests; j ++, dest ++)
if (dest->is_default)
{
printer = dests[j].name;
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL)
{
printer = dest->name;
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
break;
}
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
}
}
if (printer == NULL)
{
fputs("lpr: error - no default destination available.\n", stderr);
val = NULL;
if ((printer = getenv("LPDEST")) == NULL)
{
if ((printer = getenv("PRINTER")) != NULL)
{
if (!strcmp(printer, "lp"))
printer = NULL;
else
val = "PRINTER";
}
}
else
val = "LPDEST";
if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
_cupsLangPrintf(stderr,
_("%s: Error - %s environment variable names "
"non-existent destination \"%s\"!\n"),
argv[0], val, printer);
else if (cupsLastError() == IPP_NOT_FOUND)
_cupsLangPrintf(stderr,
_("%s: Error - no default destination available.\n"),
argv[0]);
else
_cupsLangPrintf(stderr,
_("%s: Error - scheduler not responding!\n"),
argv[0]);
return (1);
}
@@ -254,7 +417,7 @@ main(int argc, /* I - Number of command-line arguments */
{
job_id = cupsPrintFiles(printer, num_files, files, title, num_options, options);
if (deletefile)
if (deletefile && job_id > 0)
{
/*
* Delete print files after printing...
@@ -271,39 +434,56 @@ main(int argc, /* I - Number of command-line arguments */
#ifndef WIN32
# if defined(HAVE_SIGSET)
sigset(SIGHUP, sighandler);
sigset(SIGINT, sighandler);
if (sigset(SIGINT, sighandler) == SIG_IGN)
sigset(SIGINT, SIG_IGN);
sigset(SIGTERM, sighandler);
# elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = sighandler;
sigaction(SIGHUP, &action, NULL);
sigaction(SIGINT, &action, NULL);
sigaction(SIGINT, NULL, &oldaction);
if (oldaction.sa_handler != SIG_IGN)
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
# else
signal(SIGHUP, sighandler);
signal(SIGINT, sighandler);
if (signal(SIGINT, sighandler) == SIG_IGN)
signal(SIGINT, SIG_IGN);
signal(SIGTERM, sighandler);
# endif
#endif /* !WIN32 */
temp = fopen(cupsTempFile(tempfile, sizeof(tempfile)), "w");
if (temp == NULL)
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
fputs("lpr: unable to create temporary file.\n", stderr);
_cupsLangPrintf(stderr,
_("%s: Error - unable to create temporary file "
"\"%s\" - %s\n"),
argv[0], tempfile, strerror(errno));
return (1);
}
while ((i = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
fwrite(buffer, 1, i, temp);
while ((bytes = read(0, buffer, sizeof(buffer))) > 0)
if (write(temp, buffer, bytes) < 0)
{
_cupsLangPrintf(stderr,
_("%s: Error - unable to write to temporary file "
"\"%s\" - %s\n"),
argv[0], tempfile, strerror(errno));
close(temp);
unlink(tempfile);
return (1);
}
i = ftell(temp);
fclose(temp);
filesize = lseek(temp, 0, SEEK_CUR);
close(temp);
if (i == 0)
if (filesize <= 0)
{
fputs("lpr: stdin is empty, so no job has been sent.\n", stderr);
_cupsLangPrintf(stderr,
_("%s: Error - stdin is empty, so no job has been sent.\n"),
argv[0]);
unlink(tempfile);
return (1);
}
@@ -317,8 +497,7 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
fprintf(stderr, "lpr: unable to print file: %s\n",
ippErrorString(cupsLastError()));
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
return (1);
}
@@ -332,7 +511,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
void
sighandler(int s) /* I - Signal number */
sighandler(int s) /* I - Signal number */
{
/*
* Remove the temporary file we're using to print from stdin...
+130 -53
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lprm" command for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,9 +15,9 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
@@ -32,10 +32,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/i18n.h>
#include <cups/string.h>
/*
@@ -50,33 +50,44 @@ main(int argc, /* I - Number of command-line arguments */
int i; /* Looping var */
int job_id; /* Job ID */
const char *dest; /* Destination printer */
char *instance; /* Pointer to instance name */
char uri[1024]; /* Printer or job URI */
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 */
*defdest; /* Default destination */
http_encryption_t encryption; /* Encryption? */
_cupsSetLocale();
/*
* Setup to cancel individual print jobs...
*/
op = IPP_CANCEL_JOB;
job_id = 0;
dest = cupsGetDefault();
response = NULL;
http = NULL;
op = IPP_CANCEL_JOB;
job_id = 0;
dest = NULL;
response = NULL;
http = NULL;
encryption = cupsEncryption();
/*
* Open a connection to the server...
*/
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL)
{
fputs("lprm: Unable to contact server!\n", stderr);
_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;
/*
* Process command-line arguments...
*/
@@ -85,6 +96,19 @@ main(int argc, /* I - Number of command-line arguments */
if (argv[i][0] == '-' && argv[i][1] != '\0')
switch (argv[i][1])
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
encryption = HTTP_ENCRYPT_REQUIRED;
httpEncryption(http, encryption);
cupsSetEncryption(encryption);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
argv[0]);
#endif /* HAVE_SSL */
break;
case 'P' : /* Cancel jobs on a printer */
if (argv[i][2])
dest = argv[i] + 2;
@@ -93,10 +117,80 @@ main(int argc, /* I - Number of command-line arguments */
i ++;
dest = argv[i];
}
if ((instance = strchr(dest, '/')) != NULL)
*instance = '\0';
if (cupsGetDest(dest, NULL, num_dests, dests) == NULL)
{
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s\"!\n"),
argv[0], dest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return(1);
}
break;
case 'U' : /* Username */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
}
cupsSetUser(argv[i]);
}
break;
case 'h' : /* Connect to host */
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
"\'-h\' option!\n"),
argv[0]);
return (1);
}
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 :
fprintf(stderr, "lprm: Unknown option \'%c\'!\n", argv[i][1]);
_cupsLangPrintf(stderr,
_("%s: Error - unknown option \'%c\'!\n"),
argv[0], argv[i][1]);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
else
@@ -105,13 +199,14 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel a job or printer...
*/
if (isdigit(argv[i][0]))
if (isdigit(argv[i][0] & 255) &&
cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
{
dest = NULL;
op = IPP_CANCEL_JOB;
job_id = atoi(argv[i]);
}
else if (strcmp(argv[i], "-") == 0)
else if (!strcmp(argv[i], "-"))
{
/*
* Cancel all jobs
@@ -120,7 +215,10 @@ main(int argc, /* I - Number of command-line arguments */
op = IPP_PURGE_JOBS;
}
else
{
dest = argv[i];
job_id = 0;
}
/*
* Build an IPP request, which requires the following
@@ -132,22 +230,12 @@ main(int argc, /* I - Number of command-line arguments */
* [requesting-user-name]
*/
request = ippNew();
request->request.op.operation_id = op;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(op);
if (dest)
{
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", dest);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
@@ -172,46 +260,35 @@ main(int argc, /* I - Number of command-line arguments */
else
response = cupsDoRequest(http, request, "/jobs/");
if (response != NULL)
{
switch (response->request.status.status_code)
{
case IPP_NOT_FOUND :
fputs("lprm: Job or printer not found!\n", stderr);
break;
case IPP_NOT_AUTHORIZED :
fputs("lprm: Not authorized to lprm job(s)!\n", stderr);
break;
case IPP_FORBIDDEN :
fprintf(stderr, "lprm: You don't own job ID %d!\n", job_id);
break;
default :
if (response->request.status.status_code > IPP_OK_CONFLICT)
fputs("lprm: Unable to lprm job(s)!\n", stderr);
break;
}
ippDelete(response);
ippDelete(response);
}
else
if (cupsLastError() > IPP_OK_CONFLICT)
{
fputs("lprm: Unable to cancel job(s)!\n", stderr);
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
}
/*
* 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...
*/
if (response == NULL)
if (!cupsCancelJob(dest, 0))
{
fputs("lprm: Unable to cancel job(s)!\n", stderr);
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
cupsFreeDests(num_dests, dests);
httpClose(http);
return (0);
}
+55
Ver Arquivo
@@ -0,0 +1,55 @@
# DO NOT DELETE
help-index.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
help-index.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
help-index.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
help-index.o: ../cups/i18n.h ../cups/string.h ../config.h ../cups/dir.h
html.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
html.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
html.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
html.o: ../cups/i18n.h ../cups/string.h ../config.h
ipp-var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
ipp-var.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
ipp-var.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
ipp-var.o: ../cups/i18n.h ../cups/string.h ../config.h
search.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
search.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
search.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
search.o: ../cups/i18n.h ../cups/string.h ../config.h
template.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
template.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
template.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
template.o: ../cups/i18n.h ../cups/string.h ../config.h
var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
var.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
var.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
var.o: ../cups/i18n.h ../cups/string.h ../config.h
admin.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
admin.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
admin.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
admin.o: ../cups/i18n.h ../cups/string.h ../config.h ../cups/file.h
classes.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
classes.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
classes.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
classes.o: ../cups/i18n.h ../cups/string.h ../config.h
help.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
help.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
help.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
help.o: ../cups/i18n.h ../cups/string.h ../config.h
jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
jobs.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
jobs.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
jobs.o: ../cups/i18n.h ../cups/string.h ../config.h
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
printers.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
printers.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
printers.o: ../cups/i18n.h ../cups/string.h ../config.h
testcgi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
testcgi.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
testcgi.o: ../cups/array.h help-index.h
testhi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
testhi.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
testhi.o: ../cups/array.h help-index.h
testtemplate.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
testtemplate.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
testtemplate.o: ../cups/language.h ../cups/array.h help-index.h
+77 -22
Ver Arquivo
@@ -3,7 +3,7 @@
#
# CGI makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-1999 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
@@ -15,18 +15,20 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
include ../Makedefs
TARGETS = admin.cgi classes.cgi jobs.cgi printers.cgi
LIBOBJS = abort.o email.o html.o ipp-var.o template.o var.o
OBJS = $(LIBOBJS) admin.o classes.o jobs.o printers.o
CGIS = admin.cgi classes.cgi help.cgi jobs.cgi printers.cgi
TARGETS = libcgi.a $(CGIS) testcgi testhi testtemplate
LIBOBJS = help-index.o html.o ipp-var.o search.o template.o var.o
OBJS = $(LIBOBJS) admin.o classes.o help.o \
jobs.o printers.o testcgi.o testhi.o testtemplate.o
#
@@ -41,18 +43,37 @@ all: $(TARGETS)
#
clean:
$(RM) $(OBJS) libcgi.a $(TARGETS)
$(RM) $(OBJS) $(TARGETS)
#
# Update dependencies (without system header dependencies...)
#
depend:
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
#
# Install all targets...
#
install:
-$(MKDIR) $(SERVERBIN)/cgi-bin
$(CHMOD) ugo+rx $(SERVERBIN)
$(CHMOD) ugo+rx $(SERVERBIN)/cgi-bin
$(INSTALL_BIN) $(TARGETS) $(SERVERBIN)/cgi-bin
install: all
$(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
for file in $(CGIS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
done
#
# Uninstall all targets...
#
uninstall:
for file in $(CGIS); do \
$(RM) $(SERVERBIN)/cgi-bin/$$file; \
done
-$(RMDIR) $(SERVERBIN)/cgi-bin
#
@@ -65,9 +86,6 @@ libcgi.a: $(LIBOBJS)
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
$(LIBOBJS): cgi.h
ipp-var.o: ipp-var.h
#
# admin.cgi
@@ -77,8 +95,6 @@ admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ admin.o libcgi.a $(LIBS)
admin.o: cgi.h ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/language.h
#
# classes.cgi
@@ -88,7 +104,14 @@ classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ classes.o libcgi.a $(LIBS)
classes.o: cgi.h ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/language.h
#
# help.cgi
#
help.cgi: help.o ../Makedefs libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ help.o libcgi.a $(LIBS)
#
@@ -99,8 +122,6 @@ jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ jobs.o libcgi.a $(LIBS)
jobs.o: cgi.h ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/language.h
#
# printers.cgi
@@ -110,9 +131,43 @@ printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ printers.o libcgi.a $(LIBS)
printers.o: cgi.h ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/language.h
$(OBJS): ../Makedefs
#
# testcgi
#
testcgi: testcgi.o ../Makedefs libcgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testcgi.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ)
#
# testhi
#
testhi: testhi.o ../Makedefs libcgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testhi.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ)
#
# testtemplate
#
testtemplate: testtemplate.o ../Makedefs libcgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ)
#
# Dependencies...
#
include Dependencies
#
# End of "$Id$".
+2171 -707
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+44
Ver Arquivo
@@ -0,0 +1,44 @@
/*
* "$Id$"
*
* Private CGI definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
#include <cups/debug.h>
#include <cups/i18n.h>
#include <cups/string.h>
/*
* Limits...
*/
#define CUPS_PAGE_MAX 10 /* Maximum items per page */
/*
* End of "$Id$".
*/
+67 -45
Ver Arquivo
@@ -3,84 +3,106 @@
*
* CGI support library definitions.
*
* Copyright 1997-2000 by Easy Software Products.
* Copyright 1997-2006 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
#ifndef _CGI_H_
# define _CGI_H_
#ifndef _CUPS_CGI_H_
# define _CUPS_CGI_H_
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
# include <time.h>
# include <sys/stat.h>
# ifdef WIN32
# include <direct.h>
# include <io.h>
# include <malloc.h>
# define strcasecmp(s,t) stricmp((s),(t))
# define strncasecmp(s,t,n) strnicmp((s),(t),(n))
# else
# include <unistd.h>
# endif /* WIN32 */
# include <cups/cups.h>
# include <cups/array.h>
# include "help-index.h"
/*
* Types...
*/
typedef struct cgi_file_s /**** Uploaded file data ****/
{
char tempfile[1024], /* Temporary file containing data */
*name, /* Variable name */
*filename, /* Original filename */
*mimetype; /* MIME media type */
size_t filesize; /* Size of uploaded file */
} cgi_file_t;
/*
* Prototypes...
*/
extern int cgiInitialize(void);
extern void cgiAbort(const char *title, const char *stylesheet,
const char *format, ...);
extern int cgiCheckVariables(const char *names);
extern void *cgiCompileSearch(const char *query);
extern void cgiCopyTemplateFile(FILE *out, const char *tmpl);
extern void cgiCopyTemplateLang(const char *tmpl);
extern int cgiDoSearch(void *search, const char *text);
extern void cgiEndHTML(void);
extern char *cgiFormEncode(char *dst, const char *src, size_t dstsize);
extern void cgiFreeSearch(void *search);
extern const char *cgiGetArray(const char *name, int element);
extern void cgiGetAttributes(ipp_t *request, const char *tmpl);
extern char *cgiGetCookie(const char *name, char *buf, int buflen);
extern const cgi_file_t *cgiGetFile(void);
extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search);
extern int cgiGetSize(const char *name);
extern void cgiSetSize(const char *name, int size);
extern char *cgiGetTemplateDir(void);
extern const char *cgiGetVariable(const char *name);
extern int cgiInitialize(void);
extern int cgiIsPOST(void);
extern void cgiMoveJobs(http_t *http, const char *dest, int job_id);
extern void cgiPrintTestPage(http_t *http, const char *dest);
extern char *cgiRewriteURL(const char *uri, char *url, int urlsize,
const char *newresource);
extern void cgiSetArray(const char *name, int element,
const char *value);
extern void cgiSetVariable(const char *name, const char *value);
extern void cgiCopyTemplateFile(FILE *out, const char *tmpl);
extern void cgiCopyTemplateLang(FILE *out, const char *directory,
const char *tmpl, const char *lang);
extern void cgiStartHTML(FILE *out, const char *author,
const char *stylesheet,
const char *keywords,
const char *description,
const char *title, ...);
extern void cgiEndHTML(FILE *out);
extern FILE *cgiEMailOpen(const char *from, const char *to,
const char *cc, const char *subject,
int multipart);
extern void cgiEMailPart(FILE *mail, const char *type,
const char *charset, const char *encoding);
extern void cgiEMailClose(FILE *mail);
extern char *cgiGetCookie(const char *name, char *buf, int buflen);
extern void cgiSetCookie(const char *name, const char *value,
const char *path, const char *domain,
time_t expires, int secure);
extern ipp_attribute_t *cgiSetIPPObjectVars(ipp_attribute_t *obj,
const char *prefix, int element);
extern int cgiSetIPPVars(ipp_t *response, const char *filter_name,
const char *filter_value,
const char *prefix, int parent_el);
extern void cgiSetServerVersion(void);
extern void cgiSetSize(const char *name, int size);
extern void cgiSetVariable(const char *name, const char *value);
extern void cgiShowIPPError(const char *message);
extern void cgiShowJobs(http_t *http, const char *dest);
extern void cgiStartHTML(const char *title);
extern const char *cgiText(const char *message);
# define cgiGetUser() getenv("REMOTE_USER")
# define cgiGetHost() (getenv("REMOTE_HOST") == NULL ? getenv("REMOTE_ADDR") : getenv("REMOTE_HOST"))
#endif /* !_CGI_H_ */
#endif /* !_CUPS_CGI_H_ */
/*
* End of "$Id$".
+370 -204
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,42 +15,54 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
* main() - Main entry for CGI.
* show_all_classes() - Show all classes...
* show_class() - Show a single class.
*/
/*
* Include necessary headers...
*/
#include "ipp-var.h"
#include "cgi-private.h"
/*
* Local functions...
*/
void show_all_classes(http_t *http, const char *username);
void show_class(http_t *http, const char *printer);
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
char *pclass; /* Printer class name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI];
/* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
const char *pclass; /* Class name */
const char *user; /* Username */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
const char *op; /* Operation to perform, if any */
static const char *def_attrs[] = /* Attributes for default printer */
{
"printer-name",
"printer-uri-supported"
};
/*
@@ -58,235 +70,107 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiInitialize();
op = cgiGetVariable("OP");
/*
* Get the request language...
* Set the web interface section...
*/
language = cupsLangDefault();
cgiSetVariable("SECTION", "classes");
/*
* See if we are displaying a printer or all classes...
*/
if ((pclass = getenv("PATH_INFO")) != NULL)
{
pclass ++;
if (!*pclass)
pclass = NULL;
}
/*
* See who is logged in...
*/
user = getenv("REMOTE_USER");
/*
* Connect to the HTTP server...
*/
http = httpConnect("localhost", ippPort());
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
/*
* Tell the client to expect HTML...
* Get the default printer...
*/
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
/*
* See if we need to show a list of printers or the status of a
* single printer...
*/
ippSetServerVersion();
pclass = argv[0];
if (strcmp(pclass, "/") == 0 || strcmp(pclass, "classes.cgi") == 0)
{
pclass = NULL;
cgiSetVariable("TITLE", cupsLangString(language, CUPS_MSG_CLASS));
}
else
cgiSetVariable("TITLE", pclass);
cgiCopyTemplateLang(stdout, TEMPLATES, "header.tmpl", getenv("LANG"));
if (op == NULL || strcasecmp(op, "print-test-page") != 0)
if (!op)
{
/*
* Get the class info...
* Get the default destination...
*/
request = ippNew();
request = ippNewRequest(CUPS_GET_DEFAULT);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
if (pclass == NULL)
{
/*
* Build a CUPS_GET_CLASSES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
*/
request->request.op.operation_id = CUPS_GET_CLASSES;
request->request.op.request_id = 1;
}
else
{
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
snprintf(uri, sizeof(uri), "ipp://%s/classes/%s", getenv("SERVER_NAME"),
pclass);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
}
/*
* Do the request and get back a response...
*/
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char url[HTTP_MAX_URI]; /* New URL */
cgiSetVariable("DEFAULT_URI",
cgiRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
}
ippDelete(response);
}
/*
* Write the report...
* See if we need to show a list of classes or the status of a
* single printer...
*/
cgiCopyTemplateLang(stdout, TEMPLATES, "classes.tmpl", getenv("LANG"));
/*
* Get jobs for the specified class if a class has been chosen...
*/
if (pclass != NULL)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
snprintf(uri, sizeof(uri), "ipp://%s/classes/%s", getenv("SERVER_NAME"),
pclass);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
}
}
if (!pclass)
show_all_classes(http, user);
else
show_class(http, pclass);
}
else if (!strcasecmp(op, "print-test-page") && pclass)
cgiPrintTestPage(http, pclass);
else if (!strcasecmp(op, "move-jobs") && pclass)
cgiMoveJobs(http, pclass, 0);
else
{
/*
* Print a test page...
* Unknown/bad operation...
*/
snprintf(uri, sizeof(uri), "ipp://localhost/classes/%s", pclass);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNew();
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (getenv("REMOTE_USER") != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
if (pclass)
cgiStartHTML(pclass);
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "root");
cgiStartHTML(cgiText(_("Classes")));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Test Page");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, uri + 15,
CUPS_DATADIR "/data/testprint.ps")) != NULL)
{
status = response->request.status.status_code;
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
}
else
status = IPP_GONE;
cgiSetVariable("PRINTER_NAME", pclass);
if (status > IPP_OK_CONFLICT)
{
cgiSetVariable("ERROR", ippErrorString(status));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
}
else
cgiCopyTemplateLang(stdout, TEMPLATES, "test-page.tmpl", getenv("LANG"));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
cgiCopyTemplateLang(stdout, TEMPLATES, "trailer.tmpl", getenv("LANG"));
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -296,6 +180,288 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* 'show_all_classes()' - Show all classes...
*/
void
show_all_classes(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
int i; /* Looping var */
ipp_t *request, /* IPP request */
*response; /* IPP response */
cups_array_t *classes; /* Array of class objects */
ipp_attribute_t *pclass; /* Class object */
int ascending, /* Order of classes (0 = descending) */
first, /* First class to show */
count; /* Number of classes */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
/*
* Show the standard header...
*/
cgiStartHTML(cgiText(_("Classes")));
/*
* Build a CUPS_GET_CLASSES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* requesting-user-name
*/
request = ippNewRequest(CUPS_GET_CLASSES);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
cgiGetAttributes(request, "classes.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
classes = cgiGetIPPObjects(response, search);
count = cupsArrayCount(classes);
if (search)
cgiFreeSearch(search);
/*
* Figure out which classes to display...
*/
if ((var = cgiGetVariable("FIRST")) != NULL)
first = atoi(var);
else
first = 0;
if (first >= count)
first = count - CUPS_PAGE_MAX;
first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX;
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
else
ascending = 1;
if (ascending)
{
for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, first);
i < CUPS_PAGE_MAX && pclass;
i ++, pclass = (ipp_attribute_t *)cupsArrayNext(classes))
cgiSetIPPObjectVars(pclass, NULL, i);
}
else
{
for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, count - first - 1);
i < CUPS_PAGE_MAX && pclass;
i ++, pclass = (ipp_attribute_t *)cupsArrayPrev(classes))
cgiSetIPPObjectVars(pclass, NULL, i);
}
/*
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/classes/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/classes/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
* Then show everything...
*/
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("classes-header.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("classes.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
/*
* Delete the response...
*/
cupsArrayDelete(classes);
ippDelete(response);
}
else
{
/*
* Show the error...
*/
cgiShowIPPError(_("Unable to get class list:"));
}
cgiEndHTML();
}
/*
* 'show_class()' - Show a single class.
*/
void
show_class(http_t *http, /* I - Connection to server */
const char *pclass) /* I - Name of class */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
char uri[HTTP_MAX_URI]; /* Printer URI */
char refresh[1024]; /* Refresh URL */
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/classes/%s", pclass);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "classes.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Got the result; set the CGI variables and check the status of a
* single-queue request...
*/
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if (pclass && (attr = ippFindAttribute(response, "printer-state",
IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer == IPP_PRINTER_PROCESSING)
{
/*
* Class is processing - automatically refresh the page until we
* are done printing...
*/
cgiFormEncode(uri, pclass, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;URL=/classes/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
/*
* Delete the response...
*/
ippDelete(response);
/*
* Show the standard header...
*/
cgiStartHTML(pclass);
/*
* Show the class status...
*/
cgiCopyTemplateLang("classes.tmpl");
/*
* Show jobs for the specified class...
*/
cgiCopyTemplateLang("class-jobs-header.tmpl");
cgiShowJobs(http, pclass);
}
else
{
/*
* Show the IPP error...
*/
cgiStartHTML(pclass);
cgiShowIPPError(_("Unable to get class status:"));
}
cgiEndHTML();
}
/*
* End of "$Id$".
*/
+983
Ver Arquivo
@@ -0,0 +1,983 @@
/*
* "$Id$"
*
* On-line help index routines for the Common UNIX Printing System (CUPS).
*
* 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
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* helpDeleteIndex() - Delete an index, freeing all memory used.
* helpFindNode() - Find a node in an index.
* helpLoadIndex() - Load a help index from disk.
* helpSaveIndex() - Save a help index to disk.
* helpSearchIndex() - Search an index.
* help_compile_search() - Convert a search string into a regular expression.
* help_delete_node() - Free all memory used by a node.
* help_load_directory() - Load a directory of files into an index.
* help_load_file() - Load a HTML files into an index.
* help_new_node() - Create a new node and add it to an index.
* help_sort_nodes_by_name() - Sort nodes by section, filename, and anchor.
* help_sort_nodes_by_score() - Sort nodes by score and text.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
#include <cups/dir.h>
/*
* Local functions...
*/
static void help_delete_node(help_node_t *n);
static int help_load_directory(help_index_t *hi,
const char *directory,
const char *relative);
static int help_load_file(help_index_t *hi,
const char *filename,
const char *relative,
time_t mtime);
static help_node_t *help_new_node(const char *filename, const char *anchor,
const char *section, const char *text,
time_t mtime, off_t offset,
size_t length);
static int help_sort_by_name(help_node_t *p1, help_node_t *p2);
static int help_sort_by_score(help_node_t *p1, help_node_t *p2);
/*
* 'helpDeleteIndex()' - Delete an index, freeing all memory used.
*/
void
helpDeleteIndex(help_index_t *hi) /* I - Help index */
{
help_node_t *node; /* Current node */
DEBUG_printf(("helpDeleteIndex(hi=%p)\n", hi));
if (!hi)
return;
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
{
cupsArrayRemove(hi->nodes, node);
cupsArrayRemove(hi->sorted, node);
if (!hi->search)
help_delete_node(node);
}
cupsArrayDelete(hi->nodes);
cupsArrayDelete(hi->sorted);
free(hi);
}
/*
* 'helpFindNode()' - Find a node in an index.
*/
help_node_t * /* O - Node pointer or NULL */
helpFindNode(help_index_t *hi, /* I - Index */
const char *filename, /* I - Filename */
const char *anchor) /* I - Anchor */
{
help_node_t key; /* Search key */
DEBUG_printf(("helpFindNode(hi=%p, filename=\"%s\", anchor=\"%s\")\n",
hi, filename ? filename : "(nil)", anchor ? anchor : "(nil)"));
/*
* Range check input...
*/
if (!hi || !filename)
return (NULL);
/*
* Initialize the search key...
*/
key.filename = (char *)filename;
key.anchor = (char *)anchor;
/*
* Return any match...
*/
return ((help_node_t *)cupsArrayFind(hi->nodes, &key));
}
/*
* 'helpLoadIndex()' - Load a help index from disk.
*/
help_index_t * /* O - Index pointer or NULL */
helpLoadIndex(const char *hifile, /* I - Index filename */
const char *directory) /* I - Directory that is indexed */
{
help_index_t *hi; /* Help index */
cups_file_t *fp; /* Current file */
char line[2048], /* Line from file */
*ptr, /* Pointer into line */
*filename, /* Filename in line */
*anchor, /* Anchor in line */
*sectptr, /* Section pointer in line */
section[1024], /* Section name */
*text; /* Text in line */
time_t mtime; /* Modification time */
off_t offset; /* Offset into file */
size_t length; /* Length in bytes */
int update; /* Update? */
help_node_t *node; /* Current node */
DEBUG_printf(("helpLoadIndex(hifile=\"%s\", directory=\"%s\")\n",
hifile, directory));
/*
* Create a new, empty index.
*/
if ((hi = (help_index_t *)calloc(1, sizeof(help_index_t))) == NULL)
return (NULL);
hi->nodes = cupsArrayNew((cups_array_func_t)help_sort_by_name, NULL);
hi->sorted = cupsArrayNew((cups_array_func_t)help_sort_by_score, NULL);
if (!hi->nodes || !hi->sorted)
{
cupsArrayDelete(hi->nodes);
cupsArrayDelete(hi->sorted);
free(hi);
return (NULL);
}
/*
* Try loading the existing index file...
*/
if ((fp = cupsFileOpen(hifile, "r")) != NULL)
{
/*
* Lock the file and then read the first line...
*/
cupsFileLock(fp, 1);
if (cupsFileGets(fp, line, sizeof(line)) && !strcmp(line, "HELPV1"))
{
/*
* Got a valid header line, now read the data lines...
*/
while (cupsFileGets(fp, line, sizeof(line)))
{
/*
* Each line looks like one of the following:
*
* filename mtime offset length "section" "text"
* filename#anchor offset length "text"
*/
filename = line;
if ((ptr = strchr(line, ' ')) == NULL)
break;
while (isspace(*ptr & 255))
*ptr++ = '\0';
if ((anchor = strrchr(filename, '#')) != NULL)
{
*anchor++ = '\0';
mtime = 0;
}
else
mtime = strtol(ptr, &ptr, 10);
offset = strtoll(ptr, &ptr, 10);
length = strtoll(ptr, &ptr, 10);
while (isspace(*ptr & 255))
ptr ++;
if (!anchor)
{
/*
* Get section...
*/
if (*ptr != '\"')
break;
ptr ++;
sectptr = ptr;
while (*ptr && *ptr != '\"')
ptr ++;
if (*ptr != '\"')
break;
*ptr++ = '\0';
strlcpy(section, sectptr, sizeof(section));
while (isspace(*ptr & 255))
ptr ++;
}
if (*ptr != '\"')
break;
ptr ++;
text = ptr;
while (*ptr && *ptr != '\"')
ptr ++;
if (*ptr != '\"')
break;
*ptr++ = '\0';
if ((node = help_new_node(filename, anchor, section, text,
mtime, offset, length)) == NULL)
break;
node->score = -1;
cupsArrayAdd(hi->nodes, node);
}
}
cupsFileClose(fp);
}
/*
* Scan for new/updated files...
*/
update = help_load_directory(hi, directory, NULL);
/*
* Remove any files that are no longer installed...
*/
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
if (node->score < 0)
{
/*
* Delete this node...
*/
cupsArrayRemove(hi->nodes, node);
help_delete_node(node);
}
/*
* Add nodes to the sorted array...
*/
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
cupsArrayAdd(hi->sorted, node);
/*
* Save the index if we updated it...
*/
if (update)
helpSaveIndex(hi, hifile);
/*
* Return the index...
*/
return (hi);
}
/*
* 'helpSaveIndex()' - Save a help index to disk.
*/
int /* O - 0 on success, -1 on error */
helpSaveIndex(help_index_t *hi, /* I - Index */
const char *hifile) /* I - Index filename */
{
cups_file_t *fp; /* Index file */
help_node_t *node; /* Current node */
DEBUG_printf(("helpSaveIndex(hi=%p, hifile=\"%s\")\n", hi, hifile));
/*
* Try creating a new index file...
*/
if ((fp = cupsFileOpen(hifile, "w9")) == NULL)
return (-1);
/*
* Lock the file while we write it...
*/
cupsFileLock(fp, 1);
cupsFilePuts(fp, "HELPV1\n");
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
{
/*
* Write the current node with/without the anchor...
*/
if (node->anchor)
{
if (cupsFilePrintf(fp, "%s#%s " CUPS_LLFMT " " CUPS_LLFMT " \"%s\"\n",
node->filename, node->anchor,
CUPS_LLCAST node->offset, CUPS_LLCAST node->length,
node->text) < 0)
break;
}
else
{
if (cupsFilePrintf(fp, "%s %d " CUPS_LLFMT " " CUPS_LLFMT " \"%s\" \"%s\"\n",
node->filename, node->mtime,
CUPS_LLCAST node->offset, CUPS_LLCAST node->length,
node->section ? node->section : "", node->text) < 0)
break;
}
}
cupsFileFlush(fp);
if (cupsFileClose(fp) < 0)
return (-1);
else if (node)
return (-1);
else
return (0);
}
/*
* 'helpSearchIndex()' - Search an index.
*/
help_index_t * /* O - Search index */
helpSearchIndex(help_index_t *hi, /* I - Index */
const char *query, /* I - Query string */
const char *section, /* I - Limit search to this section */
const char *filename) /* I - Limit search to this file */
{
help_index_t *search; /* Search index */
help_node_t *node; /* Current node */
void *sc; /* Search context */
int matches; /* Number of matches */
DEBUG_printf(("helpSearchIndex(hi=%p, query=\"%s\", filename=\"%s\")\n",
hi, query ? query : "(nil)",
filename ? filename : "(nil)"));
/*
* Range check...
*/
if (!hi || !query)
return (NULL);
/*
* Reset the scores of all nodes to 0...
*/
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
node->score = 0;
/*
* Find the first node to search in...
*/
if (filename)
{
node = helpFindNode(hi, filename, NULL);
if (!node)
return (NULL);
}
else
node = (help_node_t *)cupsArrayFirst(hi->nodes);
/*
* Convert the query into a regular expression...
*/
sc = cgiCompileSearch(query);
if (!sc)
return (NULL);
/*
* Allocate a search index...
*/
search = calloc(1, sizeof(help_index_t));
if (!search)
{
cgiFreeSearch(sc);
return (NULL);
}
search->nodes = cupsArrayNew((cups_array_func_t)help_sort_by_name, NULL);
search->sorted = cupsArrayNew((cups_array_func_t)help_sort_by_score, NULL);
if (!search->nodes || !search->sorted)
{
cupsArrayDelete(search->nodes);
cupsArrayDelete(search->sorted);
free(search);
cgiFreeSearch(sc);
return (NULL);
}
search->search = 1;
/*
* Check each node in the index, adding matching nodes to the
* search index...
*/
for (; node; node = (help_node_t *)cupsArrayNext(hi->nodes))
if (section && strcmp(node->section, section))
continue;
else if (filename && strcmp(node->filename, filename))
continue;
else if ((matches = cgiDoSearch(sc, node->text)) > 0)
{
/*
* Found a match, add the node to the search index...
*/
node->score = matches;
cupsArrayAdd(search->nodes, node);
cupsArrayAdd(search->sorted, node);
}
/*
* Free the search context...
*/
cgiFreeSearch(sc);
/*
* Return the results...
*/
return (search);
}
/*
* 'help_delete_node()' - Free all memory used by a node.
*/
static void
help_delete_node(help_node_t *n) /* I - Node */
{
DEBUG_printf(("help_delete_node(n=%p)\n", n));
if (!n)
return;
if (n->filename)
free(n->filename);
if (n->anchor)
free(n->anchor);
if (n->section)
free(n->section);
if (n->text)
free(n->text);
free(n);
}
/*
* 'help_load_directory()' - Load a directory of files into an index.
*/
static int /* O - 0 = success, -1 = error, 1 = updated */
help_load_directory(
help_index_t *hi, /* I - Index */
const char *directory, /* I - Directory */
const char *relative) /* I - Relative path */
{
cups_dir_t *dir; /* Directory file */
cups_dentry_t *dent; /* Directory entry */
char *ext, /* Pointer to extension */
filename[1024], /* Full filename */
relname[1024]; /* Relative filename */
int update; /* Updated? */
help_node_t *node; /* Current node */
DEBUG_printf(("help_load_directory(hi=%p, directory=\"%s\", relative=\"%s\")\n",
hi, directory ? directory : "(nil)", relative ? relative : "(nil)"));
/*
* Open the directory and scan it...
*/
if ((dir = cupsDirOpen(directory)) == NULL)
return (0);
update = 0;
while ((dent = cupsDirRead(dir)) != NULL)
{
/*
* Skip "." files...
*/
if (dent->filename[0] == '.')
continue;
/*
* Get absolute and relative filenames...
*/
snprintf(filename, sizeof(filename), "%s/%s", directory, dent->filename);
if (relative)
snprintf(relname, sizeof(relname), "%s/%s", relative, dent->filename);
else
strlcpy(relname, dent->filename, sizeof(relname));
/*
* Check if we have a HTML file...
*/
if ((ext = strstr(dent->filename, ".html")) != NULL &&
(!ext[5] || !strcmp(ext + 5, ".gz")))
{
/*
* HTML file, see if we have already indexed the file...
*/
if ((node = helpFindNode(hi, relname, NULL)) != NULL)
{
/*
* File already indexed - check dates to confirm that the
* index is up-to-date...
*/
if (node->mtime == dent->fileinfo.st_mtime)
{
/*
* Same modification time, so mark all of the nodes
* for this file as up-to-date...
*/
for (; node; node = (help_node_t *)cupsArrayNext(hi->nodes))
if (!strcmp(node->filename, relname))
node->score = 0;
else
break;
continue;
}
}
update = 1;
help_load_file(hi, filename, relname, dent->fileinfo.st_mtime);
}
else if (S_ISDIR(dent->fileinfo.st_mode))
{
/*
* Process sub-directory...
*/
if (help_load_directory(hi, filename, relname) == 1)
update = 1;
}
}
cupsDirClose(dir);
return (update);
}
/*
* 'help_load_file()' - Load a HTML files into an index.
*/
static int /* O - 0 = success, -1 = error */
help_load_file(
help_index_t *hi, /* I - Index */
const char *filename, /* I - Filename */
const char *relative, /* I - Relative path */
time_t mtime) /* I - Modification time */
{
cups_file_t *fp; /* HTML file */
help_node_t *node; /* Current node */
char line[1024], /* Line from file */
section[1024], /* Section */
*ptr, /* Pointer into line */
*anchor, /* Anchor name */
*text; /* Text for anchor */
off_t offset; /* File offset */
char quote; /* Quote character */
DEBUG_printf(("help_load_file(hi=%p, filename=\"%s\", relative=\"%s\", mtime=%ld)\n",
hi, filename ? filename : "(nil)",
relative ? relative : "(nil)", mtime));
if ((fp = cupsFileOpen(filename, "r")) == NULL)
return (-1);
node = NULL;
offset = 0;
strcpy(section, "Other");
while (cupsFileGets(fp, line, sizeof(line)))
{
/*
* Look for "<TITLE>", "<A NAME", or "<!-- SECTION:" prefix...
*/
if (!strncasecmp(line, "<!-- SECTION:", 13))
{
/*
* Got section line, copy it!
*/
for (ptr = line + 13; isspace(*ptr & 255); ptr ++);
strlcpy(section, ptr, sizeof(section));
if ((ptr = strstr(section, "-->")) != NULL)
{
/*
* Strip comment stuff from end of line...
*/
for (*ptr-- = '\0'; ptr > line && isspace(*ptr & 255); *ptr-- = '\0');
if (isspace(*ptr & 255))
*ptr = '\0';
}
continue;
}
for (ptr = line; (ptr = strchr(ptr, '<')) != NULL;)
{
ptr ++;
if (!strncasecmp(ptr, "TITLE>", 6))
{
/*
* Found the title...
*/
anchor = NULL;
ptr += 6;
}
else if (!strncasecmp(ptr, "A NAME=", 7))
{
/*
* Found an anchor...
*/
ptr += 7;
if (*ptr == '\"' || *ptr == '\'')
{
/*
* Get quoted anchor...
*/
quote = *ptr;
anchor = ptr + 1;
if ((ptr = strchr(anchor, quote)) != NULL)
*ptr++ = '\0';
else
break;
}
else
{
/*
* Get unquoted anchor...
*/
anchor = ptr + 1;
for (ptr = anchor; *ptr && *ptr != '>' && !isspace(*ptr & 255); ptr ++);
if (*ptr)
*ptr++ = '\0';
else
break;
}
/*
* Got the anchor, now lets find the end...
*/
while (*ptr && *ptr != '>')
ptr ++;
if (*ptr != '>')
break;
ptr ++;
}
else
continue;
/*
* Now collect text for the link...
*/
text = ptr;
while ((ptr = strchr(text, '<')) == NULL)
{
ptr = text + strlen(text);
if (ptr >= (line + sizeof(line) - 2))
break;
*ptr++ = ' ';
if (!cupsFileGets(fp, ptr, sizeof(line) - (ptr - line) - 1))
break;
}
*ptr = '\0';
if (node)
node->length = offset - node->offset;
if (!*text)
{
node = NULL;
break;
}
if ((node = helpFindNode(hi, relative, anchor)) != NULL)
{
/*
* Node already in the index, so replace the text and other
* data...
*/
cupsArrayRemove(hi->nodes, node);
if (node->section)
free(node->section);
if (node->text)
free(node->text);
node->section = section[0] ? strdup(section) : NULL;
node->text = strdup(text);
node->mtime = mtime;
node->offset = offset;
node->score = 0;
}
else
{
/*
* New node...
*/
node = help_new_node(relative, anchor, section, text, mtime, offset, 0);
}
/*
* Go through the text value and replace tabs and newlines with
* whitespace and eliminate extra whitespace...
*/
for (ptr = node->text, text = node->text; *ptr;)
if (isspace(*ptr & 255))
{
while (isspace(*ptr & 255))
ptr ++;
*text++ = ' ';
}
else if (text != ptr)
*text++ = *ptr++;
else
{
text ++;
ptr ++;
}
*text = '\0';
/*
* (Re)add the node to the array...
*/
cupsArrayAdd(hi->nodes, node);
break;
}
/*
* Get the offset of the next line...
*/
offset = cupsFileTell(fp);
}
cupsFileClose(fp);
if (node)
node->length = offset - node->offset;
return (0);
}
/*
* 'help_new_node()' - Create a new node and add it to an index.
*/
static help_node_t * /* O - Node pointer or NULL on error */
help_new_node(const char *filename, /* I - Filename */
const char *anchor, /* I - Anchor */
const char *section, /* I - Section */
const char *text, /* I - Text */
time_t mtime, /* I - Modification time */
off_t offset, /* I - Offset in file */
size_t length) /* I - Length in bytes */
{
help_node_t *n; /* Node */
DEBUG_printf(("help_new_node(filename=\"%s\", anchor=\"%s\", text=\"%s\", "
"mtime=%ld, offset=%ld, length=%ld)\n",
filename ? filename : "(nil)", anchor ? anchor : "(nil)",
text ? text : "(nil)", (long)mtime, (long)offset,
(long)length));
n = (help_node_t *)calloc(1, sizeof(help_node_t));
if (!n)
return (NULL);
n->filename = strdup(filename);
n->anchor = anchor ? strdup(anchor) : NULL;
n->section = (section && *section) ? strdup(section) : NULL;
n->text = strdup(text);
n->mtime = mtime;
n->offset = offset;
n->length = length;
return (n);
}
/*
* 'help_sort_nodes_by_name()' - Sort nodes by section, filename, and anchor.
*/
static int /* O - Difference */
help_sort_by_name(help_node_t *n1, /* I - First node */
help_node_t *n2) /* I - Second node */
{
int diff; /* Difference */
DEBUG_printf(("help_sort_by_name(n1=%p(%s#%s), n2=%p(%s#%s)\n",
n1, n1->filename, n1->anchor ? n1->anchor : "",
n2, n2->filename, n2->anchor ? n2->anchor : ""));
if ((diff = strcmp(n1->filename, n2->filename)) != 0)
return (diff);
if (!n1->anchor && !n2->anchor)
return (0);
else if (!n1->anchor)
return (-1);
else if (!n2->anchor)
return (1);
else
return (strcmp(n1->anchor, n2->anchor));
}
/*
* 'help_sort_nodes_by_score()' - Sort nodes by score and text.
*/
static int /* O - Difference */
help_sort_by_score(help_node_t *n1, /* I - First node */
help_node_t *n2) /* I - Second node */
{
int diff; /* Difference */
DEBUG_printf(("help_sort_by_score(n1=%p(%d \"%s\" \"%s\"), "
"n2=%p(%d \"%s\" \"%s\")\n",
n1, n1->score, n1->section ? n1->section : "", n1->text,
n2, n2->score, n2->section ? n2->section : "", n2->text));
if (n1->score != n2->score)
return (n1->score - n2->score);
if (n1->section && !n2->section)
return (1);
else if (!n1->section && n2->section)
return (-1);
else if (n1->section && n2->section &&
(diff = strcmp(n1->section, n2->section)) != 0)
return (diff);
return (strcasecmp(n1->text, n2->text));
}
/*
* End of "$Id$".
*/
+77
Ver Arquivo
@@ -0,0 +1,77 @@
/*
* "$Id$"
*
* On-line help index definitions for the Common UNIX Printing System (CUPS).
*
* 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
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
#ifndef _CUPS_HELP_INDEX_H_
# define _CUPS_HELP_INDEX_H_
/*
* Include necessary headers...
*/
# include <cups/array.h>
/*
* Data structures...
*/
typedef struct /**** Help node structure... ****/
{
char *filename; /* Filename, relative to help dir */
char *section; /* Section name (NULL if none) */
char *anchor; /* Anchor name (NULL if none) */
char *text; /* Text in anchor */
time_t mtime; /* Last modification time */
off_t offset; /* Offset in file */
size_t length; /* Length in bytes */
int score; /* Search score */
} help_node_t;
typedef struct /**** Help index structure ****/
{
int search; /* 1 = search index, 0 = normal */
cups_array_t *nodes; /* Nodes sorted by filename */
cups_array_t *sorted; /* Nodes sorted by score + text */
} help_index_t;
/*
* Functions...
*/
extern void helpDeleteIndex(help_index_t *hi);
extern help_node_t *helpFindNode(help_index_t *hi, const char *filename,
const char *anchor);
extern help_index_t *helpLoadIndex(const char *hifile, const char *directory);
extern int helpSaveIndex(help_index_t *hi, const char *hifile);
extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query,
const char *section,
const char *filename);
#endif /* !_CUPS_HELP_INDEX_H_ */
/*
* End of "$Id$".
*/
+387
Ver Arquivo
@@ -0,0 +1,387 @@
/*
* "$Id$"
*
* On-line help CGI for the Common UNIX Printing System (CUPS).
*
* 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
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
help_index_t *hi, /* Help index */
*si; /* Search index */
help_node_t *n; /* Current help node */
int i; /* Looping var */
const char *query; /* Search query */
const char *cache_dir; /* CUPS_CACHEDIR environment variable */
const char *docroot; /* CUPS_DOCROOT environment variable */
const char *helpfile; /* Current help file */
const char *topic; /* Current topic */
char topic_data[1024]; /* Topic form data */
const char *section; /* Current section */
char filename[1024], /* Filename */
directory[1024]; /* Directory */
cups_file_t *fp; /* Help file */
char line[1024]; /* Line from file */
int printable; /* Show printable version? */
/*
* Get any form variables...
*/
cgiInitialize();
printable = cgiGetVariable("PRINTABLE") != NULL;
/*
* Set the web interface section...
*/
cgiSetVariable("SECTION", "help");
/*
* Load the help index...
*/
if ((cache_dir = getenv("CUPS_CACHEDIR")) == NULL)
cache_dir = CUPS_CACHEDIR;
snprintf(filename, sizeof(filename), "%s/help.index", cache_dir);
if ((docroot = getenv("CUPS_DOCROOT")) == NULL)
docroot = CUPS_DOCROOT;
snprintf(directory, sizeof(directory), "%s/help", docroot);
fprintf(stderr, "DEBUG: helpLoadIndex(filename=\"%s\", directory=\"%s\")\n",
filename, directory);
hi = helpLoadIndex(filename, directory);
if (!hi)
{
perror(filename);
cgiStartHTML(cgiText(_("Help")));
cgiSetVariable("ERROR", "Unable to load help index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return (1);
}
fprintf(stderr, "DEBUG: %d nodes in help index...\n",
cupsArrayCount(hi->nodes));
/*
* See if we are viewing a file...
*/
for (i = 0; i < argc; i ++)
fprintf(stderr, "argv[%d]=\"%s\"\n", i, argv[i]);
if ((helpfile = getenv("PATH_INFO")) != NULL)
{
helpfile ++;
if (!*helpfile)
helpfile = NULL;
}
if (helpfile)
{
/*
* Verify that the help file exists and is part of the index...
*/
snprintf(filename, sizeof(filename), "%s/help/%s", docroot, helpfile);
fprintf(stderr, "DEBUG: helpfile=\"%s\", filename=\"%s\"\n",
helpfile, filename);
if (access(filename, R_OK))
{
perror(filename);
cgiStartHTML(cgiText(_("Help")));
cgiSetVariable("ERROR", "Unable to access help file!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return (1);
}
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
{
cgiStartHTML(cgiText(_("Help")));
cgiSetVariable("ERROR", "Help file not in index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return (1);
}
/*
* Set the page title and save the help file...
*/
cgiSetVariable("HELPFILE", helpfile);
cgiSetVariable("HELPTITLE", n->text);
/*
* Send a standard page header...
*/
if (printable)
puts("Content-Type: text/html;charset=utf-8\n");
else
cgiStartHTML(n->text);
}
else
{
/*
* Send a standard page header...
*/
cgiStartHTML(cgiText(_("Help")));
}
/*
* Do a search as needed...
*/
query = cgiGetVariable("QUERY");
topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
query ? query : "(null)", topic ? topic : "(null)");
if (si)
{
help_node_t *nn; /* Parent node */
fprintf(stderr,
"DEBUG: si=%p, si->sorted=%p, cupsArrayCount(si->sorted)=%d\n", si,
si->sorted, cupsArrayCount(si->sorted));
for (i = 0, n = (help_node_t *)cupsArrayFirst(si->sorted);
n;
i ++, n = (help_node_t *)cupsArrayNext(si->sorted))
{
if (helpfile && n->anchor)
snprintf(line, sizeof(line), "#%s", n->anchor);
else if (n->anchor)
snprintf(line, sizeof(line), "/help/%s?QUERY=%s#%s", n->filename,
query ? query : "", n->anchor);
else
snprintf(line, sizeof(line), "/help/%s?QUERY=%s", n->filename,
query ? query : "");
cgiSetArray("QTEXT", i, n->text);
cgiSetArray("QLINK", i, line);
if (!helpfile && n->anchor)
{
nn = helpFindNode(hi, n->filename, NULL);
snprintf(line, sizeof(line), "/help/%s?QUERY=%s", nn->filename,
query ? query : "");
cgiSetArray("QPTEXT", i, nn->text);
cgiSetArray("QPLINK", i, line);
}
else
{
cgiSetArray("QPTEXT", i, "");
cgiSetArray("QPLINK", i, "");
}
fprintf(stderr, "DEBUG: [%d] = \"%s\" @ \"%s\"\n", i, n->text, line);
}
helpDeleteIndex(si);
}
/*
* OK, now list the bookmarks within the index...
*/
for (i = 0, section = NULL, n = (help_node_t *)cupsArrayFirst(hi->sorted);
n;
n = (help_node_t *)cupsArrayNext(hi->sorted))
{
if (n->anchor)
continue;
/*
* Add a section link as needed...
*/
if (n->section &&
(!section || strcmp(n->section, section)))
{
/*
* Add a link for this node...
*/
snprintf(line, sizeof(line), "/help/?TOPIC=%s&QUERY=%s",
cgiFormEncode(topic_data, n->section, sizeof(topic_data)),
query ? query : "");
cgiSetArray("BMLINK", i, line);
cgiSetArray("BMTEXT", i, n->section);
cgiSetArray("BMINDENT", i, "0");
i ++;
section = n->section;
}
if (!topic || strcmp(n->section, topic))
continue;
/*
* Add a link for this node...
*/
snprintf(line, sizeof(line), "/help/%s?TOPIC=%s&QUERY=%s", n->filename,
cgiFormEncode(topic_data, n->section, sizeof(topic_data)),
query ? query : "");
cgiSetArray("BMLINK", i, line);
cgiSetArray("BMTEXT", i, n->text);
cgiSetArray("BMINDENT", i, "1");
i ++;
if (helpfile && !strcmp(helpfile, n->filename))
{
help_node_t *nn; /* Pointer to sub-node */
cupsArraySave(hi->sorted);
for (nn = (help_node_t *)cupsArrayFirst(hi->sorted);
nn;
nn = (help_node_t *)cupsArrayNext(hi->sorted))
if (nn->anchor && !strcmp(helpfile, nn->filename))
{
/*
* Add a link for this node...
*/
snprintf(line, sizeof(line), "#%s", nn->anchor);
cgiSetArray("BMLINK", i, line);
cgiSetArray("BMTEXT", i, nn->text);
cgiSetArray("BMINDENT", i, "2");
i ++;
}
cupsArrayRestore(hi->sorted);
}
}
/*
* Show the search and bookmark content...
*/
if (!helpfile || !printable)
cgiCopyTemplateLang("help-header.tmpl");
else
cgiCopyTemplateLang("help-printable.tmpl");
/*
* If we are viewing a file, copy it in now...
*/
if (helpfile)
{
if ((fp = cupsFileOpen(filename, "r")) != NULL)
{
int inbody; /* Are we inside the body? */
inbody = 0;
while (cupsFileGets(fp, line, sizeof(line)))
{
if (inbody)
{
if (!strncasecmp(line, "</BODY>", 7))
break;
printf("%s\n", line);
}
else if (!strncasecmp(line, "<BODY", 5))
inbody = 1;
}
cupsFileClose(fp);
}
else
{
perror(filename);
cgiSetVariable("ERROR", "Unable to open help file.");
cgiCopyTemplateLang("error.tmpl");
}
}
/*
* Send a standard trailer...
*/
if (!printable)
cgiEndHTML();
else
puts("</BODY>\n</HTML>");
/*
* Delete the index...
*/
helpDeleteIndex(hi);
/*
* Return with no errors...
*/
return (0);
}
/*
* End of "$Id$".
*/
+153 -55
Ver Arquivo
@@ -1,86 +1,184 @@
/*
* "$Id$"
*
* CGI HTML functions.
* HTML support functions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 by Easy Software Products.
* Copyright 1997-2006 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* cgiStartHTML() - Start an HTML document stream.
* cgiEndHTML() - End an HTML document stream.
* cgiEndHTML() - End a HTML page.
* cgiFormEncode() - Encode a string as a form variable...
* cgiStartHTML() - Start a HTML page.
* cgi_null_passwd() - Return a NULL password for authentication.
*/
#include "cgi.h"
#include <stdarg.h>
/*
* Include necessary headers...
*/
#include "cgi-private.h"
/*
* 'cgiStartHTML()' - Start an HTML document stream.
* Local functions...
*/
static const char *cgi_null_passwd(const char *prompt);
/*
* 'cgiEndHTML()' - End a HTML page.
*/
void
cgiStartHTML(FILE *out, /* I - Output file to use */
const char *stylesheet, /* I - Stylesheet to use */
const char *author, /* I - Author name */
const char *keywords, /* I - Search keywords */
const char *description, /* I - Description of document */
const char *title, /* I - Title for page */
...) /* I - Any addition args for title */
cgiEndHTML(void)
{
va_list ap; /* Argument pointer */
/*
* Send the standard trailer...
*/
fputs("Content-type: text/html\n\n", out);
fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" "
"\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n", out);
fputs("<HTML>\n", out);
fputs("<HEAD>\n", out);
fputs("\t<TITLE>\n", out);
va_start(ap, title);
vfprintf(out, title, ap);
va_end(ap);
fputs("</TITLE>\n", out);
if (stylesheet)
fprintf(out, "\t<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"%s\">\n",
stylesheet);
if (author)
fprintf(out, "\t<META NAME=\"AUTHOR\" CONTENT=\"%s\">\n", author);
if (keywords)
fprintf(out, "\t<META NAME=\"KEYWORDS\" CONTENT=\"%s\">\n", keywords);
if (description)
fprintf(out, "\t<META NAME=\"DESCRIPTION\" CONTENT=\"%s\">\n", description);
fputs("</HEAD>\n", out);
fputs("<BODY>\n", out);
cgiCopyTemplateLang("trailer.tmpl");
}
/*
* 'cgiEndHTML()' - End an HTML document stream.
* 'cgiFormEncode()' - Encode a string as a form variable...
*/
char * /* O - Destination string */
cgiFormEncode(char *dst, /* I - Destination string */
const char *src, /* I - Source string */
size_t dstsize) /* I - Size of destination string */
{
char *dstptr, /* Pointer into destination */
*dstend; /* End of destination */
static const char *hex = /* Hexadecimal characters */
"0123456789ABCDEF";
/*
* Mark the end of the string...
*/
dstend = dst + dstsize - 1;
/*
* Loop through the source string and copy...
*/
for (dstptr = dst; *src && dstptr < dstend;)
{
switch (*src)
{
case ' ' :
/*
* Encode spaces with a "+"...
*/
*dstptr++ = '+';
src ++;
break;
case '&' :
case '%' :
case '+' :
/*
* Encode special characters with %XX escape...
*/
if (dstptr < (dstend - 2))
{
*dstptr++ = '%';
*dstptr++ = hex[(*src & 255) >> 4];
*dstptr++ = hex[*src & 15];
src ++;
}
break;
default :
/*
* Copy other characters literally...
*/
*dstptr++ = *src++;
break;
}
}
/*
* Nul-terminate the destination string...
*/
*dstptr = '\0';
/*
* Return the encoded string...
*/
return (dst);
}
/*
* 'cgiStartHTML()' - Start a HTML page.
*/
void
cgiEndHTML(FILE *out) /* I - Output file to use */
cgiStartHTML(const char *title) /* I - Title of page */
{
fputs("</BODY>\n", out);
fputs("</HTML>\n", out);
/*
* Disable any further authentication attempts...
*/
cupsSetPasswordCB(cgi_null_passwd);
/*
* Tell the client to expect UTF-8 encoded HTML...
*/
puts("Content-Type: text/html;charset=utf-8\n");
/*
* Send a standard header...
*/
cgiSetVariable("TITLE", title);
cgiSetServerVersion();
cgiCopyTemplateLang("header.tmpl");
}
/*
* 'cgi_null_passwd()' - Return a NULL password for authentication.
*/
static const char * /* O - NULL */
cgi_null_passwd(const char *prompt) /* I - Prompt string (unused) */
{
(void)prompt;
fprintf(stderr, "DEBUG: cgi_null_passwd(prompt=\"%s\") called!\n",
prompt ? prompt : "(null)");
return (NULL);
}
+1188 -161
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-55
Ver Arquivo
@@ -1,55 +0,0 @@
/*
* "$Id$"
*
* IPP variable definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
/*
* Include necessary headers...
*/
#include <ctype.h>
#include <cups/cups.h>
#include <cups/debug.h>
#include <cups/language.h>
#include <cups/string.h>
#include "cgi.h"
/*
* Definitions...
*/
#define TEMPLATES ippGetTemplateDir()
/*
* Prototype...
*/
extern char *ippGetTemplateDir(void);
extern void ippSetServerVersion(void);
extern void ippSetCGIVars(ipp_t *, const char *, const char *);
/*
* End of "$Id$".
*/
+123 -59
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Job status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,38 +15,45 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
* main() - Main entry for CGI.
* do_job_op() - Do a job operation.
*/
/*
* Include necessary headers...
*/
#include "ipp-var.h"
#include "cgi-private.h"
/*
* Local functions...
*/
static void do_job_op(http_t *http, int job_id, ipp_op_t op);
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
http_t *http; /* Connection to the server */
const char *which_jobs; /* Which jobs to show */
ipp_t *request, /* IPP request */
*response; /* IPP response */
http_t *http; /* Connection to the server */
const char *op; /* Operation name */
const char *job_id_var; /* Job ID form variable */
int job_id; /* Job ID */
/*
* Get any form variables...
@@ -55,76 +62,73 @@ main(int argc, /* I - Number of command-line arguments */
cgiInitialize();
/*
* Get the request language...
* Set the web interface section...
*/
language = cupsLangDefault();
cgiSetVariable("SECTION", "jobs");
/*
* Connect to the HTTP server...
*/
http = httpConnect("localhost", ippPort());
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
/*
* Tell the client to expect HTML...
* Get the job ID, if any...
*/
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
cgiSetVariable("TITLE", "Jobs");
ippSetServerVersion();
cgiCopyTemplateLang(stdout, TEMPLATES, "header.tmpl", getenv("LANG"));
if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL)
job_id = atoi(job_id_var);
else
job_id = 0;
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* Do the operation...
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
"ipp://localhost/jobs");
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
{
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
/*
* Do the operation...
*/
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
if (!strcmp(op, "cancel-job"))
do_job_op(http, job_id, IPP_CANCEL_JOB);
else if (!strcmp(op, "hold-job"))
do_job_op(http, job_id, IPP_HOLD_JOB);
else if (!strcmp(op, "move-job"))
cgiMoveJobs(http, NULL, job_id);
else if (!strcmp(op, "release-job"))
do_job_op(http, job_id, IPP_RELEASE_JOB);
else if (!strcmp(op, "restart-job"))
do_job_op(http, job_id, IPP_RESTART_JOB);
else
{
/*
* Bad operation code... Display an error...
*/
cgiStartHTML(cgiText(_("Jobs")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
}
else
{
/*
* Show a list of jobs...
*/
cgiCopyTemplateLang(stdout, TEMPLATES, "trailer.tmpl", getenv("LANG"));
cgiStartHTML(cgiText(_("Jobs")));
cgiShowJobs(http, NULL);
cgiEndHTML();
}
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -134,6 +138,66 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* 'do_job_op()' - Do a job operation.
*/
static void
do_job_op(http_t *http, /* I - HTTP connection */
int job_id, /* I - Job ID */
ipp_op_t op) /* I - Operation to perform */
{
ipp_t *request; /* IPP request */
char uri[HTTP_MAX_URI]; /* Job URI */
const char *user; /* Username */
/*
* Build a job request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* job-uri or printer-uri (purge-jobs)
* requesting-user-name
*/
request = ippNewRequest(op);
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, uri);
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
/*
* Do the request and get back a response...
*/
ippDelete(cupsDoRequest(http, request, "/jobs"));
cgiStartHTML(cgiText(_("Jobs")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Job operation failed:"));
else if (op == IPP_CANCEL_JOB)
cgiCopyTemplateLang("job-cancel.tmpl");
else if (op == IPP_HOLD_JOB)
cgiCopyTemplateLang("job-hold.tmpl");
else if (op == IPP_RELEASE_JOB)
cgiCopyTemplateLang("job-release.tmpl");
else if (op == IPP_RESTART_JOB)
cgiCopyTemplateLang("job-restart.tmpl");
cgiEndHTML();
}
/*
* End of "$Id$".
*/
Arquivo binário não exibido.
+546 -205
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2000 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
@@ -15,278 +15,169 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
* main() - Main entry for CGI.
* print_command() - Send a print command to the printer.
* show_all_printers() - Show all printers...
* show_printer() - Show a single printer.
*/
/*
* Include necessary headers...
*/
#include "ipp-var.h"
#include "cgi-private.h"
#include <errno.h>
/*
* Local functions...
*/
void print_command(http_t *http, const char *printer, const char *command);
void show_all_printers(http_t *http, const char *username);
void show_printer(http_t *http, const char *printer);
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
cups_lang_t *language; /* Language information */
char *printer; /* Printer name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI];
/* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
const char *printer; /* Printer name */
const char *user; /* Username */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
const char *op; /* Operation to perform, if any */
static const char *def_attrs[] = /* Attributes for default printer */
{
"printer-name",
"printer-uri-supported"
};
/*
* Get any form variables...
*/
cgiInitialize();
op = cgiGetVariable("OP");
/*
* Get the request language...
* Set the web interface section...
*/
language = cupsLangDefault();
cgiSetVariable("SECTION", "printers");
/*
* See if we are displaying a printer or all printers...
*/
if ((printer = getenv("PATH_INFO")) != NULL)
{
printer ++;
if (!*printer)
printer = NULL;
}
/*
* See who is logged in...
*/
user = getenv("REMOTE_USER");
/*
* Connect to the HTTP server...
*/
http = httpConnect("localhost", ippPort());
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
/*
* Tell the client to expect HTML...
* Get the default printer...
*/
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
/*
* See if we need to show a list of printers or the status of a
* single printer...
*/
ippSetServerVersion();
printer = argv[0];
if (strcmp(printer, "/") == 0 || strcmp(printer, "printers.cgi") == 0)
{
printer = NULL;
cgiSetVariable("TITLE", cupsLangString(language, CUPS_MSG_PRINTER));
}
else
cgiSetVariable("TITLE", printer);
cgiCopyTemplateLang(stdout, TEMPLATES, "header.tmpl", getenv("LANG"));
if (op == NULL || strcasecmp(op, "print-test-page") != 0)
if (!op)
{
/*
* Get the printer info...
* Get the default destination...
*/
request = ippNew();
request = ippNewRequest(CUPS_GET_DEFAULT);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
if (printer == NULL)
{
/*
* Build a CUPS_GET_PRINTERS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
*/
request->request.op.operation_id = CUPS_GET_PRINTERS;
request->request.op.request_id = 1;
}
else
{
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
request->request.op.request_id = 1;
snprintf(uri, sizeof(uri), "ipp://%s/printers/%s", getenv("SERVER_NAME"),
printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
}
/*
* Do the request and get back a response...
*/
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char url[HTTP_MAX_URI]; /* New URL */
cgiSetVariable("DEFAULT_URI",
cgiRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
}
ippDelete(response);
}
/*
* Write the report...
* See if we need to show a list of printers or the status of a
* single printer...
*/
cgiCopyTemplateLang(stdout, TEMPLATES, "printers.tmpl", getenv("LANG"));
/*
* Get jobs for the specified printer if a printer has been chosen...
*/
if (printer != NULL)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNew();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request->request.op.operation_id = IPP_GET_JOBS;
request->request.op.request_id = 1;
snprintf(uri, sizeof(uri), "ipp://%s/printers/%s", getenv("SERVER_NAME"),
printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
}
}
if (!printer)
show_all_printers(http, user);
else
show_printer(http, printer);
}
else if (!strcasecmp(op, "print-self-test-page") && printer)
print_command(http, printer, "PrintSelfTestPage");
else if (!strcasecmp(op, "clean-print-heads") && printer)
print_command(http, printer, "Clean all");
else if (!strcasecmp(op, "print-test-page") && printer)
cgiPrintTestPage(http, printer);
else if (!strcasecmp(op, "move-jobs") && printer)
cgiMoveJobs(http, printer, 0);
else
{
/*
* Print a test page...
* Unknown/bad operation...
*/
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", printer);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNew();
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (getenv("REMOTE_USER") != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, getenv("REMOTE_USER"));
if (printer)
cgiStartHTML(printer);
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "root");
cgiStartHTML(cgiText(_("Printers")));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Test Page");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, uri + 15,
CUPS_DATADIR "/data/testprint.ps")) != NULL)
{
status = response->request.status.status_code;
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
}
else
status = IPP_GONE;
cgiSetVariable("PRINTER_NAME", printer);
if (status > IPP_OK_CONFLICT)
{
cgiSetVariable("ERROR", ippErrorString(status));
cgiCopyTemplateLang(stdout, TEMPLATES, "error.tmpl", getenv("LANG"));
}
else
cgiCopyTemplateLang(stdout, TEMPLATES, "test-page.tmpl", getenv("LANG"));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
cgiCopyTemplateLang(stdout, TEMPLATES, "trailer.tmpl", getenv("LANG"));
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -296,6 +187,456 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* 'print_command()' - Send a print command to the printer.
*/
void
print_command(http_t *http, /* I - Connection to server */
const char *printer, /* I - Printer */
const char *command) /* I - Command to send */
{
cups_file_t *fp; /* File pointer */
char filename[1024]; /* Temporary file */
ipp_t *request, /* IPP request */
*response; /* IPP response */
char uri[HTTP_MAX_URI], /* Printer URI */
resource[1024], /* POST resource path */
refresh[1024]; /* Refresh URL */
const char *user; /* Username */
/*
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* Create the CUPS command file to print...
*/
if ((fp = cupsTempFile2(filename, sizeof(filename))) == NULL)
{
cgiStartHTML(cgiText(_("Printer Maintenance")));
cgiSetVariable("MESSAGE", _("Unable to create temporary file:"));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return;
}
cupsFilePuts(fp, "#CUPS-COMMAND\n");
cupsFilePrintf(fp, "%s\n", command);
cupsFileClose(fp);
/*
* Point to the printer...
*/
snprintf(resource, sizeof(resource), "/printers/%s", printer);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", ippPort(), "/printers/%s", printer);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNewRequest(IPP_PRINT_JOB);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Printer Maintenance");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, resource,
filename)) != NULL)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
unlink(filename);
if (cupsLastError() <= IPP_OK_CONFLICT)
{
/*
* Automatically reload the printer status page...
*/
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
cgiStartHTML(cgiText(_("Printer Maintenance")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to send maintenance job:"));
else
{
cgiSetVariable("PRINTER_NAME", printer);
cgiCopyTemplateLang("maintenance.tmpl");
}
cgiEndHTML();
}
/*
* 'show_all_printers()' - Show all printers...
*/
void
show_all_printers(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
int i; /* Looping var */
ipp_t *request, /* IPP request */
*response; /* IPP response */
cups_array_t *printers; /* Array of printer objects */
ipp_attribute_t *printer, /* Printer object */
*attr; /* Current attribute */
int ascending, /* Order of printers (0 = descending) */
first, /* First printer to show */
count; /* Number of printers */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
http, user ? user : "(null)");
/*
* Show the standard header...
*/
cgiStartHTML(cgiText(_("Printers")));
/*
* Build a CUPS_GET_PRINTERS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-type
* printer-type-mask
* requesting-user-name
*/
request = ippNewRequest(CUPS_GET_PRINTERS);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type", 0);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
"printer-type-mask", CUPS_PRINTER_CLASS);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
cgiGetAttributes(request, "printers.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
printers = cgiGetIPPObjects(response, search);
count = cupsArrayCount(printers);
if (search)
cgiFreeSearch(search);
/*
* Figure out which printers to display...
*/
if ((var = cgiGetVariable("FIRST")) != NULL)
first = atoi(var);
else
first = 0;
if (first >= count)
first = count - CUPS_PAGE_MAX;
first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX;
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
else
ascending = 1;
if (ascending)
{
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, first);
i < CUPS_PAGE_MAX && printer;
i ++, printer = (ipp_attribute_t *)cupsArrayNext(printers))
{
cgiSetIPPObjectVars(printer, NULL, i);
cgiSetArray("cupscommand", i, "0");
for (attr = printer; attr; attr = attr->next)
if (attr->group_tag != IPP_TAG_PRINTER || !attr->name)
break;
else if (!strcmp(attr->name, "printer-type"))
{
if (attr->values[0].integer & CUPS_PRINTER_COMMANDS)
cgiSetArray("cupscommand", i, "1");
break;
}
}
}
else
{
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, count - first - 1);
i < CUPS_PAGE_MAX && printer;
i ++, printer = (ipp_attribute_t *)cupsArrayPrev(printers))
{
cgiSetIPPObjectVars(printer, NULL, i);
cgiSetArray("cupscommand", i, "0");
for (attr = printer; attr; attr = attr->next)
if (attr->group_tag == IPP_TAG_ZERO || !attr->name)
break;
else if (!strcmp(attr->name, "printer-type"))
{
if (attr->values[0].integer & CUPS_PRINTER_COMMANDS)
cgiSetArray("cupscommand", i, "1");
break;
}
}
}
/*
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/printers/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/printers/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
* Then show everything...
*/
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("printers-header.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("printers.tmpl");
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
/*
* Delete the response...
*/
cupsArrayDelete(printers);
ippDelete(response);
}
else
{
/*
* Show the error...
*/
cgiShowIPPError(_("Unable to get printer list:"));
}
cgiEndHTML();
}
/*
* 'show_printer()' - Show a single printer.
*/
void
show_printer(http_t *http, /* I - Connection to server */
const char *printer) /* I - Name of printer */
{
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
char uri[HTTP_MAX_URI]; /* Printer URI */
char refresh[1024]; /* Refresh URL */
fprintf(stderr, "DEBUG: show_printer(http=%p, printer=\"%s\")\n",
http, printer ? printer : "(null)");
/*
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "printers.tmpl");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
/*
* Got the result; set the CGI variables and check the status of a
* single-queue request...
*/
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if ((attr = ippFindAttribute(response, "printer-type",
IPP_TAG_ENUM)) != NULL)
{
cgiSetVariable("cupscommand",
(attr->values[0].integer & CUPS_PRINTER_COMMANDS) ?
"1" : "0");
}
if (printer && (attr = ippFindAttribute(response, "printer-state",
IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer == IPP_PRINTER_PROCESSING)
{
/*
* Printer is processing - automatically refresh the page until we
* are done printing...
*/
cgiFormEncode(uri, printer, sizeof(uri));
snprintf(refresh, sizeof(refresh), "10;URL=/printers/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
/*
* Delete the response...
*/
ippDelete(response);
/*
* Show the standard header...
*/
cgiStartHTML(printer);
/*
* Show the printer status...
*/
cgiCopyTemplateLang("printers.tmpl");
/*
* Show jobs for the specified printer...
*/
cgiCopyTemplateLang("printer-jobs-header.tmpl");
cgiShowJobs(http, printer);
}
else
{
/*
* Show the IPP error...
*/
cgiStartHTML(printer);
cgiShowIPPError(_("Unable to get printer status:"));
}
cgiEndHTML();
}
/*
* End of "$Id$".
*/
+368
Ver Arquivo
@@ -0,0 +1,368 @@
/*
* "$Id$"
*
* Search routines for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* cgiCompileSearch() - Compile a search string.
* cgiDoSearch() - Do a search of some text.
* cgiFreeSearch() - Free a compiled search context.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
#include <regex.h>
/*
* 'cgiCompileSearch()' - Compile a search string.
*/
void * /* O - Search context */
cgiCompileSearch(const char *query) /* I - Query string */
{
regex_t *re; /* Regular expression */
char *s, /* Regular expression string */
*sptr, /* Pointer into RE string */
*sword; /* Pointer to start of word */
int slen; /* Allocated size of RE string */
const char *qptr, /* Pointer into query string */
*qend; /* End of current word */
const char *prefix; /* Prefix to add to next word */
int quoted; /* Word is quoted */
int wlen; /* Word length */
char *lword; /* Last word in query */
DEBUG_printf(("help_compile_search(query=\"%s\")\n", query ? query : "(nil)"));
/*
* Allocate a regular expression storage structure...
*/
re = (regex_t *)calloc(1, sizeof(regex_t));
/*
* Allocate a buffer to hold the regular expression string, starting
* at 1024 bytes or 3 times the length of the query string, whichever
* is greater. We'll expand the string as needed...
*/
slen = strlen(query) * 3;
if (slen < 1024)
slen = 1024;
s = (char *)malloc(slen);
/*
* Copy the query string to the regular expression, handling basic
* AND and OR logic...
*/
prefix = ".*";
qptr = query;
sptr = s;
lword = NULL;
while (*qptr)
{
/*
* Skip leading whitespace...
*/
while (isspace(*qptr & 255))
qptr ++;
if (!*qptr)
break;
/*
* Find the end of the current word...
*/
if (*qptr == '\"' || *qptr == '\'')
{
/*
* Scan quoted string...
*/
quoted = *qptr ++;
for (qend = qptr; *qend && *qend != quoted; qend ++);
if (!*qend)
{
/*
* No closing quote, error out!
*/
free(s);
free(re);
if (lword)
free(lword);
return (NULL);
}
}
else
{
/*
* Scan whitespace-delimited string...
*/
quoted = 0;
for (qend = qptr + 1; *qend && !isspace(*qend); qend ++);
}
wlen = qend - qptr;
/*
* Look for logic words: AND, OR
*/
if (wlen == 3 && !strncasecmp(qptr, "AND", 3))
{
/*
* Logical AND with the following text...
*/
if (sptr > s)
prefix = ".*";
qptr = qend;
}
else if (wlen == 2 && !strncasecmp(qptr, "OR", 2))
{
/*
* Logical OR with the following text...
*/
if (sptr > s)
prefix = ".*|.*";
qptr = qend;
}
else
{
/*
* Add a search word, making sure we have enough room for the
* string + RE overhead...
*/
wlen = (sptr - s) + 4 * wlen + 2 * strlen(prefix) + 4;
if (wlen > slen)
{
/*
* Expand the RE string buffer...
*/
char *temp; /* Temporary string pointer */
slen = wlen + 128;
temp = (char *)realloc(s, slen);
if (!temp)
{
free(s);
free(re);
if (lword)
free(lword);
return (NULL);
}
sptr = temp + (sptr - s);
s = temp;
}
/*
* Add the prefix string...
*/
strcpy(sptr, prefix);
sptr += strlen(sptr);
/*
* Then quote the remaining word characters as needed for the
* RE...
*/
sword = sptr;
while (qptr < qend)
{
/*
* Quote: ^ . [ $ ( ) | * + ? { \
*/
if (strchr("^.[$()|*+?{\\", *qptr))
*sptr++ = '\\';
*sptr++ = *qptr++;
}
/*
* For "word1 AND word2", add reciprocal "word2 AND word1"...
*/
if (!strcmp(prefix, ".*") && lword)
{
char *lword2; /* New "last word" */
lword2 = strdup(sword);
strcpy(sptr, ".*|.*");
sptr += 5;
strcpy(sptr, lword2);
sptr += strlen(sptr);
strcpy(sptr, ".*");
sptr += 2;
strcpy(sptr, lword);
sptr += strlen(sptr);
free(lword);
lword = lword2;
}
else
{
if (lword)
free(lword);
lword = strdup(sword);
}
prefix = ".*|.*";
}
/*
* Advance to the next string...
*/
if (quoted)
qptr ++;
}
if (lword)
free(lword);
if (sptr > s)
strcpy(sptr, ".*");
else
{
/*
* No query data, return NULL...
*/
free(s);
free(re);
return (NULL);
}
/*
* Compile the regular expression...
*/
DEBUG_printf((" s=\"%s\"\n", s));
if (regcomp(re, s, REG_EXTENDED | REG_ICASE))
{
free(re);
free(s);
return (NULL);
}
/*
* Free the RE string and return the new regular expression we compiled...
*/
free(s);
return ((void *)re);
}
/*
* 'cgiDoSearch()' - Do a search of some text.
*/
int /* O - Number of matches */
cgiDoSearch(void *search, /* I - Search context */
const char *text) /* I - Text to search */
{
int i; /* Looping var */
regmatch_t matches[100]; /* RE matches */
/*
* Range check...
*/
if (!search || !text)
return (0);
/*
* Do a lookup...
*/
if (!regexec((regex_t *)search, text, sizeof(matches) / sizeof(matches[0]),
matches, 0))
{
/*
* Figure out the number of matches in the string...
*/
for (i = 0; i < (int)(sizeof(matches) / sizeof(matches[0])); i ++)
if (matches[i].rm_so < 0)
break;
return (i);
}
else
return (0);
}
/*
* 'cgiFreeSearch()' - Free a compiled search context.
*/
void
cgiFreeSearch(void *search) /* I - Search context */
{
regfree((regex_t *)search);
}
/*
* End of "$Id$".
*/
+301 -82
Ver Arquivo
@@ -3,41 +3,48 @@
*
* CGI template function.
*
* Copyright 1997-2000 by Easy Software Products.
* Copyright 1997-2006 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* cgiCopyTemplateFile() - Copy a template file and replace all the
* '{variable}' strings with the variable value.
* cgiCopyTemplateLang() - Copy a template file using a language...
* cgiGetTemplateDir() - Get the templates directory...
* cgiSetServerVersion() - Set the server name and CUPS version...
* cgi_copy() - Copy the template file, substituting as needed...
* cgi_puts() - Put a string to the output file, quoting as
* needed...
*/
#include "cgi.h"
#include "cgi-private.h"
#include <errno.h>
/*
* Local functions...
*/
static void cgi_copy(FILE *out, FILE *in, int element, char term);
static void cgi_copy(FILE *out, FILE *in, int element, char term,
int indent);
static void cgi_puts(const char *s, FILE *out);
static void cgi_puturi(const char *s, FILE *out);
/*
@@ -52,18 +59,25 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
FILE *in; /* Input file */
fprintf(stderr, "DEBUG: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
tmpl ? tmpl : "(null)");
/*
* Open the template file...
*/
if ((in = fopen(tmpl, "r")) == NULL)
{
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
tmpl ? tmpl : "(null)", strerror(errno));
return;
}
/*
* Parse the file to the end...
*/
cgi_copy(out, in, 0, 0);
cgi_copy(out, in, 0, 0, 0);
/*
* Close the template file and return...
@@ -78,60 +92,74 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
*/
void
cgiCopyTemplateLang(FILE *out, /* I - Output file */
const char *directory, /* I - Directory */
const char *tmpl, /* I - Base filename */
const char *lang) /* I - Language */
cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
{
int i; /* Looping var */
char filename[1024], /* Filename */
locale[16]; /* Locale name */
FILE *in; /* Input file */
int i; /* Looping var */
char filename[1024], /* Filename */
locale[16]; /* Locale name */
const char *directory, /* Directory for templates */
*lang; /* Language */
FILE *in; /* Input file */
fprintf(stderr, "DEBUG: cgiCopyTemplateLang(tmpl=\"%s\")\n",
tmpl ? tmpl : "(null)");
/*
* Convert the language to a locale name...
*/
if (lang != NULL)
if ((lang = getenv("LANG")) != NULL)
{
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i]))
if (isalnum(lang[i] & 255) || lang[i] == '_')
locale[i] = tolower(lang[i]);
else
else if (lang[i] == '-')
locale[i] = '_';
else
break;
locale[i] = '\0';
}
else
locale[0] = '\0';
fprintf(stderr, "DEBUG: locale=\"%s\"...\n", locale);
/*
* See if we have a template file for this language...
*/
sprintf(filename, "%s/%s/%s", directory, locale, tmpl);
directory = cgiGetTemplateDir();
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
if (access(filename, 0))
{
locale[2] = '\0';
sprintf(filename, "%s/%s/%s", directory, locale, tmpl);
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
if (access(filename, 0))
sprintf(filename, "%s/%s", directory, tmpl);
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
}
fprintf(stderr, "DEBUG: Template file is \"%s\"...\n", filename);
/*
* Open the template file...
*/
if ((in = fopen(filename, "r")) == NULL)
{
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
filename, strerror(errno));
return;
}
/*
* Parse the file to the end...
*/
cgi_copy(out, in, 0, 0);
cgi_copy(stdout, in, 0, 0, 0);
/*
* Close the template file and return...
@@ -141,30 +169,80 @@ cgiCopyTemplateLang(FILE *out, /* I - Output file */
}
/*
* 'cgiGetTemplateDir()' - Get the templates directory...
*/
char * /* O - Template directory */
cgiGetTemplateDir(void)
{
const char *datadir; /* CUPS_DATADIR env var */
static char templates[1024] = ""; /* Template directory */
if (!templates[0])
{
/*
* Build the template directory pathname...
*/
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
datadir = CUPS_DATADIR;
snprintf(templates, sizeof(templates), "%s/templates", datadir);
}
return (templates);
}
/*
* 'cgiSetServerVersion()' - Set the server name and CUPS version...
*/
void
cgiSetServerVersion(void)
{
cgiSetVariable("SERVER_NAME", getenv("SERVER_NAME"));
cgiSetVariable("REMOTE_USER", getenv("REMOTE_USER"));
cgiSetVariable("CUPS_VERSION", CUPS_SVERSION);
#ifdef LC_TIME
setlocale(LC_TIME, "");
#endif /* LC_TIME */
}
/*
* 'cgi_copy()' - Copy the template file, substituting as needed...
*/
static void
cgi_copy(FILE *out, /* I - Output file */
FILE *in, /* I - Input file */
int element, /* I - Element number (0 to N) */
char term) /* I - Terminating character */
cgi_copy(FILE *out, /* I - Output file */
FILE *in, /* I - Input file */
int element, /* I - Element number (0 to N) */
char term, /* I - Terminating character */
int indent) /* I - Debug info indentation */
{
int ch; /* Character from file */
char op; /* Operation */
char name[255], /* Name of variable */
*nameptr, /* Pointer into name */
innername[255], /* Inner comparison name */
*innerptr, /* Pointer into inner name */
*s; /* String pointer */
const char *value; /* Value of variable */
const char *innerval; /* Inner value */
char outval[1024], /* Output string */
compare[1024]; /* Comparison string */
int result; /* Result of comparison */
int ch; /* Character from file */
char op; /* Operation */
char name[255], /* Name of variable */
*nameptr, /* Pointer into name */
innername[255], /* Inner comparison name */
*innerptr, /* Pointer into inner name */
*s; /* String pointer */
const char *value; /* Value of variable */
const char *innerval; /* Inner value */
const char *outptr; /* Output string pointer */
char outval[1024], /* Formatted output string */
compare[1024]; /* Comparison string */
int result; /* Result of comparison */
int uriencode; /* Encode as URI */
fprintf(stderr, "DEBUG: %*sStarting at file position %ld...\n", indent, "",
ftell(in));
/*
* Parse the file to the end...
*/
@@ -178,9 +256,13 @@ cgi_copy(FILE *out, /* I - Output file */
* Get a variable name...
*/
uriencode = 0;
for (s = name; (ch = getc(in)) != EOF;)
if (strchr("}]<>=!", ch))
if (strchr("}]<>=! \t\n", ch))
break;
else if (s == name && ch == '%')
uriencode = 1;
else if (s > name && ch == '?')
break;
else if (s < (name + sizeof(name) - 1))
@@ -188,6 +270,23 @@ cgi_copy(FILE *out, /* I - Output file */
*s = '\0';
if (s == name && isspace(ch & 255))
{
fprintf(stderr, "DEBUG: %*sLone { at %ld...\n", indent, "", ftell(in));
if (out)
{
putc('{', out);
putc(ch, out);
}
continue;
}
if (ch == '}')
fprintf(stderr, "DEBUG: %*s\"{%s}\" at %ld...\n", indent, "", name,
ftell(in));
/*
* See if it has a value...
*/
@@ -198,19 +297,25 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert value only if it exists...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
{
*nameptr++ = '\0';
if ((value = cgiGetArray(name + 1, atoi(nameptr) - 1)) != NULL)
strcpy(outval, value);
outptr = value;
else
{
outval[0] = '\0';
outptr = outval;
}
}
if ((value = cgiGetArray(name + 1, element)) != NULL)
strcpy(outval, value);
else if ((value = cgiGetArray(name + 1, element)) != NULL)
outptr = value;
else
{
outval[0] = '\0';
outptr = outval;
}
}
else if (name[0] == '#')
{
@@ -222,6 +327,8 @@ cgi_copy(FILE *out, /* I - Output file */
sprintf(outval, "%d", cgiGetSize(name + 1));
else
sprintf(outval, "%d", element + 1);
outptr = outval;
}
else if (name[0] == '[')
{
@@ -234,23 +341,31 @@ cgi_copy(FILE *out, /* I - Output file */
int count; /* Number of elements */
if (isdigit(name[1]))
if (isdigit(name[1] & 255))
count = atoi(name + 1);
else
count = cgiGetSize(name + 1);
pos = ftell(in);
fprintf(stderr, "DEBUG: %*sLooping on \"%s\" at %ld, count=%d...\n",
indent, "", name + 1, pos, count);
if (count > 0)
{
for (i = 0; i < count; i ++)
{
fseek(in, pos, SEEK_SET);
cgi_copy(out, in, i, '}');
if (i)
fseek(in, pos, SEEK_SET);
cgi_copy(out, in, i, '}', indent + 2);
}
}
else
cgi_copy(NULL, in, 0, '}');
cgi_copy(NULL, in, 0, '}', indent + 2);
fprintf(stderr, "DEBUG: %*sFinished looping on \"%s\"...\n", indent,
"", name + 1);
continue;
}
@@ -260,18 +375,24 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert variable or variable name (if element is NULL)...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
{
*nameptr++ = '\0';
if ((value = cgiGetArray(name, atoi(nameptr) - 1)) == NULL)
sprintf(outval, "{%s}", name);
{
snprintf(outval, sizeof(outval), "{%s}", name);
outptr = outval;
}
else
strcpy(outval, value);
outptr = value;
}
else if ((value = cgiGetArray(name, element)) == NULL)
sprintf(outval, "{%s}", name);
{
snprintf(outval, sizeof(outval), "{%s}", name);
outptr = outval;
}
else
strcpy(outval, value);
outptr = value;
}
/*
@@ -285,7 +406,12 @@ cgi_copy(FILE *out, /* I - Output file */
*/
if (out)
cgi_puts(outval, out);
{
if (uriencode)
cgi_puturi(outptr, out);
else
cgi_puts(outptr, out);
}
continue;
}
@@ -300,13 +426,16 @@ cgi_copy(FILE *out, /* I - Output file */
* {name!value?true:false} Not equal
*/
op = ch;
if (ch == '?')
{
/*
* Test for existance...
*/
result = cgiGetArray(name, element) != NULL && outval[0];
result = cgiGetArray(name, element) != NULL && outptr[0];
compare[0] = '\0';
}
else
{
@@ -314,11 +443,11 @@ cgi_copy(FILE *out, /* I - Output file */
* Compare to a string...
*/
op = ch;
for (s = compare; (ch = getc(in)) != EOF;)
if (ch == '?')
break;
else if (s >= (compare + sizeof(compare) - 1))
continue;
else if (ch == '#')
{
sprintf(s, "%d", element + 1);
@@ -339,25 +468,25 @@ cgi_copy(FILE *out, /* I - Output file */
if (innername[0] == '#')
sprintf(s, "%d", cgiGetSize(innername + 1));
else if ((innerptr = strrchr(innername, '-')) != NULL &&
isdigit(innerptr[1]))
isdigit(innerptr[1] & 255))
{
*innerptr++ = '\0';
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
*s = '\0';
else
strcpy(s, innerval);
strlcpy(s, innerval, sizeof(compare) - (s - compare));
}
else if (innername[0] == '?')
{
if ((innerval = cgiGetArray(innername + 1, element)) == NULL)
*s = '\0';
else
strcpy(s, innerval);
strlcpy(s, innerval, sizeof(compare) - (s - compare));
}
else if ((innerval = cgiGetArray(innername, element)) == NULL)
sprintf(s, "{%s}", innername);
snprintf(s, sizeof(compare) - (s - compare), "{%s}", innername);
else
strcpy(s, innerval);
strlcpy(s, innerval, sizeof(compare) - (s - compare));
s += strlen(s);
}
@@ -369,7 +498,12 @@ cgi_copy(FILE *out, /* I - Output file */
*s = '\0';
if (ch != '?')
{
fprintf(stderr,
"DEBUG: %*sBad terminator '%c' at file position %ld...\n",
indent, "", ch, ftell(in));
return;
}
/*
* Do the comparison...
@@ -378,16 +512,16 @@ cgi_copy(FILE *out, /* I - Output file */
switch (op)
{
case '<' :
result = strcasecmp(outval, compare) < 0;
result = strcasecmp(outptr, compare) < 0;
break;
case '>' :
result = strcasecmp(outval, compare) > 0;
result = strcasecmp(outptr, compare) > 0;
break;
case '=' :
result = strcasecmp(outval, compare) == 0;
result = strcasecmp(outptr, compare) == 0;
break;
case '!' :
result = strcasecmp(outval, compare) != 0;
result = strcasecmp(outptr, compare) != 0;
break;
default :
result = 1;
@@ -395,14 +529,21 @@ cgi_copy(FILE *out, /* I - Output file */
}
}
fprintf(stderr,
"DEBUG: %*sStarting \"{%s%c%s\" at %ld, result=%d...\n",
indent, "", name, op, compare, ftell(in), result);
if (result)
{
/*
* Comparison true; output first part and ignore second...
*/
cgi_copy(out, in, element, ':');
cgi_copy(NULL, in, element, '}');
fprintf(stderr, "DEBUG: %*sOutput first part...\n", indent, "");
cgi_copy(out, in, element, ':', indent + 2);
fprintf(stderr, "DEBUG: %*sSkip second part...\n", indent, "");
cgi_copy(NULL, in, element, '}', indent + 2);
}
else
{
@@ -410,9 +551,15 @@ cgi_copy(FILE *out, /* I - Output file */
* Comparison false; ignore first part and output second...
*/
cgi_copy(NULL, in, element, ':');
cgi_copy(out, in, element, '}');
fprintf(stderr, "DEBUG: %*sSkip first part...\n", indent, "");
cgi_copy(NULL, in, element, ':', indent + 2);
fprintf(stderr, "DEBUG: %*sOutput second part...\n", indent, "");
cgi_copy(out, in, element, '}', indent + 2);
}
fprintf(stderr, "DEBUG: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
name, op, compare, out);
}
else if (ch == '\\') /* Quoted char */
{
@@ -423,6 +570,24 @@ cgi_copy(FILE *out, /* I - Output file */
}
else if (out)
putc(ch, out);
if (ch == EOF)
fprintf(stderr, "DEBUG: %*sReturning at file position %ld on EOF...\n",
indent, "", ftell(in));
else
fprintf(stderr,
"DEBUG: %*sReturning at file position %ld on character '%c'...\n",
indent, "", ftell(in), ch);
if (ch == EOF && term)
fprintf(stderr, "ERROR: %*sSaw EOF, expected '%c'!\n", indent, "", term);
/*
* Flush any pending output...
*/
if (out)
fflush(out);
}
@@ -431,16 +596,50 @@ cgi_copy(FILE *out, /* I - Output file */
*/
static void
cgi_puts(const char *s,
FILE *out)
cgi_puts(const char *s, /* I - String to output */
FILE *out) /* I - Output file */
{
while (*s)
{
if (s[0] == '<' && s[1] != '/' && !isalpha(s[1]))
fputs("&lt;", out);
if (*s == '<')
{
/*
* Pass <A HREF="url"> and </A>, otherwise quote it...
*/
if (!strncasecmp(s, "<A HREF=\"", 9))
{
fputs("<A HREF=\"", out);
s += 9;
while (*s && *s != '\"')
{
if (*s == '&')
fputs("&amp;", out);
else
putc(*s, out);
s ++;
}
if (*s)
s ++;
fputs("\">", out);
}
else if (!strncasecmp(s, "</A>", 4))
{
fputs("</A>", out);
s += 3;
}
else
fputs("&lt;", out);
}
else if (*s == '>')
fputs("&gt;", out);
else if (*s == '\"')
fputs("&quot;", out);
else if (s[0] == '&' && isspace(s[1]))
else if (*s == '&')
fputs("&amp;", out);
else
putc(*s, out);
@@ -450,6 +649,26 @@ cgi_puts(const char *s,
}
/*
* 'cgi_puturi()' - Put a URI string to the output file, quoting as needed...
*/
static void
cgi_puturi(const char *s, /* I - String to output */
FILE *out) /* I - Output file */
{
while (*s)
{
if (strchr("%&+ <>#=", *s) || *s & 128)
fprintf(out, "%%%02X", *s & 255);
else
putc(*s, out);
s ++;
}
}
/*
* End of "$Id$".
*/
+84
Ver Arquivo
@@ -0,0 +1,84 @@
/*
* "$Id$"
*
* CGI test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Test the help index code.
* list_nodes() - List nodes in an array...
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
/*
* 'main()' - Test the CGI code.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
/*
* Test file upload/multi-part submissions...
*/
freopen("multipart.dat", "rb", stdin);
putenv("CONTENT_TYPE=multipart/form-data; "
"boundary=---------------------------1977426492562745908748943111");
putenv("REQUEST_METHOD=POST");
printf("cgiInitialize: ");
if (cgiInitialize())
{
const cgi_file_t *file; /* Upload file */
if ((file = cgiGetFile()) != NULL)
{
puts("PASS");
printf(" tempfile=\"%s\"\n", file->tempfile);
printf(" name=\"%s\"\n", file->name);
printf(" filename=\"%s\"\n", file->filename);
printf(" mimetype=\"%s\"\n", file->mimetype);
}
else
puts("FAIL (no file!)");
}
else
puts("FAIL (init)");
/*
* Return with no errors...
*/
return (0);
}
/*
* End of "$Id$".
*/
+118
Ver Arquivo
@@ -0,0 +1,118 @@
/*
* "$Id$"
*
* Help index test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Test the help index code.
* list_nodes() - List nodes in an array...
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
/*
* Local functions...
*/
static void list_nodes(const char *title, cups_array_t *nodes);
/*
* 'main()' - Test the help index code.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
help_index_t *hi, /* Help index */
*search; /* Search index */
/*
* Load the help index...
*/
hi = helpLoadIndex("testhi.index", ".");
list_nodes("nodes", hi->nodes);
list_nodes("sorted", hi->sorted);
/*
* Do any searches...
*/
if (argc > 1)
{
search = helpSearchIndex(hi, argv[1], NULL, argv[2]);
if (search)
{
list_nodes(argv[1], search->sorted);
helpDeleteIndex(search);
}
else
printf("%s (0 nodes)\n", argv[1]);
}
helpDeleteIndex(hi);
/*
* Return with no errors...
*/
return (0);
}
/*
* 'list_nodes()' - List nodes in an array...
*/
static void
list_nodes(const char *title, /* I - Title string */
cups_array_t *nodes) /* I - Nodes */
{
int i; /* Looping var */
help_node_t *node; /* Current node */
printf("%s (%d nodes):\n", title, cupsArrayCount(nodes));
for (i = 1, node = (help_node_t *)cupsArrayFirst(nodes);
node;
i ++, node = (help_node_t *)cupsArrayNext(nodes))
if (node->anchor)
printf(" %d: %s#%s \"%s\"\n", i, node->filename, node->anchor,
node->text);
else
printf(" %d: %s \"%s\"\n", i, node->filename, node->text);
}
/*
* End of "$Id$".
*/
+29
Ver Arquivo
@@ -0,0 +1,29 @@
<HTML>
<HEAD>
<TITLE>Test File for Help Index Code</TITLE>
</HEAD>
<BODY>
<P>This is a test file for the help index code. The help index
code reads plain HTML and indexes the title and any anchored
text, ignoring all other markup. Anchor tags must be on a single
line, although the text they wrap may cross multiple lines and be
up to 1024 bytes in length.</P>
<H1><A NAME="FIRST">This is the First Anchor</A></H1>
<P>This is some text for the first anchor.</P>
<H1><A NAME="2ND">This is the Second Anchor</A></H1>
<P>This is some text for the first anchor.</P>
<H1><A NAME="THIRD">This is the Third Anchor</A></H1>
<P>This is some text for the third anchor. <A NAME="INLINE">This
is an in-line anchor that crosses a line.</A></P>
</BODY>
</HTML>
+112
Ver Arquivo
@@ -0,0 +1,112 @@
/*
* "$Id$"
*
* CGI template test program for the Common UNIX Printing System (CUPS).
*
* Copyright 2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Test the template code.
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
/*
* 'main()' - Test the template code.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
int i; /* Looping var */
char *value; /* Value in name=value */
FILE *out; /* Where to send output */
/*
* Don't buffer stdout or stderr so that the mixed output is sane...
*/
setbuf(stdout, NULL);
setbuf(stderr, NULL);
/*
* Loop through the command-line, assigning variables for any args with
* "name=value"...
*/
out = stdout;
for (i = 1; i < argc; i ++)
{
if (!strcmp(argv[i], "-o"))
{
i ++;
if (i < argc)
{
out = fopen(argv[i], "w");
if (!out)
{
perror(argv[i]);
return (1);
}
}
}
else if (!strcmp(argv[i], "-e"))
{
i ++;
if (i < argc)
{
if (!freopen(argv[i], "w", stderr))
{
perror(argv[i]);
return (1);
}
}
}
else if (!strcmp(argv[i], "-q"))
freopen("/dev/null", "w", stderr);
else if ((value = strchr(argv[i], '=')) != NULL)
{
*value++ = '\0';
cgiSetVariable(argv[i], value);
}
else
cgiCopyTemplateFile(out, argv[i]);
}
/*
* Return with no errors...
*/
return (0);
}
/*
* End of "$Id$".
*/
+525 -150
Ver Arquivo
@@ -3,107 +3,94 @@
*
* CGI form variable and array functions.
*
* Copyright 1997-2000 by Easy Software Products.
* Copyright 1997-2005 by Easy Software Products.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636 USA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* cgiInitialize() - Initialize the CGI variable "database"...
* cgiCheckVariables() - Check for the presence of "required" variables.
* cgiGetArray() - Get an element from a form array...
* cgiGetSize() - Get the size of a form array value.
* cgiGetVariable() - Get a CGI variable from the database...
* cgiSetArray() - Set array element N to the specified string.
* cgiSetVariable() - Set a CGI variable in the database...
* cgi_add_variable() - Add a form variable.
* cgi_compare_variables() - Compare two variables.
* cgi_find_variable() - Find a variable...
* cgi_initialize_get() - Initialize form variables using the GET method.
* cgi_initialize_post() - Initialize variables using the POST method.
* cgi_initialize_string() - Initialize form variables from a string.
* cgi_sort_variables() - Sort all form variables for faster lookup.
* cgiCheckVariables() - Check for the presence of "required" variables.
* cgiGetArray() - Get an element from a form array...
* cgiGetFile() - Get the file (if any) that was submitted in the form.
* cgiGetSize() - Get the size of a form array value.
* cgiGetVariable() - Get a CGI variable from the database...
* cgiInitialize() - Initialize the CGI variable "database"...
* cgiIsPOST() - Determine whether this page was POSTed.
* cgiSetArray() - Set array element N to the specified string.
* cgiSetSize() - Set the array size.
* cgiSetVariable() - Set a CGI variable in the database...
* cgi_add_variable() - Add a form variable.
* cgi_compare_variables() - Compare two variables.
* cgi_find_variable() - Find a variable...
* cgi_initialize_get() - Initialize form variables using the GET method.
* cgi_initialize_multipart() - Initialize variables and file using the POST method.
* cgi_initialize_post() - Initialize variables using the POST method.
* cgi_initialize_string() - Initialize form variables from a string.
* cgi_passwd() - Catch authentication requests and notify the server.
* cgi_sort_variables() - Sort all form variables for faster lookup.
* cgi_unlink_file() - Remove the uploaded form.
*/
/*#define DEBUG*/
#include "cgi.h"
#include "cgi-private.h"
#include <errno.h>
/*
* Data structure to hold all the CGI form variables and arrays...
*/
typedef struct
typedef struct /**** Form variable structure ****/
{
const char *name; /* Name of variable */
int nvalues, /* Number of values */
avalues; /* Number of values allocated */
const char **values; /* Value(s) of variable */
} var_t;
const char *name; /* Name of variable */
int nvalues, /* Number of values */
avalues; /* Number of values allocated */
const char **values; /* Value(s) of variable */
} _cgi_var_t;
/*
* Local globals...
*/
static int form_count = 0, /* Form variable count */
form_alloc = 0; /* Number of variables allocated */
static var_t *form_vars = NULL; /* Form variables */
static int form_count = 0, /* Form variable count */
form_alloc = 0; /* Number of variables allocated */
static _cgi_var_t *form_vars = NULL;
/* Form variables */
static cgi_file_t *form_file = NULL;
/* Uploaded file */
/*
* Local functions...
*/
static void cgi_add_variable(const char *name, int element,
const char *value);
static int cgi_compare_variables(const var_t *v1, const var_t *v2);
static var_t *cgi_find_variable(const char *name);
static int cgi_initialize_get(void);
static int cgi_initialize_post(void);
static int cgi_initialize_string(const char *data);
static void cgi_sort_variables(void);
/*
* 'cgiInitialize()' - Initialize the CGI variable "database"...
*/
int /* O - Non-zero if there was form data */
cgiInitialize(void)
{
char *method; /* Form posting method */
#ifdef DEBUG
setbuf(stdout, NULL);
puts("Content-type: text/plain\n");
#endif /* DEBUG */
method = getenv("REQUEST_METHOD");
if (method == NULL)
return (0);
if (strcasecmp(method, "GET") == 0)
return (cgi_initialize_get());
else if (strcasecmp(method, "POST") == 0)
return (cgi_initialize_post());
else
return (0);
}
static void cgi_add_variable(const char *name, int element,
const char *value);
static int cgi_compare_variables(const _cgi_var_t *v1,
const _cgi_var_t *v2);
static _cgi_var_t *cgi_find_variable(const char *name);
static int cgi_initialize_get(void);
static int cgi_initialize_multipart(const char *boundary);
static int cgi_initialize_post(void);
static int cgi_initialize_string(const char *data);
static const char *cgi_passwd(const char *prompt);
static void cgi_sort_variables(void);
static void cgi_unlink_file(void);
/*
@@ -160,11 +147,11 @@ cgiCheckVariables(const char *names) /* I - Variables to look for */
* 'cgiGetArray()' - Get an element from a form array...
*/
const char * /* O - Element value or NULL */
cgiGetArray(const char *name, /* I - Name of array variable */
int element) /* I - Element number (0 to N) */
const char * /* O - Element value or NULL */
cgiGetArray(const char *name, /* I - Name of array variable */
int element) /* I - Element number (0 to N) */
{
var_t *var; /* Pointer to variable */
_cgi_var_t *var; /* Pointer to variable */
if ((var = cgi_find_variable(name)) == NULL)
@@ -180,14 +167,25 @@ cgiGetArray(const char *name, /* I - Name of array variable */
}
/*
* 'cgiGetFile()' - Get the file (if any) that was submitted in the form.
*/
const cgi_file_t * /* O - Attached file or NULL */
cgiGetFile(void)
{
return (form_file);
}
/*
* 'cgiGetSize()' - Get the size of a form array value.
*/
int /* O - Number of elements */
cgiGetSize(const char *name) /* I - Name of variable */
int /* O - Number of elements */
cgiGetSize(const char *name) /* I - Name of variable */
{
var_t *var; /* Pointer to variable */
_cgi_var_t *var; /* Pointer to variable */
if ((var = cgi_find_variable(name)) == NULL)
@@ -200,14 +198,14 @@ cgiGetSize(const char *name) /* I - Name of variable */
/*
* 'cgiGetVariable()' - Get a CGI variable from the database...
*
* Returns NULL if the variable doesn't exist... If the variable is an
* Returns NULL if the variable doesn't exist. If the variable is an
* array of values, returns the last element...
*/
const char * /* O - Value of variable */
cgiGetVariable(const char *name)/* I - Name of variable */
const char * /* O - Value of variable */
cgiGetVariable(const char *name) /* I - Name of variable */
{
const var_t *var; /* Returned variable */
const _cgi_var_t *var; /* Returned variable */
var = cgi_find_variable(name);
@@ -224,6 +222,87 @@ cgiGetVariable(const char *name)/* I - Name of variable */
}
/*
* 'cgiInitialize()' - Initialize the CGI variable "database"...
*/
int /* O - Non-zero if there was form data */
cgiInitialize(void)
{
const char *method; /* Form posting method */
const char *content_type; /* Content-Type of post data */
/*
* Setup a password callback for authentication...
*/
cupsSetPasswordCB(cgi_passwd);
/*
* Set the locale so that times, etc. are formatted properly...
*/
setlocale(LC_ALL, "");
#ifdef DEBUG
/*
* Disable output buffering to find bugs...
*/
setbuf(stdout, NULL);
puts("Content-type: text/plain\n");
#endif /* DEBUG */
/*
* Get the request method (GET or POST)...
*/
method = getenv("REQUEST_METHOD");
content_type = getenv("CONTENT_TYPE");
if (!method)
return (0);
/*
* Grab form data from the corresponding location...
*/
if (!strcasecmp(method, "GET"))
return (cgi_initialize_get());
else if (!strcasecmp(method, "POST") && content_type)
{
const char *boundary = strstr(content_type, "boundary=");
if (boundary)
boundary += 9;
if (content_type && !strncmp(content_type, "multipart/form-data; ", 21))
return (cgi_initialize_multipart(boundary));
else
return (cgi_initialize_post());
}
else
return (0);
}
/*
* 'cgiIsPOST()' - Determine whether this page was POSTed.
*/
int /* O - 1 if POST, 0 if GET */
cgiIsPOST(void)
{
const char *method; /* REQUEST_METHOD environment variable */
if ((method = getenv("REQUEST_METHOD")) == NULL)
return (0);
else
return (!strcmp(method, "POST"));
}
/*
* 'cgiSetArray()' - Set array element N to the specified string.
*
@@ -232,15 +311,15 @@ cgiGetVariable(const char *name)/* I - Name of variable */
*/
void
cgiSetArray(const char *name, /* I - Name of variable */
int element, /* I - Element number (0 to N) */
const char *value) /* I - Value of variable */
cgiSetArray(const char *name, /* I - Name of variable */
int element, /* I - Element number (0 to N) */
const char *value) /* I - Value of variable */
{
int i; /* Looping var */
var_t *var; /* Returned variable */
int i; /* Looping var */
_cgi_var_t *var; /* Returned variable */
if (name == NULL || value == NULL || element < 0)
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
if ((var = cgi_find_variable(name)) == NULL)
@@ -277,14 +356,14 @@ cgiSetArray(const char *name, /* I - Name of variable */
*/
void
cgiSetSize(const char *name, /* I - Name of variable */
int size) /* I - Number of elements (0 to N) */
cgiSetSize(const char *name, /* I - Name of variable */
int size) /* I - Number of elements (0 to N) */
{
int i; /* Looping var */
var_t *var; /* Returned variable */
int i; /* Looping var */
_cgi_var_t *var; /* Returned variable */
if (name == NULL || size < 0)
if (name == NULL || size < 0 || size > 100000)
return;
if ((var = cgi_find_variable(name)) == NULL)
@@ -323,8 +402,8 @@ void
cgiSetVariable(const char *name, /* I - Name of variable */
const char *value) /* I - Value of variable */
{
int i; /* Looping var */
var_t *var; /* Returned variable */
int i; /* Looping var */
_cgi_var_t *var; /* Returned variable */
if (name == NULL || value == NULL)
@@ -356,10 +435,10 @@ cgi_add_variable(const char *name, /* I - Variable name */
int element, /* I - Array element number */
const char *value) /* I - Variable value */
{
var_t *var; /* New variable */
_cgi_var_t *var; /* New variable */
if (name == NULL || value == NULL)
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
#ifdef DEBUG
@@ -369,9 +448,9 @@ cgi_add_variable(const char *name, /* I - Variable name */
if (form_count >= form_alloc)
{
if (form_alloc == 0)
form_vars = malloc(sizeof(var_t) * 16);
form_vars = malloc(sizeof(_cgi_var_t) * 16);
else
form_vars = realloc(form_vars, (form_alloc + 16) * sizeof(var_t));
form_vars = realloc(form_vars, (form_alloc + 16) * sizeof(_cgi_var_t));
form_alloc += 16;
}
@@ -392,8 +471,9 @@ cgi_add_variable(const char *name, /* I - Variable name */
*/
static int /* O - Result of comparison */
cgi_compare_variables(const var_t *v1, /* I - First variable */
const var_t *v2) /* I - Second variable */
cgi_compare_variables(
const _cgi_var_t *v1, /* I - First variable */
const _cgi_var_t *v2) /* I - Second variable */
{
return (strcasecmp(v1->name, v2->name));
}
@@ -403,10 +483,10 @@ cgi_compare_variables(const var_t *v1, /* I - First variable */
* 'cgi_find_variable()' - Find a variable...
*/
static var_t * /* O - Variable pointer or NULL */
static _cgi_var_t * /* O - Variable pointer or NULL */
cgi_find_variable(const char *name) /* I - Name of variable */
{
var_t key; /* Search key */
_cgi_var_t key; /* Search key */
if (form_count < 1 || name == NULL)
@@ -414,7 +494,7 @@ cgi_find_variable(const char *name) /* I - Name of variable */
key.name = name;
return ((var_t *)bsearch(&key, form_vars, form_count, sizeof(var_t),
return ((_cgi_var_t *)bsearch(&key, form_vars, form_count, sizeof(_cgi_var_t),
(int (*)(const void *, const void *))cgi_compare_variables));
}
@@ -423,10 +503,10 @@ cgi_find_variable(const char *name) /* I - Name of variable */
* 'cgi_initialize_get()' - Initialize form variables using the GET method.
*/
static int /* O - 1 if form data read */
static int /* O - 1 if form data read */
cgi_initialize_get(void)
{
char *data; /* Pointer to form data string */
char *data; /* Pointer to form data string */
#ifdef DEBUG
@@ -449,19 +529,240 @@ cgi_initialize_get(void)
}
/*
* 'cgi_initialize_multipart()' - Initialize variables and file using the POST method.
*
* TODO: Update to support files > 2GB.
*/
static int /* O - 1 if form data was read */
cgi_initialize_multipart(
const char *boundary) /* I - Boundary string */
{
char line[10240], /* MIME header line */
name[1024], /* Form variable name */
filename[1024], /* Form filename */
mimetype[1024], /* MIME media type */
bstring[256], /* Boundary string to look for */
*ptr, /* Pointer into name/filename */
*end; /* End of buffer */
int ch, /* Character from file */
fd, /* Temporary file descriptor */
blen; /* Length of boundary string */
DEBUG_printf(("cgi_initialize_multipart(boundary=\"%s\")\n", boundary));
/*
* Read multipart form data until we run out...
*/
name[0] = '\0';
filename[0] = '\0';
mimetype[0] = '\0';
snprintf(bstring, sizeof(bstring), "\r\n--%s", boundary);
blen = strlen(bstring);
while (fgets(line, sizeof(line), stdin))
{
if (!strcmp(line, "\r\n"))
{
/*
* End of headers, grab value...
*/
if (filename[0])
{
/*
* Read an embedded file...
*/
if (form_file)
{
/*
* Remove previous file...
*/
cgi_unlink_file();
}
/*
* Allocate memory for the new file...
*/
if ((form_file = calloc(1, sizeof(cgi_file_t))) == NULL)
return (0);
form_file->name = strdup(name);
form_file->filename = strdup(filename);
form_file->mimetype = strdup(mimetype);
fd = cupsTempFd(form_file->tempfile, sizeof(form_file->tempfile));
if (fd < 0)
return (0);
atexit(cgi_unlink_file);
/*
* Copy file data to the temp file...
*/
ptr = line;
while ((ch = getchar()) != EOF)
{
*ptr++ = ch;
if ((ptr - line) >= blen && !memcmp(ptr - blen, bstring, blen))
{
ptr -= blen;
break;
}
if ((ptr - line - blen) >= 8192)
{
/*
* Write out the first 8k of the buffer...
*/
write(fd, line, 8192);
memmove(line, line + 8192, ptr - line - 8192);
ptr -= 8192;
}
}
/*
* Write the rest of the data and close the temp file...
*/
if (ptr > line)
write(fd, line, ptr - line);
close(fd);
}
else
{
/*
* Just get a form variable; the current code only handles
* form values up to 10k in size...
*/
ptr = line;
end = line + sizeof(line) - 1;
while ((ch = getchar()) != EOF)
{
if (ptr < end)
*ptr++ = ch;
if ((ptr - line) >= blen && !memcmp(ptr - blen, bstring, blen))
{
ptr -= blen;
break;
}
}
*ptr = '\0';
/*
* Set the form variable...
*/
if ((ptr = strrchr(name, '-')) != NULL && isdigit(ptr[1] & 255))
{
/*
* Set a specific index in the array...
*/
*ptr++ = '\0';
if (line[0])
cgiSetArray(name, atoi(ptr) - 1, line);
}
else if (cgiGetVariable(name))
{
/*
* Add another element in the array...
*/
cgiSetArray(name, cgiGetSize(name), line);
}
else
{
/*
* Just set the line...
*/
cgiSetVariable(name, line);
}
}
/*
* Read the rest of the current line...
*/
fgets(line, sizeof(line), stdin);
/*
* Clear the state vars...
*/
name[0] = '\0';
filename[0] = '\0';
mimetype[0] = '\0';
}
else if (!strncasecmp(line, "Content-Disposition:", 20))
{
if ((ptr = strstr(line + 20, " name=\"")) != NULL)
{
strlcpy(name, ptr + 7, sizeof(name));
if ((ptr = strchr(name, '\"')) != NULL)
*ptr = '\0';
}
if ((ptr = strstr(line + 20, " filename=\"")) != NULL)
{
strlcpy(filename, ptr + 11, sizeof(filename));
if ((ptr = strchr(filename, '\"')) != NULL)
*ptr = '\0';
}
}
else if (!strncasecmp(line, "Content-Type:", 13))
{
for (ptr = line + 13; isspace(*ptr & 255); ptr ++);
strlcpy(mimetype, ptr, sizeof(mimetype));
for (ptr = mimetype + strlen(mimetype) - 1;
ptr > mimetype && isspace(*ptr & 255);
*ptr-- = '\0');
}
}
/*
* Return 1 for "form data found"...
*/
return (1);
}
/*
* 'cgi_initialize_post()' - Initialize variables using the POST method.
*/
static int /* O - 1 if form data was read */
static int /* O - 1 if form data was read */
cgi_initialize_post(void)
{
char *content_length, /* Length of input data (string) */
*data; /* Pointer to form data string */
int length, /* Length of input data */
nbytes, /* Number of bytes read this read() */
tbytes, /* Total number of bytes read */
status; /* Return status */
char *content_length, /* Length of input data (string) */
*data; /* Pointer to form data string */
int length, /* Length of input data */
nbytes, /* Number of bytes read this read() */
tbytes, /* Total number of bytes read */
status; /* Return status */
#ifdef DEBUG
@@ -473,7 +774,7 @@ cgi_initialize_post(void)
*/
content_length = getenv("CONTENT_LENGTH");
if (content_length == NULL || atoi(content_length) == 0)
if (content_length == NULL || atoi(content_length) <= 0)
return (0);
/*
@@ -483,16 +784,20 @@ cgi_initialize_post(void)
length = atoi(content_length);
data = malloc(length + 1);
if (data == NULL)
return (0);
/*
* Read the data into the buffer...
*/
for (tbytes = 0; tbytes < length; tbytes += nbytes)
if ((nbytes = read(0, data + tbytes, length - tbytes)) < 0)
{
free(data);
return (0);
}
if (errno != EAGAIN)
{
free(data);
return (0);
}
data[length] = '\0';
@@ -516,14 +821,14 @@ cgi_initialize_post(void)
* 'cgi_initialize_string()' - Initialize form variables from a string.
*/
static int
static int /* O - 1 if form data was processed */
cgi_initialize_string(const char *data) /* I - Form data string */
{
int done; /* True if we're done reading a form variable */
char *s, /* Pointer to current form string */
ch, /* Temporary character */
name[255], /* Name of form variable */
value[65536]; /* Variable value... */
int done; /* True if we're done reading a form variable */
char *s, /* Pointer to current form string */
ch, /* Temporary character */
name[255], /* Name of form variable */
value[65536]; /* Variable value... */
/*
@@ -543,11 +848,11 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Get the variable name...
*/
for (s = name; *data != '\0'; data ++, s ++)
for (s = name; *data != '\0'; data ++)
if (*data == '=')
break;
else
*s = *data;
else if (*data >= ' ' && s < (name + sizeof(name) - 1))
*s++ = *data;
*s = '\0';
if (*data == '=')
@@ -559,38 +864,44 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Read the variable value...
*/
for (s = value, done = 0; !done && *data != '\0'; data ++, s ++)
for (s = value, done = 0; !done && *data != '\0'; data ++)
switch (*data)
{
case '&' : /* End of data... */
done = 1;
s --;
break;
case '+' : /* Escaped space character */
*s = ' ';
if (s < (value + sizeof(value) - 1))
*s++ = ' ';
break;
case '%' : /* Escaped control character */
/*
* Read the hex code from stdin...
* Read the hex code...
*/
data ++;
ch = *data - '0';
if (ch > 9)
ch -= 7;
*s = ch << 4;
if (s < (value + sizeof(value) - 1))
{
data ++;
ch = *data - '0';
if (ch > 9)
ch -= 7;
*s = ch << 4;
data ++;
ch = *data - '0';
if (ch > 9)
ch -= 7;
*s |= ch;
data ++;
ch = *data - '0';
if (ch > 9)
ch -= 7;
*s++ |= ch;
}
else
data += 2;
break;
default : /* Other characters come straight through */
*s = *data;
if (*data >= ' ' && s < (value + sizeof(value) - 1))
*s++ = *data;
break;
}
@@ -600,7 +911,9 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Remove trailing whitespace...
*/
s --;
if (s > value)
s --;
while (s >= value && *s == ' ')
*s-- = '\0';
@@ -608,10 +921,11 @@ cgi_initialize_string(const char *data) /* I - Form data string */
* Add the string to the variable "database"...
*/
if ((s = strrchr(name, '-')) != NULL && isdigit(s[1]))
if ((s = strrchr(name, '-')) != NULL && isdigit(s[1] & 255))
{
*s++ = '\0';
cgiSetArray(name, atoi(s) - 1, value);
if (value[0])
cgiSetArray(name, atoi(s) - 1, value);
}
else if (cgiGetVariable(name) != NULL)
cgiSetArray(name, cgiGetSize(name), value);
@@ -623,6 +937,37 @@ cgi_initialize_string(const char *data) /* I - Form data string */
}
/*
* 'cgi_passwd()' - Catch authentication requests and notify the server.
*
* This function sends a Status header and exits, forcing authentication
* for this request.
*/
static const char * /* O - NULL (no return) */
cgi_passwd(const char *prompt) /* I - Prompt (not used) */
{
(void)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
* the client that authentication is required.
*/
puts("Status: 401\n");
exit(0);
/*
* This code is never executed, but is present to satisfy the compiler.
*/
return (NULL);
}
/*
* 'cgi_sort_variables()' - Sort all form variables for faster lookup.
*/
@@ -640,17 +985,47 @@ cgi_sort_variables(void)
if (form_count < 2)
return;
qsort(form_vars, form_count, sizeof(var_t),
qsort(form_vars, form_count, sizeof(_cgi_var_t),
(int (*)(const void *, const void *))cgi_compare_variables);
#ifdef DEBUG
puts("New variable list is:");
puts("Sorted variable list is:");
for (i = 0; i < form_count; i ++)
printf("%s = %s\n", form_vars[i].name, form_vars[i].value);
printf("%d: %s (%d) = \"%s\" ...\n", i, form_vars[i].name,
form_vars[i].nvalues, form_vars[i].values[0]);
#endif /* DEBUG */
}
/*
* 'cgi_unlink_file()' - Remove the uploaded form.
*/
static void
cgi_unlink_file(void)
{
if (form_file)
{
/*
* Remove the temporary file...
*/
unlink(form_file->tempfile);
/*
* Free memory used...
*/
free(form_file->name);
free(form_file->filename);
free(form_file->mimetype);
free(form_file);
form_file = NULL;
}
}
/*
* End of "$Id$".
*/
+42 -9
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1993-2000 by Easy Software Products.
# Copyright 1993-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -28,7 +28,7 @@ include ../Makedefs
# Config files...
#
KEEP = classes.conf client.conf cupsd.conf printers.conf
KEEP = cupsd.conf
REPLACE = mime.convs mime.types
@@ -46,26 +46,59 @@ all:
clean:
#
# Dummy depend...
#
depend:
#
# Install files...
#
install:
-$(MKDIR) $(SERVERROOT)
$(CHMOD) ugo+rx $(SERVERROOT)
install: all
$(INSTALL_DIR) -m 755 $(SERVERROOT)
for file in $(KEEP); do \
if test -r $(SERVERROOT)/$$file ; then \
$(INSTALL_DATA) $$file $(SERVERROOT)/$$file.N ; \
$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file.N || true; \
else \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
fi ; \
done
$(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
-chgrp $(CUPS_GROUP) $(SERVERROOT)/cupsd.conf.default
for file in $(REPLACE); do \
if test -r $(SERVERROOT)/$$file ; then \
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
fi ; \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
done
-if test x$(PAMDIR) != x; then \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \
if test -r $(BUILDROOT)$(PAMDIR)/cups/$(PAMFILE) ; then \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \
else \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \
fi ; \
fi
#
# Uninstall files...
#
uninstall:
for file in $(KEEP) $(REPLACE) cupsd.conf.default; do \
$(RM) $(SERVERROOT)/$$file; \
done
-$(RMDIR) $(SERVERROOT)
-if test x$(PAMDIR) != x; then \
$(RM) $(BUILDROOT)$(PAMDIR)/cups; \
$(RMDIR) $(BUILDROOT)$(PAMDIR); \
fi
#
-89
Ver Arquivo
@@ -1,89 +0,0 @@
#
# "$Id: classes.conf 1152 2000-06-22 18:25:29Z mike $"
#
# Sample class configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
########################################################################
# #
# This is a sample class configuration file. This file is included #
# from the main configuration file (cups.conf) and lists all of the #
# printer classes known to the system. #
# #
########################################################################
#
# Each class starts with a <Class name> definition. Class names
# can be up to 128 characters in length and are *not* case sensitive.
#
# One <DefaultClass name> entry can appear in this file; if you don't
# define a default destination, the first printer or class becomes
# the default.
#
#<Class sample>
#
# Info: the description for the class.
#
#Info Acme LaserPrint 1000 Printers
#
# Location: the location of the printer.
#
#Location Room 101 in the activities building
#
# State: sets the initial state of the class. Can be one of the
# following:
#
# Idle - Class is available to print new jobs.
# Stopped - Class is disabled but accepting new jobs.
#
#State Idle
#
# StateMessage: sets the printer-state-message attribute for the class.
#
#StateMessage Class is idle.
#
# Accepting: is the class accepting jobs?
#
#Accepting Yes
#Accepting No
#
#
# Printer: adds a printer to the class.
#
#Printer sample
#Printer sample@host2
#</Class>
#
# End of "$Id: classes.conf 1152 2000-06-22 18:25:29Z mike $".
#
-50
Ver Arquivo
@@ -1,50 +0,0 @@
#
# "$Id: client.conf 969 2000-03-10 16:56:46Z mike $"
#
# Sample client configuration file for the Common UNIX Printing System
# (CUPS).
#
# Copyright 1997-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
########################################################################
# #
# This is the CUPS client configuration file. This file is used to #
# define client-specific parameters, such as the default server or #
# default printer. #
# #
########################################################################
#
# ServerName: the hostname of your server. By default CUPS will use the
# hostname of the system.
#
#ServerName myhost.domain.com
#
# DefaultPrinter: the default printer (or class) that clients should use.
#
#DefaultPrinter myprinter
#DefaultPrinter myprinter@host
#
# End of "$Id: client.conf 969 2000-03-10 16:56:46Z mike $".
#
-542
Ver Arquivo
@@ -1,542 +0,0 @@
#
# "$Id: cupsd.conf 1171 2000-06-27 21:15:41Z mike $"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler.
#
# Copyright 1997-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
########################################################################
# #
# This is the CUPS configuration file. If you are familiar with #
# Apache or any of the other popular web servers, we've followed the #
# same format. Any configuration variable used here has the same #
# semantics as the corresponding variable in Apache. If we need #
# different functionality then a different name is used to avoid #
# confusion... #
# #
########################################################################
########
######## Server Identity
########
#
# ServerName: the hostname of your server, as advertised to the world.
# By default CUPS will use the hostname of the system.
#
# To set the default server used by clients, see the client.conf file.
#
#ServerName myhost.domain.com
#
# ServerAdmin: the email address to send all complaints/problems to.
# By default CUPS will use "root@hostname".
#
#ServerAdmin root@your.domain.com
########
######## Server Options
########
#
# AccessLog: the access log file; if this does not start with a leading /
# then it is assumed to be relative to ServerRoot. By default set to
# "/var/log/cups/access_log"
#
# You can also use the special name "syslog" to send the output to the
# syslog file or daemon.
#
#AccessLog /var/log/cups/access_log
#
# DataDir: the root directory for the CUPS data files.
# By default /usr/share/cups.
#
#DataDir /usr/share/cups
#
# DefaultCharset: the default character set to use. If not specified,
# defaults to utf-8. Note that this can also be overridden in
# HTML documents...
#
#DefaultCharset utf-8
#
# DefaultLanguage: the default language if not specified by the browser.
# If not specified, the current locale is used.
#
#DefaultLanguage en
#
# DocumentRoot: the root directory for HTTP documents that are served.
# By default the compiled in directory.
#
#DocumentRoot /usr/share/cups/doc
#
# ErrorLog: the error log file; if this does not start with a leading /
# then it is assumed to be relative to ServerRoot. By default set to
# "/var/log/cups/error_log"
#
# You can also use the special name "syslog" to send the output to the
# syslog file or daemon.
#
#ErrorLog /var/log/cups/error_log
#
# LogLevel: controls the number of messages logged to the ErrorLog
# file and can be one of the following:
#
# debug Log everything.
# info Log all requests and state changes.
# warn Log errors and warnings.
# error Log only errors.
# none Log nothing.
#
LogLevel info
#
# MaxLogSize: controls the maximum size of each log file before they are
# rotated. Defaults to 1048576 (1MB). Set to 0 to disable log rotating.
#
#MaxLogSize 0
#
# PageLog: the page log file; if this does not start with a leading /
# then it is assumed to be relative to ServerRoot. By default set to
# "/var/log/cups/page_log"
#
# You can also use the special name "syslog" to send the output to the
# syslog file or daemon.
#
#PageLog /var/log/cups/page_log
#
# PreserveJobHistory: whether or not to preserve the job history after a
# job is completed, cancelled, or stopped. Default is Yes.
#
#PreserveJobHistory Yes
#
# PreserveJobFiles: whether or not to preserve the job files after a
# job is completed, cancelled, or stopped. Default is No.
#
#PreserveJobFiles No
#
# Printcap: the name of the printcap file. Default is no filename.
# Leave blank to disable printcap file generation.
#
#Printcap /etc/printcap
#
# RequestRoot: the directory where request files are stored.
# By default /var/spool/cups.
#
#RequestRoot /var/spool/cups
#
# ServerBin: the root directory for the scheduler executables.
# By default /usr/lib/cups or /usr/lib32/cups (IRIX 6.5).
#
#ServerBin /usr/lib/cups
#
# ServerRoot: the root directory for the scheduler.
# By default /etc/cups.
#
#ServerRoot /etc/cups
########
######## Filter Options
########
#
# User/Group: the user and group the server runs under. Normally this
# must be lp and sys, however you can configure things for another user
# or group as needed.
#
# Note: the server must be run initially as root to support the
# default IPP port of 631. It changes users whenever an external
# program is run...
#
#User lp
#Group sys
#
# RIPCache: the amount of memory that each RIP should use to cache
# bitmaps. The value can be any real number followed by "k" for
# kilobytes, "m" for megabytes, "g" for gigabytes, or "t" for tiles
# (1 tile = 256x256 pixels.) Defaults to "8m" (8 megabytes).
#
#RIPCache 8m
#
# TempDir: the directory to put temporary files in. This directory must be
# writable by the user defined above! Defaults to "/var/tmp" or the value
# of the TMPDIR environment variable.
#
#TempDir /var/tmp
########
######## Network Options
########
#
# Ports/addresses that we listen to. The default port 631 is reserved
# for the Internet Printing Protocol (IPP) and is what we use here.
#
# You can have multiple Port/Listen lines to listen to more than one
# port or address, or to restrict access:
#
# Port 80
# Port 631
# Listen hostname
# Listen hostname:80
# Listen hostname:631
# Listen 1.2.3.4
# Listen 1.2.3.4:631
#
#Port 80
Port 631
#
# HostNameLookups: whether or not to do lookups on IP addresses to get a
# fully-qualified hostname. This defaults to Off for performance reasons...
#
#HostNameLookups On
#
# KeepAlive: whether or not to support the Keep-Alive connection
# option. Default is on.
#
#KeepAlive On
#
# KeepAliveTimeout: the timeout before Keep-Alive connections are
# automatically closed. Default is 60 seconds.
#
#KeepAliveTimeout 60
#
# MaxClients: controls the maximum number of simultaneous clients that
# will be handled. Defaults to 100.
#
#MaxClients 100
#
# MaxRequestSize: controls the maximum size of HTTP requests and print files.
# Set to 0 to disable this feature (defaults to 0.)
#
#MaxRequestSize 0
#
# Timeout: the timeout before requests time out. Default is 300 seconds.
#
#Timeout 300
########
######## Browsing Options
########
#
# Browsing: whether or not to broadcast printer information to
# other CUPS servers. Enabled by default.
#
#Browsing On
#
# BrowseShortNames: whether or not to use "short" names for remote printers
# when possible (e.g. "printer" instead of "printer@host".) Enabled by
# default.
#
#BrowseShortNames Yes
#
# BrowseAddress: specifies a broadcast address to be used. By
# default browsing information is broadcast to all active interfaces.
#
# Note: HP-UX 10.20 and earlier do not properly handle broadcast unless
# you have a Class A, B, C, or D netmask (i.e. no CIDR support).
#
#BrowseAddress x.y.z.255
#BrowseAddress x.y.255.255
#BrowseAddress x.255.255.255
#
# BrowseAllow: specifies an address mask to allow for incoming browser
# packets. The default is to allow packets from all addresses.
#
# BrowseDeny: specifies an address mask to deny for incoming browser
# packets. The default is to deny packets from no addresses.
#
# Both "BrowseAllow" and "BrowseDeny" accept the following notations for
# addresses:
#
# All
# None
# *.domain.com
# .domain.com
# host.domain.com
# nnn.*
# nnn.nnn.*
# nnn.nnn.nnn.*
# nnn.nnn.nnn.nnn
# nnn.nnn.nnn.nnn/mm
# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
#
# The hostname/domainname restrictions only work if you have turned hostname
# lookups on!
#
#BrowseAllow address
#BrowseDeny address
#
# BrowseInterval: the time between browsing updates in seconds. Default
# is 30 seconds.
#
# Note that browsing information is sent whenever a printer's state changes
# as well, so this represents the maximum time between updates.
#
# Set this to 0 to disable outgoing broadcasts so your local printers are
# not advertised but you can still see printers on other hosts.
#
#BrowseInterval 30
#
# BrowseOrder: specifies the order of BrowseAllow/BrowseDeny comparisons.
#
#BrowseOrder allow,deny
#BrowseOrder deny,allow
#
# BrowsePoll: poll the named server(s) for printers
#
#BrowsePoll address:port
#
# BrowsePort: the port used for UDP broadcasts. By default this is
# the IPP port; if you change this you need to do it on all servers.
# Only one BrowsePort is recognized.
#
#BrowsePort 631
#
# BrowseRelay: relay browser packets from one address/network to another.
#
#BrowseRelay source-address destination-address
#
# BrowseTimeout: the timeout for network printers - if we don't
# get an update within this time the printer will be removed
# from the printer list. This number definitely should not be
# less the BrowseInterval value for obvious reasons. Defaults
# to 300 seconds.
#
#BrowseTimeout 300
#
# ImplicitClasses: whether or not to use implicit classes.
#
# Printer classes can be specified explicitly in the classes.conf
# file, implicitly based upon the printers available on the LAN, or
# both.
#
# When ImplicitClasses is On, printers on the LAN with the same name
# (e.g. Acme-LaserPrint-1000) will be put into a class with the same
# name. This allows you to setup multiple redundant queues on a LAN
# without a lot of administrative difficulties. If a user sends a
# job to Acme-LaserPrint-1000, the job will go to the first available
# queue.
#
# Enabled by default.
#
#ImplicitClasses On
########
######## Security Options
########
#
# SystemGroup: the group name for "System" (printer administration)
# access. The default varies depending on the operating system, but
# will be "sys", "system", or "root" (checked for in that order.)
#
#SystemGroup sys
#
# Access permissions for each directory served by the scheduler.
# Locations are relative to DocumentRoot...
#
# AuthType: the authorization to use:
#
# None - Perform no authentication
# Basic - Perform authentication using the HTTP Basic method.
# Digest - Perform authentication using the HTTP Digest method.
#
# (Note: local certificate authentication can be substituted by
# the client for Basic or Digest when connecting to the
# localhost interface)
#
# AuthClass: the authorization class; currently only "Anonymous", "User",
# "System" (valid user belonging to group SystemGroup), and "Group"
# (valid user belonging to the specified group) are supported.
#
# AuthGroupName: the group name for "Group" authorization.
#
# Order: the order of Allow/Deny processing.
#
# Allow: allows access from the specified hostname, domain, IP address, or
# network.
#
# Deny: denies access from the specified hostname, domain, IP address, or
# network.
#
# Both "Allow" and "Deny" accept the following notations for addresses:
#
# All
# None
# *.domain.com
# .domain.com
# host.domain.com
# nnn.*
# nnn.nnn.*
# nnn.nnn.nnn.*
# nnn.nnn.nnn.nnn
# nnn.nnn.nnn.nnn/mm
# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
#
# The host and domain address require that you enable hostname lookups
# with "HostNameLookups On" above.
#
<Location />
</Location>
#<Location /classes>
#
# You may wish to limit access to printers and classes, either with Allow
# and Deny lines, or by requiring a username and password.
#
#</Location>
#<Location /classes/name>
#
# You may wish to limit access to printers and classes, either with Allow
# and Deny lines, or by requiring a username and password.
#
#</Location>
#<Location /printers>
#
# You may wish to limit access to printers and classes, either with Allow
# and Deny lines, or by requiring a username and password.
#
#</Location>
#<Location /printers/name>
#
# You may wish to limit access to printers and classes, either with Allow
# and Deny lines, or by requiring a username and password.
#
## Anonymous access (default)
#AuthType None
## Require a username and password (Basic authentication)
#AuthType Basic
#AuthClass User
## Require a username and password (Digest/MD5 authentication)
#AuthType Digest
#AuthClass User
## Restrict access to local domain
#Order Deny,Allow
#Deny From All
#Allow From .mydomain.com
#</Location>
<Location /admin>
#
# You definitely will want to limit access to the administration functions.
# The default configuration requires a local connection from a user who
# is a member of the system group to do any admin tasks. You can change
# the group name using the SystemGroup directive.
#
AuthType Basic
AuthClass System
## Restrict access to local domain
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>
#
# End of "$Id: cupsd.conf 1171 2000-06-27 21:15:41Z mike $".
#
+77
Ver Arquivo
@@ -0,0 +1,77 @@
#
# "$Id$"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
# file.
#
# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel info
# Administrator user group...
SystemGroup @CUPS_SYSTEM_GROUPS@
# Only listen for connections from the local machine.
Listen localhost:@DEFAULT_IPP_PORT@
@CUPS_LISTEN_DOMAINSOCKET@
# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL
# Default authentication type, when authentication is required...
DefaultAuthType Basic
# Restrict access to the server...
<Location />
Order allow,deny
Allow localhost
</Location>
# Restrict access to the admin pages...
<Location /admin>
@ENCRYPTION_REQUIRED@
Order allow,deny
Allow localhost
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Basic
Require user @SYSTEM
Order allow,deny
Allow localhost
</Location>
# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an adminstrator...
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an adminstrator to authenticate...
<Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
AuthType Basic
Require user @SYSTEM
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
#
# End of "$Id$".
#
+67 -24
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: mime.convs 1270 2000-08-03 18:05:22Z mike $"
# "$Id: mime.convs 5402 2006-04-14 19:21:03Z mike $"
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 by Easy Software Products.
# Copyright 1997-2005 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -30,10 +30,12 @@
#
# General Notes:
#
# Currently the "cost" field is not used (all filters are assumed to
# be equally costly in terms of speed/memory). Also, a filter program
# *must* accept the standard command-line arguments (job-id, user, title,
# copies,options,[filename or stdin]) or this won't work.
# The "cost" field is used to find the least costly filters to run
# when converting a job file to a printable format.
#
# All filters *must* accept the standard command-line arguments
# (job-id, user, title, copies, options, [filename or stdin]) to
# work with CUPS.
#
########################################################################
@@ -41,35 +43,76 @@
# PostScript filters
#
#application/msword application/postscript 50 mswordtops
application/pdf application/postscript 50 pdftops
application/postscript application/vnd.cups-postscript 50 pstops
application/vnd.hp-HPGL application/postscript 50 hpgltops
image/* application/vnd.cups-postscript 50 imagetops
#text/html application/postscript 50 htmltops
text/html application/postscript 50 texttops
text/plain application/postscript 50 texttops
application/vnd.cups-form application/vnd.cups-postscript 50 formtops
application/pdf application/postscript 33 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
application/x-cshell application/postscript 33 texttops
application/x-csource application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/plain application/postscript 33 texttops
text/html application/postscript 33 texttops
image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
image/jpeg application/vnd.cups-postscript 66 imagetops
image/tiff application/vnd.cups-postscript 66 imagetops
image/x-bitmap application/vnd.cups-postscript 66 imagetops
image/x-photocd application/vnd.cups-postscript 66 imagetops
image/x-portable-anymap application/vnd.cups-postscript 66 imagetops
image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops
image/x-portable-graymap application/vnd.cups-postscript 66 imagetops
image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops
image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops
image/x-xbitmap application/vnd.cups-postscript 66 imagetops
image/x-xpixmap application/vnd.cups-postscript 66 imagetops
#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
image/x-sun-raster application/vnd.cups-postscript 66 imagetops
########################################################################
#
# Form filter...
#
# This filter does not currently exist, but the file format is defined
# in the IDD and registered with the IANA for future use...
#
#application/vnd.cups-form application/vnd.cups-postscript 33 formtops
########################################################################
#
# Raster filters...
#
image/* application/vnd.cups-raster 50 imagetoraster
application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster
image/gif application/vnd.cups-raster 100 imagetoraster
image/png application/vnd.cups-raster 100 imagetoraster
image/jpeg application/vnd.cups-raster 100 imagetoraster
image/tiff application/vnd.cups-raster 100 imagetoraster
image/x-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-photocd application/vnd.cups-raster 100 imagetoraster
image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
# pstoraster is now part of ESP Ghostscript...
#application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
########################################################################
#
# Raw filter...
#
# Uncomment the following filter and the application/octet-stream type
# in mime.types to allow printing of arbitrary files without the -oraw
# option.
# Uncomment the following filter to allow printing of arbitrary files
# without the -oraw option.
#
#*/* application/vnd.cups-raw 0 -
#application/octet-stream application/vnd.cups-raw 0 -
#
# End of "$Id: mime.convs 1270 2000-08-03 18:05:22Z mike $".
# End of "$Id: mime.convs 5402 2006-04-14 19:21:03Z mike $".
#
+53 -20
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id: mime.types 1270 2000-08-03 18:05:22Z mike $"
# "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 by Easy Software Products.
# Copyright 1997-2005 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
@@ -15,9 +15,9 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
@@ -41,6 +41,8 @@
# printable(offset,length) True if bytes are printable 8-bit chars
# (CR, NL, TAB, BS, 32-126, 128-254)
# string(offset,"string") True if bytes are identical to string
# istring(offset,"string") True if bytes are identical to
# case-insensitive string
# char(offset,value) True if byte is identical
# short(offset,value) True if 16-bit integer is identical
# int(offset,value) True if 32-bit integer is identical
@@ -60,7 +62,7 @@
# accepts 8-bit characters in the range 128-255.
#
# String constants must be surrounded by "" if they contain whitespace.
# To instead binary data into a string, use the <hex> notation.
# To insert binary data into a string, use the <hex> notation.
#
########################################################################
@@ -68,12 +70,24 @@
# Application-generated files...
#
application/msword doc string(0,<D0CF11E0A1B11AE1>)
#application/msword doc string(0,<D0CF11E0A1B11AE1>)
application/pdf pdf string(0,%PDF)
application/postscript ai eps ps string(0,%!) string(0,<04>%!)
application/vnd.hp-HPGL hpgl string(0,<1b>%) string(0,<1b>&)\
string(0,<1b>E) string(0,<201b>)\
string(0,BP;) string(0,IN;) string(0,DF;)
application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=POSTSCRIPT") \
contains(0,1024,"LANGUAGE = Postscript") \
contains(0,1024,"LANGUAGE = PostScript") \
contains(0,1024,"LANGUAGE = POSTSCRIPT") \
(contains(0,1024,<0a>%!) + \
!contains(0,1024,"ENTER LANGUAGE")))
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
string(0,<1B>E<1B>%0B) \
string(0,<1B>%-1B) string(0,<201B>)\
string(0,BP;) string(0,IN;) string(0,DF;) \
string(0,BPINPS;) \
(contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=HPGL") \
contains(0,1024,"LANGUAGE = HPGL")))
########################################################################
#
@@ -96,43 +110,62 @@ image/x-portable-pixmap ppm string(0,P3) string(0,P6)
image/x-sgi-rgb rgb sgi bw icon short(0,474)
image/x-xbitmap xbm
image/x-xpixmap xpm ascii(0,1024) + string(3,"XPM")
image/x-xwindowdump xwd
image/x-sun-raster ras
#image/x-xwindowdump xwd string(4,<00000007>)
image/x-sun-raster ras string(0,<59a66a95>)
#image/fpx fpx
image/x-alias pix short(8,8) short(8,24)
image/x-bitmap bmp string(0,BM) && !printable(2,14)
image/x-icon ico
########################################################################
#
# Text files...
#
application/x-cshell csh printable(0,1024) + string(0,#!) +\
(contains(2,80,/csh) contains(2,80,/tcsh))
application/x-perl pl printable(0,1024) + string(0,#!) +\
contains(2,80,/perl)
application/x-shell sh printable(0,1024) + string(0,#!) +\
(contains(2,80,/bash) contains(2,80,/ksh)\
contains(2,80,/sh) contains(2,80,/zsh))
application/x-csource c cxx cpp cc C h hpp \
printable(0,1024) + \
(string(0,/*) string(0,//)
string(0,#include) contains(0,1024,<0a>#include) \
string(0,#define) contains(0,1024,<0a>#define))
text/html html htm printable(0,1024) +\
(string(0,"<HTML>") string(0,"<!DOCTYPE"))
(istring(0,"<HTML>") istring(0,"<!DOCTYPE"))
text/plain txt printable(0,1024)
text/css css
########################################################################
#
# CUPS-specific types...
#
application/vnd.cups-command string(0,'#CUPS-COMMAND')
application/vnd.cups-form string(0,"<CUPSFORM>")
application/vnd.cups-postscript string(0,<1B>%-12345X)
application/vnd.cups-pdf
application/vnd.cups-postscript
application/vnd.cups-ppd ppd string(0,"*PPD-Adobe:")
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
application/vnd.cups-raw
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=PCL") \
contains(0,1024,"LANGUAGE = PCL")))
########################################################################
#
# Raw print file support...
#
# Uncomment the following type and the application/octet-stream
# filter line in mime.convs to allow raw file printing without the
# -oraw option.
# Comment the following type to prevent raw file printing.
#
#application/octet-stream
application/octet-stream
#
# End of "$Id: mime.types 1270 2000-08-03 18:05:22Z mike $".
# End of "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $".
#
+7
Ver Arquivo
@@ -0,0 +1,7 @@
# cups: auth account password session
auth sufficient pam_securityserver.so
auth sufficient pam_unix.so
auth required pam_deny.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so
+3
Ver Arquivo
@@ -0,0 +1,3 @@
#%PAM-1.0
auth required pam_unix.so shadow nodelay nullok
account required pam_unix.so
+2
Ver Arquivo
@@ -0,0 +1,2 @@
auth required @PAMMOD@ nullok shadow
account required @PAMMOD@
-2
Ver Arquivo
@@ -1,2 +0,0 @@
# This is a dummy printcap file that is automatically generated by the
# CUPS software for old applications that rely on it.
-96
Ver Arquivo
@@ -1,96 +0,0 @@
#
# "$Id: printers.conf 1152 2000-06-22 18:25:29Z mike $"
#
# Sample printer configuration file for the Common UNIX Printing System
# (CUPS) scheduler.
#
# Copyright 1997-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
########################################################################
# #
# This is a sample printer configuration file. This file is included #
# from the main configuration file (cups.conf) and lists all of the #
# printers known to the system. #
# #
########################################################################
#
# Each printer starts with a <Printer name> definition. Printer names
# can be up to 128 characters in length and are *not* case sensitive.
#
# One <DefaultPrinter name> entry can appear in this file; if you don't
# define a default destination, the first printer or class becomes the
# default.
#
#<Printer sample>
#
# Info: the description for the printer.
#
#Info Acme LaserPrint 1000
#
# Location: the location of the printer.
#
#Location Room 101 in the activities building
#
# DeviceURI: the device URI for this printer.
#
#DeviceURI parallel:/dev/plp
#DeviceURI serial:/dev/ttyd1?baud=38400+size=8+parity=none+flow=soft
#DeviceURI scsi:/dev/scsi/sc1d6l0
#DeviceURI socket://hostname:port
#DeviceURI tftp://hostname/path
#DeviceURI ftp://hostname/path
#DeviceURI http://hostname[:port]/path
#DeviceURI ipp://hostname/path
#DeviceURI smb://hostname/printer
#
# State: sets the initial state of the printer. Can be one of the
# following:
#
# Idle - Printer is available to print new jobs.
# Stopped - Printer is disabled but accepting new jobs.
#
#State Idle
#
# StateMessage: sets the printer-state-message attribute for the printer.
#
#StateMessage Printer is idle.
#
# Accepting: is the printer accepting jobs?
#
#Accepting Yes
#Accepting No
#</Printer>
#
# End of "$Id: printers.conf 1152 2000-06-22 18:25:29Z mike $".
#
+269
Ver Arquivo
@@ -0,0 +1,269 @@
dnl
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
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl We need at least autoconf 2.50...
AC_PREREQ(2.50)
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Versio number information...
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'`"
fi
AC_SUBST(CUPS_VERSION)
AC_SUBST(CUPS_REVISION)
AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
dnl Default compiler flags...
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
dnl Checks for programs...
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
if test "$INSTALL" = "$ac_install_sh"; then
# Use full path to install-sh script...
INSTALL="`pwd`/install-sh -c"
fi
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(LD,ld)
AC_PATH_PROG(LN,ln)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(RMDIR,rmdir)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(STRIP,strip)
if test "x$AR" = x; then
AC_MSG_ERROR([Unable to find required library archive command.])
fi
if test "x$CC" = x; then
AC_MSG_ERROR([Unable to find required C compiler command.])
fi
if test "x$CXX" = x; then
AC_MSG_ERROR([Unable to find required C++ compiler command.])
fi
dnl Static library option...
INSTALLSTATIC=""
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
if test x$enable_static = xyes; then
echo Installing static libraries...
INSTALLSTATIC="installstatic"
fi
AC_SUBST(INSTALLSTATIC)
dnl Check for libraries...
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(getspent, sec gen)
LIBMALLOC=""
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
if test x$enable_mallinfo = xyes; then
AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
if test "$ac_cv_lib_c_mallinfo" = "no"; then
AC_CHECK_LIB(malloc,mallinfo,
LIBS="$LIBS"
LIBMALLOC="-lmalloc"
AC_DEFINE(HAVE_MALLINFO),
LIBS="$LIBS")
fi
fi
AC_SUBST(LIBMALLOC)
dnl Check for libpaper support...
AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
if test x$enable_libpaper = xyes; then
AC_CHECK_LIB(paper,systempapername,
AC_DEFINE(HAVE_LIBPAPER)
LIBPAPER="-lpaper",
LIBPAPER="")
else
LIBPAPER=""
fi
AC_SUBST(LIBPAPER)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
echo Forcing snprintf emulation for HP-UX.
else
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
dnl Checks for mkstemp and mkstemps functions.
AC_CHECK_FUNCS(mkstemp mkstemps)
dnl Check for geteuid function.
AC_CHECK_FUNCS(geteuid)
dnl Check for vsyslog function.
AC_CHECK_FUNCS(vsyslog)
dnl Checks for signal functions.
case "$uname" in
Linux | GNU)
# Do not use sigset on Linux or GNU HURD
;;
*)
# Use sigset on other platforms, if available
AC_CHECK_FUNCS(sigset)
;;
esac
AC_CHECK_FUNCS(sigaction)
dnl Checks for wait functions.
AC_CHECK_FUNCS(waitpid)
AC_CHECK_FUNCS(wait3)
dnl See if the tm structure has the tm_gmtoff member...
AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
AC_TRY_COMPILE([#include <time.h>],[struct tm t;
int o = t.tm_gmtoff;],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TM_GMTOFF),
AC_MSG_RESULT(no))
dnl Flags for "ar" command...
case $uname in
Darwin* | *BSD*)
ARFLAGS="-rcv"
;;
*)
ARFLAGS="crvs"
;;
esac
AC_SUBST(ARFLAGS)
dnl Extra platform-specific libraries...
BACKLIBS=""
CUPSDLIBS=""
DBUSDIR=""
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
case $uname in
Darwin*)
BACKLIBS="-framework IOKit"
CUPSDLIBS="-framework IOKit -framework SystemConfiguration"
LIBS="-framework CoreFoundation $LIBS"
dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
if test "$uname" = "Darwin" -a $uversion -ge 70; then
AC_DEFINE(HAVE_CF_LOCALE_ID)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Check for framework headers...
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
dnl Check for the new membership functions in MacOSX 10.4 (Tiger)...
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
AC_CHECK_FUNCS(mbr_uid_to_uuid)
dnl Check for notify_post support
AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
AC_CHECK_FUNCS(notify_post)
;;
Linux*)
dnl Check for DBUS support
if test "x$enable_dbus" != xno; then
AC_PATH_PROG(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(dbus-1,
dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
DBUSDIR="/etc/dbus-1/system.d")
else
AC_MSG_RESULT(no)
fi
fi
fi
;;
esac
dnl See if we have POSIX ACL support...
SAVELIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
CUPSDLIBS="$CUPSDLIBS $LIBS"
LIBS="$SAVELIBS"
AC_SUBST(BACKLIBS)
AC_SUBST(CUPSDLIBS)
AC_SUBST(DBUSDIR)
dnl New default port definition for IPP...
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
DEFAULT_IPP_PORT="$withval",
DEFAULT_IPP_PORT="631")
AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
dnl End of "$Id: cups-common.m4 5843 2006-08-17 18:49:31Z mike $".
dnl
+464
Ver Arquivo
@@ -0,0 +1,464 @@
dnl
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
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Clear the debugging and non-shared library options unless the user asks
dnl for them...
OPTIM=""
AC_SUBST(OPTIM)
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization 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-arch32flags="flags"
specifies 32-bit architecture flags])
ARCH32FLAGS=""
INSTALL32=""
LIB32CUPS=""
LIB32CUPSIMAGE=""
LIB32DIR=""
UNINSTALL32=""
AC_SUBST(ARCH32FLAGS)
AC_SUBST(INSTALL32)
AC_SUBST(LIB32CUPS)
AC_SUBST(LIB32CUPSIMAGE)
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-arch64flags="flags"
specifies 64-bit architecture flags])
ARCH64FLAGS=""
INSTALL64=""
LIB64CUPS=""
LIB64CUPSIMAGE=""
LIB64DIR=""
UNINSTALL64=""
AC_SUBST(ARCH64FLAGS)
AC_SUBST(INSTALL64)
AC_SUBST(LIB64CUPS)
AC_SUBST(LIB64CUPSIMAGE)
AC_SUBST(LIB64DIR)
AC_SUBST(UNINSTALL64)
dnl Position-Independent Executable support on Linux and *BSD...
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
dnl Update compiler options...
CXXLIBS=""
AC_SUBST(CXXLIBS)
PIEFLAGS=""
AC_SUBST(PIEFLAGS)
if test -n "$GCC"; then
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
# Default to optimize-for-size and debug
OPTIM="-Os -g"
else
OPTIM="$with_optim $OPTIM"
fi
fi
if test $PICFLAG = 1 -a $uname != AIX; then
OPTIM="-fPIC $OPTIM"
fi
case $uname in
Linux*)
if test x$enable_pie = xyes; then
PIEFLAGS="-pie -fPIE"
fi
;;
*)
if test x$enable_pie = xyes; then
echo "Sorry, --enable-pie is not supported on this OS!"
fi
;;
esac
if test "x$with_optim" = x; then
# Add useful warning options for tracking down problems...
OPTIM="-Wall -Wno-format-y2k $OPTIM"
# Additional warning options for alpha testing...
OPTIM="-Wshadow -Wunused $OPTIM"
fi
case "$uname" in
IRIX)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
if test -z "$with_arch32flags"; then
ARCH32FLAGS="-n32 -mips3"
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
ARCHFLAGS="-64 -mips4"
else
ARCHFLAGS="$with_arch64flags"
fi
fi
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
if test -z "$with_arch64flags"; then
ARCH64FLAGS="-64 -mips4"
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-n32 -mips3"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
;;
Linux*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
if test -z "$with_arch32flags"; then
ARCH32FLAGS="-m32"
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib"
if test -d /usr/lib32; then
LIB32DIR="${LIB32DIR}32"
fi
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
ARCHFLAGS="-m64"
else
ARCHFLAGS="$with_arch64flags"
fi
fi
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
if test -z "$with_arch64flags"; then
ARCH64FLAGS="-m64"
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib"
if test -d /usr/lib64; then
LIB64DIR="${LIB64DIR}64"
fi
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-m32"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
;;
SunOS*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
if test -z "$with_arch32flags"; then
ARCH32FLAGS="-m32"
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
ARCHFLAGS="-m64"
else
ARCHFLAGS="$with_arch64flags"
fi
fi
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
if test -z "$with_arch64flags"; then
ARCH64FLAGS="-m64"
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$exec_prefix/lib/64"
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-m32"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
;;
esac
else
case $uname in
AIX*)
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-O2 -qmaxmem=6000"
else
OPTIM="$with_optim $OPTIM"
fi
fi
;;
HP-UX*)
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="+O2"
else
OPTIM="$with_optim $OPTIM"
fi
fi
CFLAGS="-Ae $CFLAGS"
# Warning 336 is "empty translation unit"
# Warning 829 is passing constant string as char *
CXXFLAGS="+W336,829 $CXXFLAGS"
if test $PICFLAG = 1; then
OPTIM="+z $OPTIM"
fi
;;
IRIX)
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-O2"
else
OPTIM="$with_optim $OPTIM"
fi
fi
if test "x$with_optim" = x; then
OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
fi
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
if test -z "$with_arch32flags"; then
ARCH32FLAGS="-n32 -mips3"
else
ARCH32FLAGS="$with_arch32flags"
fi
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$prefix/lib32"
UNINSTALL32="uninstall32bit"
if test -z "$with_archflags"; then
if test -z "$with_arch64flags"; then
ARCHFLAGS="-64 -mips4"
else
ARCHFLAGS="$with_arch64flags"
fi
fi
fi
if test "x$enable_64bit" = xyes; then
# Build 64-bit libraries, 32-bit base...
if test -z "$with_arch64flags"; then
ARCH64FLAGS="-64 -mips4"
else
ARCH64FLAGS="$with_arch64flags"
fi
INSTALL64="install64bit"
LIB64CUPS="64bit/libcups.so.2"
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
LIB64DIR="$prefix/lib64"
UNINSTALL64="uninstall64bit"
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-n32 -mips3"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
;;
SunOS*)
# Solaris
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-xO2"
else
OPTIM="$with_optim $OPTIM"
fi
fi
if test $PICFLAG = 1; then
OPTIM="-KPIC $OPTIM"
fi
if test "x$enable_32bit" = xyes; then
# Compiling on a Solaris system, build 64-bit
# binaries with separate 32-bit libraries...
ARCH32FLAGS="-xarch=generic"
INSTALL32="install32bit"
LIB32CUPS="32bit/libcups.so.2"
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
LIB32DIR="$exec_prefix/lib/32"
UNINSTALL32="uninstall32bit"
if test "x$with_optim" = x; then
# Suppress all of Sun's questionable
# warning messages, and default to
# 64-bit compiles of everything else...
OPTIM="-w $OPTIM"
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="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"
fi
if test -z "$with_archflags"; then
if test -z "$with_arch32flags"; then
ARCHFLAGS="-xarch=generic"
else
ARCHFLAGS="$with_arch32flags"
fi
fi
fi
;;
UNIX_SVR*)
# UnixWare
if test -z "$OPTIM"; then
if test "x$with_optim" = x; then
OPTIM="-O"
else
OPTIM="$with_optim $OPTIM"
fi
fi
if test $PICFLAG = 1; then
OPTIM="-KPIC $OPTIM"
fi
;;
*)
# Running some other operating system; inform the user they
# should contribute the necessary options to
# cups-support@cups.org...
echo "Building CUPS with default compiler optimizations; contact"
echo "cups-bugs@cups.org with uname and compiler options needed"
echo "for your platform, or set the CFLAGS and CXXFLAGS"
echo "environment variable before running configure."
;;
esac
fi
if test $uname = HP-UX; then
# HP-UX 10.20 (at least) needs this definition to get the
# h_errno global...
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
# HP-UX 11.00 (at least) needs this definition to get the
# u_short type used by the IP headers...
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
fi
dnl
dnl End of "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $".
dnl
+254
Ver Arquivo
@@ -0,0 +1,254 @@
dnl
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).
dnl
dnl Copyright 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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Default langugages...
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_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"
else
CUPS_CONFIG_FILE_PERM="640"
fi)
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_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)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_FILE_PERM, 0$CUPS_LOG_FILE_PERM)
dnl Default Browsing
AC_ARG_ENABLE(browsing, [ --enable-browsing enable Browsing by default, default=yes])
if test "x$enable_browsing" = xno; then
CUPS_BROWSING="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 0)
else
CUPS_BROWSING="Yes"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 1)
fi
AC_SUBST(CUPS_BROWSING)
dnl Default BrowseLocalProtocols
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)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS,
"$CUPS_BROWSE_LOCAL_PROTOCOLS")
dnl Default BrowseRemoteProtocols
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)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS,
"$CUPS_BROWSE_REMOTE_PROTOCOLS")
dnl Default BrowseShortNames
AC_ARG_ENABLE(browse_short, [ --enable-browse-short-names
enable BrowseShortNames by default, default=yes])
if test "x$enable_browse_short" = xno; then
CUPS_BROWSE_SHORT_NAMES="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 0)
else
CUPS_BROWSE_SHORT_NAMES="Yes"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 1)
fi
AC_SUBST(CUPS_BROWSE_SHORT_NAMES)
dnl Default DefaultShared
AC_ARG_ENABLE(default_shared, [ --enable-default-shared enable DefaultShared by default, default=yes])
if test "x$enable_default_shared" = xno; then
CUPS_DEFAULT_SHARED="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 0)
else
CUPS_DEFAULT_SHARED="Yes"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 1)
fi
AC_SUBST(CUPS_DEFAULT_SHARED)
dnl Default ImplicitClasses
AC_ARG_ENABLE(implicit, [ --enable-implicit-classes
enable ImplicitClasses by default, default=yes])
if test "x$enable_implicit" = xno; then
CUPS_IMPLICIT_CLASSES="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 0)
else
CUPS_IMPLICIT_CLASSES="Yes"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 1)
fi
AC_SUBST(CUPS_IMPLICIT_CLASSES)
dnl Default UseNetworkDefault
AC_ARG_ENABLE(network_default, [ --enable-use-network-default
enable UseNetworkDefault by default, default=auto])
if test "x$enable_network_default" != xno; then
AC_MSG_CHECKING(whether to use network default printers)
if test "x$enable_network_default" = xyes -o $uname != Darwin; then
CUPS_USE_NETWORK_DEFAULT="Yes"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
AC_MSG_RESULT(yes)
else
CUPS_USE_NETWORK_DEFAULT="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
AC_MSG_RESULT(no)
fi
else
CUPS_USE_NETWORK_DEFAULT="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
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],
CUPS_USER="$withval",
AC_MSG_CHECKING(for default print user)
if test -f /etc/passwd; then
CUPS_USER=""
for user in lp lpd guest daemon nobody; do
if test "`grep \^${user}: /etc/passwd`" != ""; then
CUPS_USER="$user"
AC_MSG_RESULT($user)
break;
fi
done
if test x$CUPS_USER = x; then
CUPS_USER="nobody"
AC_MSG_RESULT(not found, using "$CUPS_USER")
fi
else
CUPS_USER="nobody"
AC_MSG_RESULT(no password file, using "$CUPS_USER")
fi)
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
GROUP_LIST="lp nobody"
CUPS_GROUP=""
for group in $GROUP_LIST; do
if test "`grep \^${group}: /etc/group`" != ""; then
CUPS_GROUP="$group"
AC_MSG_RESULT($group)
break;
fi
done
if test x$CUPS_GROUP = x; then
CUPS_GROUP="nobody"
AC_MSG_RESULT(not found, using "$CUPS_GROUP")
fi
else
CUPS_GROUP="nobody"
AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
fi)
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"
else
GROUP_LIST="lpadmin sys system root"
fi
AC_MSG_CHECKING(for default system groups)
if test -f /etc/group; then
CUPS_SYSTEM_GROUPS=""
for group in $GROUP_LIST; do
if test "`grep \^${group}: /etc/group`" != ""; then
if test "x$CUPS_SYSTEM_GROUPS" = x; then
CUPS_SYSTEM_GROUPS="$group"
else
CUPS_SYSTEM_GROUPS="$CUPS_SYSTEM_GROUPS $group"
fi
fi
done
if test "x$CUPS_SYSTEM_GROUPS" = x; then
CUPS_SYSTEM_GROUPS="$GROUP_LIST"
AC_MSG_RESULT(no groups found, using "$CUPS_SYSTEM_GROUPS")
else
AC_MSG_RESULT("$CUPS_SYSTEM_GROUPS")
fi
else
CUPS_SYSTEM_GROUPS="$GROUP_LIST"
AC_MSG_RESULT(no group file, using "$CUPS_SYSTEM_GROUPS")
fi)
CUPS_PRIMARY_SYSTEM_GROUP="`echo $CUPS_SYSTEM_GROUPS | awk '{print $1}'`"
AC_SUBST(CUPS_USER)
AC_SUBST(CUPS_GROUP)
AC_SUBST(CUPS_SYSTEM_GROUPS)
AC_SUBST(CUPS_PRIMARY_SYSTEM_GROUP)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
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="default")
if test x$enable_printcap != xno -a x$default_printcap != xno; then
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=""
fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl
dnl End of "$Id: cups-defaults.m4 5804 2006-08-04 16:51:58Z mike $".
dnl
+320
Ver Arquivo
@@ -0,0 +1,320 @@
dnl
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
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_PREFIX_DEFAULT(/)
dnl Fix "prefix" variable if it hasn't been specified...
if test "$prefix" = "NONE"; then
prefix="/"
fi
dnl Fix "exec_prefix" variable if it hasn't been specified...
if test "$exec_prefix" = "NONE"; then
if test "$prefix" = "/"; then
exec_prefix="/usr"
else
exec_prefix="$prefix"
fi
fi
dnl Fix "bindir" variable...
if test "$bindir" = "\${exec_prefix}/bin"; then
bindir="$exec_prefix/bin"
fi
AC_DEFINE_UNQUOTED(CUPS_BINDIR, "$bindir")
dnl Fix "sbindir" variable...
if test "$sbindir" = "\${exec_prefix}/sbin"; then
sbindir="$exec_prefix/sbin"
fi
AC_DEFINE_UNQUOTED(CUPS_SBINDIR, "$sbindir")
dnl Fix "sharedstatedir" variable if it hasn't been specified...
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
datadir="/usr/share"
else
datadir="$prefix/share"
fi
elif test "$datadir" = "\${datarootdir}"; then
datadir="$datarootdir"
fi
dnl Fix "includedir" variable if it hasn't been specified...
if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
includedir="/usr/include"
fi
dnl Fix "localstatedir" variable if it hasn't been specified...
if test "$localstatedir" = "\${prefix}/var"; then
if test "$prefix" = "/"; then
if test "$uname" = Darwin; then
localstatedir="/private/var"
else
localstatedir="/var"
fi
else
localstatedir="$prefix/var"
fi
fi
dnl Fix "sysconfdir" variable if it hasn't been specified...
if test "$sysconfdir" = "\${prefix}/etc"; then
if test "$prefix" = "/"; then
if test "$uname" = Darwin; then
sysconfdir="/private/etc"
else
sysconfdir="/etc"
fi
else
sysconfdir="$prefix/etc"
fi
fi
dnl Fix "libdir" variable for IRIX 6.x...
if test "$libdir" = "\${exec_prefix}/lib"; then
if test "$uname" = "IRIX"; then
libdir="$exec_prefix/lib32"
else
if test "$uname" = Linux -a -d /usr/lib64; then
libdir="$exec_prefix/lib64"
else
libdir="$exec_prefix/lib"
fi
fi
fi
dnl Setup init.d locations...
AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
if test x$rcdir = x; then
case "$uname" in
FreeBSD* | OpenBSD* | MirBsD* | ekkoBSD*)
# FreeBSD and OpenBSD
INITDIR=""
INITDDIR=""
;;
NetBSD*)
# NetBSD
INITDIR=""
INITDDIR="/etc/rc.d"
;;
Darwin*)
# Darwin and MacOS X...
INITDIR=""
if test -x /sbin/launchd; then
INITDDIR="/System/Library/LaunchDaemons"
else
INITDDIR="/System/Library/StartupItems/PrintingServices"
fi
;;
Linux | GNU)
# Linux/HURD seems to choose an init.d directory at random...
if test -d /sbin/init.d; then
# SuSE
INITDIR="/sbin/init.d"
INITDDIR=".."
else
if test -d /etc/init.d; then
# Others
INITDIR="/etc"
INITDDIR="../init.d"
else
# RedHat
INITDIR="/etc/rc.d"
INITDDIR="../init.d"
fi
fi
;;
OSF1* | HP-UX*)
INITDIR="/sbin"
INITDDIR="../init.d"
;;
AIX*)
INITDIR="/etc/rc.d"
INITDDIR=".."
;;
*)
INITDIR="/etc"
INITDDIR="../init.d"
;;
esac
else
INITDIR=""
INITDDIR="$rcdir"
fi
AC_SUBST(INITDIR)
AC_SUBST(INITDDIR)
dnl Xinetd support...
XINETD=""
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)
dnl Setup default locations...
# Cache data...
AC_ARG_WITH(cachedir, [ --with-cachedir set path for cache files],cachedir="$withval",cachedir="")
if test x$cachedir = x; then
if test "x$uname" = xDarwin; then
CUPS_CACHEDIR="$localstatedir/spool/cups/cache"
else
CUPS_CACHEDIR="$localstatedir/cache/cups"
fi
else
CUPS_CACHEDIR="$cachedir"
fi
AC_DEFINE_UNQUOTED(CUPS_CACHEDIR, "$CUPS_CACHEDIR")
AC_SUBST(CUPS_CACHEDIR)
# Data files
CUPS_DATADIR="$datadir/cups"
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
AC_SUBST(CUPS_DATADIR)
# Documentation files
AC_ARG_WITH(docdir, [ --with-docdir set path for documentation],docdir="$withval",docdir="")
if test x$docdir = x; then
CUPS_DOCROOT="$datadir/doc/cups"
docdir="$datadir/doc/cups"
else
CUPS_DOCROOT="$docdir"
fi
AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$docdir")
AC_SUBST(CUPS_DOCROOT)
# Fonts
AC_ARG_WITH(fontpath, [ --with-fontpath set font path for pstoraster],fontpath="$withval",fontpath="")
if test "x$fontpath" = "x"; then
CUPS_FONTPATH="$datadir/cups/fonts"
else
CUPS_FONTPATH="$fontpath"
fi
AC_SUBST(CUPS_FONTPATH)
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH")
# Locale data
case "$uname" in
Linux | GNU | *BSD* | Darwin*)
CUPS_LOCALEDIR="$datadir/locale"
;;
OSF1* | AIX*)
CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg"
;;
*)
# This is the standard System V location...
CUPS_LOCALEDIR="$exec_prefix/lib/locale"
;;
esac
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$CUPS_LOCALEDIR")
AC_SUBST(CUPS_LOCALEDIR)
# Log files...
AC_ARG_WITH(logdir, [ --with-logdir set path for log files],logdir="$withval",logdir="")
if test x$logdir = x; then
CUPS_LOGDIR="$localstatedir/log/cups"
AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
else
CUPS_LOGDIR="$logdir"
fi
AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$CUPS_LOGDIR")
AC_SUBST(CUPS_LOGDIR)
# Longer-term spool data
CUPS_REQUESTS="$localstatedir/spool/cups"
AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
AC_SUBST(CUPS_REQUESTS)
# Server executables...
case "$uname" in
*BSD* | Darwin*)
# *BSD and Darwin (MacOS X)
INSTALL_SYSV=""
CUPS_SERVERBIN="$exec_prefix/libexec/cups"
;;
*)
# All others
INSTALL_SYSV="install-sysv"
CUPS_SERVERBIN="$exec_prefix/lib/cups"
;;
esac
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN")
AC_SUBST(CUPS_SERVERBIN)
AC_SUBST(INSTALL_SYSV)
# Configuration files
CUPS_SERVERROOT="$sysconfdir/cups"
AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
AC_SUBST(CUPS_SERVERROOT)
# Transient run-time state
CUPS_STATEDIR="$localstatedir/run/cups"
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 5905 2006-08-29 20:48:59Z mike $".
dnl
+118
Ver Arquivo
@@ -0,0 +1,118 @@
dnl
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
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl See if we want the image filters included at all...
AC_ARG_ENABLE(image, [ --enable-image turn on image filters, default=auto])
IMGFILTERS=""
if test "x$enable_image" != xno; then
AC_MSG_CHECKING(whether to build image filters)
if test "x$enable_image" = xyes -o $uname != Darwin; then
IMGFILTERS="imagetops imagetoraster"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(IMGFILTERS)
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])
AC_ARG_ENABLE(tiff, [ --enable-tiff turn on TIFF support, default=yes])
LIBJPEG=""
LIBPNG=""
LIBTIFF=""
LIBZ=""
AC_SUBST(LIBJPEG)
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,
AC_DEFINE(HAVE_LIBJPEG)
LIBJPEG="-ljpeg"
LIBS="$LIBS -ljpeg"))
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...
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"))
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,
AC_DEFINE(HAVE_LIBTIFF)
LIBTIFF="-ltiff"))
else
AC_MSG_NOTICE([TIFF support disabled with --disable-tiff.])
fi
dnl Restore original LIBS settings...
LIBS="$SAVELIBS"
EXPORT_LIBJPEG="$LIBJPEG"
EXPORT_LIBPNG="$LIBPNG"
EXPORT_LIBTIFF="$LIBTIFF"
EXPORT_LIBZ="$LIBZ"
AC_SUBST(EXPORT_LIBJPEG)
AC_SUBST(EXPORT_LIBPNG)
AC_SUBST(EXPORT_LIBTIFF)
AC_SUBST(EXPORT_LIBZ)
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
dnl
dnl End of "$Id: cups-image.m4 5580 2006-05-23 19:30:23Z mike $".
dnl
+61
Ver Arquivo
@@ -0,0 +1,61 @@
dnl
dnl "$Id: cups-largefile.m4 4732 2005-09-30 23:23:25Z mike $"
dnl
dnl Large file support stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Check for largefile support...
AC_SYS_LARGEFILE
dnl Define largefile options as needed...
LARGEFILE=""
if test x$enable_largefile != xno; then
LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
if test $ac_cv_sys_large_files = 1; then
LARGEFILE="$LARGEFILE -D_LARGE_FILES"
fi
if test $ac_cv_sys_file_offset_bits = 64; then
LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
fi
fi
AC_SUBST(LARGEFILE)
dnl Check for "long long" support...
AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
[if test "$GCC" = yes; then
ac_cv_c_long_long=yes
else
AC_TRY_COMPILE(,[long long int i;],
ac_cv_c_long_long=yes,
ac_cv_c_long_long=no)
fi])
if test $ac_cv_c_long_long = yes; then
AC_DEFINE(HAVE_LONG_LONG)
fi
AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
dnl
dnl End of "$Id: cups-largefile.m4 4732 2005-09-30 23:23:25Z mike $".
dnl
+53
Ver Arquivo
@@ -0,0 +1,53 @@
dnl
dnl "$Id: cups-launchd.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl launchd stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(launchd, [ --enable-launchd turn on launchd support, default=yes])
DEFAULT_LAUNCHD_CONF=""
LAUNCHDLIBS=""
if test x$enable_launchd != xno; then
AC_CHECK_FUNC(launch_msg, AC_DEFINE(HAVE_LAUNCHD))
AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
case "$uname" in
Darwin*)
# Darwin, MacOS X
DEFAULT_LAUNCHD_CONF="/System/Library/LaunchDaemons/org.cups.cupsd.plist"
# liblaunch is already part of libSystem
;;
*)
# All others; this test will need to be updated
;;
esac
fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LAUNCHD_CONF, "$DEFAULT_LAUNCHD_CONF")
AC_SUBST(DEFAULT_LAUNCHD_CONF)
AC_SUBST(LAUNCHDLIBS)
dnl
dnl End of "$Id: cups-launchd.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+50
Ver Arquivo
@@ -0,0 +1,50 @@
dnl
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
dnl Copyright 2003-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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org/
dnl
AC_ARG_ENABLE(ldap, [ --enable-ldap turn on LDAP support, default=yes])
AC_ARG_WITH(openldap-libs, [ --with-openldap-libs set directory for OpenLDAP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(openldap-includes, [ --with-openldap-includes
set directory for OpenLDAP includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
LIBLDAP=""
if test x$enable_ldap != xno; then
AC_CHECK_HEADER(ldap.h,
AC_CHECK_LIB(ldap, ldap_initialize,
AC_DEFINE(HAVE_LDAP)
AC_DEFINE(HAVE_OPENLDAP)
LIBLDAP="-lldap"))
fi
AC_SUBST(LIBLDAP)
dnl
dnl End of "$Id: cups-ldap.m4 5564 2006-05-22 00:59:11Z mike $".
dnl
+49
Ver Arquivo
@@ -0,0 +1,49 @@
dnl
dnl "$Id: cups-libtool.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
turn on building with libtool (UNSUPPORTED!), default=no],
[if test x$enable_libtool_unsupported != xno; then
LIBTOOL="$enable_libtool_unsupported"
enable_shared=no
echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
echo " (even if you have a support contract)"
else
LIBTOOL=""
fi])
AC_SUBST(LIBTOOL)
if test x$LIBTOOL != x; then
LIBCUPS="libcups.la"
LIBCUPSIMAGE="libcupsimage.la"
LINKCUPS="../cups/\$(LIBCUPS)"
LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
DSO="\$(CC)"
fi
dnl
dnl End of "$Id: cups-libtool.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+113
Ver Arquivo
@@ -0,0 +1,113 @@
dnl
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-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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
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*)
# Darwin, MacOS X, Linux, GNU HURD, *BSD, and AIX
mandir="/usr/share/man"
AMANDIR="/usr/share/man"
PMANDIR="/usr/share/man"
;;
IRIX)
# SGI IRIX
mandir="/usr/share/catman/u_man"
AMANDIR="/usr/share/catman/a_man"
PMANDIR="/usr/share/catman/p_man"
;;
*)
# All others
mandir="/usr/man"
AMANDIR="/usr/man"
PMANDIR="/usr/man"
;;
esac
else
AMANDIR="$mandir"
PMANDIR="$mandir"
fi
AC_SUBST(AMANDIR)
AC_SUBST(PMANDIR)
dnl Setup manpage extensions...
case "$uname" in
*BSD* | Darwin*)
# *BSD
MAN1EXT=1
MAN5EXT=5
MAN7EXT=7
MAN8EXT=8
MAN8DIR=8
;;
IRIX*)
# SGI IRIX
MAN1EXT=1
MAN5EXT=5
MAN7EXT=7
MAN8EXT=1m
MAN8DIR=1
;;
SunOS* | HP-UX*)
# Solaris and HP-UX
MAN1EXT=1
MAN5EXT=5
MAN7EXT=7
MAN8EXT=1m
MAN8DIR=1m
;;
Linux* | GNU*)
# Linux and GNU Hurd
MAN1EXT=1.gz
MAN5EXT=5.gz
MAN7EXT=7.gz
MAN8EXT=8.gz
MAN8DIR=8
;;
*)
# All others
MAN1EXT=1
MAN5EXT=5
MAN7EXT=7
MAN8EXT=8
MAN8DIR=8
;;
esac
AC_SUBST(MAN1EXT)
AC_SUBST(MAN5EXT)
AC_SUBST(MAN7EXT)
AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 5799 2006-08-03 00:54:38Z mike $".
dnl
+89
Ver Arquivo
@@ -0,0 +1,89 @@
dnl
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
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(gethostbyaddr, nsl)
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
if test "$uname" = "SunOS"; then
case "$uversion" in
55* | 56*)
maxfiles=1024
;;
*)
maxfiles=4096
;;
esac
else
maxfiles=4096
fi
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler (deprecated) ],
maxfiles=$withval)
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
CUPS_DEFAULT_DOMAINSOCKET=""
dnl Domain socket support...
AC_ARG_WITH(domainsocket, [ --with-domainsocket set unix domain socket name],
default_domainsocket="$withval",
default_domainsocket="")
if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
if test "x$default_domainsocket" = x; then
case "$uname" in
Darwin*)
# Darwin and MaxOS X do their own thing...
CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
;;
*)
# All others use FHS standard...
CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
;;
esac
else
CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
fi
CUPS_LISTEN_DOMAINSOCKET="Listen $CUPS_DEFAULT_DOMAINSOCKET"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET")
else
CUPS_LISTEN_DOMAINSOCKET=""
fi
AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
dnl
dnl End of "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $".
dnl
+43
Ver Arquivo
@@ -0,0 +1,43 @@
dnl
dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
dnl
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'`
case "$uname" in
GNU* | GNU/*)
uname="GNU"
;;
IRIX*)
uname="IRIX"
;;
Linux*)
uname="Linux"
;;
esac
dnl
dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
+98
Ver Arquivo
@@ -0,0 +1,98 @@
dnl
dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl PAM stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support, default=yes])
dnl Don't use PAM with AIX...
if test $uname = AIX; then
enable_pam=no
fi
PAMDIR=""
PAMFILE=""
PAMLIBS=""
PAMMOD="pam_unknown.so"
if test x$enable_pam != xno; then
SAVELIBS="$LIBS"
AC_CHECK_LIB(dl,dlopen)
AC_CHECK_LIB(pam,pam_start)
AC_CHECK_HEADER(security/pam_appl.h)
if test x$ac_cv_header_security_pam_appl_h != xyes; then
AC_CHECK_HEADER(pam/pam_appl.h,
AC_DEFINE(HAVE_PAM_PAM_APPL_H))
fi
if test x$ac_cv_lib_pam_pam_start != xno; then
# Set the necessary libraries for PAM...
if test x$ac_cv_lib_dl_dlopen != xno; then
PAMLIBS="-lpam -ldl"
else
PAMLIBS="-lpam"
fi
# Find the PAM configuration directory, if any...
for dir in /private/etc/pam.d /etc/pam.d; do
if test -d $dir; then
PAMDIR=$dir
break;
fi
done
fi
LIBS="$SAVELIBS"
case "$uname" in
Darwin*)
# Darwin, MacOS X
PAMFILE="pam.darwin"
;;
IRIX)
# SGI IRIX
PAMFILE="pam.irix"
;;
*)
# All others; this test might need to be updated
# as Linux distributors move things around...
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
if test -f /lib/security/$mod; then
PAMMOD="$mod"
break;
fi
done
PAMFILE="pam.std"
;;
esac
fi
AC_SUBST(PAMDIR)
AC_SUBST(PAMFILE)
AC_SUBST(PAMLIBS)
AC_SUBST(PAMMOD)
dnl
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+37
Ver Arquivo
@@ -0,0 +1,37 @@
dnl
dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl PAP (AppleTalk) stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
# Currently the PAP backend is only supported on MacOS X with the AppleTalk
# SDK installed...
PAP=""
if test $uname = Darwin; then
PAP="pap"
AC_CHECK_HEADER(AppleTalk/at_proto.h)
fi
AC_SUBST(PAP)
dnl
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+43
Ver Arquivo
@@ -0,0 +1,43 @@
dnl
dnl "$Id: cups-pdf.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(pdftops, [ --enable-pdftops build pdftops filter, default=auto ])
PDFTOPS=""
if test "x$enable_pdftops" != xno; then
AC_MSG_CHECKING(whether to build pdftops filter)
if test "x$enable_pdftops" = xyes -o $uname != Darwin; then
PDFTOPS="pdftops"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(PDFTOPS)
dnl
dnl End of "$Id: cups-pdf.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+104
Ver Arquivo
@@ -0,0 +1,104 @@
dnl
dnl "$Id: cups-scripting.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
dnl
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
dnl Do we have Java?
AC_ARG_WITH(java, [ --with-java set Java interpreter for web interfaces ],
CUPS_JAVA="$withval",
CUPS_JAVA="")
if test "x$CUPS_JAVA" = x; then
AC_PATH_PROG(JAVA,java)
CUPS_JAVA="$JAVA"
fi
AC_DEFINE_UNQUOTED(CUPS_JAVA, "$CUPS_JAVA")
if test "x$CUPS_JAVA" != x; then
AC_DEFINE(HAVE_JAVA)
fi
dnl Do we have Perl?
AC_ARG_WITH(perl, [ --with-perl set Perl interpreter for web interfaces ],
CUPS_PERL="$withval",
CUPS_PERL="")
if test "x$CUPS_PERL" = x; then
AC_PATH_PROG(PERL,perl)
CUPS_PERL="$PERL"
fi
AC_DEFINE_UNQUOTED(CUPS_PERL, "$CUPS_PERL")
if test "x$CUPS_PERL" != x; then
AC_DEFINE(HAVE_PERL)
fi
dnl Do we have PHP?
AC_ARG_WITH(php, [ --with-php set PHP interpreter for web interfaces ],
CUPS_PHP="$withval",
CUPS_PHP="")
if test "x$CUPS_PHP" = x; then
AC_PATH_PROG(PHP,php)
CUPS_PHP="$PHP"
fi
AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
if test "x$CUPS_PHP" = x; then
CUPS_PHP="no"
else
AC_DEFINE(HAVE_PHP)
fi
PHPDIR=""
if test "x$CUPS_PHP" != xno; then
AC_PATH_PROG(PHPCONFIG, php-config)
if test "x$PHPCONFIG" != x; then
PHPDIR="scripting/php"
fi
fi
AC_SUBST(PHPDIR)
dnl Do we have Python?
AC_ARG_WITH(python, [ --with-python set Python interpreter for web interfaces ],
CUPS_PYTHON="$withval",
CUPS_PYTHON="")
if test "x$CUPS_PYTHON" = x; then
AC_PATH_PROG(PYTHON,python)
CUPS_PYTHON="$PYTHON"
fi
AC_DEFINE_UNQUOTED(CUPS_PYTHON, "$CUPS_PYTHON")
if test "x$CUPS_PYTHON" != x; then
AC_DEFINE(HAVE_PYTHON)
fi
dnl
dnl End of "$Id: cups-scripting.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+177
Ver Arquivo
@@ -0,0 +1,177 @@
dnl
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
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
PICFLAG=1
DSOFLAGS="${DSOFLAGS:=}"
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=yes])
if test x$enable_shared != xno; then
case "$uname" in
SunOS* | UNIX_S*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-h,\`basename \$@\` -G \$(OPTIM)"
;;
HP-UX*)
LIBCUPS="libcups.sl.2"
LIBCUPSIMAGE="libcupsimage.sl.2"
DSO="\$(LD)"
DSOFLAGS="$DSOFLAGS -b -z +h \`basename \$@\`"
;;
IRIX)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
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,\`basename \$@\` -shared \$(OPTIM)"
;;
Darwin*)
LIBCUPS="libcups.2.dylib"
LIBCUPSIMAGE="libcupsimage.2.dylib"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
;;
AIX*)
LIBCUPS="libcups_s.a"
LIBCUPSIMAGE="libcupsimage_s.a"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry,-blibpath:\$(libdir)"
;;
*)
echo "Warning: shared libraries may not be supported. Trying -shared"
echo " option with compiler."
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
esac
else
PICFLAG=0
LIBCUPS="libcups.a"
LIBCUPSIMAGE="libcupsimage.a"
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)
if test x$enable_shared = xno; then
LINKCUPS="../cups/libcups.a"
LINKCUPSIMAGE="../filter/libcupsimage.a"
else
if test $uname = AIX; then
LINKCUPS="-lcups_s"
LINKCUPSIMAGE="-lcupsimage_s"
else
LINKCUPS="-lcups"
LINKCUPSIMAGE="-lcupsimage"
fi
fi
AC_SUBST(LINKCUPS)
AC_SUBST(LINKCUPSIMAGE)
dnl Update libraries for DSOs...
EXPORT_LDFLAGS=""
if test "$DSO" != ":"; then
# When using DSOs the image libraries are linked to libcupsimage.so
# rather than to the executables. This makes things smaller if you
# are using any static libraries, and it also allows us to distribute
# a single DSO rather than a bunch...
DSOLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
IMGLIBS=""
# 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 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...
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...
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="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
fi
AC_SUBST(DSOLIBS)
AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 5582 2006-05-24 01:00:35Z mike $".
dnl
+48
Ver Arquivo
@@ -0,0 +1,48 @@
dnl
dnl "$Id: cups-slp.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(slp, [ --enable-slp turn on SLP support, default=yes])
AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(openslp-includes, [ --with-openslp-includes set directory for OpenSLP includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
LIBSLP=""
if test x$enable_slp != xno; then
AC_CHECK_HEADER(slp.h,
AC_CHECK_LIB(slp, SLPOpen,
AC_DEFINE(HAVE_LIBSLP)
LIBSLP="-lslp"))
fi
AC_SUBST(LIBSLP)
dnl
dnl End of "$Id: cups-slp.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+119
Ver Arquivo
@@ -0,0 +1,119 @@
dnl
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
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
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
SSLFLAGS=""
SSLLIBS=""
ENCRYPTION_REQUIRED=""
if test x$enable_ssl != xno; then
dnl Look for CDSA...
if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
if test $uname = Darwin; then
AC_CHECK_HEADER(Security/SecureTransport.h,
[SSLLIBS="-framework CoreFoundation -framework Security"
# MacOS X doesn't (yet) come with pre-installed encryption
# 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
fi
dnl Then look for GNU TLS...
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
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...
if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
AC_CHECK_HEADER(openssl/ssl.h,
dnl Save the current libraries so the crypto stuff isn't always
dnl included...
SAVELIBS="$LIBS"
dnl Some ELF systems can't resolve all the symbols in libcrypto
dnl if libcrypto was linked against RSAREF, and fail to link the
dnl test program correctly, even though a correct installation
dnl of OpenSSL exists. So we test the linking three times in
dnl case the RSAREF libraries are needed.
for libcrypto in \
"-lcrypto" \
"-lcrypto -lrsaref" \
"-lcrypto -lRSAglue -lrsaref"
do
AC_CHECK_LIB(ssl,SSL_new,
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
SSLLIBS="-lssl $libcrypto"
ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_LIBSSL)],,
$libcrypto)
if test "x${SSLLIBS}" != "x"; then
break
fi
done
LIBS="$SAVELIBS")
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)
EXPORT_SSLLIBS="$SSLLIBS"
AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 5630 2006-06-05 18:42:53Z mike $".
dnl
+57
Ver Arquivo
@@ -0,0 +1,57 @@
dnl
dnl "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl Threading stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Easy Software Products and are protected by Federal
dnl copyright law. Distribution and use rights are outlined in the file
dnl "LICENSE.txt" which should have been included with this file. If this
dnl file is missing or damaged please contact Easy Software Products
dnl at:
dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
have_pthread=no
PTHREAD_FLAGS=""
if test "x$enable_threads" != xno; then
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
if test x$ac_cv_header_pthread_h = xyes; then
dnl Check various threading options for the platforms we support
for flag in -lpthreads -lpthread -pthread; do
AC_MSG_CHECKING([for pthread_create using $flag])
SAVELIBS="$LIBS"
LIBS="$flag $LIBS"
AC_TRY_LINK([#include <pthread.h>],
[pthread_create(0, 0, 0, 0);],
have_pthread=yes,
LIBS="$SAVELIBS")
AC_MSG_RESULT([$have_pthread])
if test $have_pthread = yes; then
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
break
fi
done
fi
fi
AC_SUBST(PTHREAD_FLAGS)
dnl
dnl End of "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+349 -26
Ver Arquivo
@@ -3,9 +3,7 @@
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
* @configure_input@
*
* Copyright 1997-2000 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
@@ -17,30 +15,101 @@
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
* Hollywood, Maryland 20636 USA
*
* Voice: (301) 373-9603
* Voice: (301) 373-9600
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*/
#ifndef _CUPS_CONFIG_H_
#define _CUPS_CONFIG_H_
/*
* Version of software...
*/
#define CUPS_SVERSION "CUPS v1.1.2"
#define CUPS_SVERSION ""
#define CUPS_MINIMAL ""
/*
* Default user and groups...
*/
#define CUPS_DEFAULT_USER "lp"
#define CUPS_DEFAULT_GROUP "sys"
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
/*
* Default file permissions...
*/
#define CUPS_DEFAULT_CONFIG_FILE_PERM 0640
#define CUPS_DEFAULT_LOG_FILE_PERM 0644
/*
* Default browsing settings...
*/
#define CUPS_DEFAULT_BROWSING 1
#define CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS "CUPS"
#define CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS "CUPS"
#define CUPS_DEFAULT_BROWSE_SHORT_NAMES 1
#define CUPS_DEFAULT_DEFAULT_SHARED 1
#define CUPS_DEFAULT_IMPLICIT_CLASSES 1
#define CUPS_DEFAULT_USE_NETWORK_DEFAULT 1
/*
* Default IPP port...
*/
#define CUPS_DEFAULT_IPP_PORT 631
/*
* Default printcap file...
*/
#define CUPS_DEFAULT_PRINTCAP "/etc/printcap"
/*
* Maximum number of file descriptors to support.
*/
#define CUPS_MAX_FDS 4096
/*
* Do we have domain socket support?
*/
#undef CUPS_DEFAULT_DOMAINSOCKET
/*
* Where are files stored?
*
* Note: These are defaults, which can be overridden by environment
* variables at run-time...
*/
#define CUPS_LOCALEDIR "/usr/share/locale"
#define CUPS_SERVERROOT "/etc/cups"
#define CUPS_SERVERBIN "/usr/lib/cups"
#define CUPS_DOCROOT "/usr/share/doc/cups"
#define CUPS_REQUESTS "/var/spool/cups"
#define CUPS_LOGDIR "/var/logs/cups"
#define CUPS_BINDIR "/usr/bin"
#define CUPS_CACHEDIR "/var/cache/cups"
#define CUPS_DATADIR "/usr/share/cups"
#define CUPS_DOCROOT "/usr/share/doc/cups"
#define CUPS_FONTPATH "/usr/share/cups/fonts"
#define CUPS_LOCALEDIR "/usr/share/locale"
#define CUPS_LOGDIR "/var/logs/cups"
#define CUPS_REQUESTS "/var/spool/cups"
#define CUPS_SBINDIR "/usr/sbin"
#define CUPS_SERVERBIN "/usr/lib/cups"
#define CUPS_SERVERROOT "/etc/cups"
#define CUPS_STATEDIR "/var/run/cups"
/*
@@ -52,20 +121,6 @@
#undef HAVE_LIBJPEG
#undef HAVE_LIBTIFF
/*
* Does this machine store words in big-endian (MSB-first) order?
*/
#undef WORDS_BIGENDIAN
/*
* Which directory functions and headers do we use?
*/
#undef HAVE_DIRENT_H
#undef HAVE_SYS_DIR_H
#undef HAVE_SYS_NDIR_H
#undef HAVE_NDIR_H
/*
* Do we have PAM stuff?
@@ -75,18 +130,55 @@
#define HAVE_LIBPAM 0
#endif /* !HAVE_LIBPAM */
#undef HAVE_PAM_PAM_APPL_H
/*
* Do we have <shadow.h>?
*/
#undef HAVE_SHADOW_H
/*
* Do we have <crypt.h>?
*/
#undef HAVE_CRYPT_H
/*
* Use <string.h>, <strings.h>, and/or <bstring.h>?
*/
#undef HAVE_STRING_H
#undef HAVE_STRINGS_H
#undef HAVE_BSTRING_H
/*
* Do we have the long long type?
*/
#undef HAVE_LONG_LONG
#ifdef HAVE_LONG_LONG
# define CUPS_LLFMT "%lld"
# define CUPS_LLCAST (long long)
#else
# define CUPS_LLFMT "%ld"
# define CUPS_LLCAST (long)
#endif /* HAVE_LONG_LONG */
/*
* Do we have the strtoll() function?
*/
#undef HAVE_STRTOLL
#ifndef HAVE_STRTOLL
# define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
#endif /* !HAVE_STRTOLL */
/*
* Do we have the strXXX() functions?
*/
@@ -94,6 +186,16 @@
#undef HAVE_STRDUP
#undef HAVE_STRCASECMP
#undef HAVE_STRNCASECMP
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
/*
* Do we have the geteuid() function?
*/
#undef HAVE_GETEUID
/*
* Do we have the vsyslog() function?
@@ -101,6 +203,7 @@
#undef HAVE_VSYSLOG
/*
* Do we have the (v)snprintf() functions?
*/
@@ -108,6 +211,7 @@
#undef HAVE_SNPRINTF
#undef HAVE_VSNPRINTF
/*
* What signal functions to use?
*/
@@ -115,6 +219,7 @@
#undef HAVE_SIGSET
#undef HAVE_SIGACTION
/*
* What wait functions to use?
*/
@@ -122,6 +227,224 @@
#undef HAVE_WAITPID
#undef HAVE_WAIT3
/*
* Do we have the mallinfo function and malloc.h?
*/
#undef HAVE_MALLINFO
#undef HAVE_MALLOC_H
/*
* Do we have the POSIX ACL functions?
*/
#undef HAVE_ACL_INIT
/*
* Do we have the langinfo.h header file?
*/
#undef HAVE_LANGINFO_H
/*
* Which encryption libraries do we have?
*/
#undef HAVE_CDSASSL
#undef HAVE_GNUTLS
#undef HAVE_LIBSSL
#undef HAVE_SSL
/*
* Do we have <Security/SecBasePriv.h>?
*/
#undef HAVE_SECBASEPRIV_H
/*
* Do we have the SLP library?
*/
#undef HAVE_LIBSLP
/*
* Do we have an LDAP library?
*/
#undef HAVE_LDAP
#undef HAVE_OPENLDAP
/*
* Do we have libpaper?
*/
#undef HAVE_LIBPAPER
/*
* Do we have <sys/ioctl.h>?
*/
#undef HAVE_SYS_IOCTL_H
/*
* Do we have mkstemp() and/or mkstemps()?
*/
#undef HAVE_MKSTEMP
#undef HAVE_MKSTEMPS
/*
* Does the "tm" structure contain the "tm_gmtoff" member?
*/
#undef HAVE_TM_GMTOFF
/*
* Do we have rresvport_af()?
*/
#undef HAVE_RRESVPORT_AF
/*
* Do we have getaddrinfo()?
*/
#undef HAVE_GETADDRINFO
/*
* Do we have getnameinfo()?
*/
#undef HAVE_GETNAMEINFO
/*
* Do we have getifaddrs()?
*/
#undef HAVE_GETIFADDRS
/*
* Do we have hstrerror()?
*/
#undef HAVE_HSTRERROR
/*
* Do we have the <sys/sockio.h> header file?
*/
#undef HAVE_SYS_SOCKIO_H
/*
* Does the sockaddr structure contain an sa_len parameter?
*/
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
/*
* Do we have the AIX usersec.h header file?
*/
#undef HAVE_USERSEC_H
/*
* Do we have pthread support?
*/
#undef HAVE_PTHREAD_H
/*
* Do we have launchd support?
*/
#undef HAVE_LAUNCH_H
#undef HAVE_LAUNCHD
#define CUPS_DEFAULT_LAUNCHD_CONF ""
/*
* Various scripting languages...
*/
#undef HAVE_JAVA
#define CUPS_JAVA "/usr/bin/java"
#undef HAVE_PERL
#define CUPS_PERL "/usr/bin/perl"
#undef HAVE_PHP
#define CUPS_PHP "/usr/bin/php"
#undef HAVE_PYTHON
#define CUPS_PYTHON "/usr/bin/python"
/*
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
*/
#undef HAVE_COREFOUNDATION
#undef HAVE_SYSTEMCONFIGURATION
/*
* Do we have CoreFoundation public and private headers?
*/
#undef HAVE_COREFOUNDATION_H
#undef HAVE_CFPRIV_H
#undef HAVE_CFBUNDLEPRIV_H
/*
* Do we have MacOSX 10.4's mbr_XXX functions()?
*/
#undef HAVE_MEMBERSHIP_H
#undef HAVE_MBR_UID_TO_UUID
/*
* Do we have Darwin's notify_post() header and function?
*/
#undef HAVE_NOTIFY_H
#undef HAVE_NOTIFY_POST
/*
* Do we have DBUS?
*/
#undef HAVE_DBUS
/*
* Do we have the AppleTalk/at_proto.h header?
*/
#undef HAVE_APPLETALK_AT_PROTO_H
#endif /* !_CUPS_CONFIG_H_ */
/*
* End of "$Id$".
*/
+55 -499
Ver Arquivo
@@ -3,7 +3,7 @@ dnl "$Id$"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 1997-2000 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
@@ -15,516 +15,72 @@ dnl
dnl Attn: CUPS Licensing Information
dnl Easy Software Products
dnl 44141 Airport View Drive, Suite 204
dnl Hollywood, Maryland 20636-3111 USA
dnl Hollywood, Maryland 20636 USA
dnl
dnl Voice: (301) 373-9603
dnl Voice: (301) 373-9600
dnl EMail: cups-info@cups.org
dnl WWW: http://www.cups.org
dnl
AC_INIT(cups/cups.h)
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/)
dnl Get the operating system and version number...
sinclude(config-scripts/cups-opsys.m4)
sinclude(config-scripts/cups-common.m4)
sinclude(config-scripts/cups-directories.m4)
sinclude(config-scripts/cups-manpages.m4)
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test "$uname" = "IRIX64"; then
uname="IRIX"
sinclude(config-scripts/cups-sharedlibs.m4)
sinclude(config-scripts/cups-libtool.m4)
sinclude(config-scripts/cups-compiler.m4)
sinclude(config-scripts/cups-image.m4)
sinclude(config-scripts/cups-network.m4)
sinclude(config-scripts/cups-slp.m4)
sinclude(config-scripts/cups-ldap.m4)
sinclude(config-scripts/cups-ssl.m4)
sinclude(config-scripts/cups-pam.m4)
sinclude(config-scripts/cups-threads.m4)
sinclude(config-scripts/cups-largefile.m4)
sinclude(config-scripts/cups-launchd.m4)
sinclude(config-scripts/cups-defaults.m4)
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
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
dnl Clear the debugging and non-shared library options unless the user asks
dnl for them...
AC_SUBST(INSTALL_LANGUAGES)
AC_SUBST(UNINSTALL_LANGUAGES)
OPTIM=""
AC_SUBST(OPTIM)
PICFLAG=1
CFLAGS="${CFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
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
man/cups-deviced.man man/cups-driverd.man
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
man/cupsd.conf.man man/lpoptions.man
templates/edit-config.tmpl templates/header.tmpl
$LANGFILES)
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],[if eval "test x$enable_debug = xyes"; then
OPTIM="-g "
fi])
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=yes]])
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
turn on building with libtool (UNSUPPORTED!) [default=no]],[if eval "test x$enable_libtool_unsupported != xno"; then
LIBTOOL="$enable_libtool_unsupported"
enable_shared=no
echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
echo " (even if you have a support contract)"
else
LIBTOOL=""
fi])
if test "$enable_shared" != "no"; then
case "$uname" in
SunOS* | UNIX_S*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC) -Wl,-h,\$@ -G \$(OPTIM) -o"
;;
HP-UX*)
LIBCUPS="libcups.sl.2"
LIBCUPSIMAGE="libcupsimage.sl.2"
DSO="ld -b -z +h \$@ -o"
;;
FreeBSD* | NetBSD* | OpenBSD*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
;;
OSF1* | Linux*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
;;
IRIX*)
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC) -soname \$@ -shared \$(OPTIM) -o"
;;
*)
echo "Warning: shared libraries may not be supported. Trying -shared"
echo " option with compiler."
LIBCUPS="libcups.so.2"
LIBCUPSIMAGE="libcupsimage.so.2"
DSO="\$(CC) -Wl,-soname,\$@ -shared \$(OPTIM) -o"
;;
esac
else
PICFLAG=0
LIBCUPS="libcups.a"
LIBCUPSIMAGE="libcupsimage.a"
DSO=":"
fi
if test "$LIBTOOL" != ""; then
LIBCUPS="libcups.la"
LIBCUPSIMAGE="libcupsimage.la"
LINKCUPS="../cups/\$(LIBCUPS)"
LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
DSO=":"
else
LINKCUPS="-L../cups -lcups"
LINKCUPSIMAGE="-L../filter -lcupsimage"
fi
AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support [default=yes]])
dnl Checks for programs...
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(CHOWN,chown)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(NROFF,nroff)
if test "$NROFF" = ""; then
AC_PATH_PROG(GROFF,groff)
if test "$GROFF" = ""; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
fi
fi
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(MKDIR,mkdir)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(SED,sed)
dnl Architecture checks...
AC_C_BIGENDIAN
dnl Check for libraries...
AC_CHECK_LIB(c,crypt,LIBS="$LIBS",AC_CHECK_LIB(crypt,crypt))
AC_CHECK_HEADER(crypt.h, AC_DEFINE(HAVE_CRYPT_H))
AC_CHECK_LIB(sec,getspent)
if test "$enable_pam" != "no"; then
OLDLIBS="$LIBS"
AC_CHECK_LIB(dl,dlopen)
AC_CHECK_LIB(pam,pam_start)
if test "$ac_cv_lib_pam_pam_start" != "no"; then
PAMDIR="/etc/pam.d"
else
PAMDIR=""
LIBS="$OLDLIBS"
fi
AC_SUBST(PAMDIR)
fi
NETLIBS=""
AC_SUBST(NETLIBS)
AC_CHECK_LIB(socket,socket,
if test "$uname" != "IRIX"; then
NETLIBS="-lsocket"
else
echo "Not using -lsocket since you are running IRIX."
fi)
AC_CHECK_LIB(nsl,gethostbyaddr,
if test "$uname" != "IRIX"; then
NETLIBS="$NETLIBS -lnsl"
else
echo "Not using -lnsl since you are running IRIX."
fi)
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...
LIBJPEG=""
LIBPNG=""
LIBTIFF=""
LIBZ=""
AC_SUBST(LIBJPEG)
AC_SUBST(LIBPNG)
AC_SUBST(LIBTIFF)
AC_SUBST(LIBZ)
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_DEFINE(HAVE_LIBJPEG)
LIBJPEG="-ljpeg"
LIBS="$LIBS -ljpeg")
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)
AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
AC_DEFINE(HAVE_LIBPNG)
LIBPNG="-lpng")
AC_CHECK_LIB(tiff, TIFFReadScanline,
AC_DEFINE(HAVE_LIBTIFF)
LIBTIFF="-ltiff")
dnl Restore original LIBS settings...
LIBS="$SAVELIBS"
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup)
AC_CHECK_FUNCS(strcasecmp)
AC_CHECK_FUNCS(strncasecmp)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(vsnprintf)
dnl Checks for vsyslog function.
AC_CHECK_FUNCS(vsyslog)
dnl Checks for signal functions.
if test "$uname" != "Linux"; then
AC_CHECK_FUNCS(sigset)
fi
AC_CHECK_FUNCS(sigaction)
dnl Checks for wait functions.
AC_CHECK_FUNCS(waitpid)
AC_CHECK_FUNCS(wait3)
dnl Update compiler options...
if test -n "$GCC"; then
if test -z "$OPTIM"; then
OPTIM="-O2 -g3"
fi
if test $PICFLAG = 1; then
OPTIM="-fPIC $OPTIM"
fi
OPTIM="-Wall $OPTIM"
else
case $uname in
IRIX*)
if test -z "$OPTIM"; then
OPTIM="-O2 -g3"
fi
if test $uversion -ge 62; then
OPTIM="$OPTIM -n32 -mips3"
fi
OPTIM="-fullwarn $OPTIM"
;;
HP-UX*)
if test -z "$OPTIM"; then
OPTIM="+O2 -g3"
fi
OPTIM="-Ae $OPTIM"
;;
SunOS*)
# Solaris
if test -z "$OPTIM"; then
OPTIM="-O -g3"
fi
if test $PICFLAG = 1; then
OPTIM="-KPIC $OPTIM"
fi
;;
*)
# Running some other operating system; inform the user they
# should contribute the necessary options to
# cups-support@cups.org...
echo "Building CUPS with default compiler optimizations; contact"
echo "cups-support@cups.org with uname and compiler options needed"
echo "for your platform, or set the CFLAGS environment variable"
echo "before running configure."
;;
esac
fi
if test "$DSO" != ":"; then
# When using DSOs the image libraries are linked to libcupsimage.so
# rather than to the executables. This makes things smaller if you
# are using any static libraries, and it also allows us to distribute
# a single DSO rather than a bunch...
DSOLIBS="\$(LIBJPEG) \$(LIBPNG) \$(LIBTIFF) \$(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!)
case $uname in
HP-UX*)
LDFLAGS="$LDFLAGS -Wl,+b,$libdir,+fb"
;;
SunOS*)
# Solaris
LDFLAGS="$LDFLAGS -R$libdir"
;;
FreeBSD* | NetBSD* | OpenBSD*)
# *BSD
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
;;
esac
else
DSOLIBS=""
IMGLIBS="\$(LIBJPEG) \$(LIBPNG) \$(LIBTIFF) \$(LIBZ)"
fi
AC_SUBST(DSO)
AC_SUBST(DSOLIBS)
AC_SUBST(IMGLIBS)
AC_SUBST(LIBCUPS)
AC_SUBST(LIBCUPSIMAGE)
AC_SUBST(LIBTOOL)
AC_SUBST(LINKCUPS)
AC_SUBST(LINKCUPSIMAGE)
dnl Fix "prefix" variable if it hasn't been specified...
if test "$prefix" = "NONE"; then
prefix="/"
fi
dnl Fix "exec_prefix" variable if it hasn't been specified...
if test "$exec_prefix" = "NONE"; then
if test "$prefix" = "/"; then
exec_prefix="/usr"
else
exec_prefix="$prefix"
fi
fi
dnl Fix "sharedstatedir" variable if it hasn't been specified...
if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
sharedstatedir="/usr/com"
fi
dnl Fix "infodir" variable if it hasn't been specified...
if test "$infodir" = "\${prefix}/info" -a "$prefix" = "/"; then
infodir="/usr/info"
fi
dnl Fix "datadir" variable if it hasn't been specified...
if test "$datadir" = "\${prefix}/share" -a "$prefix" = "/"; then
datadir="/usr/share"
fi
dnl Fix "includedir" variable if it hasn't been specified...
if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
includedir="/usr/include"
fi
dnl Fix "localstatedir" variable if it hasn't been specified...
if test "$localstatedir" = "\${prefix}/var"; then
if test "$prefix" = "/"; then
localstatedir="/var"
else
localstatedir="$prefix/var"
fi
fi
dnl Fix "sysconfdir" variable if it hasn't been specified...
if test "$sysconfdir" = "\${prefix}/etc"; then
if test "$prefix" = "/"; then
sysconfdir="/etc"
else
sysconfdir="$prefix/etc"
fi
fi
dnl Fix "libdir" variable for IRIX 6.x...
if test "$uname" = "IRIX" -a $uversion -ge 62; then
libdir="$exec_prefix/lib32"
fi
dnl Fix "mandir" variable...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
if test "$uname" = "IRIX"; then
mandir="/usr/share/catman"
else
mandir="/usr/man"
fi
fi
dnl Setup manpage extensions...
case "$uname" in
FreeBSD* | NetBSD* | OpenBSD*)
# *BSD
CAT1EXT=0
CAT5EXT=0
CAT8EXT=0
;;
IRIX*)
# SGI IRIX
CAT1EXT=z
CAT5EXT=z
CAT8EXT=z
;;
*)
# All others
CAT1EXT=1
CAT5EXT=5
CAT8EXT=8
;;
esac
AC_SUBST(CAT1EXT)
AC_SUBST(CAT5EXT)
AC_SUBST(CAT8EXT)
dnl Setup init.d locations...
if test $prefix = "/"; then
case "$uname" in
FreeBSD* | NetBSD* | OpenBSD*)
# *BSD
INITDIR=""
INITDDIR=""
;;
Linux*)
# Linux seems to choose an init.d directory at random...
if test -d /sbin/init.d; then
# SuSE
INITDIR="/sbin/init.d"
INITDDIR=".."
else
if test -d /etc/rc.d; then
# RedHat
INITDIR="/etc/rc.d"
INITDDIR="../init.d"
else
# Others
INITDIR="/etc"
INITDDIR="../init.d"
fi
fi
;;
OSF1* | HP-UX*)
INITDIR="/sbin"
INITDDIR="../init.d"
;;
*)
INITDIR="/etc"
INITDDIR="../init.d"
;;
esac
else
INITDIR="/etc"
INITDDIR="../init.d"
fi
AC_SUBST(INITDIR)
AC_SUBST(INITDDIR)
dnl Setup default locations...
CUPS_SERVERROOT='${prefix}/etc/cups'
CUPS_LOGDIR='${prefix}/var/log/cups'
CUPS_REQUESTS='${prefix}/var/spool/cups'
AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$prefix/etc/cups")
AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$prefix/var/log/cups")
AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$prefix/var/spool/cups")
dnl See what directory to put server executables...
case "$uname" in
FreeBSD* | NetBSD* | OpenBSD*)
# *BSD
INSTALL_SYSV=""
CUPS_SERVERBIN='${exec_prefix}/libexec/cups'
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/libexec/cups")
;;
*)
# All others
INSTALL_SYSV="install-sysv"
CUPS_SERVERBIN='${exec_prefix}/lib/cups'
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
;;
esac
AC_SUBST(INSTALL_SYSV)
AC_SUBST(CUPS_SERVERROOT)
AC_SUBST(CUPS_SERVERBIN)
AC_SUBST(CUPS_LOGDIR)
AC_SUBST(CUPS_REQUESTS)
dnl Set the CUPS_LOCALE directory...
case "$uname" in
Linux* | FreeBSD* | NetBSD* | OpenBSD*)
CUPS_LOCALEDIR='${exec_prefix}/share/locale'
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/share/locale")
;;
OSF1*)
CUPS_LOCALEDIR='${exec_prefix}/lib/nls/msg'
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/nls/msg")
;;
*)
# This is the standard System V location...
CUPS_LOCALEDIR='${exec_prefix}/lib/locale'
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/locale")
;;
esac
AC_SUBST(CUPS_LOCALEDIR)
dnl Set the CUPS_DATADIR directory...
CUPS_DATADIR='${exec_prefix}/share/cups'
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$exec_prefix/share/cups")
AC_SUBST(CUPS_DATADIR)
dnl Set the CUPS_DOCROOT directory...
CUPS_DOCROOT='${exec_prefix}/share/doc/cups'
AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$exec_prefix/share/doc/cups")
AC_SUBST(CUPS_DOCROOT)
AC_OUTPUT(Makedefs cups.sh)
chmod +x cups-config
dnl
dnl End of "$Id$".
Arquivo executável
+155
Ver Arquivo
@@ -0,0 +1,155 @@
#! /bin/sh
#
# "$Id$"
#
# CUPS configuration utility.
#
# Copyright 2001-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.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
VERSION="@CUPS_VERSION@"
APIVERSION="1.2"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
includedir=@includedir@
libdir=@libdir@
imagelibdir=@libdir@
datarootdir=@datadir@
datadir=@datadir@
sysconfdir=@sysconfdir@
cups_datadir=@CUPS_DATADIR@
cups_serverbin=@CUPS_SERVERBIN@
cups_serverroot=@CUPS_SERVERROOT@
INSTALLSTATIC=@INSTALLSTATIC@
# flags for C++ compiler:
CFLAGS=""
LDFLAGS="@EXPORT_LDFLAGS@"
LIBS="@EXPORT_SSLLIBS@ @EXPORT_LIBZ@ @LIBS@"
IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@"
# 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
usage ()
{
echo "Usage: cups-config --api-version"
echo " cups-config --cflags"
echo " cups-config --datadir"
echo " cups-config --help"
echo " cups-config --ldflags"
echo " cups-config [--image] [--static] --libs"
echo " cups-config --serverbin"
echo " cups-config --serverroot"
echo " cups-config --version"
exit $1
}
if test $# -eq 0; then
usage 1
fi
# Parse command line options
static=no
image=no
while test $# -gt 0; do
case $1 in
--api-version)
echo $APIVERSION
;;
--cflags)
echo $CFLAGS
;;
--datadir)
echo $cups_datadir
;;
--help)
usage 0
;;
--image)
image=yes
;;
--ldflags)
echo $LDFLAGS
;;
--libs)
if test $static = no; then
if test $image = no; then
echo -lcups $LIBS
else
echo -lcupsimage -lcups $IMGLIBS $LIBS
fi
else
if test $image = no; then
echo $libdir/libcups.a $LIBS
else
echo $imagelibdir/libcupsimage.a $libdir/libcups.a $IMGLIBS $LIBS
fi
fi
;;
--serverbin)
echo $cups_serverbin
;;
--serverroot)
echo $cups_serverroot
;;
--static)
if test -z "$INSTALLSTATIC"; then
echo "WARNING: Static libraries not installed!" >&2
else
static=yes
fi
;;
--version)
echo $VERSION
;;
*)
usage 1
;;
esac
shift
done
#
# End of "$Id$".
#
-128
Ver Arquivo
@@ -1,128 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "cups"=.\cups\cups.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "cupsd"=.\scheduler\cupsd.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
}}}
###############################################################################
Project: "hpgltops"=.\filter\hpgltops.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
}}}
###############################################################################
Project: "image"=.\filter\image.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "pstops"=.\filter\pstops.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testmime"=.\cups\testmime.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
}}}
###############################################################################
Project: "testppd"=.\cups\testppd.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
}}}
###############################################################################
Project: "texttops"=.\filter\texttops.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
-509
Ver Arquivo
@@ -1,509 +0,0 @@
#
# "$Id: cups.list 1277 2000-08-04 14:53:49Z mike $"
#
# ESP Package Manager (EPM) file list for the Common UNIX Printing
# System (CUPS).
#
# Copyright 1997-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
%product Common UNIX Printing System
%copyright 1993-2000 by Easy Software Products, All Rights Reserved.
%vendor Easy Software Products
%license LICENSE.txt
%readme README.txt
%version 1.1.2
%incompat printpro
%system all
# Server files
f 0555 root sys $SBINDIR/cupsd scheduler/cupsd
d 0555 root sys $SERVERBIN -
d 0555 root sys $SERVERBIN/backend -
f 0555 root sys $SERVERBIN/backend/ipp backend/ipp
l 0555 root sys $SERVERBIN/backend/http ipp
f 0555 root sys $SERVERBIN/backend/lpd backend/lpd
f 0555 root sys $SERVERBIN/backend/parallel backend/parallel
f 0555 root sys $SERVERBIN/backend/serial backend/serial
f 0555 root sys $SERVERBIN/backend/socket backend/socket
f 0555 root sys $SERVERBIN/backend/usb backend/usb
d 0555 root sys $SERVERBIN/cgi-bin -
f 0555 root sys $SERVERBIN/cgi-bin/admin.cgi cgi-bin/admin.cgi
f 0555 root sys $SERVERBIN/cgi-bin/classes.cgi cgi-bin/classes.cgi
f 0555 root sys $SERVERBIN/cgi-bin/jobs.cgi cgi-bin/jobs.cgi
f 0555 root sys $SERVERBIN/cgi-bin/printers.cgi cgi-bin/printers.cgi
d 0555 root sys $SERVERBIN/daemon -
f 0555 root sys $SERVERBIN/daemon/cups-lpd scheduler/cups-lpd
f 0555 root sys $SERVERBIN/daemon/cups-polld scheduler/cups-polld
d 0555 root sys $SERVERBIN/filter -
f 0555 root sys $SERVERBIN/filter/pstoraster pstoraster/pstoraster
f 0555 root sys $SERVERBIN/filter/pdftops pdftops/pdftops
f 0555 root sys $SERVERBIN/filter/imagetops filter/imagetops
f 0555 root sys $SERVERBIN/filter/pstops filter/pstops
f 0555 root sys $SERVERBIN/filter/texttops filter/texttops
f 0555 root sys $SERVERBIN/filter/rastertoepson filter/rastertoepson
f 0555 root sys $SERVERBIN/filter/rastertohp filter/rastertohp
f 0555 root sys $SERVERBIN/filter/hpgltops filter/hpgltops
f 0555 root sys $SERVERBIN/filter/imagetoraster filter/imagetoraster
# Admin commands
l 0555 root sys $BINDIR/disable $SBINDIR/accept
l 0555 root sys $BINDIR/enable $SBINDIR/accept
l 0555 root sys $LIBDIR/accept $SBINDIR/accept
l 0555 root sys $LIBDIR/lpadmin $SBINDIR/lpadmin
l 0555 root sys $LIBDIR/reject accept
f 0555 root sys $SBINDIR/accept systemv/accept
f 0555 root sys $SBINDIR/lpadmin systemv/lpadmin
f 0555 root sys $SBINDIR/lpc berkeley/lpc
f 0555 root sys $SBINDIR/lpinfo systemv/lpinfo
f 0555 root sys $SBINDIR/lpmove systemv/lpmove
l 0555 root sys $SBINDIR/reject accept
%system irix
l 0555 root sys /usr/etc/lpc $SBINDIR/lpc
%system all
# User commands
f 0555 root sys $BINDIR/cancel systemv/cancel
f 0555 root sys $BINDIR/lp systemv/lp
f 0555 root sys $BINDIR/lpoptions systemv/lpoptions
f 4555 root sys $BINDIR/lppasswd systemv/lppasswd
f 0555 root sys $BINDIR/lpq berkeley/lpq
f 0555 root sys $BINDIR/lpr berkeley/lpr
f 0555 root sys $BINDIR/lprm berkeley/lprm
f 0555 root sys $BINDIR/lpstat systemv/lpstat
%system irix
l 0555 root sys /usr/bsd/lpq $BINDIR/lpq
l 0555 root sys /usr/bsd/lpr $BINDIR/lpr
l 0555 root sys /usr/bsd/lprm $BINDIR/lprm
%system all
# DSOs
%system hpux
f 0555 root sys $LIBDIR/libcups.sl.2 cups/libcups.sl.2
l 0555 root sys $LIBDIR/libcups.sl libcups.sl.2
f 0555 root sys $LIBDIR/libcupsimage.sl.2 filter/libcupsimage.sl.2
l 0555 root sys $LIBDIR/libcupsimage.sl libcupsimage.sl.2
%system !hpux
f 0555 root sys $LIBDIR/libcups.so.2 cups/libcups.so.2
l 0555 root sys $LIBDIR/libcups.so libcups.so.2
f 0555 root sys $LIBDIR/libcupsimage.so.2 filter/libcupsimage.so.2
l 0555 root sys $LIBDIR/libcupsimage.so libcupsimage.so.2
%system all
# Directories
d 0755 root sys $LOGDIR -
d 0700 lp sys $REQUESTS -
d 1700 lp sys $REQUESTS/tmp -
# Data files
f 0444 root sys $LOCALEDIR/C/cups_C locale/C/cups_C
f 0444 root sys $LOCALEDIR/de/cups_de locale/de/cups_de
f 0444 root sys $LOCALEDIR/en/cups_en locale/en/cups_en
f 0444 root sys $LOCALEDIR/es/cups_es locale/es/cups_es
f 0444 root sys $LOCALEDIR/fr/cups_fr locale/fr/cups_fr
f 0444 root sys $LOCALEDIR/it/cups_it locale/it/cups_it
d 0555 root sys $DATADIR -
d 0555 root sys $DATADIR/banners -
f 0444 root sys $DATADIR/banners/classified data/classified
f 0444 root sys $DATADIR/banners/confidential data/confidential
f 0444 root sys $DATADIR/banners/secret data/secret
f 0444 root sys $DATADIR/banners/standard data/standard
f 0444 root sys $DATADIR/banners/topsecret data/topsecret
f 0444 root sys $DATADIR/banners/unclassified data/unclassified
d 0555 root sys $DATADIR/charsets -
f 0444 root sys $DATADIR/charsets/windows-874 data/windows-874
f 0444 root sys $DATADIR/charsets/windows-1250 data/windows-1250
f 0444 root sys $DATADIR/charsets/windows-1251 data/windows-1251
f 0444 root sys $DATADIR/charsets/windows-1252 data/windows-1252
f 0444 root sys $DATADIR/charsets/windows-1253 data/windows-1253
f 0444 root sys $DATADIR/charsets/windows-1254 data/windows-1254
f 0444 root sys $DATADIR/charsets/windows-1255 data/windows-1255
f 0444 root sys $DATADIR/charsets/windows-1256 data/windows-1256
f 0444 root sys $DATADIR/charsets/windows-1257 data/windows-1257
f 0444 root sys $DATADIR/charsets/windows-1258 data/windows-1258
f 0444 root sys $DATADIR/charsets/iso-8859-1 data/iso-8859-1
f 0444 root sys $DATADIR/charsets/iso-8859-14 data/iso-8859-14
f 0444 root sys $DATADIR/charsets/iso-8859-15 data/iso-8859-15
f 0444 root sys $DATADIR/charsets/iso-8859-2 data/iso-8859-2
f 0444 root sys $DATADIR/charsets/iso-8859-3 data/iso-8859-3
f 0444 root sys $DATADIR/charsets/iso-8859-4 data/iso-8859-4
f 0444 root sys $DATADIR/charsets/iso-8859-5 data/iso-8859-5
f 0444 root sys $DATADIR/charsets/iso-8859-6 data/iso-8859-6
f 0444 root sys $DATADIR/charsets/iso-8859-7 data/iso-8859-7
f 0444 root sys $DATADIR/charsets/iso-8859-8 data/iso-8859-8
f 0444 root sys $DATADIR/charsets/iso-8859-9 data/iso-8859-9
f 0444 root sys $DATADIR/charsets/utf-8 data/utf-8
d 0555 root sys $DATADIR/data -
f 0444 root sys $DATADIR/data/HPGLprolog data/HPGLprolog
f 0444 root sys $DATADIR/data/psglyphs data/psglyphs
f 0444 root sys $DATADIR/data/testprint.ps data/testprint.ps
d 0555 root sys $DATADIR/fonts -
f 0444 root sys $DATADIR/fonts/AvantGarde-Book fonts/AvantGarde-Book
f 0444 root sys $DATADIR/fonts/AvantGarde-BookOblique fonts/AvantGarde-BookOblique
f 0444 root sys $DATADIR/fonts/AvantGarde-Demi fonts/AvantGarde-Demi
f 0444 root sys $DATADIR/fonts/AvantGarde-DemiOblique fonts/AvantGarde-DemiOblique
f 0444 root sys $DATADIR/fonts/Bookman-Demi fonts/Bookman-Demi
f 0444 root sys $DATADIR/fonts/Bookman-DemiItalic fonts/Bookman-DemiItalic
f 0444 root sys $DATADIR/fonts/Bookman-Light fonts/Bookman-Light
f 0444 root sys $DATADIR/fonts/Bookman-LightItalic fonts/Bookman-LightItalic
f 0444 root sys $DATADIR/fonts/Charter-Bold fonts/Charter-Bold
f 0444 root sys $DATADIR/fonts/Charter-BoldItalic fonts/Charter-BoldItalic
f 0444 root sys $DATADIR/fonts/Charter-Italic fonts/Charter-Italic
f 0444 root sys $DATADIR/fonts/Charter-Roman fonts/Charter-Roman
f 0444 root sys $DATADIR/fonts/Courier fonts/Courier
f 0444 root sys $DATADIR/fonts/Courier-Bold fonts/Courier-Bold
f 0444 root sys $DATADIR/fonts/Courier-BoldOblique fonts/Courier-BoldOblique
f 0444 root sys $DATADIR/fonts/Courier-Oblique fonts/Courier-Oblique
f 0444 root sys $DATADIR/fonts/Helvetica fonts/Helvetica
f 0444 root sys $DATADIR/fonts/Helvetica-Bold fonts/Helvetica-Bold
f 0444 root sys $DATADIR/fonts/Helvetica-BoldOblique fonts/Helvetica-BoldOblique
f 0444 root sys $DATADIR/fonts/Helvetica-Narrow fonts/Helvetica-Narrow
f 0444 root sys $DATADIR/fonts/Helvetica-Narrow-Bold fonts/Helvetica-Narrow-Bold
f 0444 root sys $DATADIR/fonts/Helvetica-Narrow-BoldOblique fonts/Helvetica-Narrow-BoldOblique
f 0444 root sys $DATADIR/fonts/Helvetica-Narrow-Oblique fonts/Helvetica-Narrow-Oblique
f 0444 root sys $DATADIR/fonts/Helvetica-Oblique fonts/Helvetica-Oblique
f 0444 root sys $DATADIR/fonts/NewCenturySchlbk-Bold fonts/NewCenturySchlbk-Bold
f 0444 root sys $DATADIR/fonts/NewCenturySchlbk-BoldItalic fonts/NewCenturySchlbk-BoldItalic
f 0444 root sys $DATADIR/fonts/NewCenturySchlbk-Italic fonts/NewCenturySchlbk-Italic
f 0444 root sys $DATADIR/fonts/NewCenturySchlbk-Roman fonts/NewCenturySchlbk-Roman
f 0444 root sys $DATADIR/fonts/Palatino-Bold fonts/Palatino-Bold
f 0444 root sys $DATADIR/fonts/Palatino-BoldItalic fonts/Palatino-BoldItalic
f 0444 root sys $DATADIR/fonts/Palatino-Italic fonts/Palatino-Italic
f 0444 root sys $DATADIR/fonts/Palatino-Roman fonts/Palatino-Roman
f 0444 root sys $DATADIR/fonts/Symbol fonts/Symbol
f 0444 root sys $DATADIR/fonts/Times-Bold fonts/Times-Bold
f 0444 root sys $DATADIR/fonts/Times-BoldItalic fonts/Times-BoldItalic
f 0444 root sys $DATADIR/fonts/Times-Italic fonts/Times-Italic
f 0444 root sys $DATADIR/fonts/Times-Roman fonts/Times-Roman
f 0444 root sys $DATADIR/fonts/Utopia-Bold fonts/Utopia-Bold
f 0444 root sys $DATADIR/fonts/Utopia-BoldItalic fonts/Utopia-BoldItalic
f 0444 root sys $DATADIR/fonts/Utopia-Italic fonts/Utopia-Italic
f 0444 root sys $DATADIR/fonts/Utopia-Regular fonts/Utopia-Regular
f 0444 root sys $DATADIR/fonts/ZapfChancery-MediumItalic fonts/ZapfChancery-MediumItalic
f 0444 root sys $DATADIR/fonts/ZapfDingbats fonts/ZapfDingbats
d 0555 root sys $DATADIR/pstoraster -
f 0444 root sys $DATADIR/pstoraster/Fontmap pstoraster/Fontmap
f 0444 root sys $DATADIR/pstoraster/gs_btokn.ps pstoraster/gs_btokn.ps
f 0444 root sys $DATADIR/pstoraster/gs_ccfnt.ps pstoraster/gs_ccfnt.ps
f 0444 root sys $DATADIR/pstoraster/gs_cff.ps pstoraster/gs_cff.ps
f 0444 root sys $DATADIR/pstoraster/gs_cidfn.ps pstoraster/gs_cidfn.ps
f 0444 root sys $DATADIR/pstoraster/gs_cmap.ps pstoraster/gs_cmap.ps
f 0444 root sys $DATADIR/pstoraster/gs_cmdl.ps pstoraster/gs_cmdl.ps
f 0444 root sys $DATADIR/pstoraster/gs_dbt_e.ps pstoraster/gs_dbt_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_diskf.ps pstoraster/gs_diskf.ps
f 0444 root sys $DATADIR/pstoraster/gs_dpnxt.ps pstoraster/gs_dpnxt.ps
f 0444 root sys $DATADIR/pstoraster/gs_dps.ps pstoraster/gs_dps.ps
f 0444 root sys $DATADIR/pstoraster/gs_dps1.ps pstoraster/gs_dps1.ps
f 0444 root sys $DATADIR/pstoraster/gs_dps2.ps pstoraster/gs_dps2.ps
f 0444 root sys $DATADIR/pstoraster/gs_epsf.ps pstoraster/gs_epsf.ps
f 0444 root sys $DATADIR/pstoraster/gs_fform.ps pstoraster/gs_fform.ps
f 0444 root sys $DATADIR/pstoraster/gs_fonts.ps pstoraster/gs_fonts.ps
f 0444 root sys $DATADIR/pstoraster/gs_init.ps pstoraster/gs_init.ps
f 0444 root sys $DATADIR/pstoraster/gs_iso_e.ps pstoraster/gs_iso_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_kanji.ps pstoraster/gs_kanji.ps
f 0444 root sys $DATADIR/pstoraster/gs_ksb_e.ps pstoraster/gs_ksb_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_lev2.ps pstoraster/gs_lev2.ps
f 0444 root sys $DATADIR/pstoraster/gs_ll3.ps pstoraster/gs_ll3.ps
f 0444 root sys $DATADIR/pstoraster/gs_mex_e.ps pstoraster/gs_mex_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_mro_e.ps pstoraster/gs_mro_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_pfile.ps pstoraster/gs_pfile.ps
f 0444 root sys $DATADIR/pstoraster/gs_res.ps pstoraster/gs_res.ps
f 0444 root sys $DATADIR/pstoraster/gs_setpd.ps pstoraster/gs_setpd.ps
f 0444 root sys $DATADIR/pstoraster/gs_statd.ps pstoraster/gs_statd.ps
f 0444 root sys $DATADIR/pstoraster/gs_std_e.ps pstoraster/gs_std_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_sym_e.ps pstoraster/gs_sym_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_ttf.ps pstoraster/gs_ttf.ps
f 0444 root sys $DATADIR/pstoraster/gs_typ32.ps pstoraster/gs_typ32.ps
f 0444 root sys $DATADIR/pstoraster/gs_typ42.ps pstoraster/gs_typ42.ps
f 0444 root sys $DATADIR/pstoraster/gs_type1.ps pstoraster/gs_type1.ps
f 0444 root sys $DATADIR/pstoraster/gs_wan_e.ps pstoraster/gs_wan_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_wl1_e.ps pstoraster/gs_wl1_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_wl2_e.ps pstoraster/gs_wl2_e.ps
f 0444 root sys $DATADIR/pstoraster/gs_wl5_e.ps pstoraster/gs_wl5_e.ps
d 0555 root sys $DATADIR/model -
f 0444 root sys $DATADIR/model/deskjet.ppd ppd/deskjet.ppd
f 0444 root sys $DATADIR/model/laserjet.ppd ppd/laserjet.ppd
f 0444 root sys $DATADIR/model/epson9.ppd ppd/epson9.ppd
f 0444 root sys $DATADIR/model/epson24.ppd ppd/epson24.ppd
f 0444 root sys $DATADIR/model/stcolor.ppd ppd/stcolor.ppd
f 0444 root sys $DATADIR/model/stphoto.ppd ppd/stphoto.ppd
d 0555 root sys $DATADIR/templates -
f 0444 root sys $DATADIR/templates/add-class.tmpl templates/add-class.tmpl
f 0444 root sys $DATADIR/templates/add-printer.tmpl templates/add-printer.tmpl
f 0444 root sys $DATADIR/templates/admin-op.tmpl templates/admin-op.tmpl
f 0444 root sys $DATADIR/templates/admin.tmpl templates/admin.tmpl
f 0444 root sys $DATADIR/templates/choose-device.tmpl templates/choose-device.tmpl
f 0444 root sys $DATADIR/templates/choose-make.tmpl templates/choose-make.tmpl
f 0444 root sys $DATADIR/templates/choose-members.tmpl templates/choose-members.tmpl
f 0444 root sys $DATADIR/templates/choose-model.tmpl templates/choose-model.tmpl
f 0444 root sys $DATADIR/templates/choose-serial.tmpl templates/choose-serial.tmpl
f 0444 root sys $DATADIR/templates/choose-uri.tmpl templates/choose-uri.tmpl
f 0444 root sys $DATADIR/templates/class-added.tmpl templates/class-added.tmpl
f 0444 root sys $DATADIR/templates/class-confirm.tmpl templates/class-confirm.tmpl
f 0444 root sys $DATADIR/templates/class-deleted.tmpl templates/class-deleted.tmpl
f 0444 root sys $DATADIR/templates/class-modified.tmpl templates/class-modified.tmpl
f 0444 root sys $DATADIR/templates/classes.tmpl templates/classes.tmpl
f 0444 root sys $DATADIR/templates/config-printer.tmpl templates/config-printer.tmpl
f 0444 root sys $DATADIR/templates/config-printer2.tmpl templates/config-printer2.tmpl
f 0444 root sys $DATADIR/templates/error.tmpl templates/error.tmpl
f 0444 root sys $DATADIR/templates/header.tmpl templates/header.tmpl
f 0444 root sys $DATADIR/templates/job-cancel.tmpl templates/job-cancel.tmpl
f 0444 root sys $DATADIR/templates/job-hold.tmpl templates/job-hold.tmpl
f 0444 root sys $DATADIR/templates/job-release.tmpl templates/job-release.tmpl
f 0444 root sys $DATADIR/templates/job-restart.tmpl templates/job-restart.tmpl
f 0444 root sys $DATADIR/templates/jobs.tmpl templates/jobs.tmpl
f 0444 root sys $DATADIR/templates/modify-class.tmpl templates/modify-class.tmpl
f 0444 root sys $DATADIR/templates/modify-printer.tmpl templates/modify-printer.tmpl
f 0444 root sys $DATADIR/templates/option-boolean.tmpl templates/option-boolean.tmpl
f 0444 root sys $DATADIR/templates/option-header.tmpl templates/option-header.tmpl
f 0444 root sys $DATADIR/templates/option-pickmany.tmpl templates/option-pickmany.tmpl
f 0444 root sys $DATADIR/templates/option-pickone.tmpl templates/option-pickone.tmpl
f 0444 root sys $DATADIR/templates/option-trailer.tmpl templates/option-trailer.tmpl
f 0444 root sys $DATADIR/templates/printer-accept.tmpl templates/printer-accept.tmpl
f 0444 root sys $DATADIR/templates/printer-added.tmpl templates/printer-added.tmpl
f 0444 root sys $DATADIR/templates/printer-configured.tmpl templates/printer-configured.tmpl
f 0444 root sys $DATADIR/templates/printer-confirm.tmpl templates/printer-confirm.tmpl
f 0444 root sys $DATADIR/templates/printer-deleted.tmpl templates/printer-deleted.tmpl
f 0444 root sys $DATADIR/templates/printer-modified.tmpl templates/printer-modified.tmpl
f 0444 root sys $DATADIR/templates/printer-reject.tmpl templates/printer-reject.tmpl
f 0444 root sys $DATADIR/templates/printer-start.tmpl templates/printer-start.tmpl
f 0444 root sys $DATADIR/templates/printer-stop.tmpl templates/printer-stop.tmpl
f 0444 root sys $DATADIR/templates/printers.tmpl templates/printers.tmpl
f 0444 root sys $DATADIR/templates/test-page.tmpl templates/test-page.tmpl
f 0444 root sys $DATADIR/templates/trailer.tmpl templates/trailer.tmpl
# Config files
d 0555 root sys $SERVERROOT -
d 0711 root sys $SERVERROOT/certs -
d 0755 root sys $SERVERROOT/interfaces -
d 0755 root sys $SERVERROOT/ppd -
c 0644 root sys $SERVERROOT/classes.conf conf/classes.conf
c 0644 root sys $SERVERROOT/cupsd.conf conf/cupsd.conf
f 0644 root sys $SERVERROOT/mime.convs conf/mime.convs
f 0644 root sys $SERVERROOT/mime.types conf/mime.types
c 0644 root sys $SERVERROOT/printers.conf conf/printers.conf
%system linux
# Linux version needs PAM...
%requires /lib/libpam.so.0
d 0555 root sys $PAMDIR -
c 0644 root sys $PAMDIR/cups data/cups.pam
%system all
# Developer files
d 0555 root sys $INCLUDEDIR/cups -
f 0444 root sys $INCLUDEDIR/cups/cups.h cups/cups.h
f 0444 root sys $INCLUDEDIR/cups/http.h cups/http.h
f 0444 root sys $INCLUDEDIR/cups/image.h filter/image.h
f 0444 root sys $INCLUDEDIR/cups/ipp.h cups/ipp.h
f 0444 root sys $INCLUDEDIR/cups/language.h cups/language.h
f 0444 root sys $INCLUDEDIR/cups/md5.h cups/md5.h
f 0444 root sys $INCLUDEDIR/cups/ppd.h cups/ppd.h
f 0444 root sys $INCLUDEDIR/cups/raster.h filter/raster.h
f 0444 root sys $LIBDIR/libcups.a cups/libcups.a
# Documentation files
d 0555 root sys $DOCDIR -
f 0444 root sys $DOCDIR/cups.css doc/cups.css
f 0444 root sys $DOCDIR/documentation.html doc/documentation.html
f 0444 root sys $DOCDIR/index.html doc/index.html
d 0555 root sys $DOCDIR/images -
f 0444 root sys $DOCDIR/images/classes.gif doc/images/classes.gif
f 0444 root sys $DOCDIR/images/printer-idle.gif doc/images/printer-idle.gif
f 0444 root sys $DOCDIR/images/printer-processing.gif doc/images/printer-processing.gif
f 0444 root sys $DOCDIR/images/printer-stopped.gif doc/images/printer-stopped.gif
f 0444 root sys $DOCDIR/images/accept-jobs.gif doc/images/accept-jobs.gif
f 0444 root sys $DOCDIR/images/add-class.gif doc/images/add-class.gif
f 0444 root sys $DOCDIR/images/add-printer.gif doc/images/add-printer.gif
f 0444 root sys $DOCDIR/images/cancel-job.gif doc/images/cancel-job.gif
f 0444 root sys $DOCDIR/images/cancel-jobs.gif doc/images/cancel-jobs.gif
f 0444 root sys $DOCDIR/images/cancel.gif doc/images/cancel.gif
f 0444 root sys $DOCDIR/images/continue.gif doc/images/continue.gif
f 0444 root sys $DOCDIR/images/config-printer.gif doc/images/config-printer.gif
f 0444 root sys $DOCDIR/images/cups-block-diagram.gif doc/images/cups-block-diagram.gif
f 0444 root sys $DOCDIR/images/delete-class.gif doc/images/delete-class.gif
f 0444 root sys $DOCDIR/images/delete-printer.gif doc/images/delete-printer.gif
f 0444 root sys $DOCDIR/images/hold-job.gif doc/images/hold-job.gif
f 0444 root sys $DOCDIR/images/left.gif doc/images/left.gif
f 0444 root sys $DOCDIR/images/logo.gif doc/images/logo.gif
f 0444 root sys $DOCDIR/images/manage-classes.gif doc/images/manage-classes.gif
f 0444 root sys $DOCDIR/images/manage-jobs.gif doc/images/manage-jobs.gif
f 0444 root sys $DOCDIR/images/manage-printers.gif doc/images/manage-printers.gif
f 0444 root sys $DOCDIR/images/modify-class.gif doc/images/modify-class.gif
f 0444 root sys $DOCDIR/images/modify-printer.gif doc/images/modify-printer.gif
f 0444 root sys $DOCDIR/images/navbar.gif doc/images/navbar.gif
f 0444 root sys $DOCDIR/images/print-test-page.gif doc/images/print-test-page.gif
f 0444 root sys $DOCDIR/images/reject-jobs.gif doc/images/reject-jobs.gif
f 0444 root sys $DOCDIR/images/release-job.gif doc/images/release-job.gif
f 0444 root sys $DOCDIR/images/restart-job.gif doc/images/restart-job.gif
f 0444 root sys $DOCDIR/images/right.gif doc/images/right.gif
f 0444 root sys $DOCDIR/images/show-active.gif doc/images/show-active.gif
f 0444 root sys $DOCDIR/images/show-completed.gif doc/images/show-completed.gif
f 0444 root sys $DOCDIR/images/start-class.gif doc/images/start-class.gif
f 0444 root sys $DOCDIR/images/start-printer.gif doc/images/start-printer.gif
f 0444 root sys $DOCDIR/images/stop-class.gif doc/images/stop-class.gif
f 0444 root sys $DOCDIR/images/stop-printer.gif doc/images/stop-printer.gif
f 0444 root sys $DOCDIR/cmp.html doc/cmp.html
f 0444 root sys $DOCDIR/cmp.pdf doc/cmp.pdf
f 0444 root sys $DOCDIR/cupsdoc.css doc/cupsdoc.css
f 0444 root sys $DOCDIR/idd.html doc/idd.html
f 0444 root sys $DOCDIR/idd.pdf doc/idd.pdf
f 0444 root sys $DOCDIR/ipp.html doc/ipp.html
f 0444 root sys $DOCDIR/ipp.pdf doc/ipp.pdf
f 0444 root sys $DOCDIR/overview.html doc/overview.html
f 0444 root sys $DOCDIR/overview.pdf doc/overview.pdf
f 0444 root sys $DOCDIR/sam.html doc/sam.html
f 0444 root sys $DOCDIR/sam.pdf doc/sam.pdf
f 0444 root sys $DOCDIR/sdd.html doc/sdd.html
f 0444 root sys $DOCDIR/sdd.pdf doc/sdd.pdf
f 0444 root sys $DOCDIR/spm.html doc/spm.html
f 0444 root sys $DOCDIR/spm.pdf doc/spm.pdf
f 0444 root sys $DOCDIR/sps.html doc/sps.html
f 0444 root sys $DOCDIR/sps.pdf doc/sps.pdf
f 0444 root sys $DOCDIR/ssr.html doc/ssr.html
f 0444 root sys $DOCDIR/ssr.pdf doc/ssr.pdf
f 0444 root sys $DOCDIR/sum.html doc/sum.html
f 0444 root sys $DOCDIR/sum.pdf doc/sum.pdf
f 0444 root sys $DOCDIR/svd.html doc/svd.html
f 0444 root sys $DOCDIR/svd.pdf doc/svd.pdf
f 0444 root sys $DOCDIR/images/cups-bar.gif doc/images/cups-bar.gif
f 0444 root sys $DOCDIR/images/cups-large.gif doc/images/cups-large.gif
f 0444 root sys $DOCDIR/images/cups-medium.gif doc/images/cups-medium.gif
f 0444 root sys $DOCDIR/images/cups-small.gif doc/images/cups-small.gif
# Man pages
%system irix
d 0555 root sys $MANDIR/a_man -
d 0555 root sys $MANDIR/a_man/cat1 -
d 0555 root sys $MANDIR/u_man -
d 0555 root sys $MANDIR/u_man/cat1 -
d 0555 root sys $MANDIR/u_man/cat5 -
f 0444 root sys $MANDIR/a_man/cat1/accept.z man/accept.z
l 0444 root sys $MANDIR/a_man/cat1/reject.z accept.z
f 0444 root sys $MANDIR/u_man/cat1/backend.z man/backend.z
f 0444 root sys $MANDIR/u_man/cat5/classes.conf.z man/classes.conf.z
f 0444 root sys $MANDIR/a_man/cat1/cups-lpd.z man/cups-lpd.z
f 0444 root sys $MANDIR/a_man/cat1/cups-polld.z man/cups-polld.z
f 0444 root sys $MANDIR/u_man/cat5/cupsd.conf.z man/cupsd.conf.z
f 0444 root sys $MANDIR/a_man/cat1/cupsd.z man/cupsd.z
f 0444 root sys $MANDIR/a_man/cat1/enable.z man/enable.z
l 0444 root sys $MANDIR/a_man/cat1/disable.z enable.z
f 0444 root sys $MANDIR/u_man/cat1/filter.z man/filter.z
f 0444 root sys $MANDIR/a_man/cat1/lpadmin.z man/lpadmin.z
f 0444 root sys $MANDIR/a_man/cat1/lpc.z man/lpc.z
f 0444 root sys $MANDIR/a_man/cat1/lpinfo.z man/lpinfo.z
f 0444 root sys $MANDIR/a_man/cat1/lpmove.z man/lpmove.z
f 0444 root sys $MANDIR/u_man/cat1/lpoptions.z man/lpoptions.z
f 0444 root sys $MANDIR/u_man/cat1/lpq.z man/lpq.z
f 0444 root sys $MANDIR/u_man/cat1/lprm.z man/lprm.z
f 0444 root sys $MANDIR/u_man/cat1/lpr.z man/lpr.z
f 0444 root sys $MANDIR/u_man/cat1/lpstat.z man/lpstat.z
f 0444 root sys $MANDIR/u_man/cat1/lp.z man/lp.z
l 0444 root sys $MANDIR/u_man/cat1/cancel.z lp.z
f 0444 root sys $MANDIR/u_man/cat5/mime.convs.z man/mime.convs.z
f 0444 root sys $MANDIR/u_man/cat5/mime.types.z man/mime.types.z
f 0444 root sys $MANDIR/u_man/cat5/printers.conf.z man/printers.conf.z
%system solaris hpux
d 0555 root sys $MANDIR/man1 -
d 0555 root sys $MANDIR/man5 -
d 0555 root sys $MANDIR/man1m -
f 0444 root sys $MANDIR/man1m/accept.1m man/accept.man
l 0444 root sys $MANDIR/man1m/reject.1m accept.man
f 0444 root sys $MANDIR/man1/backend.1 man/backend.man
f 0444 root sys $MANDIR/man1/classes.conf.5 man/classes.conf.man
f 0444 root sys $MANDIR/man1m/cups-lpd.1m man/cups-lpd.man
f 0444 root sys $MANDIR/man1m/cups-polld.1m man/cups-polld.man
f 0444 root sys $MANDIR/man1m/cupsd.1m man/cupsd.man
f 0444 root sys $MANDIR/man5/cupsd.conf.5 man/cupsd.conf.man
f 0444 root sys $MANDIR/man1m/enable.1m man/enable.man
l 0444 root sys $MANDIR/man1m/disable.1m enable.man
f 0444 root sys $MANDIR/man1/filter.1 man/filter.man
f 0444 root sys $MANDIR/man1m/lpadmin.1m man/lpadmin.man
f 0444 root sys $MANDIR/man1m/lpc.1m man/lpc.man
f 0444 root sys $MANDIR/man1m/lpinfo.1m man/lpinfo.man
f 0444 root sys $MANDIR/man1m/lpmove.1m man/lpmove.man
f 0444 root sys $MANDIR/man1/lpoptions.1 man/lpoptions.man
f 0444 root sys $MANDIR/man1/lpq.1 man/lpq.man
f 0444 root sys $MANDIR/man1/lprm.1 man/lprm.man
f 0444 root sys $MANDIR/man1/lpr.1 man/lpr.man
f 0444 root sys $MANDIR/man1/lpstat.1 man/lpstat.man
f 0444 root sys $MANDIR/man1/lp.1 man/lp.man
l 0444 root sys $MANDIR/man1/cancel.1 lp.man
f 0444 root sys $MANDIR/man5/mime.convs.5 man/mime.convs.man
f 0444 root sys $MANDIR/man5/mime.types.5 man/mime.types.man
f 0444 root sys $MANDIR/man5/printers.conf.5 man/printers.conf.man
%system !irix !solaris !hpux
d 0555 root sys $MANDIR/man1 -
d 0555 root sys $MANDIR/man5 -
d 0555 root sys $MANDIR/man8 -
f 0444 root sys $MANDIR/man8/accept.8 man/accept.man
l 0444 root sys $MANDIR/man8/reject.8 accept.man
f 0444 root sys $MANDIR/man1/backend.1 man/backend.man
f 0444 root sys $MANDIR/man1/classes.conf.5 man/classes.conf.man
f 0444 root sys $MANDIR/man8/cups-lpd.8 man/cups-lpd.man
f 0444 root sys $MANDIR/man8/cups-polld.8 man/cups-polld.man
f 0444 root sys $MANDIR/man8/cupsd.8 man/cupsd.man
f 0444 root sys $MANDIR/man5/cupsd.conf.5 man/cupsd.conf.man
f 0444 root sys $MANDIR/man8/enable.8 man/enable.man
l 0444 root sys $MANDIR/man8/disable.8 enable.man
f 0444 root sys $MANDIR/man1/filter.1 man/filter.man
f 0444 root sys $MANDIR/man8/lpadmin.8 man/lpadmin.man
f 0444 root sys $MANDIR/man8/lpc.8 man/lpc.man
f 0444 root sys $MANDIR/man8/lpinfo.8 man/lpinfo.man
f 0444 root sys $MANDIR/man8/lpmove.8 man/lpmove.man
f 0444 root sys $MANDIR/man1/lpoptions.1 man/lpoptions.man
f 0444 root sys $MANDIR/man1/lpq.1 man/lpq.man
f 0444 root sys $MANDIR/man1/lprm.1 man/lprm.man
f 0444 root sys $MANDIR/man1/lpr.1 man/lpr.man
f 0444 root sys $MANDIR/man1/lpstat.1 man/lpstat.man
f 0444 root sys $MANDIR/man1/lp.1 man/lp.man
l 0444 root sys $MANDIR/man1/cancel.1 lp.man
f 0444 root sys $MANDIR/man5/mime.convs.5 man/mime.convs.man
f 0444 root sys $MANDIR/man5/mime.types.5 man/mime.types.man
f 0444 root sys $MANDIR/man5/printers.conf.5 man/printers.conf.man
# Startup script
%system all
i 0555 root sys cups cups.sh
#
# End of "$Id: cups.list 1277 2000-08-04 14:53:49Z mike $".
#
-114
Ver Arquivo
@@ -1,114 +0,0 @@
#!/bin/sh
#
# "$Id$"
#
# Startup/shutdown script for the Common UNIX Printing System (CUPS).
#
# Linux chkconfig stuff:
#
# chkconfig: 02 99 00
# description: Startup/shutdown script for the Common UNIX \
# Printing System (CUPS).
#
# Copyright 1997-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
# See what program to use for configuration stuff...
case "`uname`" in
IRIX*)
IS_ON=/sbin/chkconfig
;;
*)
IS_ON=/bin/true
;;
esac
# The verbose flag controls the printing of the names of
# daemons as they are started.
if $IS_ON verbose; then
ECHO=echo
else
ECHO=:
fi
# See if the CUPS server is running...
case "`uname`" in
IRIX* | HP-UX | SunOS)
pid=`ps -e | awk '{print $1,$4}' | grep cupsd | awk '{print $1}'`
;;
OSF1)
pid=`ps -e | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'`
;;
Linux)
pid=`ps ax | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'`
;;
*)
pid=""
;;
esac
# Start or stop the CUPS server based upon the first argument to the script.
case $1 in
start | restart | reload)
if test "$pid" != ""; then
if $IS_ON cups; then
kill -HUP $pid
$ECHO "cups: scheduler restarted."
else
kill $pid
$ECHO "cups: scheduler stopped."
fi
else
if $IS_ON cups; then
prefix=@prefix@
exec_prefix=@exec_prefix@
@sbindir@/cupsd
$ECHO "cups: scheduler started."
fi
fi
;;
stop)
if test "$pid" != ""; then
kill $pid
$ECHO "cups: scheduler stopped."
fi
;;
status)
if test "$pid" != ""; then
echo "cups: Scheduler is running."
else
echo "cups: Scheduler is not running."
fi
;;
*)
echo "Usage: cups {reload|restart|start|status|stop}"
exit 1
;;
esac
exit 0
#
# End of "$Id$".
#
-153
Ver Arquivo
@@ -1,153 +0,0 @@
#
# "$Id: cups.spec 1277 2000-08-04 14:53:49Z mike $"
#
# RPM "spec" file for the Common UNIX Printing System (CUPS).
#
# Original version by Jason McMullan <jmcc@ontv.com>.
#
# Copyright 1999-2000 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
Summary: Common Unix Printing System
Name: cups
Version: 1.1.2
Release: 0
Copyright: GPL
Group: System Environment/Daemons
Source: ftp://ftp.easysw.com/pub/cups/%version/cups-%version-source.tar.gz
Url: http://www.cups.org
Packager: Michael Sweet <mike@easysw.com>
Vendor: Easy Software Products
# use buildroot so as not to disturb the version already installed
BuildRoot: /tmp/rpmbuild
Conflicts: lpr
%package devel
Summary: Common Unix Printing System - development environment
Group: Development/Libraries
%description
The Common UNIX Printing System provides a portable printing layer for
UNIX® operating systems. It has been developed by Easy Software Products
to promote a standard printing solution for all UNIX vendors and users.
CUPS provides the System V and Berkeley command-line interfaces.
%description devel
The Common UNIX Printing System provides a portable printing layer for
UNIX® operating systems. This is the development package for creating
additional printer drivers, and other CUPS services.
%prep
%setup
%build
./configure
# If we got this far, all prerequisite libraries must be here.
make
%install
# these lines just make sure the directory structure in the
# RPM_BUILD_ROOT exists
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
make prefix=$RPM_BUILD_ROOT \
exec_prefix=$RPM_BUILD_ROOT/usr \
BINDIR=$RPM_BUILD_ROOT/usr/bin \
DATADIR=$RPM_BUILD_ROOT/usr/share/cups \
DOCDIR=$RPM_BUILD_ROOT/usr/share/doc/cups \
INCLUDEDIR=$RPM_BUILD_ROOT/usr/include \
LIBDIR=$RPM_BUILD_ROOT/usr/lib \
LOCALEDIR=$RPM_BUILD_ROOT/usr/share/locale \
MANDIR=$RPM_BUILD_ROOT/usr/man \
PAMDIR=$RPM_BUILD_ROOT/etc/pam.d \
REQUESTS=$RPM_BUILD_ROOT/var/spool/cups \
SBINDIR=$RPM_BUILD_ROOT/usr/sbin \
SERVERBIN=$RPM_BUILD_ROOT/usr/lib/cups \
SERVERROOT=$RPM_BUILD_ROOT/etc/cups \
install
%post
if test -x /sbin/chkconfig; then
/sbin/chkconfig --add cups
/sbin/chkconfig cups on
fi
if test -f /sbin/init.d/cups; then
/sbin/init.d/cups start
fi
if test -f /etc/rc.d/init.d/cups; then
/etc/rc.d/init.d/cups start
fi
if test -f /etc/init.d/cups; then
/etc/init.d/cups start
fi
%preun
if test -f /sbin/init.d/cups; then
/sbin/init.d/cups stop
fi
if test -f /etc/rc.d/init.d/cups; then
/etc/rc.d/init.d/cups stop
fi
if test -f /etc/init.d/cups; then
/etc/init.d/cups stop
fi
if test -x /sbin/chkconfig; then
/sbin/chkconfig --del cups
fi
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/etc/cups/certs
%config /etc/cups/classes.conf
%config /etc/cups/client.conf
%config /etc/cups/cupsd.conf
/etc/cups/interfaces
/etc/cups/mime.types
/etc/cups/mime.convs
/etc/cups/ppd
%config /etc/cups/printers.conf
/etc/pam.d/*
/etc/init.d/*
/etc/rc0.d/*
/etc/rc2.d/*
/etc/rc.d/*
/usr/bin/*
/usr/lib/*.so*
/usr/man/*
/usr/sbin/*
/usr/share/*
/usr/lib/cups/*
%attr(0700,lp,root) /var/spool/cups
%attr(1700,lp,root) /var/spool/cups/tmp
/sbin/init.d/*
%files devel
/usr/include/cups/*
/usr/lib/*.a
#
# End of "$Id: cups.spec 1277 2000-08-04 14:53:49Z mike $".
#
+294
Ver Arquivo
@@ -0,0 +1,294 @@
# 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 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 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 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 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
file.o: string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
file.o: debug.h
getifaddrs.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
getputfile.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
getputfile.o: string.h ../config.h debug.h
globals.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
globals.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
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 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 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 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 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 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 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 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-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 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 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 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 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
file.32.o: file.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
file.32.o: file.c debug.h
getifaddrs.32.o: getifaddrs.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
getputfile.32.o: getputfile.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
getputfile.32.o: getputfile.c string.h ../config.h debug.h
globals.32.o: globals.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
globals.32.o: globals.c globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
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 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 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 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 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 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 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 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-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 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 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 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 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
file.64.o: file.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
file.64.o: file.c debug.h
getifaddrs.64.o: getifaddrs.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
getputfile.64.o: getputfile.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
getputfile.64.o: getputfile.c string.h ../config.h debug.h
globals.64.o: globals.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
globals.64.o: globals.c globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
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 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 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 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 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 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 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 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-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
+337 -49
Ver Arquivo
@@ -1,9 +1,9 @@
#
# "$Id$"
#
# Support library Makefile for the Common UNIX Printing System (CUPS).
# API library Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 1997-2000 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
@@ -15,12 +15,14 @@
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
# Hollywood, Maryland 20636 USA
#
# Voice: (301) 373-9603
# Voice: (301) 373-9600
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
# This file is subject to the Apple OS-Developed Software exception.
#
include ../Makedefs
@@ -28,23 +30,99 @@ include ../Makedefs
# Object files...
#
LIBOBJS = dest.o emit.o http.o ipp.o language.o mark.o md5.o md5passwd.o \
options.o page.o ppd.o snprintf.o string.o usersys.o util.o
OBJS = $(LIBOBJS) testhttp.o testppd.o
LIBOBJS = \
adminutil.o \
array.o \
attr.o \
auth.o \
backchannel.o \
backend.o \
custom.o \
dest.o \
dir.o \
emit.o \
encode.o \
file.o \
getifaddrs.o \
getputfile.o \
globals.o \
http.o \
http-addr.o \
http-addrlist.o \
http-support.o \
ipp.o \
ipp-support.o \
langprintf.o \
language.o \
localize.o \
mark.o \
md5.o \
md5passwd.o \
notify.o \
options.o \
page.o \
ppd.o \
request.o \
snprintf.o \
string.o \
tempfile.o \
transcode.o \
usersys.o \
util.o
LIB32OBJS = $(LIBOBJS:.o=.32.o)
LIB64OBJS = $(LIBOBJS:.o=.64.o)
OBJS = \
$(LIBOBJS) \
$(LIB32OBJS) \
$(LIB64OBJS) \
testadmin.o \
testarray.o \
testfile.o \
testhttp.o \
testi18n.o \
testipp.o \
testlang.o \
testppd.o \
php_cups_wrap.o
#
# Header files to install...
#
HEADERS = cups.h http.h ipp.h language.h md5.h ppd.h
HEADERS = \
adminutil.h \
array.h \
backend.h \
cups.h \
dir.h \
file.h \
http.h \
i18n.h \
ipp.h \
language.h \
md5.h \
ppd.h \
transcode.h
#
# Targets in this directory...
#
TARGETS = $(LIBCUPS) libcups.a
TARGETS = \
$(LIBCUPS) \
$(LIB32CUPS) \
$(LIB64CUPS) \
libcups.a \
testadmin \
testarray \
testfile \
testhttp \
testi18n \
testipp \
testlang \
testppd
#
@@ -60,45 +138,162 @@ all: $(TARGETS)
clean:
$(RM) $(OBJS) $(TARGETS)
$(RM) libcups.so libcups.sl libcups.dylib
$(RM) -r 32bit 64bit
#
# Update dependencies (without system header dependencies...)
#
depend:
touch Dependencies.tmp
makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1
$(RM) Dependencies
cp Dependencies.tmp Dependencies
sed -r -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
sed -r -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
$(RM) Dependencies.tmp
#
# Install object and target files...
#
install: all
-$(MKDIR) $(INCLUDEDIR)/cups
$(CHMOD) ugo+rx $(INCLUDEDIR)
$(CHMOD) ugo+rx $(INCLUDEDIR)/cups
$(INSTALL_DATA) $(HEADERS) $(INCLUDEDIR)/cups
-$(MKDIR) $(LIBDIR)
$(CHMOD) ugo+rx $(LIBDIR)
install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
if test $(LIBCUPS) != "libcups.a" -a $(LIBCUPS) != "libcups.la"; then \
$(INSTALL_LIB) libcups.a $(LIBDIR); \
$(RM) `basename $(LIBCUPS) .2`; \
$(LN) $(LIBCUPS) `basename $(LIBCUPS) .2`; \
if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
$(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
$(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
fi
if test $(LIBCUPS) = "libcups.2.dylib"; then \
$(STRIP) -x $(LIBDIR)/$(LIBCUPS); \
$(RM) $(LIBDIR)/libcups.dylib; \
$(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
fi
installstatic:
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) libcups.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcups.a
installhdrs:
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
for file in $(HEADERS); do \
$(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
done
install32bit:
$(INSTALL_DIR) -m 755 $(LIB32DIR)
$(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) 64bit/libcups.so.2 $(LIB64DIR)/libcups.so.2
$(LN) libcups.so.2 $(LIB64DIR)/libcups.so
#
# libcups.so.2, libcups.sl.1
# Uninstall object and target files...
#
libcups.so.2 libcups.sl.2: $(LIBOBJS) ../Makedefs
uninstall: $(UNINSTALL32) $(UNINSTALL64)
$(RM) $(LIBDIR)/libcups.2.dylib
$(RM) $(LIBDIR)/libcups.a
$(RM) $(LIBDIR)/libcups.dylib
$(RM) $(LIBDIR)/libcups_s.a
$(RM) $(LIBDIR)/libcups.sl
$(RM) $(LIBDIR)/libcups.sl.2
$(RM) $(LIBDIR)/libcups.so
$(RM) $(LIBDIR)/libcups.so.2
-$(RMDIR) $(LIBDIR)
for file in $(HEADERS); do \
$(RM) $(INCLUDEDIR)/cups/$$file; \
done
-$(RMDIR) $(INCLUDEDIR)/cups
uninstall32bit:
$(RM) $(LIB32DIR)/libcups.so
$(RM) $(LIB32DIR)/libcups.so.2
-$(RMDIR) $(LIB32DIR)
uninstall64bit:
$(RM) $(LIB64DIR)/libcups.so
$(RM) $(LIB64DIR)/libcups.so.2
-$(RMDIR) $(LIB64DIR)
#
# libcups.so.2, libcups.sl.2
#
libcups.so.2 libcups.sl.2: $(LIBOBJS)
echo Linking $@...
$(DSO) $@ $(LIBOBJS)
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) `basename $@ .2`
$(LN) $@ `basename $@ .2`
#
# 32bit/libcups.so.2
#
32bit/libcups.so.2: $(LIB32OBJS)
echo Linking 32-bit $@...
-mkdir 32bit
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 32bit/libcups.so
$(LN) libcups.so.2 32bit/libcups.so
#
# 64bit/libcups.so.2
#
64bit/libcups.so.2: $(LIB64OBJS)
echo Linking 64-bit $@...
-mkdir 64bit
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 64bit/libcups.so
$(LN) libcups.so.2 64bit/libcups.so
#
# libcups.2.dylib
#
libcups.2.dylib: $(LIBOBJS)
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/$@ \
-current_version 2.7.0 \
-compatibility_version 2.0.0 \
$(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) libcups.dylib
$(LN) $@ libcups.dylib
#
# libcups_s.a
#
libcups_s.a: $(LIBOBJS) libcups_s.exp
echo Creating $@...
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm
$(RM) $@
$(AR) $(ARFLAGS) $@ libcups_s.o
#
# libcups.la
#
libcups.la: $(LIBOBJS) ../Makedefs
libcups.la: $(LIBOBJS)
echo Linking $@...
$(CC) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) -version-info 2:0
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
-version-info 2:7 $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -113,28 +308,57 @@ libcups.a: $(LIBOBJS)
#
# cups_C.h - the default POSIX locale that is compiled in.
# CUPS language bindings for various scripting languages...
#
# NOTE: Not currently used or functional - see the scripting/php directory
# for the hand-written bindings...
#
cups_C.h: ../locale/C/cups_C
echo Generating $@...
$(RM) cups_C.h
$(AWK) '{print "\"" $$0 "\","}' < ../locale/C/cups_C > cups_C.h
phpcups.so: $(LIBCUPS) php_cups_wrap.o
echo Linking $@...
if test `uname` = Darwin; then \
DSOFLAGS="-bundle -flat_namespace -undefined suppress"; \
else \
DSOFLAGS="$(DSOFLAGS)"; \
fi; \
$(DSO) $$DSOFLAGS -o $@ php_cups_wrap.o $(LIBS) `php-config --ldflags --libs`
dest.o: cups.h http.h ipp.h language.h string.h
emit.o: ppd.h
http.o: http.h ipp.h md5.h string.h
ipp.o: http.h ipp.h string.h language.h
language.o: cups_C.h language.h string.h
mark.o: ppd.h
md5.o: md5.h
options.o: cups.h
page.o: ppd.h
ppd.o: language.h ppd.h
snprintf.o: string.h
string.o: string.h
usersys.o: cups.h
util.o: cups.h http.h ipp.h
php_cups_wrap.o: php_cups_wrap.c
echo Compiling $<...
$(CC) $(CFLAGS) `php-config --includes` -c $<
php_cups_wrap.c: cups.h
echo Creating $< using SWIG...
swig -php -o $@ -module cups cups.h
#
# testadmin (dependency on static CUPS library is intentional)
#
testadmin: testadmin.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testadmin.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# testarray (dependency on static CUPS library is intentional)
#
testarray: testarray.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testarray.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# testfile (dependency on static CUPS library is intentional)
#
testfile: testfile.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testfile.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -143,9 +367,38 @@ util.o: cups.h http.h ipp.h
testhttp: testhttp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a $(NETLIBS)
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
testhttp.o: http.h
#
# testipp (dependency on static CUPS library is intentional)
#
testipp: testipp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testipp.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# testi18n (dependency on static CUPS library is intentional)
#
testi18n: testi18n.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testi18n.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# testlang (dependency on static CUPS library is intentional)
#
testlang: testlang.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testlang.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -154,11 +407,46 @@ testhttp.o: http.h
testppd: testppd.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a $(NETLIBS)
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
testppd.o: ppd.h
$(OBJS): ../Makedefs ../config.h
#
# Automatic API help files...
#
apihelp:
echo Generating CUPS API help files...
mxmldoc --section "Programming" --title "Array API" \
--intro api-array.shtml \
array.h array.c >../doc/help/api-array.html
mxmldoc --section "Programming" --title "CUPS API" \
--intro api-cups.shtml \
cups.h dest.c getputfile.c language.c \
options.c tempfile.c usersys.c \
util.c >../doc/help/api-cups.html
mxmldoc --section "Programming" --title "File and Directory APIs" \
--intro api-filedir.shtml \
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
mxmldoc --section "Programming" --title "PPD API" \
--intro api-ppd.shtml \
ppd.h attr.c custom.c emit.c localize.c mark.c page.c \
ppd.c >../doc/help/api-ppd.html
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
--intro api-httpipp.shtml \
http.h ipp.h auth.c encode.c http.c http-addr.c \
http-support.c ipp.c ipp-support.c md5passwd.c \
request.c >../doc/help/api-httpipp.html
mxmldoc --section "Programming" --title "Filter and Backend APIs" \
--intro api-filter.shtml \
backchannel.c >../doc/help/api-filter.html
#
# Dependencies...
#
include Dependencies
#

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