Comparar commits
10 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| d996e1ac50 | |||
| ce6379738a | |||
| 6f2911b5b2 | |||
| 443cd51633 | |||
| b4dea4d7c6 | |||
| 608728d8a4 | |||
| 3dd728977a | |||
| 5b8f8fee67 | |||
| a6d5d8328d | |||
| 89c7a9d178 |
@@ -1,3 +0,0 @@
|
||||
.git* export-ignore
|
||||
.mailmap export-ignore
|
||||
tools export-ignore
|
||||
+8
-168
@@ -1,170 +1,10 @@
|
||||
*.a
|
||||
*.bck
|
||||
*.cgi
|
||||
*.gz
|
||||
*.o
|
||||
*.tokens
|
||||
.buildrev
|
||||
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/makedocset
|
||||
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/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/client.conf.man
|
||||
man/cups-files.conf.man
|
||||
man/cups-lpd.man
|
||||
man/cups-snmp.man
|
||||
man/cupsaddsmb.man
|
||||
man/cupsd.conf.man
|
||||
man/cupsd.man
|
||||
man/lpoptions.man
|
||||
man/mantohtml
|
||||
monitor/bcp
|
||||
monitor/tbcp
|
||||
notifier/dbus
|
||||
notifier/mailto
|
||||
notifier/rss
|
||||
notifier/testnotify
|
||||
packaging/cups.list
|
||||
org.cups.docset*
|
||||
patches
|
||||
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/accept
|
||||
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
|
||||
systemv/reject
|
||||
templates/header.tmpl
|
||||
templates/*/header.tmpl
|
||||
test/cups-str-*.html
|
||||
test/*_log-*
|
||||
test/ippfind
|
||||
test/ippfind-static
|
||||
test/ippserver
|
||||
test/ippserver-shared
|
||||
test/ipptool
|
||||
test/ipptool-static
|
||||
test/pwg-raster-samples-*
|
||||
vcnet/.vs
|
||||
vcnet/packages
|
||||
vcnet/Win32
|
||||
vcnet/x64
|
||||
xcode/CUPS.xcodeproj/project.xcworkspace/
|
||||
xcode/CUPS.xcodeproj/xcuserdata/
|
||||
|
||||
buildtest.env
|
||||
build.log
|
||||
temp
|
||||
tools/.buildrev
|
||||
tools/Makefile
|
||||
tools/config.log
|
||||
tools/config.status
|
||||
tools/sendbuildlog
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[submodule "stable"]
|
||||
path = stable
|
||||
url = https://github.com/apple/cups.git
|
||||
branch = branch-2.1
|
||||
[submodule "development"]
|
||||
path = development
|
||||
url = https://github.com/apple/cups.git
|
||||
-11
@@ -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>
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# Travis CI configuration file for CUPS.
|
||||
#
|
||||
# Copyright © 2018 by Apple Inc.
|
||||
#
|
||||
# Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||
# information.
|
||||
#
|
||||
|
||||
language: c
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Linux-specific build stuff
|
||||
- dist: trusty
|
||||
sudo: required
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y libavahi-client-dev libgnutls28-dev libkrb5-dev libnss-mdns libpam-dev libsystemd-dev libusb-1.0-0-dev zlib1g-dev
|
||||
|
||||
# macOS-specific build stuff
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
|
||||
script: ./configure && make check
|
||||
-226
@@ -1,226 +0,0 @@
|
||||
CHANGES - 2.3b6 - 2018-12-07
|
||||
============================
|
||||
|
||||
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-4700: 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)
|
||||
@@ -1,14 +0,0 @@
|
||||
Contributing to CUPS
|
||||
====================
|
||||
|
||||
CUPS is developed by Apple Inc. and distributed as open source software under
|
||||
the Apache License, Version 2.0. 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 web
|
||||
site. Changes to existing source files should be submitted as unified diffs
|
||||
(both Subversion and Git produce this format by default) while new source files
|
||||
should be provided as-is or in an archive. Github pull requests can also be
|
||||
used to submit changes.
|
||||
@@ -1,54 +0,0 @@
|
||||
CREDITS - 2017-05-01
|
||||
====================
|
||||
|
||||
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".
|
||||
-618
@@ -1,618 +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.
|
||||
|
||||
> 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 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 Mini-XML 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)
|
||||
@since CUPS version@ - Marks the function as new in the specified version
|
||||
of CUPS.
|
||||
@private@ - Marks the function as private (same as starting the
|
||||
function name with an underscore)
|
||||
|
||||
|
||||
### 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.
|
||||
-227
@@ -1,227 +0,0 @@
|
||||
INSTALL - CUPS v2.3b6 - 2018-12-07
|
||||
==================================
|
||||
|
||||
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.
|
||||
-202
@@ -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.
|
||||
+968
@@ -0,0 +1,968 @@
|
||||
Common UNIX Printing System License Agreement
|
||||
|
||||
Copyright 2007 by Apple Inc.
|
||||
1 Infinite Loop
|
||||
Cupertino, CA 95014 USA
|
||||
|
||||
WWW: http://www.cups.org/
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
The Common UNIX Printing System(tm), ("CUPS(tm)"), is provided
|
||||
under the GNU General Public License ("GPL") and GNU Library
|
||||
General Public License ("LGPL"), Version 2, with exceptions for
|
||||
Apple operating systems and the OpenSSL toolkit. A copy of the
|
||||
exceptions and licenses follow this introduction.
|
||||
|
||||
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
|
||||
located in the "cups" and "filter" subdirectories of the CUPS
|
||||
source distribution and in the "cups" include directory and
|
||||
library files in the binary distributions. The GNU GPL applies to
|
||||
the remainder of the CUPS distribution, including the "pdftops"
|
||||
filter which is based upon Xpdf.
|
||||
|
||||
For those not familiar with the GNU GPL, the license basically
|
||||
allows you to:
|
||||
|
||||
- Use the CUPS software at no charge.
|
||||
- Distribute verbatim copies of the software in source or
|
||||
binary form.
|
||||
- Sell verbatim copies of the software for a media fee, or
|
||||
sell support for the software.
|
||||
|
||||
What this license *does not* allow you to do is make changes or
|
||||
add features to CUPS and then sell a binary distribution without
|
||||
source code. You must provide source for any changes or additions
|
||||
to the software, and all code must be provided under the GPL or
|
||||
LGPL as appropriate. The only exceptions to this are the portions
|
||||
of the CUPS software covered by the Apple operating system
|
||||
license exceptions outlined later in this license agreement.
|
||||
|
||||
The GNU LGPL relaxes the "link-to" restriction, allowing you to
|
||||
develop applications that use the CUPS and CUPS Imaging libraries
|
||||
under other licenses and/or conditions as appropriate for your
|
||||
application, driver, or filter.
|
||||
|
||||
|
||||
LICENSE EXCEPTIONS
|
||||
|
||||
In addition, as the copyright holder of CUPS, Apple Inc. grants
|
||||
the following special exceptions:
|
||||
|
||||
1. Apple Operating System Development License Exception;
|
||||
|
||||
a. Software that is developed by any person or entity
|
||||
for an Apple Operating System ("Apple OS-Developed
|
||||
Software"), including but not limited to Apple and
|
||||
third party printer drivers, filters, and backends
|
||||
for an Apple Operating System, that is linked to the
|
||||
CUPS imaging library or based on any sample filters
|
||||
or backends provided with CUPS shall not be
|
||||
considered to be a derivative work or collective work
|
||||
based on the CUPS program and is exempt from the
|
||||
mandatory source code release clauses of the GNU GPL.
|
||||
You may therefore distribute linked combinations of
|
||||
the CUPS imaging library with Apple OS-Developed
|
||||
Software without releasing the source code of the
|
||||
Apple OS-Developed Software. You may also use sample
|
||||
filters and backends provided with CUPS to develop
|
||||
Apple OS-Developed Software without releasing the
|
||||
source code of the Apple OS-Developed Software.
|
||||
|
||||
b. An Apple Operating System means any operating system
|
||||
software developed and/or marketed by Apple Computer,
|
||||
Inc., including but not limited to all existing
|
||||
releases and versions of Apple's Darwin, Mac OS X,
|
||||
and Mac OS X Server products and all follow-on
|
||||
releases and future versions thereof.
|
||||
|
||||
c. This exception is only available for Apple
|
||||
OS-Developed Software and does not apply to software
|
||||
that is distributed for use on other operating
|
||||
systems.
|
||||
|
||||
d. All CUPS software that falls under this license
|
||||
exception have the following text at the top of each
|
||||
source file:
|
||||
|
||||
This file is subject to the Apple OS-Developed
|
||||
Software exception.
|
||||
|
||||
2. OpenSSL Toolkit License Exception;
|
||||
|
||||
a. Apple Inc. explicitly allows the compilation and
|
||||
distribution of the CUPS software with the OpenSSL
|
||||
Toolkit.
|
||||
|
||||
No developer is required to provide these exceptions in a
|
||||
derived work.
|
||||
|
||||
|
||||
KERBEROS SUPPORT CODE
|
||||
|
||||
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.
|
||||
|
||||
|
||||
TRADEMARKS
|
||||
|
||||
Apple Inc. has trademarked the Common UNIX Printing System, CUPS,
|
||||
and CUPS logo. You may use these names and logos in any direct port
|
||||
or binary distribution of CUPS. Please contact Apple Inc. for written
|
||||
permission to use them in derivative products. Our intention is to
|
||||
protect the value of these trademarks and ensure that any derivative
|
||||
product meets the same high-quality standards as the original.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
-284
@@ -1,284 +0,0 @@
|
||||
#
|
||||
# Common makefile definitions for CUPS.
|
||||
#
|
||||
# Copyright © 2007-2018 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.
|
||||
#
|
||||
|
||||
#
|
||||
# CUPS version...
|
||||
#
|
||||
|
||||
CUPS_VERSION = @CUPS_VERSION@
|
||||
|
||||
|
||||
#
|
||||
# Programs...
|
||||
#
|
||||
|
||||
AR = @AR@
|
||||
AWK = @AWK@
|
||||
CC = @LIBTOOL_CC@ @CC@
|
||||
CHMOD = @CHMOD@
|
||||
CXX = @LIBTOOL_CXX@ @CXX@
|
||||
DSO = @DSO@
|
||||
DSOXX = @DSOXX@
|
||||
GZIP = @GZIP@
|
||||
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
|
||||
|
||||
#
|
||||
# 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@
|
||||
|
||||
|
||||
#
|
||||
# Libraries...
|
||||
#
|
||||
|
||||
LIBCUPS = @LIBCUPS@
|
||||
LIBCUPSIMAGE = @LIBCUPSIMAGE@
|
||||
LIBCUPSOBJS = @LIBCUPSOBJS@
|
||||
LIBCUPSSTATIC = @LIBCUPSSTATIC@
|
||||
LIBGSSAPI = @LIBGSSAPI@
|
||||
LIBMALLOC = @LIBMALLOC@
|
||||
LIBMXML = @LIBMXML@
|
||||
LIBPAPER = @LIBPAPER@
|
||||
LIBUSB = @LIBUSB@
|
||||
LIBWRAP = @LIBWRAP@
|
||||
LIBZ = @LIBZ@
|
||||
|
||||
#
|
||||
# Install static libraries?
|
||||
#
|
||||
|
||||
INSTALLSTATIC = @INSTALLSTATIC@
|
||||
|
||||
#
|
||||
# IPP backend aliases...
|
||||
#
|
||||
|
||||
IPPALIASES = @IPPALIASES@
|
||||
|
||||
#
|
||||
# Install XPC backends?
|
||||
#
|
||||
|
||||
INSTALLXPC = @INSTALLXPC@
|
||||
|
||||
#
|
||||
# Code signing...
|
||||
#
|
||||
|
||||
CODE_SIGN = @CODE_SIGN@
|
||||
CODE_SIGN_IDENTITY = -
|
||||
|
||||
#
|
||||
# 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)
|
||||
#
|
||||
|
||||
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)
|
||||
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 = -L../cups @ARCHFLAGS@ @LDFLAGS@ @RELROFLAGS@ \
|
||||
@DSOFLAGS@ $(OPTIM)
|
||||
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
|
||||
DNSSDLIBS = @DNSSDLIBS@
|
||||
IPPFIND_BIN = @IPPFIND_BIN@
|
||||
IPPFIND_MAN = @IPPFIND_MAN@
|
||||
LDFLAGS = -L../cups @LDARCHFLAGS@ @LDFLAGS@ @RELROFLAGS@ \
|
||||
@PIEFLAGS@ $(OPTIM)
|
||||
LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
ONDEMANDFLAGS = @ONDEMANDFLAGS@
|
||||
ONDEMANDLIBS = @ONDEMANDLIBS@
|
||||
OPTIM = @OPTIM@
|
||||
OPTIONS = @WARNING_OPTIONS@
|
||||
PAMLIBS = @PAMLIBS@
|
||||
SERVERLIBS = @SERVERLIBS@
|
||||
SSLFLAGS = @SSLFLAGS@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
UNITTESTS = @UNITTESTS@
|
||||
|
||||
|
||||
#
|
||||
# Directories...
|
||||
#
|
||||
# The first section uses the GNU names (which are *extremely*
|
||||
# difficult to find in a makefile because they are lowercase...)
|
||||
# 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@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
privateinclude = @privateinclude@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
BUILDROOT = $(DSTROOT)
|
||||
|
||||
AMANDIR = $(BUILDROOT)@AMANDIR@
|
||||
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@
|
||||
PMANDIR = $(BUILDROOT)@PMANDIR@
|
||||
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@
|
||||
|
||||
MAN1EXT = @MAN1EXT@
|
||||
MAN5EXT = @MAN5EXT@
|
||||
MAN7EXT = @MAN7EXT@
|
||||
MAN8EXT = @MAN8EXT@
|
||||
MAN8DIR = @MAN8DIR@
|
||||
|
||||
PAMDIR = @PAMDIR@
|
||||
PAMFILE = @PAMFILE@
|
||||
|
||||
DBUSDIR = @DBUSDIR@
|
||||
INITDIR = @INITDIR@
|
||||
INITDDIR = @INITDDIR@
|
||||
LAUNCHD_DIR = @LAUNCHD_DIR@
|
||||
SMFMANIFESTDIR = @SMFMANIFESTDIR@
|
||||
SYSTEMD_DIR = @SYSTEMD_DIR@
|
||||
XINETD = @XINETD@
|
||||
|
||||
USBQUIRKS = @USBQUIRKS@
|
||||
|
||||
|
||||
#
|
||||
# Rules...
|
||||
#
|
||||
|
||||
.SILENT:
|
||||
.SUFFIXES: .1 .1.gz .1m .1m.gz .3 .3.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .gz
|
||||
|
||||
.c.o:
|
||||
echo Compiling $<...
|
||||
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<
|
||||
|
||||
.cxx.o:
|
||||
echo Compiling $<...
|
||||
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c -o $@ $<
|
||||
|
||||
.man.1 .man.1m .man.3 .man.5 .man.7 .man.8:
|
||||
echo Linking $<...
|
||||
$(RM) $@
|
||||
$(LN) $< $@
|
||||
|
||||
.man.1.gz .man.1m.gz .man.3.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
|
||||
echo -n Compressing $<...
|
||||
$(RM) $@
|
||||
gzip -v9 <$< >$@
|
||||
-332
@@ -1,332 +0,0 @@
|
||||
#
|
||||
# Top-level Makefile for CUPS.
|
||||
#
|
||||
# Copyright © 2007-2018 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 Makedefs
|
||||
|
||||
|
||||
#
|
||||
# Directories to make...
|
||||
#
|
||||
|
||||
DIRS = cups $(BUILDDIRS)
|
||||
|
||||
|
||||
#
|
||||
# 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;\
|
||||
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...
|
||||
#
|
||||
|
||||
clean:
|
||||
for dir in $(DIRS); do\
|
||||
echo Cleaning in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Remove all non-distribution 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) data/testprint
|
||||
$(RM) desktop/cups.desktop
|
||||
$(RM) doc/index.html
|
||||
$(RM) man/client.conf.man man/cups-files.conf.man man/cups-lpd.man man/cups-snmp.man man/cupsaddsmb.man man/cupsd.conf.man man/cupsd.man man/lpoptions.man
|
||||
$(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 clang cups/charmaps cups/locale
|
||||
|
||||
|
||||
#
|
||||
# Make dependencies
|
||||
#
|
||||
|
||||
depend:
|
||||
for dir in $(DIRS); do\
|
||||
echo Making dependencies in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Run the Clang static code analysis tool on the sources, available here:
|
||||
#
|
||||
# http://clang-analyzer.llvm.org
|
||||
#
|
||||
# At least checker-231 is required.
|
||||
#
|
||||
# Alternatively, use "--analyze -Xanalyzer -analyzer-output=text" for OPTIM (text
|
||||
# output instead of HTML...)
|
||||
#
|
||||
|
||||
.PHONY: clang clang-changes
|
||||
clang:
|
||||
$(RM) -r clang
|
||||
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all
|
||||
clang-changes:
|
||||
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
|
||||
|
||||
|
||||
#
|
||||
# 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; \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install programs...
|
||||
#
|
||||
|
||||
install-exec: all
|
||||
for dir in $(DIRS); do\
|
||||
echo Installing programs in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Install libraries...
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
|
||||
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 Mini-XML's mxmldoc (http://www.msweet.org/)...
|
||||
#
|
||||
|
||||
apihelp:
|
||||
for dir in cups filter; do\
|
||||
echo Generating API help in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Create an Xcode docset using Mini-XML's mxmldoc (http://www.msweet.org/)...
|
||||
#
|
||||
|
||||
docset: apihelp
|
||||
echo Generating docset directory tree...
|
||||
$(RM) -r org.cups.docset
|
||||
mkdir -p org.cups.docset/Contents/Resources/Documentation/help
|
||||
mkdir -p org.cups.docset/Contents/Resources/Documentation/images
|
||||
cd man; $(MAKE) $(MFLAGS) html
|
||||
cd doc; $(MAKE) $(MFLAGS) docset
|
||||
cd cgi-bin; $(MAKE) $(MFLAGS) makedocset
|
||||
cgi-bin/makedocset org.cups.docset \
|
||||
`svnversion . | sed -e '1,$$s/[a-zA-Z]//g'` \
|
||||
doc/help/api-*.tokens
|
||||
$(RM) doc/help/api-*.tokens
|
||||
echo Indexing docset...
|
||||
/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index org.cups.docset
|
||||
echo Generating docset archive and feed...
|
||||
$(RM) org.cups.docset.atom
|
||||
/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
|
||||
--atom org.cups.docset.atom \
|
||||
--download-url http://www.cups.org/org.cups.docset.xar \
|
||||
org.cups.docset
|
||||
|
||||
|
||||
#
|
||||
# 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:
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
CUPS
|
||||
|
||||
Copyright © 2007-2018 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.
|
||||
-161
@@ -1,161 +0,0 @@
|
||||
README - CUPS v2.3b6 - 2018-12-07
|
||||
=================================
|
||||
|
||||
Looking for compile instructions? Read the file `INSTALL.md` instead...
|
||||
|
||||
|
||||
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
|
||||
-------------------------
|
||||
|
||||
Once you have installed the software you can access the documentation (and a
|
||||
bunch of other stuff) online at <http://localhost:631/>.
|
||||
|
||||
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/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-2018 by Apple Inc.
|
||||
Copyright © 1997-2007 by Easy Software Products.
|
||||
|
||||
CUPS is provided under the terms of the Apache License, Version 2.0. 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.
|
||||
@@ -0,0 +1,37 @@
|
||||
README.txt - 2016-03-15
|
||||
-----------------------
|
||||
|
||||
This directory contains an automated build and test environment for CUPS.
|
||||
|
||||
|
||||
ENVIRONMENT
|
||||
|
||||
If present, the buildtest.env file sets additional shell variables for the
|
||||
build and test scripts described below. The following variables are
|
||||
currently supported:
|
||||
|
||||
BUILDOPTIONS - Configure options that are passed to each target
|
||||
BUILDNOTIFY - An email address or URL that specifies where the
|
||||
build log should be sent.
|
||||
BUILDSUBJECT - A string to include in the subject (default is empty
|
||||
string)
|
||||
|
||||
|
||||
SCRIPTS
|
||||
|
||||
The build.sh script builds the current stable branch of CUPS along with
|
||||
master ("latest"), running "make check" in each. Normally you will run the
|
||||
script via a cron job:
|
||||
|
||||
0 0 * * 0 /path/to/build.sh --update --quiet clean all
|
||||
0 0 * * 1-6 /path/to/build.sh --update --quiet
|
||||
|
||||
The "--update" option tells build.sh to do an "git pull" prior to building.
|
||||
|
||||
The "--quiet" option tells build.sh to work quietly and optionally send the
|
||||
build log via email or HTTP POST for recording, automated processing, etc.
|
||||
|
||||
The "clean" and "all" options specify build targets; the default target is
|
||||
"all". In the example above, the first line tells cron to run the script at
|
||||
midnight each day; Sunday (day 0) also does a clean build, while every other
|
||||
day only builds files that have changed.
|
||||
@@ -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
|
||||
@@ -1,324 +0,0 @@
|
||||
#
|
||||
# Backend makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2018 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 ../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
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
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)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o test1284 test1284.o ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# testbackend
|
||||
#
|
||||
|
||||
testbackend: testbackend.o ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/$(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# testsupplies
|
||||
#
|
||||
|
||||
testsupplies: testsupplies.o libbackend.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
$(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) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
if test `uname` = Darwin; then \
|
||||
$(RM) mdns; \
|
||||
$(LN) dnssd mdns; \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# ipp
|
||||
#
|
||||
|
||||
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
$(RM) http https ipps
|
||||
for file in $(IPPALIASES); do \
|
||||
$(LN) ipp $$file; \
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# lpd
|
||||
#
|
||||
|
||||
lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# snmp
|
||||
#
|
||||
|
||||
snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# socket
|
||||
#
|
||||
|
||||
socket: socket.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
socket-static: socket.o ../cups/$(LIBCUPSSTATIC) libbackend.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o socket-static socket.o libbackend.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# usb
|
||||
#
|
||||
|
||||
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
|
||||
$(BACKLIBS) $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
@@ -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_ */
|
||||
-1289
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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);
|
||||
}
|
||||
-3629
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-1294
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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(¤t->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));
|
||||
}
|
||||
@@ -1,295 +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)
|
||||
0x0a5f unidir
|
||||
|
||||
# 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 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
|
||||
|
||||
# Zebra ZD420 (Issue #5395)
|
||||
0x0a5f 0x0120 unidir no-reattach
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-1356
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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
|
||||
|
||||
@@ -1,493 +0,0 @@
|
||||
/*
|
||||
* AppSocket backend for CUPS.
|
||||
*
|
||||
* Copyright © 2007-2018 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 <cups/http-private.h>
|
||||
#include "backend-private.h"
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <netdb.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static ssize_t wait_bc(int device_fd, int secs);
|
||||
|
||||
|
||||
/*
|
||||
* '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 */
|
||||
{
|
||||
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 */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
printf("network socket \"Unknown\" \"%s\"\n",
|
||||
_cupsLangString(cupsLangDefault(), _("AppSocket/HP JetDirect")));
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have 7 arguments, print the file named on the command-line.
|
||||
* Otherwise, send stdin instead...
|
||||
*/
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
print_fd = 0;
|
||||
copies = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
|
||||
{
|
||||
_cupsLangPrintError("ERROR", _("Unable to open print file"));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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));
|
||||
|
||||
if (port == 0)
|
||||
port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */
|
||||
|
||||
/*
|
||||
* Get options, if any...
|
||||
*/
|
||||
|
||||
waiteof = 1;
|
||||
contimeout = 7 * 24 * 60 * 60;
|
||||
|
||||
if ((options = strchr(resource, '?')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Yup, terminate the device name string and move to the first
|
||||
* character of the options...
|
||||
*/
|
||||
|
||||
*options++ = '\0';
|
||||
|
||||
/*
|
||||
* Parse options...
|
||||
*/
|
||||
|
||||
while (*options)
|
||||
{
|
||||
/*
|
||||
* Get the name...
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Then try finding the remote host...
|
||||
*/
|
||||
|
||||
start_time = time(NULL);
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
error = errno;
|
||||
device_fd = -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);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(error));
|
||||
|
||||
if (errno == ECONNREFUSED || errno == EHOSTDOWN || errno == EHOSTUNREACH || errno == ETIMEDOUT || errno == ENOTCONN)
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("The printer is not responding."));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
switch (error)
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintFilter(stderr, "ERROR",
|
||||
_("The printer is not responding."));
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
|
||||
|
||||
fprintf(stderr, "DEBUG: Connected to %s:%d...\n",
|
||||
httpAddrString(&(addr->addr), addrname, sizeof(addrname)),
|
||||
httpAddrPort(&(addr->addr)));
|
||||
|
||||
/*
|
||||
* Print everything...
|
||||
*/
|
||||
|
||||
tbytes = 0;
|
||||
|
||||
if (bytes > 0)
|
||||
tbytes += write(device_fd, buffer, (size_t)bytes);
|
||||
|
||||
while (copies > 0 && tbytes >= 0)
|
||||
{
|
||||
copies --;
|
||||
|
||||
if (print_fd != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(print_fd, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0)
|
||||
tbytes = -1;
|
||||
else
|
||||
tbytes = bytes;
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
|
||||
}
|
||||
|
||||
fputs("STATE: +cups-waiting-for-job-completed\n", stderr);
|
||||
|
||||
if (waiteof && tbytes >= 0)
|
||||
{
|
||||
/*
|
||||
* Shutdown the socket and wait for the other end to finish...
|
||||
*/
|
||||
|
||||
_cupsLangPrintFilter(stderr, "INFO", _("Waiting for printer to finish."));
|
||||
|
||||
shutdown(device_fd, 1);
|
||||
|
||||
while (wait_bc(device_fd, 90) > 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'wait_bc()' - Wait for back-channel data...
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
@@ -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));
|
||||
}
|
||||
-246
@@ -1,246 +0,0 @@
|
||||
/*
|
||||
* USB printer backend for CUPS.
|
||||
*
|
||||
* Copyright © 2007-2012 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.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* A header order dependency requires this be first */
|
||||
# include <ApplicationServices/ApplicationServices.h>
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#include "backend-private.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <termios.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
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 */
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Send a file to the specified USB 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 */
|
||||
{
|
||||
int print_fd; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
int status; /* Exit status */
|
||||
int port; /* Port number (not used) */
|
||||
const char *uri; /* Device URI */
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options; /* Pointer to options */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
list_devices();
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if there are any options...
|
||||
*/
|
||||
|
||||
if ((options = strchr(resource, '?')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Yup, terminate the device name string and move to the first
|
||||
* character of the options...
|
||||
*/
|
||||
|
||||
*options++ = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have 7 arguments, print the file named on the command-line.
|
||||
* Otherwise, send stdin instead...
|
||||
*/
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
print_fd = 0;
|
||||
copies = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
|
||||
{
|
||||
_cupsLangPrintError("ERROR", _("Unable to open print file"));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
status = print_device(uri, hostname, resource, options, print_fd, copies,
|
||||
argc, argv);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
*/
|
||||
|
||||
if (print_fd != 0)
|
||||
close(print_fd);
|
||||
|
||||
return (status);
|
||||
}
|
||||
@@ -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
|
||||
@@ -1,161 +0,0 @@
|
||||
#
|
||||
# Berkeley commands makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2018 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 ../Makedefs
|
||||
|
||||
|
||||
TARGETS = lpc lpq lpr lprm
|
||||
OBJS = lpc.o lpq.o lpr.o lprm.o
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
||||
#
|
||||
# Make library targets...
|
||||
#
|
||||
|
||||
libs:
|
||||
|
||||
|
||||
#
|
||||
# Make unit tests...
|
||||
#
|
||||
|
||||
unittests:
|
||||
|
||||
|
||||
#
|
||||
# Clean all object files...
|
||||
#
|
||||
|
||||
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_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)
|
||||
|
||||
|
||||
#
|
||||
# lpc
|
||||
#
|
||||
|
||||
lpc: lpc.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# lpq
|
||||
#
|
||||
|
||||
lpq: lpq.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# lpr
|
||||
#
|
||||
|
||||
lpr: lpr.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# lprm
|
||||
#
|
||||
|
||||
lprm: lprm.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
@@ -1,427 +0,0 @@
|
||||
/*
|
||||
* "lpc" command for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 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 <cups/cups-private.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 *);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and commands.
|
||||
*/
|
||||
|
||||
int
|
||||
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 */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
/*
|
||||
* Process a single command on the command-line...
|
||||
*/
|
||||
|
||||
do_command(http, argv[1], argv[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Do the command prompt thing...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> ")); /* TODO: Need no-newline version */
|
||||
while (fgets(line, sizeof(line), stdin) != NULL)
|
||||
{
|
||||
/*
|
||||
* Strip trailing whitespace...
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find any options in the string...
|
||||
*/
|
||||
|
||||
for (params = line; *params != '\0'; params ++)
|
||||
if (isspace(*params & 255))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Remove whitespace between the command and parameters...
|
||||
*/
|
||||
|
||||
while (isspace(*params & 255))
|
||||
*params++ = '\0';
|
||||
|
||||
/*
|
||||
* The "quit" and "exit" commands exit; otherwise, process as needed...
|
||||
*/
|
||||
|
||||
if (!compare_strings(line, "quit", 1) ||
|
||||
!compare_strings(line, "exit", 2))
|
||||
break;
|
||||
|
||||
if (*params == '\0')
|
||||
do_command(http, line, NULL);
|
||||
else
|
||||
do_command(http, line, params);
|
||||
|
||||
/*
|
||||
* Put another prompt out to the user...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> ")); /* TODO: Need no newline version */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the connection to the server and return...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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 */
|
||||
{
|
||||
size_t slen; /* Length of command-line string */
|
||||
|
||||
|
||||
slen = strlen(s);
|
||||
if (slen < tmin)
|
||||
return (-1);
|
||||
else
|
||||
return (strncmp(s, t, slen));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'do_command()' - Do an lpc command...
|
||||
*/
|
||||
|
||||
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 */
|
||||
{
|
||||
if (!compare_strings(command, "status", 4))
|
||||
show_status(http, params);
|
||||
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
|
||||
show_help(params);
|
||||
else
|
||||
_cupsLangPrintf(stdout,
|
||||
_("%s is not implemented by the CUPS version of lpc."),
|
||||
command);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_help()' - Show help messages.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_help(const char *command) /* I - Command to describe or NULL */
|
||||
{
|
||||
if (!command)
|
||||
{
|
||||
_cupsLangPrintf(stdout,
|
||||
_("Commands may be abbreviated. Commands are:\n"
|
||||
"\n"
|
||||
"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
|
||||
_cupsLangPrintf(stdout, _("?Invalid help command unknown."));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_status()' - Show printers.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_status(http_t *http, /* I - HTTP connection to server */
|
||||
const 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",
|
||||
"printer-name",
|
||||
"printer-state",
|
||||
"queued-job-count"
|
||||
};
|
||||
|
||||
|
||||
if (http == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_PRINTERS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_PRINTERS);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", sizeof(requested) / sizeof(requested[0]),
|
||||
NULL, requested);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Loop through the printers returned in the list and display
|
||||
* their status...
|
||||
*/
|
||||
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Pull the needed attributes from this job...
|
||||
*/
|
||||
|
||||
printer = NULL;
|
||||
device = "file:/dev/null";
|
||||
pstate = IPP_PRINTER_IDLE;
|
||||
jobcount = 0;
|
||||
accepting = 1;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
|
||||
{
|
||||
if (!strcmp(attr->name, "device-uri") &&
|
||||
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)
|
||||
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;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have everything needed...
|
||||
*/
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
if (attr == NULL)
|
||||
break;
|
||||
else
|
||||
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...
|
||||
*/
|
||||
|
||||
match = dests == NULL;
|
||||
|
||||
if (dests != NULL)
|
||||
{
|
||||
for (dptr = dests; *dptr != '\0';)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace and commas...
|
||||
*/
|
||||
|
||||
while (isspace(*dptr & 255) || *dptr == ',')
|
||||
dptr ++;
|
||||
|
||||
if (*dptr == '\0')
|
||||
break;
|
||||
|
||||
/*
|
||||
* Compare names...
|
||||
*/
|
||||
|
||||
for (ptr = printer;
|
||||
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
|
||||
ptr ++, dptr ++)
|
||||
/* do nothing */;
|
||||
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
|
||||
isspace(*dptr & 255)))
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip trailing junk...
|
||||
*/
|
||||
|
||||
while (!isspace(*dptr & 255) && *dptr != '\0')
|
||||
dptr ++;
|
||||
while (isspace(*dptr & 255) || *dptr == ',')
|
||||
dptr ++;
|
||||
|
||||
if (*dptr == '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the printer entry if needed...
|
||||
*/
|
||||
|
||||
if (match)
|
||||
{
|
||||
/*
|
||||
* Display it...
|
||||
*/
|
||||
|
||||
printf("%s:\n", printer);
|
||||
if (!strncmp(device, "file:", 5))
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tprinter is on device \'%s\' speed -1"),
|
||||
device + 5);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Just show the scheme...
|
||||
*/
|
||||
|
||||
if ((delimiter = strchr(device, ':')) != NULL )
|
||||
{
|
||||
*delimiter = '\0';
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tprinter is on device \'%s\' speed -1"),
|
||||
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"));
|
||||
|
||||
if (jobcount == 0)
|
||||
_cupsLangPuts(stdout, _("\tno entries"));
|
||||
else
|
||||
_cupsLangPrintf(stdout, _("\t%d entries"), jobcount);
|
||||
|
||||
_cupsLangPuts(stdout, _("\tdaemon present"));
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
}
|
||||
@@ -1,651 +0,0 @@
|
||||
/*
|
||||
* "lpq" command 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 <cups/cups-private.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;
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and commands.
|
||||
*/
|
||||
|
||||
int
|
||||
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 */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
/*
|
||||
* Check for command-line options...
|
||||
*/
|
||||
|
||||
http = NULL;
|
||||
dest = NULL;
|
||||
user = NULL;
|
||||
id = 0;
|
||||
interval = 0;
|
||||
longstatus = 0;
|
||||
all = 0;
|
||||
|
||||
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 (*opt)
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
|
||||
if (http)
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."), argv[0]);
|
||||
#endif /* HAVE_SSL */
|
||||
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);
|
||||
}
|
||||
|
||||
cupsSetUser(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P' : /* Printer */
|
||||
if (opt[1] != '\0')
|
||||
{
|
||||
dest = opt + 1;
|
||||
opt += strlen(opt) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i >= argc)
|
||||
{
|
||||
httpClose(http);
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isdigit(argv[i][0] & 255))
|
||||
{
|
||||
id = atoi(argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
user = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (dest == NULL && !all)
|
||||
{
|
||||
if ((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...
|
||||
*/
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (dest)
|
||||
show_printer(argv[0], http, dest);
|
||||
|
||||
i = show_jobs(argv[0], http, dest, user, id, longstatus);
|
||||
|
||||
if (i && interval)
|
||||
{
|
||||
fflush(stdout);
|
||||
sleep((unsigned)interval);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the connection to the server and return...
|
||||
*/
|
||||
|
||||
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 */
|
||||
{
|
||||
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 */
|
||||
{
|
||||
"th",
|
||||
"st",
|
||||
"nd",
|
||||
"rd",
|
||||
"th",
|
||||
"th",
|
||||
"th",
|
||||
"th",
|
||||
"th",
|
||||
"th"
|
||||
};
|
||||
|
||||
|
||||
if (http == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_JOBS or IPP_GET_JOB_ATTRIBUTES request, which requires
|
||||
* the following attributes:
|
||||
*
|
||||
* 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);
|
||||
|
||||
if (id)
|
||||
{
|
||||
snprintf(resource, sizeof(resource), "ipp://localhost/jobs/%d", id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
else if (dest)
|
||||
{
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
|
||||
NULL, "localhost", 0, "/printers/%s", dest);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
else
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/");
|
||||
|
||||
if (user)
|
||||
{
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_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...
|
||||
*/
|
||||
|
||||
jobcount = 0;
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
|
||||
ippDelete(response);
|
||||
return (0);
|
||||
}
|
||||
|
||||
rank = 1;
|
||||
|
||||
/*
|
||||
* Loop through the job list and display them...
|
||||
*/
|
||||
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Pull the needed attributes from this job...
|
||||
*/
|
||||
|
||||
jobid = 0;
|
||||
jobsize = 0;
|
||||
jobstate = IPP_JOB_PENDING;
|
||||
jobname = "unknown";
|
||||
jobuser = "unknown";
|
||||
jobdest = NULL;
|
||||
jobcopies = 1;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
|
||||
{
|
||||
if (!strcmp(attr->name, "job-id") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-k-octets") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobsize = attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-state") &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
jobstate = (ipp_jstate_t)attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-printer-uri") &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL)
|
||||
jobdest ++;
|
||||
|
||||
if (!strcmp(attr->name, "job-originating-user-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
jobuser = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "job-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
jobname = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "copies") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobcopies = attr->values[0].integer;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have everything needed...
|
||||
*/
|
||||
|
||||
if (jobdest == NULL || jobid == 0)
|
||||
{
|
||||
if (attr == NULL)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!longstatus && jobcount == 0)
|
||||
_cupsLangPuts(stdout,
|
||||
_("Rank Owner Job File(s)"
|
||||
" Total Size"));
|
||||
|
||||
jobcount ++;
|
||||
|
||||
/*
|
||||
* Display the job...
|
||||
*/
|
||||
|
||||
if (jobstate == IPP_JOB_PROCESSING)
|
||||
strlcpy(rankstr, "active", sizeof(rankstr));
|
||||
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]);
|
||||
|
||||
rank ++;
|
||||
}
|
||||
|
||||
if (longstatus)
|
||||
{
|
||||
_cupsLangPuts(stdout, "\n");
|
||||
|
||||
if (jobcopies > 1)
|
||||
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
|
||||
jobname);
|
||||
else
|
||||
strlcpy(namestr, jobname, sizeof(namestr));
|
||||
|
||||
_cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]"),
|
||||
jobuser, rankstr, jobid);
|
||||
_cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes"),
|
||||
namestr, 1024.0 * jobsize);
|
||||
}
|
||||
else
|
||||
_cupsLangPrintf(stdout,
|
||||
_("%-7s %-7.7s %-7d %-31.31s %.0f bytes"),
|
||||
rankstr, jobuser, jobid, jobname, 1024.0 * jobsize);
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (jobcount == 0)
|
||||
_cupsLangPuts(stdout, _("no entries"));
|
||||
|
||||
return (jobcount);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_printer()' - Show printer status.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_printer(const char *command, /* I - Command name */
|
||||
http_t *http, /* I - HTTP connection to server */
|
||||
const char *dest) /* I - Destination */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
ipp_pstate_t state; /* Printer state */
|
||||
char uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
|
||||
|
||||
if (http == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* 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", dest);
|
||||
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)
|
||||
{
|
||||
if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
|
||||
ippDelete(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL)
|
||||
state = (ipp_pstate_t)attr->values[0].integer;
|
||||
else
|
||||
state = IPP_PRINTER_STOPPED;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case IPP_PRINTER_IDLE :
|
||||
_cupsLangPrintf(stdout, _("%s is ready"), dest);
|
||||
break;
|
||||
case IPP_PRINTER_PROCESSING :
|
||||
_cupsLangPrintf(stdout, _("%s is ready and printing"),
|
||||
dest);
|
||||
break;
|
||||
case IPP_PRINTER_STOPPED :
|
||||
_cupsLangPrintf(stdout, _("%s is not ready"), dest);
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'usage()' - Show program usage.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1,455 +0,0 @@
|
||||
/*
|
||||
* "lpr" command for CUPS.
|
||||
*
|
||||
* Copyright © 2007-2018 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 <cups/cups-private.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void usage(void) _CUPS_NORETURN;
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and send files for printing.
|
||||
*/
|
||||
|
||||
int
|
||||
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 */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
deletefile = 0;
|
||||
printer = NULL;
|
||||
dest = 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 ++)
|
||||
{
|
||||
switch (ch = *opt)
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."), argv[0]);
|
||||
#endif /* HAVE_SSL */
|
||||
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]);
|
||||
}
|
||||
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]);
|
||||
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();
|
||||
}
|
||||
|
||||
num_copies = atoi(argv[i]);
|
||||
}
|
||||
|
||||
if (num_copies < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Error - copies must be 1 or more."), argv[0]);
|
||||
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 (opt[1] != '\0')
|
||||
{
|
||||
title = opt + 1;
|
||||
opt += strlen(opt) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Error - expected name after \"-%c\" option."), argv[0], ch);
|
||||
usage();
|
||||
}
|
||||
|
||||
title = argv[i];
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
_cupsLangPrintf(stderr, _("%s: Error - unknown option \"%c\"."), argv[0], *opt);
|
||||
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 ++;
|
||||
|
||||
if (title == NULL)
|
||||
{
|
||||
if ((title = strrchr(argv[i], '/')) != NULL)
|
||||
title ++;
|
||||
else
|
||||
title = argv[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Error - too many files - \"%s\"."), argv[0], 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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (num_files > 0)
|
||||
{
|
||||
job_id = cupsPrintFiles(printer, num_files, files, title, num_options, options);
|
||||
|
||||
if (deletefile && job_id > 0)
|
||||
{
|
||||
/*
|
||||
* Delete print files after printing...
|
||||
*/
|
||||
|
||||
for (i = 0; i < num_files; i ++)
|
||||
unlink(files[i]);
|
||||
}
|
||||
}
|
||||
else if ((job_id = cupsCreateJob(CUPS_HTTP_DEFAULT, printer,
|
||||
title ? title : "(stdin)",
|
||||
num_options, options)) > 0)
|
||||
{
|
||||
http_status_t status; /* Write status */
|
||||
const char *format; /* Document format */
|
||||
ssize_t bytes; /* Bytes read */
|
||||
|
||||
if (cupsGetOption("raw", num_options, options))
|
||||
format = CUPS_FORMAT_RAW;
|
||||
else if ((format = cupsGetOption("document-format", num_options,
|
||||
options)) == NULL)
|
||||
format = CUPS_FORMAT_AUTO;
|
||||
|
||||
status = cupsStartDocument(CUPS_HTTP_DEFAULT, printer, job_id, NULL,
|
||||
format, 1);
|
||||
|
||||
while (status == HTTP_CONTINUE &&
|
||||
(bytes = read(0, buffer, sizeof(buffer))) > 0)
|
||||
status = cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, (size_t)bytes);
|
||||
|
||||
if (status != HTTP_CONTINUE)
|
||||
{
|
||||
_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);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
|
||||
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (job_id < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'usage()' - Show program usage and exit.
|
||||
*/
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
_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, _("-q Specify the job should be held for printing"));
|
||||
_cupsLangPuts(stdout, _("-r Remove the file(s) after submission"));
|
||||
_cupsLangPuts(stdout, _("-P destination Specify the destination"));
|
||||
_cupsLangPuts(stdout, _("-T title Specify the job title"));
|
||||
_cupsLangPuts(stdout, _("-U username Specify the username to use for authentication"));
|
||||
|
||||
exit(1);
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
/*
|
||||
* "lprm" command 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 <cups/cups-private.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void usage(void) _CUPS_NORETURN;
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and cancel jobs.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
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? */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
/*
|
||||
* Setup to cancel individual print jobs...
|
||||
*/
|
||||
|
||||
did_cancel = 0;
|
||||
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
|
||||
name = defdest ? defdest->name : NULL;
|
||||
|
||||
/*
|
||||
* 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 ++)
|
||||
{
|
||||
switch (*opt)
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."), argv[0]);
|
||||
#endif /* HAVE_SSL */
|
||||
break;
|
||||
|
||||
case 'P' : /* Cancel jobs on a printer */
|
||||
if (opt[1] != '\0')
|
||||
{
|
||||
name = opt + 1;
|
||||
opt += strlen(opt) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
name = argv[i];
|
||||
}
|
||||
|
||||
if ((instance = strchr(name, '/')) != NULL)
|
||||
*instance = '\0';
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Cancel a job or printer...
|
||||
*/
|
||||
|
||||
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, argv[i], NULL)) != NULL)
|
||||
cupsFreeDests(1, dest);
|
||||
|
||||
if (dest)
|
||||
{
|
||||
name = argv[i];
|
||||
job_id = 0;
|
||||
}
|
||||
else if (isdigit(argv[i][0] & 255))
|
||||
{
|
||||
name = NULL;
|
||||
job_id = atoi(argv[i]);
|
||||
}
|
||||
else if (!strcmp(argv[i], "-"))
|
||||
{
|
||||
/*
|
||||
* Cancel all jobs
|
||||
*/
|
||||
|
||||
job_id = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Error - unknown destination \"%s\"."),
|
||||
argv[0], argv[i]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0) != IPP_OK)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
|
||||
goto error;
|
||||
}
|
||||
|
||||
did_cancel = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If nothing has been canceled yet, cancel the current job on the specified
|
||||
* (or default) printer...
|
||||
*/
|
||||
|
||||
if (!did_cancel && cupsCancelJob2(CUPS_HTTP_DEFAULT, name, 0, 0) != IPP_OK)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (defdest)
|
||||
cupsFreeDests(1, defdest);
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
#
|
||||
# Makefile for CUPS build and test repository.
|
||||
#
|
||||
# This makefile MUST be used from the build.sh script, otherwise the
|
||||
# environment will not be configured properly...
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# 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/".
|
||||
|
||||
# Subdirectories to be built...
|
||||
DIRS = \
|
||||
stable/.all \
|
||||
development/.all \
|
||||
|
||||
|
||||
# Make everything...
|
||||
all: tools/.all $(DIRS)
|
||||
|
||||
|
||||
# Clean everything...
|
||||
clean: tools/.clean $(DIRS:.all=.clean)
|
||||
@echo Removing \"temp\" directory...
|
||||
rm -rf temp
|
||||
@echo Removing old failed test reports...
|
||||
find . -name 'cups-str*.html' -mtime +7 -print -exec rm -f '{}' \;
|
||||
find . -name 'error_log-*' -mtime +7 -print -exec rm -f '{}' \;
|
||||
|
||||
|
||||
# Make CUPS stable
|
||||
stable/.all: stable/Makedefs
|
||||
@echo Making all in CUPS stable...
|
||||
cd stable && $(MAKE) all check
|
||||
|
||||
stable/.clean:
|
||||
@cd stable; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS stable...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
|
||||
stable/Makedefs: stable/Makedefs.in stable/configure \
|
||||
stable/packaging/cups.list.in \
|
||||
stable/config.h.in
|
||||
@cd stable; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS stable...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
@echo Configuring CUPS stable...
|
||||
cd stable && ./configure $(BUILDOPTIONS) \
|
||||
--enable-static \
|
||||
--enable-unit-tests --enable-debug-printfs
|
||||
|
||||
stable/configure: stable/configure.ac \
|
||||
stable/config-scripts/cups-common.m4 \
|
||||
stable/config-scripts/cups-compiler.m4 \
|
||||
stable/config-scripts/cups-defaults.m4 \
|
||||
stable/config-scripts/cups-directories.m4 \
|
||||
stable/config-scripts/cups-dnssd.m4 \
|
||||
stable/config-scripts/cups-gssapi.m4 \
|
||||
stable/config-scripts/cups-largefile.m4 \
|
||||
stable/config-scripts/cups-libtool.m4 \
|
||||
stable/config-scripts/cups-manpages.m4 \
|
||||
stable/config-scripts/cups-network.m4 \
|
||||
stable/config-scripts/cups-opsys.m4 \
|
||||
stable/config-scripts/cups-pam.m4 \
|
||||
stable/config-scripts/cups-poll.m4 \
|
||||
stable/config-scripts/cups-scripting.m4 \
|
||||
stable/config-scripts/cups-sharedlibs.m4 \
|
||||
stable/config-scripts/cups-ssl.m4 \
|
||||
stable/config-scripts/cups-startup.m4 \
|
||||
stable/config-scripts/cups-threads.m4
|
||||
@echo Updating CUPS stable configure script...
|
||||
cd stable; rm -rf autom4te.cache configure; autoconf
|
||||
|
||||
|
||||
# Make CUPS master (bleeding edge development)
|
||||
development/.all: development/Makedefs
|
||||
@echo Making all in CUPS development...
|
||||
cd development && $(MAKE) all check
|
||||
|
||||
development/.clean:
|
||||
@cd development; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS development...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
|
||||
development/Makedefs: development/Makedefs.in development/configure \
|
||||
development/packaging/cups.list.in \
|
||||
development/config.h.in
|
||||
@cd development; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS development...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
@echo Configuring CUPS development...
|
||||
cd development && ./configure $(BUILDOPTIONS) \
|
||||
--enable-static \
|
||||
--enable-unit-tests --enable-debug-printfs
|
||||
|
||||
development/configure: development/configure.ac \
|
||||
development/config-scripts/cups-common.m4 \
|
||||
development/config-scripts/cups-compiler.m4 \
|
||||
development/config-scripts/cups-defaults.m4 \
|
||||
development/config-scripts/cups-directories.m4 \
|
||||
development/config-scripts/cups-dnssd.m4 \
|
||||
development/config-scripts/cups-gssapi.m4 \
|
||||
development/config-scripts/cups-largefile.m4 \
|
||||
development/config-scripts/cups-libtool.m4 \
|
||||
development/config-scripts/cups-manpages.m4 \
|
||||
development/config-scripts/cups-network.m4 \
|
||||
development/config-scripts/cups-opsys.m4 \
|
||||
development/config-scripts/cups-pam.m4 \
|
||||
development/config-scripts/cups-poll.m4 \
|
||||
development/config-scripts/cups-scripting.m4 \
|
||||
development/config-scripts/cups-sharedlibs.m4 \
|
||||
development/config-scripts/cups-ssl.m4 \
|
||||
development/config-scripts/cups-startup.m4 \
|
||||
development/config-scripts/cups-threads.m4
|
||||
@echo Updating CUPS development configure script...
|
||||
cd development; rm -rf autom4te.cache configure; autoconf
|
||||
|
||||
# Make the build tools
|
||||
tools/.all: tools/Makefile
|
||||
@echo Making all in tools...
|
||||
cd tools && $(MAKE) install
|
||||
|
||||
tools/.clean:
|
||||
@cd tools; if test -f Makefile; then \
|
||||
echo Cleaning tools...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
|
||||
tools/Makefile: tools/Makefile.in tools/configure
|
||||
@cd tools; if test -f Makefile; then \
|
||||
echo Cleaning tools...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
@echo Configuring Tools...
|
||||
cd tools && ./configure $(BUILDOPTIONS) --prefix=$(BASEDIR)/temp
|
||||
Arquivo executável
+233
@@ -0,0 +1,233 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Common script for building the current stable and development (master)
|
||||
# branches of CUPS.
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# 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/".
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# build.sh [--if-changed] [--quiet] [--update] [target(s)]
|
||||
#
|
||||
|
||||
# Copy any build/test environment variables...
|
||||
BUILDOPTIONS=""
|
||||
BUILDNOTIFY=""
|
||||
BUILDSUBJECT="[`hostname`]"
|
||||
if test -f buildtest.env; then
|
||||
. ./buildtest.env
|
||||
fi
|
||||
|
||||
# Get the path to this script...
|
||||
BASEDIR=`dirname $0`
|
||||
if test $BASEDIR = .; then
|
||||
BASEDIR=`pwd`
|
||||
fi
|
||||
|
||||
# Make sure the temporary directory is there...
|
||||
if test ! -d $BASEDIR/temp; then
|
||||
mkdir -p $BASEDIR/temp
|
||||
fi
|
||||
|
||||
# Setup common path stuff...
|
||||
PATH=""
|
||||
for dir in /usr/xpg4/bin /usr/ccs/bin /opt/SUNWspro/bin /opt/sfw/bin \
|
||||
/usr/sfw/bin /usr/bsd /usr/freeware/bin /opt/aCC/bin /usr/contrib/bin \
|
||||
/usr/local/bin $HOME/oss/bin; do
|
||||
if test -d $dir; then
|
||||
PATH="$PATH:$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$PATH" = x; then
|
||||
PATH="$BASEDIR/temp/bin:/usr/bin:/bin"
|
||||
else
|
||||
PATH="$BASEDIR/temp/bin$PATH:/usr/bin:/bin"
|
||||
fi
|
||||
|
||||
export PATH
|
||||
|
||||
if test -x /usr/xpg4/bin/grep; then
|
||||
grep=/usr/xpg4/bin/grep
|
||||
else
|
||||
grep=grep
|
||||
fi
|
||||
|
||||
if test -x /usr/local/bin/gmake; then
|
||||
make=/usr/local/bin/gmake
|
||||
else
|
||||
make=make
|
||||
fi
|
||||
|
||||
# Parse command-line arguments:
|
||||
ifchanged=no
|
||||
quiet=no
|
||||
update=no
|
||||
targets=""
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
--ifchanged | --if-changed) ifchanged=yes;;
|
||||
--quiet) quiet=yes;;
|
||||
--update | update) update=yes;;
|
||||
*) targets="$targets $1";;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# Start the build...
|
||||
if test $quiet = yes; then
|
||||
if test $update = yes; then
|
||||
exec >/dev/null 2>&1
|
||||
else
|
||||
if test -f build.log; then
|
||||
mv build.log build.log.O
|
||||
fi
|
||||
|
||||
exec >build.log 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$targets" = x; then
|
||||
targets="all"
|
||||
fi
|
||||
|
||||
echo "Starting build of '$targets' on `date`"
|
||||
|
||||
if test -f git.log; then
|
||||
# Show Subversion updates...
|
||||
echo git pull --recurse-submodules; git submodule update --recursive
|
||||
cat git.log
|
||||
git status | $grep modified: >git.log
|
||||
if test -s git.log; then
|
||||
echo ""
|
||||
echo ERROR: Local files have modifications:
|
||||
echo ""
|
||||
cat git.log
|
||||
echo ""
|
||||
fi
|
||||
rm -f git.log
|
||||
fi
|
||||
|
||||
# Update and then build safely...
|
||||
if test $update = yes; then
|
||||
cd $BASEDIR
|
||||
(git pull --recurse-submodules; git submodule update --recursive) 2>&1 >git.log
|
||||
|
||||
# Need to exec since this script might change...
|
||||
options=""
|
||||
if test $quiet = yes; then
|
||||
options="--quiet $options"
|
||||
fi
|
||||
if test $ifchanged = yes; then
|
||||
options="--ifchanged $options"
|
||||
fi
|
||||
|
||||
exec ./build.sh $options $targets
|
||||
fi
|
||||
|
||||
# Make sure submodules are initialized...
|
||||
if test ! -f stable/Makedefs.in; then
|
||||
echo Initializing submodules...
|
||||
git submodule init
|
||||
git submodule update
|
||||
fi
|
||||
|
||||
# Look for changes to the dependent projects
|
||||
changed=0
|
||||
|
||||
for dir in . tools stable development; do
|
||||
rev=`git rev-parse HEAD $dir`
|
||||
if test -f $dir/.buildrev; then
|
||||
oldrev=`cat $dir/.buildrev`
|
||||
else
|
||||
oldrev=""
|
||||
fi
|
||||
|
||||
if test "x$rev" != "x$oldrev"; then
|
||||
changed=1
|
||||
fi
|
||||
|
||||
echo $rev >$dir/.buildrev
|
||||
done
|
||||
|
||||
if test $ifchanged = yes -a $changed = 0; then
|
||||
echo No changes to build.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Setup the compiler flags to point to all of the dependent libraries...
|
||||
#CFLAGS="-I$BASEDIR/temp/include"
|
||||
#CPPFLAGS="-I$BASEDIR/temp/include"
|
||||
#CXXFLAGS="-I$BASEDIR/temp/include"
|
||||
#DSOFLAGS="-L$BASEDIR/temp/lib"
|
||||
#LDFLAGS="-L$BASEDIR/temp/lib"
|
||||
|
||||
CFLAGS="${CFLAGS:=}"
|
||||
CPPFLAGS="${CPPFLAGS:=}"
|
||||
CXXFLAGS="${CXXFLAGS:=}"
|
||||
DSOFLAGS="${DSOFLAGS:=}"
|
||||
LDFLAGS="${LDFLAGS:=}"
|
||||
|
||||
export CFLAGS
|
||||
export CPPFLAGS
|
||||
export CXXFLAGS
|
||||
export DSOFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
case `uname` in
|
||||
Linux*)
|
||||
if test "`uname -m`" = x86_64; then
|
||||
# 64-bit Linux needs this, at least for now...
|
||||
X_LIBS="-L/usr/X11R6/lib64"
|
||||
export X_LIBS
|
||||
fi
|
||||
;;
|
||||
*BSD*)
|
||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
DSOFLAGS="$DSOFLAGS -L/usr/local/lib"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Show the environment...
|
||||
echo Environment:
|
||||
env
|
||||
|
||||
# Do the build using the top-level makefile...
|
||||
echo $make -f build.mak BASEDIR=$BASEDIR BUILDOPTIONS="$BUILDOPTIONS" $targets
|
||||
$make -f build.mak BASEDIR=$BASEDIR BUILDOPTIONS="$BUILDOPTIONS" $targets </dev/null
|
||||
status=$?
|
||||
|
||||
if test $status = 0; then
|
||||
echo Build succeeded on `date`
|
||||
else
|
||||
echo Build failed on `date`
|
||||
fi
|
||||
|
||||
# If configured, send the build log to a central server for processing...
|
||||
if test "x$BUILDNOTIFY" != x -a -x temp/bin/sendbuildlog -a $quiet = yes; then
|
||||
attachments=""
|
||||
|
||||
date=`date "+%Y-%m-%d"`
|
||||
|
||||
if test -f stable/test/cups-str-2.1-$date-$USER.html; then
|
||||
attachments="$attachments -a stable/test/cups-str-2.1-$date-$USER.html"
|
||||
fi
|
||||
|
||||
if test -f developent/test/cups-str-2.2-$date-$USER.html; then
|
||||
attachments="$attachments -a developent/test/cups-str-2.2-$date-$USER.html"
|
||||
fi
|
||||
|
||||
temp/bin/sendbuildlog -b $status -s "$BUILDSUBJECT r$rev" $attachments "$BUILDNOTIFY" build.log
|
||||
fi
|
||||
@@ -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
|
||||
@@ -1,248 +0,0 @@
|
||||
#
|
||||
# CGI makefile 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 ../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)
|
||||
|
||||
|
||||
#
|
||||
# Make all 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
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
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)
|
||||
echo Archiving $@...
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# admin.cgi
|
||||
#
|
||||
|
||||
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ admin.o libcupscgi.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# classes.cgi
|
||||
#
|
||||
|
||||
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ classes.o libcupscgi.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# help.cgi
|
||||
#
|
||||
|
||||
help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ help.o libcupscgi.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# jobs.cgi
|
||||
#
|
||||
|
||||
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ jobs.o libcupscgi.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# printers.cgi
|
||||
#
|
||||
|
||||
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcupscgi.a
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(LDFLAGS) -o $@ printers.o libcupscgi.a $(LIBS)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# testcgi
|
||||
#
|
||||
|
||||
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
$(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) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
|
||||
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(LIBZ) $(LIBGSSAPI)
|
||||
$(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) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/$(LIBCUPSSTATIC) \
|
||||
$(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ) $(LIBGSSAPI)
|
||||
$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
-3985
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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 */
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* CGI support library definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CGI_H_
|
||||
# define _CUPS_CGI_H_
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
# ifdef _WIN32
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
# 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;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
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 const 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 int cgiGetSize(const char *name);
|
||||
extern char *cgiGetTemplateDir(void);
|
||||
extern const char *cgiGetVariable(const char *name);
|
||||
extern int cgiInitialize(void);
|
||||
extern int cgiIsPOST(void);
|
||||
extern void cgiMoveJobs(http_t *http, const char *dest, int job_id);
|
||||
extern void 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 cgiSetArray(const char *name, int element,
|
||||
const char *value);
|
||||
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 */
|
||||
|
||||
#endif /* !_CUPS_CGI_H_ */
|
||||
@@ -1,529 +0,0 @@
|
||||
/*
|
||||
* Class status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2016 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"
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(void)
|
||||
{
|
||||
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"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
op = cgiGetVariable("OP");
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
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");
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
/*
|
||||
* Get the default printer...
|
||||
*/
|
||||
|
||||
if (!op || !cgiIsPOST())
|
||||
{
|
||||
/*
|
||||
* Get the default destination...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEFAULT);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
char url[HTTP_MAX_URI]; /* New URL */
|
||||
|
||||
|
||||
cgiSetVariable("DEFAULT_URI",
|
||||
cgiRewriteURL(attr->values[0].string.text,
|
||||
url, sizeof(url), NULL));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we need to show a list of classes or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
if (!pclass)
|
||||
show_all_classes(http, user);
|
||||
else
|
||||
show_class(http, pclass);
|
||||
}
|
||||
else if (pclass)
|
||||
{
|
||||
if (!*op)
|
||||
{
|
||||
const char *server_port = getenv("SERVER_PORT");
|
||||
/* Port number string */
|
||||
int port = atoi(server_port ? server_port : "0");
|
||||
/* Port number */
|
||||
char uri[1024]; /* URL */
|
||||
|
||||
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);
|
||||
}
|
||||
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...
|
||||
*/
|
||||
|
||||
cgiStartHTML(pclass);
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Unknown/bad operation...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Classes")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'do_class_op()' - Do a class operation.
|
||||
*/
|
||||
|
||||
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
@@ -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_ */
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
/*
|
||||
* HTML support functions 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"
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiEndHTML(void)
|
||||
{
|
||||
/*
|
||||
* Send the standard trailer...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("trailer.tmpl");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiEndMultipart()' - End the delivery of a multipart web page.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiEndMultipart(void)
|
||||
{
|
||||
if (cgi_multipart)
|
||||
{
|
||||
printf("\n%s--\n", cgi_multipart);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiFormEncode()' - Encode a string as a form variable.
|
||||
*/
|
||||
|
||||
char * /* O - Destination string */
|
||||
cgiFormEncode(char *dst, /* I - Destination string */
|
||||
const char *src, /* I - Source string */
|
||||
size_t dstsize) /* I - Size of destination string */
|
||||
{
|
||||
char *dstptr, /* Pointer into destination */
|
||||
*dstend; /* End of destination */
|
||||
static const char *hex = /* Hexadecimal characters */
|
||||
"0123456789ABCDEF";
|
||||
|
||||
|
||||
/*
|
||||
* Mark the end of the string...
|
||||
*/
|
||||
|
||||
dstend = dst + dstsize - 1;
|
||||
|
||||
/*
|
||||
* Loop through the source string and copy...
|
||||
*/
|
||||
|
||||
for (dstptr = dst; *src && dstptr < dstend;)
|
||||
{
|
||||
switch (*src)
|
||||
{
|
||||
case ' ' :
|
||||
/*
|
||||
* Encode spaces with a "+"...
|
||||
*/
|
||||
|
||||
*dstptr++ = '+';
|
||||
src ++;
|
||||
break;
|
||||
|
||||
case '&' :
|
||||
case '%' :
|
||||
case '+' :
|
||||
/*
|
||||
* Encode special characters with %XX escape...
|
||||
*/
|
||||
|
||||
if (dstptr < (dstend - 2))
|
||||
{
|
||||
*dstptr++ = '%';
|
||||
*dstptr++ = hex[(*src & 255) >> 4];
|
||||
*dstptr++ = hex[*src & 15];
|
||||
src ++;
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
/*
|
||||
* Copy other characters literally...
|
||||
*/
|
||||
|
||||
*dstptr++ = *src++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Nul-terminate the destination string...
|
||||
*/
|
||||
|
||||
*dstptr = '\0';
|
||||
|
||||
/*
|
||||
* Return the encoded string...
|
||||
*/
|
||||
|
||||
return (dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiStartHTML()' - Start a HTML page.
|
||||
*/
|
||||
|
||||
void
|
||||
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);
|
||||
}
|
||||
-1528
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* Job status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2014 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"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void do_job_op(http_t *http, int job_id, ipp_op_t op);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(void)
|
||||
{
|
||||
http_t *http; /* Connection to the server */
|
||||
const char *op; /* Operation name */
|
||||
const char *job_id_var; /* Job ID form variable */
|
||||
int job_id; /* Job ID */
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
cgiSetVariable("SECTION", "jobs");
|
||||
cgiSetVariable("REFRESH_PAGE", "");
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
/*
|
||||
* Get the job ID, if any...
|
||||
*/
|
||||
|
||||
if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL)
|
||||
job_id = atoi(job_id_var);
|
||||
else
|
||||
job_id = 0;
|
||||
|
||||
/*
|
||||
* Do the operation...
|
||||
*/
|
||||
|
||||
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
|
||||
{
|
||||
/*
|
||||
* Do the operation...
|
||||
*/
|
||||
|
||||
if (!strcmp(op, "cancel-job"))
|
||||
do_job_op(http, job_id, IPP_CANCEL_JOB);
|
||||
else if (!strcmp(op, "hold-job"))
|
||||
do_job_op(http, job_id, IPP_HOLD_JOB);
|
||||
else if (!strcmp(op, "move-job"))
|
||||
cgiMoveJobs(http, NULL, job_id);
|
||||
else if (!strcmp(op, "release-job"))
|
||||
do_job_op(http, job_id, IPP_RELEASE_JOB);
|
||||
else if (!strcmp(op, "restart-job"))
|
||||
do_job_op(http, job_id, IPP_RESTART_JOB);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Bad operation code... Display an error...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show a list of jobs...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
cgiShowJobs(http, NULL);
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'do_job_op()' - Do a job operation.
|
||||
*/
|
||||
|
||||
static void
|
||||
do_job_op(http_t *http, /* I - HTTP connection */
|
||||
int job_id, /* I - Job ID */
|
||||
ipp_op_t op) /* I - Operation to perform */
|
||||
{
|
||||
ipp_t *request; /* IPP request */
|
||||
char uri[HTTP_MAX_URI]; /* Job URI */
|
||||
const char *user; /* Username */
|
||||
|
||||
|
||||
/*
|
||||
* Build a job request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* job-uri or printer-uri (purge-jobs)
|
||||
* requesting-user-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(op);
|
||||
|
||||
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, uri);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/jobs"));
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -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
|
||||
@@ -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> </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.
@@ -1,549 +0,0 @@
|
||||
/*
|
||||
* Printer status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2016 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 <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);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(void)
|
||||
{
|
||||
const char *printer; /* Printer name */
|
||||
const char *user; /* Username */
|
||||
http_t *http; /* Connection to the server */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
const char *op; /* Operation to perform, if any */
|
||||
static const char *def_attrs[] = /* Attributes for default printer */
|
||||
{
|
||||
"printer-name",
|
||||
"printer-uri-supported"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
op = cgiGetVariable("OP");
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
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");
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
/*
|
||||
* Get the default printer...
|
||||
*/
|
||||
|
||||
if (!op || !cgiIsPOST())
|
||||
{
|
||||
/*
|
||||
* Get the default destination...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEFAULT);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
char url[HTTP_MAX_URI]; /* New URL */
|
||||
|
||||
|
||||
cgiSetVariable("DEFAULT_URI",
|
||||
cgiRewriteURL(attr->values[0].string.text,
|
||||
url, sizeof(url), NULL));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we need to show a list of printers or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
if (!printer)
|
||||
show_all_printers(http, user);
|
||||
else
|
||||
show_printer(http, printer);
|
||||
}
|
||||
else if (printer)
|
||||
{
|
||||
if (!*op)
|
||||
{
|
||||
const char *server_port = getenv("SERVER_PORT");
|
||||
/* Port number string */
|
||||
int port = atoi(server_port ? server_port : "0");
|
||||
/* Port number */
|
||||
char uri[1024]; /* URL */
|
||||
|
||||
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);
|
||||
}
|
||||
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...
|
||||
*/
|
||||
|
||||
cgiStartHTML(printer);
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Unknown/bad operation...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Printers")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'do_printer_op()' - Do a printer operation.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1,679 +0,0 @@
|
||||
/*
|
||||
* CGI template function.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <errno.h>
|
||||
#include <regex.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void cgi_copy(FILE *out, FILE *in, int element, char term,
|
||||
int indent);
|
||||
static void cgi_puts(const char *s, FILE *out);
|
||||
static void cgi_puturi(const char *s, FILE *out);
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiCopyTemplateFile()' - Copy a template file and replace all the
|
||||
* '{variable}' strings with the variable value.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiCopyTemplateFile(FILE *out, /* I - Output file */
|
||||
const char *tmpl) /* I - Template file to read */
|
||||
{
|
||||
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);
|
||||
|
||||
/*
|
||||
* Close the template file and return...
|
||||
*/
|
||||
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiCopyTemplateLang()' - Copy a template file using a language...
|
||||
*/
|
||||
|
||||
void
|
||||
cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
|
||||
{
|
||||
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 */
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
locale[0] = '/';
|
||||
strlcpy(locale + 1, lang, sizeof(locale) - 1);
|
||||
|
||||
if ((locptr = strchr(locale, '.')) != NULL)
|
||||
*locptr = '\0'; /* Strip charset */
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: lang=\"%s\", locale=\"%s\"...\n",
|
||||
lang ? lang : "(null)", locale);
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
locale[3] = '\0';
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
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));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the file to the end...
|
||||
*/
|
||||
|
||||
cgi_copy(stdout, in, 0, 0, 0);
|
||||
|
||||
/*
|
||||
* Close the template file and return...
|
||||
*/
|
||||
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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 */
|
||||
{
|
||||
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 */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sStarting at file position %ld...\n", indent, "",
|
||||
ftell(in));
|
||||
|
||||
/*
|
||||
* Parse the file to the end...
|
||||
*/
|
||||
|
||||
while ((ch = getc(in)) != EOF)
|
||||
if (ch == term)
|
||||
break;
|
||||
else if (ch == '{')
|
||||
{
|
||||
/*
|
||||
* Get a variable name...
|
||||
*/
|
||||
|
||||
uriencode = 0;
|
||||
|
||||
for (s = name; (ch = getc(in)) != EOF;)
|
||||
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 = '\0';
|
||||
|
||||
if (s == name && isspace(ch & 255))
|
||||
{
|
||||
fprintf(stderr, "DEBUG2: %*sLone { at %ld...\n", indent, "", ftell(in));
|
||||
|
||||
if (out)
|
||||
{
|
||||
putc('{', out);
|
||||
putc(ch, out);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '}')
|
||||
fprintf(stderr, "DEBUG2: %*s\"{%s}\" at %ld...\n", indent, "", name,
|
||||
ftell(in));
|
||||
|
||||
/*
|
||||
* See if it has a value...
|
||||
*/
|
||||
|
||||
if (name[0] == '?')
|
||||
{
|
||||
/*
|
||||
* Insert value only if it exists...
|
||||
*/
|
||||
|
||||
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
|
||||
{
|
||||
*nameptr++ = '\0';
|
||||
|
||||
if ((value = cgiGetArray(name + 1, atoi(nameptr) - 1)) != NULL)
|
||||
outptr = value;
|
||||
else
|
||||
{
|
||||
outval[0] = '\0';
|
||||
outptr = outval;
|
||||
}
|
||||
}
|
||||
else if ((value = cgiGetArray(name + 1, element)) != NULL)
|
||||
outptr = value;
|
||||
else
|
||||
{
|
||||
outval[0] = '\0';
|
||||
outptr = outval;
|
||||
}
|
||||
}
|
||||
else if (name[0] == '#')
|
||||
{
|
||||
/*
|
||||
* Insert count...
|
||||
*/
|
||||
|
||||
if (name[1])
|
||||
sprintf(outval, "%d", cgiGetSize(name + 1));
|
||||
else
|
||||
sprintf(outval, "%d", element + 1);
|
||||
|
||||
outptr = outval;
|
||||
}
|
||||
else if (name[0] == '[')
|
||||
{
|
||||
/*
|
||||
* Loop for # of elements...
|
||||
*/
|
||||
|
||||
int i; /* Looping var */
|
||||
long pos; /* File position */
|
||||
int count; /* Number of elements */
|
||||
|
||||
|
||||
if (isdigit(name[1] & 255))
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
cgi_copy(NULL, in, 0, '}', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sFinished looping on \"%s\"...\n", indent,
|
||||
"", name + 1);
|
||||
|
||||
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))
|
||||
{
|
||||
*nameptr++ = '\0';
|
||||
if ((value = cgiGetArray(name, atoi(nameptr) - 1)) == NULL)
|
||||
{
|
||||
snprintf(outval, sizeof(outval), "{%s}", name);
|
||||
outptr = outval;
|
||||
}
|
||||
else
|
||||
outptr = value;
|
||||
}
|
||||
else if ((value = cgiGetArray(name, element)) == NULL)
|
||||
{
|
||||
snprintf(outval, sizeof(outval), "{%s}", name);
|
||||
outptr = outval;
|
||||
}
|
||||
else
|
||||
outptr = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the terminating character requires another test...
|
||||
*/
|
||||
|
||||
if (ch == '}')
|
||||
{
|
||||
/*
|
||||
* End of substitution...
|
||||
*/
|
||||
|
||||
if (out)
|
||||
{
|
||||
if (uriencode)
|
||||
cgi_puturi(outptr, out);
|
||||
else if (!_cups_strcasecmp(name, "?cupsdconf_default"))
|
||||
fputs(outptr, stdout);
|
||||
else
|
||||
cgi_puts(outptr, out);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, process one of the following checks:
|
||||
*
|
||||
* {name?exist:not-exist} Exists?
|
||||
* {name=value?true:false} Equal
|
||||
* {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';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Compare to a string...
|
||||
*/
|
||||
|
||||
for (s = compare; (ch = getc(in)) != EOF;)
|
||||
if (ch == '?')
|
||||
break;
|
||||
else if (s >= (compare + sizeof(compare) - 1))
|
||||
continue;
|
||||
else if (ch == '#')
|
||||
{
|
||||
sprintf(s, "%d", element + 1);
|
||||
s += strlen(s);
|
||||
}
|
||||
else if (ch == '{')
|
||||
{
|
||||
/*
|
||||
* Grab the value of a variable...
|
||||
*/
|
||||
|
||||
innerptr = innername;
|
||||
while ((ch = getc(in)) != EOF && ch != '}')
|
||||
if (innerptr < (innername + sizeof(innername) - 1))
|
||||
*innerptr++ = (char)ch;
|
||||
*innerptr = '\0';
|
||||
|
||||
if (innername[0] == '#')
|
||||
sprintf(s, "%d", cgiGetSize(innername + 1));
|
||||
else if ((innerptr = strrchr(innername, '-')) != NULL &&
|
||||
isdigit(innerptr[1] & 255))
|
||||
{
|
||||
*innerptr++ = '\0';
|
||||
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
|
||||
*s = '\0';
|
||||
else
|
||||
strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
|
||||
}
|
||||
else if (innername[0] == '?')
|
||||
{
|
||||
if ((innerval = cgiGetArray(innername + 1, element)) == NULL)
|
||||
*s = '\0';
|
||||
else
|
||||
strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
|
||||
}
|
||||
else if ((innerval = cgiGetArray(innername, element)) == NULL)
|
||||
snprintf(s, sizeof(compare) - (size_t)(s - compare), "{%s}", innername);
|
||||
else
|
||||
strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
|
||||
|
||||
s += strlen(s);
|
||||
}
|
||||
else if (ch == '\\')
|
||||
*s++ = (char)getc(in);
|
||||
else
|
||||
*s++ = (char)ch;
|
||||
|
||||
*s = '\0';
|
||||
|
||||
if (ch != '?')
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sBad terminator '%c' at file position %ld...\n",
|
||||
indent, "", ch, ftell(in));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the comparison...
|
||||
*/
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case '<' :
|
||||
result = _cups_strcasecmp(outptr, compare) < 0;
|
||||
break;
|
||||
case '>' :
|
||||
result = _cups_strcasecmp(outptr, compare) > 0;
|
||||
break;
|
||||
case '=' :
|
||||
result = _cups_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);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
|
||||
name, op, compare, out);
|
||||
}
|
||||
else if (ch == '\\') /* Quoted char */
|
||||
{
|
||||
if (out)
|
||||
putc(getc(in), out);
|
||||
else
|
||||
getc(in);
|
||||
}
|
||||
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...
|
||||
*/
|
||||
|
||||
if (out)
|
||||
fflush(out);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_puts()' - Put a string to the output file, quoting as needed...
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_puts(const char *s, /* I - String to output */
|
||||
FILE *out) /* I - Output file */
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
if (*s == '<')
|
||||
fputs("<", out);
|
||||
else if (*s == '>')
|
||||
fputs(">", out);
|
||||
else if (*s == '\"')
|
||||
fputs(""", out);
|
||||
else if (*s == '\'')
|
||||
fputs("'", out);
|
||||
else if (*s == '&')
|
||||
fputs("&", out);
|
||||
else
|
||||
putc(*s, out);
|
||||
|
||||
s ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_puturi()' - Put a URI string to the output file, quoting as needed...
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_puturi(const char *s, /* I - String to output */
|
||||
FILE *out) /* I - Output file */
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
if (strchr("%@&+ <>#=", *s) || *s < ' ' || *s & 128)
|
||||
fprintf(out, "%%%02X", *s & 255);
|
||||
else
|
||||
putc(*s, out);
|
||||
|
||||
s ++;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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 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>
|
||||
@@ -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);
|
||||
}
|
||||
-1256
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-132
@@ -1,132 +0,0 @@
|
||||
#
|
||||
# Configuration file makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2015 by Apple Inc.
|
||||
# Copyright 1993-2006 by Easy Software Products.
|
||||
#
|
||||
# Licensed under Apache License v2.0. See the file "LICENSE" for more information.
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
#
|
||||
# Config files...
|
||||
#
|
||||
|
||||
KEEP = cups-files.conf cupsd.conf snmp.conf
|
||||
REPLACE = mime.convs mime.types
|
||||
|
||||
|
||||
#
|
||||
# Make everything...
|
||||
#
|
||||
|
||||
all:
|
||||
|
||||
|
||||
#
|
||||
# Make library targets...
|
||||
#
|
||||
|
||||
libs:
|
||||
|
||||
|
||||
#
|
||||
# Make unit tests...
|
||||
#
|
||||
|
||||
unittests:
|
||||
|
||||
|
||||
#
|
||||
# Clean all config and object files...
|
||||
#
|
||||
|
||||
clean:
|
||||
|
||||
|
||||
#
|
||||
# Dummy depend...
|
||||
#
|
||||
|
||||
depend:
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
install-data:
|
||||
for file in $(KEEP); do \
|
||||
if test -r $(SERVERROOT)/$$file ; then \
|
||||
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
|
||||
else \
|
||||
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$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 ; \
|
||||
fi ; \
|
||||
$(INSTALL_DATA) $$file $(DATADIR)/mime ; \
|
||||
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...
|
||||
#
|
||||
|
||||
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
|
||||
@@ -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
|
||||
@@ -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>
|
||||
@@ -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 -
|
||||
@@ -1,168 +0,0 @@
|
||||
#
|
||||
# Base MIME types file for CUPS.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Format of Lines:
|
||||
#
|
||||
# super/type rules
|
||||
#
|
||||
# "rules" can be any combination of:
|
||||
#
|
||||
# ( expr ) Parenthesis for expression grouping
|
||||
# + Logical AND
|
||||
# , or whitespace Logical OR
|
||||
# ! Logical NOT
|
||||
# match("pattern") Pattern match on filename
|
||||
# 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
|
||||
# locale("string") True if current locale matches string
|
||||
# contains(offset,range,"string") True if the range contains the string
|
||||
#
|
||||
# General Notes:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# The "printable" rule differs from the "ascii" rule in that it also
|
||||
# accepts 8-bit characters in the range 128-255.
|
||||
#
|
||||
# String constants must be surrounded by "" if they contain whitespace.
|
||||
# To insert binary data into a string, use the <hex> notation.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# 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")))
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Image files...
|
||||
#
|
||||
|
||||
image/gif gif string(0,GIF87a) string(0,GIF89a)
|
||||
image/png png string(0,<89>PNG)
|
||||
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/x-photocd pcd string(2048,PCD_IPI)
|
||||
image/x-portable-anymap pnm
|
||||
image/x-portable-bitmap pbm string(0,P1) string(0,P4)
|
||||
image/x-portable-graymap pgm string(0,P2) string(0,P5)
|
||||
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/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
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Text files...
|
||||
#
|
||||
|
||||
application/x-cshell csh printable(0,1024) + string(0,#!) +\
|
||||
(contains(2,80,/csh) contains(2,80,/tcsh))
|
||||
application/x-perl pl printable(0,1024) + string(0,#!) +\
|
||||
contains(2,80,/perl)
|
||||
application/x-shell sh printable(0,1024) + string(0,#!) +\
|
||||
(contains(2,80,/bash) contains(2,80,/ksh)\
|
||||
contains(2,80,/sh) contains(2,80,/zsh))
|
||||
application/x-csource c cxx cpp cc C h hpp \
|
||||
printable(0,1024) + ! 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-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")))
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raw print file support...
|
||||
#
|
||||
# Comment the following type to prevent raw file printing.
|
||||
#
|
||||
|
||||
application/octet-stream
|
||||
@@ -1,3 +0,0 @@
|
||||
@include common-auth
|
||||
@include common-account
|
||||
@include common-session
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,2 +0,0 @@
|
||||
auth required @PAMMODAUTH@
|
||||
account required @PAMMOD@
|
||||
@@ -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@
|
||||
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# "$Id: compiler.m4 142 2006-08-17 14:50:46Z mike $"
|
||||
#
|
||||
# Common compiler stuff for autoconf...
|
||||
#
|
||||
|
||||
CFLAGS="${CFLAGS:=}"
|
||||
LDFLAGS="${LDFLAGS:=}"
|
||||
LIBS="${LIBS:=}"
|
||||
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
|
||||
[if test x$enable_debug = xyes; then
|
||||
CFLAGS="-g $CFLAGS"
|
||||
LDFLAGS="-g $LDFLAGS"
|
||||
fi])
|
||||
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PATH_PROG(RM,rm)
|
||||
|
||||
dnl Support large files.
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Add -Wall for GCC...
|
||||
if test -n "$GCC"; then
|
||||
dnl Extended warnings...
|
||||
CFLAGS="-Wshadow -Winline $CFLAGS"
|
||||
dnl Standard warnings...
|
||||
CFLAGS="-Wall -Wunused -Wno-char-subscripts -Wno-format-y2k $CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: compiler.m4 142 2006-08-17 14:50:46Z mike $".
|
||||
#
|
||||
@@ -1,469 +0,0 @@
|
||||
dnl
|
||||
dnl Common configuration 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
|
||||
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(GZIP,gzip)
|
||||
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)
|
||||
|
||||
AC_MSG_CHECKING(for install-sh script)
|
||||
INSTALL="`pwd`/install-sh"
|
||||
AC_SUBST(INSTALL)
|
||||
AC_MSG_RESULT(using $INSTALL)
|
||||
|
||||
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 Mini-XML (www.minixml.org)...
|
||||
LIBMXML=""
|
||||
AC_CHECK_HEADER(mxml.h,
|
||||
SAVELIBS="$LIBS"
|
||||
AC_SEARCH_LIBS(mmxlNewElement,mxml,
|
||||
AC_DEFINE(HAVE_MXML_H)
|
||||
LIBMXML="-lmxml")
|
||||
LIBS="$SAVELIBS")
|
||||
AC_SUBST(LIBMXML)
|
||||
|
||||
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$GZIP" != z; 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
|
||||
AC_ARG_ENABLE(dbus, [ --disable-dbus build without DBUS support])
|
||||
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
|
||||
DBUSDIR="$withval")
|
||||
|
||||
DBUSDIR=""
|
||||
DBUS_NOTIFIER=""
|
||||
DBUS_NOTIFIERLIBS=""
|
||||
|
||||
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; 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 SystemConfiguration -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))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
|
||||
|
||||
dnl Check for dynamic store function...
|
||||
AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
|
||||
|
||||
dnl Check for the new membership functions in MacOSX 10.4...
|
||||
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
|
||||
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_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])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
|
||||
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")
|
||||
AC_CHECK_HEADER(xpc/private.h,
|
||||
AC_DEFINE(HAVE_XPC_PRIVATE_H))
|
||||
;;
|
||||
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"
|
||||
LIBCUPSOBJS="\$(COREOBJS) \$(DRIVEROBJS)"
|
||||
case "$COMPONENTS" in
|
||||
all)
|
||||
BUILDDIRS="test filter backend berkeley cgi-bin monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
|
||||
;;
|
||||
|
||||
core)
|
||||
BUILDDIRS="test locale"
|
||||
;;
|
||||
|
||||
libcups)
|
||||
BUILDDIRS="locale"
|
||||
cupsimagebase=""
|
||||
;;
|
||||
|
||||
libcupslite)
|
||||
BUILDDIRS="locale"
|
||||
cupsimagebase=""
|
||||
LIBCUPSOBJS="\$(COREOBJS)"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Bad build component "$COMPONENT" specified!])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(BUILDDIRS)
|
||||
AC_SUBST(LIBCUPSOBJS)
|
||||
@@ -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
|
||||
@@ -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"
|
||||
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)
|
||||
@@ -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)
|
||||
@@ -1,76 +0,0 @@
|
||||
dnl
|
||||
dnl DNS Service Discovery (aka Bonjour) stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2017 by Apple Inc.
|
||||
dnl
|
||||
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more 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.\$(MAN1EXT)"
|
||||
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)
|
||||
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
|
||||
DNSSD_BACKEND="dnssd"
|
||||
IPPFIND_BIN="ippfind"
|
||||
IPPFIND_MAN="ippfind.\$(MAN1EXT)"
|
||||
;;
|
||||
*)
|
||||
# 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.\$(MAN1EXT)"
|
||||
AC_MSG_RESULT(no))
|
||||
LIBS="$SAVELIBS"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
fi
|
||||
|
||||
AC_SUBST(DNSSDLIBS)
|
||||
AC_SUBST(DNSSD_BACKEND)
|
||||
AC_SUBST(IPPFIND_BIN)
|
||||
AC_SUBST(IPPFIND_MAN)
|
||||
@@ -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")
|
||||
@@ -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))
|
||||
@@ -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)
|
||||
@@ -1,72 +0,0 @@
|
||||
dnl
|
||||
dnl Manpage stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2017 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 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"
|
||||
AMANDIR="/usr/share/man"
|
||||
PMANDIR="/usr/share/man"
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
mandir="/usr/man"
|
||||
AMANDIR="/usr/man"
|
||||
PMANDIR="/usr/man"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
AMANDIR="$mandir"
|
||||
PMANDIR="$mandir"
|
||||
fi
|
||||
|
||||
AC_SUBST(AMANDIR)
|
||||
AC_SUBST(PMANDIR)
|
||||
|
||||
dnl Setup manpage extensions...
|
||||
case "$host_os_name" in
|
||||
sunos*)
|
||||
# Solaris
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=1m
|
||||
MAN8DIR=1m
|
||||
;;
|
||||
linux* | gnu* | darwin*)
|
||||
# Linux, GNU Hurd, and macOS
|
||||
MAN1EXT=1.gz
|
||||
MAN5EXT=5.gz
|
||||
MAN7EXT=7.gz
|
||||
MAN8EXT=8.gz
|
||||
MAN8DIR=8
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=8
|
||||
MAN8DIR=8
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(MAN1EXT)
|
||||
AC_SUBST(MAN5EXT)
|
||||
AC_SUBST(MAN7EXT)
|
||||
AC_SUBST(MAN8EXT)
|
||||
AC_SUBST(MAN8DIR)
|
||||
@@ -1,66 +0,0 @@
|
||||
dnl
|
||||
dnl Networking stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2016 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_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H),,[
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>])
|
||||
AC_SEARCH_LIBS(socket, socket)
|
||||
AC_SEARCH_LIBS(gethostbyaddr, nsl)
|
||||
AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
|
||||
AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
|
||||
AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
|
||||
AC_SEARCH_LIBS(__res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT),
|
||||
AC_SEARCH_LIBS(res_9_init, resolv bind, AC_DEFINE(HAVE_RES_INIT),
|
||||
AC_SEARCH_LIBS(res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT))))
|
||||
|
||||
# Tru64 5.1b leaks file descriptors with these functions; disable until
|
||||
# we can come up with a test for this...
|
||||
if test "$host_os_name" != "osf1"; then
|
||||
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
|
||||
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
|
||||
fi
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
|
||||
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
|
||||
|
||||
CUPS_DEFAULT_DOMAINSOCKET=""
|
||||
|
||||
dnl Domain socket support...
|
||||
AC_ARG_WITH(domainsocket, [ --with-domainsocket set unix domain socket name],
|
||||
default_domainsocket="$withval",
|
||||
default_domainsocket="")
|
||||
|
||||
if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
|
||||
if test "x$default_domainsocket" = x; then
|
||||
case "$host_os_name" in
|
||||
darwin*)
|
||||
# Darwin and macOS do their own thing...
|
||||
CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
|
||||
;;
|
||||
*)
|
||||
# All others use FHS standard...
|
||||
CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
|
||||
fi
|
||||
|
||||
CUPS_LISTEN_DOMAINSOCKET="Listen $CUPS_DEFAULT_DOMAINSOCKET"
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET")
|
||||
else
|
||||
CUPS_LISTEN_DOMAINSOCKET=""
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
|
||||
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
|
||||
@@ -1,38 +0,0 @@
|
||||
dnl
|
||||
dnl Operating system stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2018 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 Get the build and host platforms and split the host_os value
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
[host_os_name=`echo $host_os | sed -e '1,$s/[0-9.]*$//g'`]
|
||||
[host_os_version=`echo $host_os | sed -e '1,$s/^[^0-9.]*//g' | awk -F. '{print $1 $2}'`]
|
||||
# Linux often does not yield an OS version we can use...
|
||||
if test "x$host_os_version" = x; then
|
||||
host_os_version="0"
|
||||
fi
|
||||
|
||||
if test "$host_os_name" = darwin -a $host_os_version -lt 120; then
|
||||
AC_MSG_ERROR([Sorry, this version of CUPS requires macOS 10.8 or higher.])
|
||||
fi
|
||||
|
||||
echo host_os_version=$host_os_version
|
||||
|
||||
dnl Determine whether we are cross-compiling...
|
||||
if test "$build" = "$host"; then
|
||||
# No, build local targets
|
||||
LOCALTARGET="local"
|
||||
else
|
||||
# Yes, don't build local targets
|
||||
LOCALTARGET=""
|
||||
fi
|
||||
AC_SUBST(LOCALTARGET)
|
||||
|
||||
AC_PATH_PROGS(CODE_SIGN, codesign true)
|
||||
@@ -1,99 +0,0 @@
|
||||
dnl
|
||||
dnl PAM stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2017 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(pam, [ --disable-pam disable PAM support])
|
||||
AC_ARG_WITH(pam_module, [ --with-pam-module set the PAM module to use])
|
||||
|
||||
PAMDIR=""
|
||||
PAMFILE="pam.std"
|
||||
PAMLIBS=""
|
||||
PAMMOD="pam_unknown.so"
|
||||
PAMMODAUTH="pam_unknown.so"
|
||||
|
||||
if test x$enable_pam != xno; then
|
||||
SAVELIBS="$LIBS"
|
||||
|
||||
AC_CHECK_LIB(dl,dlopen)
|
||||
AC_CHECK_LIB(pam,pam_start)
|
||||
AC_CHECK_LIB(pam,pam_set_item,AC_DEFINE(HAVE_PAM_SET_ITEM))
|
||||
AC_CHECK_LIB(pam,pam_setcred,AC_DEFINE(HAVE_PAM_SETCRED))
|
||||
AC_CHECK_HEADER(security/pam_appl.h)
|
||||
if test x$ac_cv_header_security_pam_appl_h != xyes; then
|
||||
AC_CHECK_HEADER(pam/pam_appl.h,
|
||||
AC_DEFINE(HAVE_PAM_PAM_APPL_H))
|
||||
fi
|
||||
|
||||
if test x$ac_cv_lib_pam_pam_start != xno; then
|
||||
# Set the necessary libraries for PAM...
|
||||
if test x$ac_cv_lib_dl_dlopen != xno; then
|
||||
PAMLIBS="-lpam -ldl"
|
||||
else
|
||||
PAMLIBS="-lpam"
|
||||
fi
|
||||
|
||||
# Find the PAM configuration directory, if any...
|
||||
for dir in /private/etc/pam.d /etc/pam.d; do
|
||||
if test -d $dir; then
|
||||
PAMDIR=$dir
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
case "$host_os_name" in
|
||||
darwin*)
|
||||
# Darwin/macOS
|
||||
if test "x$with_pam_module" != x; then
|
||||
PAMFILE="pam.$with_pam_module"
|
||||
elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
|
||||
PAMFILE="pam.opendirectory"
|
||||
else
|
||||
PAMFILE="pam.securityserver"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
# All others; this test might need to be updated
|
||||
# as Linux distributors move things around...
|
||||
if test "x$with_pam_module" != x; then
|
||||
PAMMOD="pam_${with_pam_module}.so"
|
||||
elif test -f /etc/pam.d/common-auth; then
|
||||
PAMFILE="pam.common"
|
||||
else
|
||||
moddir=""
|
||||
for dir in /lib/security /lib64/security /lib/x86_64-linux-gnu/security /var/lib/pam; do
|
||||
if test -d $dir; then
|
||||
moddir=$dir
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
if test -f $moddir/pam_unix2.so; then
|
||||
PAMMOD="pam_unix2.so"
|
||||
elif test -f $moddir/pam_unix.so; then
|
||||
PAMMOD="pam_unix.so"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$PAMMOD" = xpam_unix.so; then
|
||||
PAMMODAUTH="$PAMMOD shadow nodelay"
|
||||
else
|
||||
PAMMODAUTH="$PAMMOD nodelay"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST(PAMDIR)
|
||||
AC_SUBST(PAMFILE)
|
||||
AC_SUBST(PAMLIBS)
|
||||
AC_SUBST(PAMMOD)
|
||||
AC_SUBST(PAMMODAUTH)
|
||||
@@ -1,12 +0,0 @@
|
||||
dnl
|
||||
dnl Select/poll stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
|
||||
dnl
|
||||
|
||||
AC_CHECK_FUNC(poll, AC_DEFINE(HAVE_POLL))
|
||||
AC_CHECK_FUNC(epoll_create, AC_DEFINE(HAVE_EPOLL))
|
||||
AC_CHECK_FUNC(kqueue, AC_DEFINE(HAVE_KQUEUE))
|
||||
@@ -1,156 +0,0 @@
|
||||
dnl
|
||||
dnl Shared library support 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
|
||||
dnl information.
|
||||
dnl
|
||||
|
||||
PICFLAG=1
|
||||
DSOFLAGS="${DSOFLAGS:=}"
|
||||
|
||||
AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
|
||||
|
||||
cupsbase="cups"
|
||||
LIBCUPSBASE="lib$cupsbase"
|
||||
LIBCUPSIMAGE=""
|
||||
LIBCUPSSTATIC="lib$cupsbase.a"
|
||||
|
||||
if test x$enable_shared != xno; then
|
||||
case "$host_os_name" in
|
||||
sunos*)
|
||||
LIBCUPS="lib$cupsbase.so.2"
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LIBCUPSIMAGE="lib$cupsimagebase.so.2"
|
||||
fi
|
||||
DSO="\$(CC)"
|
||||
DSOXX="\$(CXX)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
|
||||
;;
|
||||
linux* | gnu* | *bsd*)
|
||||
LIBCUPS="lib$cupsbase.so.2"
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LIBCUPSIMAGE="lib$cupsimagebase.so.2"
|
||||
fi
|
||||
DSO="\$(CC)"
|
||||
DSOXX="\$(CXX)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
|
||||
;;
|
||||
darwin*)
|
||||
LIBCUPS="lib$cupsbase.2.dylib"
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LIBCUPSIMAGE="lib$cupsimagebase.2.dylib"
|
||||
fi
|
||||
DSO="\$(CC)"
|
||||
DSOXX="\$(CXX)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
|
||||
;;
|
||||
*)
|
||||
echo "Warning: shared libraries may not be supported. Trying -shared"
|
||||
echo " option with compiler."
|
||||
LIBCUPS="lib$cupsbase.so.2"
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LIBCUPSIMAGE="lib$cupsimagebase.so.2"
|
||||
fi
|
||||
DSO="\$(CC)"
|
||||
DSOXX="\$(CXX)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
PICFLAG=0
|
||||
LIBCUPS="lib$cupsbase.a"
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LIBCUPSIMAGE="lib$cupsimagebase.a"
|
||||
fi
|
||||
DSO=":"
|
||||
DSOXX=":"
|
||||
fi
|
||||
|
||||
AC_SUBST(DSO)
|
||||
AC_SUBST(DSOXX)
|
||||
AC_SUBST(DSOFLAGS)
|
||||
AC_SUBST(LIBCUPS)
|
||||
AC_SUBST(LIBCUPSBASE)
|
||||
AC_SUBST(LIBCUPSIMAGE)
|
||||
AC_SUBST(LIBCUPSSTATIC)
|
||||
|
||||
if test x$enable_shared = xno; then
|
||||
LINKCUPS="../cups/lib$cupsbase.a"
|
||||
EXTLINKCUPS="-lcups"
|
||||
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LINKCUPSIMAGE="../cups/lib$cupsimagebase.a"
|
||||
EXTLINKCUPSIMAGE="-l$cupsimagebase"
|
||||
else
|
||||
LINKCUPSIMAGE=""
|
||||
EXTLINKCUPSIMAGE=""
|
||||
fi
|
||||
else
|
||||
LINKCUPS="-l${cupsbase}"
|
||||
EXTLINKCUPS="-lcups"
|
||||
|
||||
if test "x$cupsimagebase" != x; then
|
||||
LINKCUPSIMAGE="-l$cupsimagebase"
|
||||
EXTLINKCUPSIMAGE="-l$cupsimagebase"
|
||||
else
|
||||
LINKCUPSIMAGE=""
|
||||
EXTLINKCUPSIMAGE=""
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(EXTLINKCUPS)
|
||||
AC_SUBST(EXTLINKCUPSIMAGE)
|
||||
AC_SUBST(LINKCUPS)
|
||||
AC_SUBST(LINKCUPSIMAGE)
|
||||
|
||||
dnl Update libraries for DSOs...
|
||||
EXPORT_LDFLAGS=""
|
||||
|
||||
if test "$DSO" != ":"; then
|
||||
# When using DSOs the image libraries are linked to libcupsimage.so
|
||||
# rather than to the executables. This makes things smaller if you
|
||||
# are using any static libraries, and it also allows us to distribute
|
||||
# a single DSO rather than a bunch...
|
||||
DSOLIBS="\$(LIBZ)"
|
||||
IMGLIBS=""
|
||||
|
||||
# Tell the run-time linkers where to find a DSO. Some platforms
|
||||
# need this option, even when the library is installed in a
|
||||
# standard location...
|
||||
case $host_os_name in
|
||||
sunos*)
|
||||
# Solaris...
|
||||
if test $exec_prefix != /usr; then
|
||||
DSOFLAGS="-R$libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -R$libdir"
|
||||
EXPORT_LDFLAGS="-R$libdir"
|
||||
fi
|
||||
;;
|
||||
*bsd*)
|
||||
# *BSD...
|
||||
if test $exec_prefix != /usr; then
|
||||
DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
|
||||
EXPORT_LDFLAGS="-Wl,-R$libdir"
|
||||
fi
|
||||
;;
|
||||
linux* | gnu*)
|
||||
# Linux, and HURD...
|
||||
if test $exec_prefix != /usr; then
|
||||
DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
|
||||
EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
DSOLIBS=""
|
||||
IMGLIBS="\$(LIBZ)"
|
||||
fi
|
||||
|
||||
AC_SUBST(DSOLIBS)
|
||||
AC_SUBST(IMGLIBS)
|
||||
AC_SUBST(EXPORT_LDFLAGS)
|
||||
@@ -1,101 +0,0 @@
|
||||
dnl
|
||||
dnl TLS 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_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
|
||||
AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
|
||||
AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
|
||||
|
||||
SSLFLAGS=""
|
||||
SSLLIBS=""
|
||||
have_ssl=0
|
||||
CUPS_SERVERKEYCHAIN=""
|
||||
|
||||
if test x$enable_ssl != xno; then
|
||||
dnl Look for CDSA...
|
||||
if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
|
||||
if test $host_os_name = darwin; then
|
||||
AC_CHECK_HEADER(Security/SecureTransport.h, [
|
||||
have_ssl=1
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_CDSASSL)
|
||||
CUPS_SERVERKEYCHAIN="/Library/Keychains/System.keychain"
|
||||
|
||||
dnl Check for the various security headers...
|
||||
AC_CHECK_HEADER(Security/SecureTransportPriv.h,
|
||||
AC_DEFINE(HAVE_SECURETRANSPORTPRIV_H))
|
||||
AC_CHECK_HEADER(Security/SecCertificate.h,
|
||||
AC_DEFINE(HAVE_SECCERTIFICATE_H))
|
||||
AC_CHECK_HEADER(Security/SecItem.h,
|
||||
AC_DEFINE(HAVE_SECITEM_H))
|
||||
AC_CHECK_HEADER(Security/SecItemPriv.h,
|
||||
AC_DEFINE(HAVE_SECITEMPRIV_H),,
|
||||
[#include <Security/SecItem.h>])
|
||||
AC_CHECK_HEADER(Security/SecPolicy.h,
|
||||
AC_DEFINE(HAVE_SECPOLICY_H))
|
||||
AC_CHECK_HEADER(Security/SecPolicyPriv.h,
|
||||
AC_DEFINE(HAVE_SECPOLICYPRIV_H))
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,
|
||||
AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
|
||||
AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
|
||||
|
||||
AC_DEFINE(HAVE_CSSMERRORSTRING)
|
||||
AC_DEFINE(HAVE_SECKEYCHAINOPEN)])
|
||||
|
||||
if test $host_os_version -ge 150; then
|
||||
AC_DEFINE(HAVE_SSLSETENABLEDCIPHERS)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Then look for GNU TLS...
|
||||
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
|
||||
AC_PATH_TOOL(LIBGNUTLSCONFIG,libgnutls-config)
|
||||
if $PKGCONFIG --exists gnutls; then
|
||||
have_ssl=1
|
||||
SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
elif test "x$LIBGNUTLSCONFIG" != x; then
|
||||
have_ssl=1
|
||||
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
|
||||
if test $have_ssl = 1; then
|
||||
CUPS_SERVERKEYCHAIN="ssl"
|
||||
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS $SSLLIBS"
|
||||
AC_CHECK_FUNC(gnutls_transport_set_pull_timeout_function, AC_DEFINE(HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION))
|
||||
AC_CHECK_FUNC(gnutls_priority_set_direct, AC_DEFINE(HAVE_GNUTLS_PRIORITY_SET_DIRECT))
|
||||
LIBS="$SAVELIBS"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
IPPALIASES="http"
|
||||
if test $have_ssl = 1; then
|
||||
AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
|
||||
AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
|
||||
IPPALIASES="http https ipps"
|
||||
elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes; then
|
||||
AC_MSG_ERROR([Unable to enable SSL support.])
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_SERVERKEYCHAIN)
|
||||
AC_SUBST(IPPALIASES)
|
||||
AC_SUBST(SSLFLAGS)
|
||||
AC_SUBST(SSLLIBS)
|
||||
|
||||
EXPORT_SSLLIBS="$SSLLIBS"
|
||||
AC_SUBST(EXPORT_SSLLIBS)
|
||||
@@ -1,183 +0,0 @@
|
||||
dnl
|
||||
dnl Launch-on-demand/startup stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2017 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
|
||||
|
||||
ONDEMANDFLAGS=""
|
||||
ONDEMANDLIBS=""
|
||||
AC_SUBST(ONDEMANDFLAGS)
|
||||
AC_SUBST(ONDEMANDLIBS)
|
||||
|
||||
dnl Launchd is used on macOS/Darwin...
|
||||
AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
|
||||
LAUNCHD_DIR=""
|
||||
AC_SUBST(LAUNCHD_DIR)
|
||||
|
||||
if test x$enable_launchd != xno; then
|
||||
AC_CHECK_FUNC(launch_activate_socket, [
|
||||
AC_DEFINE(HAVE_LAUNCHD)
|
||||
AC_DEFINE(HAVE_ONDEMAND)])
|
||||
AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
|
||||
|
||||
if test "$host_os_name" = darwin; then
|
||||
LAUNCHD_DIR="/System/Library/LaunchDaemons"
|
||||
# liblaunch is already part of libSystem
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Systemd is used on Linux...
|
||||
AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support])
|
||||
AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files],
|
||||
SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
|
||||
AC_SUBST(SYSTEMD_DIR)
|
||||
|
||||
if test x$enable_systemd != xno; then
|
||||
if test "x$PKGCONFIG" = x; then
|
||||
if test x$enable_systemd = xyes; then
|
||||
AC_MSG_ERROR(Need pkg-config to enable systemd support.)
|
||||
fi
|
||||
else
|
||||
have_systemd=no
|
||||
AC_MSG_CHECKING(for libsystemd)
|
||||
if $PKGCONFIG --exists libsystemd; then
|
||||
AC_MSG_RESULT(yes)
|
||||
have_systemd=yes
|
||||
ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd`
|
||||
ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd`
|
||||
elif $PKGCONFIG --exists libsystemd-daemon; then
|
||||
AC_MSG_RESULT(yes - legacy)
|
||||
have_systemd=yes
|
||||
ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
|
||||
ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
|
||||
|
||||
if $PKGCONFIG --exists libsystemd-journal; then
|
||||
ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`"
|
||||
ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
if test $have_systemd = yes; then
|
||||
AC_DEFINE(HAVE_SYSTEMD)
|
||||
AC_DEFINE(HAVE_ONDEMAND)
|
||||
AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H))
|
||||
if test "x$SYSTEMD_DIR" = x; then
|
||||
SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Upstart is also used on Linux (e.g., Chrome OS)
|
||||
AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
|
||||
if test "x$enable_upstart" = "xyes"; then
|
||||
if test "x$have_systemd" = "xyes"; then
|
||||
AC_MSG_ERROR(Cannot support both systemd and upstart.)
|
||||
fi
|
||||
AC_DEFINE(HAVE_UPSTART)
|
||||
AC_DEFINE(HAVE_ONDEMAND)
|
||||
fi
|
||||
|
||||
dnl Solaris uses smf
|
||||
SMFMANIFESTDIR=""
|
||||
AC_SUBST(SMFMANIFESTDIR)
|
||||
AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
|
||||
|
||||
dnl Use init on other platforms...
|
||||
AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
|
||||
AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
|
||||
AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
|
||||
AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
|
||||
|
||||
if test x$rcdir = x; then
|
||||
if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then
|
||||
# Fall back on "init", the original service startup interface...
|
||||
if test -d /sbin/init.d; then
|
||||
# SuSE
|
||||
rcdir="/sbin/init.d"
|
||||
elif test -d /etc/init.d; then
|
||||
# Others
|
||||
rcdir="/etc"
|
||||
else
|
||||
# RedHat, NetBSD
|
||||
rcdir="/etc/rc.d"
|
||||
fi
|
||||
else
|
||||
rcdir="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$rcstart" = x; then
|
||||
case "$host_os_name" in
|
||||
linux* | gnu*)
|
||||
# Linux
|
||||
rcstart="81"
|
||||
;;
|
||||
|
||||
sunos*)
|
||||
# Solaris
|
||||
rcstart="81"
|
||||
;;
|
||||
|
||||
*)
|
||||
# Others
|
||||
rcstart="99"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "x$rcstop" = x; then
|
||||
case "$host_os_name" in
|
||||
linux* | gnu*)
|
||||
# Linux
|
||||
rcstop="36"
|
||||
;;
|
||||
|
||||
*)
|
||||
# Others
|
||||
rcstop="00"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
INITDIR=""
|
||||
INITDDIR=""
|
||||
RCLEVELS="$rclevels"
|
||||
RCSTART="$rcstart"
|
||||
RCSTOP="$rcstop"
|
||||
AC_SUBST(INITDIR)
|
||||
AC_SUBST(INITDDIR)
|
||||
AC_SUBST(RCLEVELS)
|
||||
AC_SUBST(RCSTART)
|
||||
AC_SUBST(RCSTOP)
|
||||
|
||||
if test "x$rcdir" != xno; then
|
||||
if test "x$rclevels" = x; then
|
||||
INITDDIR="$rcdir"
|
||||
else
|
||||
INITDIR="$rcdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Xinetd support...
|
||||
AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
|
||||
XINETD=""
|
||||
AC_SUBST(XINETD)
|
||||
|
||||
if test "x$xinetd" = x; then
|
||||
if test ! -x /sbin/launchd; then
|
||||
for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do
|
||||
if test -d $dir; then
|
||||
XINETD="$dir"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
elif test "x$xinetd" != xno; then
|
||||
XINETD="$xinetd"
|
||||
fi
|
||||
@@ -1,44 +0,0 @@
|
||||
dnl
|
||||
dnl Threading stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2017 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(threads, [ --disable-threads disable multi-threading support])
|
||||
|
||||
have_pthread=no
|
||||
PTHREAD_FLAGS=""
|
||||
|
||||
if test "x$enable_threads" != xno; then
|
||||
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
|
||||
|
||||
if test x$ac_cv_header_pthread_h = xyes; then
|
||||
dnl Check various threading options for the platforms we support
|
||||
for flag in -lpthreads -lpthread -pthread; do
|
||||
AC_MSG_CHECKING([for pthread_create using $flag])
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$flag $LIBS"
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_create(0, 0, 0, 0);],
|
||||
have_pthread=yes,
|
||||
LIBS="$SAVELIBS")
|
||||
AC_MSG_RESULT([$have_pthread])
|
||||
|
||||
if test $have_pthread = yes; then
|
||||
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
|
||||
|
||||
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
|
||||
# be POSIX-compliant... :(
|
||||
if test $host_os_name = sunos; then
|
||||
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_FLAGS)
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Common C++ compiler stuff for autoconf...
|
||||
#
|
||||
|
||||
CXXFLAGS="${CXXFLAGS:=}"
|
||||
|
||||
if test x$enable_debug = xyes; then
|
||||
CXXFLAGS="-g $CXXFLAGS"
|
||||
fi
|
||||
|
||||
AC_PROG_CXX
|
||||
|
||||
dnl Add -Wall for GCC...
|
||||
if test -n "$GCC"; then
|
||||
dnl Extended warnings...
|
||||
CXXFLAGS="-Wshadow -Wconversion -Winline $CXXFLAGS"
|
||||
dnl Standard warnings...
|
||||
CXXFLAGS="-Wall -Wunused -Wno-char-subscripts -Wno-format-y2k $CXXFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -0,0 +1,119 @@
|
||||
#
|
||||
# "$Id: library.m4 44 2006-05-08 19:33:22Z mike $"
|
||||
#
|
||||
# Common directory stuff for autoconf...
|
||||
#
|
||||
|
||||
dnl Get the operating system, version number, and architecture...
|
||||
uname=`uname`
|
||||
uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'`
|
||||
uarch=`uname -m`
|
||||
|
||||
case "$uname" in
|
||||
GNU* | GNU/*)
|
||||
uname="GNU"
|
||||
;;
|
||||
IRIX*)
|
||||
uname="IRIX"
|
||||
;;
|
||||
Linux*)
|
||||
uname="Linux"
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
|
||||
dnl Fix "sbindir" variable...
|
||||
if test "$sbindir" = "\${exec_prefix}/sbin"; then
|
||||
sbindir="$exec_prefix/sbin"
|
||||
fi
|
||||
|
||||
dnl Fix "sharedstatedir" variable if it hasn't been specified...
|
||||
if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
|
||||
sharedstatedir="/usr/com"
|
||||
fi
|
||||
|
||||
dnl Fix "datarootdir" variable if it hasn't been specified...
|
||||
if test "$datarootdir" = "\${prefix}/share"; then
|
||||
if test "$prefix" = "/"; then
|
||||
datarootdir="/usr/share"
|
||||
else
|
||||
datarootdir="$prefix/share"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "datadir" variable if it hasn't been specified...
|
||||
if test "$datadir" = "\${prefix}/share"; then
|
||||
if test "$prefix" = "/"; then
|
||||
datadir="/usr/share"
|
||||
else
|
||||
datadir="$prefix/share"
|
||||
fi
|
||||
elif test "$datadir" = "\${datarootdir}"; then
|
||||
datadir="$datarootdir"
|
||||
fi
|
||||
|
||||
dnl Fix "includedir" variable if it hasn't been specified...
|
||||
if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
|
||||
includedir="/usr/include"
|
||||
fi
|
||||
|
||||
dnl Fix "localstatedir" variable if it hasn't been specified...
|
||||
if test "$localstatedir" = "\${prefix}/var"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
localstatedir="/private/var"
|
||||
else
|
||||
localstatedir="/var"
|
||||
fi
|
||||
else
|
||||
localstatedir="$prefix/var"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "sysconfdir" variable if it hasn't been specified...
|
||||
if test "$sysconfdir" = "\${prefix}/etc"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
sysconfdir="/private/etc"
|
||||
else
|
||||
sysconfdir="/etc"
|
||||
fi
|
||||
else
|
||||
sysconfdir="$prefix/etc"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "libdir" variable for IRIX 6.x...
|
||||
if test "$libdir" = "\${exec_prefix}/lib"; then
|
||||
if test "$uname" = "IRIX"; then
|
||||
libdir="$exec_prefix/lib32"
|
||||
else
|
||||
if test "$uname" = Linux -a -d /usr/lib64; then
|
||||
libdir="$exec_prefix/lib64"
|
||||
else
|
||||
libdir="$exec_prefix/lib"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# End of "$Id: library.m4 44 2006-05-08 19:33:22Z mike $".
|
||||
#
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário