Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 739e75b9f2 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.1.6.3@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
2339 arquivos alterados com 477445 adições e 892676 exclusões
-5
Ver Arquivo
@@ -1,5 +0,0 @@
.git* export-ignore
.mailmap export-ignore
examples/testfile.pcl -text
exampels/testfile.txt -text
scripts export-ignore
-156
Ver Arquivo
@@ -1,156 +0,0 @@
*.a
*.bck
*.cgi
*.o
autom4te.cache
config.h
config.log
config.status
cups-config
Makedefs
backend/dnssd
backend/http
backend/https
backend/ipp
backend/ipps
backend/lpd
backend/mdns
backend/snmp
backend/socket
backend/test1284
backend/testbackend
backend/testsupplies
backend/usb
berkeley/lpc
berkeley/lpq
berkeley/lpr
berkeley/lprm
cgi-bin/testcgi
cgi-bin/testhi
cgi-bin/testhi.index
cgi-bin/testtemplate
conf/cups-files.conf
conf/cupsd.conf
conf/mime.convs
conf/pam.std
conf/snmp.conf
cups/libcups.dylib
cups/libcups.2.dylib
cups/libcups.so
cups/libcups.so.2
cups/libcupsimage.dylib
cups/libcupsimage.2.dylib
cups/libcupsimage.so
cups/libcupsimage.so.2
cups/locale/
cups/rasterbench
cups/test.pwg
cups/test.raster
cups/testadmin
cups/testarray
cups/testcache
cups/testclient
cups/testconflicts
cups/testcreds
cups/testcups
cups/testdest
cups/testfile
cups/testgetdests
cups/testhttp
cups/testi18n
cups/testipp
cups/testlang
cups/testoptions
cups/testppd
cups/testpwg
cups/testraster
cups/testsnmp
cups/testthreads
cups/tlscheck
desktop/cups.desktop
doc/index.html
doc/*/index.html
filter/commandtops
filter/gziptoany
filter/pstops
filter/rastertoepson
filter/rastertohp
filter/rastertolabel
filter/rastertopwg
locale/checkpo
locale/po2strings
locale/strings2po
man/mantohtml
monitor/bcp
monitor/tbcp
notifier/dbus
notifier/mailto
notifier/rss
notifier/testnotify
packaging/cups.list
ppdc/genstrings
ppdc/ppd/
ppdc/ppd2/
ppdc/ppdc
ppdc/ppdc-static
ppdc/ppdhtml
ppdc/ppdi
ppdc/ppdi-static
ppdc/ppdmerge
ppdc/ppdpo
ppdc/sample-import.drv
ppdc/sample.c
ppdc/testcatalog
scheduler/convert
scheduler/cups-deviced
scheduler/cups-driverd
scheduler/cups-exec
scheduler/cups-lpd
scheduler/cups-lpd.xinetd
scheduler/cups.sh
scheduler/cups.xml
scheduler/cupsd
scheduler/cupsfilter
scheduler/org.cups.cups-lpd.plist
scheduler/org.cups.cups-lpdAT.service
scheduler/org.cups.cupsd.path
scheduler/org.cups.cupsd.service
scheduler/org.cups.cupsd.socket
scheduler/testlpd
scheduler/testmime
scheduler/testspeed
scheduler/testsub
systemv/cancel
systemv/cupsaccept
systemv/cupsaddsmb
systemv/cupsctl
systemv/cupsdisable
systemv/cupsenable
systemv/cupsreject
systemv/cupstestdsc
systemv/cupstestppd
systemv/lp
systemv/lpadmin
systemv/lpinfo
systemv/lpmove
systemv/lpoptions
systemv/lpstat
templates/header.tmpl
templates/*/header.tmpl
test/cups-str-*.html
test/*_log-*
tools/ippevepcl
tools/ippeveprinter
tools/ippeveprinter-static
tools/ippeveps
tools/ippfind
tools/ippfind-static
tools/ipptool
tools/ipptool-static
vcnet/.vs
vcnet/packages
vcnet/Win32
vcnet/x64
xcode/CUPS.xcodeproj/project.xcworkspace/
xcode/CUPS.xcodeproj/xcuserdata/
-4
Ver Arquivo
@@ -1,4 +0,0 @@
queries:
- exclude: cpp/integer-multiplication-cast-to-long
- exclude: cpp/missing-header-guard
- exclude: cpp/short-global-name
-11
Ver Arquivo
@@ -1,11 +0,0 @@
# Prevent git from showing duplicate names with commands like "git shortlog"
# See the manpage of git-shortlog for details.
# The syntax is:
# Name that should be used <email that should be used> Bad name <bad email>
#
# You can skip Bad name if it is the same as the one that should be used, and is unique.
#
# This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u
# gives no duplicates.
Michael R Sweet <michaelrsweet@gmail.com> msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Michael R Sweet <michaelrsweet@gmail.com> Michael Sweet <msweet@msweet-imac.local>
-406
Ver Arquivo
@@ -1,406 +0,0 @@
CHANGES - 2.3.3 - 2020-04-24
============================
Changes in CUPS v2.3.3
----------------------
- CVE-2020-3898: The `ppdOpen` function did not handle invalid UI
constraint. `ppdcSource::get_resolution` function did not handle
invalid resolution strings.
- CVE-2019-8842: The `ippReadIO` function may under-read an extension
field.
- Fixed WARNING_OPTIONS support for GCC 9.x
Changes in CUPS v2.3.2
----------------------
- Localization updates.
Changes in CUPS v2.3.1
----------------------
- Documentation updates (Issue #5661, #5674, #5682)
- CVE-2019-2228: The `ippSetValuetag` function did not validate the default
language value.
- Fixed a crash bug in the web interface (Issue #5621)
- The PPD cache code now looks up page sizes using their dimensions
(Issue #5633)
- PPD files containing "custom" option keywords did not work (Issue #5639)
- Added a workaround for the scheduler's systemd support (Issue #5640)
- On Windows, TLS certificates generated on February 29 would likely fail
(Issue #5643)
- Added a DigestOptions directive for the `client.conf` file to control whether
MD5-based Digest authentication is allowed (Issue #5647)
- Fixed a bug in the handling of printer resource files (Issue #5652)
- The libusb-based USB backend now reports an error when the distribution
permissions are wrong (Issue #5658)
- Added paint can labels to Dymo driver (Issue #5662)
- The `ippeveprinter` program now supports authentication (Issue #5665)
- The `ippeveprinter` program now advertises DNS-SD services on the correct
interfaces, and provides a way to turn them off (Issue #5666)
- The `--with-dbusdir` option was ignored by the configure script (Issue #5671)
- Sandboxed applications were not able to get the default printer (Issue #5676)
- Log file access controls were not preserved by `cupsctl` (Issue #5677)
- Default printers set with `lpoptions` did not work in all cases (Issue #5681,
Issue #5683, Issue #5684)
- Fixed an error in the jobs web interface template (Issue #5694)
- Fixed an off-by-one error in `ippEnumString` (Issue #5695)
- Fixed some new compiler warnings (Issue #5700)
- Fixed a few issues with the Apple Raster support (rdar://55301114)
- The IPP backend did not detect all cases where a job should be retried using
a raster format (rdar://56021091)
- Fixed spelling of "fold-accordion".
- Fixed the default common name for TLS certificates used by `ippeveprinter`.
- Fixed the option names used for IPP Everywhere finishing options.
- Added support for the second roll of the DYMO Twin/DUO label printers.
Changes in CUPS v2.3.0
----------------------
- CVE-2019-8696 and CVE-2019-8675: Fixed SNMP buffer overflows (rdar://51685251)
- Added a GPL2/LGPL2 exception to the new CUPS license terms.
- Documentation updates (Issue #5604)
- Localization updates (Issue #5637)
- Fixed a bug in the scheduler job cleanup code (Issue #5588)
- Fixed builds when there is no TLS library (Issue #5590)
- Eliminated some new GCC compiler warnings (Issue #5591)
- Removed dead code from the scheduler (Issue #5593)
- "make" failed with GZIP options (Issue #5595)
- Fixed potential excess logging from the scheduler when removing job files
(Issue #5597)
- Fixed a NULL pointer dereference bug in `httpGetSubField2` (Issue #5598)
- Added FIPS-140 workarounds for GNU TLS (Issue #5601, Issue #5622)
- The scheduler no longer provides a default value for the description
(Issue #5603)
- The scheduler now logs jobs held for authentication using the error level so
it is clear what happened (Issue #5604)
- The `lpadmin` command did not always update the PPD file for changes to the
`cupsIPPSupplies` and `cupsSNMPSupplies` keywords (Issue #5610)
- The scheduler now uses both the group's membership list as well as the
various OS-specific membership functions to determine whether a user belongs
to a named group (Issue #5613)
- Added USB quirks rule for HP LaserJet 1015 (Issue #5617)
- Fixed some PPD parser issues (Issue #5623, Issue #5624)
- The IPP parser no longer allows invalid member attributes in collections
(Issue #5630)
- The configure script now treats the "wheel" group as a potential system
group (Issue #5638)
- Fixed a USB printing issue on macOS (rdar://31433931)
- Fixed IPP buffer overflow (rdar://50035411)
- Fixed memory disclosure issue in the scheduler (rdar://51373853)
- Fixed DoS issues in the scheduler (rdar://51373929)
- Fixed an issue with unsupported "sides" values in the IPP backend
(rdar://51775322)
- The scheduler would restart continuously when idle and printers were not
shared (rdar://52561199)
- Fixed an issue with `EXPECT !name WITH-VALUE ...` tests.
- Fixed a command ordering issue in the Zebra ZPL driver.
- Fixed a memory leak in `ppdOpen`.
Changes in CUPS v2.3rc1
-----------------------
- The `cups-config` script no longer adds extra libraries when linking against
shared libraries (Issue #5261)
- The supplied example print documents have been optimized for size
(Issue #5529)
- The `cupsctl` command now prevents setting "cups-files.conf" directives
(Issue #5530)
- The "forbidden" message in the web interface is now explained (Issue #5547)
- The footer in the web interface covered some content on small displays
(Issue #5574)
- The libusb-based USB backend now enforces read limits, improving print speed
in many cases (Issue #5583)
- The `ippeveprinter` command now looks for print commands in the "command"
subdirectory.
- The `ipptool` command now supports `$date-current` and `$date-start` variables
to insert the current and starting date and time values, as well as ISO-8601
relative time values such as "PT30S" for 30 seconds in the future.
Changes in CUPS v2.3b8
----------------------
- Media size matching now uses a tolerance of 0.5mm (rdar://33822024)
- The lpadmin command would hang with a bad PPD file (rdar://41495016)
- Fixed a potential crash bug in cups-driverd (rdar://46625579)
- Fixed a performance regression with large PPDs (rdar://47040759)
- Fixed a memory reallocation bug in HTTP header value expansion
(rdar://problem/50000749)
- Timed out job submission now yields an error (Issue #5570)
- Restored minimal support for the `Emulators` keyword in PPD files to allow
old Samsung printer drivers to continue to work (Issue #5562)
- The scheduler did not encode octetString values like "job-password" correctly
for the print filters (Issue #5558)
- The `cupsCheckDestSupported` function did not check octetString values
correctly (Issue #5557)
- Added support for `UserAgentTokens` directive in "client.conf" (Issue #5555)
- Updated the systemd service file for cupsd (Issue #5551)
- The `ippValidateAttribute` function did not catch all instances of invalid
UTF-8 strings (Issue #5509)
- Fixed an issue with the self-signed certificates generated by GNU TLS
(Issue #5506)
- Fixed a potential memory leak when reading at the end of a file (Issue #5473)
- Fixed potential unaligned accesses in the string pool (Issue #5474)
- Fixed a potential memory leak when loading a PPD file (Issue #5475)
- Added a USB quirks rule for the Lexmark E120n (Issue #5478)
- Updated the USB quirks rule for Zebra label printers (Issue #5395)
- Fixed a compile error on Linux (Issue #5483)
- The lpadmin command, web interface, and scheduler all queried an IPP
Everywhere printer differently, resulting in different PPDs for the same
printer (Issue #5484)
- The web interface no longer provides access to the log files (Issue #5513)
- Non-Kerberized printing to Windows via IPP was broken (Issue #5515)
- Eliminated use of private headers and some deprecated macOS APIs (Issue #5516)
- The scheduler no longer stops a printer if an error occurs when a job is
canceled or aborted (Issue #5517)
- Added a USB quirks rule for the DYMO 450 Turbo (Issue #5521)
- Added a USB quirks rule for Xerox printers (Issue #5523)
- The scheduler's self-signed certificate did not include all of the alternate
names for the server when using GNU TLS (Issue #5525)
- Fixed compiler warnings with newer versions of GCC (Issue #5532, Issue #5533)
- Fixed some PPD caching and IPP Everywhere PPD accounting/password bugs
(Issue #5535)
- Fixed `PreserveJobHistory` bug with time values (Issue #5538)
- The scheduler no longer advertises the HTTP methods it supports (Issue #5540)
- Localization updates (Issue #5461, Issues #5471, Issue #5481, Issue #5486,
Issue #5489, Issue #5491, Issue #5492, Issue #5493, Issue #5494, Issue #5495,
Issue #5497, Issue #5499, Issue #5500, Issue #5501, Issue #5504)
- The scheduler did not always idle exit as quickly as it could.
- Added a new `ippeveprinter` command based on the old ippserver sample code.
Changes in CUPS v2.3b7
----------------------
- Fixed some build failures (Issue #5451, Issue #5463)
- Running ppdmerge with the same input and output filenames did not work as
advertised (Issue #5455)
Changes in CUPS v2.3b6
----------------------
- Localization update (Issue #5339, Issue #5348, Issue #5362, Issue #5408,
Issue #5410)
- Documentation updates (Issue #5369, Issue #5402, Issue #5403, Issue #5404)
- CVE-2018-4300: Linux session cookies used a predictable random number seed.
- All user commands now support the `--help` option (Issue #5326)
- The `lpoptions` command now works with IPP Everywhere printers that have not
yet been added as local queues (Issue #5045)
- The lpadmin command would create a non-working printer in some error cases
(Issue #5305)
- The scheduler would crash if an empty `AccessLog` directive was specified
(Issue #5309)
- The scheduler did not idle-exit on some Linux distributions (Issue #5319)
- Fixed a regression in the changes to ippValidateAttribute (Issue #5322,
Issue #5330)
- Fixed a crash bug in the Epson dot matrix driver (Issue #5323)
- Automatic debug logging of job errors did not work with systemd (Issue #5337)
- The web interface did not list the IPP Everywhere "driver" (Issue #5338)
- The scheduler did not report all of the supported job options and values
(Issue #5340)
- The IPP Everywhere "driver" now properly supports face-up printers
(Issue #5345)
- Fixed some typos in the label printer drivers (Issue #5350)
- Setting the `Community` name to the empty string in `snmp.conf` now disables
SNMP supply level monitoring by all the standard network backends
(Issue #5354)
- Multi-file jobs could get stuck if the backend failed (Issue #5359,
Issue #5413)
- The IPP Everywhere "driver" no longer does local filtering when printing to
a shared CUPS printer (Issue #5361)
- The lpadmin command now correctly reports IPP errors when configuring an
IPP Everywhere printer (Issue #5370)
- Fixed some memory leaks discovered by Coverity (Issue #5375)
- The PPD compiler incorrectly terminated JCL options (Issue #5379)
- The cupstestppd utility did not generate errors for missing/mismatched
CloseUI/JCLCloseUI keywords (Issue #5381)
- The scheduler now reports the actual location of the log file (Issue #5398)
- Added USB quirk rules (Issue #5395, Issue #5420, Issue #5443)
- The generated PPD files for IPP Everywhere printers did not contain the
cupsManualCopies keyword (Issue #5433)
- Kerberos credentials might be truncated (Issue #5435)
- The handling of `MaxJobTime 0` did not match the documentation (Issue #5438)
- Fixed a bug adding a queue with the `-E` option (Issue #5440)
- The `cupsaddsmb` program has been removed (Issue #5449)
- The `cupstestdsc` program has been removed (Issue #5450)
- The scheduler was being backgrounded on macOS, causing applications to spin
(rdar://40436080)
- The scheduler did not validate that required initial request attributes were
in the operation group (rdar://41098178)
- Authentication in the web interface did not work on macOS (rdar://41444473)
- Fixed an issue with HTTP Digest authentication (rdar://41709086)
- The scheduler could crash when job history was purged (rdar://42198057)
- Fixed a crash bug when mapping PPD duplex options to IPP attributes
(rdar://46183976)
- Fixed a memory leak for some IPP (extension) syntaxes.
- The `cupscgi`, `cupsmime`, and `cupsppdc` support libraries are no longer
installed as shared libraries.
- The `snmp` backend is now deprecated.
Changes in CUPS v2.3b5
----------------------
- The `ipptool` program no longer checks for duplicate attributes when running
in list or CSV mode (Issue #5278)
- The `cupsCreateJob`, `cupsPrintFile2`, and `cupsPrintFiles2` APIs did not use
the supplied HTTP connection (Issue #5288)
- Fixed another crash in the scheduler when adding an IPP Everywhere printer
(Issue #5290)
- Added a workaround for certain web browsers that do not support multiple
authentication schemes in a single response header (Issue #5289)
- Fixed policy limits containing the `All` operation (Issue #5296)
- The scheduler was always restarted after idle-exit with systemd (Issue #5297)
- Added a USB quirks rule for the HP LaserJet P1102 (Issue #5310)
- The mailto notifier did not wait for the welcome message (Issue #5312)
- Fixed a parsing bug in the pstops filter (Issue #5321)
- Documentation updates (Issue #5299, Issue #5301, Issue #5306)
- Localization updates (Issue #5317)
- The scheduler allowed environment variables to be specified in the
`cupsd.conf` file (rdar://37836779, rdar://37836995, rdar://37837252,
rdar://37837581)
- Fax queues did not support pause (p) or wait-for-dialtone (w) characters
(rdar://39212256)
- The scheduler did not validate notify-recipient-uri values properly
(rdar://40068936)
- The IPP parser allowed invalid group tags (rdar://40442124)
- Fixed a parsing bug in the new authentication code.
Changes in CUPS v2.3b4
----------------------
- NOTICE: Printer drivers are now deprecated (Issue #5270)
- Kerberized printing to another CUPS server did not work correctly
(Issue #5233)
- Fixed printing to some IPP Everywhere printers (Issue #5238)
- Fixed installation of filters (Issue #5247)
- The scheduler now supports using temporary print queues for older IPP/1.1
print queues like those shared by CUPS 1.3 and earlier (Issue #5241)
- Star Micronics printers need the "unidir" USB quirk rule (Issue #5251)
- Documentation fixes (Issue #5252)
- Fixed a compile issue when PAM is not available (Issue #5253)
- Label printers supported by the rastertolabel driver don't support SNMP, so
don't delay printing to test it (Issue #5256)
- The scheduler could crash while adding an IPP Everywhere printer (Issue #5258)
- The Lexmark Optra E310 printer needs the "no-reattach" USB quirk rule
(Issue #5259)
- Systemd did not restart cupsd when configuration changes were made that
required a restart (Issue #5263)
- The IPP Everywhere PPD generator did not include the `cupsJobPassword`
keyword, when supported (Issue #5265)
- Fixed an Avahi crash bug in the scheduler (Issue #5268)
- Raw print queues are now deprecated (Issue #5269)
- Fixed an RPM packaging problem (Issue #5276)
- The IPP backend did not properly detect failed PDF prints (rdar://34055474)
- TLS connections now properly timeout (rdar://34938533)
- Temp files could not be created in some sandboxed applications
(rdar://37789645)
- The ipptool `--ippserver` option did not encode out-of-band attributes
correctly.
- Added public `cupsEncodeOption` API for encoding a single option as an IPP
attribute.
- Removed support for the `-D_PPD_DEPRECATED=""` developer cheat - the PPD API
should no longer be used.
- Removed support for `-D_IPP_PRIVATE_STRUCTURES=1` developer cheat - the IPP
accessor functions should be used instead.
Changes in CUPS v2.3b3
----------------------
- More fixes for printing to old CUPS servers (Issue #5211)
- The IPP Everywhere PPD generator did not support deep grayscale or 8-bit per
component AdobeRGB (Issue #5227)
- Additional changes for the scheduler to substitute default values for invalid
job attributes when running in "relaxed conformance" mode (Issue #5229)
- Localization changes (Issue #5232, rdar://37068158)
- The `cupsCopyDestInfo` function did not work with all print queues
(Issue #5235)
Changes in CUPS v2.3b2
----------------------
- Localization changes (Issue #5210)
- Build fixes (Issue #5217)
- IPP Everywhere PPDs were not localized to English (Issue #5205)
- The `cupsGetDests` and `cupsEnumDests` functions no longer filter out local
print services like IPP USB devices (Issue #5206)
- The `cupsCopyDest` function now correctly copies the `is_default` value
(Issue #5208)
- Printing to old CUPS servers has been fixed (Issue #5211)
- The `ppdInstallableConflict` tested too many constraints (Issue #5213)
- All HTTP field values can now be longer than `HTTP_MAX_VALUE` bytes
(Issue #5216)
- Added a USB quirk rule for Canon MP280 series printers (Issue #5221)
- The `cupsRasterWritePixels` function did not correctly swap bytes for some
formats (Issue #5225)
- Fixed an issue with mapping finishing options (rdar://34250727)
- The `ppdLocalizeIPPReason` function incorrectly returned a localized version
of "none" (rdar://36566269)
- The scheduler did not add ".local" to the default DNS-SD host name when
needed.
Changes in CUPS v2.3b1
----------------------
- CUPS is now provided under the Apache License, Version 2.0.
- Documentation updates (Issue #4580, Issue #5177, Issue #5192)
- The `cupsCopyDestConflicts` function now handles collection attribute
("media-col", "finishings-col", etc.) constraints (Issue #4096)
- The `lpoptions` command incorrectly saved default options (Issue #4717)
- The `lpstat` command now reports when new jobs are being held (Issue #4761)
- The `ippfind` command now supports finding printers whose name starts with an
underscore (Issue #4833)
- The CUPS library now supports the latest HTTP Digest authentication
specification including support for SHA-256 (Issue #4862)
- The scheduler now supports the "printer-id" attribute (Issue #4868)
- No longer support backslash, question mark, or quotes in printer names
(Issue #4966)
- The scheduler no longer logs pages as they are printed, instead just logging
a total of the pages printed at job completion (Issue #4991)
- Dropped RSS subscription management from the web interface (Issue #5012)
- Bonjour printer sharing now uses the DNS-SD hostname (or ServerName value if
none is defined) when registering shared printers on the network (Issue #5071)
- The `ipptool` command now supports writing `ippserver` attributes files
(Issue #5093)
- The `lp` and `lpr` commands now provide better error messages when the default
printer cannot be found (Issue #5096)
- The `lpadmin` command now provides a better error message when an unsupported
System V interface script is used (Issue #5111)
- The scheduler did not write out dirty configuration and state files if there
were open client connections (Issue #5118)
- The `SSLOptions` directive now supports `MinTLS` and `MaxTLS` options to
control the minimum and maximum TLS versions that will be allowed,
respectively (Issue #5119)
- Dropped hard-coded CGI scripting language support (Issue #5124)
- The `cupsEnumDests` function did not include options from the lpoptions
files (Issue #5144)
- Fixed the `ippserver` sample code when threading is disabled or unavailable
(Issue #5154)
- Added label markup to checkbox and radio button controls in the web interface
templates (Issue #5161)
- Fixed group validation on OpenBSD (Issue #5166)
- Improved IPP Everywhere media support, including a new
`cupsAddDestMediaOptions` function (Issue #5167)
- IPP Everywhere PPDs now include localizations of printer-specific media types,
when available (Issue #5168)
- The cups-driverd program incorrectly stopped scanning PPDs as soon as a loop
was seen (Issue #5170)
- IPP Everywhere PPDs now support IPP job presets (Issue #5179)
- IPP Everywhere PPDs now support finishing templates (Issue #5180)
- Fixed a journald support bug in the scheduler (Issue #5181)
- Fixed PAM module detection and added support for the common PAM definitions
(Issue #5185)
- The scheduler now substitutes default values for invalid job attributes when
running in "relaxed conformance" mode (Issue #5186)
- The scheduler did not work with older versions of uClibc (Issue #5188)
- The scheduler now generates a strings file for localizing PPD options
(Issue #5194)
+1234
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-15
Ver Arquivo
@@ -1,15 +0,0 @@
Contributing to CUPS
====================
CUPS is developed by Apple Inc. and distributed as open source software under
the Apache License, Version 2.0 with exceptions to allow linking to GPL2/LGPL2
code. Significant contributions to CUPS must be licensed to Apple using the
Apple Contributor Agreement:
https://www.cups.org/AppleContributorAgreement_2011-03-10.pdf
Contributions should be submitted as attachments to bug reports on the
[CUPS Github project](https://github.com/apple/cups). Changes to existing
source files should be submitted as unified diffs while new source files
should be provided as-is or in an archive. Github pull requests can also be
used to submit changes.
-54
Ver Arquivo
@@ -1,54 +0,0 @@
CREDITS - 2019-08-21
====================
Few projects are completed by one person, and CUPS is no exception. We'd like
to thank the following individuals for their contributions:
Niklas 'Nille' Åkerström - Swedish localization.
Nathaniel Barbour - Lots of testing and feedback.
N. Becker - setsid().
Philippe Combes - French localization and buttons script.
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.
Tomohiro Kato - Japanese localization.
Kiko - Bug fixes.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Marek Laane - Estonian translation.
Iñaki Larrañaga - Basque localization.
Mark Lawrence - Microsoft interoperability testing.
Jeff Licquia - Bug fixes, beta testing, evangelism.
Jason McMullan - Original CUPS RPM distributions.
Àngel Mompó - Catalan localization.
Wes Morgan - *BSD fixes.
Kenshi Muto - Japanese localization, patches, and
testing.
Brian Norris - Upstart support.
Daniel Nylander - Swedish localization.
Naruiko Ogasawara - Japanese localization.
Giulio Orsero - Bug fixes and testing.
Michal Osowiecki - Polish localization.
Citra Paska - Indonesian localization.
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
Vincenzo Reale - Italian localization.
Petter Reinholdtsen - HP-UX compiler stuff.
Juan Pablo González Riopedre - Spanish localization.
Giovanni Scafora - Italian localization.
Joachim Schwender - German localization.
Opher Shachar - Hebrew localization.
Stuart Stevens - HP JetDirect IPP information.
Andrea Suatoni - IRIX desktop integration and testing.
Teppo Turliainen - Finnish 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
"msweet@apple.com".
+26
Ver Arquivo
@@ -0,0 +1,26 @@
CREDITS.txt - 01/27/2000
------------------------
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.
If I've missed someone, please let me know by sending an email to
"mike@easysw.com".
-626
Ver Arquivo
@@ -1,626 +0,0 @@
Developing for CUPS
===================
Please see the [Contributing to CUPS](CONTRIBUTING.md) file for information on
contributing to the CUPS project.
How To Contact The Developers
-----------------------------
The CUPS mailing lists are the primary means of asking questions and informally
discussing issues and feature requests with the CUPS developers and other
experienced CUPS users and developers. The "cups" mailing list is intended for
CUPS usage questions and new software announcements while the "cups-devel"
mailing list provides a forum for CUPS developers and monitoring new bugs.
Interfaces
----------
CUPS interfaces, including the C APIs and command-line arguments, environment
variables, configuration files, and output format, are stable across patch
versions and are generally backwards-compatible with interfaces used in prior
major and minor versions. However, program interfaces such as those used by
the scheduler to run filter, port monitor, and backend processes for job
processing should only be considered stable from the point of view of a
filter, port monitor, or backend. Software that simulates the scheduler in
order to run those programs outside of CUPS must necessarily be updated when
the corresponding interface is changed in a subsequent CUPS release, otherwise
undefined behavior can occur.
CUPS C APIs starting with an underscore (`_`) are considered to be private to
CUPS and are not subject to the normal guarantees of stability between CUPS
releases and must never be used in non-CUPS source code. Similarly,
configuration and state files written by CUPS are considered private if a
corresponding man page is not provided with the CUPS release. Never rely on
undocumented files or formats when developing software for CUPS. Always use a
published C API to access data stored in a file to avoid compatibility problems
in the future.
Build System
------------
The CUPS build system uses GNU autoconf to tailor the library to the local
operating system. Project files for the current release of Microsoft Visual
Studio are also provided for Microsoft Windows®. To improve portability,
makefiles must not make use of features unique to GNU make. See the MAKEFILE
GUIDELINES section for a description of the allowed make features and makefile
guidelines.
Additional GNU build programs such as GNU automake and GNU libtool must not be
used. GNU automake produces non-portable makefiles which depend on GNU-
specific extensions, and GNU libtool is not portable or reliable enough for
CUPS.
Version Numbering
-----------------
CUPS uses a three-part version number separated by periods to represent the
major, minor, and patch release numbers. Major release numbers indicate large
design changes or backwards-incompatible changes to the CUPS API or CUPS
Imaging API. Minor release numbers indicate new features and other smaller
changes which are backwards-compatible with previous CUPS releases. Patch
numbers indicate bug fixes to the previous feature or patch release. This
version numbering scheme is consistent with the
[Semantic Versioning](http://semver.org) specification.
> Note:
>
> When we talk about compatibility, we are talking about binary compatibility
> for public APIs and output format compatibility for program interfaces.
> Changes to configuration file formats or the default behavior of programs
> are not generally considered incompatible as the upgrade process can
> normally address such changes gracefully.
Production releases use the plain version numbers:
MAJOR.MINOR.PATCH
1.0.0
...
1.1.0
...
1.1.23
...
2.0.0
...
2.1.0
2.1.1
2.1.2
2.1.3
The first production release in a MAJOR.MINOR series (MAJOR.MINOR.0) is called
a feature release. Feature releases are the only releases that may contain new
features. Subsequent production releases in a MAJOR.MINOR series may only
contain bug fixes.
Beta-test releases are identified by appending the letter B to the major and
minor version numbers followed by the beta release number:
MAJOR.MINORbNUMBER
2.2b1
Release candidates are identified by appending the letters RC to the major and
minor version numbers followed by the release candidate number:
MAJOR.MINORrcNUMBER
2.2rc1
Coding Guidelines
-----------------
Contributed source code must follow the guidelines below. While the examples
are for C and C++ source files, source code for other languages should conform
to the same guidelines as allowed by the language.
Source code comments provide the reference portion of the CUPS Programming
Manual, which is generated using the [codedoc](https://www.msweet.org/codedoc)
software.
### Source Files
All source files names must be 16 characters or less in length to ensure
compatibility with older UNIX filesystems. Source files containing functions
have an extension of ".c" for C and ".cxx" for C++ source files. All other
"include" files have an extension of ".h". Tabs are set to 8 characters or
columns.
> Note:
>
> The ".cxx" extension is used because it is the only common C++ extension
> between Linux, macOS, UNIX, and Windows.
The top of each source file contains a header giving the purpose or nature of
the source file and the copyright and licensing notice:
/*
* Description of file contents.
*
* Copyright 2017 by Apple Inc.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
### Header Files
All public header files must include the "versioning.h" header file, or a header
that does so. Function declarations are then "decorated" with the correct
`_CUPS_API_major_minor` macro to define its availability based on the build
environment, for example:
extern int cupsDoThis(int foo, int bar) _CUPS_API_2_2;
Private API header files must be named with the suffix "-private", for example
the "cups.h" header file defines all of the public CUPS APIs while the
"cups-private.h" header file defines all of the private CUPS APIs as well.
Typically a private API header file will include the corresponding public API
header file.
### Comments
All source code utilizes block comments within functions to describe the
operations being performed by a group of statements; avoid putting a comment
per line unless absolutely necessary, and then consider refactoring the code
so that it is not necessary. C source files use the block comment format
("/* comment */") since many vendor C compilers still do not support C99/C++
comments ("// comment"):
/*
* Clear the state array before we begin...
*/
for (i = 0; i < (sizeof(array) / sizeof(sizeof(array[0])); i ++)
array[i] = CUPS_STATE_IDLE;
/*
* Wait for state changes on another thread...
*/
do
{
for (i = 0; i < (sizeof(array) / sizeof(sizeof(array[0])); i ++)
if (array[i] != CUPS_STATE_IDLE)
break;
if (i == (sizeof(array) / sizeof(array[0])))
sleep(1);
} while (i == (sizeof(array) / sizeof(array[0])));
### Indentation
All code blocks enclosed by brackets begin with the opening brace on a new
line. The code then follows starting on a new line after the brace and is
indented 2 spaces. The closing brace is then placed on a new line following
the code at the original indentation:
{
int i; /* Looping var */
/*
* Process foobar values from 0 to 999...
*/
for (i = 0; i < 1000; i ++)
{
do_this(i);
do_that(i);
}
}
Single-line statements following "do", "else", "for", "if", and "while" are
indented 2 spaces as well. Blocks of code in a "switch" block are indented 4
spaces after each "case" and "default" case:
switch (array[i])
{
case CUPS_STATE_IDLE :
do_this(i);
do_that(i);
break;
default :
do_nothing(i);
break;
}
### Spacing
A space follows each reserved word such as `if`, `while`, etc. Spaces are not
inserted between a function name and the arguments in parenthesis.
### Return Values
Parenthesis surround values returned from a function:
return (CUPS_STATE_IDLE);
### Functions
Functions with a global scope have a lowercase prefix followed by capitalized
words, e.g., `cupsDoThis`, `cupsDoThat`, `cupsDoSomethingElse`, etc. Private
global functions begin with a leading underscore, e.g., `_cupsDoThis`,
`_cupsDoThat`, etc.
Functions with a local scope are declared static with lowercase names and
underscores between words, e.g., `do_this`, `do_that`, `do_something_else`, etc.
Each function begins with a comment header describing what the function does,
the possible input limits (if any), the possible output values (if any), and
any special information needed:
/*
* 'do_this()' - Compute y = this(x).
*
* Notes: none.
*/
static float /* O - Inverse power value, 0.0 <= y <= 1.1 */
do_this(float x) /* I - Power value (0.0 <= x <= 1.1) */
{
...
return (y);
}
Return/output values are indicated using an "O" prefix, input values are
indicated using the "I" prefix, and values that are both input and output use
the "IO" prefix for the corresponding in-line comment.
The [codedoc](https://www.msweet.org/codedoc) documentation generator also
understands the following special text in the function description comment:
@deprecated@ - Marks the function as deprecated: not recommended
for new development and scheduled for removal.
@link name@ - Provides a hyperlink to the corresponding function
or type definition.
@since CUPS version@ - Marks the function as new in the specified version
of CUPS.
@private@ - Marks the function as private so it will not be
included in the documentation.
### Variables
Variables with a global scope are capitalized, e.g., `ThisVariable`,
`ThatVariable`, `ThisStateVariable`, etc. Globals in CUPS libraries are either
part of the per-thread global values managed by the `_cupsGlobals` function
or are suitably protected for concurrent access. Global variables should be
replaced by function arguments whenever possible.
Variables with a local scope are lowercase with underscores between words,
e.g., `this_variable`, `that_variable`, etc. Any "local global" variables
shared by functions within a source file are declared static. As for global
variables, local static variables are suitably protected for concurrent access.
Each variable is declared on a separate line and is immediately followed by a
comment block describing the variable:
int ThisVariable; /* The current state of this */
static int that_variable; /* The current state of that */
### Types
All type names are lowercase with underscores between words and `_t` appended
to the end of the name, e.g., `cups_this_type_t`, `cups_that_type_t`, etc.
Type names start with a prefix, typically `cups` or the name of the program,
to avoid conflicts with system types. Private type names start with an
underscore, e.g., `_cups_this_t`, `_cups_that_t`, etc.
Each type has a comment block immediately after the typedef:
typedef int cups_this_type_t; /* This type is for CUPS foobar options. */
### Structures
All structure names are lowercase with underscores between words and `_s`
appended to the end of the name, e.g., `cups_this_s`, `cups_that_s`, etc.
Structure names start with a prefix, typically `cups` or the name of the
program, to avoid conflicts with system types. Private structure names start
with an underscore, e.g., `_cups_this_s`, `_cups_that_s`, etc.
Each structure has a comment block immediately after the struct and each member
is documented similar to the variable naming policy above:
struct cups_this_struct_s /* This structure is for CUPS foobar options. */
{
int this_member; /* Current state for this */
int that_member; /* Current state for that */
};
### Constants
All constant names are uppercase with underscores between words, e.g.,
`CUPS_THIS_CONSTANT`, `CUPS_THAT_CONSTANT`, etc. Constants begin with an
uppercase prefix, typically `CUPS_` or the program or type name. Private
constants start with an underscore, e.g., `_CUPS_THIS_CONSTANT`,
`_CUPS_THAT_CONSTANT`, etc.
Typed enumerations should be used whenever possible to allow for type checking
by the compiler.
Comment blocks immediately follow each constant:
typedef enum cups_tray_e /* Tray enumerations */
{
CUPS_TRAY_THIS, /* This tray */
CUPS_TRAY_THAT /* That tray */
} cups_tray_t;
## Makefile Guidelines
The following is a guide to the makefile-based build system used by CUPS.
These standards have been developed over the years to allow CUPS to be built on
as many systems and environments as possible.
### General Organization
The CUPS source code is organized functionally into a top-level makefile,
include file, and subdirectories each with their own makefile and dependencies
files. The ".in" files are template files for the autoconf software and are
used to generate a static version of the corresponding file.
### Makefile Documentation
Each makefile starts with the standard CUPS header containing the description
of the file, and CUPS copyright and license notice:
#
# Makefile for ...
#
# Copyright 2017 by Apple Inc.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
### Portable Makefile Construction
CUPS uses a common subset of make program syntax to ensure that the software
can be compiled "out of the box" on as many systems as possible. The following
is a list of assumptions we follow when constructing makefiles:
- Targets; we assume that the make program supports the notion of simple
targets of the form "name:" that perform tab-indented commands that follow
the target, e.g.:
target:
TAB target commands
- Dependencies; we assume that the make program supports recursive dependencies
on targets, e.g.:
target: foo bar
TAB target commands
foo: bla
TAB foo commands
bar:
TAB bar commands
bla:
TAB bla commands
- Variable Definition; we assume that the make program supports variable
definition on the command-line or in the makefile using the following form:
name=value
- Variable Substitution; we assume that the make program supports variable
substitution using the following forms:
- `$(name)`; substitutes the value of "name",
- `$(name:.old=.new)`; substitutes the value of "name" with the filename
extension ".old" changed to ".new",
- `$(MAKEFLAGS)`; substitutes the command-line options passed to the
program without the leading hyphen (-),
- `$$`; substitutes a single $ character,
- `$<`; substitutes the current source file or dependency, and
- `$@`; substitutes the current target name.
- Suffixes; we assume that the make program supports filename suffixes with
assumed dependencies, e.g.:
.SUFFIXES: .c .o
.c.o:
TAB $(CC) $(CFLAGS) -o $@ -c $<
- Include Files; we assume that the make program supports the include
directive, e.g.:
include ../Makedefs
include Dependencies
- Comments; we assume that comments begin with a # character and proceed to the
end of the current line.
- Line Length; we assume that there is no practical limit to the length of
lines.
- Continuation of long lines; we assume that the `\` character may be placed at
the end of a line to concatenate two or more lines in a makefile to form a
single long line.
- Shell; we assume a POSIX-compatible shell is present on the build system.
### Standard Variables
The following variables are defined in the "Makedefs" file generated by the
autoconf software:
- `ALL_CFLAGS`; the combined C compiler options,
- `ALL_CXXFLAGS`; the combined C++ compiler options,
- `AMANDIR`; the administrative man page installation directory (section 8/1m
depending on the platform),
- `AR`; the library archiver command,
- `ARFLAGS`; options for the library archiver command,
- `AWK`; the local awk command,
- `BINDIR`; the binary installation directory,
- `BUILDROOT`; optional installation prefix (defaults to DSTROOT),
- `CC`; the C compiler command,
- `CFLAGS`; options for the C compiler command,
- `CHMOD`; the chmod command,
- `CXX`; the C++ compiler command,
- `CXXFLAGS`; options for the C++ compiler command,
- `DATADIR`; the data file installation directory,
- `DSO`; the C shared library building command,
- `DSOXX`; the C++ shared library building command,
- `DSOFLAGS`; options for the shared library building command,
- `INCLUDEDIR`; the public header file installation directory,
- `INSTALL`; the install command,
- `INSTALL_BIN`; the program installation command,
- `INSTALL_COMPDATA`; the compressed data file installation command,
- `INSTALL_CONFIG`; the configuration file installation command,
- `INSTALL_DATA`; the data file installation command,
- `INSTALL_DIR`; the directory installation command,
- `INSTALL_LIB`; the library installation command,
- `INSTALL_MAN`; the documentation installation command,
- `INSTALL_SCRIPT`; the shell script installation command,
- `LD`; the linker command,
- `LDFLAGS`; options for the linker,
- `LIBDIR`; the library installation directory,
- `LIBS`; libraries for all programs,
- `LN`; the ln command,
- `MAN1EXT`; extension for man pages in section 1,
- `MAN3EXT`; extension for man pages in section 3,
- `MAN5EXT`; extension for man pages in section 5,
- `MAN7EXT`; extension for man pages in section 7,
- `MAN8DIR`; subdirectory for man pages in section 8,
- `MAN8EXT`; extension for man pages in section 8,
- `MANDIR`; the man page installation directory,
- `OPTIM`; common compiler optimization options,
- `PRIVATEINCLUDE`; the private header file installation directory,
- `RM`; the rm command,
- `SHELL`; the sh (POSIX shell) command,
- `STRIP`; the strip command,
- `srcdir`; the source directory.
### Standard Targets
The following standard targets are defined in each makefile:
- `all`; creates all target programs, libraries, and documentation files,
- `clean`; removes all target programs libraries, documentation files, and object
files,
- `depend`; generates automatic dependencies for any C or C++ source files (also
see "DEPENDENCIES"),
- `distclean`; removes autoconf-generated files in addition to those removed by
the "clean" target,
- `install`; installs all distribution files in their corresponding locations
(also see "INSTALL/UNINSTALL SUPPORT"),
- `install-data`; installs all data files in their corresponding locations (also
see "INSTALL/UNINSTALL SUPPORT"),
- `install-exec`; installs all executable files in their corresponding locations
(also see "INSTALL/UNINSTALL SUPPORT"),
- `install-headers`; installs all include files in their corresponding locations
(also see "INSTALL/UNINSTALL SUPPORT"),
- `install-libs`; installs all library files in their corresponding locations
(also see "INSTALL/UNINSTALL SUPPORT"), and
- `uninstall`; removes all distribution files from their corresponding locations
(also see "INSTALL/UNINSTALL SUPPORT").
### Object Files
Object files (the result of compiling a C or C++ source file) have the
extension ".o".
### Programs
Program files are the result of linking object files and libraries together to
form an executable file. A typical program target looks like:
program: $(OBJS)
TAB echo Linking $@...
TAB $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
### Static Libraries
Static libraries have a prefix of "lib" and the extension ".a". A typical
static library target looks like:
libname.a: $(OBJECTS)
TAB echo Creating $@...
TAB $(RM) $@
TAB $(AR) $(ARFLAGS) $@ $(OBJECTS)
TAB $(RANLIB) $@
### Shared Libraries
Shared libraries have a prefix of "lib" and the extension ".dylib" or ".so"
depending on the operating system. A typical shared library is composed of
several targets that look like:
libname.so: $(OBJECTS)
TAB echo $(DSOCOMMAND) libname.so.$(DSOVERSION) ...
TAB $(DSOCOMMAND) libname.so.$(DSOVERSION) $(OBJECTS)
TAB $(RM) libname.so libname.so.$(DSOMAJOR)
TAB $(LN) libname.so.$(DSOVERSION) libname.so.$(DSOMAJOR)
TAB $(LN) libname.so.$(DSOVERSION) libname.so
libname.dylib: $(OBJECTS)
TAB echo $(DSOCOMMAND) libname.$(DSOVERSION).dylib ...
TAB $(DSOCOMMAND) libname.$(DSOVERSION).dylib \
TAB TAB -install_name $(libdir)/libname.$(DSOMAJOR).dylib \
TAB TAB -current_version libname.$(DSOVERSION).dylib \
TAB TAB -compatibility_version $(DSOMAJOR).0 \
TAB TAB $(OBJECTS) $(LIBS)
TAB $(RM) libname.dylib
TAB $(RM) libname.$(DSOMAJOR).dylib
TAB $(LN) libname.$(DSOVERSION).dylib libname.$(DSOMAJOR).dylib
TAB $(LN) libname.$(DSOVERSION).dylib libname.dylib
### Dependencies
Static dependencies are expressed in each makefile following the target, for
example:
foo: bar
Static dependencies are only used when it is not possible to automatically
generate them. Automatic dependencies are stored in a file named
"Dependencies" and included at the end of the makefile. The following "depend"
target rule is used to create the automatic dependencies:
depend:
TAB $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
We regenerate the automatic dependencies on an macOS system and express any
non-macOS dependencies statically in the makefile.
### Install/Uninstall Support
All makefiles contains install and uninstall rules which install or remove the
corresponding software. These rules must use the $(BUILDROOT) variable as a
prefix to any installation directory so that CUPS can be installed in a
temporary location for packaging by programs like rpmbuild.
The `INSTALL_BIN`, `INSTALL_COMPDATA`, `INSTALL_CONFIG`, `INSTALL_DATA`,
`INSTALL_DIR`, `INSTALL_LIB`, `INSTALL_MAN`, and `INSTALL_SCRIPT` variables
must be used when installing files so that the proper ownership and permissions
are set on the installed files.
The `$(RANLIB)` command must be run on any static libraries after installation
since the symbol table is invalidated when the library is copied on some
platforms.
+133
Ver Arquivo
@@ -0,0 +1,133 @@
ENCRYPTION - CUPS v1.1.6 - 01/23/2001
-------------------------------------
This file describes the encryption support provided by CUPS.
WARNING: CLIENTS CURRENTLY TRUST ALL CERTIFICATES FROM SERVERS.
This makes the CUPS client applications vulnerable to "man in
the middle" attacks, so we don't recommend using this to do
remote administration over WANs at this time.
Future versions of CUPS will keep track of server certificates
and provide a callback/confirmation interface for accepting new
certificates and warning when a certificate has changed.
LEGAL STUFF
BEFORE USING THE ENCRYPTION SUPPORT, PLEASE VERIFY THAT IT IS
LEGAL TO DO SO IN YOUR COUNTRY. CUPS by itself doesn't include
any encryption code, but it can link against the OpenSSL library
which does.
OVERVIEW OF ENCRYPTION SUPPORT IN CUPS
CUPS supports SSL/2.0, SSL/3.0, and TLS/1.0 encryption using
keys as large as 128-bits. Encryption support is provided via
the OpenSSL library and some new hooks in the CUPS code.
CUPS provides support for dedicated (https) and "upgrade" (TLS)
encryption of sessions. The "HTTP Upgrade" method is described
in RFC 2817; basically, the client can be secure or unsecure,
and the client or server initiates an upgrade to a secure
connection via some new HTTP fields and status codes. The HTTP
Upgrade method is new and no browsers we know of support it yet.
Stick with "https" for web browsers.
The current implementation is very basic. The CUPS client
software (lp, lpr, etc.) uses encryption as requested by the
user or server.
The user can specify the "-E" option with the printing commands
to force encryption of the connection. Encryption can also be
specified using the Encryption directive in the client.conf file
or in the CUPS_ENCRYPTION environment variable:
Never
Never do encryption.
Always
Always do SSL/TLS encryption using the https scheme.
IfRequested
Upgrade to TLS encryption if the server asks for it.
This is the default setting.
Required
Always upgrade to TLS encryption as soon as the
connection is made. This is different than the "Always"
mode above since the connection is initially unsecure
and the client initiates the upgrade to TLS encryption.
(same as using the "-E" option)
These keywords are also used in the cupsd.conf file to secure
particular locations. To secure all traffic on the server, listen
on port 443 (https port) instead of port 631 and change the "ipp"
service listing (or add it if you don't have one) in /etc/services
to 443.
BEFORE YOU BEGIN
You'll need the OpenSSL library from:
http://www.openssl.org
CONFIGURING WITH ENCRYPTION SUPPORT
Once you have the OpenSSL library installed, you'll need to
configure CUPS to use it with the "--enable-ssl" option:
./configure --enable-ssl
If the OpenSSL stuff is not in a standard location, make sure to
define the CFLAGS, CXXFLAGS, and LDFLAGS environment variables
with the appropriate compiler and linker options first.
GENERATING A SERVER CERTIFICATE AND KEY
The following OpenSSL command will generate a server certificate
and key that you can play with. Since the certificate is not
properly signed it will generate all kinds of warnings in
Netscape and MSIE:
openssl req -new -x509 -keyout /etc/cups/ssl/server.key \
-out /etc/cups/ssl/server.crt -days 365 -nodes
chmod 600 /etc/cups/ssl/server.*
The "-nodes" option prevents the certificate and key from being
encrypted. The cupsd process runs in the background, detached
from any input source; if you encrypt these files then cupsd
will not be able to load them!
Send all rants about non-encrypted certificate and key files to
/dev/null. It makes sense to encrypt user files, but not for
files used by system processes/daemons...
REPORTING PROBLEMS
If you have problems, READ THE DOCUMENTATION FIRST! If the
documentation does not solve your problems please send an email
to "cups-support@cups.org". Include your operating system and
version, compiler and version, and any errors or problems you've
run into. The "/var/log/cups/error_log" file should also be sent,
as it often helps to determine the cause of your problem.
If you are running a version of Linux, be sure to provide the
Linux distribution you have, too.
Please note that the "cups-support@cups.org" email address goes
to the CUPS developers; they are busy people, so your email may
go unanswered for days or weeks. In general, only general build
or distribution problems will actually get answered - for
end-user support see the "README.txt" for a summary of the
resources available.
-227
Ver Arquivo
@@ -1,227 +0,0 @@
INSTALL - CUPS v2.3.3 - 2020-04-24
==================================
This file describes how to compile and install CUPS from source code. For more
information on CUPS see the file called "README.md". A complete change log can
be found in "CHANGES.md".
Using CUPS requires additional third-party support software and printer drivers.
These are typically included with your operating system distribution. Apple
does not endorse or support third-party support software for CUPS.
> Note: Current versions of macOS DO NOT allow installation to /usr with the
> default System Integrity Protection (SIP) settings. In addition, we do not
> recommend replacing the CUPS supplied with macOS because:
>
> a. not all versions of CUPS are compatible with every macOS release,
>
> b. code signing prevents replacement of system libraries and access to the
> system keychain (needed for encrypted printer sharing), and
>
> c. software updates will often replace parts of your local installation,
> potentially rendering your system unusable.
>
> Apple only supports using the Clang supplied with Xcode to build CUPS on
> macOS.
BEFORE YOU BEGIN
----------------
You'll need ANSI-compliant C and C++ compilers, plus a make program and POSIX-
compliant shell (/bin/sh). The GNU compiler tools and Bash work well and we
have tested the current CUPS code against several versions of GCC with excellent
results.
The makefiles used by the project should work with most versions of make. We've
tested them with GNU make as well as the make programs shipped by Compaq, HP,
SGI, and Sun. BSD users should use GNU make (gmake) since BSD make does not
support "include".
Besides these tools you'll want ZLIB library for compression support, the GNU
TLS library for encryption support on platforms other than iOS, macOS, or
Windows, and either MIT (1.6.3 or higher) or Heimdal Kerberos for Kerberos
support. CUPS will compile and run without these, however you'll miss out on
many of the features provided by CUPS.
On a stock Ubuntu install, the following command will install the required
prerequisites:
sudo apt-get install autoconf build-essential libavahi-client-dev \
libgnutls28-dev libkrb5-dev libnss-mdns libpam-dev \
libsystemd-dev libusb-1.0-0-dev zlib1g-dev
Also, please note that CUPS does not include print filters to support PDF or
raster printing. You *must* download GPL Ghostscript and/or the Open Printing
CUPS filters package separately to print on operating systems other than macOS.
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
> Note: Current versions of macOS DO NOT allow installation to /usr with the
> default System Integrity Protection (SIP) settings.
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 ...
The `--enable-debug` option compiles CUPS with debugging information enabled.
Additional debug logging support can be enabled using the
`--enable-debug-printfs` option - these debug messages are enabled using the
`CUPS_DEBUG_xxx` environment variables at run-time.
CUPS also includes an extensive set of unit tests that can be used to find and
diagnose a variety of common problems - use the "--enable-unit-tests" configure
option to run them at build time.
On macOS, use the `--with-archflags` option to build with the correct set of
architectures:
./configure --with-archflags="-arch i386 -arch x86_64" ...
Once you have configured things, just type:
make ENTER
or if you have FreeBSD, NetBSD, or OpenBSD type:
gmake ENTER
to build the software.
TESTING THE SOFTWARE
--------------------
Aside from the built-in unit tests, CUPS includes an automated test framework
for testing the entire printing system. To run the tests, just type:
make check ENTER
or if you have FreeBSD, NetBSD, or OpenBSD type:
gmake check ENTER
The test framework runs a copy of the CUPS scheduler (cupsd) on port 8631 in
/tmp/cups-$USER and produces a nice HTML report of the results.
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
Use the BUILDROOT variable to install to an alternate root directory:
make BUILDROOT=/some/other/root/directory 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.
You can find the RPM software at:
http://www.rpm.org/
The EPM software is available at:
https://michaelrsweet.github.io/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
- "bsd": Builds a *BSD package
- "deb": Builds a Debian package
- "pkg": Builds a Solaris package
- "rpm": Builds a RPM package
- "slackware": Build a Slackware package
GETTING DEBUG LOGGING FROM CUPS
-------------------------------
When configured with the `--enable-debug-printfs` option, CUPS compiles in
additional debug logging support in the scheduler, CUPS API, and CUPS Imaging
API. The following environment variables are used to enable and control debug
logging:
- `CUPS_DEBUG_FILTER`: Specifies a POSIX regular expression to control which
messages are logged.
- `CUPS_DEBUG_LEVEL`: Specifies a number from 0 to 9 to control the verbosity of
the logging. The default level is 1.
- `CUPS_DEBUG_LOG`: Specifies a log file to use. Specify the name "-" to send
the messages to stderr. Prefix a filename with "+" to append to an existing
file. You can include a single "%d" in the filename to embed the current
process ID.
REPORTING PROBLEMS
------------------
If you have problems, *read the documentation first*! If the documentation does
not solve your problems, please post a message on the users forum at:
https://www.cups.org/
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.
+157
Ver Arquivo
@@ -0,0 +1,157 @@
INSTALL - CUPS v1.1.6 - 01/23/2001
----------------------------------
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".
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 GCC 2.95.x 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 following libraries:
- JPEG 6b or higher
- PNG 1.0.6 or higher
- TIFF 3.4 or higher
- ZLIB 1.1.3 or higher
CUPS will compile and run without these, however you'll miss out on
many of the features provided by CUPS.
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 ENTER
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 ENTER
If the PNG, JPEG, TIFF, and ZLIB libraries are not installed in
a system default location (typically "/usr/include" and
"/usr/lib") you'll need to set the CFLAGS, CXXFLAGS, and LDFLAGS
environment variables prior to running configure:
setenv CFLAGS "-I/some/directory" ENTER
setenv CXXFLAGS "-I/some/directory" ENTER
setenv LDFLAGS "-L/some/directory" ENTER
./configure ... ENTER
or:
CFLAGS="-I/some/directory"; export CFLAGS ENTER
CXXFLAGS="-I/some/directory"; export CXXFLAGS ENTER
LDFLAGS="-L/some/directory"; export LDFLAGS ENTER
./configure ... ENTER
To enable support for encryption, you'll also want to add the
"--enable-ssl" option:
./configure --enable-ssl
SSL and TLS support require the OpenSSL library, available at:
http://www.openssl.org
See the file "ENCRYPTION.txt" for information on using the
encryption support in CUPS.
Once you have configured things, just type:
make ENTER
or if you have FreeBSD:
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:
gmake install ENTER
You can also build binary packages that can be installed on other
machines using the RPM spec file ("cups.spec") or EPM list file
("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 RPM software is 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, where <format> is one of the following:
epm - Builds a portable shell script and tar file based
distribution. This format will also backup your
existing printing system if you decide to remove
CUPS at some future time.
rpm - Builds a RPM binary distribution.
deb - Builds a Debian binary distribution.
depot - Builds a HP-UX binary distribution.
pkg - Builds a Solaris binary distribution.
tardist - Builds an IRIX binary distribution.
REPORTING PROBLEMS
If you have problems, READ THE DOCUMENTATION FIRST! If the
documentation does not solve your problems please send an email
to "cups-support@cups.org". Include your operating system and
version, compiler and version, and any errors or problems you've
run into. The "/var/log/cups/error_log" file should also be sent,
as it often helps to determine the cause of your problem.
If you are running a version of Linux, be sure to provide the
Linux distribution you have, too.
Please note that the "cups-support@cups.org" email address goes
to the CUPS developers; they are busy people, so your email may
go unanswered for days or weeks. In general, only general build
or distribution problems will actually get answered - for
end-user support see the "README.txt" for a summary of the
resources available.
-202
Ver Arquivo
@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+895
Ver Arquivo
@@ -0,0 +1,895 @@
<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>
+102 -205
Ver Arquivo
@@ -1,190 +1,97 @@
#
# Common makefile definitions for CUPS.
# "$Id$"
#
# Copyright © 2007-2019 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
# Copyright 1997-2001 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:
#
# CUPS version...
# 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
#
CUPS_VERSION = @CUPS_VERSION@
#
# Programs...
#
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL_CC@ @CC@
CHMOD = @CHMOD@
CXX = @LIBTOOL_CXX@ @CXX@
DSO = @DSO@
DSOXX = @DSOXX@
GZIPPROG = @GZIPPROG@
INSTALL = @INSTALL@
LD = @LD@
LD_CC = @LD_CC@
LD_CXX = @LD_CXX@
LIBTOOL = @LIBTOOL@
LN = @LN@ -sf
MKDIR = @MKDIR@ -p
MV = @MV@
RANLIB = @RANLIB@
RM = @RM@ -f
RMDIR = @RMDIR@
SED = @SED@
SHELL = /bin/sh
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CHMOD = @CHMOD@
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
#
# Installation programs...
#
INSTALL_BIN = @LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = @LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
INSTALL_MAN = $(INSTALL) -c -m 444
INSTALL_SCRIPT = $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@
#
# 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_CUPSD_FILE_PERM = @CUPS_CUPSD_FILE_PERM@
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
#
# Languages to install...
#
LANGUAGES = @LANGUAGES@
INSTALL_LANGUAGES = @INSTALL_LANGUAGES@
UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@
#
# Cross-compilation support: "local" target is used for any tools that are
# built and run locally.
#
LOCALTARGET = @LOCALTARGET@
INSTALL_BIN = $(LIBTOOL) $(CP)
INSTALL_DATA = $(CP)
INSTALL_LIB = $(LIBTOOL) $(CP)
INSTALL_MAN = $(CP)
INSTALL_SCRIPT = $(CP)
INSTALL_SYSV = @INSTALL_SYSV@
#
# Libraries...
#
LIBCUPS = @LIBCUPS@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBCUPSOBJS = @LIBCUPSOBJS@
LIBCUPSSTATIC = @LIBCUPSSTATIC@
LIBGSSAPI = @LIBGSSAPI@
LIBHEADERS = @LIBHEADERS@
LIBHEADERSPRIV = @LIBHEADERSPRIV@
LIBMALLOC = @LIBMALLOC@
LIBPAPER = @LIBPAPER@
LIBUSB = @LIBUSB@
LIBWRAP = @LIBWRAP@
LIBZ = @LIBZ@
#
# Install static libraries?
#
INSTALLSTATIC = @INSTALLSTATIC@
#
# IPP backend aliases...
#
IPPALIASES = @IPPALIASES@
#
# ippeveprinter commands...
#
IPPEVECOMMANDS = @IPPEVECOMMANDS@
#
# Install XPC backends?
#
INSTALLXPC = @INSTALLXPC@
#
# Code signing...
#
CODE_SIGN = @CODE_SIGN@
CODE_SIGN_IDENTITY = -
LIBCUPS = @LIBCUPS@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBJPEG = @LIBJPEG@
LIBMALLOC = @LIBMALLOC@
LIBPNG = @LIBPNG@
LIBTIFF = @LIBTIFF@
LIBZ = @LIBZ@
#
# Program options...
#
# ARCHFLAGS Defines the default architecture build options.
# OPTIM Defines the common compiler optimization/debugging options
# for all architectures.
# OPTIONS Defines other compile-time options (currently only -DDEBUG
# for extra debug info)
# GSOPTIM defines the common compiler optimization/debugging options for
# pstoraster (Ghostscript).
# OPTIM defines the common compiler optimization/debugging options.
# OPTIONS defines other compile-time options (currently only -dDEBUG for
# extra debug info)
#
ALL_CFLAGS = -I.. -D_CUPS_SOURCE $(CFLAGS) \
$(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
$(ONDEMANDFLAGS) $(OPTIONS)
ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) \
$(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
$(ONDEMANDFLAGS) $(OPTIONS)
ALL_DSOFLAGS = -L../cups @ARCHFLAGS@ @RELROFLAGS@ $(DSOFLAGS) $(OPTIM)
ALL_LDFLAGS = -L../cups @LDARCHFLAGS@ @RELROFLAGS@ $(LDFLAGS) \
@PIEFLAGS@ $(OPTIM)
ARCHFLAGS = @ARCHFLAGS@
ARFLAGS = @ARFLAGS@
BACKLIBS = @BACKLIBS@
BUILDDIRS = @BUILDDIRS@
CFLAGS = @CPPFLAGS@ @CFLAGS@
COMMONLIBS = @LIBS@
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
DBUS_NOTIFIER = @DBUS_NOTIFIER@
DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
DNSSD_BACKEND = @DNSSD_BACKEND@
DSOFLAGS = @DSOFLAGS@
DNSSDLIBS = @DNSSDLIBS@
IPPFIND_BIN = @IPPFIND_BIN@
IPPFIND_MAN = @IPPFIND_MAN@
LDFLAGS = @LDFLAGS@
LINKCUPS = @LINKCUPS@
LINKCUPSSTATIC = ../cups/$(LIBCUPSSTATIC) $(LIBS)
LIBS = $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ) $(COMMONLIBS)
ONDEMANDFLAGS = @ONDEMANDFLAGS@
ONDEMANDLIBS = @ONDEMANDLIBS@
OPTIM = @OPTIM@
OPTIONS = @WARNING_OPTIONS@
PAMLIBS = @PAMLIBS@
SERVERLIBS = @SERVERLIBS@
SSLFLAGS = @SSLFLAGS@
SSLLIBS = @SSLLIBS@
UNITTESTS = @UNITTESTS@
ARFLAGS = crvs
CFLAGS = @CFLAGS@ -I.. $(OPTIONS)
CXXFLAGS = @CXXFLAGS@ -I.. $(OPTIONS)
DSOFLAGS = @DSOFLAGS@
DSOLIBS = @DSOLIBS@
GSOPTIM = @GSOPTIM@
IMGLIBS = @IMGLIBS@ -lm
LDFLAGS = @LDFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(NETLIBS) @LIBS@
NETLIBS = @NETLIBS@
OPTIM = @OPTIM@
OPTIONS =
SSLLIBS = @SSLLIBS@
#
# Directories...
@@ -194,16 +101,12 @@ UNITTESTS = @UNITTESTS@
# 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@
@@ -213,63 +116,57 @@ localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
privateinclude = @privateinclude@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
top_srcdir = @top_srcdir@
BUILDROOT = $(DSTROOT)$(DESTDIR)
BINDIR = $(BUILDROOT)@bindir@
BUNDLEDIR = @CUPS_BUNDLEDIR@
CACHEDIR = $(BUILDROOT)@CUPS_CACHEDIR@
DATADIR = $(BUILDROOT)@CUPS_DATADIR@
DOCDIR = $(BUILDROOT)@CUPS_DOCROOT@
ICONDIR = @ICONDIR@
INCLUDEDIR = $(BUILDROOT)$(includedir)
LIBDIR = $(BUILDROOT)$(libdir)
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
MANDIR = $(BUILDROOT)@mandir@
MENUDIR = @MENUDIR@
PRIVATEINCLUDE = $(BUILDROOT)@PRIVATEINCLUDE@
RCLEVELS = @RCLEVELS@
RCSTART = @RCSTART@
RCSTOP = @RCSTOP@
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
RESOURCEDIR = @CUPS_RESOURCEDIR@
SBINDIR = $(BUILDROOT)@sbindir@
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
PAMDIR = @PAMDIR@
PAMFILE = @PAMFILE@
DBUSDIR = @DBUSDIR@
AMANDIR = @AMANDIR@
BINDIR = @bindir@
DATADIR = @CUPS_DATADIR@
DOCDIR = @CUPS_DOCROOT@
INCLUDEDIR = $(includedir)
INITDIR = @INITDIR@
INITDDIR = @INITDDIR@
LAUNCHD_DIR = @LAUNCHD_DIR@
SMFMANIFESTDIR = @SMFMANIFESTDIR@
SYSTEMD_DIR = @SYSTEMD_DIR@
XINETD = @XINETD@
USBQUIRKS = @USBQUIRKS@
LIBDIR = $(libdir)
LOCALEDIR = @CUPS_LOCALEDIR@
LOGDIR = @CUPS_LOGDIR@
MANDIR = @mandir@
PAMDIR = @PAMDIR@
REQUESTS = @CUPS_REQUESTS@
SBINDIR = @sbindir@
SERVERBIN = @CUPS_SERVERBIN@
SERVERROOT = @CUPS_SERVERROOT@
CAT1EXT = @CAT1EXT@
CAT5EXT = @CAT5EXT@
CAT8EXT = @CAT8EXT@
MAN8EXT = @MAN8EXT@
#
# Rules...
#
.SILENT:
.SUFFIXES: .a .c .cxx .h .o
.SUFFIXES: .a .c .cxx .h .man .o .0 .1 .5 .8 .z
.c.o:
echo Compiling $<...
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<
$(CC) $(OPTIM) $(CFLAGS) -c $<
.cxx.o:
echo Compiling $<...
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c -o $@ $<
$(CXX) $(OPTIM) $(CXXFLAGS) -c $<
.man.0 .man.1 .man.5 .man.8:
echo Formatting $<...
$(RM) $@
$(NROFF) -man $< >$@
.man.z:
echo Formatting $<...
$(RM) $@ t.z
$(NROFF) -man $< >t
pack -f t
$(MV) t.z $@
#
# End of "$Id$"
#
+91 -247
Ver Arquivo
@@ -1,88 +1,46 @@
#
# Top-level Makefile for CUPS.
# "$Id$"
#
# Copyright © 2007-2019 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
# Copyright 1997-2001 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
include Makedefs
#
# Directories to make...
#
DIRS = cups $(BUILDDIRS)
#
# Test suite options - normally blank, override with make command...
#
TESTOPTIONS =
DIRS = cups backend berkeley cgi-bin filter man pdftops pstoraster \
scheduler systemv
#
# Make all targets...
#
all:
chmod +x cups-config
echo Using ARCHFLAGS="$(ARCHFLAGS)"
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
echo Using CC="$(CC)"
echo Using CXX="$(CC)"
echo Using DSOFLAGS="$(DSOFLAGS)"
echo Using LDFLAGS="$(LDFLAGS)"
echo Using LIBS="$(LIBS)"
for dir in $(DIRS); do\
echo Making all in $$dir... ;\
(cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
(cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
done
#
# Make library targets...
#
libs:
echo Using ARCHFLAGS="$(ARCHFLAGS)"
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
echo Using CC="$(CC)"
echo Using CXX="$(CC)"
echo Using DSOFLAGS="$(DSOFLAGS)"
echo Using LDFLAGS="$(LDFLAGS)"
echo Using LIBS="$(LIBS)"
for dir in $(DIRS); do\
echo Making libraries in $$dir... ;\
(cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
done
#
# Make unit test targets...
#
unittests:
echo Using ARCHFLAGS="$(ARCHFLAGS)"
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
echo Using CC="$(CC)"
echo Using CXX="$(CC)"
echo Using DSOFLAGS="$(DSOFLAGS)"
echo Using LDFLAGS="$(LDFLAGS)"
echo Using LIBS="$(LIBS)"
for dir in $(DIRS); do\
echo Making all in $$dir... ;\
(cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\
done
#
# Remove object and target files...
#
@@ -93,200 +51,86 @@ clean:
(cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
done
#
# Remove all non-distribution files...
# Install object and target files...
#
distclean: clean
$(RM) Makedefs config.h config.log config.status
$(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
$(RM) cups-config
$(RM) desktop/cups.desktop
$(RM) doc/index.html
$(RM) packaging/cups.list
$(RM) scheduler/cups-lpd.xinetd scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist scheduler/org.cups.cups-lpdAT.service scheduler/org.cups.cupsd.path scheduler/org.cups.cupsd.service scheduler/org.cups.cupsd.socket
$(RM) templates/header.tmpl
-$(RM) doc/*/index.html
-$(RM) templates/*/header.tmpl
-$(RM) -r autom4te*.cache cups/charmaps cups/locale
#
# Make dependencies
#
depend:
install:
for dir in $(DIRS); do\
echo Making dependencies in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
echo Installing in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install) || exit 1;\
done
#
# Run the STACK tool on the sources, available here:
#
# http://css.csail.mit.edu/stack/
#
# Do the following to pass options to configure:
#
# make CONFIGFLAGS="--foo --bar" stack
#
.PHONY: stack
stack:
stack-build ./configure $(CONFIGFLAGS)
stack-build $(MAKE) $(MFLAGS) clean all
poptck
$(MAKE) $(MFLAGS) distclean
$(RM) */*.ll
$(RM) */*.ll.out
#
# Generate a ctags file...
#
ctags:
ctags -R .
#
# Install everything...
#
install: install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
echo Making all in cups...
(cd cups; $(MAKE) $(MFLAGS) all)
for dir in $(DIRS); do\
echo Installing data files in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
done
echo Installing cups-config script...
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
#
# Install header files...
#
install-headers:
for dir in $(DIRS); do\
echo Installing header files in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
done
if test "x$(privateinclude)" != x; then \
echo Installing config.h into $(PRIVATEINCLUDE)...; \
$(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
$(INSTALL_DATA) config.h $(PRIVATEINCLUDE)/config.h; \
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 ppd...
(cd ppd; $(MAKE) $(MFLAGS) install)
echo Installing in templates...
(cd templates; $(MAKE) $(MFLAGS) install)
echo Installing startup script...
if test "x$(INITDIR)" != "x"; then \
$(MKDIR) $(prefix)/$(INITDIR)/init.d; \
$(RM) $(prefix)/$(INITDIR)/init.d/cups; \
$(INSTALL_SCRIPT) cups.sh $(prefix)/$(INITDIR)/init.d/cups; \
$(CHMOD) ugo+rx $(prefix)/$(INITDIR)/init.d/cups; \
$(MKDIR) $(prefix)/$(INITDIR)/rc0.d; \
$(RM) $(prefix)/$(INITDIR)/rc0.d/K00cups; \
ln -s $(INITDDIR)/cups $(prefix)/$(INITDIR)/rc0.d/K00cups; \
$(MKDIR) $(prefix)/$(INITDIR)/rc2.d; \
$(RM) $(prefix)/$(INITDIR)/rc2.d/S99cups; \
ln -s $(INITDDIR)/cups $(prefix)/$(INITDIR)/rc2.d/S99cups; \
$(MKDIR) $(prefix)/$(INITDIR)/rc3.d; \
$(RM) $(prefix)/$(INITDIR)/rc3.d/S99cups; \
ln -s $(INITDDIR)/cups $(prefix)/$(INITDIR)/rc3.d/S99cups; \
$(MKDIR) $(prefix)/$(INITDIR)/rc5.d; \
$(RM) $(prefix)/$(INITDIR)/rc5.d/S99cups; \
ln -s $(INITDDIR)/cups $(prefix)/$(INITDIR)/rc5.d/S99cups; \
fi
if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \
$(MKDIR) $(prefix)/$(INITDDIR); \
$(RM) $(prefix)/$(INITDDIR)/cups; \
$(INSTALL_SCRIPT) cups.sh $(prefix)/$(INITDDIR)/cups; \
$(CHMOD) ugo+rx $(prefix)/$(INITDDIR)/cups; \
fi
#
# Install programs...
# Make software distributions using EPM (http://www.easysw.com/epm)...
#
install-exec: all
for dir in $(DIRS); do\
echo Installing programs in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
done
EPMFLAGS = -v \
BINDIR=$(BINDIR) DATADIR=$(DATADIR) \
DOCDIR=$(DOCDIR) INCLUDEDIR=$(INCLUDEDIR) \
LIBDIR=$(LIBDIR) LOCALEDIR=$(LOCALEDIR) \
LOGDIR=$(LOGDIR) MANDIR=$(MANDIR) \
PAMDIR=$(PAMDIR) REQUESTS=$(REQUESTS) \
SBINDIR=$(SBINDIR) SERVERBIN=$(SERVERBIN) \
SERVERROOT=$(SERVERROOT)
epm:
epm $(EPMFLAGS) cups
rpm:
epm $(EPMFLAGS) -f rpm cups
deb:
epm $(EPMFLAGS) -f deb cups
depot:
epm $(EPMFLAGS) -f depot cups
pkg:
epm $(EPMFLAGS) -f pkg cups
tardist:
epm $(EPMFLAGS) -f tardist cups
#
# Install libraries...
# End of "$Id$".
#
install-libs: libs
for dir in $(DIRS); do\
echo Installing libraries in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
done
#
# 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)
#
# Run the test suite...
#
test: all unittests
echo Running CUPS test suite...
cd test; ./run-stp-tests.sh $(TESTOPTIONS)
check: all unittests
echo Running CUPS test suite with defaults...
cd test; ./run-stp-tests.sh 1 0 n n
debugcheck: all unittests
echo Running CUPS test suite with debug printfs...
cd test; ./run-stp-tests.sh 1 0 n y
#
# Create HTML documentation using codedoc (http://www.msweet.org/codedoc)...
#
apihelp:
for dir in cups filter; do\
echo Generating API help in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
done
#
# Lines of code computation...
#
sloc:
for dir in cups scheduler; do \
(cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\
done
#
# Make software distributions using EPM (http://www.msweet.org/)...
#
EPMFLAGS = -v --output-dir dist $(EPMARCH)
bsd deb epm pkg rpm slackware:
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
.PHONY: dist
dist: all
$(RM) -r dist
$(MAKE) $(MFLAGS) epm
case `uname` in \
*BSD*) $(MAKE) $(MFLAGS) bsd;; \
Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
SunOS*) $(MAKE) $(MFLAGS) pkg;; \
esac
#
# Don't run top-level build targets in parallel...
#
.NOTPARALLEL:
-51
Ver Arquivo
@@ -1,51 +0,0 @@
CUPS
Copyright © 2007-2019 by Apple Inc.
Copyright © 1997-2007 by Easy Software Products.
CUPS and the CUPS logo are trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
The Kerberos support code ("KSC") is copyright 2006 by Jelmer Vernooij and is
provided 'as-is', without any express or implied warranty. In no event will the
author or Apple Inc. be held liable for any damages arising from the use of the
KSC.
Sources files containing KSC have the following text at the top of each source
file:
This file contains Kerberos support code, copyright 2006 by Jelmer Vernooij.
The KSC copyright and license apply only to Kerberos-related feature code in
CUPS. Such code is typically conditionally compiled based on the present of the
HAVE_GSSAPI preprocessor definition.
Permission is granted to anyone to use the KSC for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to
the following restrictions:
1. The origin of the KSC must not be misrepresented; you must not claim that
you wrote the original software. If you use the KSC in a product, an
acknowledgment in the product documentation would be appreciated but is not
required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-- CUPS Exceptions to the Apache 2.0 License --
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
-170
Ver Arquivo
@@ -1,170 +0,0 @@
README - CUPS v2.3.3 - 2020-04-24
=================================
INTRODUCTION
------------
CUPS is a standards-based, open source printing system developed by Apple Inc.
for macOS® and other UNIX®-like operating systems. CUPS uses the Internet
Printing Protocol ("IPP") and provides System V and Berkeley command-line
interfaces, a web interface, and a C API to manage printers and print jobs. It
supports printing to both local (parallel, serial, USB) and networked printers,
and printers can be shared from one computer to another, even over the Internet!
Internally, CUPS uses PostScript Printer Description ("PPD") files to describe
printer capabilities and features and a wide variety of generic and device-
specific programs to convert and print many types of files. Sample drivers are
included with CUPS to support many Dymo, EPSON, HP, Intellitech, OKIDATA, and
Zebra printers. Many more drivers are available online and (in some cases) on
the driver CD-ROM that came with your printer.
CUPS is licensed under the Apache License Version 2.0. See the file
"LICENSE" for more information.
READING THE DOCUMENTATION
-------------------------
Initial documentation to get you started is provided in the root directory of
the CUPS sources:
- `CHANGES.md`: A list of changes in the current major release of CUPS.
- `CONTRIBUTING.md`: Guidelines for contributing to the CUPS project.
- `CREDITS.md`: A list of past contributors to the CUPS project.
- `DEVELOPING.md`: Guidelines for developing code for the CUPS project.
- `INSTALL.md`: Instructions for building and installing CUPS.
- `LICENSE`: The CUPS license agreement (Apache 2.0).
- `NOTICE`: Copyright notices and exceptions to the CUPS license agreement.
- `README.md`: This file.
Once you have installed the software you can access the documentation (and a
bunch of other stuff) online at <http://localhost:631/> and using the `man`
command, for example `man cups`.
If you're having trouble getting that far, the documentation is located under
the `doc/help` and `man` directories.
Please read the documentation before asking questions.
GETTING SUPPORT AND OTHER RESOURCES
-----------------------------------
If you have problems, *read the documentation first!* We also provide two
mailing lists which are available at <https://lists.cups.org/mailman/listinfo>.
See the CUPS web site at <https://www.cups.org/> for other resources.
SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
------------------------------------------------
CUPS includes a web-based administration tool that allows you to manage
printers, classes, and jobs on your server. Open <http://localhost:631/admin/>
in your browser to access the printer administration tools:
*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.
You will be asked for the administration password (root or any other user in the
"sys", "system", "root", "admin", or "lpadmin" group on your system) when
performing any administrative function.
SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
-----------------------------------------------
CUPS currently uses PPD (PostScript Printer Description) files that describe
printer capabilities and driver programs needed for each printer. The
`everywhere` PPD is used for nearly all modern networks printers sold since
about 2009. For example, the following command creates a print queue for a
printer at address "11.22.33.44":
lpadmin -p printername -E -v ipp://11.22.33.44/ipp/print -m everywhere
CUPS also includes several sample PPD files you can use for "legacy" printers:
Driver | PPD Name
----------------------------- | ------------------------------
Dymo Label Printers | drv:///sample.drv/dymo.ppd
Intellitech Intellibar | drv:///sample.drv/intelbar.ppd
EPSON 9-pin Series | drv:///sample.drv/epson9.ppd
EPSON 24-pin Series | drv:///sample.drv/epson24.ppd
Generic PCL Laser Printer | drv:///sample.drv/generpcl.ppd
Generic PostScript Printer | drv:///sample.drv/generic.ppd
HP DeskJet Series | drv:///sample.drv/deskjet.ppd
HP LaserJet Series | drv:///sample.drv/laserjet.ppd
OKIDATA 9-Pin Series | drv:///sample.drv/okidata9.ppd
OKIDATA 24-Pin Series | drv:///sample.drv/okidat24.ppd
Zebra CPCL Label Printer | drv:///sample.drv/zebracpl.ppd
Zebra EPL1 Label Printer | drv:///sample.drv/zebraep1.ppd
Zebra EPL2 Label Printer | drv:///sample.drv/zebraep2.ppd
Zebra ZPL Label Printer | drv:///sample.drv/zebra.ppd
You can run the `lpinfo -m` command to list all of the available drivers:
lpinfo -m
Run the `lpinfo -v` command to list the available printers:
lpinfo -v
Then use the correct URI to add the printer using the `lpadmin` command:
lpadmin -p printername -E -v device-uri -m ppd-name
Current network printers typically use `ipp` or `ipps` URIS:
lpadmin -p printername -E -v ipp://11.22.33.44/ipp/print -m everywhere
lpadmin -p printername -E -v ipps://11.22.33.44/ipp/print -m everywhere
Older network printers typically use `socket` or `lpd` URIs:
lpadmin -p printername -E -v socket://11.22.33.44 -m ppd-name
lpadmin -p printername -E -v lpd://11.22.33.44/ -m ppd-name
The sample drivers provide basic printing capabilities, but generally do not
exercise the full potential of the printers or CUPS. Other drivers provide
greater printing capabilities.
PRINTING FILES
--------------
CUPS provides both the System V `lp` and Berkeley `lpr` commands for printing:
lp filename
lpr filename
Both the `lp` and `lpr` commands support printing options for the driver:
lp -o media=A4 -o resolution=600dpi filename
lpr -o media=A4 -o resolution=600dpi filename
CUPS recognizes many types of images files as well as PDF, PostScript, 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:
lp -o raw filename
lpr -l filename
This will prevent the filters from misinterpreting your print file.
LEGAL STUFF
-----------
Copyright © 2007-2019 by Apple Inc.
Copyright © 1997-2007 by Easy Software Products.
CUPS is provided under the terms of the Apache License, Version 2.0 with
exceptions for GPL2/LGPL2 software. A copy of this license can be found in the
file `LICENSE`. Additional legal information is provided in the file `NOTICE`.
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
+276
Ver Arquivo
@@ -0,0 +1,276 @@
README - CUPS v1.1.6 - 01/23/2001
---------------------------------
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 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.
Drivers for over 2300 printers are provided with our ESP Print
Pro software, available at:
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 file "INSTALL.txt".
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.
READING THE DOCUMENTATION
Once you have installed the software you can access the
documentation (and a bunch of other stuff) on-line at:
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.
Please read the documentation before asking questions.
GETTING SUPPORT AND OTHER RESOURCES
If you have problems, READ THE DOCUMENTATION FIRST!
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.
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:
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, consult the CUPS Software Administrators
Manual.
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.
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:
Digital UNIX:
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp0 -E
HP-UX:
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/c2t0d0_lp -E
IRIX:
/usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/plp -E
Linux:
/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
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
PRINTING FILES
CUPS provides both the System V "lp" and Berkeley "lpr" commands
for printing:
lp filename
lpr filename
Both the "lp" and "lpr" commands support printing options for
the driver:
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.
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
This will prevent the filters from misinterpreting your print
file.
LEGAL STUFF
CUPS is Copyright 1993-2001 by Easy Software Products. CUPS,
the CUPS logo, and the Common UNIX Printing System are the
trademark property of Easy Software Products.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
The PostScript RIP software (pstoraster) is based on the GNU
Ghostscript 5.50 core, Copyright 1986-1998 by Aladdin
Enterprises.
The PDF filter (pdftops) is based on the Xpdf 0.90 software,
Copyright 1996-1999 by Derek B. Noonburg.
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 "LICENSE.html",
"LICENSE.txt", or "cups.license" files for more information.
For commercial licensing information, please contact:
Attn: CUPS Licensing Information
Easy Software Products
44141 Airport View Drive, Suite 204
Hollywood, Maryland 20636-3111 USA
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.
-72
Ver Arquivo
@@ -1,72 +0,0 @@
ipp.o: ipp.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/versioning.h \
../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/raster.h
lpd.o: lpd.c ../cups/http-private.h ../config.h ../cups/language.h \
../cups/array.h ../cups/versioning.h ../cups/http.h \
../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/pwg.h backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../cups/array-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/versioning.h \
../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
snmp.o: snmp.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/versioning.h \
../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
socket.o: socket.c ../cups/http-private.h ../config.h ../cups/language.h \
../cups/array.h ../cups/versioning.h ../cups/http.h \
../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/pwg.h backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../cups/array-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
test1284.o: test1284.c ../cups/string-private.h ../config.h \
../cups/versioning.h ieee1284.c backend-private.h \
../cups/cups-private.h ../cups/array-private.h ../cups/array.h \
../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/raster.h
testbackend.o: testbackend.c ../cups/string-private.h ../config.h \
../cups/versioning.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/sidechannel.h
testsupplies.o: testsupplies.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/versioning.h \
../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
usb.o: usb.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/versioning.h \
../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h usb-darwin.c ../cups/debug-private.h \
../cups/file-private.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/raster.h
+68 -247
Ver Arquivo
@@ -1,57 +1,32 @@
#
# Backend makefile for CUPS.
# "$Id$"
#
# Copyright 2007-2019 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
# Backend makefile for the Common UNIX Printing System (CUPS).
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more information.
# Copyright 1997-2001 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
include ../Makedefs
#
# Object files...
#
# RBACKENDS are installed mode 0700 so cupsd will run them as root...
#
# UBACKENDS and ULBACKENDS are installed mode 0755 so cupsd will run them as
# an unprivileged user...
#
# See http://www.cups.org/doc/api-filter.html for more info...
RBACKENDS = \
ipp \
lpd \
$(DNSSD_BACKEND)
UBACKENDS = \
snmp \
socket
ULBACKENDS = \
usb
UNITTESTS = \
test1284 \
testbackend \
testsupplies
TARGETS = \
libbackend.a \
$(RBACKENDS) \
$(UBACKENDS) \
$(ULBACKENDS)
LIBOBJS = \
ieee1284.o \
network.o \
runloop.o \
snmp-supplies.o
OBJS = \
ipp.o \
lpd.o \
dnssd.o \
snmp.o \
socket.o \
test1284.o \
testbackend.o \
testsupplies.o \
usb.o
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
#
@@ -61,260 +36,106 @@ OBJS = \
all: $(TARGETS)
#
# Make library targets...
#
libs: $(ULBACKENDS)
#
# Make unit tests...
#
unittests: $(UNITTESTS)
#
# Clean all object files...
#
clean:
$(RM) $(OBJS) $(TARGETS) $(UNITTESTS) $(LIBOBJS) http https ipps mdns socket-static
#
# Update dependencies (without system header dependencies...)
#
depend:
$(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
$(RM) $(OBJS) $(TARGETS) http
#
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
install:
-$(MKDIR) $(SERVERBIN)/backend
$(CHMOD) ugo+rx $(SERVERBIN)
$(CHMOD) ugo+rx $(SERVERBIN)/backend
$(INSTALL_BIN) $(BACKENDS) $(SERVERBIN)/backend
$(RM) $(SERVERBIN)/backend/http
$(LN) ipp $(SERVERBIN)/backend/http
#
# Install data files...
# betest
#
install-data:
if test "x$(USBQUIRKS)" != x; then \
echo Installing USB quirks in $(USBQUIRKS); \
$(INSTALL_DIR) -m 755 $(USBQUIRKS); \
$(INSTALL_DATA) org.cups.usb-quirks $(USBQUIRKS); \
fi
#
# Install programs...
#
install-exec: $(INSTALLXPC)
echo Installing backends in $(SERVERBIN)/backend
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
for file in $(RBACKENDS); do \
$(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \
done
for file in $(UBACKENDS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
done
for file in $(IPPALIASES); do \
$(RM) $(SERVERBIN)/backend/$$file; \
$(LN) ipp $(SERVERBIN)/backend/$$file; \
done
if test "x$(DNSSD_BACKEND)" != x -a `uname` = Darwin; then \
$(RM) $(SERVERBIN)/backend/mdns; \
$(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \
fi
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(RBACKENDS) $(UBACKENDS); do \
cp $$file $(SYMROOT); \
dsymutil $(SYMROOT)/$$file; \
done \
fi
install-xpc: ipp
echo Installing XPC backends in $(SERVERBIN)/apple
$(INSTALL_DIR) -m 755 $(SERVERBIN)/apple
$(LIBTOOL) $(INSTALL_BIN) ipp $(SERVERBIN)/apple
for file in $(IPPALIASES); do \
$(RM) $(SERVERBIN)/apple/$$file; \
$(LN) ipp $(SERVERBIN)/apple/$$file; \
done
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
echo Installing backends in $(SERVERBIN)/backend
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
for file in $(ULBACKENDS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
done
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(ULBACKENDS); do \
cp $$file $(SYMROOT); \
dsymutil $(SYMROOT)/$$file; \
done \
fi
#
# Uninstall all targets...
#
uninstall:
$(RM) $(SERVERBIN)/apple/ipp
for file in $(IPPALIASES); do \
$(RM) $(SERVERBIN)/apple/$$file; \
done
-$(RMDIR) $(SERVERBIN)/apple
for file in $(RBACKENDS) $(UBACKENDS) $(ULBACKENDS); do \
$(RM) $(SERVERBIN)/backend/$$file; \
done
for file in $(IPPALIASES); do \
$(RM) $(SERVERBIN)/backend/$$file; \
done
-$(RMDIR) $(SERVERBIN)/backend
-$(RMDIR) $(SERVERBIN)
#
# test1284
#
test1284: test1284.o ../cups/$(LIBCUPSSTATIC)
betest: betest.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o test1284 test1284.o $(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o betest betest.o $(LIBS)
#
# testbackend
#
testbackend: testbackend.o ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o testbackend testbackend.o $(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
#
# testsupplies
#
testsupplies: testsupplies.o libbackend.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
$(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
#
# libbackend.a
#
libbackend.a: $(LIBOBJS)
echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
#
# dnssd
#
dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o dnssd dnssd.o libbackend.a $(DNSSDLIBS) $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
if test `uname` = Darwin; then \
$(RM) mdns; \
$(LN) dnssd mdns; \
fi
betest.o: ../cups/string.h ../Makedefs
#
# ipp
#
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
ipp: ipp.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o ipp ipp.o libbackend.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(RM) http https ipps
for file in $(IPPALIASES); do \
$(LN) ipp $$file; \
done
$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS)
$(RM) http
$(LN) ipp http
ipp.o: ../cups/cups.h ../Makedefs
#
# lpd
#
lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
lpd: lpd.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o lpd lpd.o libbackend.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
lpd.o: ../cups/cups.h ../Makedefs
#
# snmp
# parallel
#
snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
parallel: parallel.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o snmp snmp.o libbackend.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o parallel parallel.o $(LIBS)
parallel.o: ../cups/cups.h ../Makedefs
#
# serial
#
serial: serial.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o serial serial.o $(LIBS)
serial.o: ../cups/cups.h ../Makedefs
#
# socket
#
socket: socket.o ../cups/$(LIBCUPS) libbackend.a
socket: socket.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o socket socket.o libbackend.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o socket socket.o $(LIBS)
socket-static: socket.o ../cups/$(LIBCUPSSTATIC) libbackend.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o socket-static socket.o libbackend.a \
$(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
socket.o: ../cups/cups.h ../Makedefs
#
# usb
#
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
usb: usb.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
$(BACKLIBS) $(COMMONLIBS) $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c
$(CC) $(LDFLAGS) -o usb usb.o $(LIBS)
usb.o: ../cups/cups.h ../Makedefs
#
# Dependencies...
# End of "$Id$".
#
include Dependencies
-327
Ver Arquivo
@@ -1,327 +0,0 @@
/*
* Backend support definitions for CUPS.
*
* Copyright © 2007-2014 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
#ifndef _CUPS_BACKEND_PRIVATE_H_
# define _CUPS_BACKEND_PRIVATE_H_
/*
* Include necessary headers.
*/
# include <cups/cups-private.h>
# include <cups/snmp-private.h>
# include <cups/backend.h>
# include <cups/sidechannel.h>
# include <signal.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)
# include <linux/parport.h>
# include <linux/ppdev.h>
# include <unistd.h>
# include <fcntl.h>
# endif /* __linux */
# ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ioccom.h>
# include <sys/ecppsys.h>
# endif /* __sparc */
# endif /* __sun */
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* OID constants...
*/
/* Host MIB */
#define CUPS_OID_mib2 1,3,6,1,2,1
#define CUPS_OID_system CUPS_OID_mib2,1
#define CUPS_OID_sysLocation CUPS_OID_system,6
#define CUPS_OID_host CUPS_OID_mib2,25
#define CUPS_OID_hrSystem CUPS_OID_host,1
#define CUPS_OID_hrStorage CUPS_OID_host,2
#define CUPS_OID_hrDevice CUPS_OID_host,3
#define CUPS_OID_hrDeviceTable CUPS_OID_hrDevice,2
#define CUPS_OID_hrDeviceEntry CUPS_OID_hrDeviceTable,1
#define CUPS_OID_hrDeviceIndex CUPS_OID_hrDeviceEntry,1
#define CUPS_OID_hrDeviceType CUPS_OID_hrDeviceEntry,2
#define CUPS_OID_hrDeviceDescr CUPS_OID_hrDeviceEntry,3
#define CUPS_OID_hrPrinterTable CUPS_OID_hrDevice,5
#define CUPS_OID_hrPrinterEntry CUPS_OID_hrPrinterTable,1
#define CUPS_OID_hrPrinterStatus CUPS_OID_hrPrinterEntry,1
#define CUPS_OID_hrPrinterDetectedErrorState CUPS_OID_hrPrinterEntry,2
/* Printer MIB */
#define CUPS_OID_printmib CUPS_OID_mib2,43
#define CUPS_OID_prtGeneral CUPS_OID_printmib,5
#define CUPS_OID_prtGeneralTable CUPS_OID_prtGeneral,1
#define CUPS_OID_prtGeneralEntry CUPS_OID_prtGeneralTable,1
#define CUPS_OID_prtGeneralCurrentLocalization CUPS_OID_prtGeneralEntry,2
#define CUPS_OID_prtGeneralPrinterName CUPS_OID_prtGeneralEntry,16
#define CUPS_OID_prtGeneralSerialNumber CUPS_OID_prtGeneralEntry,17
#define CUPS_OID_prtCover CUPS_OID_printmib,6
#define CUPS_OID_prtCoverTable CUPS_OID_prtCover,1
#define CUPS_OID_prtCoverEntry CUPS_OID_prtCoverTable,1
#define CUPS_OID_prtCoverDescription CUPS_OID_prtCoverEntry,2
#define CUPS_OID_prtCoverStatus CUPS_OID_prtCoverEntry,3
#define CUPS_OID_prtLocalization CUPS_OID_printmib,7
#define CUPS_OID_prtLocalizationTable CUPS_OID_prtLocalization,1
#define CUPS_OID_prtLocalizationEntry CUPS_OID_prtLocalizationTable,1
#define CUPS_OID_prtLocalizationCharacterSet CUPS_OID_prtLocalizationEntry,4
#define CUPS_OID_prtMarker CUPS_OID_printmib,10
#define CUPS_OID_prtMarkerTable CUPS_OID_prtMarker,2
#define CUPS_OID_prtMarkerEntry CUPS_OID_prtMarkerTable,1
#define CUPS_OID_prtMarkerLifeCount CUPS_OID_prtMarkerEntry,4
#define CUPS_OID_prtMarkerSupplies CUPS_OID_printmib,11
#define CUPS_OID_prtMarkerSuppliesTable CUPS_OID_prtMarkerSupplies,1
#define CUPS_OID_prtMarkerSuppliesEntry CUPS_OID_prtMarkerSuppliesTable,1
#define CUPS_OID_prtMarkerSuppliesIndex CUPS_OID_prtMarkerSuppliesEntry,1
#define CUPS_OID_prtMarkerSuppliesMarkerIndex CUPS_OID_prtMarkerSuppliesEntry,2
#define CUPS_OID_prtMarkerSuppliesColorantIndex CUPS_OID_prtMarkerSuppliesEntry,3
#define CUPS_OID_prtMarkerSuppliesClass CUPS_OID_prtMarkerSuppliesEntry,4
#define CUPS_OID_prtMarkerSuppliesType CUPS_OID_prtMarkerSuppliesEntry,5
#define CUPS_OID_prtMarkerSuppliesDescription CUPS_OID_prtMarkerSuppliesEntry,6
#define CUPS_OID_prtMarkerSuppliesSupplyUnit CUPS_OID_prtMarkerSuppliesEntry,7
#define CUPS_OID_prtMarkerSuppliesMaxCapacity CUPS_OID_prtMarkerSuppliesEntry,8
#define CUPS_OID_prtMarkerSuppliesLevel CUPS_OID_prtMarkerSuppliesEntry,9
#define CUPS_OID_prtMarkerColorant CUPS_OID_printmib,12
#define CUPS_OID_prtMarkerColorantTable CUPS_OID_prtMarkerColorant,1
#define CUPS_OID_prtMarkerColorantEntry CUPS_OID_prtMarkerColorantTable,1
#define CUPS_OID_prtMarkerColorantIndex CUPS_OID_prtMarkerColorantEntry,1
#define CUPS_OID_prtMarkerColorantMarkerIndex CUPS_OID_prtMarkerColorantEntry,2
#define CUPS_OID_prtMarkerColorantRole CUPS_OID_prtMarkerColorantEntry,3
#define CUPS_OID_prtMarkerColorantValue CUPS_OID_prtMarkerColorantEntry,4
#define CUPS_OID_prtMarkerColorantTonality CUPS_OID_prtMarkerColorantEntry,5
#define CUPS_OID_prtInterpreter CUPS_OID_printmib,15
#define CUPS_OID_prtInterpreterTable CUPS_OID_prtInterpreter,1
#define CUPS_OID_prtInterpreterEntry CUPS_OID_prtInterpreterTable,1
#define CUPS_OID_prtInterpreterLangFamily CUPS_OID_prtInterpreterEntry,2
#define CUPS_OID_prtInterpreterLangLevel CUPS_OID_prtInterpreterEntry,3
/* Printer Port Monitor MIB */
#define CUPS_OID_enterprises 1,3,6,1,4,1
#define CUPS_OID_pwg CUPS_OID_enterprises,2699,1
#define CUPS_OID_ppmMIB CUPS_OID_pwg,2
#define CUPS_OID_ppmMIBObjects CUPS_OID_ppmMIB,1
#define CUPS_OID_ppmGeneral CUPS_OID_ppmMIBObjects,1
#define CUPS_OID_ppmPrinter CUPS_OID_ppmMIBObjects,2
#define CUPS_OID_ppmPrinterTable CUPS_OID_ppmPrinter,1
#define CUPS_OID_ppmPrinterEntry CUPS_OID_ppmPrinterTable,1
#define CUPS_OID_ppmPrinterIndex CUPS_OID_ppmPrinterEntry,1
#define CUPS_OID_ppmPrinterName CUPS_OID_ppmPrinterEntry,2
#define CUPS_OID_ppmPrinterIEEE1284DeviceId CUPS_OID_ppmPrinterEntry,3
#define CUPS_OID_ppmPrinterNumberOfPorts CUPS_OID_ppmPrinterEntry,4
#define CUPS_OID_ppmPrinterPreferredPortIndex CUPS_OID_ppmPrinterEntry,5
#define CUPS_OID_ppmPrinterHrDeviceIndex CUPS_OID_ppmPrinterEntry,6
#define CUPS_OID_ppmPrinterSnmpCommunityName CUPS_OID_ppmPrinterEntry,7
#define CUPS_OID_ppmPrinterSnmpQueryEnabled CUPS_OID_ppmPrinterEntry,8
#define CUPS_OID_ppmPort CUPS_OID_ppmMIBObjects,3
#define CUPS_OID_ppmPortTable CUPS_OID_ppmPort,1
#define CUPS_OID_ppmPortEntry CUPS_OID_ppmPortTable,1
#define CUPS_OID_ppmPortIndex CUPS_OID_ppmPortEntry,1
#define CUPS_OID_ppmPortEnabled CUPS_OID_ppmPortEntry,2
#define CUPS_OID_ppmPortName CUPS_OID_ppmPortEntry,3
#define CUPS_OID_ppmPortServiceNameOrURI CUPS_OID_ppmPortEntry,4
#define CUPS_OID_ppmPortProtocolType CUPS_OID_ppmPortEntry,5
#define CUPS_OID_ppmPortProtocolTargetPort CUPS_OID_ppmPortEntry,6
#define CUPS_OID_ppmPortProtocolAltSourceEnabled CUPS_OID_ppmPortEntry,7
#define CUPS_OID_ppmPortPrtChannelIndex CUPS_OID_ppmPortEntry,8
#define CUPS_OID_ppmPortLprByteCountEnabled CUPS_OID_ppmPortEntry,9
/*
* State constants...
*/
#define CUPS_TC_other 1
#define CUPS_TC_unknown 2
#define CUPS_TC_idle 3
#define CUPS_TC_printing 4
#define CUPS_TC_warmup 5
/* These come from the hrPrinterDetectedErrorState OCTET-STRING */
#define CUPS_TC_lowPaper 0x8000
#define CUPS_TC_noPaper 0x4000
#define CUPS_TC_lowToner 0x2000
#define CUPS_TC_noToner 0x1000
#define CUPS_TC_doorOpen 0x0800
#define CUPS_TC_jammed 0x0400
#define CUPS_TC_offline 0x0200
#define CUPS_TC_serviceRequested 0x0100
#define CUPS_TC_inputTrayMissing 0x0080
#define CUPS_TC_outputTrayMissing 0x0040
#define CUPS_TC_markerSupplyMissing 0x0020
#define CUPS_TC_outputNearFull 0x0010
#define CUPS_TC_outputFull 0x0008
#define CUPS_TC_inputTrayEmpty 0x0004
#define CUPS_TC_overduePreventMaint 0x0002
#define CUPS_TC_prtCoverStatus_coverOpen 3
#define CUPS_TC_prtCoverStatus_coverClosed 4
#define CUPS_TC_prtCoverStatus_interlockOpen 5
#define CUPS_TC_prtCoverStatus_interlockClosed 6
#define CUPS_TC_langPCL 3
#define CUPS_TC_langHPGL 4
#define CUPS_TC_langPJL 5
#define CUPS_TC_langPS 6
#define CUPS_TC_langEscapeP 9
#define CUPS_TC_langCCITT 26
#define CUPS_TC_langLIPS 39
#define CUPS_TC_langTIFF 40
#define CUPS_TC_langPCLXL 47
#define CUPS_TC_langPDF 54
#define CUPS_TC_langJPEG 61
#define CUPS_TC_supplyThatIsConsumed 3
#define CUPS_TC_receptacleThatIsFilled 4
#define CUPS_TC_process 3
#define CUPS_TC_spot 4
#define CUPS_TC_toner 3
#define CUPS_TC_wasteToner 4
#define CUPS_TC_ink 5
#define CUPS_TC_inkCartridge 6
#define CUPS_TC_inkRibbon 7
#define CUPS_TC_wasteInk 8
#define CUPS_TC_opc 9
#define CUPS_TC_developer 10
#define CUPS_TC_fuserOil 11
#define CUPS_TC_solidWax 12
#define CUPS_TC_ribbonWax 13
#define CUPS_TC_wasteWax 14
#define CUPS_TC_fuser 15
#define CUPS_TC_coronaWire 16
#define CUPS_TC_fuserOilWick 17
#define CUPS_TC_cleanerUnit 18
#define CUPS_TC_fuserCleaningPad 19
#define CUPS_TC_transferUnit 20
#define CUPS_TC_tonerCartridge 21
#define CUPS_TC_fuserOiler 22
#define CUPS_TC_water 23
#define CUPS_TC_wasteWater 24
#define CUPS_TC_glueWaterAdditive 25
#define CUPS_TC_wastePaper 26
#define CUPS_TC_bindingSupply 27
#define CUPS_TC_bandingSupply 28
#define CUPS_TC_stitchingWire 29
#define CUPS_TC_shrinkWrap 30
#define CUPS_TC_paperWrap 31
#define CUPS_TC_staples 32
#define CUPS_TC_inserts 33
#define CUPS_TC_covers 34
#define CUPS_TC_tenThousandthsOfInches 3
#define CUPS_TC_micrometers 4
#define CUPS_TC_impressions 7
#define CUPS_TC_sheets 8
#define CUPS_TC_hours 11
#define CUPS_TC_thousandthsOfOunces 12
#define CUPS_TC_tenthsOfGrams 13
#define CUPS_TC_hundrethsOfFluidOunces 14
#define CUPS_TC_tenthsOfMilliliters 15
#define CUPS_TC_feet 16
#define CUPS_TC_meters 17
#define CUPS_TC_items 18
#define CUPS_TC_percent 19
/* These come from RFC 3808 to define character sets we support */
/* Also see http://www.iana.org/assignments/character-sets */
#define CUPS_TC_csASCII 3
#define CUPS_TC_csISOLatin1 4
#define CUPS_TC_csShiftJIS 17
#define CUPS_TC_csUTF8 106
#define CUPS_TC_csUnicode 1000 /* UCS2 BE */
#define CUPS_TC_csUCS4 1001 /* UCS4 BE */
#define CUPS_TC_csUnicodeASCII 1002
#define CUPS_TC_csUnicodeLatin1 1003
#define CUPS_TC_csUTF16BE 1013
#define CUPS_TC_csUTF16LE 1014
#define CUPS_TC_csUTF32 1017
#define CUPS_TC_csUTF32BE 1018
#define CUPS_TC_csUTF32LE 1019
#define CUPS_TC_csWindows31J 2024
/*
* Types...
*/
typedef int (*_cups_sccb_t)(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
/*
* Prototypes...
*/
extern void backendCheckSideChannel(int snmp_fd, http_addr_t *addr);
extern int backendDrainOutput(int print_fd, int device_fd);
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,
size_t make_model_size);
extern http_addrlist_t *backendLookup(const char *hostname, int port, int *cancel);
extern int backendNetworkSideCB(int print_fd, int device_fd,
int snmp_fd, http_addr_t *addr,
int use_bc);
extern ssize_t backendRunLoop(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc,
int update_state, _cups_sccb_t side_cb);
extern int backendSNMPSupplies(int snmp_fd, http_addr_t *addr,
int *page_count,
int *printer_state);
extern int backendWaitLoop(int snmp_fd, http_addr_t *addr,
int use_bc, _cups_sccb_t side_cb);
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_BACKEND_PRIVATE_H_ */
+85
Ver Arquivo
@@ -0,0 +1,85 @@
/*
* "$Id$"
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2001 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Run the named backend.
*/
/*
* Include necessary headers.
*/
#include <stdio.h>
#include <stdlib.h>
#include <cups/string.h>
#include <unistd.h>
/*
* 'main()' - Run the named backend.
*
* Usage:
*
* betest device-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (7 or 8) */
char *argv[]) /* I - Command-line arguments */
{
char backend[255]; /* Method in URI */
if (argc < 7 || argc > 8)
{
fputs("Usage: betest device-uri job-id user title copies options [file]\n",
stderr);
return (1);
}
/*
* Extract the method from the device-uri - that's the program we want to
* execute.
*/
if (sscanf(argv[1], "%254[^:]", backend) != 1)
{
fputs("betest: Bad device-uri - no colon!\n", stderr);
return (1);
}
/*
* Execute and return
*/
execl(backend, argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7],
NULL);
return (1);
}
/*
* End of "$Id$".
*/
-1289
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-445
Ver Arquivo
@@ -1,445 +0,0 @@
/*
* IEEE-1284 support functions for CUPS.
*
* Copyright © 2007-2015 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#include <cups/ppd-private.h>
/*
* '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 */
{
#ifdef __APPLE__ /* This function is a no-op */
(void)fd;
(void)device_id;
(void)device_id_size;
(void)make_model;
(void)make_model_size;
(void)scheme;
(void)uri;
(void)uri_size;
return (-1);
#else /* Get the device ID from the specified file descriptor... */
# ifdef __linux
int length; /* Length of device ID info */
int got_id = 0;
# endif /* __linux */
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
struct ecpp_device_id did; /* Device ID buffer */
# endif /* __sun && ECPPIOC_GETDEVID */
char *ptr; /* Pointer into device ID */
/*
* Range check input...
*/
if (!device_id || device_id_size < 32)
{
return (-1);
}
if (make_model)
*make_model = '\0';
if (fd >= 0)
{
/*
* Get the device ID string...
*/
*device_id = '\0';
# ifdef __linux
if (ioctl(fd, LPIOC_GET_DEVICE_ID((unsigned)device_id_size), device_id))
{
/*
* Linux has to implement things differently for every device it seems.
* Since the standard parallel port driver does not provide a simple
* ioctl() to get the 1284 device ID, we have to open the "raw" parallel
* device corresponding to this port and do some negotiation trickery
* to get the current device ID.
*/
if (uri && !strncmp(uri, "parallel:/dev/", 14))
{
char devparport[16]; /* /dev/parportN */
int devparportfd, /* File descriptor for raw device */
mode; /* Port mode */
/*
* Since the Linux parallel backend only supports 4 parallel port
* devices, just grab the trailing digit and use it to construct a
* /dev/parportN filename...
*/
snprintf(devparport, sizeof(devparport), "/dev/parport%s",
uri + strlen(uri) - 1);
if ((devparportfd = open(devparport, O_RDWR | O_NOCTTY)) != -1)
{
/*
* Claim the device...
*/
if (!ioctl(devparportfd, PPCLAIM))
{
fcntl(devparportfd, F_SETFL, fcntl(devparportfd, F_GETFL) | O_NONBLOCK);
mode = IEEE1284_MODE_COMPAT;
if (!ioctl(devparportfd, PPNEGOT, &mode))
{
/*
* Put the device into Device ID mode...
*/
mode = IEEE1284_MODE_NIBBLE | IEEE1284_DEVICEID;
if (!ioctl(devparportfd, PPNEGOT, &mode))
{
/*
* Read the 1284 device ID...
*/
if ((length = read(devparportfd, device_id, (size_t)device_id_size - 1)) >= 2)
{
device_id[length] = '\0';
got_id = 1;
}
}
}
/*
* Release the device...
*/
ioctl(devparportfd, PPRELEASE);
}
close(devparportfd);
}
}
}
else
got_id = 1;
if (got_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 = (int)((((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 || length < 14)
length = (int)((((unsigned)device_id[1] & 255) << 8) + ((unsigned)device_id[0] & 255));
if (length > device_id_size)
length = device_id_size;
/*
* The length field counts the number of bytes in the string
* including the length field itself (2 bytes). The minimum
* length for a valid/usable device ID is 14 bytes:
*
* <LENGTH> MFG: <MFG> ;MDL: <MDL> ;
* 2 + 4 + 1 + 5 + 1 + 1
*/
if (length < 14)
{
/*
* Can't use this device ID, so don't try to copy it...
*/
device_id[0] = '\0';
got_id = 0;
}
else
{
/*
* Copy the device ID text to the beginning of the buffer and
* nul-terminate.
*/
length -= 2;
memmove(device_id, device_id + 2, (size_t)length);
device_id[length] = '\0';
}
}
else
{
*device_id = '\0';
}
# 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';
}
# endif /* __sun && ECPPIOC_GETDEVID */
}
/*
* Check whether device ID is valid. Turn line breaks and tabs to spaces and
* reject device IDs with non-printable characters.
*/
for (ptr = device_id; *ptr; ptr ++)
if (_cups_isspace(*ptr))
*ptr = ' ';
else if ((*ptr & 255) < ' ' || *ptr == 127)
{
*device_id = '\0';
break;
}
if (scheme && uri)
*uri = '\0';
if (!*device_id)
return (-1);
/*
* Get the make and model...
*/
if (make_model)
backendGetMakeModel(device_id, make_model, (size_t)make_model_size);
/*
* Then generate a device URI...
*/
if (scheme && uri && uri_size > 32)
{
int num_values; /* Number of keys and values */
cups_option_t *values; /* Keys and values in device ID */
const char *mfg, /* Manufacturer */
*mdl, /* Model */
*sern; /* Serial number */
char temp[256], /* Temporary manufacturer string */
*tempptr; /* Pointer into temp string */
/*
* Get the make, model, and serial numbers...
*/
num_values = _cupsGet1284Values(device_id, &values);
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
sern = cupsGetOption("SN", num_values, values);
if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
mfg = cupsGetOption("MFG", num_values, values);
if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
mdl = cupsGetOption("MDL", num_values, values);
if (mfg)
{
if (!_cups_strcasecmp(mfg, "Hewlett-Packard"))
mfg = "HP";
else if (!_cups_strcasecmp(mfg, "Lexmark International"))
mfg = "Lexmark";
}
else
{
strlcpy(temp, make_model, sizeof(temp));
if ((tempptr = strchr(temp, ' ')) != NULL)
*tempptr = '\0';
mfg = temp;
}
if (!mdl)
mdl = "";
if (!_cups_strncasecmp(mdl, mfg, strlen(mfg)))
{
mdl += strlen(mfg);
while (isspace(*mdl & 255))
mdl ++;
}
/*
* Generate the device URI from the manufacturer, make_model, and
* serial number strings.
*/
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, scheme, NULL, mfg, 0,
"/%s%s%s", mdl, sern ? "?serial=" : "", sern ? sern : "");
cupsFreeOptions(num_values, values);
}
return (0);
#endif /* __APPLE__ */
}
/*
* '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 */
size_t make_model_size) /* I - Size of buffer */
{
int num_values; /* Number of keys and values */
cups_option_t *values; /* Keys and values */
const char *mfg, /* Manufacturer string */
*mdl, /* Model string */
*des; /* Description string */
/*
* Range check input...
*/
if (!device_id || !*device_id || !make_model || make_model_size < 32)
return (-1);
*make_model = '\0';
/*
* Look for the description field...
*/
num_values = _cupsGet1284Values(device_id, &values);
if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
mdl = cupsGetOption("MDL", num_values, values);
if (mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
mfg = cupsGetOption("MFG", num_values, values);
if (!mfg || !_cups_strncasecmp(mdl, mfg, strlen(mfg)))
{
/*
* Just copy the model string, since it has the manufacturer...
*/
_ppdNormalizeMakeAndModel(mdl, make_model, make_model_size);
}
else
{
/*
* Concatenate the make and model...
*/
char temp[1024]; /* Temporary make and model */
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
_ppdNormalizeMakeAndModel(temp, make_model, make_model_size);
}
}
else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL ||
(des = cupsGetOption("DES", num_values, values)) != NULL)
{
/*
* 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 (strlen(des) >= 8)
{
const char *ptr; /* Pointer into description */
int letters, /* Number of letters seen */
spaces; /* Number of spaces seen */
for (ptr = des, letters = 0, spaces = 0; *ptr; ptr ++)
{
if (isspace(*ptr & 255))
spaces ++;
else if (isalpha(*ptr & 255))
letters ++;
if (spaces && letters)
break;
}
if (spaces && letters)
_ppdNormalizeMakeAndModel(des, make_model, make_model_size);
}
}
if (!make_model[0])
{
/*
* Use "Unknown" as the printer make and model...
*/
strlcpy(make_model, "Unknown", make_model_size);
}
cupsFreeOptions(num_values, values);
return (0);
}
+466 -3403
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+315 -1062
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-354
Ver Arquivo
@@ -1,354 +0,0 @@
/*
* Common backend network APIs for CUPS.
*
* Copyright © 2007-2016 by Apple Inc.
* Copyright © 2006-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#include <limits.h>
#include <sys/select.h>
/*
* 'backendCheckSideChannel()' - Check the side-channel for pending requests.
*/
void
backendCheckSideChannel(
int snmp_fd, /* I - SNMP socket */
http_addr_t *addr) /* I - Address of device */
{
fd_set input; /* Select input set */
struct timeval timeout; /* Select timeout */
FD_ZERO(&input);
FD_SET(CUPS_SC_FD, &input);
timeout.tv_sec = timeout.tv_usec = 0;
if (select(CUPS_SC_FD + 1, &input, NULL, NULL, &timeout) > 0)
backendNetworkSideCB(-1, -1, snmp_fd, addr, 0);
}
/*
* 'backendLookup()' - Lookup the given host and log addresses.
*/
http_addrlist_t * /* O - List of addresses or NULL */
backendLookup(const char *hostname, /* I - Hostname */
int port, /* I - Port number */
int *cancel) /* I - Variable to watch for job cancel */
{
char portname[32], /* Port number as string */
addrname[256]; /* Address as string */
http_addrlist_t *addrlist, /* List of addresses */
*current; /* Current address */
/*
* Lookup the address for the named host...
*/
snprintf(portname, sizeof(portname), "%d", port);
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
while ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
{
_cupsLangPrintFilter(stderr, "INFO", _("Unable to locate printer \"%s\"."), hostname);
sleep(10);
if (getenv("CLASS") != NULL)
{
fputs("STATE: -connecting-to-device\n", stderr);
exit(CUPS_BACKEND_STOP);
}
if (cancel && *cancel)
{
fputs("STATE: -connecting-to-device\n", stderr);
exit(CUPS_BACKEND_OK);
}
}
fputs("STATE: -connecting-to-device\n", stderr);
/*
* Log the addresses we got...
*/
for (current = addrlist; current; current = current->next)
fprintf(stderr, "DEBUG: %s=%s\n", hostname, httpAddrString(&current->addr, addrname, sizeof(addrname)));
/*
* Return...
*/
return (addrlist);
}
/*
* 'backendNetworkSideCB()' - Handle common network side-channel commands.
*/
int /* O - -1 on error, 0 on success */
backendNetworkSideCB(
int print_fd, /* I - Print file or -1 */
int device_fd, /* I - Device file or -1 */
int snmp_fd, /* I - SNMP socket */
http_addr_t *addr, /* I - Address of device */
int use_bc) /* I - Use back-channel data? */
{
cups_sc_command_t command; /* Request command */
cups_sc_status_t status; /* Request/response status */
char data[65536]; /* Request/response data */
int datalen; /* Request/response data size */
const char *device_id; /* 1284DEVICEID env var */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
return (-1);
switch (command)
{
case CUPS_SC_CMD_DRAIN_OUTPUT :
/*
* Our sockets disable the Nagle algorithm and data is sent immediately.
*/
if (device_fd < 0)
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
else if (backendDrainOutput(print_fd, device_fd))
status = CUPS_SC_STATUS_IO_ERROR;
else
status = CUPS_SC_STATUS_OK;
datalen = 0;
break;
case CUPS_SC_CMD_GET_BIDI :
status = CUPS_SC_STATUS_OK;
data[0] = (char)use_bc;
datalen = 1;
break;
case CUPS_SC_CMD_SNMP_GET :
case CUPS_SC_CMD_SNMP_GET_NEXT :
fprintf(stderr, "DEBUG: CUPS_SC_CMD_SNMP_%s: %d (%s)\n",
command == CUPS_SC_CMD_SNMP_GET ? "GET" : "GET_NEXT", datalen,
data);
if (datalen < 2)
{
status = CUPS_SC_STATUS_BAD_MESSAGE;
datalen = 0;
break;
}
if (snmp_fd >= 0)
{
char *dataptr; /* Pointer into data */
cups_snmp_t packet; /* Packet from printer */
const char *snmp_value; /* CUPS_SNMP_VALUE env var */
if ((snmp_value = getenv("CUPS_SNMP_VALUE")) != NULL)
{
const char *snmp_count; /* CUPS_SNMP_COUNT env var */
int count; /* Repetition count */
if ((snmp_count = getenv("CUPS_SNMP_COUNT")) != NULL)
{
if ((count = atoi(snmp_count)) <= 0)
count = 1;
}
else
count = 1;
for (dataptr = data + strlen(data) + 1;
count > 0 && dataptr < (data + sizeof(data) - 1);
count --, dataptr += strlen(dataptr))
strlcpy(dataptr, snmp_value, sizeof(data) - (size_t)(dataptr - data));
fprintf(stderr, "DEBUG: Returning %s %s\n", data,
data + strlen(data) + 1);
status = CUPS_SC_STATUS_OK;
datalen = (int)(dataptr - data);
break;
}
if (!_cupsSNMPStringToOID(data, packet.object_name, CUPS_SNMP_MAX_OID))
{
status = CUPS_SC_STATUS_BAD_MESSAGE;
datalen = 0;
break;
}
status = CUPS_SC_STATUS_IO_ERROR;
datalen = 0;
if (_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(),
command == CUPS_SC_CMD_SNMP_GET ?
CUPS_ASN1_GET_REQUEST :
CUPS_ASN1_GET_NEXT_REQUEST, 1,
packet.object_name))
{
if (_cupsSNMPRead(snmp_fd, &packet, 1.0))
{
size_t i; /* Looping var */
if (!_cupsSNMPOIDToString(packet.object_name, data, sizeof(data)))
{
fputs("DEBUG: Bad OID returned!\n", stderr);
break;
}
datalen = (int)strlen(data) + 1;
dataptr = data + datalen;
switch (packet.object_type)
{
case CUPS_ASN1_BOOLEAN :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%d", packet.object_value.boolean);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_INTEGER :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%d",
packet.object_value.integer);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_BIT_STRING :
case CUPS_ASN1_OCTET_STRING :
if (packet.object_value.string.num_bytes < (sizeof(data) - (size_t)(dataptr - data)))
i = packet.object_value.string.num_bytes;
else
i = sizeof(data) - (size_t)(dataptr - data);
memcpy(dataptr, packet.object_value.string.bytes, i);
datalen += (int)i;
break;
case CUPS_ASN1_OID :
_cupsSNMPOIDToString(packet.object_value.oid, dataptr,
sizeof(data) - (size_t)(dataptr - data));
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_HEX_STRING :
for (i = 0;
i < packet.object_value.string.num_bytes &&
dataptr < (data + sizeof(data) - 3);
i ++, dataptr += 2)
sprintf(dataptr, "%02X", packet.object_value.string.bytes[i]);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_COUNTER :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%u", packet.object_value.counter);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_GAUGE :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%u", packet.object_value.gauge);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_TIMETICKS :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%u", packet.object_value.timeticks);
datalen += (int)strlen(dataptr);
break;
default :
fprintf(stderr, "DEBUG: Unknown OID value type %02X.\n", packet.object_type);
case CUPS_ASN1_NULL_VALUE :
dataptr[0] = '\0';
break;
}
fprintf(stderr, "DEBUG: Returning %s %s\n", data, data + datalen);
status = CUPS_SC_STATUS_OK;
}
else
fputs("DEBUG: SNMP read error...\n", stderr);
}
else
fputs("DEBUG: SNMP write error...\n", stderr);
break;
}
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
break;
case CUPS_SC_CMD_GET_CONNECTED :
status = CUPS_SC_STATUS_OK;
data[0] = device_fd != -1;
datalen = 1;
break;
case CUPS_SC_CMD_GET_DEVICE_ID :
if (snmp_fd >= 0)
{
cups_snmp_t packet; /* Packet from printer */
static const int ppmPrinterIEEE1284DeviceId[] =
{ CUPS_OID_ppmPrinterIEEE1284DeviceId,1,-1 };
status = CUPS_SC_STATUS_IO_ERROR;
datalen = 0;
if (_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(),
CUPS_ASN1_GET_REQUEST, 1,
ppmPrinterIEEE1284DeviceId))
{
if (_cupsSNMPRead(snmp_fd, &packet, 1.0) &&
packet.object_type == CUPS_ASN1_OCTET_STRING)
{
strlcpy(data, (char *)packet.object_value.string.bytes,
sizeof(data));
datalen = (int)strlen(data);
status = CUPS_SC_STATUS_OK;
}
}
break;
}
if ((device_id = getenv("1284DEVICEID")) != NULL)
{
strlcpy(data, device_id, sizeof(data));
datalen = (int)strlen(data);
status = CUPS_SC_STATUS_OK;
break;
}
default :
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
break;
}
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
-304
Ver Arquivo
@@ -1,304 +0,0 @@
# USB backend 'quirks' file.
#
# This file lists known issues with various vendors or printers. Each
# line contains either a comment (starting with #) or the USB vendor ID,
# product ID (omit for all vendor products), and a list of known issues:
#
# blacklist The printer is not functional with the USB backend.
# delay-close Delay close/reset of selected interface
# no-reattach Do no re-attach usblp kernel module after printing.
# soft-reset Do a soft reset after printing for cleanup.
# unidir Only supports unidirectional I/O
# usb-init Needs vendor USB initialization string.
# vendor-class Uses vendor-specific class or subclass.
# whitelist The printer is functional with the USB backend.
#
# To get the USB vendor and product IDs for a given printer, run the "lsusb"
# command, which will show something like the following:
#
# Bus 002 Device 003: ID ab21:34dc Acme Example Printer
#
# The "ab21:34dc" is the vendor and product ID, separated by a colon.
# HP DeskJet 895C
0x03f0 0x0004 unidir
# HP DeskJet 880C
0x03f0 0x0104 unidir
# HP DeskJet 815C
0x03f0 0x0204 unidir
# HP DeskJet 810C/812C
0x03f0 0x0304 unidir
# HP DeskJet 830C
0x03f0 0x0404 unidir
# HP DeskJet 885C
0x03f0 0x0504 unidir
# HP DeskJet 840C
0x03f0 0x0604 unidir
# HP DeskJet 816C
0x03f0 0x0804 unidir
# HP Deskjet 959C
0x03f0 0x1104 unidir
# NEC Picty900 (HP OEM)
0x0409 0xefbe unidir
# NEC Picty760 (HP OEM)
0x0409 0xbef4 unidir
# NEC Picty920 (HP OEM)
0x0409 0xf0be unidir
# NEC Picty800 (HP OEM)
0x0409 0xf1be unidir
# Lexmark International, Inc. (e250d) (https://bugs.launchpad.net/bugs/1084164)
0x043d 0x00f3 no-reattach
# Kyocera Mita FS 820, by zut <kernel@zut.de>
0x0482 0x0010 unidir
# Canon, Inc. PIXMA iP6000D Printer (https://bugs.launchpad.net/bugs/1160638)
0x04a9 0x1095 unidir
# Canon, Inc. PIXMA iP4200 Printer (Issue #4155)
0x04a9 0x10a2 unidir
# Canon, Inc. PIXMA iP4300 Printer (https://bugs.launchpad.net/bugs/1032385)
0x04a9 0x10b6 unidir
# Canon, Inc. MP210 (https://bugzilla.redhat.com/show_bug.cgi?id=847923#c53)
0x04a9 0x1721 unidir
# Canon, Inc. MP500 Printer (https://bugs.launchpad.net/bugs/1032456)
0x04a9 0x170c unidir
# Canon, Inc. MP510 Printer (https://bugs.launchpad.net/bugs/1050009)
0x04a9 0x1717 unidir
# Canon, Inc. MP540 Printer, https://bugzilla.redhat.com/967873
0x04a9 0x1730 unidir
# Canon, Inc. MP550 Printer (Issue #4155)
0x04a9 0x173d unidir
# Canon, Inc. MP560 Printer (Issue #4155)
0x04a9 0x173e unidir
# Canon, Inc. MF4150 Printer (https://bugs.launchpad.net/bugs/1160638)
0x04a9 0x26a3 no-reattach
# Brother Industries, Ltd HL-1250 Laser Printer (https://bugs.debian.org/712512)
0x04f9 0x0007 no-reattach
# Brother Industries, Ltd HL-1430 Laser Printer (https://bugs.launchpad.net/bugs/1038695)
0x04f9 0x001a no-reattach
# Brother Industries, Ltd HL-1440 Laser Printer (https://bugs.launchpad.net/bugs/1000253)
0x04f9 0x000d no-reattach unidir
# Brother Industries, Ltd HL-1450 Laser Printer (https://bugs.launchpad.net/bugs/1000253)
0x04f9 0x000e no-reattach unidir
# Oki Data Corp. Okipage 14ex Printer (https://bugs.launchpad.net/bugs/872483)
0x06bc 0x000b no-reattach
# Oki Data Corp. B410d (https://bugs.launchpad.net/bugs/872483)
0x06bc 0x01c7 no-reattach
# Seiko Epson Corp. Stylus Color 740 / Photo 750 (http://bugs.debian.org/697970)
0x04b8 0x0001 no-reattach unidir
# Seiko Epson Corp. Stylus Color 670 (https://bugs.launchpad.net/bugs/872483)
0x04b8 0x0005 no-reattach
# Seiko Epson Receipt Printer M129C
0x04b8 0x0202 vendor-class
# Prolific Technology, Inc. PL2305 Parallel Port (USB -> Parallel adapter) (https://bugs.launchpad.net/bugs/987485)
0x067b 0x2305 no-reattach soft-reset unidir
# Xerox Phaser 3124 https://bugzilla.redhat.com/show_bug.cgi?id=867392
0x0924 0x3ce9 no-reattach
# Xerox WorkCentre 3210 https://bugs.launchpad.net/bugs/1102470
0x0924 0x4293 no-reattach
# QinHeng Electronics CH340S (USB -> Parallel adapter) (https://bugs.launchpad.net/bugs/1000253)
0x1a86 0x7584 no-reattach
# All Samsung devices (https://bugs.launchpad.net/bugs/1032456)
0x04e8 soft-reset
# Samsung ML-2160 Series (https://bugzilla.redhat.com/show_bug.cgi?id=873123)
0x04e8 0x330f unidir
# All Zebra devices (https://bugs.launchpad.net/bugs/1001028) (Issue #5395)
0x0a5f unidir no-reattach
# Canon CP-10
0x04a9 0x304a blacklist
# Canon CP-100
0x04a9 0x3063 blacklist
# Canon CP-200
0x04a9 0x307c blacklist
# Canon CP-300
0x04a9 0x307d blacklist
# Canon CP-220
0x04a9 0x30bd blacklist
# Canon CP-330
0x04a9 0x30be blacklist
# Canon SELPHY CP400
0x04a9 0x30f6 blacklist
# Canon SELPHY CP600
0x04a9 0x310b blacklist
# Canon SELPHY CP710
0x04a9 0x3127 blacklist
# Canon SELPHY CP510
0x04a9 0x3128 blacklist
# Canon SELPHY ES1
0x04a9 0x3141 blacklist
# Canon SELPHY CP730
0x04a9 0x3142 blacklist
# Canon SELPHY CP720
0x04a9 0x3143 blacklist
# Canon SELPHY CP750
0x04a9 0x3170 blacklist
# Canon SELPHY CP740
0x04a9 0x3171 blacklist
# Canon SELPHY ES2
0x04a9 0x3185 blacklist
# Canon SELPHY ES20
0x04a9 0x3186 blacklist
# Canon SELPHY CP770
0x04a9 0x31aa blacklist
# Canon SELPHY CP760
0x04a9 0x31ab blacklist
# Canon SELPHY ES30
0x04a9 0x31b0 blacklist
# Canon SELPHY CP780
0x04a9 0x31dd blacklist
# Canon SELPHY ES40
0x04a9 0x31ee blacklist
# Canon SELPHY CP800
0x04a9 0x3214 blacklist
# Canon SELPHY CP900
0x04a9 0x3255 blacklist
# Canon SELPHY CP810
0x04a9 0x3256 blacklist
# Canon SELPHY CP500
0x04a9 0x30f5 blacklist
# Canon SELPHY ES3
0x04a9 0x31af blacklist
# Canon SELPHY CP780
0x04a9 0x31dd blacklist
# Lexmark E238 (<rdar://problem/14493054>)
0x043d 0x00d7 no-reattach
# Lexmark E238 (Issue #4448)
0x043d 0x009a no-reattach
# Canon MX310 (Issue #4482)
0x04a9 0x1728 unidir
# Canon MX320 (Issue #4482)
0x04A9 0x1736 unidir
# All Intermec devices (Issue #4553)
0x067e no-reattach
# HP LaserJet 1015 (Issue #5617)
0x03f0 0x0e17 delay-close
# HP LaserJet 1150 (Issue #4549)
0x03f0 0x0f17 delay-close
# HP LaserJet 1300 (Issue #4549)
0x03f0 0x1017 delay-close
0x03f0 0x1117 delay-close
# HP LaserJet 1320 (Issue #4549)
0x03f0 0x1d17 delay-close
# Canon, Inc. MP530 Printer
0x04a9 0x1712 unidir
# Xerox WorkCentre 3220 (https://bugs.launchpad.net/bugs/1406203, Issue #4789)
0x0924 0x4294 no-reattach
# Lexmark C540n (Issue #4778)
0x043d 0x0139 no-reattach
# Kyocera Ecosys P6026cdn (Issue #4900)
0x0482 0x063f no-reattach
# Kyocera Ecosys P6130cdn (Issue #5102)
0x0482 0x0677 no-reattach
# Lexmark E260dn (Issue #4994)
0x043d 0x0123 no-reattach
# HP LaserJet 1160 (Issue #5121)
0x03f0 0x1e17 delay-close
# Canon, Inc. MP280 series (Issue #5221)
0x04a9 0x1746 unidir
# Star Micronics printers (Issue #5251)
0x0519 unidir
# Lexmark Optra E310 (Issue #5259)
0x043d 0x000c no-reattach
# HP LaserJet P1102 (Issue #5310)
0x03F0 0x002A no-reattach
# Lexmark MS317dn
0x043d 0x0226 no-reattach
# Star TSP743 (Issue #5443)
0x0519 0x0001 delay-close
# Lexmark E120n (Issue #5478)
0x043d 0x00cc no-reattach
# All Xerox printers (Issue #5523)
0x0924 no-reattach
# Dymo 450 Turbo (Issue #5521)
0x0922 0x0021 unidir
+599
Ver Arquivo
@@ -0,0 +1,599 @@
/*
* "$Id$"
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2001 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Send a file to the specified parallel port.
* list_devices() - List all parallel devices.
*/
/*
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
#endif /* WIN32 || __EMX__ */
#ifdef __sgi
# include <invent.h>
# ifndef INV_EPP_ECP_PLP
# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */
# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */
# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */
# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */
# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */
# endif /* !INV_EPP_ECP_PLP */
#endif /* __sgi */
/*
* Local functions...
*/
void list_devices(void);
/*
* 'main()' - Send a file to the specified parallel port.
*
* 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) */
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 */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: parallel 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]);
}
/*
* Extract the device name and options from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
/*
* See if there are any options...
*/
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
}
/*
* Open the parallel port device...
*/
do
{
if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
perror("ERROR: Unable to open parallel port device file");
return (1);
}
}
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page...
*/
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Finally, send the print file...
*/
while (copies > 0)
{
copies --;
if (fp != 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);
}
}
/*
* Close the socket connection and input file and return...
*/
close(fd);
if (fp != stdin)
fclose(fp);
return (0);
}
/*
* 'list_devices()' - List all parallel devices.
*/
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 */
probefile[255]; /* Probe 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 */
for (i = 0; i < 4; i ++)
{
/*
* First open the device to make sure the driver module is loaded...
*/
sprintf(device, "/dev/lp%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
close(fd);
else
{
sprintf(device, "/dev/par%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
close(fd);
}
/*
* Then try looking at the probe file...
*/
sprintf(probefile, "/proc/parport/%d/autoprobe", i);
if ((probe = fopen(probefile, "r")) == NULL)
{
/*
* Linux 2.4 kernel has different path...
*/
sprintf(probefile, "/proc/sys/dev/parport/parport%d/autoprobe", i);
probe = fopen(probefile, "r");
}
if (probe != NULL)
{
/*
* Found a probe file!
*/
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
strcpy(model, "Unknown");
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);
else
printf("direct parallel:/dev/lp%d \"%s\" \"Parallel Port #%d\"\n",
i, model, i + 1);
}
else if (fd >= 0)
{
/*
* No probe file, but we know the port is there...
*/
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
}
#elif defined(__sgi)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
inventory_t *inv; /* Hardware inventory info */
/*
* IRIX maintains a hardware inventory of most devices...
*/
setinvent();
while ((inv = getinvent()) != NULL)
{
if (inv->inv_class == INV_PARALLEL &&
(inv->inv_type == INV_ONBOARD_PLP ||
inv->inv_type == INV_EPP_ECP_PLP))
{
/*
* Standard parallel port...
*/
puts("direct parallel:/dev/plp \"Unknown\" \"Onboard Parallel Port\"");
}
else if (inv->inv_class == INV_PARALLEL &&
inv->inv_type == INV_EPC_PLP)
{
/*
* EPC parallel port...
*/
printf("direct parallel:/dev/plp%d \"Unknown\" \"Integral EPC parallel port, Ebus slot %d\"\n",
inv->inv_controller, inv->inv_controller);
}
}
endinvent();
/*
* Central Data makes serial and parallel "servers" that can be
* connected in a number of ways. Look for ports...
*/
for (i = 0; i < 10; i ++)
for (j = 0; j < 8; j ++)
for (n = 0; n < 32; n ++)
{
if (i == 8) /* EtherLite */
sprintf(device, "/dev/lpn%d%c", j, funky_hex[n]);
else if (i == 9) /* PCI */
sprintf(device, "/dev/lpp%d%c", j, funky_hex[n]);
else /* SCSI */
sprintf(device, "/dev/lp%d%d%c", i, j, funky_hex[n]);
if (access(device, 0) == 0)
{
if (i == 8)
printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
device, j, n);
else if (i == 9)
printf("direct parallel:%s \"Unknown\" \"Central Data PCI Parallel Port, ID %d, port %d\"\n",
device, j, n);
else
printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
device, i, j, n);
}
}
#elif defined(__sun)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
/*
* Standard parallel ports...
*/
for (i = 0; i < 10; i ++)
{
sprintf(device, "/dev/ecpp%d", i);
if (access(device, 0) == 0)
printf("direct parallel:%s \"Unknown\" \"Sun IEEE-1284 Parallel Port #%d\"\n",
device, i + 1);
}
for (i = 0; i < 10; i ++)
{
sprintf(device, "/dev/bpp%d", i);
if (access(device, 0) == 0)
printf("direct parallel:%s \"Unknown\" \"Sun Standard Parallel Port #%d\"\n",
device, i + 1);
}
for (i = 0; i < 3; i ++)
{
sprintf(device, "/dev/lp%d", i);
if (access(device, 0) == 0)
printf("direct parallel:%s \"Unknown\" \"PC Parallel Port #%d\"\n",
device, i + 1);
}
/*
* MAGMA parallel ports...
*/
for (i = 0; i < 40; i ++)
{
sprintf(device, "/dev/pm%02d", i);
if (access(device, 0) == 0)
printf("direct parallel:%s \"Unknown\" \"MAGMA Parallel Board #%d Port #%d\"\n",
device, (i / 10) + 1, (i % 10) + 1);
}
/*
* Central Data parallel ports...
*/
for (i = 0; i < 9; i ++)
for (j = 0; j < 8; j ++)
for (n = 0; n < 32; n ++)
{
if (i == 8) /* EtherLite */
sprintf(device, "/dev/sts/lpN%d%c", j, funky_hex[n]);
else
sprintf(device, "/dev/sts/lp%c%d%c", i + 'C', j,
funky_hex[n]);
if (access(device, 0) == 0)
{
if (i == 8)
printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
device, j, n);
else
printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
device, i, j, n);
}
}
#elif defined(__hpux)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
/*
* Standard parallel ports...
*/
if (access("/dev/rlp", 0) == 0)
puts("direct parallel:/dev/rlp \"Unknown\" \"Standard Parallel Port (/dev/rlp)\"");
for (i = 0; i < 7; i ++)
for (j = 0; j < 7; j ++)
{
sprintf(device, "/dev/c%dt%dd0_lp", i, j);
if (access(device, 0) == 0)
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d,%d\"\n",
device, i, j);
}
/*
* Central Data parallel ports...
*/
for (i = 0; i < 9; i ++)
for (j = 0; j < 8; j ++)
for (n = 0; n < 32; n ++)
{
if (i == 8) /* EtherLite */
sprintf(device, "/dev/lpN%d%c", j, funky_hex[n]);
else
sprintf(device, "/dev/lp%c%d%c", i + 'C', j,
funky_hex[n]);
if (access(device, 0) == 0)
{
if (i == 8)
printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
device, j, n);
else
printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
device, i, j, n);
}
}
#elif defined(__osf__)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
for (i = 0; i < 3; 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);
}
}
#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/lpt%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
}
#endif
}
/*
* End of "$Id$".
*/
-24
Ver Arquivo
@@ -1,24 +0,0 @@
#!/bin/sh
#
# Psuedo-backend for CUPS testing purposes.
#
# Copyright 2011 by Apple Inc.
#
# These coded instructions, statements, and computer programs are the
# property of Apple Inc. 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
# file is missing or damaged, see the license at "http://www.cups.org/".
#
# This file is subject to the Apple OS-Developed Software exception.
#
if test $# = 0; then
echo 'direct pseudo:///deskjet "HP DeskJet" "HP DeskJet (pseudo)" "MFG:HP;MDL:DeskJet;CMD:PCL;" "Nowhere"'
echo 'direct pseudo:///laserjet "HP LaserJet" "HP LaserJet (pseudo)" "MFG:HP;MDL:LaserJet;CMD:PCL;" "Nowhere"'
exit 0
fi
cat $6 >/dev/null
sleep 5
exit 0
-520
Ver Arquivo
@@ -1,520 +0,0 @@
/*
* Common run loop APIs for CUPS backends.
*
* Copyright © 2007-2014 by Apple Inc.
* Copyright © 2006-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#include <limits.h>
#include <sys/select.h>
/*
* 'backendDrainOutput()' - Drain pending print data to the device.
*/
int /* O - 0 on success, -1 on error */
backendDrainOutput(int print_fd, /* I - Print file descriptor */
int device_fd) /* I - Device file descriptor */
{
int nfds; /* Maximum file descriptor value + 1 */
fd_set input; /* Input set for reading */
ssize_t print_bytes, /* Print bytes read */
bytes; /* Bytes written */
char print_buffer[8192], /* Print data buffer */
*print_ptr; /* Pointer into print data buffer */
struct timeval timeout; /* Timeout for read... */
fprintf(stderr, "DEBUG: backendDrainOutput(print_fd=%d, device_fd=%d)\n",
print_fd, device_fd);
/*
* 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 (;;)
{
/*
* Use select() to determine whether we have data to copy around...
*/
FD_ZERO(&input);
FD_SET(print_fd, &input);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select(nfds, &input, NULL, NULL, &timeout) < 0)
return (-1);
if (!FD_ISSET(print_fd, &input))
return (0);
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)
{
fprintf(stderr, "DEBUG: Read failed: %s\n", strerror(errno));
_cupsLangPrintFilter(stderr, "ERROR", _("Unable to read print data."));
return (-1);
}
print_bytes = 0;
}
else if (print_bytes == 0)
{
/*
* End of file, return...
*/
return (0);
}
fprintf(stderr, "DEBUG: Read %d bytes of print data...\n",
(int)print_bytes);
for (print_ptr = print_buffer; print_bytes > 0;)
{
if ((bytes = write(device_fd, print_ptr, (size_t)print_bytes)) < 0)
{
/*
* Write error - bail if we don't see an error we can retry...
*/
if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN &&
errno != EINTR && errno != ENOTTY)
{
_cupsLangPrintError("ERROR", _("Unable to write print data"));
return (-1);
}
}
else
{
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
print_bytes -= bytes;
print_ptr += bytes;
}
}
}
}
/*
* '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 snmp_fd, /* I - SNMP socket or -1 if none */
http_addr_t *addr, /* I - Address of device */
int use_bc, /* I - Use back-channel? */
int update_state, /* I - Update printer-state-reasons? */
_cups_sccb_t side_cb) /* I - Side-channel callback */
{
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 */
struct timeval timeout; /* Timeout for select() */
time_t curtime, /* Current time */
snmp_update = 0;
#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, snmp_fd=%d, "
"addr=%p, use_bc=%d, side_cb=%p)\n",
print_fd, device_fd, snmp_fd, addr, use_bc, side_cb);
/*
* 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 */
}
else if (print_fd < 0)
{
/*
* Copy print data from stdin, but don't mess with the signal handlers...
*/
print_fd = 0;
}
/*
* 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 = -1,
paperout = -1, 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);
if (!print_bytes && side_cb)
FD_SET(CUPS_SC_FD, &input);
FD_ZERO(&output);
if (print_bytes || (!use_bc && !side_cb))
FD_SET(device_fd, &output);
if (use_bc || side_cb)
{
timeout.tv_sec = 5;
timeout.tv_usec = 0;
if (select(nfds, &input, &output, NULL, &timeout) < 0)
{
/*
* Pause printing to clear any pending errors...
*/
if (errno == ENXIO && offline != 1 && update_state)
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO",
_("The printer is not connected."));
offline = 1;
}
else if (errno == EINTR && total_bytes == 0)
{
fputs("DEBUG: Received an interrupt before any bytes were "
"written, aborting.\n", stderr);
return (0);
}
sleep(1);
continue;
}
}
/*
* Check if we have a side-channel request ready...
*/
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
{
/*
* Do the side-channel request, then start back over in the select
* loop since it may have read from print_fd...
*/
if ((*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc))
side_cb = NULL;
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, (size_t)bc_bytes, 1.0);
}
else if (bc_bytes < 0 && errno != EAGAIN && errno != EINTR)
{
fprintf(stderr, "DEBUG: Error reading back-channel data: %s\n",
strerror(errno));
use_bc = 0;
}
else if (bc_bytes == 0)
use_bc = 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)
{
fprintf(stderr, "DEBUG: Read failed: %s\n", strerror(errno));
_cupsLangPrintFilter(stderr, "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, (size_t)print_bytes)) < 0)
{
/*
* Write error - bail if we don't see an error we can retry...
*/
if (errno == ENOSPC)
{
if (paperout != 1 && update_state)
{
fputs("STATE: +media-empty-warning\n", stderr);
fputs("DEBUG: Out of paper\n", stderr);
paperout = 1;
}
}
else if (errno == ENXIO)
{
if (offline != 1 && update_state)
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO",
_("The printer is not connected."));
offline = 1;
}
}
else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
_cupsLangPrintError("ERROR", _("Unable to write print data"));
return (-1);
}
}
else
{
if (paperout && update_state)
{
fputs("STATE: -media-empty-warning\n", stderr);
paperout = 0;
}
if (offline && update_state)
{
fputs("STATE: -offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO",
_("The printer is now connected."));
offline = 0;
}
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
print_bytes -= bytes;
print_ptr += bytes;
total_bytes += bytes;
}
}
/*
* Do SNMP updates periodically...
*/
if (snmp_fd >= 0 && time(&curtime) >= snmp_update)
{
if (backendSNMPSupplies(snmp_fd, addr, NULL, NULL))
snmp_update = INT_MAX;
else
snmp_update = curtime + 5;
}
}
/*
* Return with success...
*/
return (total_bytes);
}
/*
* 'backendWaitLoop()' - Wait for input from stdin while handling side-channel
* queries.
*/
int /* O - 1 if data is ready, 0 if not */
backendWaitLoop(
int snmp_fd, /* I - SNMP socket or -1 if none */
http_addr_t *addr, /* I - Address of device */
int use_bc, /* I - Use back-channel? */
_cups_sccb_t side_cb) /* I - Side-channel callback */
{
int nfds; /* Number of file descriptors */
fd_set input; /* Input set for reading */
time_t curtime = 0, /* Current time */
snmp_update = 0;/* Last SNMP status update */
struct timeval timeout; /* Timeout for select() */
fprintf(stderr, "DEBUG: backendWaitLoop(snmp_fd=%d, addr=%p, side_cb=%p)\n",
snmp_fd, addr, side_cb);
/*
* Now loop until we receive data from stdin...
*/
if (snmp_fd >= 0)
snmp_update = time(NULL) + 5;
for (;;)
{
/*
* Use select() to determine whether we have data to copy around...
*/
FD_ZERO(&input);
FD_SET(0, &input);
if (side_cb)
FD_SET(CUPS_SC_FD, &input);
if (snmp_fd >= 0)
{
curtime = time(NULL);
timeout.tv_sec = curtime >= snmp_update ? 0 : snmp_update - curtime;
timeout.tv_usec = 0;
nfds = select(CUPS_SC_FD + 1, &input, NULL, NULL, &timeout);
}
else
nfds = select(CUPS_SC_FD + 1, &input, NULL, NULL, NULL);
if (nfds < 0)
{
/*
* Pause printing to clear any pending errors...
*/
if (errno == EINTR)
{
fputs("DEBUG: Received an interrupt before any bytes were "
"written, aborting.\n", stderr);
return (0);
}
sleep(1);
continue;
}
/*
* Check for input on stdin...
*/
if (FD_ISSET(0, &input))
break;
/*
* Check if we have a side-channel request ready...
*/
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
{
/*
* Do the side-channel request, then start back over in the select
* loop since it may have read from print_fd...
*/
if ((*side_cb)(0, -1, snmp_fd, addr, use_bc))
side_cb = NULL;
continue;
}
/*
* Do SNMP updates periodically...
*/
if (snmp_fd >= 0 && curtime >= snmp_update)
{
if (backendSNMPSupplies(snmp_fd, addr, NULL, NULL))
snmp_fd = -1;
else
snmp_update = curtime + 5;
}
}
/*
* Return with success...
*/
return (1);
}
+856
Ver Arquivo
@@ -0,0 +1,856 @@
/*
* "$Id$"
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2001 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Send a file to the printer or server.
* list_devices() - List all serial devices.
*/
/*
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#ifdef __hpux
# include <sys/modem.h>
#endif /* __hpux */
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
# ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
# endif /* __linux */
#endif /* WIN32 || __EMX__ */
#ifdef __sgi
# include <invent.h>
# ifndef INV_EPP_ECP_PLP
# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */
# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */
# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */
# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */
# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */
# 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 */
/*
* Local functions...
*/
void list_devices(void);
/*
* 'main()' - Send a file to the printer or server.
*
* 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 */
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 */
int dtrdsr; /* Do dtr/dsr flow control? */
int bufsize; /* Size of output buffer for writes */
char buffer[8192], /* Output buffer */
*bufptr; /* Pointer into buffer */
struct termios opts; /* Parallel port options */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
}
else if (argc < 6 || argc > 7)
{
fputs("Usage: serial 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]);
}
/*
* Extract the device name and options from the URI...
*/
httpSeparate(argv[0], method, username, hostname, &port, resource);
/*
* See if there are any options...
*/
if ((options = strchr(resource, '?')) != NULL)
{
/*
* Yup, terminate the device name string and move to the first
* character of the options...
*/
*options++ = '\0';
}
/*
* Open the serial port device...
*/
do
{
if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL)) == -1)
{
if (errno == EBUSY)
{
fputs("INFO: Serial port busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
else
{
perror("ERROR: Unable to open serial port device file");
return (1);
}
}
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
bufsize = 480; /* 9600 baud / 10 bits/char / 2Hz */
dtrdsr = 0; /* No dtr/dsr flow control */
if (options != NULL)
while (*options)
{
/*
* Get the name...
*/
for (ptr = name; *options && *options != '=';)
*ptr++ = *options++;
*ptr = '\0';
if (*options == '=')
{
/*
* Get the value...
*/
options ++;
for (ptr = value; *options && *options != '+';)
*ptr++ = *options++;
*ptr = '\0';
if (*options == '+')
options ++;
}
else
value[0] = '\0';
/*
* Process the option...
*/
if (strcasecmp(name, "baud") == 0)
{
/*
* Set the baud rate...
*/
bufsize = atoi(value) / 20;
#if B19200 == 19200
cfsetispeed(&opts, atoi(value));
cfsetospeed(&opts, atoi(value));
#else
switch (atoi(value))
{
case 1200 :
cfsetispeed(&opts, B1200);
cfsetospeed(&opts, B1200);
break;
case 2400 :
cfsetispeed(&opts, B2400);
cfsetospeed(&opts, B2400);
break;
case 4800 :
cfsetispeed(&opts, B4800);
cfsetospeed(&opts, B4800);
break;
case 9600 :
cfsetispeed(&opts, B9600);
cfsetospeed(&opts, B9600);
break;
case 19200 :
cfsetispeed(&opts, B19200);
cfsetospeed(&opts, B19200);
break;
case 38400 :
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 */
default :
fprintf(stderr, "WARNING: Unsupported baud rate %s!\n", value);
break;
}
#endif /* B19200 == 19200 */
}
else if (strcasecmp(name, "bits") == 0)
{
/*
* Set number of data bits...
*/
switch (atoi(value))
{
case 7 :
opts.c_cflag &= ~CSIZE;
opts.c_cflag |= CS7;
opts.c_cflag |= PARENB;
opts.c_cflag &= ~PARODD;
break;
case 8 :
opts.c_cflag &= ~CSIZE;
opts.c_cflag |= CS8;
opts.c_cflag &= ~PARENB;
break;
}
}
else if (strcasecmp(name, "parity") == 0)
{
/*
* Set parity checking...
*/
if (strcasecmp(value, "even") == 0)
{
opts.c_cflag |= PARENB;
opts.c_cflag &= ~PARODD;
}
else if (strcasecmp(value, "odd") == 0)
{
opts.c_cflag |= PARENB;
opts.c_cflag |= PARODD;
}
else if (strcasecmp(value, "none") == 0)
opts.c_cflag &= ~PARENB;
}
else if (strcasecmp(name, "flow") == 0)
{
/*
* Set flow control...
*/
if (strcasecmp(value, "none") == 0)
{
opts.c_iflag &= ~(IXON | IXOFF | IXANY);
opts.c_cflag &= ~CRTSCTS;
}
else if (strcasecmp(value, "soft") == 0)
{
opts.c_iflag |= IXON | IXOFF | IXANY;
opts.c_cflag &= ~CRTSCTS;
}
else if (strcasecmp(value, "hard") == 0 ||
strcasecmp(value, "rtscts") == 0)
{
opts.c_iflag &= ~(IXON | IXOFF | IXANY);
opts.c_cflag |= CRTSCTS;
}
else if (strcasecmp(value, "dtrdsr") == 0)
{
opts.c_iflag &= ~(IXON | IXOFF | IXANY);
opts.c_cflag &= ~CRTSCTS;
dtrdsr = 1;
}
}
}
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 */
/*
* Finally, send the print file...
*/
if (bufsize > sizeof(buffer))
bufsize = sizeof(buffer);
while (copies > 0)
{
copies --;
if (fp != stdin)
{
fputs("PAGE: 1 1\n", stderr);
rewind(fp);
}
if (dtrdsr)
{
/*
* Check the port and sleep until DSR is set...
*/
int status;
if (!ioctl(fd, TIOCMGET, &status))
if (!(status & TIOCM_DSR))
{
/*
* Wait for DSR to go high...
*/
fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
do
{
sleep(1);
if (ioctl(fd, TIOCMGET, &status))
break;
}
while (!(status & TIOCM_DSR));
fputs("DEBUG: DSR is high; writing to device...\n", stderr);
}
}
tbytes = 0;
while ((nbytes = fread(buffer, 1, bufsize, 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);
}
}
/*
* Close the socket connection and input file and return...
*/
close(fd);
if (fp != stdin)
fclose(fp);
return (0);
}
/*
* 'list_devices()' - List all serial devices.
*/
void
list_devices(void)
{
#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__)
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
/* 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 */
for (i = 0; i < 100; i ++)
{
sprintf(device, "/dev/ttyS%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",
device, i + 1);
}
}
#elif defined(__sgi)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
inventory_t *inv; /* Hardware inventory info */
/*
* IRIX maintains a hardware inventory of most devices...
*/
setinvent();
while ((inv = getinvent()) != NULL)
{
if (inv->inv_class == INV_SERIAL)
{
/*
* Some sort of serial port...
*/
if (inv->inv_type == INV_CDSIO || inv->inv_type == INV_CDSIO_E)
{
/*
* CDSIO port...
*/
for (n = 0; n < 6; 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)
{
/*
* Everest serial port...
*/
if (inv->inv_unit == 0)
i = 1;
else
i = 41 + 4 * (int)inv->inv_controller;
for (n = 0; n < (int)inv->inv_state; 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)
{
/*
* Standard serial port under IRIX 6.4 and earlier...
*/
for (n = 0; n < (int)inv->inv_state; 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
{
/*
* Standard serial port under IRIX 6.5 and beyond...
*/
printf("serial serial:/dev/ttyd%d?baud=115200 \"Unknown\" \"Onboard Serial Port %d\"\n",
(int)inv->inv_controller, (int)inv->inv_controller);
}
}
}
endinvent();
/*
* Central Data makes serial and parallel "servers" that can be
* connected in a number of ways. Look for ports...
*/
for (i = 0; i < 10; i ++)
for (j = 0; j < 8; j ++)
for (n = 0; n < 32; n ++)
{
if (i == 8) /* EtherLite */
sprintf(device, "/dev/ttydn%d%c", j, funky_hex[n]);
else if (i == 9) /* PCI */
sprintf(device, "/dev/ttydp%d%c", j, funky_hex[n]);
else /* SCSI */
sprintf(device, "/dev/ttyd%d%d%c", i, j, funky_hex[n]);
if (access(device, 0) == 0)
{
if (i == 8)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data EtherLite Serial Port, ID %d, port %d\"\n",
device, j, n);
else if (i == 9)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data PCI Serial Port, ID %d, port %d\"\n",
device, j, n);
else
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data SCSI Serial Port, logical bus %d, ID %d, port %d\"\n",
device, i, j, n);
}
}
#elif defined(__sun)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
/*
* Standard serial ports...
*/
for (i = 0; i < 26; i ++)
{
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 */
}
/*
* MAGMA serial ports...
*/
for (i = 0; i < 40; i ++)
{
sprintf(device, "/dev/term/%02d", i);
if (access(device, 0) == 0)
printf("serial serial:%s?baud=38400 \"Unknown\" \"MAGMA Serial Board #%d Port #%d\"\n",
device, (i / 10) + 1, (i % 10) + 1);
}
/*
* Central Data serial ports...
*/
for (i = 0; i < 9; i ++)
for (j = 0; j < 8; j ++)
for (n = 0; n < 32; n ++)
{
if (i == 8) /* EtherLite */
sprintf(device, "/dev/sts/ttyN%d%c", j, funky_hex[n]);
else
sprintf(device, "/dev/sts/tty%c%d%c", i + 'C', j,
funky_hex[n]);
if (access(device, 0) == 0)
{
if (i == 8)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data EtherLite Serial Port, ID %d, port %d\"\n",
device, j, n);
else
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data SCSI Serial Port, logical bus %d, ID %d, port %d\"\n",
device, i, j, n);
}
}
#elif defined(__hpux)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
/*
* Standard serial ports...
*/
for (i = 0; i < 10; i ++)
{
sprintf(device, "/dev/tty%dp0", i);
if (access(device, 0) == 0)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
/*
* Central Data serial ports...
*/
for (i = 0; i < 9; i ++)
for (j = 0; j < 8; j ++)
for (n = 0; n < 32; n ++)
{
if (i == 8) /* EtherLite */
sprintf(device, "/dev/ttyN%d%c", j, funky_hex[n]);
else
sprintf(device, "/dev/tty%c%d%c", i + 'C', j,
funky_hex[n]);
if (access(device, 0) == 0)
{
if (i == 8)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data EtherLite Serial Port, ID %d, port %d\"\n",
device, j, n);
else
printf("serial serial:%s?baud=38400 \"Unknown\" \"Central Data SCSI Serial Port, logical bus %d, ID %d, port %d\"\n",
device, i, j, n);
}
}
#elif defined(__osf__)
int i; /* Looping var */
char device[255]; /* Device filename */
/*
* Standard serial ports...
*/
for (i = 0; i < 100; i ++)
{
sprintf(device, "/dev/tty%02d", i);
if (access(device, 0) == 0)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
/*
* SIO ports...
*/
for (i = 0; i < 32; i ++)
{
sprintf(device, "/dev/ttyd%c", funky_hex[i]);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Standard Serial Port #%d\"\n",
device, i + 1);
}
}
/*
* Cyclades ports...
*/
for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
for (j = 0; j < 32; j ++)
{
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);
}
}
/*
* Digiboard ports...
*/
for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
for (j = 0; j < 32; j ++)
{
sprintf(device, "/dev/ttyD%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\" \"Digiboard #%d Serial Port #%d\"\n",
device, i, j + 1);
}
}
/*
* Stallion ports...
*/
for (i = 0; i < 32; i ++)
{
sprintf(device, "/dev/ttyE%c", funky_hex[i]);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Stallion Serial Port #%d\"\n",
device, i + 1);
}
}
/*
* SX ports...
*/
for (i = 0; i < 128; i ++)
{
sprintf(device, "/dev/ttyA%d", i + 1);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"SX Serial Port #%d\"\n",
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);
}
}
#endif
}
/*
* End of "$Id$".
*/
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-1356
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-172
Ver Arquivo
@@ -1,172 +0,0 @@
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
+167 -365
Ver Arquivo
@@ -1,40 +1,53 @@
/*
* AppSocket backend for CUPS.
* "$Id$"
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
* Copyright 1997-2001 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Send a file to the printer or server.
*/
/*
* Include necessary headers.
*/
#include <cups/http-private.h>
#include "backend-private.h"
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef _WIN32
#if defined(WIN32) || defined(__EMX__)
# 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 */
/*
* Local functions...
*/
static ssize_t wait_bc(int device_fd, int secs);
#endif /* WIN32 || __EMX__ */
/*
@@ -45,41 +58,31 @@ static ssize_t wait_bc(int device_fd, int secs);
* 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 */
{
const char *device_uri; /* Device URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (not used) */
*options, /* Pointer to options */
*name, /* Name of option */
*value, /* Value of option */
sep; /* Option separator */
int print_fd; /* Print file */
int copies; /* Number of copies to print */
time_t start_time; /* Time of first connect */
int contimeout; /* Connection timeout */
int waiteof; /* Wait for end-of-file? */
int port; /* Port number */
int delay; /* Delay for retries... */
int device_fd; /* AppSocket */
int error; /* Error code (if any) */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Connected address */
char addrname[256]; /* Address name */
int snmp_enabled = 1; /* Is SNMP enabled? */
int snmp_fd, /* SNMP socket */
start_count, /* Page count via SNMP at start */
page_count, /* Page count via SNMP */
have_supplies; /* Printer supports supply levels? */
ssize_t bytes = 0, /* Initial bytes read */
tbytes; /* Total number of bytes written */
char buffer[1024]; /* Initial print buffer */
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 delay; /* Delay for retries... */
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() */
#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 */
@@ -89,36 +92,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc == 1)
{
printf("network socket \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("AppSocket/HP JetDirect")));
return (CUPS_BACKEND_OK);
puts("network socket \"Unknown\" \"AppSocket/HP JetDirect\"");
return (0);
}
else if (argc < 6 || argc > 7)
{
_cupsLangPrintf(stderr,
_("Usage: %s job-id user title copies options [file]"),
argv[0]);
return (CUPS_BACKEND_FAILED);
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
argv[0]);
return (1);
}
/*
@@ -128,8 +115,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 6)
{
print_fd = 0;
copies = 1;
fp = stdin;
copies = 1;
}
else
{
@@ -137,10 +124,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Try to open the print file...
*/
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
if ((fp = fopen(argv[6], "rb")) == NULL)
{
_cupsLangPrintError("ERROR", _("Unable to open print file"));
return (CUPS_BACKEND_FAILED);
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
@@ -150,344 +137,159 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the hostname and port number from the URI...
*/
while ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
{
_cupsLangPrintFilter(stderr, "INFO", _("Unable to locate printer."));
sleep(10);
if (getenv("CLASS") != NULL)
return (CUPS_BACKEND_FAILED);
}
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
httpSeparate(argv[0], method, username, hostname, &port, resource);
if (port == 0)
port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */
/*
* Get options, if any...
* Then try to connect to the remote host...
*/
waiteof = 1;
contimeout = 7 * 24 * 60 * 60;
if ((options = strchr(resource, '?')) != NULL)
if ((hostaddr = gethostbyname(hostname)) == 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...
*/
name = options;
while (*options && *options != '=' && *options != '+' && *options != '&')
options ++;
if ((sep = *options) != '\0')
*options++ = '\0';
if (sep == '=')
{
/*
* Get the value...
*/
value = options;
while (*options && *options != '+' && *options != '&')
options ++;
if (*options)
*options++ = '\0';
}
else
value = (char *)"";
/*
* Process the option...
*/
if (!_cups_strcasecmp(name, "waiteof"))
{
/*
* Set the wait-for-eof value...
*/
waiteof = !value[0] || !_cups_strcasecmp(value, "on") ||
!_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true");
}
else if (!_cups_strcasecmp(name, "snmp"))
{
/*
* Enable/disable SNMP stuff...
*/
snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
!_cups_strcasecmp(value, "yes") ||
!_cups_strcasecmp(value, "true");
}
else if (!_cups_strcasecmp(name, "contimeout"))
{
/*
* Set the connection timeout...
*/
if (atoi(value) > 0)
contimeout = atoi(value);
}
}
fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s\n",
hostname, strerror(errno));
return (1);
}
/*
* Then try finding the remote host...
*/
fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
hostname, port);
start_time = time(NULL);
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);
addrlist = backendLookup(hostname, port, NULL);
/*
* See if the printer supports SNMP...
*/
if (snmp_enabled)
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
else
snmp_fd = -1;
if (snmp_fd >= 0)
have_supplies = !backendSNMPSupplies(snmp_fd, &(addrlist->addr),
&start_count, NULL);
else
have_supplies = start_count = 0;
/*
* Wait for data from the filter...
*/
if (print_fd == 0)
while (copies > 0)
{
if (!backendWaitLoop(snmp_fd, &(addrlist->addr), 1, backendNetworkSideCB))
return (CUPS_BACKEND_OK);
else if ((bytes = read(0, buffer, sizeof(buffer))) <= 0)
return (CUPS_BACKEND_OK);
}
/*
* Connect to the printer...
*/
fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPrintFilter(stderr, "INFO", _("Connecting to printer."));
for (delay = 5;;)
{
if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
for (delay = 5;;)
{
error = errno;
device_fd = -1;
if (getenv("CLASS") != NULL)
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
/*
* 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.
*/
_cupsLangPrintFilter(stderr, "INFO",
_("Unable to contact printer, queuing on next "
"printer in class."));
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
return (CUPS_BACKEND_FAILED);
perror("ERROR: Unable to create socket");
return (1);
}
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(error));
if (errno == ECONNREFUSED || errno == EHOSTDOWN || errno == EHOSTUNREACH || errno == ETIMEDOUT || errno == ENOTCONN)
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
if (contimeout && (time(NULL) - start_time) > contimeout)
error = errno;
close(fd);
fd = -1;
if (error == ECONNREFUSED)
{
_cupsLangPrintFilter(stderr, "ERROR",
_("The printer is not responding."));
return (CUPS_BACKEND_FAILED);
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
hostname, delay);
sleep(delay);
if (delay < 30)
delay += 5;
}
switch (error)
else
{
case EHOSTDOWN :
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer may not exist or "
"is unavailable at this time."));
break;
case EHOSTUNREACH :
default :
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer is unreachable at this "
"time."));
break;
case ECONNREFUSED :
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer is in use."));
break;
}
sleep((unsigned)delay);
if (delay < 30)
delay += 5;
perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
sleep(30);
}
}
else
{
_cupsLangPrintFilter(stderr, "ERROR",
_("The printer is not responding."));
sleep(30);
}
break;
}
else
break;
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
/*
* 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...
*/
fprintf(stderr, "DEBUG: Connected to %s:%d...\n",
httpAddrString(&(addr->addr), addrname, sizeof(addrname)),
httpAddrPort(&(addr->addr)));
#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 */
tbytes = 0;
/*
* Finally, send the print file...
*/
if (bytes > 0)
tbytes += write(device_fd, buffer, (size_t)bytes);
while (copies > 0 && tbytes >= 0)
{
copies --;
if (print_fd != 0)
if (fp != stdin)
{
fputs("PAGE: 1 1\n", stderr);
lseek(print_fd, 0, SEEK_SET);
rewind(fp);
}
if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0)
tbytes = -1;
else
tbytes = bytes;
fputs("INFO: Connected to host, sending print job...\n", stderr);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
}
tbytes = 0;
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
{
/*
* Write the print data to the printer...
*/
fputs("STATE: +cups-waiting-for-job-completed\n", stderr);
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_usec = 0;
FD_ZERO(&input);
FD_SET(fd, &input);
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
{
/*
* 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);
}
else if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
}
if (waiteof && tbytes >= 0)
{
/*
* Shutdown the socket and wait for the other end to finish...
* Close the socket connection...
*/
_cupsLangPrintFilter(stderr, "INFO", _("Waiting for printer to finish."));
shutdown(device_fd, 1);
while (wait_bc(device_fd, 90) > 0);
close(fd);
}
/*
* Collect the final page count as needed...
*/
if (have_supplies &&
!backendSNMPSupplies(snmp_fd, &(addrlist->addr), &page_count, NULL) &&
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
/*
* Close the socket connection...
*/
close(device_fd);
httpAddrFreeList(addrlist);
/*
* Close the input file and return...
*/
if (print_fd != 0)
close(print_fd);
if (fp != stdin)
fclose(fp);
return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED);
return (0);
}
/*
* 'wait_bc()' - Wait for back-channel data...
* End of "$Id$".
*/
static ssize_t /* O - # bytes read or -1 on error */
wait_bc(int device_fd, /* I - Socket */
int secs) /* I - Seconds to wait */
{
struct timeval timeout; /* Timeout for select() */
fd_set input; /* Input set for select() */
ssize_t bytes; /* Number of back-channel bytes read */
char buffer[1024]; /* Back-channel buffer */
/*
* Wait up to "secs" seconds for backchannel data...
*/
timeout.tv_sec = secs;
timeout.tv_usec = 0;
FD_ZERO(&input);
FD_SET(device_fd, &input);
if (select(device_fd + 1, &input, NULL, NULL, &timeout) > 0)
{
/*
* Grab the data coming back and spit it out to stderr...
*/
if ((bytes = read(device_fd, buffer, sizeof(buffer))) > 0)
{
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data\n",
(int)bytes);
cupsBackChannelWrite(buffer, (size_t)bytes, 1.0);
}
return (bytes);
}
else
return (-1);
}
-68
Ver Arquivo
@@ -1,68 +0,0 @@
/*
* IEEE-1284 support functions test program for CUPS.
*
* Copyright © 2007-2010 by Apple Inc.
* Copyright © 1997-2006 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include <cups/string-private.h>
#ifdef _WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
#endif /* _WIN32 */
#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);
}
-672
Ver Arquivo
@@ -1,672 +0,0 @@
/*
* Backend test program for CUPS.
*
* Copyright © 2007-2014 by Apple Inc.
* Copyright © 1997-2005 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include <cups/string-private.h>
#include <cups/cups.h>
#include <cups/sidechannel.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <signal.h>
/*
* Local globals...
*/
static int job_canceled = 0;
/*
* Local functions...
*/
static void sigterm_handler(int sig);
static void usage(void) _CUPS_NORETURN;
static void walk_cb(const char *oid, const char *data, int datalen,
void *context);
/*
* 'main()' - Run the named backend.
*
* Usage:
*
* testbackend [-s] [-t] device-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int first_arg, /* First argument for backend */
do_cancel = 0, /* Simulate a cancel-job via SIGTERM */
do_ps = 0, /* Do PostScript query+test? */
do_pcl = 0, /* Do PCL query+test? */
do_side_tests = 0, /* Test side-channel ops? */
do_trickle = 0, /* Trickle data to backend */
do_walk = 0, /* Do OID lookup (0) or walking (1) */
show_log = 0; /* Show log messages from backends? */
const char *oid = ".1.3.6.1.2.1.43.10.2.1.4.1.1";
/* OID to lookup or walk */
char scheme[255], /* Scheme in URI == backend */
backend[1024], /* Backend path */
libpath[1024], /* Path for libcups */
*ptr; /* Pointer into path */
const char *serverbin; /* CUPS_SERVERBIN environment variable */
int fd, /* Temporary file descriptor */
back_fds[2], /* Back-channel pipe */
side_fds[2], /* Side-channel socket */
data_fds[2], /* Data pipe */
back_pid = -1, /* Backend process ID */
data_pid = -1, /* Trickle process ID */
pid, /* Process ID */
status; /* Exit status */
/*
* Get the current directory and point the run-time linker at the "cups"
* subdirectory...
*/
if (getcwd(libpath, sizeof(libpath)) &&
(ptr = strrchr(libpath, '/')) != NULL && !strcmp(ptr, "/backend"))
{
strlcpy(ptr, "/cups", sizeof(libpath) - (size_t)(ptr - libpath));
if (!access(libpath, 0))
{
#ifdef __APPLE__
fprintf(stderr, "Setting DYLD_LIBRARY_PATH to \"%s\".\n", libpath);
setenv("DYLD_LIBRARY_PATH", libpath, 1);
#else
fprintf(stderr, "Setting LD_LIBRARY_PATH to \"%s\".\n", libpath);
setenv("LD_LIBRARY_PATH", libpath, 1);
#endif /* __APPLE__ */
}
else
perror(libpath);
}
/*
* See if we have side-channel tests to do...
*/
for (first_arg = 1;
argv[first_arg] && argv[first_arg][0] == '-';
first_arg ++)
if (!strcmp(argv[first_arg], "-d"))
show_log = 1;
else if (!strcmp(argv[first_arg], "-cancel"))
do_cancel = 1;
else if (!strcmp(argv[first_arg], "-pcl"))
do_pcl = 1;
else if (!strcmp(argv[first_arg], "-ps"))
do_ps = 1;
else if (!strcmp(argv[first_arg], "-s"))
do_side_tests = 1;
else if (!strcmp(argv[first_arg], "-t"))
do_trickle = 1;
else if (!strcmp(argv[first_arg], "-get") && (first_arg + 1) < argc)
{
first_arg ++;
do_side_tests = 1;
oid = argv[first_arg];
}
else if (!strcmp(argv[first_arg], "-walk") && (first_arg + 1) < argc)
{
first_arg ++;
do_side_tests = 1;
do_walk = 1;
oid = argv[first_arg];
}
else
usage();
argc -= first_arg;
if (argc < 6 || argc > 7 || (argc == 7 && do_trickle))
usage();
/*
* Extract the scheme from the device-uri - that's the program we want to
* execute.
*/
if (sscanf(argv[first_arg], "%254[^:]", scheme) != 1)
{
fputs("testbackend: Bad device-uri - no colon!\n", stderr);
return (1);
}
if (!access(scheme, X_OK))
strlcpy(backend, scheme, sizeof(backend));
else
{
if ((serverbin = getenv("CUPS_SERVERBIN")) == NULL)
serverbin = CUPS_SERVERBIN;
snprintf(backend, sizeof(backend), "%s/backend/%s", serverbin, scheme);
if (access(backend, X_OK))
{
fprintf(stderr, "testbackend: Unknown device scheme \"%s\"!\n", scheme);
return (1);
}
}
/*
* Create the back-channel pipe and side-channel socket...
*/
open("/dev/null", O_WRONLY); /* Make sure fd 3 and 4 are used */
open("/dev/null", O_WRONLY);
pipe(back_fds);
fcntl(back_fds[0], F_SETFL, fcntl(back_fds[0], F_GETFL) | O_NONBLOCK);
fcntl(back_fds[1], F_SETFL, fcntl(back_fds[1], F_GETFL) | O_NONBLOCK);
socketpair(AF_LOCAL, SOCK_STREAM, 0, side_fds);
fcntl(side_fds[0], F_SETFL, fcntl(side_fds[0], F_GETFL) | O_NONBLOCK);
fcntl(side_fds[1], F_SETFL, fcntl(side_fds[1], F_GETFL) | O_NONBLOCK);
/*
* Execute the trickle process as needed...
*/
if (do_trickle || do_pcl || do_ps || do_cancel)
{
pipe(data_fds);
signal(SIGTERM, sigterm_handler);
if ((data_pid = fork()) == 0)
{
/*
* Trickle/query child comes here. Rearrange file descriptors so that
* FD 1, 3, and 4 point to the backend...
*/
if ((fd = open("/dev/null", O_RDONLY)) != 0)
{
dup2(fd, 0);
close(fd);
}
if (data_fds[1] != 1)
{
dup2(data_fds[1], 1);
close(data_fds[1]);
}
close(data_fds[0]);
if (back_fds[0] != 3)
{
dup2(back_fds[0], 3);
close(back_fds[0]);
}
close(back_fds[1]);
if (side_fds[0] != 4)
{
dup2(side_fds[0], 4);
close(side_fds[0]);
}
close(side_fds[1]);
if (do_trickle)
{
/*
* Write 10 spaces, 1 per second...
*/
int i; /* Looping var */
for (i = 0; i < 10; i ++)
{
write(1, " ", 1);
sleep(1);
}
}
else if (do_cancel)
{
/*
* Write PS or PCL lines until we see SIGTERM...
*/
int line = 0, page = 0; /* Current line and page */
ssize_t bytes; /* Number of bytes of response data */
char buffer[1024]; /* Output buffer */
if (do_pcl)
write(1, "\033E", 2);
else
write(1, "%!\n/Courier findfont 12 scalefont setfont 0 setgray\n", 52);
while (!job_canceled)
{
if (line == 0)
{
page ++;
if (do_pcl)
snprintf(buffer, sizeof(buffer), "PCL Page %d\r\n\r\n", page);
else
snprintf(buffer, sizeof(buffer),
"18 732 moveto (PS Page %d) show\n", page);
write(1, buffer, strlen(buffer));
}
line ++;
if (do_pcl)
snprintf(buffer, sizeof(buffer), "Line %d\r\n", line);
else
snprintf(buffer, sizeof(buffer), "18 %d moveto (Line %d) show\n",
720 - line * 12, line);
write(1, buffer, strlen(buffer));
if (line >= 55)
{
/*
* Eject after 55 lines...
*/
line = 0;
if (do_pcl)
write(1, "\014", 1);
else
write(1, "showpage\n", 9);
}
/*
* Check for back-channel data...
*/
if ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 0)) > 0)
write(2, buffer, (size_t)bytes);
/*
* Throttle output to ~100hz...
*/
usleep(10000);
}
/*
* Eject current page with info...
*/
if (do_pcl)
snprintf(buffer, sizeof(buffer),
"Canceled on line %d of page %d\r\n\014\033E", line, page);
else
snprintf(buffer, sizeof(buffer),
"\n18 %d moveto (Canceled on line %d of page %d)\nshowpage\n",
720 - line * 12, line, page);
write(1, buffer, strlen(buffer));
/*
* See if we get any back-channel data...
*/
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 5.0)) > 0)
write(2, buffer, (size_t)bytes);
exit(0);
}
else
{
/*
* Do PS or PCL query + test pages.
*/
char buffer[1024]; /* Buffer for response data */
ssize_t bytes; /* Number of bytes of response data */
double timeout; /* Timeout */
const char *data; /* Data to send */
static const char *pcl_data = /* PCL data */
"\033%-12345X@PJL\r\n"
"@PJL JOB NAME = \"Hello, World!\"\r\n"
"@PJL INFO USTATUS\r\n"
"@PJL ENTER LANGUAGE = PCL\r\n"
"\033E"
"Hello, World!\n"
"\014"
"\033%-12345X@PJL\r\n"
"@PJL EOJ NAME=\"Hello, World!\"\r\n"
"\033%-12345X";
static const char *ps_data = /* PostScript data */
"%!\n"
"save\n"
"product = flush\n"
"currentpagedevice /PageSize get aload pop\n"
"2 copy gt {exch} if\n"
"(Unknown)\n"
"19 dict\n"
"dup [612 792] (Letter) put\n"
"dup [612 1008] (Legal) put\n"
"dup [612 935] (w612h935) put\n"
"dup [522 756] (Executive) put\n"
"dup [595 842] (A4) put\n"
"dup [420 595] (A5) put\n"
"dup [499 709] (ISOB5) put\n"
"dup [516 728] (B5) put\n"
"dup [612 936] (w612h936) put\n"
"dup [284 419] (Postcard) put\n"
"dup [419.5 567] (DoublePostcard) put\n"
"dup [558 774] (w558h774) put\n"
"dup [553 765] (w553h765) put\n"
"dup [522 737] (w522h737) put\n"
"dup [499 709] (EnvISOB5) put\n"
"dup [297 684] (Env10) put\n"
"dup [459 649] (EnvC5) put\n"
"dup [312 624] (EnvDL) put\n"
"dup [279 540] (EnvMonarch) put\n"
"{ exch aload pop 4 index sub abs 5 le exch\n"
" 5 index sub abs 5 le and\n"
" {exch pop exit} {pop} ifelse\n"
"} bind forall\n"
"= flush pop pop\n"
"/Courier findfont 12 scalefont setfont\n"
"0 setgray 36 720 moveto (Hello, ) show product show (!) show\n"
"showpage\n"
"restore\n"
"\004";
if (do_pcl)
data = pcl_data;
else
data = ps_data;
write(1, data, strlen(data));
write(2, "DEBUG: START\n", 13);
timeout = 60.0;
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer),
timeout)) > 0)
{
write(2, buffer, (size_t)bytes);
timeout = 5.0;
}
write(2, "\nDEBUG: END\n", 12);
}
exit(0);
}
else if (data_pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
}
}
else
data_fds[0] = data_fds[1] = -1;
/*
* Execute the backend...
*/
if ((back_pid = fork()) == 0)
{
/*
* Child comes here...
*/
if (do_trickle || do_ps || do_pcl || do_cancel)
{
if (data_fds[0] != 0)
{
dup2(data_fds[0], 0);
close(data_fds[0]);
}
close(data_fds[1]);
}
if (!show_log)
{
if ((fd = open("/dev/null", O_WRONLY)) != 2)
{
dup2(fd, 2);
close(fd);
}
}
if (back_fds[1] != 3)
{
dup2(back_fds[1], 3);
close(back_fds[0]);
}
close(back_fds[1]);
if (side_fds[1] != 4)
{
dup2(side_fds[1], 4);
close(side_fds[0]);
}
close(side_fds[1]);
execv(backend, argv + first_arg);
fprintf(stderr, "testbackend: Unable to execute \"%s\": %s\n", backend,
strerror(errno));
return (errno);
}
else if (back_pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
}
/*
* Parent comes here, setup back and side channel file descriptors...
*/
if (do_trickle || do_ps || do_pcl || do_cancel)
{
close(data_fds[0]);
close(data_fds[1]);
}
if (back_fds[0] != 3)
{
dup2(back_fds[0], 3);
close(back_fds[0]);
}
close(back_fds[1]);
if (side_fds[0] != 4)
{
dup2(side_fds[0], 4);
close(side_fds[0]);
}
close(side_fds[1]);
/*
* Do side-channel tests as needed, then wait for the backend...
*/
if (do_side_tests)
{
int length; /* Length of buffer */
char buffer[2049]; /* Buffer for reponse */
cups_sc_status_t scstatus; /* Status of side-channel command */
static const char * const statuses[] =
{
"CUPS_SC_STATUS_NONE", /* No status */
"CUPS_SC_STATUS_OK", /* Operation succeeded */
"CUPS_SC_STATUS_IO_ERROR", /* An I/O error occurred */
"CUPS_SC_STATUS_TIMEOUT", /* The backend did not respond */
"CUPS_SC_STATUS_NO_RESPONSE", /* The device did not respond */
"CUPS_SC_STATUS_BAD_MESSAGE", /* The command/response message was invalid */
"CUPS_SC_STATUS_TOO_BIG", /* Response too big */
"CUPS_SC_STATUS_NOT_IMPLEMENTED" /* Command not implemented */
};
sleep(2);
length = 0;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_DRAIN_OUTPUT, buffer,
&length, 60.0);
printf("CUPS_SC_CMD_DRAIN_OUTPUT returned %s\n", statuses[scstatus]);
length = 1;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_GET_BIDI, buffer,
&length, 5.0);
printf("CUPS_SC_CMD_GET_BIDI returned %s, %d\n", statuses[scstatus], buffer[0]);
length = sizeof(buffer) - 1;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_GET_DEVICE_ID, buffer,
&length, 5.0);
buffer[length] = '\0';
printf("CUPS_SC_CMD_GET_DEVICE_ID returned %s, \"%s\"\n",
statuses[scstatus], buffer);
length = 1;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_GET_STATE, buffer,
&length, 5.0);
printf("CUPS_SC_CMD_GET_STATE returned %s, %02X\n", statuses[scstatus],
buffer[0] & 255);
if (do_walk)
{
/*
* Walk the OID tree...
*/
scstatus = cupsSideChannelSNMPWalk(oid, 5.0, walk_cb, NULL);
printf("CUPS_SC_CMD_SNMP_WALK returned %s\n", statuses[scstatus]);
}
else
{
/*
* Lookup the same OID twice...
*/
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %d bytes (%s)\n", oid,
statuses[scstatus], (int)length, buffer);
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %d bytes (%s)\n", oid,
statuses[scstatus], (int)length, buffer);
}
length = 0;
scstatus = cupsSideChannelDoRequest(CUPS_SC_CMD_SOFT_RESET, buffer,
&length, 5.0);
printf("CUPS_SC_CMD_SOFT_RESET returned %s\n", statuses[scstatus]);
}
if (do_cancel)
{
sleep(1);
kill(data_pid, SIGTERM);
kill(back_pid, SIGTERM);
}
while ((pid = wait(&status)) > 0)
{
if (status)
{
if (WIFEXITED(status))
printf("%s exited with status %d!\n",
pid == back_pid ? backend : "test",
WEXITSTATUS(status));
else
printf("%s crashed with signal %d!\n",
pid == back_pid ? backend : "test",
WTERMSIG(status));
}
}
/*
* Exit accordingly...
*/
return (status != 0);
}
/*
* 'sigterm_handler()' - Flag when we get SIGTERM.
*/
static void
sigterm_handler(int sig) /* I - Signal */
{
(void)sig;
job_canceled = 1;
}
/*
* 'usage()' - Show usage information.
*/
static void
usage(void)
{
puts("Usage: testbackend [-cancel] [-d] [-ps | -pcl] [-s [-get OID] "
"[-walk OID]] [-t] device-uri job-id user title copies options [file]");
puts("");
puts("Options:");
puts(" -cancel Simulate a canceled print job after 2 seconds.");
puts(" -d Show log messages from backend.");
puts(" -get OID Lookup the specified SNMP OID.");
puts(" (.1.3.6.1.2.1.43.10.2.1.4.1.1 is a good one for printers)");
puts(" -pcl Send PCL+PJL query and test page to backend.");
puts(" -ps Send PostScript query and test page to backend.");
puts(" -s Do side-channel + SNMP tests.");
puts(" -t Send spaces slowly to backend ('trickle').");
puts(" -walk OID Walk the specified SNMP OID.");
puts(" (.1.3.6.1.2.1.43 is a good one for printers)");
exit(1);
}
/*
* 'walk_cb()' - Show results of cupsSideChannelSNMPWalk...
*/
static void
walk_cb(const char *oid, /* I - OID */
const char *data, /* I - Data */
int datalen, /* I - Length of data */
void *context) /* I - Context (unused) */
{
char temp[80];
(void)context;
if ((size_t)datalen > (sizeof(temp) - 1))
{
memcpy(temp, data, sizeof(temp) - 1);
temp[sizeof(temp) - 1] = '\0';
}
else
{
memcpy(temp, data, (size_t)datalen);
temp[datalen] = '\0';
}
printf("CUPS_SC_CMD_SNMP_WALK %s, %d bytes (%s)\n", oid, datalen, temp);
}
-67
Ver Arquivo
@@ -1,67 +0,0 @@
/*
* SNMP supplies test program for CUPS.
*
* Copyright © 2008-2011 by Apple Inc.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
/*
* 'main()' - Show the supplies state of a printer.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
http_addrlist_t *host; /* Host addresses */
int snmp_fd; /* SNMP socket */
int page_count, /* Current page count */
printer_state; /* Current printer state */
if (argc != 2)
{
puts("Usage: testsupplies ip-or-hostname");
return (1);
}
if ((host = httpAddrGetList(argv[1], AF_UNSPEC, "9100")) == NULL)
{
perror(argv[1]);
return (1);
}
if ((snmp_fd = _cupsSNMPOpen(host->addr.addr.sa_family)) < 0)
{
perror(argv[1]);
return (1);
}
for (;;)
{
fputs("backendSNMPSupplies: ", stdout);
if (backendSNMPSupplies(snmp_fd, &(host->addr), &page_count,
&printer_state))
{
puts("FAIL");
return (1);
}
printf("backendSNMPSupplies: %s (page_count=%d, printer_state=%d)\n",
page_count < 0 || printer_state < CUPS_TC_other ||
printer_state > CUPS_TC_warmup ? "FAIL" : "PASS",
page_count, printer_state);
sleep(5);
}
}
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-595
Ver Arquivo
@@ -1,595 +0,0 @@
/*
* USB port backend for CUPS.
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright © 2007-2013 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers.
*/
#include <sys/select.h>
/*
* Local functions...
*/
static int open_device(const char *uri, int *use_bc);
static int side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, 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 */
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 */
ssize_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
{
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
/*
* *BSD's ulpt driver currently does not support the
* back-channel, incorrectly returns data ready on a select(),
* and locks up on read()...
*/
use_bc = 0;
#elif defined(__sun)
/*
* CUPS STR #3028: Solaris' usbprn driver apparently does not support
* select() or poll(), so we can't support backchannel...
*/
use_bc = 0;
#else
/*
* Disable backchannel data when printing to Brother, Canon, or
* Minolta USB printers - apparently these printers will return
* the IEEE-1284 device ID over and over and over when they get
* a read request...
*/
use_bc = _cups_strcasecmp(hostname, "Brother") &&
_cups_strcasecmp(hostname, "Canon") &&
_cups_strncasecmp(hostname, "Konica", 6) &&
_cups_strncasecmp(hostname, "Minolta", 7);
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
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.
*/
_cupsLangPrintFilter(stderr, "INFO",
_("Unable to contact printer, queuing on next "
"printer in class."));
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
*/
sleep(5);
return (CUPS_BACKEND_FAILED);
}
if (errno == EBUSY)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
sleep(10);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
errno == ENODEV)
{
sleep(30);
}
else
{
_cupsLangPrintError("ERROR", _("Unable to open device file"));
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 &= ~(unsigned)(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);
}
#ifdef __sun
/*
* CUPS STR #3028: Solaris' usbprn driver apparently does not support
* select() or poll(), so we can't support the sidechannel either...
*/
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, NULL);
#else
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb);
#endif /* __sun */
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
}
/*
* Close the USB port and return...
*/
close(device_fd);
return (CUPS_BACKEND_OK);
}
/*
* '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 */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* Try to open each USB device...
*/
for (i = 0; i < 16; i ++)
{
/*
* Linux has a long history of changing the standard filenames used
* for USB printer devices. We get the honor of trying them all...
*/
sprintf(device, "/dev/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
{
if (errno != ENOENT)
continue;
sprintf(device, "/dev/usb/lp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
{
if (errno != ENOENT)
continue;
sprintf(device, "/dev/usb/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
continue;
}
}
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
cupsBackendReport("direct", device_uri, make_model, make_model,
device_id, NULL);
close(fd);
}
#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)))
cupsBackendReport("direct", device_uri, make_model, make_model,
device_id, NULL);
close(fd);
}
}
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
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...
*/
static 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 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...
*/
for (;;)
{
for (busy = 0, i = 0; i < 16; i ++)
{
/*
* Linux has a long history of changing the standard filenames used
* for USB printer devices. We get the honor of trying them all...
*/
sprintf(device, "/dev/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
{
sprintf(device, "/dev/usb/lp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
{
sprintf(device, "/dev/usb/usblp%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
continue;
}
}
if (fd >= 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)
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
sleep(5);
}
}
#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)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
sleep(5);
}
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#else
{
if (*use_bc)
fd = open(uri + 4, O_RDWR | O_EXCL);
else
fd = -1;
if (fd < 0)
{
fd = open(uri + 4, O_WRONLY | O_EXCL);
*use_bc = 0;
}
return (fd);
}
#endif /* __linux */
else
{
errno = ENODEV;
return (-1);
}
}
/*
* 'side_cb()' - Handle side-channel requests...
*/
static int /* O - 0 on success, -1 on error */
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int snmp_fd, /* I - SNMP socket (unused) */
http_addr_t *addr, /* I - Device address (unused) */
int use_bc) /* I - Using back-channel? */
{
cups_sc_command_t command; /* Request command */
cups_sc_status_t status; /* Request/response status */
char data[2048]; /* Request/response data */
int datalen; /* Request/response data size */
(void)snmp_fd;
(void)addr;
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
return (-1);
switch (command)
{
case CUPS_SC_CMD_DRAIN_OUTPUT :
if (backendDrainOutput(print_fd, device_fd))
status = CUPS_SC_STATUS_IO_ERROR;
else if (tcdrain(device_fd))
status = CUPS_SC_STATUS_IO_ERROR;
else
status = CUPS_SC_STATUS_OK;
datalen = 0;
break;
case CUPS_SC_CMD_GET_BIDI :
status = CUPS_SC_STATUS_OK;
data[0] = use_bc;
datalen = 1;
break;
case CUPS_SC_CMD_GET_DEVICE_ID :
memset(data, 0, sizeof(data));
if (backendGetDeviceID(device_fd, data, sizeof(data) - 1,
NULL, 0, NULL, NULL, 0))
{
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
}
else
{
status = CUPS_SC_STATUS_OK;
datalen = strlen(data);
}
break;
default :
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
break;
}
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+345 -154
Ver Arquivo
@@ -1,31 +1,50 @@
/*
* USB printer backend for CUPS.
* "$Id$"
*
* Copyright © 2007-2012 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
* USB port backend for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
* Copyright 1997-2001 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Send a file to the specified USB port.
* list_devices() - List all USB devices.
*/
/*
* Include necessary headers.
*/
#ifdef __APPLE__
/* A header order dependency requires this be first */
# include <ApplicationServices/ApplicationServices.h>
#endif /* __APPLE__ */
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <signal.h>
#include "backend-private.h"
#ifdef _WIN32
#if defined(WIN32) || defined(__EMX__)
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
# include <termios.h>
#endif /* _WIN32 */
#endif /* WIN32 || __EMX__ */
/*
@@ -33,79 +52,6 @@
*/
void list_devices(void);
int print_device(const char *uri, const char *hostname,
const char *resource, char *options,
int print_fd, int copies, int argc, char *argv[]);
/*
* Include the vendor-specific USB implementation...
*/
#ifdef HAVE_LIBUSB
# include "usb-libusb.c"
#elif defined(__APPLE__)
# include "usb-darwin.c"
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
# 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 */
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 /* HAVE_LIBUSB */
/*
@@ -116,22 +62,27 @@ print_device(const char *uri, /* I - Device URI */
* 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 */
{
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 */
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 */
#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 */
@@ -141,20 +92,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -162,32 +99,44 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 1)
{
list_devices();
return (CUPS_BACKEND_OK);
return (0);
}
else if (argc < 6 || argc > 7)
{
_cupsLangPrintf(stderr,
_("Usage: %s job-id user title copies options [file]"),
argv[0]);
return (CUPS_BACKEND_FAILED);
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]);
}
/*
* Extract the device name and options from the URI...
*/
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)
{
_cupsLangPrintFilter(stderr, "ERROR",
_("No device URI found in argv[0] or in DEVICE_URI "
"environment variable."));
return (1);
}
httpSeparate(argv[0], method, username, hostname, &port, resource);
/*
* See if there are any options...
@@ -204,43 +153,285 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
* Open the USB port device...
*/
if (argc == 6)
do
{
print_fd = 0;
copies = 1;
}
else
{
/*
* Try to open the print file...
*/
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
{
_cupsLangPrintError("ERROR", _("Unable to open print file"));
return (CUPS_BACKEND_FAILED);
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);
}
}
copies = atoi(argv[4]);
}
while (fd < 0);
/*
* Set any options provided...
*/
tcgetattr(fd, &opts);
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
tcsetattr(fd, TCSANOW, &opts);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page...
*/
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Finally, send the print file...
*/
status = print_device(uri, hostname, resource, options, print_fd, copies,
argc, argv);
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);
}
}
/*
* Close the input file and return...
* Close the socket connection and input file and return...
*/
if (print_fd != 0)
close(print_fd);
close(fd);
if (fp != stdin)
fclose(fp);
return (status);
return (0);
}
/*
* 'list_devices()' - List all USB devices.
*/
void
list_devices(void)
{
#ifdef __linux
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
FILE *probe; /* /proc/bus/usb/devices file */
char line[1024], /* Line from file */
*delim, /* Delimiter in file */
make[IPP_MAX_NAME], /* Make from file */
model[IPP_MAX_NAME]; /* Model from file */
/*
* First try opening one of the USB devices to load the driver
* module as needed...
*/
if ((fd = open("/dev/usb/lp0", O_WRONLY)) >= 0)
close(fd); /* 2.3.x and 2.4.x */
else if ((fd = open("/dev/usb/usblp0", O_WRONLY)) >= 0)
close(fd); /* Mandrake 7.x */
else if ((fd = open("/dev/usblp0", O_WRONLY)) >= 0)
close(fd); /* 2.2.x */
/*
* Then look at the device list for the USB bus...
*/
if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL)
{
/*
* Scan the device list...
*/
i = 0;
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
while (fgets(line, sizeof(line), probe) != NULL)
{
/*
* Strip trailing newline.
*/
if ((delim = strrchr(line, '\n')) != NULL)
*delim = '\0';
/*
* See if it is a printer device ("P: ...")
*/
if (strncmp(line, "S:", 2) == 0)
{
/*
* String attribute...
*/
if (strncmp(line, "S: Manufacturer=", 17) == 0)
{
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 ||
strstr(line, "Driver=usblp") != NULL) &&
make[0] && model[0])
{
/*
* We were processing a printer device; send the info out...
*/
sprintf(device, "/dev/usb/lp%d", i);
if (access(device, 0))
{
sprintf(device, "/dev/usb/usblp%d", i);
if (access(device, 0))
sprintf(device, "/dev/usblp%d", i);
}
printf("direct usb:%s \"%s %s\" \"USB Printer #%d\"\n",
device, make, model, i + 1);
i ++;
memset(make, 0, sizeof(make));
memset(model, 0, sizeof(model));
}
}
fclose(probe);
}
else
{
/*
* Just probe manually for USB devices...
*/
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/usb/usblp%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__)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
for (i = 0; i < 3; i ++)
{
sprintf(device, "/dev/unlpt%d", i);
if ((fd = open(device, O_WRONLY)) >= 0)
{
close(fd);
printf("direct usb:%s \"Unknown\" \"USB Port #%d\"\n", device, i + 1);
}
}
#elif defined(__NetBSD__) || defined(__OpenBSD__)
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
}
/*
* End of "$Id$".
*/
-24
Ver Arquivo
@@ -1,24 +0,0 @@
lpc.o: lpc.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
../cups/versioning.h ../cups/array-private.h ../cups/array.h \
../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h
lpq.o: lpq.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
../cups/versioning.h ../cups/array-private.h ../cups/array.h \
../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h
lpr.o: lpr.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
../cups/versioning.h ../cups/array-private.h ../cups/array.h \
../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/thread-private.h
lprm.o: lprm.c ../cups/cups-private.h ../cups/string-private.h \
../config.h ../cups/versioning.h ../cups/array-private.h \
../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
../cups/http-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/pwg-private.h ../cups/thread-private.h
+38 -94
Ver Arquivo
@@ -1,15 +1,29 @@
#
# Berkeley commands makefile for CUPS.
# "$Id$"
#
# Copyright 2007-2019 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more information.
# Copyright 1997-2001 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
# property of Easy Software Products and are protected by Federal
# copyright law. Distribution and use rights are outlined in the file
# "LICENSE.txt" which should have been included with this file. If this
# file is missing or damaged please contact Easy Software Products
# at:
#
# Attn: CUPS Licensing Information
# Easy Software Products
# 44141 Airport View Drive, Suite 204
# Hollywood, Maryland 20636-3111 USA
#
# Voice: (301) 373-9603
# EMail: cups-info@cups.org
# WWW: http://www.cups.org
#
include ../Makedefs
TARGETS = lpc lpq lpr lprm
OBJS = lpc.o lpq.o lpr.o lprm.o
@@ -21,20 +35,6 @@ OBJS = lpc.o lpq.o lpr.o lprm.o
all: $(TARGETS)
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all object files...
#
@@ -43,75 +43,17 @@ clean:
$(RM) $(OBJS) $(TARGETS)
#
# Update dependencies (without system header dependencies...)
#
depend:
$(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
#
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
#
# Install programs...
#
install-exec:
echo Installing Berkeley user printing commands in $(BINDIR)...
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_BIN) lpq $(BINDIR)
$(INSTALL_BIN) lpr $(BINDIR)
$(INSTALL_BIN) lprm $(BINDIR)
echo Installing Berkeley admin printing commands in $(BINDIR)...
$(INSTALL_DIR) -m 755 $(SBINDIR)
install:
-$(MKDIR) $(BINDIR)
$(CHMOD) ugo+rx $(BINDIR)
$(INSTALL_BIN) lpq lpr lprm $(BINDIR)
-$(MKDIR) $(SBINDIR)
$(CHMOD) ugo+rx $(SBINDIR)
$(INSTALL_BIN) lpc $(SBINDIR)
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(TARGETS); do \
cp $$file $(SYMROOT); \
dsymutil $(SYMROOT)/$$file; \
done \
fi
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall all targets...
#
uninstall:
$(RM) $(BINDIR)/lpq
$(RM) $(BINDIR)/lpr
$(RM) $(BINDIR)/lprm
$(RM) $(SBINDIR)/lpc
-$(RMDIR) $(SBINDIR)
-$(RMDIR) $(BINDIR)
#
@@ -120,8 +62,9 @@ uninstall:
lpc: lpc.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o lpc lpc.o $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
lpc.o: ../cups/cups.h ../Makedefs
#
@@ -130,8 +73,9 @@ lpc: lpc.o ../cups/$(LIBCUPS)
lpq: lpq.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o lpq lpq.o $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
lpq.o: ../cups/cups.h ../Makedefs
#
@@ -140,8 +84,9 @@ lpq: lpq.o ../cups/$(LIBCUPS)
lpr: lpr.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o lpr lpr.o $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
lpr.o: ../cups/cups.h ../Makedefs
#
@@ -150,12 +95,11 @@ lpr: lpr.o ../cups/$(LIBCUPS)
lprm: lprm.o ../cups/$(LIBCUPS)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o lprm lprm.o $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
lprm.o: ../cups/cups.h ../Makedefs
#
# Dependencies...
# End of "$Id$".
#
include Dependencies
+199 -145
Ver Arquivo
@@ -1,27 +1,55 @@
/*
* "lpc" command for CUPS.
* "$Id$"
*
* Copyright 2007-2014 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* "lpc" command for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Parse options and commands.
* compare_strings() - Compare two command-line strings.
* do_command() - Do an lpc command...
* show_help() - Show help messages.
* show_status() - Show printers.
*/
/*
* Include necessary headers...
*/
#include <cups/cups-private.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/debug.h>
/*
* Local functions...
*/
static int compare_strings(const char *, const char *, size_t);
static void do_command(http_t *, const char *, const char *);
static void show_help(const char *);
static void show_status(http_t *, const char *);
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 *);
/*
@@ -29,21 +57,19 @@ static void show_status(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 */
{
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(argv);
/*
* Connect to the scheduler...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
http = httpConnect(cupsServer(), ippPort());
if (argc > 1)
{
@@ -59,59 +85,39 @@ main(int argc, /* I - Number of command-line arguments */
* Do the command prompt thing...
*/
_cupsLangPuts(stdout, _("lpc> ")); /* TODO: Need no-newline version */
printf("lpc> ");
while (fgets(line, sizeof(line), stdin) != NULL)
{
/*
* Strip trailing whitespace...
* Strip the trailing newline...
*/
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> ")); /* TODO: Need no newline version */
continue;
}
line[strlen(line) - 1] = '\0';
/*
* Find any options in the string...
*/
while (isspace(line[0]))
strcpy(line, line + 1);
for (params = line; *params != '\0'; params ++)
if (isspace(*params & 255))
if (isspace(*params))
break;
/*
* Remove whitespace between the command and parameters...
*/
while (isspace(*params & 255))
while (isspace(*params))
*params++ = '\0';
/*
* The "quit" and "exit" commands exit; otherwise, process as needed...
*/
if (!compare_strings(line, "quit", 1) ||
!compare_strings(line, "exit", 2))
if (compare_strings(line, "quit", 1) == 0 ||
compare_strings(line, "exit", 2) == 0)
break;
if (*params == '\0')
@@ -123,7 +129,7 @@ main(int argc, /* I - Number of command-line arguments */
* Put another prompt out to the user...
*/
_cupsLangPuts(stdout, _("lpc> ")); /* TODO: Need no newline version */
printf("lpc> ");
}
}
@@ -141,12 +147,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(const char *s, /* I - Command-line string */
const char *t, /* I - Option string */
size_t tmin) /* I - Minimum number of unique chars in option */
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 */
{
size_t slen; /* Length of command-line string */
int slen; /* Length of command-line string */
slen = strlen(s);
@@ -162,18 +168,17 @@ compare_strings(const char *s, /* I - Command-line string */
*/
static void
do_command(http_t *http, /* I - HTTP connection to server */
const char *command, /* I - Command string */
const char *params) /* I - Parameters for command */
do_command(http_t *http, /* I - HTTP connection to server */
char *command, /* I - Command string */
char *params) /* I - Parameters for command */
{
if (!compare_strings(command, "status", 4))
if (compare_strings(command, "status", 4) == 0)
show_status(http, params);
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
else if (compare_strings(command, "help", 1) == 0 ||
strcmp(command, "?") == 0)
show_help(params);
else
_cupsLangPrintf(stdout,
_("%s is not implemented by the CUPS version of lpc."),
command);
printf("%s is not implemented by the CUPS version of lpc.\n", command);
}
@@ -182,21 +187,21 @@ do_command(http_t *http, /* I - HTTP connection to server */
*/
static void
show_help(const char *command) /* I - Command to describe or NULL */
show_help(char *command) /* I - Command to describe or NULL */
{
if (!command)
if (command == NULL)
{
_cupsLangPrintf(stdout,
_("Commands may be abbreviated. Commands are:\n"
"\n"
"exit help quit status ?"));
puts("Commands may be abbreviated. Commands are:");
puts("");
puts("exit help quit status ?");
}
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
_cupsLangPrintf(stdout, _("help\t\tGet help on commands."));
else if (!compare_strings(command, "status", 4))
_cupsLangPrintf(stdout, _("status\t\tShow status of daemon and queue."));
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
_cupsLangPrintf(stdout, _("?Invalid help command unknown."));
puts("?Invalid help command unknown");
}
@@ -205,31 +210,36 @@ show_help(const char *command) /* I - Command to describe or NULL */
*/
static void
show_status(http_t *http, /* I - HTTP connection to server */
const char *dests) /* I - Destinations */
show_status(http_t *http, /* I - HTTP connection to server */
char *dests) /* I - Destinations */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
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 */
static const char *requested[] = /* Requested attributes */
{
"device-uri",
"printer-is-accepting-jobs",
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 */
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 */
char printer_uri[HTTP_MAX_URI];
/* Printer URI */
static const char *requested[] =
{ /* Requested attributes */
"printer-name",
"device-uri",
"printer-state",
"queued-job-count"
"printer-is-accepting-jobs"
};
DEBUG_printf(("show_status(%08x, %08x)\n", http, dests));
if (http == NULL)
return;
@@ -241,7 +251,18 @@ show_status(http_t *http, /* I - HTTP connection to server */
* attributes-natural-language
*/
request = ippNewRequest(CUPS_GET_PRINTERS);
request = ippNew();
request->request.op.operation_id = CUPS_GET_PRINTERS;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(requested) / sizeof(requested[0]),
@@ -251,8 +272,10 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Do the request and get back a response...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
if ((response = cupsDoRequest(http, request, "/printers/")) != NULL)
{
DEBUG_puts("show_status: request succeeded...");
/*
* Loop through the printers returned in the list and display
* their status...
@@ -282,21 +305,21 @@ show_status(http_t *http, /* I - HTTP connection to server */
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
if (!strcmp(attr->name, "device-uri") &&
if (strcmp(attr->name, "printer-name") == 0 &&
attr->value_tag == IPP_TAG_NAME)
printer = attr->values[0].string.text;
if (strcmp(attr->name, "device-uri") == 0 &&
attr->value_tag == IPP_TAG_URI)
device = attr->values[0].string.text;
else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
attr->value_tag == IPP_TAG_BOOLEAN)
accepting = attr->values[0].boolean;
else if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
printer = attr->values[0].string.text;
else if (!strcmp(attr->name, "printer-state") &&
attr->value_tag == IPP_TAG_ENUM)
if (strcmp(attr->name, "printer-state") == 0 &&
attr->value_tag == IPP_TAG_ENUM)
pstate = (ipp_pstate_t)attr->values[0].integer;
else if (!strcmp(attr->name, "queued-job-count") &&
attr->value_tag == IPP_TAG_INTEGER)
jobcount = attr->values[0].integer;
if (strcmp(attr->name, "printer-is-accepting-jobs") == 0 &&
attr->value_tag == IPP_TAG_BOOLEAN)
accepting = attr->values[0].boolean;
attr = attr->next;
}
@@ -313,13 +336,6 @@ 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...
*/
@@ -334,7 +350,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip leading whitespace and commas...
*/
while (isspace(*dptr & 255) || *dptr == ',')
while (isspace(*dptr) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -346,11 +362,9 @@ show_status(http_t *http, /* I - HTTP connection to server */
for (ptr = printer;
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
ptr ++, dptr ++)
/* do nothing */;
ptr ++, dptr ++);
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
isspace(*dptr & 255)))
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr)))
{
match = 1;
break;
@@ -360,9 +374,9 @@ show_status(http_t *http, /* I - HTTP connection to server */
* Skip trailing junk...
*/
while (!isspace(*dptr & 255) && *dptr != '\0')
while (!isspace(*dptr) && *dptr != '\0')
dptr ++;
while (isspace(*dptr & 255) || *dptr == ',')
while (isspace(*dptr) || *dptr == ',')
dptr ++;
if (*dptr == '\0')
@@ -376,46 +390,81 @@ 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.
*/
if (pstate == IPP_PRINTER_PROCESSING)
{
/*
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* limit
*/
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);
snprintf(printer_uri, sizeof(printer_uri),
"ipp://localhost/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, "/jobs/")) != NULL)
{
for (jattr = jobs->attrs; jattr != NULL; jattr = jattr->next)
if (jattr->name && strcmp(jattr->name, "job-id") == 0)
jobcount ++;
ippDelete(jobs);
}
}
/*
* Display it...
*/
printf("%s:\n", printer);
if (!strncmp(device, "file:", 5))
_cupsLangPrintf(stdout,
_("\tprinter is on device \'%s\' speed -1"),
device + 5);
if (strncmp(device, "file:", 5) == 0)
printf("\tprinter is on device \'%s\' speed -1\n", device + 5);
else
{
/*
* Just show the scheme...
* Just show the method...
*/
if ((delimiter = strchr(device, ':')) != NULL )
{
*delimiter = '\0';
_cupsLangPrintf(stdout,
_("\tprinter is on device \'%s\' speed -1"),
device);
}
*strchr(device, ':') = '\0';
printf("\tprinter is on device \'%s\' speed -1\n", device);
}
if (accepting)
_cupsLangPuts(stdout, _("\tqueuing is enabled"));
else
_cupsLangPuts(stdout, _("\tqueuing is disabled"));
if (pstate != IPP_PRINTER_STOPPED)
_cupsLangPuts(stdout, _("\tprinting is enabled"));
else
_cupsLangPuts(stdout, _("\tprinting is disabled"));
printf("\tqueuing is %sabled\n", accepting ? "en" : "dis");
printf("\tprinting is %sabled\n",
pstate == IPP_PRINTER_STOPPED ? "dis" : "en");
if (jobcount == 0)
_cupsLangPuts(stdout, _("\tno entries"));
puts("\tno entries");
else
_cupsLangPrintf(stdout, _("\t%d entries"), jobcount);
_cupsLangPuts(stdout, _("\tdaemon present"));
printf("\t%d entries\n", jobcount);
puts("\tdaemon present");
}
if (attr == NULL)
@@ -425,3 +474,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
ippDelete(response);
}
}
/*
* End of "$Id$".
*/
+227 -339
Ver Arquivo
@@ -1,29 +1,57 @@
/*
* "lpq" command for CUPS.
* "$Id$"
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 1997-2006 by Easy Software Products.
* "lpq" command for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Parse options and commands.
* show_jobs() - Show jobs.
* show_printer() - Show printer status.
*/
/*
* Include necessary headers...
*/
#include <cups/cups-private.h>
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <config.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/debug.h>
/*
* Local functions...
*/
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) _CUPS_NORETURN;
static int show_jobs(http_t *, const char *, const char *, const int,
const int);
static void show_printer(http_t *, const char *);
/*
@@ -31,218 +59,99 @@ static void usage(void) _CUPS_NORETURN;
*/
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 *opt, /* Option pointer */
*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 */
cups_dest_t *named_dest; /* Named destination */
int i; /* Looping var */
http_t *http; /* Connection to server */
const char *dest, /* Desired printer */
*user; /* Desired user */
char *instance; /* Printer instance */
int id, /* Desired job ID */
interval, /* Reporting interval */
longstatus; /* Show file details */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
http_encryption_t encryption; /* Encryption? */
_cupsSetLocale(argv);
/*
* Connect to the scheduler...
*/
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
{
fputs("lpq: Unable to contact server!\n", stderr);
return (1);
}
/*
* Check for command-line options...
*/
http = NULL;
dest = NULL;
user = NULL;
id = 0;
interval = 0;
longstatus = 0;
all = 0;
num_dests = cupsGetDests(&dests);
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
for (i = 1; i < argc; i ++)
{
if (argv[i][0] == '+')
{
interval = atoi(argv[i] + 1);
}
else if (!strcmp(argv[i], "--help"))
usage();
else if (argv[i][0] == '-')
{
for (opt = argv[i] + 1; *opt; opt ++)
switch (argv[i][1])
{
switch (*opt)
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
case 'E' : /* Encrypt */
#ifdef HAVE_LIBSSL
encryption = HTTP_ENCRYPT_REQUIRED;
if (http)
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
if (http)
httpEncryption(http, encryption);
#else
_cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."), argv[0]);
#endif /* HAVE_SSL */
break;
fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
argv[0]);
#endif /* HAVE_LIBSSL */
break;
case 'U' : /* Username */
if (opt[1] != '\0')
{
cupsSetUser(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected username after \"-U\" option."), argv[0]);
return (1);
}
case 'P' : /* Printer */
if (argv[i][2])
dest = argv[i] + 2;
else
{
i ++;
dest = argv[i];
}
cupsSetUser(argv[i]);
}
break;
if ((instance = strchr(dest, '/')) != NULL)
*instance = '\0';
break;
case 'P' : /* Printer */
if (opt[1] != '\0')
{
dest = opt + 1;
opt += strlen(opt) - 1;
}
else
{
i ++;
case 'a' : /* All printers */
dest = NULL;
break;
if (i >= argc)
{
httpClose(http);
case 'l' : /* Long status */
longstatus = 1;
break;
usage();
}
dest = argv[i];
}
if ((instance = strchr(dest, '/')) != NULL)
*instance++ = '\0';
http = connect_server(argv[0], http);
if ((named_dest = cupsGetNamedDest(http, dest, instance)) == NULL)
{
if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
_cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
else if (instance)
_cupsLangPrintf(stderr, _("%s: Error - unknown destination \"%s/%s\"."), argv[0], dest, instance);
else
_cupsLangPrintf(stderr, _("%s: Unknown destination \"%s\"."), argv[0], dest);
return (1);
}
cupsFreeDests(1, named_dest);
break;
case 'a' : /* All printers */
all = 1;
break;
case 'h' : /* Connect to host */
if (http)
{
httpClose(http);
http = NULL;
}
if (opt[1] != '\0')
{
cupsSetServer(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected hostname after \"-h\" option."), argv[0]);
return (1);
}
else
cupsSetServer(argv[i]);
}
break;
case 'l' : /* Long status */
longstatus = 1;
break;
default :
httpClose(http);
usage();
}
default :
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
}
}
else if (isdigit(argv[i][0] & 255))
{
else if (isdigit(argv[i][0]))
id = atoi(argv[i]);
}
else
{
user = argv[i];
}
}
http = connect_server(argv[0], http);
if (dest == NULL && !all)
{
if ((named_dest = cupsGetNamedDest(http, NULL, NULL)) == NULL)
{
if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
_cupsLangPrintf(stderr,
_("%s: Error - add '/version=1.1' to server name."),
argv[0]);
return (1);
}
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 && val)
_cupsLangPrintf(stderr,
_("%s: Error - %s environment variable names "
"non-existent destination \"%s\"."), argv[0], val,
dest);
else
_cupsLangPrintf(stderr,
_("%s: Error - no default destination available."),
argv[0]);
httpClose(http);
return (1);
}
dest = named_dest->name;
}
/*
* Show the status in a loop...
@@ -251,14 +160,14 @@ main(int argc, /* I - Number of command-line arguments */
for (;;)
{
if (dest)
show_printer(argv[0], http, dest);
show_printer(http, dest);
i = show_jobs(argv[0], http, dest, user, id, longstatus);
i = show_jobs(http, dest, user, id, longstatus);
if (i && interval)
{
fflush(stdout);
sleep((unsigned)interval);
sleep(interval);
}
else
break;
@@ -268,75 +177,44 @@ 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."), command);
exit(1);
}
}
return (http);
}
/*
* 'show_jobs()' - Show jobs.
*/
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 */
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 */
{
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 */
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 * const jobattrs[] =/* Job attributes we want to see */
{
"copies",
"job-id",
"job-k-octets",
"job-name",
"job-originating-user-name",
"job-printer-uri",
"job-priority",
"job-state"
};
static const char * const ranks[10] = /* Ranking strings */
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 */
#ifdef __osf__
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 */
{
"th",
"st",
@@ -351,6 +229,9 @@ show_jobs(const char *command, /* I - Command name */
};
DEBUG_printf(("show_jobs(%08x, %08x, %08x, %d, %d)\n", http, dest, user, id,
longstatus));
if (http == NULL)
return (0);
@@ -361,29 +242,38 @@ show_jobs(const char *command, /* I - Command name */
* attributes-charset
* attributes-natural-language
* job-uri or printer-uri
* requested-attributes
* requesting-user-name
*/
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
request = ippNew();
if (id)
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);
if (dest == NULL)
{
snprintf(resource, sizeof(resource), "ipp://localhost/jobs/%d", id);
if (id)
sprintf(resource, "ipp://localhost/jobs/%d", id);
else
strcpy(resource, "ipp://localhost/jobs");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, resource);
}
else if (dest)
else
{
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
NULL, "localhost", 0, "/printers/%s", dest);
snprintf(resource, sizeof(resource), "ipp://localhost/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, resource);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/");
if (user)
{
@@ -391,13 +281,6 @@ show_jobs(const char *command, /* I - Command name */
"requesting-user-name", NULL, user);
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
(int)(sizeof(jobattrs) / sizeof(jobattrs[0])), NULL, jobattrs);
/*
* Do the request and get back a response...
@@ -409,7 +292,8 @@ show_jobs(const char *command, /* I - Command name */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
fprintf(stderr, "lpq: get-jobs failed: %s\n",
ippErrorString(response->request.status.status_code));
ippDelete(response);
return (0);
}
@@ -438,40 +322,49 @@ show_jobs(const char *command, /* I - Command name */
jobid = 0;
jobsize = 0;
#ifdef __osf__
jobpriority = 50;
#endif /* __osf__ */
jobstate = IPP_JOB_PENDING;
jobname = "unknown";
jobuser = "unknown";
jobname = "untitled";
jobuser = NULL;
jobdest = NULL;
jobcopies = 1;
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
{
if (!strcmp(attr->name, "job-id") &&
if (strcmp(attr->name, "job-id") == 0 &&
attr->value_tag == IPP_TAG_INTEGER)
jobid = attr->values[0].integer;
if (!strcmp(attr->name, "job-k-octets") &&
if (strcmp(attr->name, "job-k-octets") == 0 &&
attr->value_tag == IPP_TAG_INTEGER)
jobsize = attr->values[0].integer;
jobsize = attr->values[0].integer * 1024;
if (!strcmp(attr->name, "job-state") &&
#ifdef __osf__
if (strcmp(attr->name, "job-priority") == 0 &&
attr->value_tag == IPP_TAG_INTEGER)
jobpriority = attr->values[0].integer;
#endif /* __osf__ */
if (strcmp(attr->name, "job-state") == 0 &&
attr->value_tag == IPP_TAG_ENUM)
jobstate = (ipp_jstate_t)attr->values[0].integer;
if (!strcmp(attr->name, "job-printer-uri") &&
if (strcmp(attr->name, "job-printer-uri") == 0 &&
attr->value_tag == IPP_TAG_URI)
if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL)
jobdest ++;
if (!strcmp(attr->name, "job-originating-user-name") &&
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
attr->value_tag == IPP_TAG_NAME)
jobuser = attr->values[0].string.text;
if (!strcmp(attr->name, "job-name") &&
if (strcmp(attr->name, "job-name") == 0 &&
attr->value_tag == IPP_TAG_NAME)
jobname = attr->values[0].string.text;
if (!strcmp(attr->name, "copies") &&
if (strcmp(attr->name, "copies") == 0 &&
attr->value_tag == IPP_TAG_INTEGER)
jobcopies = attr->values[0].integer;
@@ -491,9 +384,11 @@ show_jobs(const char *command, /* I - Command name */
}
if (!longstatus && jobcount == 0)
_cupsLangPuts(stdout,
_("Rank Owner Job File(s)"
" Total Size"));
#ifdef __osf__
puts("Rank Owner Pri Job Files Total Size");
#else
puts("Rank Owner Job File(s) Total Size");
#endif /* __osf__ */
jobcount ++;
@@ -502,41 +397,37 @@ show_jobs(const char *command, /* I - Command name */
*/
if (jobstate == IPP_JOB_PROCESSING)
strlcpy(rankstr, "active", sizeof(rankstr));
strcpy(rankstr, "active");
else
{
/*
* 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]);
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
rank ++;
}
if (longstatus)
{
_cupsLangPuts(stdout, "\n");
puts("");
if (jobcopies > 1)
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
jobname);
else
strlcpy(namestr, jobname, sizeof(namestr));
{
strncpy(namestr, jobname, sizeof(namestr) - 1);
namestr[sizeof(namestr) - 1] = '\0';
}
_cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]"),
jobuser, rankstr, jobid);
_cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes"),
namestr, 1024.0 * jobsize);
printf("%s: %-34.34s[job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-40.40s%d bytes\n", namestr, jobsize);
}
else
_cupsLangPrintf(stdout,
_("%-7s %-7.7s %-7d %-31.31s %.0f bytes"),
rankstr, jobuser, jobid, jobname, 1024.0 * jobsize);
#ifdef __osf__
printf("%-6s %-10.10s %-4d %-10d %-27.27s %d bytes\n", rankstr, jobuser,
jobpriority, jobid, jobname, jobsize);
#else
printf("%-7s %-8.8s%-8d%-32.32s%d bytes\n", rankstr, jobuser,
jobid, jobname, jobsize);
#endif /* __osf */
if (attr == NULL)
break;
@@ -546,12 +437,12 @@ show_jobs(const char *command, /* I - Command name */
}
else
{
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
fprintf(stderr, "lpq: get-jobs failed: %s\n", ippErrorString(cupsLastError()));
return (0);
}
if (jobcount == 0)
_cupsLangPuts(stdout, _("no entries"));
puts("no entries");
return (jobcount);
}
@@ -562,15 +453,16 @@ show_jobs(const char *command, /* I - Command name */
*/
static void
show_printer(const char *command, /* I - Command name */
http_t *http, /* I - HTTP connection to server */
const char *dest) /* I - Destination */
show_printer(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 */
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 */
cups_lang_t *language; /* Default language */
ipp_pstate_t state; /* Printer state */
char uri[HTTP_MAX_URI];
/* Printer URI */
if (http == NULL)
@@ -585,10 +477,20 @@ show_printer(const char *command, /* I - Command name */
* printer-uri
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request = ippNew();
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
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);
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
@@ -600,7 +502,8 @@ show_printer(const char *command, /* I - Command name */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
fprintf(stderr, "lpq: get-printer-attributes failed: %s\n",
ippErrorString(response->request.status.status_code));
ippDelete(response);
return;
}
@@ -613,39 +516,24 @@ show_printer(const char *command, /* I - Command name */
switch (state)
{
case IPP_PRINTER_IDLE :
_cupsLangPrintf(stdout, _("%s is ready"), dest);
printf("%s is ready\n", dest);
break;
case IPP_PRINTER_PROCESSING :
_cupsLangPrintf(stdout, _("%s is ready and printing"),
dest);
printf("%s is ready and printing\n", dest);
break;
case IPP_PRINTER_STOPPED :
_cupsLangPrintf(stdout, _("%s is not ready"), dest);
printf("%s is not ready\n", dest);
break;
}
ippDelete(response);
}
else
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
fprintf(stderr, "lpq: get-printer-attributes failed: %s\n",
ippErrorString(cupsLastError()));
}
/*
* 'usage()' - Show program usage.
* End of "$Id$".
*/
static void
usage(void)
{
_cupsLangPuts(stderr, _("Usage: lpq [options] [+interval]"));
_cupsLangPuts(stdout, _("Options:"));
_cupsLangPuts(stdout, _("-a Show jobs on all destinations"));
_cupsLangPuts(stdout, _("-E Encrypt the connection to the server"));
_cupsLangPuts(stdout, _("-h server[:port] Connect to the named server and port"));
_cupsLangPuts(stdout, _("-l Show verbose (long) output"));
_cupsLangPuts(stdout, _("-P destination Show status for the specified destination"));
_cupsLangPuts(stdout, _("-U username Specify the username to use for authentication"));
exit(1);
}
+300 -330
Ver Arquivo
@@ -1,25 +1,60 @@
/*
* "lpr" command for CUPS.
* "$Id$"
*
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products.
* "lpr" command for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Parse options and send files for printing.
* sighandler() - Signal catcher for when we print from stdin...
*/
/*
* Include necessary headers...
*/
#include <cups/cups-private.h>
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include <cups/cups.h>
#ifndef WIN32
# include <signal.h>
/*
* Local functions...
* Local functions.
*/
static void usage(void) _CUPS_NORETURN;
void sighandler(int);
#endif /* !WIN32 */
/*
* Globals...
*/
char tempfile[1024]; /* Temporary file for printing from stdin */
/*
@@ -27,284 +62,225 @@ static void usage(void) _CUPS_NORETURN;
*/
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 ch; /* Option character */
char *printer, /* Destination printer or class */
*instance, /* Instance */
*opt; /* Option pointer */
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 */
cups_dest_t *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 */
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 */
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 */
int temp; /* Temporary file descriptor */
#ifdef HAVE_SIGACTION
struct sigaction action; /* Signal action */
#endif /* HAVE_SIGACTION */
_cupsSetLocale(argv);
deletefile = 0;
printer = NULL;
dest = NULL;
num_dests = 0;
dests = NULL;
num_options = 0;
options = NULL;
num_files = 0;
title = NULL;
for (i = 1; i < argc; i ++)
{
if (!strcmp(argv[i], "--help"))
usage();
else if (argv[i][0] == '-')
{
for (opt = argv[i] + 1; *opt; opt ++)
if (argv[i][0] == '-')
switch (ch = argv[i][1])
{
switch (ch = *opt)
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
case 'E' : /* Encrypt */
#ifdef HAVE_LIBSSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."), argv[0]);
#endif /* HAVE_SSL */
break;
fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
argv[0]);
#endif /* HAVE_LIBSSL */
break;
case 'U' : /* Username */
if (opt[1] != '\0')
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)
{
cupsSetUser(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected username after \"-U\" option."), argv[0]);
usage();
}
cupsSetUser(argv[i]);
}
break;
case 'H' : /* Connect to host */
if (opt[1] != '\0')
{
cupsSetServer(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected hostname after \"-H\" option."), argv[0]);
usage();
}
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 (opt[1] != '\0')
{
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr,
_("%s: Error - expected value after \"-%c\" "
"option."), argv[0], ch);
usage();
}
}
case 'c' : /* CIFPLOT */
case 'd' : /* DVI */
case 'f' : /* FORTRAN */
case 'g' : /* plot */
case 'n' : /* Ditroff */
case 't' : /* Troff */
case 'v' : /* Raster image */
_cupsLangPrintf(stderr, _("%s: Warning - \"%c\" format modifier not supported - output may not be correct."), argv[0], ch);
break;
case 'o' : /* Option */
if (opt[1] != '\0')
{
num_options = cupsParseOptions(opt + 1, num_options, &options);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected option=value after \"-o\" option."), argv[0]);
usage();
}
num_options = cupsParseOptions(argv[i], num_options, &options);
}
break;
case 'l' : /* Literal/raw */
num_options = cupsAddOption("raw", "true", num_options, &options);
break;
case 'p' : /* Prettyprint */
num_options = cupsAddOption("prettyprint", "true", 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 */
{
char email[1024]; /* EMail address */
snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(), httpGetHostname(NULL, buffer, sizeof(buffer)));
num_options = cupsAddOption("notify-recipient-uri", 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 */
deletefile = 1;
break;
case 'P' : /* Destination printer or class */
if (opt[1] != '\0')
{
printer = opt + 1;
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected destination after \"-P\" option."), argv[0]);
usage();
}
printer = argv[i];
}
if ((instance = strrchr(printer, '/')) != NULL)
*instance++ = '\0';
if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
{
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);
}
else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
_cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
fprintf(stderr, "lpr: Expected value after -%c option!\n", ch);
return (1);
}
break;
}
case '#' : /* Number of copies */
if (opt[1] != '\0')
{
num_copies = atoi(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected copies after \"-#\" option."), argv[0]);
usage();
}
case 'c' : /* CIFPLOT */
case 'd' : /* DVI */
case 'f' : /* FORTRAN */
case 'g' : /* plot */
case 'n' : /* Ditroff */
case 't' : /* Troff */
case 'v' : /* Raster image */
fprintf(stderr, "Warning: \'%c\' format modifier not supported - output may not be correct!\n",
ch);
break;
num_copies = atoi(argv[i]);
}
if (num_copies < 1)
case 'o' : /* Option */
if (argv[i][2] != '\0')
num_options = cupsParseOptions(argv[i] + 2, num_options, &options);
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - copies must be 1 or more."), argv[0]);
fputs("lpr: Expected option=value after -o option!\n", stderr);
return (1);
}
sprintf(buffer, "%d", num_copies);
num_options = cupsAddOption("copies", buffer, num_options, &options);
break;
num_options = cupsParseOptions(argv[i], num_options, &options);
}
break;
case 'C' : /* Class */
case 'J' : /* Job name */
case 'T' : /* Title */
if (opt[1] != '\0')
case 'l' : /* Literal/raw */
num_options = cupsAddOption("raw", "", num_options, &options);
break;
case 'p' : /* Prettyprint */
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);
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 */
deletefile = 1;
break;
case 'P' : /* Destination printer or class */
if (argv[i][2] != '\0')
printer = argv[i] + 2;
else
{
i ++;
if (i >= argc)
{
title = opt + 1;
opt += strlen(opt) - 1;
fputs("lpr: Expected destination after -P option!\n", stderr);
return (1);
}
else
printer = argv[i];
}
if ((instance = strrchr(printer, '/')) != NULL)
*instance++ = '\0';
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
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)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
}
break;
case '#' : /* Number of copies */
if (argv[i][2] != '\0')
num_copies = atoi(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected name after \"-%c\" option."), argv[0], ch);
usage();
}
title = argv[i];
fputs("lpr: Expected copy count after -# option!\n", stderr);
return (1);
}
break;
default :
_cupsLangPrintf(stderr, _("%s: Error - unknown option \"%c\"."), argv[0], *opt);
num_copies = atoi(argv[i]);
}
if (num_copies < 1 || num_copies > 100)
{
fputs("lpr: Number copies must be between 1 and 100.\n", stderr);
return (1);
}
}
sprintf(buffer, "%d", num_copies);
num_options = cupsAddOption("copies", buffer, num_options, &options);
break;
case 'C' : /* Class */
case 'J' : /* Job name */
case 'T' : /* Title */
if (argv[i][2] != '\0')
title = argv[i] + 2;
else
{
i ++;
if (i >= argc)
{
fprintf(stderr, "lpr: Expected name after -%c option!\n", ch);
return (1);
}
title = argv[i];
}
break;
case 'U' : /* User */
if (argv[i][2] != '\0')
cupsSetUser(argv[i] + 2);
else
{
i ++;
if (i >= argc)
{
fputs("lpr: Expected username after -U option!\n", stderr);
return (1);
}
cupsSetUser(argv[i]);
}
break;
default :
fprintf(stderr, "lpr: Unknown option \'%c\'!\n", argv[i][1]);
return (1);
}
}
else if (num_files < 1000)
{
/*
* Print a file...
*/
if (access(argv[i], R_OK) != 0)
{
_cupsLangPrintf(stderr,
_("%s: Error - unable to access \"%s\" - %s"),
argv[0], argv[i], strerror(errno));
return (1);
}
files[num_files] = argv[i];
num_files ++;
@@ -317,44 +293,33 @@ main(int argc, /* I - Number of command-line arguments */
}
}
else
{
_cupsLangPrintf(stderr, _("%s: Error - too many files - \"%s\"."), argv[0], argv[i]);
}
}
fprintf(stderr, "lpr: Too many files - \"%s\"\n", argv[i]);
/*
* See if we have any files to print; if not, print from stdin...
*/
if (printer == NULL)
{
if ((dest = cupsGetNamedDest(NULL, NULL, NULL)) != NULL)
{
printer = dest->name;
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
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);
}
else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
_cupsLangPrintf(stderr,
_("%s: Error - add '/version=1.1' to server "
"name."), argv[0]);
return (1);
}
for (j = 0, dest = dests; j < num_dests; j ++, dest ++)
if (dest->is_default)
{
printer = dests[j].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;
}
}
if (printer == NULL)
{
if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
_cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsLastErrorString());
else
_cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."), argv[0]);
fputs("lpr: error - no default destination available.\n", stderr);
return (1);
}
@@ -362,7 +327,7 @@ main(int argc, /* I - Number of command-line arguments */
{
job_id = cupsPrintFiles(printer, num_files, files, title, num_options, options);
if (deletefile && job_id > 0)
if (deletefile)
{
/*
* Delete print files after printing...
@@ -372,47 +337,59 @@ main(int argc, /* I - Number of command-line arguments */
unlink(files[i]);
}
}
else if ((job_id = cupsCreateJob(CUPS_HTTP_DEFAULT, printer,
title ? title : "(stdin)",
num_options, options)) > 0)
else
{
http_status_t status; /* Write status */
const char *format; /* Document format */
ssize_t bytes; /* Bytes read */
num_files = 1;
if (cupsGetOption("raw", num_options, options))
format = CUPS_FORMAT_RAW;
else if ((format = cupsGetOption("document-format", num_options,
options)) == NULL)
format = CUPS_FORMAT_AUTO;
#ifndef WIN32
# if defined(HAVE_SIGSET)
sigset(SIGHUP, sighandler);
sigset(SIGINT, sighandler);
sigset(SIGTERM, sighandler);
# elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = sighandler;
status = cupsStartDocument(CUPS_HTTP_DEFAULT, printer, job_id, NULL,
format, 1);
sigaction(SIGHUP, &action, NULL);
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
# else
signal(SIGHUP, sighandler);
signal(SIGINT, sighandler);
signal(SIGTERM, sighandler);
# endif
#endif /* !WIN32 */
while (status == HTTP_CONTINUE &&
(bytes = read(0, buffer, sizeof(buffer))) > 0)
status = cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, (size_t)bytes);
if (status != HTTP_CONTINUE)
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
_cupsLangPrintf(stderr, _("%s: Error - unable to queue from stdin - %s."),
argv[0], httpStatus(status));
cupsFinishDocument(CUPS_HTTP_DEFAULT, printer);
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
fputs("lpr: unable to create temporary file.\n", stderr);
return (1);
}
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
while ((i = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
write(temp, buffer, i);
i = lseek(temp, 0, SEEK_CUR);
close(temp);
if (i == 0)
{
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
fputs("lpr: stdin is empty, so no job has been sent.\n", stderr);
return (1);
}
if (title)
job_id = cupsPrintFile(printer, tempfile, title, num_options, options);
else
job_id = cupsPrintFile(printer, tempfile, "(stdin)", num_options, options);
unlink(tempfile);
}
if (job_id < 1)
{
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
fprintf(stderr, "lpr: unable to print file: %s\n",
ippErrorString(cupsLastError()));
return (1);
}
@@ -420,36 +397,29 @@ main(int argc, /* I - Number of command-line arguments */
}
#ifndef WIN32
/*
* 'usage()' - Show program usage and exit.
* 'sighandler()' - Signal catcher for when we print from stdin...
*/
static void
usage(void)
void
sighandler(int s) /* I - Signal number */
{
_cupsLangPuts(stdout, _("Usage: lpr [options] [file(s)]"));
_cupsLangPuts(stdout, _("Options:"));
_cupsLangPuts(stdout, _("-# num-copies Specify the number of copies to print"));
_cupsLangPuts(stdout, _("-E Encrypt the connection to the server"));
_cupsLangPuts(stdout, _("-H server[:port] Connect to the named server and port"));
_cupsLangPuts(stdout, _("-m Send an email notification when the job completes"));
_cupsLangPuts(stdout, _("-o option[=value] Specify a printer-specific option"));
_cupsLangPuts(stdout, _("-o job-sheets=standard Print a banner page with the job"));
_cupsLangPuts(stdout, _("-o media=size Specify the media size to use"));
_cupsLangPuts(stdout, _("-o number-up=N Specify that input pages should be printed N-up (1, 2, 4, 6, 9, and 16 are supported)"));
_cupsLangPuts(stdout, _("-o orientation-requested=N\n"
" Specify portrait (3) or landscape (4) orientation"));
_cupsLangPuts(stdout, _("-o print-quality=N Specify the print quality - draft (3), normal (4), or best (5)"));
_cupsLangPuts(stdout, _("-o sides=one-sided Specify 1-sided printing"));
_cupsLangPuts(stdout, _("-o sides=two-sided-long-edge\n"
" Specify 2-sided portrait printing"));
_cupsLangPuts(stdout, _("-o sides=two-sided-short-edge\n"
" Specify 2-sided landscape printing"));
_cupsLangPuts(stdout, _("-P destination Specify the destination"));
_cupsLangPuts(stdout, _("-q Specify the job should be held for printing"));
_cupsLangPuts(stdout, _("-r Remove the file(s) after submission"));
_cupsLangPuts(stdout, _("-T title Specify the job title"));
_cupsLangPuts(stdout, _("-U username Specify the username to use for authentication"));
/*
* Remove the temporary file we're using to print from stdin...
*/
exit(1);
unlink(tempfile);
/*
* Exit...
*/
exit(s);
}
#endif /* !WIN32 */
/*
* End of "$Id$".
*/
+181 -163
Ver Arquivo
@@ -1,25 +1,41 @@
/*
* "lprm" command for CUPS.
* "$Id$"
*
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 1997-2006 by Easy Software Products.
* "lprm" command for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Parse options and cancel jobs.
*/
/*
* Include necessary headers...
*/
#include <cups/cups-private.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
/*
* Local functions...
*/
static void usage(void) _CUPS_NORETURN;
#include <cups/cups.h>
#include <cups/language.h>
/*
@@ -30,211 +46,213 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
http_t *http; /* HTTP connection to server */
int i; /* Looping var */
int job_id; /* Job ID */
const char *name; /* Destination printer */
char *instance, /* Pointer to instance name */
*opt; /* Option pointer */
cups_dest_t *dest, /* Destination */
*defdest; /* Default destination */
int did_cancel; /* Did we cancel something? */
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 */
http_encryption_t encryption; /* Encryption? */
_cupsSetLocale(argv);
/*
* Setup to cancel individual print jobs...
*/
did_cancel = 0;
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
name = defdest ? defdest->name : NULL;
op = IPP_CANCEL_JOB;
job_id = 0;
dest = NULL;
response = NULL;
http = NULL;
encryption = cupsEncryption();
num_dests = cupsGetDests(&dests);
for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
/*
* Open a connection to the server...
*/
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
{
fputs("lprm: Unable to contact server!\n", stderr);
cupsFreeDests(num_dests, dests);
return (1);
}
httpEncryption(http, encryption);
/*
* Process command-line arguments...
*/
for (i = 1; i < argc; i ++)
{
if (!strcmp(argv[i], "--help"))
usage();
else if (argv[i][0] == '-' && argv[i][1] != '\0')
{
for (opt = argv[i] + 1; *opt; opt ++)
if (argv[i][0] == '-' && argv[i][1] != '\0')
switch (argv[i][1])
{
switch (*opt)
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
case 'E' : /* Encrypt */
#ifdef HAVE_LIBSSL
encryption = HTTP_ENCRYPT_REQUIRED;
httpEncryption(http, encryption);
#else
_cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."), argv[0]);
#endif /* HAVE_SSL */
break;
fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
argv[0]);
#endif /* HAVE_LIBSSL */
break;
case 'P' : /* Cancel jobs on a printer */
if (opt[1] != '\0')
{
name = opt + 1;
opt += strlen(opt) - 1;
}
else
{
i ++;
name = argv[i];
}
case 'P' : /* Cancel jobs on a printer */
if (argv[i][2])
dest = argv[i] + 2;
else
{
i ++;
dest = argv[i];
}
if ((instance = strchr(name, '/')) != NULL)
*instance = '\0';
if ((instance = strchr(dest, '/')) != NULL)
*instance = '\0';
break;
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, name, NULL)) == NULL)
{
_cupsLangPrintf(stderr, _("%s: Error - unknown destination \"%s\"."), argv[0], name);
goto error;
}
cupsFreeDests(1, dest);
break;
case 'U' : /* Username */
if (opt[1] != '\0')
{
cupsSetUser(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected username after \"-U\" option."), argv[0]);
usage();
}
cupsSetUser(argv[i]);
}
break;
case 'h' : /* Connect to host */
if (opt[1] != '\0')
{
cupsSetServer(opt + 1);
opt += strlen(opt) - 1;
}
else
{
i ++;
if (i >= argc)
{
_cupsLangPrintf(stderr, _("%s: Error - expected hostname after \"-h\" option."), argv[0]);
usage();
}
else
cupsSetServer(argv[i]);
}
if (defdest)
cupsFreeDests(1, defdest);
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
name = defdest ? defdest->name : NULL;
break;
default :
_cupsLangPrintf(stderr, _("%s: Error - unknown option \"%c\"."), argv[0], *opt);
usage();
}
default :
fprintf(stderr, "lprm: Unknown option \'%c\'!\n", argv[i][1]);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
}
else
{
/*
* Cancel a job or printer...
*/
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, argv[i], NULL)) != NULL)
cupsFreeDests(1, dest);
if (dest)
if (isdigit(argv[i][0]))
{
name = argv[i];
job_id = 0;
}
else if (isdigit(argv[i][0] & 255))
{
name = NULL;
dest = NULL;
op = IPP_CANCEL_JOB;
job_id = atoi(argv[i]);
}
else if (!strcmp(argv[i], "-"))
else if (strcmp(argv[i], "-") == 0)
{
/*
* Cancel all jobs
*/
job_id = -1;
op = IPP_PURGE_JOBS;
}
else
job_id = 0;
/*
* Build an IPP request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri + job-id *or* job-uri
* [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);
if (dest)
{
snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
job_id);
}
else
{
_cupsLangPrintf(stderr, _("%s: Error - unknown destination \"%s\"."),
argv[0], argv[i]);
goto error;
sprintf(uri, "ipp://localhost/jobs/%d", job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
uri);
}
if (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0) != IPP_OK)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
/*
* Do the request and get back a response...
*/
if (op == IPP_PURGE_JOBS)
response = cupsDoRequest(http, request, "/admin/");
else
response = cupsDoRequest(http, request, "/jobs/");
if (response != NULL)
{
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
goto error;
}
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;
}
did_cancel = 1;
ippDelete(response);
}
else
{
fputs("lprm: Unable to cancel job(s)!\n", stderr);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
}
}
/*
* If nothing has been canceled yet, cancel the current job on the specified
* If nothing has been cancelled yet, cancel the current job on the specified
* (or default) printer...
*/
if (!did_cancel && cupsCancelJob2(CUPS_HTTP_DEFAULT, name, 0, 0) != IPP_OK)
if (response == NULL)
if (!cupsCancelJob(dest, 0))
{
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
goto error;
fputs("lprm: Unable to cancel job(s)!\n", stderr);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
if (defdest)
cupsFreeDests(1, defdest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (0);
/*
* If we get here there was an error, so clean up...
*/
error:
if (defdest)
cupsFreeDests(1, defdest);
return (1);
}
/*
* 'usage()' - Show program usage and exit.
* End of "$Id$".
*/
static void
usage(void)
{
_cupsLangPuts(stdout, _("Usage: lprm [options] [id]\n"
" lprm [options] -"));
_cupsLangPuts(stdout, _("Options:"));
_cupsLangPuts(stdout, _("- Cancel all jobs"));
_cupsLangPuts(stdout, _("-E Encrypt the connection to the server"));
_cupsLangPuts(stdout, _("-h server[:port] Connect to the named server and port"));
_cupsLangPuts(stdout, _("-P destination Specify the destination"));
_cupsLangPuts(stdout, _("-U username Specify the username to use for authentication"));
exit(1);
}
-72
Ver Arquivo
@@ -1,72 +0,0 @@
help-index.o: help-index.c cgi-private.h cgi.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/pwg.h help-index.h \
../cups/debug-private.h ../cups/language-private.h ../config.h \
../cups/transcode.h ../cups/string-private.h ../cups/ipp-private.h \
../cups/dir.h
html.o: html.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
ipp-var.o: ipp-var.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
search.o: search.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
template.o: template.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
var.o: var.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
admin.o: admin.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h ../cups/http-private.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h \
../cups/pwg-private.h ../cups/adminutil.h
classes.o: classes.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
help.o: help.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
jobs.o: jobs.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
makedocset.o: makedocset.c cgi-private.h cgi.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/pwg.h help-index.h \
../cups/debug-private.h ../cups/language-private.h ../config.h \
../cups/transcode.h ../cups/string-private.h ../cups/ipp-private.h
printers.o: printers.c cgi-private.h cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h ../cups/debug-private.h \
../cups/language-private.h ../config.h ../cups/transcode.h \
../cups/string-private.h ../cups/ipp-private.h
testcgi.o: testcgi.c cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h
testhi.o: testhi.c cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h
testtemplate.o: testtemplate.c cgi.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/pwg.h help-index.h
+52 -176
Ver Arquivo
@@ -1,50 +1,33 @@
#
# CGI makefile for CUPS.
# "$Id$"
#
# Copyright © 2007-2019 by Apple Inc.
# Copyright © 1997-2006 by Easy Software Products.
# CGI makefile for the Common UNIX Printing System (CUPS).
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
# Copyright 1997-2001 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 ../Makedefs
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 \
makedocset.o \
printers.o \
testcgi.o \
testhi.o \
testtemplate.o
CGIS = \
admin.cgi \
classes.cgi \
help.cgi \
jobs.cgi \
printers.cgi
LIBTARGETS = \
libcupscgi.a
UNITTARGETS = \
testcgi \
testhi \
testtemplate
TARGETS = \
$(LIBTARGETS) \
$(CGIS)
CGIS = admin.cgi classes.cgi jobs.cgi printers.cgi
TARGETS = libcgi.a $(CGIS)
LIBOBJS = html.o ipp-var.o template.o var.o
OBJS = $(LIBOBJS) admin.o classes.o jobs.o printers.o
#
@@ -54,192 +37,85 @@ TARGETS = \
all: $(TARGETS)
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests: $(UNITTARGETS)
#
# Clean all object files...
#
clean:
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS) makedocset
#
# Update dependencies (without system header dependencies...)
#
depend:
$(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
$(RM) $(OBJS) $(TARGETS)
#
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
install:
-$(MKDIR) $(SERVERROOT)/cgi-bin
$(CHMOD) ugo+rx $(SERVERROOT)
$(CHMOD) ugo+rx $(SERVERROOT)/cgi-bin
$(INSTALL_BIN) $(CGIS) $(SERVERROOT)/cgi-bin
#
# Install data files...
# libcgi.a
#
install-data:
#
# Install programs...
#
install-exec:
$(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
for file in $(CGIS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
done
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(CGIS); do \
cp $$file $(SYMROOT); \
dsymutil $(SYMROOT)/$$file; \
done \
fi
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall all targets...
#
uninstall:
for file in $(CGIS); do \
$(RM) $(SERVERBIN)/cgi-bin/$$file; \
done
-$(RMDIR) $(SERVERBIN)/cgi-bin
#
# libcupscgi.a
#
libcupscgi.a: $(LIBOBJS)
libcgi.a: $(LIBOBJS)
echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
$(LIBOBJS): cgi.h
ipp-var.o: ipp-var.h
#
# admin.cgi
#
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o $@ admin.o libcupscgi.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(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
#
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o $@ classes.o libcupscgi.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(CC) $(LDFLAGS) -o $@ classes.o libcgi.a $(LIBS)
#
# help.cgi
#
help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o $@ help.o libcupscgi.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
classes.o: cgi.h ipp-var.h ../cups/cups.h ../cups/ipp.h ../cups/language.h
#
# jobs.cgi
#
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o $@ jobs.o libcupscgi.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(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
#
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o $@ printers.o libcupscgi.a $(LINKCUPS)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
$(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
# End of "$Id$".
#
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
$(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o $@ testcgi.o libcupscgi.a \
$(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
echo Testing CGI API...
./testcgi
#
# testhi
#
testhi: testhi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
$(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o $@ testhi.o libcupscgi.a \
$(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
echo Testing help index API...
./testhi
#
# testtemplate
#
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
$(LD_CC) $(ALL_LDFLAGS) -o $@ testtemplate.o libcupscgi.a $(LINKCUPSSTATIC)
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
#
# Dependencies...
#
include Dependencies
+962 -3177
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-25
Ver Arquivo
@@ -1,25 +0,0 @@
/*
* Private CGI definitions for CUPS.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
#include <cups/debug-private.h>
#include <cups/language-private.h>
#include <cups/string-private.h>
#include <cups/ipp-private.h> /* TODO: Update so we don't need this */
/*
* Limits...
*/
#define CUPS_PAGE_MAX 100 /* Maximum items per page */
+57 -80
Ver Arquivo
@@ -1,110 +1,87 @@
/*
* CGI support library definitions for CUPS.
* "$Id$"
*
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2006 by Easy Software Products.
* CGI support library definitions.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
* Copyright 1997-2001 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _CUPS_CGI_H_
# define _CUPS_CGI_H_
#ifndef _CGI_H_
# define _CGI_H_
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
# include <sys/stat.h>
# include <string.h>
# include <ctype.h>
# ifdef _WIN32
# 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"
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* 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;
# endif /* WIN32 */
/*
* 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 cgiClearVariables(void);
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 void cgiEndMultipart(void);
extern char *cgiFormEncode(char *dst, const char *src,
size_t dstsize);
extern void cgiFreeSearch(void *search);
extern char *cgiGetArray(const char *name, int element);
extern void cgiGetAttributes(ipp_t *request, const char *tmpl);
extern const char *cgiGetCookie(const char *name);
extern const cgi_file_t *cgiGetFile(void);
extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search);
extern const char *cgiGetArray(const char *name, int element);
extern int cgiGetSize(const char *name);
extern char *cgiGetTemplateDir(void);
extern 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 cgiPrintCommand(http_t *http, const char *dest,
const char *command, const char *title);
extern void cgiPrintTestPage(http_t *http, const char *dest);
extern char *cgiRewriteURL(const char *uri, char *url, int urlsize,
const char *newresource);
extern void cgiSetSize(const char *name, int size);
extern const char *cgiGetVariable(const char *name);
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 void cgiStartMultipart(void);
extern int cgiSupportsMultipart(void);
extern const char *cgiText(const char *message);
# ifdef __cplusplus
}
# endif /* __cplusplus */
# define cgiGetUser() getenv("REMOTE_USER")
# define cgiGetHost() (getenv("REMOTE_HOST") == NULL ? getenv("REMOTE_ADDR") : getenv("REMOTE_HOST"))
#endif /* !_CUPS_CGI_H_ */
#endif /* !_CGI_H_ */
/*
* End of "$Id$".
*/
+266 -435
Ver Arquivo
@@ -1,48 +1,57 @@
/*
* Class status CGI for CUPS.
* "$Id$"
*
* Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* Class status CGI for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
/*
* Local functions...
*/
static void do_class_op(http_t *http, const char *printer, ipp_op_t op,
const char *title);
static void show_all_classes(http_t *http, const char *username);
static void show_class(http_t *http, const char *printer);
#include "ipp-var.h"
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(void)
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
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"
};
cups_lang_t *language; /* Language information */
char *pclass; /* Printer class name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI];
/* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
/*
@@ -50,58 +59,59 @@ main(void)
*/
cgiInitialize();
op = cgiGetVariable("OP");
/*
* Set the web interface section...
* Get the request language...
*/
cgiSetVariable("SECTION", "classes");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we are displaying a printer or all classes...
*/
if ((pclass = getenv("PATH_INFO")) != NULL)
{
pclass ++;
if (!*pclass)
pclass = NULL;
if (pclass)
cgiSetVariable("PRINTER_NAME", pclass);
}
/*
* See who is logged in...
*/
user = getenv("REMOTE_USER");
language = cupsLangDefault();
/*
* Connect to the HTTP server...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
http = httpConnect("localhost", ippPort());
/*
* Get the default printer...
* Tell the client to expect HTML...
*/
if (!op || !cgiIsPOST())
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)
{
/*
* Get the default destination...
*/
request = ippNewRequest(CUPS_GET_DEFAULT);
request = ippNew();
request->request.op.operation_id = CUPS_GET_DEFAULT;
request->request.op.request_id = 1;
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
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 ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -110,84 +120,232 @@ main(void)
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char url[HTTP_MAX_URI]; /* New URL */
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
const char *server; /* Name of server */
cgiSetVariable("DEFAULT_URI",
cgiRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
/*
* Map localhost access to localhost...
*/
server = getenv("SERVER_NAME");
httpSeparate(attr->values[0].string.text, method, username,
hostname, &port, resource);
if (strcasecmp(hostname, server) == 0 &&
(strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
strcmp(getenv("REMOTE_HOST"), server) == 0))
strcpy(hostname, "localhost");
/*
* Rewrite URI with HTTP address...
*/
snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
resource);
cgiSetVariable("DEFAULT_URI", uri);
}
ippDelete(response);
}
/*
* See if we need to show a list of classes or the status of a
* single printer...
* Get the class info...
*/
if (!pclass)
show_all_classes(http, user);
else
show_class(http, pclass);
}
else if (pclass)
{
if (!*op)
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);
if (pclass == NULL)
{
const char *server_port = getenv("SERVER_PORT");
/* Port number string */
int port = atoi(server_port ? server_port : "0");
/* Port number */
char uri[1024]; /* URL */
/*
* Build a CUPS_GET_CLASSES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
*/
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
getenv("HTTPS") ? "https" : "http", NULL,
getenv("SERVER_NAME"), port, "/classes/%s", pclass);
printf("Location: %s\n\n", uri);
request->request.op.operation_id = CUPS_GET_CLASSES;
request->request.op.request_id = 1;
}
else if (!strcmp(op, "start-class"))
do_class_op(http, pclass, IPP_RESUME_PRINTER, cgiText(_("Resume Class")));
else if (!strcmp(op, "stop-class"))
do_class_op(http, pclass, IPP_PAUSE_PRINTER, cgiText(_("Pause Class")));
else if (!strcmp(op, "accept-jobs"))
do_class_op(http, pclass, CUPS_ACCEPT_JOBS, cgiText(_("Accept Jobs")));
else if (!strcmp(op, "reject-jobs"))
do_class_op(http, pclass, CUPS_REJECT_JOBS, cgiText(_("Reject Jobs")));
else if (!strcmp(op, "cancel-jobs"))
do_class_op(http, pclass, IPP_OP_CANCEL_JOBS, cgiText(_("Cancel Jobs")));
else if (!_cups_strcasecmp(op, "print-test-page"))
cgiPrintTestPage(http, pclass);
else if (!_cups_strcasecmp(op, "move-jobs"))
cgiMoveJobs(http, pclass, 0);
else
{
/*
* Unknown/bad operation...
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
cgiStartHTML(pclass);
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
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...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
}
/*
* Write the report...
*/
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"));
}
}
}
else
{
/*
* Unknown/bad operation...
* Print a test page...
*/
cgiStartHTML(cgiText(_("Classes")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
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"));
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "root");
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(stdout, TEMPLATES, "trailer.tmpl", getenv("LANG"));
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -198,332 +356,5 @@ main(void)
/*
* 'do_class_op()' - Do a class operation.
* End of "$Id$".
*/
static void
do_class_op(http_t *http, /* I - HTTP connection */
const char *printer, /* I - Printer name */
ipp_op_t op, /* I - Operation to perform */
const char *title) /* I - Title of page */
{
ipp_t *request; /* IPP request */
char uri[HTTP_MAX_URI], /* Printer URI */
resource[HTTP_MAX_URI]; /* Path for request */
/*
* Build a printer request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNewRequest(op);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/classes/%s", printer);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
/*
* Do the request and get back a response...
*/
snprintf(resource, sizeof(resource), "/classes/%s", printer);
ippDelete(cupsDoRequest(http, request, resource));
if (cupsLastError() == IPP_NOT_AUTHORIZED)
{
puts("Status: 401\n");
exit(0);
}
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to do maintenance command"));
}
else
{
/*
* Redirect successful updates back to the printer page...
*/
char url[1024], /* Printer/class URL */
refresh[1024]; /* Refresh URL */
cgiRewriteURL(uri, url, sizeof(url), NULL);
cgiFormEncode(uri, url, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
cgiSetVariable("IS_CLASS", "YES");
if (op == IPP_PAUSE_PRINTER)
cgiCopyTemplateLang("printer-stop.tmpl");
else if (op == IPP_RESUME_PRINTER)
cgiCopyTemplateLang("printer-start.tmpl");
else if (op == CUPS_ACCEPT_JOBS)
cgiCopyTemplateLang("printer-accept.tmpl");
else if (op == CUPS_REJECT_JOBS)
cgiCopyTemplateLang("printer-reject.tmpl");
else if (op == IPP_OP_CANCEL_JOBS)
cgiCopyTemplateLang("printer-cancel-jobs.tmpl");
}
cgiEndHTML();
}
/*
* 'show_all_classes()' - Show all classes...
*/
static 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 first, /* First class to show */
count; /* Number of classes */
const char *var; /* Form variable */
void *search; /* Search data */
char val[1024]; /* Form variable */
/*
* 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 &&
!cgiGetVariable("CLEAR"))
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(val, "%d", count);
cgiSetVariable("TOTAL", val);
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);
/*
* Save navigation URLs...
*/
cgiSetVariable("THISURL", "/classes/");
if (first > 0)
{
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
}
if ((first + CUPS_PAGE_MAX) < count)
{
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
}
if (count > CUPS_PAGE_MAX)
{
snprintf(val, sizeof(val), "%d", CUPS_PAGE_MAX * (count / CUPS_PAGE_MAX));
cgiSetVariable("LAST", val);
}
/*
* Then show everything...
*/
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("classes-header.tmpl");
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("classes.tmpl");
if (count > CUPS_PAGE_MAX)
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.
*/
static 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, "class.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("class.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();
}
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-77
Ver Arquivo
@@ -1,77 +0,0 @@
/*
* Online help index definitions for CUPS.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
#ifndef _CUPS_HELP_INDEX_H_
# define _CUPS_HELP_INDEX_H_
/*
* Include necessary headers...
*/
# include <cups/array.h>
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Data structures...
*/
typedef struct help_word_s /**** Help word structure... ****/
{
int count; /* Number of occurrences */
char *text; /* Word text */
} help_word_t;
typedef struct help_node_s /**** 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 */
cups_array_t *words; /* Words after this node */
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_s /**** 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);
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_HELP_INDEX_H_ */
-384
Ver Arquivo
@@ -1,384 +0,0 @@
/*
* Online help CGI for CUPS.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* 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 */
*helptitle = NULL; /* Current help title */
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");
cgiSetVariable("REFRESH_PAGE", "");
/*
* 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(_("Online Help")));
cgiSetVariable("ERROR", cgiText(_("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, "DEBUG: 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(_("Online Help")));
cgiSetVariable("ERROR", cgiText(_("Unable to access help file.")));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return (1);
}
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
{
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", cgiText(_("Help file not in index.")));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return (1);
}
/*
* Save the page title and help file...
*/
helptitle = n->text;
topic = n->section;
/*
* 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(_("Online Help")));
topic = cgiGetVariable("TOPIC");
}
/*
* Do a search as needed...
*/
if (cgiGetVariable("CLEAR"))
cgiSetVariable("QUERY", "");
query = cgiGetVariable("QUERY");
si = helpSearchIndex(hi, query, topic, helpfile);
cgiClearVariables();
if (query)
cgiSetVariable("QUERY", query);
if (topic)
cgiSetVariable("TOPIC", topic);
if (helpfile)
cgiSetVariable("HELPFILE", helpfile);
if (helptitle)
cgiSetVariable("HELPTITLE", helptitle);
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 || !n->section || 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? */
char *lineptr; /* Pointer into line */
inbody = 0;
while (cupsFileGets(fp, line, sizeof(line)))
{
for (lineptr = line; *lineptr && isspace(*lineptr & 255); lineptr ++);
if (inbody)
{
if (!_cups_strncasecmp(lineptr, "</BODY>", 7))
break;
printf("%s\n", line);
}
else if (!_cups_strncasecmp(lineptr, "<BODY", 5))
inbody = 1;
}
cupsFileClose(fp);
}
else
{
perror(filename);
cgiSetVariable("ERROR", cgiText(_("Unable to open help file.")));
cgiCopyTemplateLang("error.tmpl");
}
}
/*
* Send a standard trailer...
*/
if (!printable)
{
cgiCopyTemplateLang("help-trailer.tmpl");
cgiEndHTML();
}
else
puts("</BODY>\n</HTML>");
/*
* Delete the index...
*/
helpDeleteIndex(hi);
/*
* Return with no errors...
*/
return (0);
}
+63 -192
Ver Arquivo
@@ -1,218 +1,89 @@
/*
* HTML support functions for CUPS.
* "$Id$"
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* CGI HTML functions.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Copyright 1997-2001 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contents:
*
* cgiStartHTML() - Start an HTML document stream.
* cgiEndHTML() - End an HTML document stream.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
#include "cgi.h"
#include <stdarg.h>
/*
* Local globals...
*/
static const char *cgi_multipart = NULL;
/* Multipart separator, if any */
/*
* Local functions...
*/
static const char *cgi_null_passwd(const char *prompt);
/*
* 'cgiEndHTML()' - End a HTML page.
* 'cgiStartHTML()' - Start an HTML document stream.
*/
void
cgiEndHTML(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 */
{
/*
* Send the standard trailer...
*/
va_list ap; /* Argument pointer */
cgiCopyTemplateLang("trailer.tmpl");
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);
}
/*
* 'cgiEndMultipart()' - End the delivery of a multipart web page.
* 'cgiEndHTML()' - End an HTML document stream.
*/
void
cgiEndMultipart(void)
cgiEndHTML(FILE *out) /* I - Output file to use */
{
if (cgi_multipart)
{
printf("\n%s--\n", cgi_multipart);
fflush(stdout);
}
fputs("</BODY>\n", out);
fputs("</HTML>\n", out);
}
/*
* 'cgiFormEncode()' - Encode a string as a form variable.
* End of "$Id$".
*/
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
cgiStartHTML(const char *title) /* I - Title of page */
{
/*
* Disable any further authentication attempts...
*/
cupsSetPasswordCB(cgi_null_passwd);
/*
* Tell the client to expect UTF-8 encoded HTML...
*/
if (cgi_multipart)
puts(cgi_multipart);
puts("Content-Type: text/html;charset=utf-8\n");
/*
* Send a standard header...
*/
cgiSetVariable("TITLE", title);
cgiSetServerVersion();
cgiCopyTemplateLang("header.tmpl");
}
/*
* 'cgiStartMultipart()' - Start a multipart delivery of a web page.
*/
void
cgiStartMultipart(void)
{
puts("MIME-Version: 1.0\n"
"Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
fflush(stdout);
cgi_multipart = "--CUPS-MULTIPART";
}
/*
* 'cgiSupportsMultipart()' - Does the browser support multi-part documents?
*/
int /* O - 1 if multi-part supported, 0 otherwise */
cgiSupportsMultipart(void)
{
/*
* Too many bug reports for browsers that don't support it, and too much pain
* to whitelist known-good browsers, so for now we just punt on multi-part
* support... :(
*/
return (0);
}
/*
* '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);
}
+210 -1446
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+55
Ver Arquivo
@@ -0,0 +1,55 @@
/*
* "$Id$"
*
* IPP variable definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 1997-2001 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$".
*/
+79 -137
Ver Arquivo
@@ -1,38 +1,52 @@
/*
* Job status CGI for CUPS.
* "$Id$"
*
* Copyright 2007-2014 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* Job status CGI for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
/*
* Local functions...
*/
static void do_job_op(http_t *http, int job_id, ipp_op_t op);
#include "ipp-var.h"
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(void)
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
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 */
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 */
/*
* Get any form variables...
@@ -41,74 +55,76 @@ main(void)
cgiInitialize();
/*
* Set the web interface section...
* Get the request language...
*/
cgiSetVariable("SECTION", "jobs");
cgiSetVariable("REFRESH_PAGE", "");
language = cupsLangDefault();
/*
* Connect to the HTTP server...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
http = httpConnect("localhost", ippPort());
/*
* Get the job ID, if any...
* Tell the client to expect HTML...
*/
if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL)
job_id = atoi(job_id_var);
else
job_id = 0;
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
cgiSetVariable("TITLE", "Jobs");
ippSetServerVersion();
cgiCopyTemplateLang(stdout, TEMPLATES, "header.tmpl", getenv("LANG"));
/*
* Do the operation...
* Build an IPP_GET_JOBS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
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)
{
/*
* Do the operation...
*/
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
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();
}
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
}
else
{
/*
* Show a list of jobs...
*/
cgiStartHTML(cgiText(_("Jobs")));
cgiShowJobs(http, NULL);
cgiEndHTML();
}
cgiCopyTemplateLang(stdout, TEMPLATES, "trailer.tmpl", getenv("LANG"));
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -119,79 +135,5 @@ main(void)
/*
* 'do_job_op()' - Do a job operation.
* End of "$Id$".
*/
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"));
if (cupsLastError() <= IPP_OK_CONFLICT && getenv("HTTP_REFERER"))
{
/*
* Redirect successful updates back to the parent page...
*/
char url[1024]; /* Encoded URL */
strlcpy(url, "5;URL=", sizeof(url));
cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
cgiSetVariable("refresh_page", url);
}
else if (cupsLastError() == IPP_NOT_AUTHORIZED)
{
puts("Status: 401\n");
exit(0);
}
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();
}
-42
Ver Arquivo
@@ -1,42 +0,0 @@
_cgiCheckVariables
_cgiClearVariables
_cgiCompileSearch
_cgiCopyTemplateFile
_cgiCopyTemplateLang
_cgiDoSearch
_cgiEndHTML
_cgiEndMultipart
_cgiFormEncode
_cgiFreeSearch
_cgiGetArray
_cgiGetAttributes
_cgiGetCookie
_cgiGetFile
_cgiGetIPPObjects
_cgiGetSize
_cgiGetTemplateDir
_cgiGetVariable
_cgiInitialize
_cgiIsPOST
_cgiMoveJobs
_cgiPrintCommand
_cgiPrintTestPage
_cgiRewriteURL
_cgiSetArray
_cgiSetIPPObjectVars
_cgiSetIPPVars
_cgiSetCookie
_cgiSetServerVersion
_cgiSetSize
_cgiSetVariable
_cgiShowIPPError
_cgiShowJobs
_cgiStartHTML
_cgiStartMultipart
_cgiSupportsMultipart
_cgiText
_helpDeleteIndex
_helpFindNode
_helpLoadIndex
_helpSaveIndex
_helpSearchIndex
-465
Ver Arquivo
@@ -1,465 +0,0 @@
/*
* Xcode documentation set generator.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*
* Usage:
*
* makedocset directory *.tokens
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
#include <errno.h>
/*
* Local structures...
*/
typedef struct _cups_html_s /**** Help file ****/
{
char *path; /* Path to help file */
char *title; /* Title of help file */
} _cups_html_t;
typedef struct _cups_section_s /**** Help section ****/
{
char *name; /* Section name */
cups_array_t *files; /* Files in this section */
} _cups_section_t;
/*
* Local functions...
*/
static int compare_html(_cups_html_t *a, _cups_html_t *b);
static int compare_sections(_cups_section_t *a, _cups_section_t *b);
static int compare_sections_files(_cups_section_t *a, _cups_section_t *b);
static void write_index(const char *path, help_index_t *hi);
static void write_info(const char *path, const char *revision);
static void write_nodes(const char *path, help_index_t *hi);
/*
* 'main()' - Test the help index code.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int i; /* Looping var */
char path[1024], /* Path to documentation */
line[1024]; /* Line from file */
help_index_t *hi; /* Help index */
cups_file_t *tokens, /* Tokens.xml file */
*fp; /* Current file */
if (argc < 4)
{
puts("Usage: makedocset directory revision *.tokens");
return (1);
}
/*
* Index the help documents...
*/
snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation", argv[1]);
if ((hi = helpLoadIndex(NULL, path)) == NULL)
{
fputs("makedocset: Unable to index help files!\n", stderr);
return (1);
}
snprintf(path, sizeof(path), "%s/Contents/Resources/Documentation/index.html",
argv[1]);
write_index(path, hi);
snprintf(path, sizeof(path), "%s/Contents/Resources/Nodes.xml", argv[1]);
write_nodes(path, hi);
/*
* Write the Info.plist file...
*/
snprintf(path, sizeof(path), "%s/Contents/Info.plist", argv[1]);
write_info(path, argv[2]);
/*
* Merge the Tokens.xml files...
*/
snprintf(path, sizeof(path), "%s/Contents/Resources/Tokens.xml", argv[1]);
if ((tokens = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create \"%s\": %s\n", path,
strerror(errno));
return (1);
}
cupsFilePuts(tokens, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
cupsFilePuts(tokens, "<Tokens version=\"1.0\">\n");
for (i = 3; i < argc; i ++)
{
if ((fp = cupsFileOpen(argv[i], "r")) == NULL)
{
fprintf(stderr, "makedocset: Unable to open \"%s\": %s\n", argv[i],
strerror(errno));
return (1);
}
if (!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "<?xml ", 6) ||
!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "<Tokens ", 8))
{
fprintf(stderr, "makedocset: Bad Tokens.xml file \"%s\"!\n", argv[i]);
return (1);
}
while (cupsFileGets(fp, line, sizeof(line)))
{
if (strcmp(line, "</Tokens>"))
cupsFilePrintf(tokens, "%s\n", line);
}
cupsFileClose(fp);
}
cupsFilePuts(tokens, "</Tokens>\n");
cupsFileClose(tokens);
/*
* Return with no errors...
*/
return (0);
}
/*
* 'compare_html()' - Compare the titles of two HTML files.
*/
static int /* O - Result of comparison */
compare_html(_cups_html_t *a, /* I - First file */
_cups_html_t *b) /* I - Second file */
{
return (_cups_strcasecmp(a->title, b->title));
}
/*
* 'compare_sections()' - Compare the names of two help sections.
*/
static int /* O - Result of comparison */
compare_sections(_cups_section_t *a, /* I - First section */
_cups_section_t *b) /* I - Second section */
{
return (_cups_strcasecmp(a->name, b->name));
}
/*
* 'compare_sections_files()' - Compare the number of files and section names.
*/
static int /* O - Result of comparison */
compare_sections_files(
_cups_section_t *a, /* I - First section */
_cups_section_t *b) /* I - Second section */
{
int ret = cupsArrayCount(b->files) - cupsArrayCount(a->files);
if (ret)
return (ret);
else
return (_cups_strcasecmp(a->name, b->name));
}
/*
* 'write_index()' - Write an index file for the CUPS help.
*/
static void
write_index(const char *path, /* I - File to write */
help_index_t *hi) /* I - Index of files */
{
cups_file_t *fp; /* Output file */
help_node_t *node; /* Current help node */
_cups_section_t *section, /* Current section */
key; /* Section search key */
_cups_html_t *html; /* Current HTML file */
cups_array_t *sections, /* Sections in index */
*sections_files,/* Sections sorted by size */
*columns[3]; /* Columns in final HTML file */
int column, /* Current column */
lines[3], /* Number of lines in each column */
min_column, /* Smallest column */
min_lines; /* Smallest number of lines */
/*
* Build an array of sections and their files.
*/
sections = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
{
if (node->anchor)
continue;
key.name = node->section ? node->section : "Miscellaneous";
if ((section = (_cups_section_t *)cupsArrayFind(sections, &key)) == NULL)
{
section = (_cups_section_t *)calloc(1, sizeof(_cups_section_t));
section->name = key.name;
section->files = cupsArrayNew((cups_array_func_t)compare_html, NULL);
cupsArrayAdd(sections, section);
}
html = (_cups_html_t *)calloc(1, sizeof(_cups_html_t));
html->path = node->filename;
html->title = node->text;
cupsArrayAdd(section->files, html);
}
/*
* Build a sorted list of sections based on the number of files in each section
* and the section name...
*/
sections_files = cupsArrayNew((cups_array_func_t)compare_sections_files,
NULL);
for (section = (_cups_section_t *)cupsArrayFirst(sections);
section;
section = (_cups_section_t *)cupsArrayNext(sections))
cupsArrayAdd(sections_files, section);
/*
* Then build three columns to hold everything, trying to balance the number of
* lines in each column...
*/
for (column = 0; column < 3; column ++)
{
columns[column] = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
lines[column] = 0;
}
for (section = (_cups_section_t *)cupsArrayFirst(sections_files);
section;
section = (_cups_section_t *)cupsArrayNext(sections_files))
{
for (min_column = 0, min_lines = lines[0], column = 1;
column < 3;
column ++)
{
if (lines[column] < min_lines)
{
min_column = column;
min_lines = lines[column];
}
}
cupsArrayAdd(columns[min_column], section);
lines[min_column] += cupsArrayCount(section->files) + 2;
}
/*
* Write the HTML file...
*/
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePuts(fp, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
"Transitional//EN\" "
"\"http://www.w3.org/TR/html4/loose.dtd\">\n"
"<html>\n"
"<head>\n"
"<title>CUPS Documentation</title>\n"
"<link rel='stylesheet' type='text/css' "
"href='cups-printable.css'>\n"
"</head>\n"
"<body>\n"
"<h1 class='title'>CUPS Documentation</h1>\n"
"<table width='100%' summary=''>\n"
"<tr>\n");
for (column = 0; column < 3; column ++)
{
if (column)
cupsFilePuts(fp, "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n");
cupsFilePuts(fp, "<td valign='top' width='33%'>");
for (section = (_cups_section_t *)cupsArrayFirst(columns[column]);
section;
section = (_cups_section_t *)cupsArrayNext(columns[column]))
{
cupsFilePrintf(fp, "<h2 class='title'>%s</h2>\n", section->name);
for (html = (_cups_html_t *)cupsArrayFirst(section->files);
html;
html = (_cups_html_t *)cupsArrayNext(section->files))
cupsFilePrintf(fp, "<p class='compact'><a href='%s'>%s</a></p>\n",
html->path, html->title);
}
cupsFilePuts(fp, "</td>\n");
}
cupsFilePuts(fp, "</tr>\n"
"</table>\n"
"</body>\n"
"</html>\n");
cupsFileClose(fp);
}
/*
* 'write_info()' - Write the Info.plist file.
*/
static void
write_info(const char *path, /* I - File to write */
const char *revision) /* I - Subversion revision number */
{
cups_file_t *fp; /* File */
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePrintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" "
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
"<plist version=\"1.0\">\n"
"<dict>\n"
"\t<key>CFBundleIdentifier</key>\n"
"\t<string>org.cups.docset</string>\n"
"\t<key>CFBundleName</key>\n"
"\t<string>CUPS Documentation</string>\n"
"\t<key>CFBundleVersion</key>\n"
"\t<string>%d.%d.%s</string>\n"
"\t<key>CFBundleShortVersionString</key>\n"
"\t<string>%d.%d.%d</string>\n"
"\t<key>DocSetFeedName</key>\n"
"\t<string>cups.org</string>\n"
"\t<key>DocSetFeedURL</key>\n"
"\t<string>http://www.cups.org/org.cups.docset.atom"
"</string>\n"
"\t<key>DocSetPublisherIdentifier</key>\n"
"\t<string>org.cups</string>\n"
"\t<key>DocSetPublisherName</key>\n"
"\t<string>CUPS</string>\n"
"</dict>\n"
"</plist>\n",
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, revision,
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, CUPS_VERSION_PATCH);
cupsFileClose(fp);
}
/*
* 'write_nodes()' - Write the Nodes.xml file.
*/
static void
write_nodes(const char *path, /* I - File to write */
help_index_t *hi) /* I - Index of files */
{
cups_file_t *fp; /* Output file */
int id; /* Current node ID */
help_node_t *node; /* Current help node */
int subnodes; /* Currently in Subnodes for file? */
int needclose; /* Need to close the current node? */
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePuts(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<DocSetNodes version=\"1.0\">\n"
"<TOC>\n"
"<Node id=\"0\">\n"
"<Name>CUPS Documentation</Name>\n"
"<Path>Documentation/index.html</Path>\n"
"</Node>\n");
for (node = (help_node_t *)cupsArrayFirst(hi->nodes), id = 1, subnodes = 0,
needclose = 0;
node;
node = (help_node_t *)cupsArrayNext(hi->nodes), id ++)
{
if (node->anchor)
{
if (!subnodes)
{
cupsFilePuts(fp, "<Subnodes>\n");
subnodes = 1;
}
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Anchor>%s</Anchor>\n"
"<Name>%s</Name>\n"
"</Node>\n", id, node->filename, node->anchor,
node->text);
}
else
{
if (subnodes)
{
cupsFilePuts(fp, "</Subnodes>\n");
subnodes = 0;
}
if (needclose)
cupsFilePuts(fp, "</Node>\n");
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Name>%s</Name>\n", id, node->filename, node->text);
needclose = 1;
}
}
if (subnodes)
cupsFilePuts(fp, "</Subnodes>\n");
if (needclose)
cupsFilePuts(fp, "</Node>\n");
cupsFilePuts(fp, "</TOC>\n"
"</DocSetNodes>\n");
cupsFileClose(fp);
}
Arquivo binário não exibido.
+267 -456
Ver Arquivo
@@ -1,108 +1,117 @@
/*
* Printer status CGI for CUPS.
* "$Id$"
*
* Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Copyright 1997-2001 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* Contents:
*
* main() - Main entry for CGI.
*/
/*
* Include necessary headers...
*/
#include "cgi-private.h"
#include <errno.h>
/*
* Local functions...
*/
static void do_printer_op(http_t *http, const char *printer, ipp_op_t op,
const char *title);
static void show_all_printers(http_t *http, const char *username);
static void show_printer(http_t *http, const char *printer);
#include "ipp-var.h"
/*
* 'main()' - Main entry for CGI.
*/
int /* O - Exit status */
main(void)
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
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"
};
cups_lang_t *language; /* Language information */
char *printer; /* Printer name */
http_t *http; /* Connection to the server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_attribute_t *attr; /* IPP attribute */
ipp_status_t status; /* Operation status... */
char uri[HTTP_MAX_URI];
/* Printer URI */
const char *which_jobs; /* Which jobs to show */
const char *op; /* Operation to perform, if any */
/*
* Get any form variables...
*/
cgiInitialize();
op = cgiGetVariable("OP");
/*
* Set the web interface section...
* Get the request language...
*/
cgiSetVariable("SECTION", "printers");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we are displaying a printer or all printers...
*/
if ((printer = getenv("PATH_INFO")) != NULL)
{
printer ++;
if (!*printer)
printer = NULL;
if (printer)
cgiSetVariable("PRINTER_NAME", printer);
}
/*
* See who is logged in...
*/
user = getenv("REMOTE_USER");
language = cupsLangDefault();
/*
* Connect to the HTTP server...
*/
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
http = httpConnect("localhost", ippPort());
/*
* Get the default printer...
* Tell the client to expect HTML...
*/
if (!op || !cgiIsPOST())
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)
{
/*
* Get the default destination...
*/
request = ippNewRequest(CUPS_GET_DEFAULT);
request = ippNew();
request->request.op.operation_id = CUPS_GET_DEFAULT;
request->request.op.request_id = 1;
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
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 ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -111,92 +120,232 @@ main(void)
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
{
char url[HTTP_MAX_URI]; /* New URL */
char method[HTTP_MAX_URI],
username[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
resource[HTTP_MAX_URI],
uri[HTTP_MAX_URI];
int port; /* URI data */
const char *server; /* Name of server */
cgiSetVariable("DEFAULT_URI",
cgiRewriteURL(attr->values[0].string.text,
url, sizeof(url), NULL));
/*
* Map localhost access to localhost...
*/
server = getenv("SERVER_NAME");
httpSeparate(attr->values[0].string.text, method, username,
hostname, &port, resource);
if (strcasecmp(hostname, server) == 0 &&
(strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
strcmp(getenv("REMOTE_HOST"), server) == 0))
strcpy(hostname, "localhost");
/*
* Rewrite URI with HTTP address...
*/
snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
resource);
cgiSetVariable("DEFAULT_URI", uri);
}
ippDelete(response);
}
/*
* See if we need to show a list of printers or the status of a
* single printer...
* Get the printer info...
*/
if (!printer)
show_all_printers(http, user);
else
show_printer(http, printer);
}
else if (printer)
{
if (!*op)
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);
if (printer == NULL)
{
const char *server_port = getenv("SERVER_PORT");
/* Port number string */
int port = atoi(server_port ? server_port : "0");
/* Port number */
char uri[1024]; /* URL */
/*
* Build a CUPS_GET_PRINTERS request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
*/
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
getenv("HTTPS") ? "https" : "http", NULL,
getenv("SERVER_NAME"), port, "/printers/%s", printer);
printf("Location: %s\n\n", uri);
request->request.op.operation_id = CUPS_GET_PRINTERS;
request->request.op.request_id = 1;
}
else if (!strcmp(op, "start-printer"))
do_printer_op(http, printer, IPP_RESUME_PRINTER,
cgiText(_("Resume Printer")));
else if (!strcmp(op, "stop-printer"))
do_printer_op(http, printer, IPP_PAUSE_PRINTER,
cgiText(_("Pause Printer")));
else if (!strcmp(op, "accept-jobs"))
do_printer_op(http, printer, CUPS_ACCEPT_JOBS, cgiText(_("Accept Jobs")));
else if (!strcmp(op, "reject-jobs"))
do_printer_op(http, printer, CUPS_REJECT_JOBS, cgiText(_("Reject Jobs")));
else if (!strcmp(op, "cancel-jobs"))
do_printer_op(http, printer, IPP_OP_CANCEL_JOBS, cgiText(_("Cancel Jobs")));
else if (!_cups_strcasecmp(op, "print-self-test-page"))
cgiPrintCommand(http, printer, "PrintSelfTestPage",
cgiText(_("Print Self-Test Page")));
else if (!_cups_strcasecmp(op, "clean-print-heads"))
cgiPrintCommand(http, printer, "Clean all",
cgiText(_("Clean Print Heads")));
else if (!_cups_strcasecmp(op, "print-test-page"))
cgiPrintTestPage(http, printer);
else if (!_cups_strcasecmp(op, "move-jobs"))
cgiMoveJobs(http, printer, 0);
else
{
/*
* Unknown/bad operation...
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
cgiStartHTML(printer);
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
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...
*/
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
ippSetCGIVars(response, NULL, NULL);
ippDelete(response);
}
/*
* Write the report...
*/
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"));
}
}
}
else
{
/*
* Unknown/bad operation...
* Print a test page...
*/
cgiStartHTML(cgiText(_("Printers")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
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"));
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, "root");
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(stdout, TEMPLATES, "trailer.tmpl", getenv("LANG"));
/*
* Close the HTTP server connection...
*/
httpClose(http);
cupsLangFree(language);
/*
* Return with no errors...
@@ -207,343 +356,5 @@ main(void)
/*
* 'do_printer_op()' - Do a printer operation.
* End of "$Id$".
*/
static void
do_printer_op(http_t *http, /* I - HTTP connection */
const char *printer, /* I - Printer name */
ipp_op_t op, /* I - Operation to perform */
const char *title) /* I - Title of page */
{
ipp_t *request; /* IPP request */
char uri[HTTP_MAX_URI], /* Printer URI */
resource[HTTP_MAX_URI]; /* Path for request */
/*
* Build a printer request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
*/
request = ippNewRequest(op);
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);
/*
* Do the request and get back a response...
*/
snprintf(resource, sizeof(resource), "/printers/%s", printer);
ippDelete(cupsDoRequest(http, request, resource));
if (cupsLastError() == IPP_NOT_AUTHORIZED)
{
puts("Status: 401\n");
exit(0);
}
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to do maintenance command"));
}
else
{
/*
* Redirect successful updates back to the printer page...
*/
char url[1024], /* Printer/class URL */
refresh[1024]; /* Refresh URL */
cgiRewriteURL(uri, url, sizeof(url), NULL);
cgiFormEncode(uri, url, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
if (op == IPP_PAUSE_PRINTER)
cgiCopyTemplateLang("printer-stop.tmpl");
else if (op == IPP_RESUME_PRINTER)
cgiCopyTemplateLang("printer-start.tmpl");
else if (op == CUPS_ACCEPT_JOBS)
cgiCopyTemplateLang("printer-accept.tmpl");
else if (op == CUPS_REJECT_JOBS)
cgiCopyTemplateLang("printer-reject.tmpl");
else if (op == IPP_OP_CANCEL_JOBS)
cgiCopyTemplateLang("printer-cancel-jobs.tmpl");
}
cgiEndHTML();
}
/*
* 'show_all_printers()' - Show all printers...
*/
static 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 */
int first, /* First printer to show */
count; /* Number of printers */
const char *var; /* Form variable */
void *search; /* Search data */
char val[1024]; /* Form variable */
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 &&
!cgiGetVariable("CLEAR"))
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(val, "%d", count);
cgiSetVariable("TOTAL", val);
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);
/*
* Save navigation URLs...
*/
cgiSetVariable("THISURL", "/printers/");
if (first > 0)
{
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
}
if ((first + CUPS_PAGE_MAX) < count)
{
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
}
if (count > CUPS_PAGE_MAX)
{
snprintf(val, sizeof(val), "%d", CUPS_PAGE_MAX * (count / CUPS_PAGE_MAX));
cgiSetVariable("LAST", val);
}
/*
* Then show everything...
*/
cgiCopyTemplateLang("search.tmpl");
cgiCopyTemplateLang("printers-header.tmpl");
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("printers.tmpl");
if (count > CUPS_PAGE_MAX)
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.
*/
static 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, "printer.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 (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("printer.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();
}
-362
Ver Arquivo
@@ -1,362 +0,0 @@
/*
* Search routines for CUPS.
*
* Copyright 2007-2018 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* 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 */
size_t 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 */
size_t wlen; /* Word length */
char *lword; /* Last word in query */
/*
* Range check input...
*/
if (!query)
return (NULL);
/*
* Allocate a regular expression storage structure...
*/
if ((re = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
return (NULL);
/*
* 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;
if ((s = (char *)malloc(slen)) == NULL)
{
free(re);
return (NULL);
}
/*
* 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 = (size_t)(qend - qptr);
/*
* Look for logic words: AND, OR
*/
if (wlen == 3 && !_cups_strncasecmp(qptr, "AND", 3))
{
/*
* Logical AND with the following text...
*/
if (sptr > s)
prefix = ".*";
qptr = qend;
}
else if (wlen == 2 && !_cups_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 = (size_t)(sptr - s) + 2 * 4 * wlen + 2 * strlen(prefix) + 11;
if (lword)
wlen += strlen(lword);
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...
*/
memcpy(sptr, prefix, strlen(prefix) + 1);
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++;
}
*sptr = '\0';
/*
* For "word1 AND word2", add reciprocal "word2 AND word1"...
*/
if (!strcmp(prefix, ".*") && lword)
{
char *lword2; /* New "last word" */
if ((lword2 = strdup(sword)) == NULL)
{
free(lword);
free(s);
free(re);
return (NULL);
}
memcpy(sptr, ".*|.*", 6);
sptr += 5;
memcpy(sptr, lword2, strlen(lword2) + 1);
sptr += strlen(sptr);
memcpy(sptr, ".*", 3);
sptr += 2;
memcpy(sptr, lword, strlen(lword) + 1);
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)
memcpy(sptr, ".*", 3);
else
{
/*
* No query data, return NULL...
*/
free(s);
free(re);
return (NULL);
}
/*
* Compile the regular expression...
*/
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);
free(search);
}
+114 -294
Ver Arquivo
@@ -1,25 +1,43 @@
/*
* CGI template function.
* "$Id$"
*
* Copyright 2007-2015 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* CGI template function.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Copyright 1997-2001 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.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contents:
*
* cgiCopyTemplateFile() - Copy a template file and replace all the
* '{variable}' strings with the variable value.
* cgiCopyTemplateLang() - Copy a template file using a language...
* cgi_copy() - Copy the template file, substituting as needed...
* cgi_puts() - Put a string to the output file, quoting as
* needed...
*/
#include "cgi-private.h"
#include <errno.h>
#include <regex.h>
#include "cgi.h"
/*
* Local functions...
*/
static void cgi_copy(FILE *out, FILE *in, int element, char term,
int indent);
static void cgi_copy(FILE *out, FILE *in, int element, char term);
static void cgi_puts(const char *s, FILE *out);
static void cgi_puturi(const char *s, FILE *out);
/*
@@ -34,32 +52,18 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
FILE *in; /* Input file */
fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
tmpl ? tmpl : "(null)");
/*
* Range check input...
*/
if (!tmpl || !out)
return;
/*
* 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, 0);
cgi_copy(out, in, 0, 0);
/*
* Close the template file and return...
@@ -74,74 +78,60 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
*/
void
cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
cgiCopyTemplateLang(FILE *out, /* I - Output file */
const char *directory, /* I - Directory */
const char *tmpl, /* I - Base filename */
const char *lang) /* I - Language */
{
char filename[1024], /* Filename */
locale[16], /* Locale name */
*locptr; /* Pointer into locale name */
const char *directory, /* Directory for templates */
*lang; /* Language */
FILE *in; /* Input file */
int i; /* Looping var */
char filename[1024], /* Filename */
locale[16]; /* Locale name */
FILE *in; /* Input file */
fprintf(stderr, "DEBUG2: cgiCopyTemplateLang(tmpl=\"%s\")\n",
tmpl ? tmpl : "(null)");
/*
* Convert the language to a locale name...
*/
locale[0] = '\0';
if ((lang = getenv("LANG")) != NULL)
if (lang != NULL)
{
locale[0] = '/';
strlcpy(locale + 1, lang, sizeof(locale) - 1);
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i]))
locale[i] = tolower(lang[i]);
else
locale[i] = '_';
if ((locptr = strchr(locale, '.')) != NULL)
*locptr = '\0'; /* Strip charset */
locale[i] = '\0';
}
fprintf(stderr, "DEBUG2: lang=\"%s\", locale=\"%s\"...\n",
lang ? lang : "(null)", locale);
else
locale[0] = '\0';
/*
* See if we have a template file for this language...
*/
directory = cgiGetTemplateDir();
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
if ((in = fopen(filename, "r")) == NULL)
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
if (access(filename, 0))
{
locale[3] = '\0';
locale[2] = '\0';
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
if ((in = fopen(filename, "r")) == NULL)
{
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
if (access(filename, 0))
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
in = fopen(filename, "r");
}
}
fprintf(stderr, "DEBUG2: Template file is \"%s\"...\n", filename);
/*
* Open the template file...
*/
if (!in)
{
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
filename, strerror(errno));
if ((in = fopen(filename, "r")) == NULL)
return;
}
/*
* Parse the file to the end...
*/
cgi_copy(stdout, in, 0, 0, 0);
cgi_copy(out, in, 0, 0);
/*
* Close the template file and return...
@@ -151,81 +141,31 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
}
/*
* '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 */
int indent) /* I - Debug info indentation */
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 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 */
regex_t re; /* Regular expression to match */
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 */
fprintf(stderr, "DEBUG2: %*sStarting at file position %ld...\n", indent, "",
ftell(in));
/*
* Parse the file to the end...
*/
@@ -239,24 +179,18 @@ cgi_copy(FILE *out, /* I - Output file */
* Get a variable name...
*/
uriencode = 0;
for (s = name; (ch = getc(in)) != EOF;)
if (strchr("}]<>=!~ \t\n", 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))
*s++ = (char)ch;
*s++ = ch;
*s = '\0';
if (s == name && isspace(ch & 255))
if (s == name && isspace(ch))
{
fprintf(stderr, "DEBUG2: %*sLone { at %ld...\n", indent, "", ftell(in));
if (out)
{
putc('{', out);
@@ -266,10 +200,6 @@ cgi_copy(FILE *out, /* I - Output file */
continue;
}
if (ch == '}')
fprintf(stderr, "DEBUG2: %*s\"{%s}\" at %ld...\n", indent, "", name,
ftell(in));
/*
* See if it has a value...
*/
@@ -280,7 +210,7 @@ cgi_copy(FILE *out, /* I - Output file */
* Insert value only if it exists...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
{
*nameptr++ = '\0';
@@ -292,7 +222,7 @@ cgi_copy(FILE *out, /* I - Output file */
outptr = outval;
}
}
else if ((value = cgiGetArray(name + 1, element)) != NULL)
if ((value = cgiGetArray(name + 1, element)) != NULL)
outptr = value;
else
{
@@ -324,55 +254,33 @@ cgi_copy(FILE *out, /* I - Output file */
int count; /* Number of elements */
if (isdigit(name[1] & 255))
if (isdigit(name[1]))
count = atoi(name + 1);
else
count = cgiGetSize(name + 1);
pos = ftell(in);
fprintf(stderr, "DEBUG2: %*sLooping on \"%s\" at %ld, count=%d...\n",
indent, "", name + 1, pos, count);
if (count > 0)
{
for (i = 0; i < count; i ++)
{
if (i)
fseek(in, pos, SEEK_SET);
cgi_copy(out, in, i, '}', indent + 2);
fseek(in, pos, SEEK_SET);
cgi_copy(out, in, i, '}');
}
}
else
cgi_copy(NULL, in, 0, '}', indent + 2);
fprintf(stderr, "DEBUG2: %*sFinished looping on \"%s\"...\n", indent,
"", name + 1);
cgi_copy(NULL, in, 0, '}');
continue;
}
else if (name[0] == '$')
{
/*
* Insert cookie value or nothing if not defined.
*/
if ((value = cgiGetCookie(name + 1)) != NULL)
outptr = value;
else
{
outval[0] = '\0';
outptr = outval;
}
}
else
{
/*
* Insert variable or variable name (if element is NULL)...
*/
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1]))
{
*nameptr++ = '\0';
if ((value = cgiGetArray(name, atoi(nameptr) - 1)) == NULL)
@@ -403,14 +311,7 @@ cgi_copy(FILE *out, /* I - Output file */
*/
if (out)
{
if (uriencode)
cgi_puturi(outptr, out);
else if (!_cups_strcasecmp(name, "?cupsdconf_default"))
fputs(outptr, stdout);
else
cgi_puts(outptr, out);
}
cgi_puts(outptr, out);
continue;
}
@@ -423,26 +324,15 @@ cgi_copy(FILE *out, /* I - Output file */
* {name<value?true:false} Less than
* {name>value?true:false} Greater than
* {name!value?true:false} Not equal
* {name~refex?true:false} Regex match
*/
op = (char)ch;
if (ch == '?')
{
/*
* Test for existance...
*/
if (name[0] == '?')
result = cgiGetArray(name + 1, element) != NULL;
else if (name[0] == '#')
result = cgiGetVariable(name + 1) != NULL;
else
result = cgiGetArray(name, element) != NULL;
result = result && outptr[0];
compare[0] = '\0';
result = cgiGetArray(name, element) != NULL && outval[0];
}
else
{
@@ -450,6 +340,8 @@ cgi_copy(FILE *out, /* I - Output file */
* Compare to a string...
*/
op = ch;
for (s = compare; (ch = getc(in)) != EOF;)
if (ch == '?')
break;
@@ -469,48 +361,52 @@ cgi_copy(FILE *out, /* I - Output file */
innerptr = innername;
while ((ch = getc(in)) != EOF && ch != '}')
if (innerptr < (innername + sizeof(innername) - 1))
*innerptr++ = (char)ch;
*innerptr++ = ch;
*innerptr = '\0';
if (innername[0] == '#')
sprintf(s, "%d", cgiGetSize(innername + 1));
else if ((innerptr = strrchr(innername, '-')) != NULL &&
isdigit(innerptr[1] & 255))
isdigit(innerptr[1]))
{
*innerptr++ = '\0';
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
*s = '\0';
else
strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
{
strncpy(s, innerval, sizeof(compare) - (s - compare) - 1);
compare[sizeof(compare) - 1] = '\0';
}
}
else if (innername[0] == '?')
{
if ((innerval = cgiGetArray(innername + 1, element)) == NULL)
*s = '\0';
else
strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
{
strncpy(s, innerval, sizeof(compare) - (s - compare) - 1);
compare[sizeof(compare) - 1] = '\0';
}
}
else if ((innerval = cgiGetArray(innername, element)) == NULL)
snprintf(s, sizeof(compare) - (size_t)(s - compare), "{%s}", innername);
snprintf(s, sizeof(s), "{%s}", innername);
else
strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
{
strncpy(s, innerval, sizeof(compare) - (s - compare) - 1);
compare[sizeof(compare) - 1] = '\0';
}
s += strlen(s);
}
else if (ch == '\\')
*s++ = (char)getc(in);
*s++ = getc(in);
else
*s++ = (char)ch;
*s++ = ch;
*s = '\0';
if (ch != '?')
{
fprintf(stderr,
"DEBUG2: %*sBad terminator '%c' at file position %ld...\n",
indent, "", ch, ftell(in));
return;
}
/*
* Do the comparison...
@@ -519,49 +415,16 @@ cgi_copy(FILE *out, /* I - Output file */
switch (op)
{
case '<' :
result = _cups_strcasecmp(outptr, compare) < 0;
result = strcasecmp(outptr, compare) < 0;
break;
case '>' :
result = _cups_strcasecmp(outptr, compare) > 0;
result = strcasecmp(outptr, compare) > 0;
break;
case '=' :
result = _cups_strcasecmp(outptr, compare) == 0;
result = strcasecmp(outptr, compare) == 0;
break;
case '!' :
result = _cups_strcasecmp(outptr, compare) != 0;
break;
case '~' :
fprintf(stderr, "DEBUG: Regular expression \"%s\"\n", compare);
if (regcomp(&re, compare, REG_EXTENDED | REG_ICASE))
{
fprintf(stderr,
"ERROR: Unable to compile regular expression \"%s\"!\n",
compare);
result = 0;
}
else
{
regmatch_t matches[10];
result = 0;
if (!regexec(&re, outptr, 10, matches, 0))
{
int i;
for (i = 0; i < 10; i ++)
{
fprintf(stderr, "DEBUG: matches[%d].rm_so=%d\n", i,
(int)matches[i].rm_so);
if (matches[i].rm_so < 0)
break;
result ++;
}
}
regfree(&re);
}
result = strcasecmp(outptr, compare) != 0;
break;
default :
result = 1;
@@ -569,21 +432,14 @@ cgi_copy(FILE *out, /* I - Output file */
}
}
fprintf(stderr,
"DEBUG2: %*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...
*/
fprintf(stderr, "DEBUG2: %*sOutput first part...\n", indent, "");
cgi_copy(out, in, element, ':', indent + 2);
fprintf(stderr, "DEBUG2: %*sSkip second part...\n", indent, "");
cgi_copy(NULL, in, element, '}', indent + 2);
cgi_copy(out, in, element, ':');
cgi_copy(NULL, in, element, '}');
}
else
{
@@ -591,15 +447,9 @@ cgi_copy(FILE *out, /* I - Output file */
* Comparison false; ignore first part and output second...
*/
fprintf(stderr, "DEBUG2: %*sSkip first part...\n", indent, "");
cgi_copy(NULL, in, element, ':', indent + 2);
fprintf(stderr, "DEBUG2: %*sOutput second part...\n", indent, "");
cgi_copy(out, in, element, '}', indent + 2);
cgi_copy(NULL, in, element, ':');
cgi_copy(out, in, element, '}');
}
fprintf(stderr, "DEBUG2: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
name, op, compare, out);
}
else if (ch == '\\') /* Quoted char */
{
@@ -611,17 +461,6 @@ cgi_copy(FILE *out, /* I - Output file */
else if (out)
putc(ch, out);
if (ch == EOF)
fprintf(stderr, "DEBUG2: %*sReturning at file position %ld on EOF...\n",
indent, "", ftell(in));
else
fprintf(stderr,
"DEBUG2: %*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...
*/
@@ -636,20 +475,16 @@ cgi_copy(FILE *out, /* I - Output file */
*/
static void
cgi_puts(const char *s, /* I - String to output */
FILE *out) /* I - Output file */
cgi_puts(const char *s,
FILE *out)
{
while (*s)
{
if (*s == '<')
if (s[0] == '<' && s[1] != '/' && !isalpha(s[1]))
fputs("&lt;", out);
else if (*s == '>')
fputs("&gt;", out);
else if (*s == '\"')
fputs("&quot;", out);
else if (*s == '\'')
fputs("&#39;", out);
else if (*s == '&')
else if (s[0] == '&' && isspace(s[1]))
fputs("&amp;", out);
else
putc(*s, out);
@@ -660,20 +495,5 @@ cgi_puts(const char *s, /* I - String to output */
/*
* 'cgi_puturi()' - Put a URI string to the output file, quoting as needed...
* End of "$Id$".
*/
static void
cgi_puturi(const char *s, /* I - String to output */
FILE *out) /* I - Output file */
{
while (*s)
{
if (strchr("%@&+ <>#=", *s) || *s < ' ' || *s & 128)
fprintf(out, "%%%02X", *s & 255);
else
putc(*s, out);
s ++;
}
}
-58
Ver Arquivo
@@ -1,58 +0,0 @@
/*
* CGI test program for CUPS.
*
* Copyright 2007-2014 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
/*
* 'main()' - Test the CGI code.
*/
int /* O - Exit status */
main(void)
{
/*
* 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);
}
-181
Ver Arquivo
@@ -1,181 +0,0 @@
/*
* Help index test program for CUPS.
*
* Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
/*
* Local functions...
*/
static void list_nodes(const char *title, cups_array_t *nodes);
static int usage(void);
/*
* '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 */
{
int i; /* Looping var */
help_index_t *hi, /* Help index */
*search; /* Search index */
const char *opt, /* Current option character */
*dir = ".", /* Directory to index */
*q = NULL, /* Query string */
*section = NULL, /* Section string */
*filename = NULL; /* Filename string */
/*
* Parse the command-line...
*/
for (i = 1; i < argc; i ++)
{
if (argv[i][0] == '-')
{
if (!strcmp(argv[i], "--help"))
{
usage();
return (0);
}
for (opt = argv[i] + 1; *opt; opt ++)
{
switch (*opt)
{
case 'd' : /* -d directory */
i ++;
if (i < argc)
{
dir = argv[i];
}
else
{
fputs("testhi: Missing directory for \"-d\" option.\n", stderr);
return (usage());
}
break;
case 's' : /* -s section */
i ++;
if (i < argc)
{
section = argv[i];
}
else
{
fputs("testhi: Missing section name for \"-s\" option.\n", stderr);
return (usage());
}
break;
default :
fprintf(stderr, "testhi: Unknown option \"-%c\".\n", *opt);
return (usage());
}
}
}
else if (!q)
q = argv[i];
else if (!filename)
filename = argv[i];
else
{
fprintf(stderr, "testhi: Unknown argument \"%s\".\n", argv[i]);
return (usage());
}
}
/*
* Load the help index...
*/
hi = helpLoadIndex("testhi.index", dir);
list_nodes("nodes", hi->nodes);
list_nodes("sorted", hi->sorted);
/*
* Do any searches...
*/
if (q)
{
search = helpSearchIndex(hi, q, section, filename);
if (search)
{
list_nodes(argv[1], search->sorted);
helpDeleteIndex(search);
}
else
printf("%s (0 nodes)\n", q);
}
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\"", i, node->filename, node->anchor,
node->text);
else
printf(" %d: %s \"%s\"", i, node->filename, node->text);
printf(" (%d words)\n", cupsArrayCount(node->words));
}
}
/*
* 'usage()' - Show program usage.
*/
static int /* O - Exit status */
usage(void)
{
puts("Usage: ./testhi [options] [\"query\"] [filename]");
puts("Options:");
puts("-d directory Specify index directory.");
puts("-s section Specify search section.");
return (1);
}
-31
Ver Arquivo
@@ -1,31 +0,0 @@
<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&nbsp;is some text for the <em>first</em> anchor.</P>
<H1><A NAME="2ND">This is the Second Anchor</A></H1>
<P>This is some text for the first anchor.</P>
<P>John asked Mary to the dance.</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>
-88
Ver Arquivo
@@ -1,88 +0,0 @@
/*
* CGI template test program for CUPS.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 2006 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* 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);
}
+190 -793
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+29 -88
Ver Arquivo
@@ -1,10 +1,25 @@
#
# Configuration file makefile for CUPS.
# "$Id$"
#
# Copyright 2007-2015 by Apple Inc.
# Copyright 1993-2006 by Easy Software Products.
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more information.
# Copyright 1993-2001 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 ../Makedefs
@@ -13,7 +28,7 @@ include ../Makedefs
# Config files...
#
KEEP = cups-files.conf cupsd.conf snmp.conf
KEEP = classes.conf client.conf cupsd.conf printers.conf
REPLACE = mime.convs mime.types
@@ -24,20 +39,6 @@ REPLACE = mime.convs mime.types
all:
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all config and object files...
#
@@ -46,87 +47,27 @@ clean:
#
# Dummy depend...
# Install files...
#
depend:
#
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
install:
-$(MKDIR) $(SERVERROOT)
$(CHMOD) ugo+rx $(SERVERROOT)
for file in $(KEEP); do \
if test -r $(SERVERROOT)/$$file ; then \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
$(INSTALL_DATA) $$file $(SERVERROOT)/$$file.N ; \
else \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
fi ; \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.default; \
done
$(INSTALL_DIR) -m 755 $(DATADIR)/mime
for file in $(REPLACE); do \
if test -r $(DATADIR)/mime/$$file ; then \
$(MV) $(DATADIR)/mime/$$file $(DATADIR)/mime/$$file.O ; \
fi ; \
if test -r $(SERVERROOT)/$$file ; then \
$(MV) $(SERVERROOT)/$$file $(DATADIR)/mime/$$file.O ; \
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
fi ; \
$(INSTALL_DATA) $$file $(DATADIR)/mime ; \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
done
-if test x$(PAMDIR) != x; then \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \
if test -r $(BUILDROOT)$(PAMDIR)/cups ; then \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \
else \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \
fi ; \
fi
#
# Install programs...
# End of "$Id$".
#
install-exec:
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall files...
#
uninstall:
for file in $(KEEP) $(REPLACE) cupsd.conf.default; do \
$(RM) $(SERVERROOT)/$$file; \
done
-$(RMDIR) $(SERVERROOT)
for file in $(REPLACE); do \
$(RM) $(DATADIR)/mime/$$file; \
done
-$(RMDIR) $(DATADIR)/mime
-if test x$(PAMDIR) != x; then \
$(RM) $(BUILDROOT)$(PAMDIR)/cups; \
$(RMDIR) $(BUILDROOT)$(PAMDIR); \
fi
+89
Ver Arquivo
@@ -0,0 +1,89 @@
#
# "$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 $".
#
+65
Ver Arquivo
@@ -0,0 +1,65 @@
#
# "$Id: client.conf 1485 2000-12-20 13:41:17Z 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 encryption settings. #
# #
########################################################################
#
# ServerName: the hostname of your server. By default CUPS will use the
# hostname of the system or the value of the CUPS_SERVER environment
# variable.
#
#ServerName myhost.domain.com
#
# Encryption: whether or not to use encryption; this depends on having
# the OpenSSL library linked into the CUPS library.
#
# Possible values:
#
# Always - Always use encryption (SSL)
# Never - Never use encryption
# Required - Use TLS encryption upgrade
# IfRequested - Use encryption if the server requests it
#
# The default value is "IfRequested". This parameter can also be set
# using the CUPS_ENCRYPTION environment variable.
#
#Encryption Always
#Encryption Never
#Encryption Required
#Encryption IfRequested
#
# End of "$Id: client.conf 1485 2000-12-20 13:41:17Z mike $".
#
-93
Ver Arquivo
@@ -1,93 +0,0 @@
#
# File/directory/user/group configuration file for the CUPS scheduler.
# See "man cups-files.conf" for a complete description of this file.
#
# List of events that are considered fatal errors for the scheduler...
#FatalErrors @CUPS_FATAL_ERRORS@
# Do we call fsync() after writing configuration or status files?
#SyncOnClose No
# Default user and group for filters/backends/helper programs; this cannot be
# any user or group that resolves to ID 0 for security reasons...
#User @CUPS_USER@
#Group @CUPS_GROUP@
# Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
# This cannot contain the Group value for security reasons...
SystemGroup @CUPS_SYSTEM_GROUPS@
@CUPS_SYSTEM_AUTHKEY@
# User that is substituted for unauthenticated (remote) root accesses...
#RemoteRoot remroot
# Do we allow file: device URIs other than to /dev/null?
#FileDevice No
# Permissions for configuration and log files...
#ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
#LogFilePerm 0@CUPS_LOG_FILE_PERM@
# Location of the file logging all access to the scheduler; may be the name
# "syslog". If not an absolute path, the value of ServerRoot is used as the
# root directory. Also see the "AccessLogLevel" directive in cupsd.conf.
AccessLog @CUPS_LOGDIR@/access_log
# Location of cache files used by the scheduler...
#CacheDir @CUPS_CACHEDIR@
# Location of data files used by the scheduler...
#DataDir @CUPS_DATADIR@
# Location of the static web content served by the scheduler...
#DocumentRoot @CUPS_DOCROOT@
# Location of the file logging all messages produced by the scheduler and any
# helper programs; may be the name "syslog". If not an absolute path, the value
# of ServerRoot is used as the root directory. Also see the "LogLevel"
# directive in cupsd.conf.
ErrorLog @CUPS_LOGDIR@/error_log
# Location of fonts used by older print filters...
#FontPath @CUPS_FONTPATH@
# Location of LPD configuration
#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@
# Location of the file logging all pages printed by the scheduler and any
# helper programs; may be the name "syslog". If not an absolute path, the value
# of ServerRoot is used as the root directory. Also see the "PageLogFormat"
# directive in cupsd.conf.
PageLog @CUPS_LOGDIR@/page_log
# Location of the file listing all of the local printers...
#Printcap @CUPS_DEFAULT_PRINTCAP@
# Format of the Printcap file...
#PrintcapFormat bsd
#PrintcapFormat plist
#PrintcapFormat solaris
# Location of all spool files...
#RequestRoot @CUPS_REQUESTS@
# Location of helper programs...
#ServerBin @CUPS_SERVERBIN@
# SSL/TLS keychain for the scheduler...
#ServerKeychain @CUPS_SERVERKEYCHAIN@
# Location of other configuration files...
#ServerRoot @CUPS_SERVERROOT@
# Location of Samba configuration file...
#SMBConfigFile @CUPS_DEFAULT_SMB_CONFIG_FILE@
# Location of scheduler state files...
#StateDir @CUPS_STATEDIR@
# Location of scheduler/helper temporary files. This directory is emptied on
# scheduler startup and cannot be one of the standard (public) temporary
# directory locations for security reasons...
#TempDir @CUPS_REQUESTS@/tmp
+628
Ver Arquivo
@@ -0,0 +1,628 @@
#
# "$Id: cupsd.conf 1485 2000-12-20 13:41:17Z 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
#
# FontPath: the path to locate all font files (currently only for pstoraster)
# By default /usr/share/cups/fonts.
#
#FontPath /usr/share/cups/fonts
#
# LogLevel: controls the number of messages logged to the ErrorLog
# file and can be one of the following:
#
# debug2 Log everything.
# debug Log almost 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
#
# AutoPurgeJobs: automatically purge jobs when not needed for quotas.
# Default is No.
#
#AutoPurgeJobs No
#
# MaxJobs: maximum number of jobs to keep in memory (active and completed.)
# Default is 0 (no limit.)
#
#MaxJobs 0
#
# Printcap: the name of the printcap file. Default is /etc/printcap.
# 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
#
# RemoteRoot: the name of the user assigned to unauthenticated accesses
# from remote systems. By default "remroot".
#
#RemoteRoot remroot
#
# 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
########
######## Encryption Support
########
#
# ServerCertificate: the file to read containing the server's certificate.
# Defaults to "/etc/cups/ssl/server.crt".
#
#ServerCertificate /etc/cups/ssl/server.crt
#
# ServerKey: the file to read containing the server's key.
# Defaults to "/etc/cups/ssl/server.key".
#
#ServerKey /etc/cups/ssl/server.key
########
######## 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/spool/cups/tmp" or
# the value of the TMPDIR environment variable.
#
#TempDir /var/spool/cups/tmp
#
# FilterLimit: sets the maximum cost of all job filters that can be run
# at the same time. A limit of 0 means no limit. A typical job may need
# a filter limit of at least 200; limits less than the minimum required
# by a job force a single job to be printed at any time.
#
# The default limit is 0 (unlimited).
#
#FilterLimit 0
########
######## 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
#
# NOTE: Unfortunately, most web browsers don't support TLS or HTTP Upgrades
# for encryption. If you want to support web-based encryption you'll
# probably need to listen on port 443 (the "https" port...)
#
#Port 80
#Port 443
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 and/or listen for CUPS printer
# information on the network. Enabled by default.
#
#Browsing On
#
# BrowseAddress: specifies a broadcast address to be used. By
# default browsing information is not sent!
#
# Note: HP-UX does not properly handle broadcast unless you have a
# Class A, B, C, or D netmask (i.e. no CIDR support).
#
# Note: Using the "global" broadcast address (255.255.255.255) will
# activate a Linux demand-dial link with the default configuration.
# If you have a LAN as well as the dial-up link, use the LAN's
# broadcast address.
#
#BrowseAddress x.y.z.255
#BrowseAddress x.y.255.255
#BrowseAddress x.255.255.255
#BrowseAddress 255.255.255.255
#
# 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
#
# 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.
#
# Encryption: whether or not to use encryption; this depends on having
# the OpenSSL library linked into the CUPS library and scheduler.
#
# Possible values:
#
# Always - Always use encryption (SSL)
# Never - Never use encryption
# Required - Use TLS encryption upgrade
# IfRequested - Use encryption if the server requests it
#
# The default value is "IfRequested".
#
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</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
#Encryption Required
</Location>
#
# End of "$Id: cupsd.conf 1485 2000-12-20 13:41:17Z mike $".
#
-182
Ver Arquivo
@@ -1,182 +0,0 @@
#
# Configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
#
# Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
# for troubleshooting...
LogLevel @CUPS_LOG_LEVEL@
@CUPS_PAGE_LOG_FORMAT@
# 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
BrowseLocalProtocols @CUPS_BROWSE_LOCAL_PROTOCOLS@
# Default authentication type, when authentication is required...
DefaultAuthType Basic
# Web interface setting...
WebInterface @CUPS_WEBIF@
# Restrict access to the server...
<Location />
Order allow,deny
</Location>
# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
</Location>
# Restrict access to log files...
<Location /admin/log>
AuthType Default
Require user @SYSTEM
Order allow,deny
</Location>
# Set the default printer/job policies...
<Policy default>
# Job/subscription privacy...
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<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 Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer 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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
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 @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
# Set the authenticated printer/job policies...
<Policy authenticated>
# Job/subscription privacy...
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
<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 Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer 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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
# Set the kerberized printer/job policies...
<Policy kerberos>
# Job/subscription privacy...
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Negotiate
Order deny,allow
</Limit>
<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 Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Negotiate
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer 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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Negotiate
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
+78
Ver Arquivo
@@ -0,0 +1,78 @@
#
# "$Id: mime.convs 1340 2000-09-06 13:53:00Z mike $"
#
# MIME converts file 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
#
########################################################################
#
# Format of Lines:
#
# source/type destination/type cost filter
#
# 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.
#
########################################################################
#
# PostScript filters
#
#application/msword application/postscript 33 mswordtops
application/pdf application/postscript 33 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
image/* application/vnd.cups-postscript 66 imagetops
#text/html application/postscript 33 htmltops
application/x-cshell application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/html application/postscript 33 texttops
text/plain application/postscript 33 texttops
application/vnd.cups-form application/vnd.cups-postscript 33 formtops
########################################################################
#
# Raster filters...
#
image/* application/vnd.cups-raster 100 imagetoraster
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.
#
#*/* application/vnd.cups-raw 0 -
#
# End of "$Id: mime.convs 1340 2000-09-06 13:53:00Z mike $".
#
-55
Ver Arquivo
@@ -1,55 +0,0 @@
#
# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
# VERSIONS OF CUPS. Instead, create a "local.convs" file that
# reflects your local configuration changes.
#
# Base MIME conversions file for CUPS.
#
# Copyright © 2007-2016 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
########################################################################
#
# Format of Lines:
#
# source/type destination/type cost filter
#
# General Notes:
#
# 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.
#
########################################################################
#
# PostScript filters
#
application/postscript application/vnd.cups-postscript 66 pstops
########################################################################
#
# Raster filters...
#
# PWG Raster filter for IPP Everywhere...
application/vnd.cups-raster image/pwg-raster 100 rastertopwg
application/vnd.cups-raster image/urf 100 rastertopwg
########################################################################
#
# Raw filter...
#
# Uncomment the following filter to allow printing of arbitrary files
# without the -oraw option.
#
@DEFAULT_RAW_PRINTING@application/octet-stream application/vnd.cups-raw 0 -
+54 -68
Ver Arquivo
@@ -1,15 +1,25 @@
#
# Base MIME types file for CUPS.
# "$Id: mime.types 1544 2001-02-02 19:38:45Z mike $"
#
# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
# VERSIONS OF CUPS. Instead, create a "local.types" file that
# reflects your local configuration changes.
# MIME types file for the Common UNIX Printing System (CUPS).
#
# Copyright © 2007-2017 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products.
# Copyright 1997-2000 by Easy Software Products.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
# 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
#
########################################################################
@@ -28,14 +38,9 @@
# extension Pattern match on "*.extension"
# ascii(offset,length) True if bytes are valid printable ASCII
# (CR, NL, TAB, BS, 32-126)
# priority(number) Sets priority of type (0=lowest,
# 100=default, 200=highest)
# printable(offset,length) True if bytes are printable 8-bit chars
# (CR, NL, TAB, BS, 32-126, 128-254)
# regex(offset,"regex") True if bytes match regular expression
# 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
@@ -46,12 +51,10 @@
#
# MIME type names are case-insensitive. Internally they are converted
# to lowercase. Multiple occurrences of a type will cause the provided
# rules to be appended to the existing definition. If two types use the same
# rules to resolve a type and have the same priority, e.g. "doc" extension for
# "text/bar" and "text/foo", the returned type will be the first type as
# sorted in alphanumerically ascending order without regard to case. Thus,
# the "text/bar" type will match the "doc" extension first unless the
# "text/foo" type has specified a higher priority.
# rules to be appended to the existing definition. Type names are sorted
# in ascending order, so if two types use the same rules to resolve a type
# (e.g. doc extension for two types), the returned type will be the first
# type in the sorted list.
#
# The "printable" rule differs from the "ascii" rule in that it also
# accepts 8-bit characters in the range 128-255.
@@ -65,17 +68,15 @@
# Application-generated files...
#
#application/msword doc string(0,<D0CF11E0A1B11AE1>)
application/pdf pdf regex(0,^[\n\r]*%PDF)
application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
contains(0,128,<1B>%-12345X) + \
(contains(0,4096,"LANGUAGE=POSTSCRIPT") \
contains(0,4096,"LANGUAGE = Postscript") \
contains(0,4096,"LANGUAGE = PostScript") \
contains(0,4096,"LANGUAGE = POSTSCRIPT") \
(contains(0,4096,<0a>%!) + \
!contains(0,4096,"ENTER LANGUAGE")))
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>E<1B>%0B) string(0,<201B>)\
string(0,BP;) string(0,IN;) string(0,DF;) \
(string(0,<1B>%-12345X) + \
(contains(9,512,"LANGUAGE=HPGL") \
contains(9,512,"LANGUAGE = HPGL")))
########################################################################
#
@@ -84,13 +85,12 @@ application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
image/gif gif string(0,GIF87a) string(0,GIF89a)
image/png png string(0,<89>PNG)
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) +\
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
(char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
char(3,0xec) char(3,0xed) char(3,0xee) char(3,0xef))
image/pwg-raster string(0,"RaS2") + string(4,PwgRaster<00>) priority(150)
image/tiff tiff tif string(0,MM<002A>) string(0,II<2A00>)
image/tiff tiff tif string(0,MM) string(0,II)
image/x-photocd pcd string(2048,PCD_IPI)
image/x-portable-anymap pnm
image/x-portable-bitmap pbm string(0,P1) string(0,P4)
@@ -99,20 +99,20 @@ 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 string(4,<00000007>)
image/x-sun-raster ras string(0,<59a66a95>)
image/x-xwindowdump xwd
image/x-sun-raster ras
#image/fpx fpx
image/urf urf string(0,UNIRAST<00>)
image/x-alias pix short(8,8) short(8,24)
image/x-bitmap bmp string(0,BM) + !printable(2,14)
image/x-icon ico
image/x-bitmap bmp string(0,BM) && !printable(2,14)
########################################################################
#
# Text files...
#
text/html html htm printable(0,1024) +\
(string(0,"<HTML>") string(0,"<!DOCTYPE"))
application/x-cshell csh printable(0,1024) + string(0,#!) +\
(contains(2,80,/csh) contains(2,80,/tcsh))
application/x-perl pl printable(0,1024) + string(0,#!) +\
@@ -120,49 +120,35 @@ application/x-perl pl printable(0,1024) + string(0,#!) +\
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) + ! css + \
(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) +\
(istring(0,"<HTML>") istring(0,"<!DOCTYPE"))
text/plain txt printable(0,1024)
text/css css
########################################################################
#
# RSS feed type...
#
application/rss+xml rss
########################################################################
#
# CUPS-specific types...
#
application/vnd.cups-banner string(0,'#CUPS-BANNER')
application/vnd.cups-command string(0,'#CUPS-COMMAND')
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") \
(string(0,"RaS2") + !string(4,PwgRaster<00>)) string(0,"2SaR") \
string(0,"RaS3") string(0,"3SaR")
application/vnd.cups-form string(0,"<CUPSFORM>")
application/vnd.cups-postscript string(0,<1B>%-12345X) + \
(contains(9,512,"LANGUAGE=POSTSCRIPT") \
contains(9,512,"LANGUAGE = POSTSCRIPT"))
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,128,<1B>%-12345X) + \
(contains(0,4096,"LANGUAGE=PCL") \
contains(0,4096,"LANGUAGE = PCL")))
(string(0,<1B>%-12345X) + \
(contains(9,512,"LANGUAGE=PCL") \
contains(9,512,"LANGUAGE = PCL")))
########################################################################
#
# Raw print file support...
#
# Comment the following type to prevent raw file printing.
# Uncomment the following type and the application/octet-stream
# filter line in mime.convs to allow raw file printing without the
# -oraw option.
#
application/octet-stream
#application/octet-stream
#
# End of "$Id: mime.types 1544 2001-02-02 19:38:45Z mike $".
#
-3
Ver Arquivo
@@ -1,3 +0,0 @@
@include common-auth
@include common-account
@include common-session
-5
Ver Arquivo
@@ -1,5 +0,0 @@
# cups: auth account password session
auth required pam_opendirectory.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so
-7
Ver Arquivo
@@ -1,7 +0,0 @@
# 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
-2
Ver Arquivo
@@ -1,2 +0,0 @@
auth required @PAMMODAUTH@
account required @PAMMOD@
+2
Ver Arquivo
@@ -0,0 +1,2 @@
# This is a dummy printcap file that is automatically generated by the
# CUPS software for old applications that rely on it.
+96
Ver Arquivo
@@ -0,0 +1,96 @@
#
# "$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 $".
#
-7
Ver Arquivo
@@ -1,7 +0,0 @@
#
# SNMP configuration file for CUPS. See "man cups-snmp.conf" for a complete
# description of this file.
#
@CUPS_SNMP_ADDRESS@
@CUPS_SNMP_COMMUNITY@
-476
Ver Arquivo
@@ -1,476 +0,0 @@
dnl
dnl Common configuration stuff for CUPS.
dnl
dnl Copyright © 2007-2019 by Apple Inc.
dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
dnl
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="AC_PACKAGE_VERSION"
CUPS_REVISION=""
CUPS_BUILD="cups-$CUPS_VERSION"
AC_ARG_WITH(cups_build, [ --with-cups-build set "cups-config --build" string ],
CUPS_BUILD="$withval")
AC_SUBST(CUPS_VERSION)
AC_SUBST(CUPS_REVISION)
AC_SUBST(CUPS_BUILD)
AC_DEFINE_UNQUOTED(CUPS_SVERSION, "AC_PACKAGE_NAME v$CUPS_VERSION$CUPS_REVISION")
AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "AC_PACKAGE_NAME/$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(clang cc gcc)
AC_PROG_CPP
AC_PROG_CXX(clang++ c++ g++)
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(GZIPPROG,gzip)
AC_MSG_CHECKING(for install-sh script)
INSTALL="`pwd`/install-sh"
AC_SUBST(INSTALL)
AC_MSG_RESULT(using $INSTALL)
AC_PATH_PROG(LD,ld)
AC_PATH_PROG(LN,ln)
AC_PATH_PROG(MKDIR,mkdir)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(RMDIR,rmdir)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(XDGOPEN,xdg-open)
if test "x$XDGOPEN" = x; then
CUPS_HTMLVIEW="htmlview"
else
CUPS_HTMLVIEW="$XDGOPEN"
fi
AC_SUBST(CUPS_HTMLVIEW)
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
dnl Static library option...
INSTALLSTATIC=""
AC_ARG_ENABLE(static, [ --enable-static install static libraries])
if test x$enable_static = xyes; then
echo Installing static libraries...
INSTALLSTATIC="installstatic"
fi
AC_SUBST(INSTALLSTATIC)
dnl Check for pkg-config, which is used for some other tests later on...
AC_PATH_TOOL(PKGCONFIG, pkg-config)
dnl Check for libraries...
AC_SEARCH_LIBS(abs, m, AC_DEFINE(HAVE_ABS))
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(fmod, m)
AC_SEARCH_LIBS(getspent, sec gen)
LIBMALLOC=""
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
if test x$enable_mallinfo = xyes; then
SAVELIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
LIBMALLOC="$LIBS"
LIBS="$SAVELIBS"
fi
AC_SUBST(LIBMALLOC)
dnl Check for libpaper support...
AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
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(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
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(stdint.h,AC_DEFINE(HAVE_STDINT_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(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
dnl Checks for iconv.h and iconv_open
AC_CHECK_HEADER(iconv.h,
SAVELIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(iconv_open,iconv,
AC_DEFINE(HAVE_ICONV_H)
SAVELIBS="$SAVELIBS $LIBS")
AC_SEARCH_LIBS(libiconv_open,iconv,
AC_DEFINE(HAVE_ICONV_H)
SAVELIBS="$SAVELIBS $LIBS")
LIBS="$SAVELIBS")
dnl Checks for statfs and its many headers...
AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
AC_CHECK_FUNCS(statfs statvfs)
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup strlcat strlcpy)
if test "$host_os_name" = "hp-ux" -a "$host_os_version" = "1020"; then
echo Forcing snprintf emulation for HP-UX.
else
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
dnl Check for random number functions...
AC_CHECK_FUNCS(random lrand48 arc4random)
dnl Check for geteuid function.
AC_CHECK_FUNCS(geteuid)
dnl Check for setpgid function.
AC_CHECK_FUNCS(setpgid)
dnl Check for vsyslog function.
AC_CHECK_FUNCS(vsyslog)
dnl Checks for signal functions.
case "$host_os_name" 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 wait3)
dnl Check for posix_spawn
AC_CHECK_FUNCS(posix_spawn)
dnl Check for getgrouplist
AC_CHECK_FUNCS(getgrouplist)
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 See if the stat structure has the st_gen member...
AC_MSG_CHECKING(for st_gen member in stat structure)
AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat t;
int o = t.st_gen;],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ST_GEN),
AC_MSG_RESULT(no))
dnl See if we have the removefile(3) function for securely removing files
AC_CHECK_FUNCS(removefile)
dnl See if we have libusb...
AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
LIBUSB=""
USBQUIRKS=""
AC_SUBST(LIBUSB)
AC_SUBST(USBQUIRKS)
if test "x$PKGCONFIG" != x; then
if test x$enable_libusb != xno -a $host_os_name != darwin; then
AC_MSG_CHECKING(for libusb-1.0)
if $PKGCONFIG --exists libusb-1.0; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBUSB)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags libusb-1.0`"
LIBUSB="`$PKGCONFIG --libs libusb-1.0`"
USBQUIRKS="\$(DATADIR)/usb"
else
AC_MSG_RESULT(no)
if test x$enable_libusb = xyes; then
AC_MSG_ERROR(libusb required for --enable-libusb.)
fi
fi
fi
elif test x$enable_libusb = xyes; then
AC_MSG_ERROR(Need pkg-config to enable libusb support.)
fi
dnl See if we have libwrap for TCP wrappers support...
AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support])
LIBWRAP=""
AC_SUBST(LIBWRAP)
if test x$enable_tcp_wrappers = xyes; then
AC_CHECK_LIB(wrap, hosts_access,[
AC_CHECK_HEADER(tcpd.h,
AC_DEFINE(HAVE_TCPD_H)
LIBWRAP="-lwrap")])
fi
dnl ZLIB
INSTALL_GZIP=""
LIBZ=""
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzgets,[
AC_DEFINE(HAVE_LIBZ)
LIBZ="-lz"
LIBS="$LIBS -lz"
AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_INFLATECOPY))
if test "x$GZIPPROG" != x; then
INSTALL_GZIP="-z"
fi]))
AC_SUBST(INSTALL_GZIP)
AC_SUBST(LIBZ)
dnl Flags for "ar" command...
case $host_os_name in
darwin* | *bsd*)
ARFLAGS="-rcv"
;;
*)
ARFLAGS="crvs"
;;
esac
AC_SUBST(ARFLAGS)
dnl Prep libraries specifically for cupsd and backends...
BACKLIBS=""
SERVERLIBS=""
AC_SUBST(BACKLIBS)
AC_SUBST(SERVERLIBS)
dnl See if we have POSIX ACL support...
SAVELIBS="$LIBS"
LIBS=""
AC_ARG_ENABLE(acl, [ --enable-acl build with POSIX ACL support])
if test "x$enable_acl" != xno; then
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
SERVERLIBS="$SERVERLIBS $LIBS"
fi
LIBS="$SAVELIBS"
dnl Check for DBUS support
DBUSDIR=""
DBUS_NOTIFIER=""
DBUS_NOTIFIERLIBS=""
AC_ARG_ENABLE(dbus, [ --disable-dbus build without DBUS support])
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
DBUSDIR="$withval")
if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x -a "x$host_os_name" != xdarwin; then
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
SERVERLIBS="$SERVERLIBS `$PKGCONFIG --libs dbus-1`"
DBUS_NOTIFIER="dbus"
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
SAVELIBS="$LIBS"
LIBS="$LIBS $DBUS_NOTIFIERLIBS"
AC_CHECK_FUNC(dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
AC_CHECK_FUNC(dbus_threads_init,
AC_DEFINE(HAVE_DBUS_THREADS_INIT))
LIBS="$SAVELIBS"
if test -d /etc/dbus-1 -a "x$DBUSDIR" = x; then
DBUSDIR="/etc/dbus-1"
fi
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(DBUSDIR)
AC_SUBST(DBUS_NOTIFIER)
AC_SUBST(DBUS_NOTIFIERLIBS)
dnl Extra platform-specific libraries...
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
CUPS_DEFAULT_SYSTEM_AUTHKEY=""
CUPS_SYSTEM_AUTHKEY=""
INSTALLXPC=""
case $host_os_name in
darwin*)
BACKLIBS="$BACKLIBS -framework IOKit"
SERVERLIBS="$SERVERLIBS -framework IOKit -weak_framework ApplicationServices"
LIBS="-framework CoreFoundation -framework Security $LIBS"
dnl Check for framework headers...
AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
dnl Check for dynamic store function...
SAVELIBS="$LIBS"
LIBS="-framework SystemConfiguration $LIBS"
AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName,[
AC_DEFINE(HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME)],[
LIBS="$SAVELIBS"])
dnl Check for the new membership functions in MacOSX 10.4...
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
AC_CHECK_FUNCS(mbr_uid_to_uuid)
dnl Need <dlfcn.h> header...
AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
dnl Check for notify_post support
AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
AC_CHECK_FUNCS(notify_post)
dnl Check for Authorization Services support
AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
default_adminkey="$withval",
default_adminkey="default")
AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
default_operkey="$withval",
default_operkey="default")
AC_CHECK_HEADER(Security/Authorization.h, [
AC_DEFINE(HAVE_AUTHORIZATION_H)
if test "x$default_adminkey" != xdefault; then
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
CUPS_DEFAULT_SYSTEM_AUTHKEY="$default_adminkey"
else
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
CUPS_DEFAULT_SYSTEM_AUTHKEY="system.print.admin"
fi
if test "x$default_operkey" != xdefault; then
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
else
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
fi])
dnl Check for sandbox/Seatbelt support
if test $host_os_version -ge 100; then
AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
fi
if test $host_os_version -ge 110 -a $host_os_version -lt 120; then
# Broken public headers in 10.7.x...
AC_MSG_CHECKING(for sandbox/private.h presence)
if test -f /usr/local/include/sandbox/private.h; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(Run 'sudo mkdir -p /usr/local/include/sandbox' and 'sudo touch /usr/local/include/sandbox/private.h' to build CUPS.)
fi
fi
dnl Check for XPC support
AC_CHECK_HEADER(xpc/xpc.h,
AC_DEFINE(HAVE_XPC)
INSTALLXPC="install-xpc")
;;
esac
AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_AUTHKEY, "$CUPS_DEFAULT_SYSTEM_AUTHKEY")
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
AC_SUBST(INSTALLXPC)
dnl Check for build components
COMPONENTS="all"
AC_ARG_WITH(components, [ --with-components set components to build:
- "all" (default) builds everything
- "core" builds libcups and ipptool
- "libcups" builds just libcups
- "libcupslite" builds just libcups without driver support],
COMPONENTS="$withval")
cupsimagebase="cupsimage"
IPPEVECOMMANDS="ippevepcl ippeveps"
LIBCUPSOBJS="\$(COREOBJS) \$(DRIVEROBJS)"
LIBHEADERS="\$(COREHEADERS) \$(DRIVERHEADERS)"
LIBHEADERSPRIV="\$(COREHEADERSPRIV) \$(DRIVERHEADERSPRIV)"
case "$COMPONENTS" in
all)
BUILDDIRS="tools filter backend berkeley cgi-bin monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
;;
core)
BUILDDIRS="tools examples locale"
;;
corelite)
AC_DEFINE(CUPS_LITE)
BUILDDIRS="tools examples locale"
cupsimagebase=""
LIBCUPSOBJS="\$(COREOBJS)"
LIBHEADERS="\$(COREHEADERS)"
LIBHEADERSPRIV="\$(COREHEADERSPRIV)"
;;
libcups)
BUILDDIRS="locale"
cupsimagebase=""
;;
libcupslite)
AC_DEFINE(CUPS_LITE)
BUILDDIRS="locale"
cupsimagebase=""
LIBCUPSOBJS="\$(COREOBJS)"
LIBHEADERS="\$(COREHEADERS)"
LIBHEADERSPRIV="\$(COREHEADERSPRIV)"
;;
*)
AC_MSG_ERROR([Bad build component "$COMPONENT" specified!])
;;
esac
AC_SUBST(BUILDDIRS)
AC_SUBST(IPPEVECOMMANDS)
AC_SUBST(LIBCUPSOBJS)
AC_SUBST(LIBHEADERS)
AC_SUBST(LIBHEADERSPRIV)
-225
Ver Arquivo
@@ -1,225 +0,0 @@
dnl
dnl Compiler stuff for CUPS.
dnl
dnl Copyright 2007-2018 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
dnl
dnl Clear the debugging and non-shared library options unless the user asks
dnl for them...
INSTALL_STRIP=""
AC_SUBST(INSTALL_STRIP)
AC_ARG_WITH(optim, [ --with-optim set optimization flags ],
OPTIM="$withval",
OPTIM="")
AC_SUBST(OPTIM)
AC_ARG_ENABLE(debug, [ --enable-debug build with debugging symbols])
AC_ARG_ENABLE(debug_guards, [ --enable-debug-guards build with memory allocation guards])
AC_ARG_ENABLE(debug_printfs, [ --enable-debug-printfs build with CUPS_DEBUG_LOG support])
AC_ARG_ENABLE(unit_tests, [ --enable-unit-tests build and run unit tests])
dnl For debugging, keep symbols, otherwise strip them...
if test x$enable_debug = xyes -a "x$OPTIM" = x; then
OPTIM="-g"
else
INSTALL_STRIP="-s"
fi
dnl Debug printfs can slow things down, so provide a separate option for that
if test x$enable_debug_printfs = xyes; then
CFLAGS="$CFLAGS -DDEBUG"
CXXFLAGS="$CXXFLAGS -DDEBUG"
fi
dnl Debug guards use an extra 4 bytes for some structures like strings in the
dnl string pool, so provide a separate option for that
if test x$enable_debug_guards = xyes; then
CFLAGS="$CFLAGS -DDEBUG_GUARDS"
CXXFLAGS="$CXXFLAGS -DDEBUG_GUARDS"
fi
dnl Unit tests take up time during a compile...
if test x$enable_unit_tests = xyes; then
if test "$build" != "$host"; then
AC_MSG_ERROR([Sorry, cannot build unit tests when cross-compiling.])
fi
UNITTESTS="unittests"
else
UNITTESTS=""
fi
AC_SUBST(UNITTESTS)
dnl Setup general architecture flags...
AC_ARG_WITH(archflags, [ --with-archflags set default architecture flags ])
AC_ARG_WITH(ldarchflags, [ --with-ldarchflags set program architecture flags ])
if test -z "$with_archflags"; then
ARCHFLAGS=""
else
ARCHFLAGS="$with_archflags"
fi
if test -z "$with_ldarchflags"; then
if test "$host_os_name" = darwin; then
# Only create Intel programs by default
LDARCHFLAGS="`echo $ARCHFLAGS | sed -e '1,$s/-arch ppc64//'`"
else
LDARCHFLAGS="$ARCHFLAGS"
fi
else
LDARCHFLAGS="$with_ldarchflags"
fi
AC_SUBST(ARCHFLAGS)
AC_SUBST(LDARCHFLAGS)
dnl Read-only data/program support on Linux...
AC_ARG_ENABLE(relro, [ --enable-relro build with the GCC relro option])
dnl Clang/GCC address sanitizer...
AC_ARG_ENABLE(sanitizer, [ --enable-sanitizer build with AddressSanitizer])
dnl Update compiler options...
CXXLIBS="${CXXLIBS:=}"
AC_SUBST(CXXLIBS)
PIEFLAGS=""
AC_SUBST(PIEFLAGS)
RELROFLAGS=""
AC_SUBST(RELROFLAGS)
WARNING_OPTIONS=""
AC_SUBST(WARNING_OPTIONS)
if test -n "$GCC"; then
# Add GCC-specific compiler options...
# Address sanitizer is a useful tool to use when developing/debugging
# code but adds about 2x overhead...
if test x$enable_sanitizer = xyes; then
# Use -fsanitize=address with debugging...
OPTIM="$OPTIM -g -fsanitize=address"
else
# Otherwise use the Fortify enhancements to catch any unbounded
# string operations...
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
fi
# Default optimization options...
if test -z "$OPTIM"; then
# Default to optimize-for-size and debug
OPTIM="-Os -g"
fi
# Generate position-independent code as needed...
if test $PICFLAG = 1; then
OPTIM="-fPIC $OPTIM"
fi
# The -fstack-protector option is available with some versions of
# GCC and adds "stack canaries" which detect when the return address
# has been overwritten, preventing many types of exploit attacks.
AC_MSG_CHECKING(whether compiler supports -fstack-protector)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector"
AC_TRY_LINK(,,
if test "x$LSB_BUILD" = xy; then
# Can't use stack-protector with LSB binaries...
OPTIM="$OPTIM -fno-stack-protector"
else
OPTIM="$OPTIM -fstack-protector"
fi
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
if test "x$LSB_BUILD" != xy; then
# The -fPIE option is available with some versions of GCC and
# adds randomization of addresses, which avoids another class of
# exploits that depend on a fixed address for common functions.
#
# Not available to LSB binaries...
AC_MSG_CHECKING(whether compiler supports -fPIE)
OLDCFLAGS="$CFLAGS"
case "$host_os_name" in
darwin*)
CFLAGS="$CFLAGS -fPIE -Wl,-pie"
AC_TRY_COMPILE(,,[
PIEFLAGS="-fPIE -Wl,-pie"
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
;;
*)
CFLAGS="$CFLAGS -fPIE -pie"
AC_TRY_COMPILE(,,[
PIEFLAGS="-fPIE -pie"
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
;;
esac
CFLAGS="$OLDCFLAGS"
fi
# Add useful warning options for tracking down problems...
WARNING_OPTIONS="-Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion"
# Test GCC version for certain warning flags since -Werror
# doesn't trigger...
gccversion=`$CC --version | head -1 | awk '{print $NF}'`
case "$gccversion" in
7.* | 8.*)
WARNING_OPTIONS="$WARNING_OPTIONS -Wno-format-truncation -Wno-tautological-compare"
;;
esac
# Additional warning options for development testing...
if test -d .git; then
WARNING_OPTIONS="-Werror -Wno-error=deprecated-declarations $WARNING_OPTIONS"
fi
else
# Add vendor-specific compiler options...
case $host_os_name in
sunos*)
# Solaris
if test -z "$OPTIM"; then
OPTIM="-xO2"
fi
if test $PICFLAG = 1; then
OPTIM="-KPIC $OPTIM"
fi
;;
*)
# Running some other operating system; inform the user
# they should contribute the necessary options via
# Github...
echo "Building CUPS with default compiler optimizations; contact the CUPS developers on Github"
echo "(https://github.com/apple/cups/issues) with the uname and compiler options needed for"
echo "your platform, or set the CFLAGS and LDFLAGS environment variables before running"
echo "configure."
;;
esac
fi
# Add general compiler options per platform...
case $host_os_name in
linux*)
# glibc 2.8 and higher breaks peer credentials unless you
# define _GNU_SOURCE...
OPTIM="$OPTIM -D_GNU_SOURCE"
# The -z relro option is provided by the Linux linker command to
# make relocatable data read-only.
if test x$enable_relro = xyes; then
RELROFLAGS="-Wl,-z,relro,-z,now"
fi
;;
esac
-439
Ver Arquivo
@@ -1,439 +0,0 @@
dnl
dnl Default cupsd configuration settings for CUPS.
dnl
dnl Copyright © 2007-2018 by Apple Inc.
dnl Copyright © 2006-2007 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
dnl
dnl Default languages...
LANGUAGES="`ls -1 locale/cups_*.po 2>/dev/null | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
AC_ARG_WITH(languages, [ --with-languages set installed languages, default=all ],[
case "$withval" in
none | no) LANGUAGES="" ;;
all) ;;
*) LANGUAGES="$withval" ;;
esac])
AC_SUBST(LANGUAGES)
dnl macOS bundle-based localization support
AC_ARG_WITH(bundledir, [ --with-bundledir set localization bundle directory ],
CUPS_BUNDLEDIR="$withval",[
if test "x$host_os_name" = xdarwin -a $host_os_version -ge 100; then
CUPS_BUNDLEDIR="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A"
LANGUAGES=""
else
CUPS_BUNDLEDIR=""
fi])
AC_SUBST(CUPS_BUNDLEDIR)
if test "x$CUPS_BUNDLEDIR" != x; then
AC_DEFINE_UNQUOTED(CUPS_BUNDLEDIR, "$CUPS_BUNDLEDIR")
fi
AC_ARG_WITH(bundlelang, [ --with-bundlelang set localization bundle base language (English or en) ],
cups_bundlelang="$withval",[
if test $host_os_version -ge 190; then
cups_bundlelang="en"
else
cups_bundlelang="English"
fi])
if test "x$cups_bundlelang" != x -a "x$CUPS_BUNDLEDIR" != x; then
CUPS_RESOURCEDIR="$CUPS_BUNDLEDIR/Resources/$cups_bundlelang.lproj"
else
CUPS_RESOURCEDIR=""
fi
AC_SUBST(CUPS_RESOURCEDIR)
dnl Default executable file permissions
AC_ARG_WITH(exe_file_perm, [ --with-exe-file-perm set default executable permissions value, default=0555],
CUPS_EXE_FILE_PERM="$withval",
[case "$host_os_name" in
linux* | gnu*)
CUPS_EXE_FILE_PERM="755"
;;
*)
CUPS_EXE_FILE_PERM="555"
;;
esac])
AC_SUBST(CUPS_EXE_FILE_PERM)
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$host_os_name" = 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 permissions for cupsd
AC_ARG_WITH(cupsd_file_perm, [ --with-cupsd-file-perm set default cupsd permissions, default=0500],
CUPS_CUPSD_FILE_PERM="$withval",
[case "$host_os_name" in
linux* | gnu*)
CUPS_CUPSD_FILE_PERM="700"
;;
*)
CUPS_CUPSD_FILE_PERM="500"
;;
esac])
AC_SUBST(CUPS_CUPSD_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 FatalErrors
AC_ARG_WITH(fatal_errors, [ --with-fatal-errors set default FatalErrors value, default=config],
CUPS_FATAL_ERRORS="$withval",
CUPS_FATAL_ERRORS="config")
AC_SUBST(CUPS_FATAL_ERRORS)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_FATAL_ERRORS, "$CUPS_FATAL_ERRORS")
dnl Default LogLevel
AC_ARG_WITH(log_level, [ --with-log-level set default LogLevel value, default=warn],
CUPS_LOG_LEVEL="$withval",
CUPS_LOG_LEVEL="warn")
AC_SUBST(CUPS_LOG_LEVEL)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_LEVEL, "$CUPS_LOG_LEVEL")
dnl Default AccessLogLevel
AC_ARG_WITH(access_log_level, [ --with-access-log-level set default AccessLogLevel value, default=none],
CUPS_ACCESS_LOG_LEVEL="$withval",
CUPS_ACCESS_LOG_LEVEL="none")
AC_SUBST(CUPS_ACCESS_LOG_LEVEL)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_ACCESS_LOG_LEVEL, "$CUPS_ACCESS_LOG_LEVEL")
dnl Default PageLogFormat
AC_ARG_ENABLE(page_logging, [ --enable-page-logging enable page_log by default])
if test "x$enable_page_logging" = xyes; then
CUPS_PAGE_LOG_FORMAT=""
else
CUPS_PAGE_LOG_FORMAT="PageLogFormat"
fi
AC_SUBST(CUPS_PAGE_LOG_FORMAT)
dnl Default Browsing
AC_ARG_ENABLE(browsing, [ --disable-browsing disable Browsing by default])
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=""],
default_local_protocols="$withval",
default_local_protocols="default")
if test x$with_local_protocols != xno; then
if test "x$default_local_protocols" = "xdefault"; then
if test "x$DNSSD_BACKEND" != "x"; then
CUPS_BROWSE_LOCAL_PROTOCOLS="dnssd"
else
CUPS_BROWSE_LOCAL_PROTOCOLS=""
fi
else
CUPS_BROWSE_LOCAL_PROTOCOLS="$default_local_protocols"
fi
else
CUPS_BROWSE_LOCAL_PROTOCOLS=""
fi
AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS,
"$CUPS_BROWSE_LOCAL_PROTOCOLS")
dnl Default DefaultShared
AC_ARG_ENABLE(default_shared, [ --disable-default-shared
disable DefaultShared by default])
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 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 x$host_os_name = xdarwin; then
if test x`id -u _lp 2>/dev/null` = x; then
CUPS_USER="lp";
else
CUPS_USER="_lp";
fi
AC_MSG_RESULT($CUPS_USER)
elif 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)
if test "x$CUPS_USER" = "xroot" -o "x$CUPS_USER" = "x0"; then
AC_MSG_ERROR([The default user for CUPS cannot be root!])
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 x$host_os_name = xdarwin; then
if test x`id -g _lp 2>/dev/null` = x; then
CUPS_GROUP="lp";
else
CUPS_GROUP="_lp";
fi
AC_MSG_RESULT($CUPS_GROUP)
elif test -f /etc/group; then
GROUP_LIST="_lp 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)
if test "x$CUPS_GROUP" = "xroot" -o "x$CUPS_GROUP" = "xwheel" -o "x$CUPS_GROUP" = "x0"; then
AC_MSG_ERROR([The default group for CUPS cannot be root!])
fi
AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups for CUPS],
CUPS_SYSTEM_GROUPS="$withval",
if test x$host_os_name = xdarwin; then
CUPS_SYSTEM_GROUPS="admin"
else
AC_MSG_CHECKING(for default system groups)
if test -f /etc/group; then
CUPS_SYSTEM_GROUPS=""
GROUP_LIST="lpadmin sys system root wheel"
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
fi)
CUPS_PRIMARY_SYSTEM_GROUP="`echo $CUPS_SYSTEM_GROUPS | awk '{print $1}'`"
for group in $CUPS_SYSTEM_GROUPS; do
if test "x$CUPS_GROUP" = "x$group"; then
AC_MSG_ERROR([The default system groups cannot contain the default CUPS group!])
fi
done
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$default_printcap != xno; then
if test "x$default_printcap" = "xdefault"; then
case $host_os_name in
darwin*)
if test $host_os_version -ge 90; then
CUPS_DEFAULT_PRINTCAP="/Library/Preferences/org.cups.printers.plist"
else
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
fi
;;
sunos*)
CUPS_DEFAULT_PRINTCAP="/etc/printers.conf"
;;
*)
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
;;
esac
else
CUPS_DEFAULT_PRINTCAP="$default_printcap"
fi
else
CUPS_DEFAULT_PRINTCAP=""
fi
AC_SUBST(CUPS_DEFAULT_PRINTCAP)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl Default LPD config file...
AC_ARG_WITH(lpdconfigfile, [ --with-lpdconfigfile set default LPDConfigFile URI],
default_lpdconfigfile="$withval",
default_lpdconfigfile="default")
if test x$default_lpdconfigfile != xno; then
if test "x$default_lpdconfigfile" = "xdefault"; then
case $host_os_name in
darwin*)
CUPS_DEFAULT_LPD_CONFIG_FILE="launchd:///System/Library/LaunchDaemons/org.cups.cups-lpd.plist"
;;
*)
if test "x$XINETD" != x; then
CUPS_DEFAULT_LPD_CONFIG_FILE="xinetd://$XINETD/cups-lpd"
else
CUPS_DEFAULT_LPD_CONFIG_FILE=""
fi
;;
esac
else
CUPS_DEFAULT_LPD_CONFIG_FILE="$default_lpdconfigfile"
fi
else
CUPS_DEFAULT_LPD_CONFIG_FILE=""
fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG_FILE, "$CUPS_DEFAULT_LPD_CONFIG_FILE")
AC_SUBST(CUPS_DEFAULT_LPD_CONFIG_FILE)
dnl Default SMB config file...
AC_ARG_WITH(smbconfigfile, [ --with-smbconfigfile set default SMBConfigFile URI],
default_smbconfigfile="$withval",
default_smbconfigfile="default")
if test x$default_smbconfigfile != xno; then
if test "x$default_smbconfigfile" = "xdefault"; then
if test -f /etc/smb.conf; then
CUPS_DEFAULT_SMB_CONFIG_FILE="samba:///etc/smb.conf"
else
CUPS_DEFAULT_SMB_CONFIG_FILE=""
fi
else
CUPS_DEFAULT_SMB_CONFIG_FILE="$default_smbconfigfile"
fi
else
CUPS_DEFAULT_SMB_CONFIG_FILE=""
fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG_FILE, "$CUPS_DEFAULT_SMB_CONFIG_FILE")
AC_SUBST(CUPS_DEFAULT_SMB_CONFIG_FILE)
dnl Default MaxCopies value...
AC_ARG_WITH(max-copies, [ --with-max-copies set default max copies value, default=9999 ],
CUPS_MAX_COPIES="$withval",
CUPS_MAX_COPIES="9999")
AC_SUBST(CUPS_MAX_COPIES)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_MAX_COPIES, $CUPS_MAX_COPIES)
dnl Default raw printing state
AC_ARG_ENABLE(raw_printing, [ --disable-raw-printing do not allow raw printing by default])
if test "x$enable_raw_printing" != xno; then
DEFAULT_RAW_PRINTING=""
else
DEFAULT_RAW_PRINTING="#"
fi
AC_SUBST(DEFAULT_RAW_PRINTING)
dnl Default SNMP options...
AC_ARG_WITH(snmp-address, [ --with-snmp-address set SNMP query address, default=auto ],
if test "x$withval" = x; then
CUPS_SNMP_ADDRESS=""
else
CUPS_SNMP_ADDRESS="Address $withval"
fi,
if test "x$host_os_name" = xdarwin; then
CUPS_SNMP_ADDRESS=""
else
CUPS_SNMP_ADDRESS="Address @LOCAL"
fi)
AC_ARG_WITH(snmp-community, [ --with-snmp-community set SNMP community, default=public ],
CUPS_SNMP_COMMUNITY="Community $withval",
CUPS_SNMP_COMMUNITY="Community public")
AC_SUBST(CUPS_SNMP_ADDRESS)
AC_SUBST(CUPS_SNMP_COMMUNITY)
dnl New default port definition for IPP...
AC_ARG_WITH(ipp-port, [ --with-ipp-port set port number for IPP, default=631 ],
DEFAULT_IPP_PORT="$withval",
DEFAULT_IPP_PORT="631")
AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl Web interface...
AC_ARG_ENABLE(webif, [ --enable-webif enable the web interface by default, default=no for macOS])
case "x$enable_webif" in
xno)
CUPS_WEBIF=No
CUPS_DEFAULT_WEBIF=0
;;
xyes)
CUPS_WEBIF=Yes
CUPS_DEFAULT_WEBIF=1
;;
*)
if test $host_os_name = darwin; then
CUPS_WEBIF=No
CUPS_DEFAULT_WEBIF=0
else
CUPS_WEBIF=Yes
CUPS_DEFAULT_WEBIF=1
fi
;;
esac
AC_SUBST(CUPS_WEBIF)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF)
-299
Ver Arquivo
@@ -1,299 +0,0 @@
dnl
dnl Directory stuff for CUPS.
dnl
dnl Copyright 2007-2017 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
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 "$host_os_name" = 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 "$host_os_name" = darwin; then
sysconfdir="/private/etc"
else
sysconfdir="/etc"
fi
else
sysconfdir="$prefix/etc"
fi
fi
dnl Fix "libdir" variable...
if test "$libdir" = "\${exec_prefix}/lib"; then
case "$host_os_name" in
linux*)
if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then
libdir="$exec_prefix/lib64"
fi
;;
esac
fi
dnl Setup private include directory...
AC_ARG_WITH(privateinclude, [ --with-privateinclude set path for private include files, default=none],privateinclude="$withval",privateinclude="")
if test "x$privateinclude" != x -a "x$privateinclude" != xnone; then
PRIVATEINCLUDE="$privateinclude/cups"
else
privateinclude=""
PRIVATEINCLUDE=""
fi
AC_SUBST(privateinclude)
AC_SUBST(PRIVATEINCLUDE)
dnl LPD sharing support...
AC_ARG_WITH(lpdconfig, [ --with-lpdconfig set URI for LPD config file],
LPDCONFIG="$withval", LPDCONFIG="")
if test "x$LPDCONFIG" = x; then
if test -f /System/Library/LaunchDaemons/org.cups.cups-lpd.plist; then
LPDCONFIG="launchd:///System/Library/LaunchDaemons/org.cups.cups-lpd.plist"
elif test "x$XINETD" != x; then
LPDCONFIG="xinetd://$XINETD/cups-lpd"
fi
fi
if test "x$LPDCONFIG" = xoff; then
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG, "")
else
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG, "$LPDCONFIG")
fi
dnl SMB sharing support...
AC_ARG_WITH(smbconfig, [ --with-smbconfig set URI for Samba config file],
SMBCONFIG="$withval", SMBCONFIG="")
if test "x$SMBCONFIG" = x; then
if test -f /System/Library/LaunchDaemons/smbd.plist; then
SMBCONFIG="launchd:///System/Library/LaunchDaemons/smbd.plist"
else
for dir in /etc /etc/samba /usr/local/etc; do
if test -f $dir/smb.conf; then
SMBCONFIG="samba://$dir/smb.conf"
break
fi
done
fi
fi
if test "x$SMBCONFIG" = xoff; then
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG, "")
else
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG, "$SMBCONFIG")
fi
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$host_os_name" = 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)
# Icon directory
AC_ARG_WITH(icondir, [ --with-icondir set path for application icons],icondir="$withval",icondir="")
if test "x$icondir" = x -a -d /usr/share/icons; then
ICONDIR="/usr/share/icons"
else
ICONDIR="$icondir"
fi
AC_SUBST(ICONDIR)
# Menu directory
AC_ARG_WITH(menudir, [ --with-menudir set path for application menus],menudir="$withval",menudir="")
if test "x$menudir" = x -a -d /usr/share/applications; then
MENUDIR="/usr/share/applications"
else
MENUDIR="$menudir"
fi
AC_SUBST(MENUDIR)
# 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
if test "$localedir" = "\${datarootdir}/locale"; then
case "$host_os_name" in
linux* | gnu* | *bsd* | darwin*)
CUPS_LOCALEDIR="$datarootdir/locale"
;;
*)
# This is the standard System V location...
CUPS_LOCALEDIR="$exec_prefix/lib/locale"
;;
esac
else
CUPS_LOCALEDIR="$localedir"
fi
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 "$host_os_name" in
*bsd* | darwin*)
# *BSD and Darwin (macOS)
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
AC_ARG_WITH(rundir, [ --with-rundir set transient run-time state directory],CUPS_STATEDIR="$withval",[
case "$host_os_name" in
darwin*)
# Darwin (macOS)
CUPS_STATEDIR="$CUPS_SERVERROOT"
;;
*)
# All others
CUPS_STATEDIR="$localstatedir/run/cups"
;;
esac])
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
AC_SUBST(CUPS_STATEDIR)
-76
Ver Arquivo
@@ -1,76 +0,0 @@
dnl
dnl DNS Service Discovery (aka Bonjour) stuff for CUPS.
dnl
dnl Copyright © 2007-2019 by Apple Inc.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
dnl
AC_ARG_ENABLE(avahi, [ --disable-avahi disable DNS Service Discovery support using Avahi])
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support using mDNSResponder])
AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes],
CFLAGS="-I$withval $CFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
DNSSDLIBS=""
DNSSD_BACKEND=""
IPPFIND_BIN=""
IPPFIND_MAN=""
if test "x$PKGCONFIG" != x -a x$enable_avahi != xno -a x$host_os_name != xdarwin; then
AC_MSG_CHECKING(for Avahi)
if $PKGCONFIG --exists avahi-client; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
DNSSD_BACKEND="dnssd"
IPPFIND_BIN="ippfind"
IPPFIND_MAN="ippfind.1"
AC_DEFINE(HAVE_AVAHI)
else
AC_MSG_RESULT(no)
fi
fi
if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then
AC_CHECK_HEADER(dns_sd.h, [
case "$host_os_name" in
darwin*)
# Darwin and macOS...
AC_DEFINE(HAVE_DNSSD)
DNSSD_BACKEND="dnssd"
IPPFIND_BIN="ippfind"
IPPFIND_MAN="ippfind.1"
;;
*)
# All others...
AC_MSG_CHECKING(for current version of dns_sd library)
SAVELIBS="$LIBS"
LIBS="$LIBS -ldns_sd"
AC_TRY_COMPILE([#include <dns_sd.h>],
[int constant = kDNSServiceFlagsShareConnection;
unsigned char txtRecord[100];
uint8_t valueLen;
TXTRecordGetValuePtr(sizeof(txtRecord),
txtRecord, "value", &valueLen);],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DNSSD)
DNSSDLIBS="-ldns_sd"
DNSSD_BACKEND="dnssd",
IPPFIND_BIN="ippfind"
IPPFIND_MAN="ippfind.1"
AC_MSG_RESULT(no))
LIBS="$SAVELIBS"
;;
esac
])
fi
AC_SUBST(DNSSDLIBS)
AC_SUBST(DNSSD_BACKEND)
AC_SUBST(IPPFIND_BIN)
AC_SUBST(IPPFIND_MAN)
-123
Ver Arquivo
@@ -1,123 +0,0 @@
dnl
dnl GSSAPI/Kerberos library detection for CUPS.
dnl
dnl Copyright 2007-2017 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products.
dnl
dnl This file contains Kerberos support code, copyright 2006 by
dnl Jelmer Vernooij.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
dnl
AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support])
LIBGSSAPI=""
AC_SUBST(LIBGSSAPI)
if test x$enable_gssapi != xno; then
AC_PATH_TOOL(KRB5CONFIG, krb5-config)
if test "x$KRB5CONFIG" != x; then
case "$host_os_name" in
darwin)
# macOS weak-links to the Kerberos framework...
LIBGSSAPI="-weak_framework Kerberos"
AC_MSG_CHECKING(for GSS framework)
if test -d /System/Library/Frameworks/GSS.framework; then
AC_MSG_RESULT(yes)
LIBGSSAPI="$LIBGSSAPI -weak_framework GSS"
else
AC_MSG_RESULT(no)
fi
;;
sunos*)
# Solaris has a non-standard krb5-config, don't use it!
AC_CHECK_LIB(gss, gss_display_status,
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
CFLAGS="`$KRB5CONFIG --cflags` $CFLAGS"
CPPFLAGS="`$KRB5CONFIG --cflags` $CPPFLAGS"
LIBGSSAPI="-lgss `$KRB5CONFIG --libs`")
;;
*)
# Other platforms just ask for GSSAPI
CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS"
CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS"
LIBGSSAPI="`$KRB5CONFIG --libs gssapi`"
;;
esac
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
else
# Check for vendor-specific implementations...
case "$host_os_name" in
hp-ux*)
AC_CHECK_LIB(gss, gss_display_status,
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
LIBGSSAPI="-lgss -lgssapi_krb5")
;;
sunos*)
AC_CHECK_LIB(gss, gss_display_status,
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
LIBGSSAPI="-lgss")
;;
esac
fi
if test "x$LIBGSSAPI" != x; then
AC_CHECK_HEADER(krb5.h, AC_DEFINE(HAVE_KRB5_H))
if test -d /System/Library/Frameworks/GSS.framework; then
AC_CHECK_HEADER(GSS/gssapi.h, AC_DEFINE(HAVE_GSS_GSSAPI_H))
AC_CHECK_HEADER(GSS/gssapi_generic.h, AC_DEFINE(HAVE_GSS_GSSAPI_GENERIC_H))
AC_CHECK_HEADER(GSS/gssapi_spi.h, AC_DEFINE(HAVE_GSS_GSSAPI_SPI_H))
else
AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H))
AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H))
fi
SAVELIBS="$LIBS"
LIBS="$LIBS $LIBGSSAPI"
AC_CHECK_FUNC(__ApplePrivate_gss_acquire_cred_ex_f,
AC_DEFINE(HAVE_GSS_ACQUIRE_CRED_EX_F))
AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
if test x$ac_cv_header_gssapi_gssapi_h = xyes; then
AC_TRY_COMPILE([ #include <gssapi/gssapi.h> ],
[ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ],
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
elif test x$ac_cv_header_gss_gssapi_h = xyes; then
AC_TRY_COMPILE([ #include <GSS/gssapi.h> ],
[ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ],
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
else
AC_TRY_COMPILE([ #include <gssapi.h> ],
[ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ],
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
fi
LIBS="$SAVELIBS"
fi
fi
dnl Default GSS service name...
AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service name],
default_gssservicename="$withval",
default_gssservicename="default")
if test x$default_gssservicename != xno; then
if test "x$default_gssservicename" = "xdefault"; then
CUPS_DEFAULT_GSSSERVICENAME="host"
else
CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
fi
else
CUPS_DEFAULT_GSSSERVICENAME=""
fi
AC_SUBST(CUPS_DEFAULT_GSSSERVICENAME)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
-42
Ver Arquivo
@@ -1,42 +0,0 @@
dnl
dnl Large file support stuff for CUPS.
dnl
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
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 x$ac_cv_sys_large_files = x1; then
LARGEFILE="$LARGEFILE -D_LARGE_FILES"
fi
if test x$ac_cv_sys_file_offset_bits = x64; 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))
-60
Ver Arquivo
@@ -1,60 +0,0 @@
dnl
dnl Libtool stuff for CUPS.
dnl
dnl Copyright 2007-2018 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
dnl
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=/path/to/libtool
build with libtool (UNSUPPORTED!)],
[if test x$enable_libtool_unsupported != xno; then
if test x$enable_libtool_unsupported == xyes; then
AC_MSG_ERROR([Use --enable-libtool-unsupported=/path/to/libtool.])
fi
LIBTOOL="$enable_libtool_unsupported"
enable_shared=no
echo "WARNING: libtool is not supported or endorsed by Apple Inc."
echo " WE DO NOT PROVIDE SUPPORT FOR LIBTOOL PROBLEMS."
else
LIBTOOL=""
fi])
if test x$LIBTOOL != x; then
DSO="\$(LIBTOOL) --mode=link --tag=CC ${CC}"
DSOXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}"
LD_CC="\$(LIBTOOL) --mode=link --tag=CC ${CC}"
LD_CXX="\$(LIBTOOL) --mode=link --tag=CXX ${CXX}"
LIBCUPS="libcups.la"
LIBCUPSSTATIC="libcups.la"
LIBCUPSCGI="libcupscgi.la"
LIBCUPSIMAGE="libcupsimage.la"
LIBCUPSMIME="libcupsmime.la"
LIBCUPSPPDC="libcupsppdc.la"
LIBTOOL_CC="\$(LIBTOOL) --mode=compile --tag=CC"
LIBTOOL_CXX="\$(LIBTOOL) --mode=compile --tag=CXX"
LIBTOOL_INSTALL="\$(LIBTOOL) --mode=install"
LINKCUPS="../cups/\$(LIBCUPS)"
LINKCUPSIMAGE="../cups/\$(LIBCUPSIMAGE)"
else
LD_CC="\$(CC)"
LD_CXX="\$(CXX)"
LIBTOOL_CC=""
LIBTOOL_CXX=""
LIBTOOL_INSTALL=""
fi
AC_SUBST(LD_CC)
AC_SUBST(LD_CXX)
AC_SUBST(LIBTOOL)
AC_SUBST(LIBTOOL_CC)
AC_SUBST(LIBTOOL_CXX)
AC_SUBST(LIBTOOL_INSTALL)
-29
Ver Arquivo
@@ -1,29 +0,0 @@
dnl
dnl Manpage stuff for CUPS.
dnl
dnl Copyright © 2007-2019 by Apple Inc.
dnl Copyright © 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
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 "$host_os_name" in
darwin* | linux* | gnu* | *bsd*)
# Darwin, macOS, Linux, GNU HURD, and *BSD
mandir="/usr/share/man"
;;
*)
# All others
mandir="/usr/man"
;;
esac
fi

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