Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 5b5a12ad96 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.4.3@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
2479 arquivos alterados com 249967 adições e 178939 exclusões
+856
Ver Arquivo
@@ -0,0 +1,856 @@
CHANGES-1.3.txt
---------------
CHANGES IN CUPS V1.3.11
- The scheduler did not prevent nested classes (STR #3211)
- The scheduler did not reprint processing jobs that were moved to
another destination (STR #3222)
- The scheduler did not reset the current job file when stopping a
printer (STR #3226)
- The scheduler did not handle POSTs to custom CGIs properly (STR #3221)
- The pdftops filter did not print landscape PDF pages properly
(STR #2881)
- The scheduler did not handle partial header lines properly from CGI
programs (STR #3194)
- The web interface could hang on OpenBSD (STR #3176, STR #3196)
- The scheduler and cupsfilter utility did not handle rules starting
with a negation operator properly (STR #3160)
- The scheduler and cupsfilter utility would crash with certain MIME
.types rules (STR #3159)
- httpSetField wasn't bracketing IPv6 numeric addresses for the Host:
field (STR #3164)
- The ServerName, if specified, was not treated as a valid alias for the
local system (STR #3167)
- "make epm" did not work (STR #3166)
- "lpstat -h server" showed non-shared printers (STR #3147)
- "make check" did not work on Linux (STR #3161)
CHANGES IN CUPS V1.3.10
- Documentation fixes (STR #2994, STR #2995, STR #3008, STR #3056,
STR #3057)
- SECURITY: The scheduler now protects against DNS rebinding attacks
(STR #3118)
- SECURITY: Fixed TIFF integer overflow in image filters (STR #3031)
- The scheduler did not support the job-hold-until attribute with the
Restart-Job operation (STR #3130)
- SECURITY: The PNG image reading code did not validate the
image size properly, leading to a potential buffer overflow
(STR #2974)
- The rastertohp driver did not set the 1-sided printing mode when
needed (STR #3131)
- Now use a wrapper program instead of our fork of the Xpdf code to
support printing of PDF files. The new wrapper supports using Xpdf,
poppler, or Ghostscript to convert PDF files to PostScript (STR #3129)
- Long job names caused problems with some PJL printers (STR #3125)
- The lpq command did not work when showing all destinations (STR #3117)
- The scheduler used a codeset name of UTF8 which is not supported on
Solaris (STR #3113)
- cupsGetJobs() did not work with a NULL destination (STR #3107)
- Fixed a localization problem for option choices (incorrectly) named
"Custom" (STR #3106)
- The fallback OpenSSL random number seeding would not work (STR #3079)
- The scheduler might miss a child signal, causing high CPU usage.
- The scheduler did not enforce quotas after the job history was
unloaded (STR #3078)
- The job-k-limit, job-page-limit, and job-quota-period attributes
could not be set using the lpadmin command (STR #3077)
- httpSeparateURI() did not error out on URIs with a missing port
number after a colon.
- Fixed a Valgrind-detected initialization error when creating a
missing directory on startup.
- The scheduler did not always read all of the HTTP headers from a
CGI script/program.
- The scheduler did not always set the "air" property in Bonjour/DNS-SD
registrations.
- The scheduler incorrectly compared Mac OS X UUIDs for access
control, preventing access in certain configurations.
- The IPP backend incorrectly reset the required authentication
to Kerberos when authentication failed.
- The scheduler no longer looks up the local hostname by default;
turn on hostname lookups to restore the previous behavior.
- The scheduler did not always load MIME type rules correctly
(STR #3059)
- The test page did not format correctly on A4 paper (STR #3060)
- The web interface sometimes incorrectly redirected users to
127.0.0.1 (STR #3022)
- cupsPrintFile*() did not send the document filename for single
file submissions (STR #3055)
- The scheduler did not update the member-names attribute when
removing the last printer from a class.
- The scheduler did not report PPD Products with parenthesis
in them properly (STR #3046)
- The wrong italic fonts were listed in the UTF-8 charset file
for the text filter.
- The backends did not return an OK status for the
CUPS_SC_CMD_GET_BIDI side-channel command (STR #3029)
- The scheduler did not purge jobs that were missing a
time-at-creation attribute, indicating a bad job control file
(STR #3030)
- The "-o job-hold-until=week-end" option did not work properly
(STR #3025)
- The Solaris USB printer device does not support select or poll
(STR #3028)
- The scheduler would crash if you exceeded the MaxSubscriptions
limit.
- The lp "-H immediate" option did not specify that the job
should not be held (STR #3013)
- The scheduler did not support the "Connection: close"
HTTP header (STR #3010)
- The mailto notifier didn't terminate messages properly
(STR #3011)
- Backends could spin trying to read back-channel data
(STR #3001)
- The HP-GL/2 filter was using the wrong default colors
(STR #2966)
- The scheduler incorrectly allowed Get-Jobs operations without a
printer-uri (STR #2996)
- The compression option was not being encoded properly
(STR #2997)
- Added a missing character map for JIS-X0213/ShiftJIS.
- The scheduler now rejects ATTR: messages with empty values.
- The scheduler could consume all CPU handling closed connections
(STR #2988)
- Fixed some configure script bugs with rc/xinetd directories
(STR #2970)
- The Epson sample driver PPDs contained errors (STR #2979)
CHANGES IN CUPS V1.3.9
- SECURITY: The HP-GL/2 filter did not range check pen numbers
(STR #2911)
- SECURITY: The SGI image file reader did not range check
16-bit run lengths (STR #2918)
- SECURITY: The text filter did not range check cpi, lpi, or
column values (STR #2919)
- Documentation updates (STR #2904, STR #2944)
- The French web admin page was never updated (STR #2963)
- The IPP backend did not retry print jobs when the printer
reported itself as busy or unavailable (STR #2951)
- The "Set Allowed Users" web interface did not handle trailing
whitespace correctly (STR #2956)
- The PostScript filter did not work with Adobe applications
using custom page sizes (STR #2968)
- The Mac OS X USB backend did not work with some printers
that reported a bad 1284 device ID.
- The scheduler incorrectly resolved the client connection
address when HostNameLookups was set to Off (STR #2946)
- The IPP backend incorrectly stopped the local queue if
the remote server reported the "paused" state.
- The cupsGetDests() function did not catch all types of
request errors.
- The scheduler did not always log "job queued" messages
(STR #2943)
- The scheduler did not support destination filtering using
the printer-location attribute properly (STR #2945)
- The scheduler did not send the server-started,
server-restarted, or server-stopped events (STR #2927)
- The scheduler no longer enforces configuration file
permissions on symlinked files (STR #2937)
- CUPS now reinitializes the DNS resolver on failures
(STR #2920)
- The CUPS desktop menu item was broken (STR #2924)
- The PPD parser was too strict about missing keyword
values in "relaxed" mode.
- The PostScript filter incorrectly mirrored landscape
documents.
- The scheduler did not correctly update the
auth-info-required value(s) if the AuthType was Default.
- The scheduler required Kerberos authentication for
all operations on remote Kerberized printers instead
of just for the operations that needed it.
- The socket backend could wait indefinitely for back-
channel data with some devices.
- PJL panel messages were not reset correctly on older
printers (STR #2909)
- cupsfilter used the wrong default path (STR #2908)
- Fixed address matching for "BrowseAddress @IF(name)"
(STR #2910)
- Fixed compiles on AIX.
- Firefox 3 did not work with the CUPS web interface in SSL
mode (STR #2892)
- Custom options with multiple parameters were not emitted
correctly.
- Refined the cupstestppd utility.
- ppdEmit*() did not support custom JCL options (STR #2889)
- The cupstestppd utility incorrectly reported missing
"en" base translations (STR #2887)
CHANGES IN CUPS V1.3.8
- Documentation updates (STR #2785, STR #2861, STR #2862)
- The scheduler did not add the ending job sheet when the
job was released.
- The IPP backend did not relay marker-* attributes.
- The CUPS GNOME/KDE menu item was not localized for
Chinese (STR #2880)
- The CUPS GNOME/KDE menu item was not localized for
Japanese (STR #2876)
- The cupstestppd utility reported mixed line endings for
Mac OS and Windows PPD files (STR #2874)
- The pdftops filter did not print landscape orientation PDF
pages correctly on all printers (STR #2850)
- The scheduler did not handle expiring of implicit classes
or their members properly, leading to a configuration where
one of the members would have a short name (STR #2766)
- The scheduler and cupstestppd utilities did not support
cupsFilter and cupsPreFilter programs with spaces in their
names (STR #2866)
- Removed unused variables and assignments found by the
LLVM "clang" tool.
- Added NULL checks recommended by the LLVM "clang" tool.
- The scheduler would crash if you started a printer that
pointed to a backend that did not exist (STR #2865)
- The ppdLocalize functions incorrectly mapped all generic
locales to country-specific locales.
- The cups-driverd program did not support Simplified Chinese
or Traditional Chinese language version strings (STR #2851)
- Added an Indonesian translation (STR #2792)
- Fixed a timing issue in the backends that could cause data
corruption with the CUPS_SC_CMD_DRAIN_OUTPUT side-channel
command (STR #2858)
- The scheduler did not support "HostNameLookups" with all of
the boolean names (STR #2861)
- Fixed a compile problem with glibc 2.8 (STR #2860)
- The scheduler incorrectly filtered out queues with ACLs and
authentication.
- The PostScript filter did not support %%IncludeFeature lines
in the page setup section of each page (STR #2831)
- The scheduler did not generate printer-state events when the
default printer was changed (STR #2764)
- cupstestppd incorrectly reported a warning about the PPD format
version in some locales (STR #2854)
- cupsGetPPD() and friends incorrectly returned a PPD file for
a class with no printers.
- The member-uris values for local printers in a class returned
by the scheduler did not reflect the connected hostname or
port.
- The CUPS PHP extension was not thread-safe (STR #2828)
- The scheduler incorrectly added the document-format-default
attribute to the list of "common" printer attributes, which
over time would slow down the printing system (STR #2755,
STR #2836)
- The cups-deviced and cups-driverd helper programs did not set
the CFProcessPath environment variable on Mac OS X (STR #2837)
- "lpstat -p" could report the wrong job as printing (STR #2845)
- The scheduler would crash when some cupsd.conf directives
were missing values (STR #2849)
- The web interface "move jobs" operation redirected users to
the wrong URL (STR #2815)
- The Polish web interface translation contained errors
(STR #2815)
- The scheduler did not report PostScript printer PPDs with
filters as PostScript devices.
- The scheduler did not set the job document-format attribute
for jobs submitted using Create-Job and Send-Document.
- cupsFileTell() did not work for log files opened in append
mode (STR #2810)
- The scheduler did not set QUERY_STRING all of the time
for CGI scripts (STR #2781, STR #2816)
- The scheduler now returns an error for bad job-sheets
values (STR #2775)
- Authenticated remote printing did not work over domain
sockets (STR #2750)
- The scheduler incorrectly logged errors for print filters
when a job was canceled (STR #2806, #2808)
- The scheduler no longer allows multiple RSS subscriptions
with the same URI (STR #2789)
- The scheduler now supports Kerberized printing with
multiple server names (STR #2783)
- "Satisfy any" did not work in IPP policies (STR #2782)
- The CUPS imaging library would crash with very large
images - more than 16Mx16M pixels (STR #2805)
- The PNG image loading code would crash with large images
(STR #2790)
- The scheduler did not limit the total number of filters.
- The scheduler now ensures that the RSS directory has
the correct permissions.
- The RSS notifier did not quote the feed URL in the RSS
file it created (STR #2801)
- The web interface allowed the creation and cancellation
of RSS subscriptions without a username (STR #2774)
- Increased the default MaxCopies value on Mac OS X to
9999 to match the limit imposed by the print dialog.
- The scheduler did not reject requests with an empty
Content-Length field (STR #2787)
- The scheduler did not log the current date and time and
did not escape special characters in request URIs when
logging bad requests to the access_log file (STR #2788)
CHANGES IN CUPS V1.3.7
- CVE-2008-0047: cgiCompileSearch buffer overflow (STR #2729)
- CVE-2008-1373: CUPS GIF image filter overflow (STR #2765)
- Updated the "make check" tests to do a more thorough
automated test.
- cups-driverd complained about missing directories (STR
#2777)
- cupsaddsmb would leave the Samba username and password on
disk if no Windows drivers were installed (STR #2779)
- The Linux USB backend used 100% CPU when a printer was
disconnected (STR #2769)
- The sample raster drivers did not properly handle SIGTERM
(STR #2770)
- The scheduler sent notify_post() messages too often on
Mac OS X.
- Kerberos access to the web interface did not work
(STR #2748)
- The scheduler did not support "AuthType Default" in IPP
policies (STR #2749)
- The scheduler did not support the "HideImplicitMembers"
directive as documented (STR #2760)
- "make check" didn't return a non-zero exit code on
error (STR #2758)
- The scheduler incorrectly logged AUTH_foo environment
variables in debug mode (STR #2751)
- The image filters inverted PBM files (STR #2746)
- cupsctl would crash if the scheduler was not running
(STR #2741)
- The scheduler could crash when printing using a port
monitor (STR #2742)
- The scheduler would crash if PAM was broken (STR #2734)
- The image filters did not work with some CMYK JPEG files
produced by Adobe applications (STR #2727)
- The Mac OS X USB backend did not work with printers that
did not report a make or model.
- The job-sheets option was not encoded properly (STR #2715)
- The scheduler incorrectly complained about missing LSB
PPD directories.
CHANGES IN CUPS V1.3.6
- Documentation updates (STR #2646, STR #2647, STR #2649)
- Fixed a problem with the web interface "Use Kerberos
Authentication" check box (STR #2703)
- The scheduler unconditionally overwrote the printer-state-
message with "process-name failed" when a filter or backend
failed, preventing a useful error message from being shown
to the user.
- Policies on CUPS-Move-Job didn't work as expected (STR
#2699)
- The configure script only supported D-BUS on Linux
(STR #2702)
- The scheduler did not support </LimitExcept> (STR #2701)
- The scheduler did not reset the job-hold-until attribute
after a job's hold time was reached.
- The scheduler did not support printer supply attributes
(STR #1307)
- The Kerberos credentials provided by some Windows KDCs
were still too large - now use a dynamic buffer to
support credentials up to 64k in size (STR #2695)
- Printing a test page from the web interface incorrectly
defaulted to the "guest" user (STR #2688)
- The cupsEncodeOptions2() function did not parse multiple-
value attribute values properly (STR #2690)
- The scheduler incorrectly sent printer-stopped events for
status updates from the print filters (STR #2680)
- The IPP backend could crash when handling printer errors
(STR #2667)
- Multi-file jobs did not print to remote CUPS servers
(STR #2673)
- The scheduler did not provide the Apple language ID to
job filters.
- Kerberos authentication did not work with the web
interface (STR #2606, STR #2669)
- The requesing-user-name-allowed and -denied functionality
did not work for Kerberos-authenticated usernames (STR
#2670)
- CUPS didn't compile on HP-UX 11i (STR #2679)
- cupsEncodeOptions2() did not handle option values like
"What's up, doc?" properly.
- Added lots of memory allocation checks (Fortify)
- The scheduler would crash if it was unable to add a job
file (Fortify)
- ppdOpen*() did not check all memory allocations (Coverity)
- ippReadIO() did not check all memory allocations (Coverity)
- The PostScript filter did not detect read errors (Coverity)
- The scheduler did not check for a missing job-sheets-completed
attribute when sending an event notification (Coverity)
- "Set Printer Options" might not work with raw queues (Coverity)
- cupsRasterInterpretPPD() could crash on certain PostScript
errors (Coverity)
- The USB backend did not check for back-channel support
properly on all systems (Coverity)
- Fixed memory leaks in the GIF and PNM image loading code
(Coverity)
- Removed some dead code in the CUPS API and scheduler (Coverity)
- Fixed two overflow bugs in the HP-GL/2 filter (Coverity)
- Fixed another ASN1 string parsing bug (STR #2665)
- The RSS notifier directory was not installed with the
correct permissions.
- The standard CUPS backends could use 100% CPU while waiting
for print data (STR #2664)
- Filename-based MIME rules did not work (STR #2659)
- The cups-polld program did not exit if the scheduler crashed
(STR #2640)
- The scheduler would crash if you tried to set the port-monitor
on a raw queue (STR #2639)
- The scheduler could crash if a polled remote printer was
converted to a class (STR #2656)
- The web interface and cupsctl did not correctly reflect
the "allow printing from the Internet" state (STR #2650)
- The scheduler incorrectly treated MIME types as case-
sensitive (STR #2657)
- The Java support classes did not send UTF-8 strings to
the scheduler (STR #2651)
- The CGI code did not handle interrupted POST requests
properly (STR #2652)
- The PostScript filter incorrectly handled number-up when
the number of pages was evenly divisible by the number-up
value.
- The PDF filter incorrectly filtered pages when page-ranges
and number-up were both specified (STR #2643)
- The IPP backend did not handle printing of pictwps files
to a non-Mac CUPS server properly.
- The scheduler did not detect network interface changes
on operating systems other than Mac OS X (STR #2631)
- The scheduler now logs the UNIX error message when it
is unable to create a request file such as a print job.
- Added support for --enable-pie on Mac OS X.
CHANGES IN CUPS V1.3.5
- The SNMP backend did not check for negative string
lengths (STR #2589)
- The scheduler incorrectly removed auth-info attributes,
potentially leading to a loss of all options for a job.
- The scheduler stopped sending CUPS browse packets on a
restart when using fixed addresses (STR #2618)
- Fixed PDF filter security issues (CVE-2007-4352
CVE-2007-5392 CVE-2007-5393)
- Changing settings would always change the DefaultAuthType
and Allow lines (STR #2580)
- The scheduler would crash when submitting an undefined
format file from Samba with LogLevel debug2 (STR #2600)
- The scheduler did not use poll() when epoll() was not
supported by the running kernel (STR #2582)
- Fixed a compile problem with Heimdal Kerberos (STR #2592)
- The USB backend now retries connections to a printer
indefinitely rather than stopping the queue.
- Printers with untranslated JCL options were not exported
to Samba correctly (STR #2570)
- The USB backend did not work with some Minolta USB
printers (STR #2604)
- The strcasecmp() emulation code did not compile (STR
#2612)
- The scheduler would crash if a job was sent to an empty
class (STR #2605)
- The lpc command did not work in non-UTF-8 locales (STR
#2595)
- Subscriptions for printer-stopped events also received
other state changes (STR #2572)
- cupstestppd incorrectly reported translation errors for
the "en" locale.
- ppdOpen() did not handle custom options properly when the
Custom attribute appeared before the OpenUI for that
option.
- The scheduler could crash when deleting a printer or
listing old jobs.
- The Mac OS X USB backend did not allow for requeuing of
jobs submitted to a class.
- lpmove didn't accept a job ID by itself.
- The scheduler incorrectly removed job history information
for remote print jobs.
- The scheduler incorrectly sent the
"com.apple.printerListChanged" message for printer state
changes.
- The PostScript filter drew the page borders (when enabled)
outside the imageable area.
- The LPD and IPP backends did not default to the correct
port numbers when using alternate scheme names.
- The scheduler incorrectly deleted hardwired remote
printers on system sleep.
- The scheduler would abort if a bad browse protocol name
was listed in the cupsd.conf file.
- The online cupsd.conf help file incorrectly showed
"dns-sd" instead of "dnssd" for Bonjour sharing.
- The scheduler could crash changing the port-monitor value.
- The scheduler generated CoreFoundation errors when run as
a background process.
- When printing with number-up > 1, it was possible to get
an extra blank page.
CHANGES IN CUPS V1.3.4
- Documentation updates (STR #2560, STR #2563, STR #2569)
- CUPS now maps the "nb" locale to "no" on all platforms
(STR #2575)
- CUPS did not work with a Windows 2003 R2 KDC (STR #2568)
- ippReadIO() could read past the end of a buffer (STR
#2561)
- The scheduler would crash on shutdown if it was unable
to create a Kerberos context.
- Multiple AuthTypes in cupsd.conf did not work (STR
#2545)
- The snmp.conf file referenced the wrong man page (STR
#2564)
- The cupsaddsmb program didn't handle domain sockets
properly (STR #2556)
- The scheduler now validates device URIs when adding
printers.
- Updated httpSeparateURI() to support hostnames with
the backslash character.
- Updated the Japanese localization (STR #2546)
- The parallel backend now gets the current IEEE-1284
device ID string on Linux (STR #2553)
- The IPP backend now checks the job status at
variable intervals (from 1 to 10 seconds) instead
of every 10 seconds for faster remote printing
(STR #2548)
- "lpr -p" and "lpr -l" did not work (STR #2544)
- Compilation failed when a previous version of CUPS
was installed and was included in the SSL include
path (STR #2538)
- The scheduler did not reject requests with charsets
other than US-ASCII or UTF-8, and the CUPS API
incorrectly passed the locale charset to the scheduler
instead of UTF-8 (STR #2537)
- cups-deviced did not filter out duplicate devices.
- The AppleTalk backend incorrectly added a scheme
listing when AppleTalk was disabled or no printers
were found.
- The PostScript filter generated N^2 copies when the
printer supported collated copies and user requested
reverse-order output.
- The scheduler did not reprint all of the files in a
job that was held.
- The scheduler did not update the printcap file after
removing stale remote queues.
- The cupsd.conf man page incorrectly referenced
"AuthType Kerberos" instead of "AuthType Negotiate".
CHANGES IN CUPS V1.3.3
- The scheduler did not use the attributes-natural-language
attribute when passing the LANG environment variable to
cups-deviced or cups-driverd.
- The scheduler did not use the printer-op-policy when
modifying classes or printers (STR #2525)
- The auth-info-required attribute was not always updated
for remote queues that required authentication.
- The German web interface localization contained errors
(STR #2523)
- The Swedish localization contained errors (STR #2522)
CHANGES IN CUPS V1.3.2
- The 1.3.1 release was incorrectly created from the
1.4.x source tree (STR #2519)
- Added support for 32/64-bit libraries on HP-UX
(STR #2520)
- The scheduler incorrectly used portrait as the default
orientation (STR #2513)
- The scheduler no longer writes the printcap file for
every remote printer update (STR #2512)
- Remote raw printing with multiple copies did not work
(STR #2518)
- Updated the configure script to require at least autoconf
2.60 (STR #2515)
- Some gzip'd PPD files were not read in their entirety
(STR #2510)
CHANGES IN CUPS V1.3.1
- Documentation updates.
- The USB backend on Mac OS X could hang if the driver and
printer did not match.
- Delegated Kerberos credentials were not working.
- "make distclean" incorrectly removed the edit-config.tmpl
files (STR #2508)
- Fix compile problem on HP-UX (STR #2501)
- The cupstestppd utility now tests for resolutions greater
than 99999 DPI to detect a missing "x" between the X and Y
resolutions.
- Fixed many problems in the various translations and added
a new "checkpo" utility to validate them.
- The cupstestppd utility now tests the custom page size code
for CUPS raster drivers.
- cupsLangDefault() did not attempt to return a language that
was supported by the calling application.
- If a remote printer stopped while a job was being sent, the
local queue would also get stopped and the job re-queued,
resulting in duplicate prints in some cases.
- A few Apple-specific job options needed to be omitted when
printing a banner page.
- The new peer credential support did not compile on FreeBSD
(STR #2495)
- Direct links to help files did not set the current section
so the table-of-contents was not shown.
- The configure script did not support --localedir=foo (STR #2488)
- The backends were not displaying their localized messages.
- CUPS-Authenticate-Job did not require Kerberos authentication
on queues protected by Kerberos.
- The Zebra ZPL driver did not work with Brady label printers
(STR #2487)
- Norwegian wasn't localized on Mac OS X.
- getnameinfo() returns an error on some systems when DNS is
not available, leading to numerous problems (STR #2486)
- The cupsfilter command did not work properly on Mac OS X.
- The scheduler makefile contained a typo (STR #2483)
- The TBCP and BCP port monitors did not handle the trailing
CTRL-D in some PostScript output properly.
- Fixed the localization instructions and German template for
the "Find New Printers" button (STR #2478)
- The web interface did not work with the Chinese localization
(STR #2477)
- The web interface home page did not work for languages that
were only partially localized (STR #2472)
- Updated the Spanish web interface localization (STR #2473)
- ppdLocalize() did not work for country-specific localizations.
CHANGES IN CUPS V1.3.0
- The scheduler did not handle out-of-file conditions
gracefully when accepting new connections, leading to
heavy CPU usage.
- The scheduler did not detect ServerBin misconfigurations
(STR #2470)
- "AuthType Default" did not work as expected when the
"DefaultAuthType foo" line appeared after it in the
cupsd.conf file.
- The on-line help did not describe many common printing
options (STR #1846)
- The IPP backend did not return the "auth required" status
when printing to a Kerberos-protected queue.
- The scheduler was not looking in the correct directories
for LSB PPD files (STR #2464)
- Changed references to ESP Ghostscript to GPL Ghostscript
(STR #2463)
- The PostScript filter did not cleanly terminate when
the job was canceled or stopped.
- Fixed generation of Kerberos credentials for remote
printing. Note that this requires a recent version of
MIT Kerberos with a working krb5_cc_new_unique()
function or Heimdal Kerberos.
- Added Portuguese and updated Italian message catalogs.
CHANGES IN CUPS V1.3rc2
- Added more range checking to the pdftops filter.
- The scheduler would crash if a remote IPP queue was stopped
(STR #2460)
- The scheduler did not allow "DefaultAuthType None".
CHANGES IN CUPS V1.3rc1
- Updated the German localization (STR #2443)
- cupsAdminGetServerSettings() did not handle </Foo> properly.
- When lprm and cancel are run with no job ID, they now will
cancel the first stopped job if no pending or processing
jobs are left in the queue.
- The scheduler now logs successful print jobs, filter
failures, and the job file types at the default log
level (STR #2458)
- The scheduler now logs the usernames it is using for
authorization at LogLevel debug instead of debug2 (STR #2448)
- Added Intellitech Intellibar and Zebra CPCL PPDs to the list
of installed PPDs.
- Added 6" and 8" wide label sizes for the Zebra ZPL Label
Printer driver (STR #2442)
- The cupsaddsmb program and web interface now support
exporting of 64-bit Windows drivers, when available
(STR #2439)
- Moving a job that was printing did not stop the job on the
original printer (STR #2262)
- The cups-lpd mini-daemon did not work on Mac OS X server.
- Added httpGetAuthString() and httpSetAuthString() APIs to get
and set the current (cached) authorization string to use for
HTTP requests.
- Updated the default cupsd.conf policy to list the
"administrative" operations separately from the "printer
control" operations so that it is easier to define a
group of users that are "printer operators".
- The web interface now pulls the default cupsd.conf file
from cupsd.conf.default in the CUPS config directory.
- Added a help file for using Kerberos with CUPS.
- The scheduler now strips the "@KDC" portion of Kerberos
usernames since those usernames typically do not appear in
the group membership lists used by CUPS.
- cupsMarkOptions() could (incorrectly) leave multiple option
choices marked.
- Backends could (incorrectly) run as root during discovery
(STR #2454)
- Avahi is now supported for DNS-SD (Bonjour) printer sharing
(STR #2455)
- The default cupsd.conf file had typos and old operation names
(STR #2450)
- The scheduler now erases authentication cache files using the
7-pass US DoD algorithm.
- Delegated Kerberos credentials (proxy authentication) did not
work.
- The filter makefile did not optimize the libcupsimage.2.dylib
with a sectorder file.
- The IPP backend incorrectly wrote an empty printer message
when processing the "none" state reason.
- The USB backend could deadlock on Mac OS X while performing
a side-channel command.
- The scheduler did not prevent remote queues from being
shared/published.
- The scheduler did not remove the temporary request file on
authentication errors.
- ppdLocalizeIPPReason() did not handle "scheme:" schemes or
"file" URLs.
- ppdLocalizeIPPReason() was not exported on Mac OS X.
CHANGES IN CUPS V1.3b1
- Copyright updates - CUPS is now owned by Apple Inc.
- Documentation updates (STR #1775, STR #2027, STR #2130,
STR #2131, STR #2263, STR #2356, STR #2397)
- Added new cupsfilter utility (STR #1734)
- Added new job-printer-state-message and
job-printer-state-reasons attributes to jobs (STR #2418)
- Added LDAP+SSL support (STR #1967)
- CUPS now supports authentication via peer credentials
over domain sockets (STR #2242, STR #2277)
- The CUPS sample driver PPDs are now generated by the PPD
compiler and include all of the localized languages by
default (STR #2164)
- You can now specify "AuthType Default" in the cupsd.conf
file to use the default authentication defined by the
DefaultAuthType directive.
- The SNMP backend no longer adds a default Address line
when none is specified in the snmp.conf file; this allows
the backend to be easily disabled as needed (STR #2434)
- Added a new cupsctl command for doing basic changes to
the cupsd.conf file (STR #1777)
- Added a new ppdLocalizeIPPReason() function to get the
localized text/URI for a given IPP reason keyword for a
driver.
- Removed the deskjet2.ppd driver, as it only worked with
a very small subset of HP DeskJet printers and was
confusing to users. The rastertohp driver still
supports the deskjet2.ppd options for existing queues.
- The scheduler did not add a trailing banner page if a
client did not specify the last document in a job (STR
#1711)
- The scheduler did not report Bonjour shared printers as
remote printers (STR #2384)
- Added new -R and -W options to the cupstestppd program
for greater control over the testing of PPDs.
- Added a new cupsGetServerPPD() function for getting
an available PPD from the server (STR #2334)
- Added a new cupsDoIORequest() function for reading
and writing files via IPP requests (STR #2334)
- Added a new CUPS_GET_PPD operation for getting an
available PPD file on the server (STR #2334)
- CUPS_GET_PPDS now reports multiple ppd-product values
based on the PPD ModelName and Product strings (STR
#2334, STR #2383)
- CUPS_GET_PPDS now reports the PSVersion attributes
from a PPD file in the ppd-psversion attribute
(STR #2334)
- CUPS_GET_PPDS now reports the cupsModelNumber attribute
from a PPD file in the ppd-model-number attribute (STR
#2383)
- CUPS_GET_PPDS now reports a driver type string in the
ppd-type attribute based on the cupsFax and cupsFilter
attributes in a PPD file (STR #2383)
- Added a new printer attribute called "cups-version"
which reports the version of CUPS that is running
(STR #2240)
- backendRunLoop() now aborts immediately on SIGTERM
if no data has been written yet (STR #2103)
- Due to poor IPP support from the vendors, the SNMP
backend no longer tries IPP connections; instead,
it now uses a lookup file with fallback to port 9100
(socket://address) and 515 (lpd://address) printing
(STR #2035, STR #2354)
- The scheduler now recreates the CUPS log directory as
needed (STR #2353)
- cupsLangDefault() now maps new-style Apple locale names
to the traditional ll_CC form (STR #2357)
- Add new cupsArrayNew2() API to support hashed lookups
of array elements (STR #2358)
- ppdConflicts() optimizations (STR #2358)
- The cupstestppd program now tests for existing filters,
icons, profiles, and dialog extensions (STR #2326)
- The web interface no longer lists new printers on the
main administration page. Instead, a new "List Available
Printers" button is provided that shows a separate page
with the list of printers.
- The web interface now supports setting the banner and
policy options on raw printers and classes (STR #2238)
- The socket backend now reads any pending back-channel
data before shutting down the socket (STR #2325)
- Added a new ErrorPolicy directive in the cupsd.conf
file (STR #1871)
- Printers that use JCL options are now exported to Samba
correctly (STR #1985)
- The IPP backend now relays printer-state-message values
from the server to the client (STR #2109)
- Added support for the PWG printer-alert and
printer-alert-description attributes (STR #2088)
- Added support for LPD "stream" mode (STR #2036)
- The scheduler now reports the PostScript product string
from PPD files in CUPS-Get-PPDs responses (STR #1900)
- Raw printing with queues pointing to the file pseudo-
device and multiple files and/or banners now works (STR
#1933)
- Added new public cupsAdminGetServerSettings() and
cupsAdminSetServerSettings() APIs.
- Added new "makebuttons" script in the "tools" directory
for creating web interface buttons (STR #2231)
- Added support for DNS-SD (aka "Bonjour") printer sharing
(STR #1171)
- Job operations (cancel, hold, release, etc.) from the
web interface now return back to the original page (STR
#2239)
- The classes or printers list is now shown after a
successful deletion from the web interface (STR #1999)
- The default configuration now allows browse packets from
any address (STR #2008)
- The web interface now provides an "allow printing from the
Internet" check box (STR #1897)
- The notify-events-default and
notify-lease-duration-default attributes can now be set
(STR #1671)
- Server-side default options are now sent to clients when
the "printer-defaults" attribute group is requested (STR
#1923)
- Added support for Linux "relro" linker option (STR #1614)
- CUPS now validates the number-up option value (STR #1329)
- The on-line help now provides better search capabilities
(STR #1701)
- The web interface "Add This Printer" button now allows you
to change the printer name, description, and location
(STR #1646)
- Added support for Mac OS X authorization services
(STR #2206)
- Added support for driver-specific pre-filters (STR #2108)
- Added a new side-channel API for drivers and backends
for basic device control and information queries (STR
#1898)
- The scheduler now uses poll(), epoll(), or /dev/kqueue
instead of select() when possible (STR #1261)
- Added new cupsArrayGetIndex() and cupsArrayGetInsert()
functions to get the current index and insertion
positions of an array.
- Added a new --with-max-copies configure option (STR
#2090)
- Added new cupsRemoveDest() and cupsSetDefaultDest()
functions.
- Added support for cupsPJLCharset attribute in PPD files
which specifies the character set that is used in PJL
strings (STR #1969)
- Moved the definition of the (private) _http_s structure
to http-private.h; code that directly accesses the
http_t members will no longer compile!
- Added support for setting the document-format-default
attribute on a per-printer basis.
- Added support for IntelliBar label printers.
+601 -297
Ver Arquivo
@@ -1,315 +1,619 @@
CHANGES.txt - 2007-09-18
CHANGES.txt - 2010-03-30
------------------------
CHANGES IN CUPS V1.3.2
CHANGES IN CUPS V1.4.3
- The 1.3.1 release was incorrectly created from the
1.4.x source tree (STR #2519)
- Added support for 32/64-bit libraries on HP-UX
(STR #2520)
- The scheduler incorrectly used portrait as the default
orientation (STR #2513)
- The scheduler no longer writes the printcap file for
every remote printer update (STR #2512)
- Remote raw printing with multiple copies did not work
(STR #2518)
- Updated the configure script to require at least autoconf
2.60 (STR #2515)
- Some gzip'd PPD files were not read in their entirety
(STR #2510)
- SECURITY: The scheduler could try responding on a closed client
connection, leading to a crash (STR #3200)
- SECURITY: The lppasswd program allowed the localization files to be
overridden when running in setuid mode (STR #3482)
- Localization updates (STR #3352, STR #3409, STR #3422, STR #3452,
STR #3473, STR #3502)
- Documentation updates (STR #3451, STR #3504)
- The IPP backend now sets the printer-state-message to "Ready to
print." at the end of a successful job (STR #3460)
- The PPD compiler did not correctly add the manufacturer to the output
filename when using the "-m" option (STR #3469)
- The IPP backend did not handle authentication properly for the Get-
Printer-Attributes operation (STR 3458)
- Getting SNMP values larger than 127 bytes did not work.
- IPP conformance: Get-Jobs has a default value for requested-attributes
(STR #3383)
- cupsPrintFiles() did not report all errors (STR #3449)
- cupsAddDest() could read freed memory (STR #3448)
- The DBUS notifier did not build (STR #3447)
- The scheduler would crash when an active printer was deleted.
- The snmp backend did not work with some printers (STR #3413)
- The web interface did not show the conflicting values when setting
options (STR #3440)
- Setting options in the web interface did not always work (STR #3439)
- The scheduler did not use the Get-Job-Attributes policy for a printer
(STR #3431)
- The scheduler added two job-name attributes to each job object
(STR #3428)
- CSS files would not print (STR #3442)
- The scheduler did not clean out completed jobs when PreserveJobHistory
was turned off (STR #3425)
- The web interface did not show completed jobs for a printer
(STR #3436)
- Authenticated printing did not always work when printing directly to
a remote server (STR #3435)
- The USB backend did not work on Solaris (STR #3423)
- cupstestppd didn't catch problems with JobPatchFile definitions
(STR #3421)
- The socket backend could crash if a SNMP string had a negative length.
- Fixed some termination issues with the USB backend on Mac OS X.
- The side-channel APIs did not handle interrupts properly.
- The network backends incorrectly cleared the media-empty-warning
state.
- The web interface did not allow users to successfully add serial
printers (STR #3391)
- cupsTempFd() did not work in some situations (STR #3382)
- Some C API headers were missing C++ wrapper logic.
- The PPD compiler did not localize single-language PPD options properly
(STR #3386)
- Modifying a printer from the web interface sometimes caused the wrong
driver to be selected (STR #3418)
- The scheduler did not handle out-of-memory conditions properly when
loading a job (STR #3407)
- When adding printers from the web interface, the dynamic updates of
the device list made it hard to pick a device (STR #3406)
- Fixed a typo in the web interface admin page template (STR 3403)
- The web interface did not preserve the "printer is shared" state when
modifying a printer (STR #3390)
- The PPD compiler incorrectly inserted translations of empty strings
(STR #3411)
- The scheduler did not reset the SIGPIPE handler of child processes
(STR #3399)
- cupsGetNamedDest() incorrectly returned the default printer if the
named printer did not exist (STR #3397)
- Fixed a GNU TLS error handling bug (STR #3381)
CHANGES IN CUPS V1.3.1
CHANGES IN CUPS V1.4.2
- Documentation updates.
- The USB backend on Mac OS X could hang if the driver and
printer did not match.
- Delegated Kerberos credentials were not working.
- "make distclean" incorrectly removed the edit-config.tmpl
files (STR #2508)
- Fix compile problem on HP-UX (STR #2501)
- The cupstestppd utility now tests for resolutions greater
than 99999 DPI to detect a missing "x" between the X and Y
resolutions.
- Fixed many problems in the various translations and added
a new "checkpo" utility to validate them.
- The cupstestppd utility now tests the custom page size code
for CUPS raster drivers.
- cupsLangDefault() did not attempt to return a language that
was supported by the calling application.
- If a remote printer stopped while a job was being sent, the
local queue would also get stopped and the job re-queued,
resulting in duplicate prints in some cases.
- A few Apple-specific job options needed to be omitted when
printing a banner page.
- The new peer credential support did not compile on FreeBSD
(STR #2495)
- Direct links to help files did not set the current section
so the table-of-contents was not shown.
- The configure script did not support --localedir=foo (STR #2488)
- The backends were not displaying their localized messages.
- CUPS-Authenticate-Job did not require Kerberos authentication
on queues protected by Kerberos.
- The Zebra ZPL driver did not work with Brady label printers
(STR #2487)
- Norwegian wasn't localized on Mac OS X.
- getnameinfo() returns an error on some systems when DNS is
not available, leading to numerous problems (STR #2486)
- The cupsfilter command did not work properly on Mac OS X.
- The scheduler makefile contained a typo (STR #2483)
- The TBCP and BCP port monitors did not handle the trailing
CTRL-D in some PostScript output properly.
- Fixed the localization instructions and German template for
the "Find New Printers" button (STR #2478)
- The web interface did not work with the Chinese localization
(STR #2477)
- The web interface home page did not work for languages that
were only partially localized (STR #2472)
- Updated the Spanish web interface localization (STR #2473)
- ppdLocalize() did not work for country-specific localizations.
- SECURITY: The CUPS web interface was vulnerable to several XSS and
HTTP header/body attacks via attribute injection (STR #3367,
STR #3401)
- Fixed localization errors (STR #3359, STR #3372, STR #3380, STR #3387)
- The documentation for classes.conf and printers.conf did not provide
the correct instructions for manual changes (STR #3351)
- The scheduler did not always rebuild printer cache files when the
driver was changed (STR #3356)
- The documentation makefile failed to install localizations when using
newer versions of Bash (STR #3360)
- The configure script did not use the --with-xinetd value for the
default LPD configuration path (STR #3347)
- The configure script incorrectly required glib for DBUS support
(STR #3346)
- The cupstestppd program incorrectly reported filters with bad
permisssions as missing (STR #3363)
- The cups.desktop file used the wrong locale names (STR #3358)
- cupsSideChannelRead() did not return an error for short reads.
- The installed PAM configuration file did not use the correct options
with the pam_unix2 module (STR #3313)
- The scheduler did not preserve default options that contained special
characters (STR #3340)
- The scheduler did not remove old pre-filters when updating a printer
driver (STR #3342)
- The HP/GL-2 filter did not check for early end-of-file (STR #3319)
- The USB backend did not compile on some platforms (STR #3332)
- cupsSideChannelSNMPWalk() could go into an infinite loop with broken
SNMP implementations.
CHANGES IN CUPS V1.3.0
CHANGES IN CUPS V1.4.1
- The scheduler did not handle out-of-file conditions
gracefully when accepting new connections, leading to
heavy CPU usage.
- The scheduler did not detect ServerBin misconfigurations
(STR #2470)
- "AuthType Default" did not work as expected when the
"DefaultAuthType foo" line appeared after it in the
cupsd.conf file.
- The on-line help did not describe many common printing
options (STR #1846)
- The IPP backend did not return the "auth required" status
when printing to a Kerberos-protected queue.
- The scheduler was not looking in the correct directories
for LSB PPD files (STR #2464)
- Changed references to ESP Ghostscript to GPL Ghostscript
(STR #2463)
- The PostScript filter did not cleanly terminate when
the job was canceled or stopped.
- Fixed generation of Kerberos credentials for remote
printing. Note that this requires a recent version of
MIT Kerberos with a working krb5_cc_new_unique()
function or Heimdal Kerberos.
- Added Portuguese and updated Italian message catalogs.
- Documention fixes (STR #3296)
- SNMP supply levels and states were wrong for some printers.
- The IPP backend did not update the auth-info-required value.
- The libusb-based USB backend would hang at the end of the job
(STR #3315, STR #3318)
- DNS-SD registrations for raw queues had an empty "ty" key (STR #3299)
- The JPEG and BMP MIME type rules were broken (STR #3284)
- cupsGetNamedDest returned the default printer when the named
destination did not exist (STR #3285)
- The JobKillDelay was not triggered for canceled jobs (STR #3292)
- The PPD compiler could get in an infinite loop (STR #3293)
- The configure check for dns-sd.h was broken (STR #3297)
- The "Query Printer for Default Options" page did not go away if the
query job was held (STR #3302)
- Boolean options did not show up as selected in the web interface
(STR #3303)
- The scheduler did not cache or report driver information files
correctly, leading to a variety of issues (STR #3283, STR #3297,
STR #3305)
- cupsDoIORequest() did not abort on permanent errors (STR #3311)
- Modifying a class in the web interface did not work (STR #3312)
- BrowseLocalProtocols could be cleared when changing the sharing
setting (STR #3287)
- The scheduler could return an empty supported document format
(STR #3308)
- The PPD compiler generated invalid PPD files when the locale used
something other than "." for the decimal point (STR #3300)
- The IPP backend did not handle some non-comforming IPP printer
implementations (STR #3262)
- The scheduler leaked three file descriptors to each job filter
(STR #3263)
- The scheduler now uses a default CUPS-Get-Devices timeout of 15
seconds (STR #3307)
CHANGES IN CUPS V1.3rc2
CHANGES IN CUPS V1.4.0
- Added more range checking to the pdftops filter.
- The scheduler would crash if a remote IPP queue was stopped
(STR #2460)
- The scheduler did not allow "DefaultAuthType None".
- Localization updates (STR #3223, STR #3246, STR #3248, STR #3250)
- Documentation updates (STR #3225, STR #3230, STR #3242, STR #3260)
- The --with-pdftops configure option did not accept a full path to the
filter (STR #3278)
- The banner filter did not position the back side image correctly
(STR #3277)
- The dnssd backend could crash (STR #3272)
- The 1284 device ID sometimes contained trailing garbage (STR #3266)
- The USB backend returned different URIs for some printers than in
CUPS 1.3 (STR #3259)
- The scheduler did not do local job-hold-until processing for remote
queues (STR #3258)
- The scheduler did not try all possible SSL certificates on Mac OS X.
- The scheduler did not always remove a file descriptor when using the
kqueue interface (STR #3256)
- The scheduler did not protect against bad job control files in all
cases (STR #3253)
- The scheduler did not encode "+" in model names (STR #3254)
- The web interface didn't show the default options (STR #3244)
- The IPP and LPD backends needed print data before they would do an
SNMP query.
- Fixed a GNU TLS compatibility issue (STR #3231)
- Fixed a HTML error in the add and modify printer web interface
templates (STR #3229)
- The scheduler did not minimize the number of printer state events that
were generated by filter STATE: messages, which could lead to poor
performance.
- The USB backend on Mac OS X did not cleanly cancel a job.
- The network backends now set the connecting-to-device printer-state-
reasons value when looking up the address and copying the print data
for consistency.
- The scheduler now supports the com.apple.print.recoverable-warning
reason on all platforms.
CHANGES IN CUPS V1.3rc1
CHANGES IN CUPS V1.4rc1
- Updated the German localization (STR #2443)
- cupsAdminGetServerSettings() did not handle </Foo> properly.
- When lprm and cancel are run with no job ID, they now will
cancel the first stopped job if no pending or processing
jobs are left in the queue.
- The scheduler now logs successful print jobs, filter
failures, and the job file types at the default log
level (STR #2458)
- The scheduler now logs the usernames it is using for
authorization at LogLevel debug instead of debug2 (STR #2448)
- Added Intellitech Intellibar and Zebra CPCL PPDs to the list
of installed PPDs.
- Added 6" and 8" wide label sizes for the Zebra ZPL Label
Printer driver (STR #2442)
- The cupsaddsmb program and web interface now support
exporting of 64-bit Windows drivers, when available
(STR #2439)
- Moving a job that was printing did not stop the job on the
original printer (STR #2262)
- The cups-lpd mini-daemon did not work on Mac OS X server.
- Added httpGetAuthString() and httpSetAuthString() APIs to get
and set the current (cached) authorization string to use for
HTTP requests.
- Updated the default cupsd.conf policy to list the
"administrative" operations separately from the "printer
control" operations so that it is easier to define a
group of users that are "printer operators".
- The web interface now pulls the default cupsd.conf file
from cupsd.conf.default in the CUPS config directory.
- Added a help file for using Kerberos with CUPS.
- The scheduler now strips the "@KDC" portion of Kerberos
usernames since those usernames typically do not appear in
the group membership lists used by CUPS.
- cupsMarkOptions() could (incorrectly) leave multiple option
choices marked.
- Backends could (incorrectly) run as root during discovery
(STR #2454)
- Avahi is now supported for DNS-SD (Bonjour) printer sharing
(STR #2455)
- The default cupsd.conf file had typos and old operation names
(STR #2450)
- The scheduler now erases authentication cache files using the
7-pass US DoD algorithm.
- Delegated Kerberos credentials (proxy authentication) did not
work.
- The filter makefile did not optimize the libcupsimage.2.dylib
with a sectorder file.
- The IPP backend incorrectly wrote an empty printer message
when processing the "none" state reason.
- The USB backend could deadlock on Mac OS X while performing
a side-channel command.
- The scheduler did not prevent remote queues from being
shared/published.
- The scheduler did not remove the temporary request file on
authentication errors.
- ppdLocalizeIPPReason() did not handle "scheme:" schemes or
"file" URLs.
- ppdLocalizeIPPReason() was not exported on Mac OS X.
- The PPD compiler documentation was missing information on localization
(STR #3212)
- The IPP backend now reconnects after every request when talking to
printers that claim IPP support but only use HTTP/1.0.
- The PPD compiler crashed when both "Resolution" and "Group foo Option
Resolution" were specified in the .drv file.
- The PPD compiler's #if/#elif/#else/#endif did not work for undefined
variables (STR #3210)
- Static libraries could not be installed by a non-root user on systems
needing a ranlib program (STR #3209)
- The scheduler incorrectly always tried to copy Kerberos credentials
for print jobs.
- Updated the Spanish localization (STR #3204)
- The scheduler crashed when getting the default paper size from
libpaper (STR #3205, STR #3206)
- The PPD compiler now defines six variables: CUPS_VERSION,
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, CUPS_VERSION_PATCH,
PLATFORM_NAME, and PLATFORM_ARCH (STR #3203)
- Fixed a whitespace skipping bug in cupsRasterInterpretPPD.
- The scheduler did not return HTTP 403 (Forbidden) for authenticated
users that were not authorized to do IPP operations (STR #3193)
- The scheduler did not report more than 8 Product strings from a PPD
file. Some PPD files have as many as 24.
- ppdOpen*() could crash if a keyword had no value string (something
that cupstestppd looks for...)
- cupsLangDefault() did not return the correct language on Mac OS X.
- The Mac OS X USB backend did not handle aborted or stalled pipe
conditions properly, which prevented drivers from ejecting partial
pages when a job was canceled or held.
CHANGES IN CUPS V1.3b1
CHANGES IN CUPS V1.4b3
- Copyright updates - CUPS is now owned by Apple Inc.
- Documentation updates (STR #1775, STR #2027, STR #2130,
STR #2131, STR #2263, STR #2356, STR #2397)
- Added new cupsfilter utility (STR #1734)
- Added new job-printer-state-message and
job-printer-state-reasons attributes to jobs (STR #2418)
- Added LDAP+SSL support (STR #1967)
- CUPS now supports authentication via peer credentials
over domain sockets (STR #2242, STR #2277)
- The CUPS sample driver PPDs are now generated by the PPD
compiler and include all of the localized languages by
default (STR #2164)
- You can now specify "AuthType Default" in the cupsd.conf
file to use the default authentication defined by the
DefaultAuthType directive.
- The SNMP backend no longer adds a default Address line
when none is specified in the snmp.conf file; this allows
the backend to be easily disabled as needed (STR #2434)
- Added a new cupsctl command for doing basic changes to
the cupsd.conf file (STR #1777)
- Added a new ppdLocalizeIPPReason() function to get the
localized text/URI for a given IPP reason keyword for a
driver.
- Removed the deskjet2.ppd driver, as it only worked with
a very small subset of HP DeskJet printers and was
confusing to users. The rastertohp driver still
supports the deskjet2.ppd options for existing queues.
- The scheduler did not add a trailing banner page if a
client did not specify the last document in a job (STR
#1711)
- The scheduler did not report Bonjour shared printers as
remote printers (STR #2384)
- Added new -R and -W options to the cupstestppd program
for greater control over the testing of PPDs.
- Added a new cupsGetServerPPD() function for getting
an available PPD from the server (STR #2334)
- Added a new cupsDoIORequest() function for reading
and writing files via IPP requests (STR #2334)
- Added a new CUPS_GET_PPD operation for getting an
available PPD file on the server (STR #2334)
- CUPS_GET_PPDS now reports multiple ppd-product values
based on the PPD ModelName and Product strings (STR
#2334, STR #2383)
- CUPS_GET_PPDS now reports the PSVersion attributes
from a PPD file in the ppd-psversion attribute
(STR #2334)
- CUPS_GET_PPDS now reports the cupsModelNumber attribute
from a PPD file in the ppd-model-number attribute (STR
#2383)
- CUPS_GET_PPDS now reports a driver type string in the
ppd-type attribute based on the cupsFax and cupsFilter
attributes in a PPD file (STR #2383)
- Added a new printer attribute called "cups-version"
which reports the version of CUPS that is running
(STR #2240)
- backendRunLoop() now aborts immediately on SIGTERM
if no data has been written yet (STR #2103)
- Due to poor IPP support from the vendors, the SNMP
backend no longer tries IPP connections; instead,
it now uses a lookup file with fallback to port 9100
(socket://address) and 515 (lpd://address) printing
(STR #2035, STR #2354)
- The scheduler now recreates the CUPS log directory as
needed (STR #2353)
- cupsLangDefault() now maps new-style Apple locale names
to the traditional ll_CC form (STR #2357)
- Add new cupsArrayNew2() API to support hashed lookups
of array elements (STR #2358)
- ppdConflicts() optimizations (STR #2358)
- The cupstestppd program now tests for existing filters,
icons, profiles, and dialog extensions (STR #2326)
- The web interface no longer lists new printers on the
main administration page. Instead, a new "List Available
Printers" button is provided that shows a separate page
with the list of printers.
- The web interface now supports setting the banner and
policy options on raw printers and classes (STR #2238)
- The socket backend now reads any pending back-channel
data before shutting down the socket (STR #2325)
- Added a new ErrorPolicy directive in the cupsd.conf
file (STR #1871)
- Printers that use JCL options are now exported to Samba
correctly (STR #1985)
- The IPP backend now relays printer-state-message values
from the server to the client (STR #2109)
- Added support for the PWG printer-alert and
printer-alert-description attributes (STR #2088)
- Added support for LPD "stream" mode (STR #2036)
- The scheduler now reports the PostScript product string
from PPD files in CUPS-Get-PPDs responses (STR #1900)
- Raw printing with queues pointing to the file pseudo-
device and multiple files and/or banners now works (STR
#1933)
- Added new public cupsAdminGetServerSettings() and
cupsAdminSetServerSettings() APIs.
- Added new "makebuttons" script in the "tools" directory
for creating web interface buttons (STR #2231)
- Added support for DNS-SD (aka "Bonjour") printer sharing
(STR #1171)
- Job operations (cancel, hold, release, etc.) from the
web interface now return back to the original page (STR
#2239)
- The classes or printers list is now shown after a
successful deletion from the web interface (STR #1999)
- The default configuration now allows browse packets from
any address (STR #2008)
- The web interface now provides an "allow printing from the
Internet" check box (STR #1897)
- The notify-events-default and
notify-lease-duration-default attributes can now be set
(STR #1671)
- Server-side default options are now sent to clients when
the "printer-defaults" attribute group is requested (STR
#1923)
- Added support for Linux "relro" linker option (STR #1614)
- CUPS now validates the number-up option value (STR #1329)
- The on-line help now provides better search capabilities
(STR #1701)
- The web interface "Add This Printer" button now allows you
to change the printer name, description, and location
(STR #1646)
- Added support for Mac OS X authorization services
(STR #2206)
- Added support for driver-specific pre-filters (STR #2108)
- Added a new side-channel API for drivers and backends
for basic device control and information queries (STR
#1898)
- The scheduler now uses poll(), epoll(), or /dev/kqueue
instead of select() when possible (STR #1261)
- Added new cupsArrayGetIndex() and cupsArrayGetInsert()
functions to get the current index and insertion
positions of an array.
- Added a new --with-max-copies configure option (STR
#2090)
- Added new cupsRemoveDest() and cupsSetDefaultDest()
functions.
- Added support for cupsPJLCharset attribute in PPD files
which specifies the character set that is used in PJL
strings (STR #1969)
- Moved the definition of the (private) _http_s structure
to http-private.h; code that directly accesses the
http_t members will no longer compile!
- Added support for setting the document-format-default
attribute on a per-printer basis.
- Added support for IntelliBar label printers.
- Documentation fixes (STR #3044, STR #3057, STR #3153, STR #3158,
STR #3173)
- Added complete localizations for German, Japanese, Polish, and
Russian and partial localizations for Chinese, Danish, Finnish,
French, Italian, Korean, Norwegian, Portuguese, and Swedish
(STR #3096, STR #3098, STR #3109, STR #3111, STR #3141)
- Updated the configure check for -fstack-protector (STR #3198)
- The network backends now correctly convert SNMP supply descriptions to
UTF-8 encoding as needed.
- The scheduler could crash when deleting an attribute (STR #3197)
- The cups-driverd program did not detect symlink loops (STR #3185)
- The EPSON 24-pin series driver should now feed the correct amount
(STR #2624)
- The scheduler now automatically logs the last N debug messages for
failed print jobs.
- You can now modify a raw print queue (STR #3133)
- Fixed a number of ppdi issues and added a unit test to validate that
ppdc + ppdi can generate and import the same data (STR #3152)
- Moving jobs in the web interface now shows an error if you only have
one printer or class added (STR #3094)
- Since classes have never truly supported the printer-error-policy
stuff added in CUPS 1.2, update the code to reflect the current
reality and support only the retry-current-job policy for now
(STR #3171)
- Revised the password callback support (STR #2953)
- ppdEmit*() did not choose between PageSize and PageRegion properly.
- Make some fairly substantial changes to the Kerberos support code so
that CUPS can work in multi-realm environments and does not require
delegatable credentials. Shared printing still requires delegation,
however "delegation by policy" can be enabled in the KDC to make this
all work.
- "AccessLogLevel actions" did not hide client-error-not-found errors.
- AP_FIRST_InputSlot did not work with number-up.
- cupsBackChannelRead() and cupsBackChannelWrite() could fail due to a
lack of kernel buffers.
- The IPP and LPD backends did not respond to side-channel requests
while copying print data to a temporary file.
- cupsWriteRequestData() flushed the output buffer unnecessarily,
causing reduced performance in some situations.
- If a CGI process died before sending its MIME headers, the request
would hang on the client.
- The printer/class/job search feature on the web interface did not
work (STR #3132)
- The scheduler did not write the printers out for classes.
- CUPS-Get-PPDs did not work properly when filtering by language,
product, or psversion (STR #3136)
- The scheduler now kills job filters when it takes more than 30 seconds
(configurable) to cancel or hold the job.
- The cupstestppd program did not validate the capitalization of
filenames in the PPD file.
- The cupstestppd program did not validate the PageSize and PageRegion
values.
- The cups-deviced helper program could miss reporting some backend
devices (STR #3108)
- The cupsSideChannelSNMP* functions did not work.
- The scheduler could consume 100% CPU when jobs were canceled.
- Clicking on "Select Another Make/Manufacturer" in the web interface
incorrectly added the printer (STR #3095)
- The scheduler no longer uses programs with insecure file
permissions.
- httpAssembleURI*() did not escape backslashes in hostnames.
- The dnssd backend did not unquote "full names" before creating the
device URI.
- The scheduler now supports JobRetryInterval values less than 10
seconds.
- Updated the Spanish localization (STR #3090)
- The scheduler did not redo Bonjour/DNS-SD registrations when updating
them failed.
- The "authenticated" policy incorrectly required authentication for
status operations.
- ppdOpen*() incorrectly loaded PPDs with multiple JobPatchFile
keywords.
- The network backends no longer report the SNMP "offline" or
maintenance status bits since they are inconsistently implemented and
often unreliable.
- The scheduler no longer logs child processes killed via SIGKILL as
"crashed".
- The printer link shown on the "job moved" template was bad (STR #3085)
- Updated the HTML templates to use the final HTML 4 DOCTYPE (STR #3086)
- The scheduler did not track the "paused" reason properly if a
printer had other reasons associated with it.
- cupsSendRequest() did not clear old local certificate auth data.
- The PPD compiler did not search for localization files properly
(STR #3084)
- cupsGetNamedDest() did not use the fallback default like
cupsGetDests*() (STR #3082)
- The scheduler now provides a LogTimeFormat directive to enable
microseconds in the date and time that are logged.
- The scheduler now provides a MultipleOperationTimeout directive to
control the timeout for multi-file print jobs.
- The configure script incorrectly allowed Avahi to be used for DNS-SD
printer discovery (STR #3065)
- The web interface and scheduler did not support URIs up to 1024 bytes
in length (STR #3072)
- Fixed pdftops issues with page sizes (STR #3063)
- Fixed pdftops issues with Ghostscript (STR #3062)
- The scheduler incorrectly registered default profiles for PostScript
printers with no specified colorspace.
- The scheduler incorrectly created an empty org.cups.printers.plist
file on Mac OS X.
- cupsGetPPD3() did not look for local PPDs in the right directory.
- SNMP lookups via side-channel did not work for NULL-VALUE and
and OCTET-STRING OIDs containing nul characters.
- The libusb-based USB backend did not work.
- The scheduler did not set the printer-commands attribute correctly
for some PPDs.
- The ppdi utility did not work.
- The web interface no longer uses multi-part output with old or broken
web browsers (STR #3049)
- CUPS now conforms to the draft IPP/2.0 and IPP/2.1 specification.
- Added a new cupsGetConflicts() API to get a list of conflicting
options.
- The PPD compiler didn't localize options or choices that did not
have associated translation text (STR #3045)
- Updated the Spanish localization (STR #3043)
- Fixed build problems (STR #3040, STR #3047)
- cupsResolveConflicts() did not resolve using the default option
choice in some cases due to the mirror UIConstraints that are
present in most PPD files.
- The scheduler did not honor MIME type priorities.
- The commandtops filter incorrectly used the JCLBegin code to end
its jobs.
- The default BrowseLocalProtocols value was not set properly.
- Since the commandtops filter does not actually support ReportLevels
all on its own, don't list that printer command by default for PS
printers.
- The scheduler did not give filters a chance to log errors or update
printer attributes when a job was canceled.
- The scheduler did not clear the "connecting-to-device" reason keyword
when a job finished.
CHANGES IN CUPS V1.4b2
- Documentation updates (STR #2983, STR #2998, STR #3021)
- The cupstestppd utility now validates the FileVersion and
FormatVersion values in PPD files.
- The default cupsd.conf file did not reflect the
--with-local-protocols value set at compile-time (STR #3037)
- The cupsGetPPD* APIs now create symlinks to local PPD files
rather than copying them whenever possible.
- Various performance optimizations in the string pool, dests, and
options implementations.
- The cupsGetDests* APIs now return the marker and printer-commands
attributes.
- Side-channel SNMP lookups would not work when cupsSNMPSupplies
was set to False in the PPD file.
- Localized the device descriptions for the SCSI, serial,
and network backends (STR #3014)
- Added a Spanish localization (STR #3015)
- Added support for marker-low-levels and marker-high-levels
attributes.
- The scheduler could hang writing a long log line.
- The cupsGetDevices() function now has an "include_schemes"
parameter.
- The lpinfo command now supports --include-schemes and
--exclude-schemes options.
- The CUPS-Get-PPDs operation now supports the include-schemes
and exclude-schemes attributes.
- The CUPS-Get-Devices operation now supports the include-schemes
attribute.
- The print filters now support a replacement for the fitplot
option called "fit-to-page".
- The LPD backend no longer tries to collect page accounting
information since the LPD protocol does not allow us to
prevent race conditions.
- The scheduler did not save the last marker-change-time value.
- Fixed a problem with printing to some IPP printers, including
CUPS 1.1.x.
- Fixed a redirection problem with the printer web page (STR #3012)
- Fixed a PPD compiler problem with the loading of message
catalogs (STR #2990)
- Fixed a PPD compiler problem with the loading of .strings files
(STR #2989)
- The cupsfilter utility did not set the CONTENT_TYPE environment
variable when running filters.
- The scheduler now waits to allow system sleep until the jobs
have all stopped.
- The IPP, LPD, and socket backends used different "connecting"
progress messages.
CHANGES IN CUPS V1.4b1
- Documentation updates (STR #2567)
- The PPD compiler now allows local message catalogs to
override the standard CUPS translations (STR #2642)
- The ppdmerge command did not merge custom option strings
(STR #2863)
- The scheduler now supports the Hold-New-Jobs and
Release-Held-New-Jobs operations; these are exposed via the
cupsdisable and cupsenable commands (STR #2332)
- The lpstat command is now much faster when displaying the
status of a single printer (STR #2843)
- The scheduler now caches information from PPD files to provide
significantly faster startup time with large numbers of PPDs
(STR #1293)
- CUPS-Get-Driver now provides much better driver matching based
on the IEEE-1284 device ID and make/model strings (STR #2707)
- Now support the cupsSNMPSupplies keyword to control whether
the network backends query the SNMP Printer MIB for supply
levels.
- Now support and use a new banner file format for better text
support and easier customization (STR #2490)
- The scheduler now sets the PRINTER_INFO and PRINTER_LOCATION
environment variables from the corresponding IPP attributes.
- The ippRead*() and ippWrite*() functions no longer use a
stack-based buffer (STR #2388)
- The CUPS-Add-Modify-Printer operation now allows you to set
the printer-state-reasons attribute.
- The "set printer options" page now supports auto-configuration
of printer options (STR #1440)
- The web interface now provides an advanced server settings
form.
- The web interface's "modify printer" pages now make it
easier to change just one setting (STR #1919)
- The scheduler now supports a plist PrintcapFormat.
- The scheduler now supports multiple addresses in Allow and
Deny lines, just like Apache (STR #2947)
- Added CUPS_JOBTYPE environment variable for job filters so
they know whether they are printing a banner or document
file (STR #2799)
- Added support for printer filtering by the cupsfilter
command (STR #2562)
- Added a SSLOptions directive to allow Windows clients to
talk to CUPS in FIPS mode (STR #2827)
- Renamed the accept and reject commands to cupsaccept and
cupsreject; the old names are still available (STR #2936)
- The locale/translate utility needed an update to work with
Google (STR #2882)
- The lpstat command now supports a -H option to display the
default server (STR #2833)
- The scheduler now supports a FatalErrors directive to control
which errors should cause the scheduler to exit (STR #2536)
- The scheduler now uses the php-cgi program if it is available
(STR #2923)
- The scheduler now supports a DefaultPaperSize directive
(STR #2848)
- The scheduler now passes the job-originating-host-name
value to filters in the options argument (STR #2558)
- CUPS now supports job tickets in PDF files (STR #2903)
- Added a DBUS notifier (STR #2529)
- The LPD mini-daemon now passes the document name when queuing
print jobs (STR #2482)
- The IPP backend did not relay com.apple.print.recoverable-message
values.
- The scheduler now supports a job-media-progress attribute to
track the progress of individual pages.
- The sample HP driver now supports A5 (STR #2798)
- The CUPS web interface menu item now uses the xdg-open
command, when available (STR #2724)
- The cups-lpd program now supports the -h option (STR #2794)
- The scheduler now sets the PAM_TTY parameter and the
PAM_ESTABLISH_CRED credential flag (STR #2745)
- The scheduler now logs unsuccessful requests to the error_log
file as errors (STR #2616)
- Added support for a "retry-current-job" error policy that
retries the current job immediately when the backend encounters
an error (STR #2555)
- The scheduler now returns a "forbidden" error when a user
correctly authenticates but does not have permission to
continue further (STR #2101)
- The scheduler now loads both the server and CA certificates
(if present) from the ServerCertificate file (STR #2146)
- New RSS subscriptions now create their feed files immediately
(STR #2853)
- Added support for a device-location attribute which provides
the physical location of a printer device.
- Added a cupsBackendReport() API which handles quoting of the
device data by a backend.
- Added support for custom options in the web interface
(STR #1729)
- Added support for Mozilla LDAP, reconnection to LDAP servers,
and improved LDAP performance (STR #1962)
- Added Solaris SMF support (STR #1477)
- Added optional support for using TCP wrappers to limit access
to CUPS (STR #263)
- Added ppdPageSizeLimits API.
- Added support for new cupsMediaQualifier2, cupsMediaQualifier3,
cupsMinSize, and cupsMaxSize attributes.
- Added cupsResolveConflicts and ppdInstallableConflict APIs.
- Added support for new cupsUIConstraints and cupsUIResolver
attributes for better option conflict detection and
resolution.
- Increased the maximum size of 1284 device ID strings to
256 bytes (STR #2877)
- Added an AccessLogLevel directive to cupsd.conf to control
what is logged to the access_log file.
- The default LogLevel is now "warn" instead of "info" to reduce
the amount of logging that is done to disk by default.
- The PPD compiler did not include OID query keywords in PPD
files (STR #2871)
- The cups-driverd helper program now directly supports driver
information files.
- The USB backend now uses libusb when available (STR #1575)
- Added ppdLocalizeAttr function to get the localized version
of an attribute.
- MIME types now support a priority() attribute (STR #2719)
- The standard MIME types are now installed in
DataDir/mime (STR #2719)
- The lpoptions command now describes custom options and
the necessary parameters (STR #2660)
- The ppdmerge program did not support Simplified Chinese
or Traditional Chinese language version strings (STR #2851)
- The PPD compiler now supports localizable attributes
(STR #2738)
- The ppdpo utility now includes cupsIPPReasons values in
the message catalogs it generates (STR #2754)
- The PPD compiler now supports conditional directives
(STR #2636)
- The ppdc utility now supports a "-t" option to test PPD
files (STR #2739)
- The ppdc utility now supports a "-m" option to use the
ModelName value as the output filename.
- The ppdc utility now supports a FileName directive to
set an alternate output filename (STR #2740)
- The side-channel API now supports SNMP queries for the
standard network backends.
- Added a PageLogFormat directive to the cupsd.conf file to
control the format of lines in the page_log file.
- Filters can now send PPD: messages to stderr to set PPD
keywords like DefaultPageSize while a job is printing.
- Added a mdns backend for discovery and printing to printers
that advertise themselves via DNS-SD (Bonjour)
- The ipp, lpd, and socket backends now support DNS-SD service
name resolution.
- The scheduler now uses a single shared file descriptor for
all DNS-SD registrations (STR #2674)
- The ipp, lpd, and socket backends now support SNMP-based
page accounting and supply level monitoring (STR #1655)
- Added support for cupsPJLDisplay attribute to control what
PJL commands are used to display the job information.
- Driver information files can now be installed in
/Library/Printers/PPDs.drv on Mac OS X.
- The CUPS image library now supports reading images larger
than 2GB.
- The scheduler now delays writing config and state files to
reduce disk activity (STR #2684)
- The CUPS-Get-Devices operation now supports the
exclude-schemes and timeout attributes to control which
backends are polled and for how long.
- The cups-deviced helper application now runs backends in
parallel to get the list of devices faster.
- Added --enable-pap configure option.
- The default cupsd.conf file now includes an "authenticated"
policy which requires authentication for remote print jobs.
- Added support for Czech and Hungarian in PPD files
(STR #2735, STR #2736)
- The PPD compiler tools now support Mac OS X .strings files
for localization (STR #2737)
- ppdOpen*() now default the colorspace member to PPD_CS_N
when no DefaultColorSpace attribute is present in the PPD
file.
- The build system has been updated to support separate
installation of data, program, header, and library files.
- All support libraries are now built as shared libraries
by default.
- The scheduler now manages ICC color profiles on Mac OS X.
- The network backends (ipp, lpd, socket) now support
SNMP-based supply and page count monitoring (STR #1655)
- The lppasswd program is no longer installed setuid to
root to make the default installation more secure.
- Added a new ppdLocalizeMarkerName() function to get
the localized version of a marker-names value.
- The scheduler now provides the printer-dns-sd-name
attribute for printers shared via DNS-SD/Bonjour.
- The pdftops filter now executes the Xpdf or poppler
pdftops utility to convert PDF files (STR #1471)
- Bonjour printer registrations now advertise as local or
global based on the current access policies for the
printer.
- cupsGetDests*() and cupsSetDests*() now track the last
used printer preference on Mac OS X.
- Added a new streaming request API (STR #2261)
- Added a new cupsGetNamedDest() function to the CUPS
library for faster printing with lp and lpr (STR #2638)
- The scheduler now sets the PAM RHOST value on systems
that support it (STR #2637)
- The scheduler now sandboxes child processes when
possible.
- The Cancel-Job operation now supports a purge-job
attriibute to purge a specified job.
- ppdEmit* and ppdCollect* now use the NonUIOrderDependency
attributes for custom option selections.
- The web interface now enables/disables the printer
sharing (formerly publishing) controls based on the
server-is-sharing-printers state (STR #2233)
- The scheduler now tracks printer sharing via the
server-is-sharing-printers attribute, and manages LPD
and SMB sharing as well (STR #2233)
- The web interface now allows you to go back to the make/
manufacturer page if there is no matching printer driver
on the model page (STR #2436)
- The printer list now shows the default media, banner, and
duplex options as well as the color and duplex capabilities
of printers (STR #1175)
- The web interface look-n-feel has been updated (STR #2492)
- The scheduler now supports a CUPS-Get-Document operation
that returns the specified print job document (STR #118)
- The cupsfilter utility now supports a "-J jobid" option
to filter the document from the specified job.
- The scheduler (cupsd) now supports a new option (-t) to
do a syntax check of the cupsd.conf file (STR #2003)
- Added new cupsGetPPD3() API to allow applications to
cache PPDs safely (STR #1473)
- Added generic PostScript and PCL printer driver PPDs.
+6 -3
Ver Arquivo
@@ -1,4 +1,4 @@
CREDITS.txt - 2007-09-10
CREDITS.txt - 2010-03-13
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
@@ -17,6 +17,7 @@ like to thank the following individuals for their contributions:
Wang Jian - CUPS RPM corrections.
Roderick Johnstone - Beta tester of the millenium.
Till Kamppeter - Bug fixes, beta testing, evangelism.
I–aki Larra–aga - Basque localization.
Kenshi Muto - Japanese localization, patches, and
testing.
Tomohiro Kato - Japanese localization.
@@ -28,16 +29,18 @@ like to thank the following individuals for their contributions:
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Daniel Nylander - Swedish localization.
Niklas 'Nille' kerstršm - Swedish 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.
Juan Pablo Gonzlez Riopedre - Spanish localization.
Opher Shachar - Hebrew localization.
Stuart Stevens - HP JetDirect IPP information.
Andrea Suatoni - IRIX desktop integration and testing.
Teppo Turlianen - Finnish localization.
Teppo Turliainen - Finnish localization.
Tim Waugh - Lots of patches, testing, and Linux
integration.
Yugami - LDAP browsing support.
+98 -72
Ver Arquivo
@@ -1,10 +1,9 @@
INSTALL - CUPS v1.3.2 - 2007-09-18
INSTALL - CUPS v1.4.3 - 2009-12-15
----------------------------------
This file describes how to compile and install CUPS from source
code. For more information on CUPS see the file called
"README.txt". A complete change log can be found in
"CHANGES.txt".
This file describes how to compile and install CUPS from source code. For more
information on CUPS see the file called "README.txt". A complete change log can
be found in "CHANGES.txt".
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
@@ -14,71 +13,61 @@ code. For more information on CUPS see the file called
BEFORE YOU BEGIN
You'll need ANSI-compliant C and C++ compilers, plus a make
program and Bourne shell. The GNU compiler tools work well -
we've tested the current CUPS code against several versions
of GCC with excellent results.
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 all
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).
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 the JPEG, PNG, TIFF, and ZLIB
libraries for image support, the CDSA, GNU TLS, or OpenSSL
libraries for encryption support, and the OpenLDAP and
OpenSLP libraries for directory services support. CUPS will
compile and run without these, however you'll miss out on
many of the features provided by CUPS.
Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB libraries for
image support, the CDSA, GNU TLS, or OpenSSL libraries for encryption
support, the OpenLDAP and OpenSLP libraries for directory services support,
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.
Kerberos support requires a very recent version of the MIT
implementation with the krb5_cc_new_unique() function or the
Heimdal implementation, along with the corresponding GSSAPI
pieces.
Also, please note that CUPS no longer includes the
Ghostscript- based pstoraster filter. You *must* download
GPL Ghostscript separately from the CUPS web site if you want
to print PostScript files to non-PostScript printers on
operating systems other than Mac OS X.
Also, please note that CUPS does not include the Ghostscript-based
PostScript filter needed by non-PostScript printers. You *must* download
GPL Ghostscript separately from the CUPS web site if you want to print
PostScript files to non-PostScript printers on operating systems other than
Mac OS X.
COMPILING FROM SUBVERSION
COMPILING THE SUBVERSION REPOSITORY CODE
The CUPS Subversion repository doesn't hold a copy of the
pre-built configure script. You'll need to run the GNU
autoconf software (2.52 or higher) before compiling the
software from Subversion:
The CUPS Subversion repository doesn't hold a copy of the pre-built
configure script. You'll need to run the GNU autoconf software (2.60 or
higher) to create it:
autoconf -f
autoconf
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:
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:
The default installation will put the CUPS software in the "/etc", "/usr",
and "/var" directories on your system, which will overwrite any existing
printing commands on your system. Use the "--prefix" option to install the
CUPS software in another location:
./configure --prefix=/some/directory
To see a complete list of configuration options, use the
--help option:
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:
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"
@@ -96,6 +85,15 @@ CONFIGURATION
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_LOG environment variable 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.
Once you have configured things, just type:
make ENTER
@@ -107,11 +105,26 @@ CONFIGURATION
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:
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
@@ -119,12 +132,10 @@ INSTALLING THE SOFTWARE
gmake install ENTER
You can also build binary packages that can be installed on
other machines using the RPM spec file
("packaging/cups.spec") or EPM list file
("packaging/cups.list"). The latter also supports building
of binary RPMs, so it may be more convenient to use - we use
EPM to build all of our binary distributions.
You can 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:
@@ -132,7 +143,7 @@ INSTALLING THE SOFTWARE
The EPM software is available at:
http://www.easysw.com/epm/
http://www.epmhome.org/
CREATING BINARY DISTRIBUTIONS WITH EPM
@@ -146,8 +157,8 @@ CREATING BINARY DISTRIBUTIONS WITH EPM
gmake <format> ENTER
for FreeBSD, NetBSD, and OpenBSD. The <format> target is one of
the following:
for FreeBSD, NetBSD, and OpenBSD. The <format> target is one of the
following:
epm - Builds a script + tarfile package
aix - Builds an AIX package
@@ -164,19 +175,34 @@ CREATING BINARY DISTRIBUTIONS WITH EPM
tardist - Builds an IRIX package (also inst)
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.
REPORTING PROBLEMS
If you have problems, READ THE DOCUMENTATION FIRST! If the
documentation does not solve your problems, please post a
message on the "cups.general" forum at:
If you have problems, READ THE DOCUMENTATION FIRST! If the documentation
does not solve your problems, please post a message on the "cups.general"
forum at:
http://www.cups.org/newsgroups.php
Include your operating system and version, compiler and
version, and any errors or problems you've run into. The
"config.log" file and the output from the configure script
and make should also be sent, as it often helps to determine
the cause of your problem.
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.
If you are running a version of Linux, be sure to provide the Linux
distribution you have, too.
+18 -13
Ver Arquivo
@@ -1,6 +1,6 @@
Common UNIX Printing System License Agreement
CUPS License Agreement
Copyright 2007 by Apple Inc.
Copyright 2007-2009 by Apple Inc.
1 Infinite Loop
Cupertino, CA 95014 USA
@@ -9,11 +9,10 @@
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.
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
@@ -137,12 +136,18 @@ redistribute it freely, subject to the following restrictions:
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.
CUPS and the CUPS logo (the "CUPS Marks") are trademarks of Apple
Inc. Apple grants you a non-exclusive and non-transferable right
to use the CUPS Marks in any direct port or binary distribution
incorporating CUPS software and in any promotional material
therefor. You agree that your products will meet the highest
levels of quality and integrity for similar goods, not be unlawful,
and be developed, manufactured, and distributed in compliance with
this license. You will not interfere with Apple's rights in the
CUPS Marks, and all use of the CUPS Marks shall inure to the
benefit of Apple. This license does not apply to use of the CUPS
Marks in a derivative products, which requires prior written
permission from Apple Inc.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
+38 -21
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -20,8 +20,10 @@
AR = @AR@
AWK = @AWK@
CC = @LIBTOOL@ @CC@
CHMOD = @CHMOD@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
DSOXX = @DSOXX@
HTMLDOC = @HTMLDOC@
INSTALL = @INSTALL@
LD = @LD@
@@ -34,19 +36,18 @@ RM = @RM@ -f
RMDIR = @RMDIR@
SED = @SED@
SHELL = /bin/sh
STRIP = @STRIP@
#
# Installation programs...
#
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_SCRIPT = $(INSTALL) -m 755
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
INSTALL_MAN = $(INSTALL) -c -m 444
INSTALL_SCRIPT = $(INSTALL) -c -m 555
#
# Default user, group, and system groups for the scheduler...
@@ -77,7 +78,11 @@ UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@
#
LIBCUPS = @LIBCUPS@
LIBCUPSCGI = @LIBCUPSCGI@
LIBCUPSDRIVER = @LIBCUPSDRIVER@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBCUPSMIME = @LIBCUPSMIME@
LIBCUPSPPDC = @LIBCUPSPPDC@
LIBJPEG = @LIBJPEG@
LIBLDAP = @LIBLDAP@
LIBMALLOC = @LIBMALLOC@
@@ -86,6 +91,8 @@ LIBPNG = @LIBPNG@
LIBSLP = @LIBSLP@
LIBGSSAPI = @LIBGSSAPI@
LIBTIFF = @LIBTIFF@
LIBUSB = @LIBUSB@
LIBWRAP = @LIBWRAP@
LIBZ = @LIBZ@
#
@@ -108,31 +115,36 @@ INSTALLSTATIC = @INSTALLSTATIC@
# for extra debug info)
#
ALL_CFLAGS = $(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
$(OPTIONS) $(CFLAGS)
ALL_CFLAGS = -I.. -D_CUPS_SOURCE $(CFLAGS) $(SSLFLAGS) \
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
ARCHFLAGS = @ARCHFLAGS@
ARFLAGS = @ARFLAGS@
BACKLIBS = @BACKLIBS@
CFLAGS = -I.. @CPPFLAGS@ @CFLAGS@ \
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
BANNERTOPS = @BANNERTOPS@
CFLAGS = @CPPFLAGS@ @CFLAGS@
COMMONLIBS = @LIBS@
CUPSDLIBS = @CUPSDLIBS@
CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
DSOFLAGS = @DSOFLAGS@
DBUS_NOTIFIER = @DBUS_NOTIFIER@
DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
DNSSD_BACKEND = @DNSSD_BACKEND@
DSOFLAGS = -L../cups @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
DNSSDLIBS = @DNSSDLIBS@
FONTS = @FONTS@
IMGLIBS = @IMGLIBS@
IMGFILTERS = @IMGFILTERS@
LAUNCHDLIBS = @LAUNCHDLIBS@
LDFLAGS = -L../cups -L../filter @LDARCHFLAGS@ \
LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
-L../scheduler @LDARCHFLAGS@ \
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
LEGACY_BACKENDS = @LEGACY_BACKENDS@
LIBCUPSORDER = @LIBCUPSORDER@
LIBCUPSIMAGEORDER = @LIBCUPSIMAGEORDER@
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
LINKCUPS = @LINKCUPS@ $(SSLLIBS) $(DNSSDLIBS)
LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(COMMONLIBS)
OPTIM = @OPTIM@
@@ -141,8 +153,12 @@ PAMLIBS = @PAMLIBS@
PAP = @PAP@
PDFTOPS = @PDFTOPS@
PHPDIR = @PHPDIR@
PHPOPTIONS = @PHPOPTIONS@ -I../.. `$(PHPCONFIG) --includes`
SSLFLAGS = @SSLFLAGS@
SSLLIBS = @SSLLIBS@
TEXTTOPS = @TEXTTOPS@
UNITTESTS = @UNITTESTS@
#
# Separate 32/64-bit library support...
@@ -221,6 +237,7 @@ REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
SBINDIR = $(BUILDROOT)@sbindir@
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
SMFMANIFESTDIR = @SMFMANIFESTDIR@
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
XINETD = @XINETD@
@@ -242,7 +259,7 @@ DBUSDIR = @DBUSDIR@
#
.SILENT:
.SUFFIXES: .1 .1.gz .1m .1m.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
.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 .32.o .64.o .gz
.c.o:
echo Compiling $<...
@@ -258,14 +275,14 @@ DBUSDIR = @DBUSDIR@
.cxx.o:
echo Compiling $<...
$(CXX) $(ARCHFLAGS) $(OPTIM) $(CXXFLAGS) -c $<
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c $<
.man.1 .man.1m .man.5 .man.7 .man.8:
.man.1 .man.1m .man.3 .man.5 .man.7 .man.8:
echo Linking $<...
$(RM) $@
$(LN) $< $@
.man.1.gz .man.1m.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
.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 <$< >$@
+190 -38
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2010 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,14 +15,22 @@
include Makedefs
#
# Don't run top-level build targets in parallel...
#
.NOTPARALLEL:
#
# Directories to make...
#
DIRS = cups backend berkeley cgi-bin filter locale man monitor \
notifier $(PDFTOPS) scheduler systemv test \
DIRS = cups filter backend berkeley cgi-bin driver locale man monitor \
notifier ppdc scheduler systemv test \
$(PHPDIR) \
conf data doc $(FONTS) ppd templates
conf data doc examples $(FONTS) templates
#
@@ -31,9 +39,55 @@ DIRS = cups backend berkeley cgi-bin filter locale man monitor \
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)) || exit 1;\
(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
@@ -54,19 +108,22 @@ clean:
distclean: clean
$(RM) Makedefs config.h config.log config.status
$(RM) cups-config conf/cupsd.conf conf/pam.std
$(RM) doc/help/ref-cupsd-conf.html doc/help/standard.html
$(RM) doc/index.html
$(RM) init/cups.sh init/cups-lpd
$(RM) cups-config
$(RM) conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
$(RM) doc/help/ref-cupsd-conf.html doc/help/standard.html doc/index.html
$(RM) init/cups.sh init/cups-lpd init/org.cups.cups-lpd.plist
$(RM) man/client.conf.man
$(RM) man/cups-deviced.man man/cups-driverd.man
$(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
$(RM) man/cupsd.conf.man man/lpoptions.man
$(RM) man/cupsd.conf.man man/drv.man man/lpoptions.man
$(RM) packaging/cups.list
$(RM) packaging/cups-desc.plist packaging/cups-info.plist
$(RM) templates/header.tmpl
$(RM) desktop/cups.desktop
$(RM) init/cups.xml
-$(RM) doc/*/index.html
-$(RM) templates/*/header.tmpl
-$(RM) -r autom4te*.cache
-$(RM) -r autom4te*.cache clang cups/charmaps cups/locale driver/test
#
@@ -80,6 +137,19 @@ depend:
done
#
# Run the clang.llvm.org static code analysis tool on the C sources.
# (at least checker-231 is required for scan-build to work this way)
#
.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
#
# Generate a ctags file...
#
@@ -89,13 +159,20 @@ ctags:
#
# Install object and target files...
# Install everything...
#
install: installhdrs
install: install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
for dir in $(DIRS); do\
echo Installing in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install) || exit 1;\
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)
@@ -118,13 +195,7 @@ install: installhdrs
fi
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
echo Installing StartupItems files...; \
$(INSTALL_SCRIPT) init/PrintingServices $(BUILDROOT)$(INITDDIR)/PrintingServices; \
$(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
$(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
echo Installing LaunchDaemons configuration files...; \
$(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
$(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \
@@ -142,6 +213,11 @@ install: installhdrs
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
fi \
fi
if test "x$(SMFMANIFESTDIR)" != x; then \
echo Installing SMF manifest in $(SMFMANIFESTDIR)...;\
$(INSTALL_DIR) $(BUILDROOT)/$(SMFMANIFESTDIR); \
$(INSTALL_SCRIPT) init/cups.xml $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
fi
if test "x$(DBUSDIR)" != x; then \
echo Installing cups.conf in $(DBUSDIR)...;\
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR)/system.d; \
@@ -169,17 +245,37 @@ install: installhdrs
$(INSTALL_DATA) desktop/cups-128.png $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
fi
#
# Install source and header files...
# Install header files...
#
installsrc:
gnutar --dereference --exclude=.svn -cf - . | gnutar -C $(SRCROOT) -xf -
install-headers:
for dir in $(DIRS); do\
echo Installing header files in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
done
installhdrs:
(cd cups ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;\
(cd filter ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;
#
# 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
#
@@ -222,33 +318,89 @@ uninstall:
fi \
$(RMDIR) $(BUILDROOT)$(INITDDIR); \
fi
if test "x$(SMFMANIFESTDIR)" != x; then \
echo Uninstalling SMF manifest in $(SMFMANIFESTDIR)...;\
$(RM) $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
fi
if test "x$(DBUSDIR)" != x; then \
echo Uninstalling cups.conf in $(DBUSDIR)...;\
$(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
$(RMDIR) $(BUILDROOT)$(DBUSDIR); \
fi
$(RM) $(BUILDROOT)/etc/xinetd.d/cups-lpd
$(RM) $(BUILDROOT)/usr/share/applications/cups.desktop
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png
if test "x$(XINETD)" != x; then \
echo Uninstalling xinetd configuration file for cups-lpd...; \
$(RM) $(BUILDROOT)$(XINETD)/cups-lpd; \
fi
if test "x$(MENUDIR)" != x; then \
echo Uninstalling desktop menu...; \
$(RM) $(BUILDROOT)$(MENUDIR)/cups.desktop; \
fi
if test "x$(ICONDIR)" != x; then \
echo Uninstalling desktop icons...; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
$(RM) $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
fi
#
# Run the test suite...
#
test: all
test: all unittests
echo Running CUPS test suite...
cd test; ./run-stp-tests.sh
check: all
check: all unittests
echo Running CUPS test suite with defaults...
cd test; ./run-stp-tests.sh 1 0 n
#
# Create HTML documentation...
#
apihelp:
for dir in cgi-bin cups filter driver ppdc scheduler; do\
echo Generating API help in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
done
framedhelp:
for dir in cgi-bin cups filter driver ppdc scheduler; do\
echo Generating framed API help in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
done
#
# Create an Xcode docset...
#
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...
/Developer/usr/bin/docsetutil index org.cups.docset
echo Generating docset archive and feed...
$(RM) org.cups.docset.atom
/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
#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
#
@@ -275,7 +427,7 @@ dist: all
*BSD*) $(MAKE) $(MFLAGS) bsd;; \
Darwin*) $(MAKE) $(MFLAGS) osx;; \
IRIX*) $(MAKE) $(MFLAGS) tardist;; \
Linux*) $(MAKE) $(MFLAGS) rpm;; \
Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
SunOS*) $(MAKE) $(MFLAGS) pkg;; \
esac
+90 -100
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.3.2 - 2007-09-18
README - CUPS v1.4.3 - 2009-12-15
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
@@ -7,144 +7,141 @@ instead...
INTRODUCTION
CUPS provides a portable printing layer for UNIX(r)-based
operating systems. It was developed by Easy Software Products
and is now owned and maintained by Apple Inc. to promote a
standard printing solution for all UNIX vendors and users. CUPS
provides the System V and Berkeley command-line interfaces.
CUPS is a standards-based, open source printing system developed by Apple
Inc. for Mac OS® X 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!
CUPS uses the Internet Printing Protocol ("IPP") as the basis
for managing print jobs and queues. The Line Printer Daemon
("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
JetDirect) protocols are also supported with reduced
functionality. CUPS adds network printer browsing and
PostScript Printer Description ("PPD") based printing options
to support real-world printing under UNIX.
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 includes an image file RIP that supports printing of
image files to non-PostScript printers. GPL Ghostscript now
includes the "cups" driver to support printing of PostScript
files within the CUPS driver framework. Sample drivers for
Dymo, EPSON, HP, OKIDATA, and Zebra printers are included that
use these filters.
CUPS is licensed under the GNU General Public License and GNU
Library General Public License versions 2.
CUPS is licensed under the GNU General Public License and GNU Library
General Public License versions 2. See the file "LICENSE.txt" for more
information.
READING THE DOCUMENTATION
Once you have installed the software you can access the
documentation (and a bunch of other stuff) on-line at:
Once you have installed the software you can access the documentation (and
a bunch of other stuff) online at:
http://localhost:631/
If you're having trouble getting that far, the documentation
is located under the "doc/help" directory.
If you're having trouble getting that far, the documentation is located
under the "doc/help" directory.
Please read the documentation before asking questions.
GETTING SUPPORT AND OTHER RESOURCES
If you have problems, READ THE DOCUMENTATION FIRST! We also
provide many discussion forums which are available at:
If you have problems, READ THE DOCUMENTATION FIRST! We also provide many
discussion forums which are available at:
http://www.cups.org/newsgroups.php
See the CUPS web site at "http://www.cups.org/" for other
site links.
See the CUPS web site at "http://www.cups.org/" for other resources.
SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
CUPS 1.3 includes a web-based administration tool that allows
you to manage printers, classes, and jobs on your server.
Open the following URL in your browser to access the printer
administration tools:
CUPS includes a web-based administration tool that allows you to manage
printers, classes, and jobs on your server. Open the following URL in your
browser to access the printer administration tools:
http://localhost:631/admin/
DO NOT use the hostname for your machine - it will not work
with the default CUPS configuration. To enable
administration access on other addresses, check the "Allow
Remote Administration" box and click on the "Change Settings"
button.
DO NOT use the hostname for your machine - it will not work with the default
CUPS configuration. To enable administration access on other addresses,
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 group on your system)
when performing any administrative function.
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 works best with PPD (PostScript Printer Description)
files. In a pinch you can also use System V style printer
interface scripts.
CUPS works best with PPD (PostScript Printer Description) files. In a pinch
you can also use System V style printer interface scripts.
CUPS includes several sample PPD files you can use:
Driver PPD File
----------------------------- ------------
Dymo Label Printers dymo.ppd
Intellitech Intellibar intelbar.ppd
EPSON Stylus Color Series stcolor.ppd
EPSON Stylus Photo Series stphoto.ppd
EPSON Stylus New Color Series stcolor2.ppd
EPSON Stylus New Photo Series stphoto2.ppd
EPSON 9-pin Series epson9.ppd
EPSON 24-pin Series epson24.ppd
HP DeskJet Series deskjet.ppd
HP LaserJet Series laserjet.ppd
OKIDATA 9-Pin Series okidata9.ppd
OKIDATA 24-Pin Series okidat24.ppd
Zebra CPCL Label Printer zebracpl.ppd
Zebra EPL1 Label Printer zebraep1.ppd
Zebra EPL2 Label Printer zebraep2.ppd
Zebra ZPL Label Printer zebra.ppd
Driver PPD Name
----------------------------- ------------------------------
Dymo Label Printers drv:///sample.drv/dymo.ppd
Intellitech Intellibar drv:///sample.drv/intelbar.ppd
EPSON Stylus Color Series drv:///sample.drv/stcolor.ppd
EPSON Stylus Photo Series drv:///sample.drv/stphoto.ppd
EPSON Stylus New Color Series drv:///sample.drv/stcolor2.ppd
EPSON Stylus New Photo Series drv:///sample.drv/stphoto2.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
Run the "lpinfo" command to list the available printers:
Run the "lpinfo -m" command to list 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:
Then use the correct URI to add the printer using the "lpadmin" command:
lpadmin -p printername -E -v URI -m filename.ppd
lpadmin -p printername -E -v device-uri -m ppd-name
Network printers typically use "socket" or "lpd" URIs:
lpadmin -p printername -E -v socket://11.22.33.44 -m filename.ppd
lpadmin -p printername -E -v lpd://11.22.33.44/ -m filename.ppd
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.
The sample drivers provide basic printing capabilities, but generally do not
exercise the full potential of the printers or CUPS. The CUPS web site
provides links and drivers:
http://www.cups.org/ppd.php PPD files
http://www.cups.org/links.php Links to other drivers
PRINTING FILES
CUPS provides both the System V "lp" and Berkeley "lpr"
commands for printing:
CUPS provides both the System V "lp" and Berkeley "lpr" commands for
printing:
lp filename
lpr filename
Both the "lp" and "lpr" commands support printing options for
the driver:
Both the "lp" and "lpr" commands support printing options for the driver:
lp -omedia=A4 -oresolution=600dpi filename
lpr -omedia=A4 -oresolution=600dpi filename
lp -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, HP-GL/2, and text files, so you can print those
files directly rather than through an application.
CUPS recognizes many types of images files as well as PDF, PostScript,
HP-GL/2, and text files, so you can print those files directly rather than
through an application.
If you have an application that generates output specifically
for your printer then you need to use the "-oraw" or "-l"
options:
If you have an application that generates output specifically for your
printer then you need to use the "-oraw" or "-l" options:
lp -oraw filename
lp -o raw filename
lpr -l filename
This will prevent the filters from misinterpreting your print
@@ -153,22 +150,15 @@ PRINTING FILES
LEGAL STUFF
CUPS is Copyright 2007 by Apple Inc. CUPS, the CUPS logo, and
the Common UNIX Printing System are the trademark property of
Apple Inc.
CUPS is Copyright 2007-2009 by Apple Inc. CUPS and the CUPS logo are
trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
The PDF filter (pdftops) is based on the Xpdf software,
Copyright 1996-2005 by Derek B. Noonburg.
This software is based in part on the work of the Independent JPEG Group.
This software is based in part on the work of the Independent
JPEG Group.
CUPS is provided under the terms of the GNU General Public
License and GNU Library General Public License. This program
is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
"doc/help/license.html" or "LICENSE.txt" files for more
information.
CUPS is provided under the terms of version 2 of the GNU General Public
License and GNU Library General Public License. This program is distributed
in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "doc/help/license.html" or "LICENSE.txt" files for more information.
+75 -49
Ver Arquivo
@@ -1,50 +1,76 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
betest.o: betest.c ../cups/string.h ../config.h
ipp.o: ipp.c ../cups/http-private.h ../config.h ../cups/http.h \
../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/backend.h \
../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/language.h ../cups/i18n.h \
../cups/transcode.h ../cups/string.h
lpd.o: lpd.c ../cups/backend.h ../cups/http-private.h ../config.h \
../cups/http.h ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/i18n.h ../cups/transcode.h ../cups/string.h
pap.o: pap.c ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h \
../cups/backend.h ../cups/sidechannel.h ../cups/i18n.h \
../cups/transcode.h
parallel.o: parallel.c backend-private.h ../cups/backend.h \
../cups/sidechannel.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h \
../cups/debug.h ../cups/i18n.h ../cups/transcode.h ../cups/string.h \
../config.h
scsi.o: scsi.c ../cups/backend.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/i18n.h ../cups/transcode.h ../cups/string.h \
../config.h scsi-linux.c
serial.o: serial.c backend-private.h ../cups/backend.h \
../cups/sidechannel.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h \
../cups/debug.h ../cups/i18n.h ../cups/transcode.h ../cups/string.h \
../config.h
snmp.o: snmp.c ../cups/http-private.h ../config.h ../cups/http.h \
../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h backend-private.h \
../cups/backend.h ../cups/sidechannel.h ../cups/cups.h ../cups/ppd.h \
../cups/array.h ../cups/file.h ../cups/language.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../cups/array.h \
../cups/file.h
socket.o: socket.c ../cups/http-private.h ../config.h ../cups/http.h \
../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h backend-private.h \
../cups/backend.h ../cups/sidechannel.h ../cups/cups.h ../cups/ppd.h \
../cups/array.h ../cups/file.h ../cups/language.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h
test1284.o: test1284.c ../cups/string.h ../config.h ieee1284.c \
backend-private.h ../cups/backend.h ../cups/sidechannel.h \
../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/ppd.h \
../cups/array.h ../cups/file.h ../cups/language.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h
usb.o: usb.c ../cups/backend.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/string.h ../config.h ../cups/i18n.h \
../cups/transcode.h usb-unix.c ieee1284.c backend-private.h \
../cups/sidechannel.h ../cups/debug.h
ipp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/versioning.h
ipp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h backend-private.h
ipp.o: ../cups/backend.h ../cups/sidechannel.h ../cups/ppd-private.h
ipp.o: ../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h
ipp.o: ../cups/language.h ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
ipp.o: ../cups/snmp-private.h ../cups/string.h
lpd.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/versioning.h
lpd.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h backend-private.h
lpd.o: ../cups/backend.h ../cups/sidechannel.h ../cups/ppd-private.h
lpd.o: ../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h
lpd.o: ../cups/language.h ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
lpd.o: ../cups/snmp-private.h ../cups/string.h
dnssd.o: backend-private.h ../cups/backend.h ../cups/versioning.h
dnssd.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
dnssd.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
dnssd.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
dnssd.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
dnssd.o: ../config.h ../cups/array.h
pap.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
pap.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
pap.o: ../cups/language.h ../cups/backend.h ../cups/sidechannel.h
pap.o: ../cups/i18n.h ../cups/transcode.h
parallel.o: backend-private.h ../cups/backend.h ../cups/versioning.h
parallel.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
parallel.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
parallel.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
parallel.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
parallel.o: ../config.h
scsi.o: ../cups/backend.h ../cups/versioning.h ../cups/cups.h ../cups/ipp.h
scsi.o: ../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h
scsi.o: ../cups/language.h ../cups/i18n.h ../cups/transcode.h
scsi.o: ../cups/string.h ../config.h
serial.o: backend-private.h ../cups/backend.h ../cups/versioning.h
serial.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
serial.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
serial.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
serial.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
serial.o: ../config.h
snmp.o: backend-private.h ../cups/backend.h ../cups/versioning.h
snmp.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
snmp.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
snmp.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
snmp.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
snmp.o: ../config.h ../cups/array.h ../cups/file.h ../cups/http-private.h
snmp.o: ../cups/md5.h ../cups/ipp-private.h
socket.o: ../cups/http-private.h ../config.h ../cups/http.h
socket.o: ../cups/versioning.h ../cups/md5.h ../cups/ipp-private.h
socket.o: ../cups/ipp.h backend-private.h ../cups/backend.h
socket.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
socket.o: ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
socket.o: ../cups/snmp-private.h ../cups/string.h
test1284.o: ../cups/string.h ../config.h ieee1284.c backend-private.h
test1284.o: ../cups/backend.h ../cups/versioning.h ../cups/sidechannel.h
test1284.o: ../cups/ppd-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
test1284.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
test1284.o: ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
test1284.o: ../cups/snmp-private.h
testbackend.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
testbackend.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h
testbackend.o: ../cups/array.h ../cups/file.h ../cups/language.h
testbackend.o: ../cups/sidechannel.h
testsupplies.o: backend-private.h ../cups/backend.h ../cups/versioning.h
testsupplies.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
testsupplies.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
testsupplies.o: ../cups/file.h ../cups/language.h ../cups/debug.h
testsupplies.o: ../cups/i18n.h ../cups/transcode.h ../cups/snmp-private.h
testsupplies.o: ../cups/string.h ../config.h
usb.o: backend-private.h ../cups/backend.h ../cups/versioning.h
usb.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
usb.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
usb.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
usb.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
usb.o: ../config.h
+90 -31
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Backend makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,12 +17,13 @@
include ../Makedefs
RBACKENDS = ipp lpd
RBACKENDS = ipp lpd $(DNSSD_BACKEND)
UBACKENDS = $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
TARGETS = betest test1284 libbackend.a $(RBACKENDS) $(UBACKENDS)
LIBOBJS = ieee1284.o runloop.o
OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
serial.o snmp.o socket.o test1284.o usb.o
UNITTESTS = test1284 testbackend testsupplies
TARGETS = libbackend.a $(RBACKENDS) $(UBACKENDS)
LIBOBJS = ieee1284.o network.o runloop.o snmp-supplies.o
OBJS = ipp.o lpd.o dnssd.o pap.o parallel.o scsi.o serial.o snmp.o \
socket.o test1284.o testbackend.o testsupplies.o usb.o
#
@@ -32,12 +33,26 @@ OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
all: $(TARGETS)
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests: $(UNITTESTS)
#
# Clean all object files...
#
clean:
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http
$(RM) $(OBJS) $(TARGETS) $(UNITTESTS) $(LIBOBJS) http mdns
#
@@ -52,16 +67,34 @@ depend:
# Install all targets...
#
install: all
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
#
# Install programs...
#
install-exec:
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
for file in $(RBACKENDS); do \
$(LIBTOOL) $(INSTALL) -m 700 $$file $(SERVERBIN)/backend; \
$(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \
done
for file in $(UBACKENDS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
done
$(RM) $(SERVERBIN)/backend/http
$(LN) ipp $(SERVERBIN)/backend/http
if test "x$(DNSSD_BACKEND)" != x; then \
$(RM) $(SERVERBIN)/backend/mdns; \
$(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \
fi
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(TARGETS); do \
@@ -70,6 +103,20 @@ install: all
fi
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall all targets...
#
@@ -83,15 +130,6 @@ uninstall:
-$(RMDIR) $(SERVERBIN)
#
# betest
#
betest: betest.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o betest betest.o $(LIBS)
#
# test1284
#
@@ -99,7 +137,28 @@ betest: betest.o ../cups/$(LIBCUPS)
test1284: test1284.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/libcups.a \
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
# testbackend
#
testbackend: testbackend.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
# testsupplies
#
testsupplies: testsupplies.o libbackend.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
$(COMMONLIBS) $(LIBZ)
#
@@ -114,24 +173,23 @@ libbackend.a: $(LIBOBJS)
#
# ieee1394
# dnssd
#
ieee1394: ieee1394.o ieee1394-linux.o
dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o ieee1394 ieee1394.o ieee1394-linux.o -lraw1394 $(LIBS)
ieee1394.o: ieee1394.h
ieee1394-linux.o: ieee1394.h
$(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
$(RM) mdns
$(LN) dnssd mdns
#
# ipp
#
ipp: ipp.o ../cups/$(LIBCUPS)
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS)
$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
$(RM) http
$(LN) ipp http
@@ -140,9 +198,9 @@ ipp: ipp.o ../cups/$(LIBCUPS)
# lpd
#
lpd: lpd.o ../cups/$(LIBCUPS)
lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
$(CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
#
@@ -207,8 +265,9 @@ socket: socket.o ../cups/$(LIBCUPS) libbackend.a
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
$(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c
#
+265 -12
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend support definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -25,14 +25,35 @@
# include <cups/backend.h>
# include <cups/sidechannel.h>
# include <cups/cups.h>
# include <cups/ppd-private.h>
# include <cups/debug.h>
# include <cups/i18n.h>
# include <cups/snmp-private.h>
# include <stdlib.h>
# include <errno.h>
# include <cups/string.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...
@@ -43,20 +64,252 @@ 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
/* 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
/*
* Prototypes...
*/
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,
int make_model_size);
extern ssize_t backendRunLoop(int print_fd, int device_fd, int use_bc,
void (*side_cb)(int print_fd, int device_fd,
int use_bc));
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,
int make_model_size);
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,
int (*side_cb)(int print_fd,
int device_fd,
int snmp_fd,
http_addr_t *addr,
int use_bc));
extern int backendSNMPSupplies(int snmp_fd, http_addr_t *addr,
int *page_count,
int *printer_state);
# ifdef __cplusplus
}
-78
Ver Arquivo
@@ -1,78 +0,0 @@
/*
* "$Id$"
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 1997-2005 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"
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Run the named backend.
*/
/*
* Include necessary headers.
*/
#include <stdio.h>
#include <stdlib.h>
#include <cups/string.h>
#include <unistd.h>
/*
* 'main()' - Run the named backend.
*
* Usage:
*
* betest device-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (7 or 8) */
char *argv[]) /* I - Command-line arguments */
{
char backend[255]; /* Method in URI */
if (argc < 7 || argc > 8)
{
fputs("Usage: betest device-uri job-id user title copies options [file]\n",
stderr);
return (1);
}
/*
* Extract the method from the device-uri - that's the program we want to
* execute.
*/
if (sscanf(argv[1], "%254[^:]", backend) != 1)
{
fputs("betest: Bad device-uri - no colon!\n", stderr);
return (1);
}
/*
* Execute and return
*/
execl(backend, argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7],
NULL);
return (1);
}
/*
* End of "$Id$".
*/
+912
Ver Arquivo
@@ -0,0 +1,912 @@
/*
* "$Id$"
*
* DNS-SD discovery backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2008-2009 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"
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Browse for printers.
* browse_callback() - Browse devices.
* browse_local_callback() - Browse local devices.
* compare_devices() - Compare two devices.
* exec_backend() - Execute the backend that corresponds to the
* resolved service name.
* get_device() - Create or update a device.
* query_callback() - Process query data.
* sigterm_handler() - Handle termination signals...
* unquote() - Unquote a name string.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#include <cups/array.h>
#include <dns_sd.h>
/*
* Device structure...
*/
typedef enum
{
CUPS_DEVICE_PRINTER = 0, /* lpd://... */
CUPS_DEVICE_IPP, /* ipp://... */
CUPS_DEVICE_FAX_IPP, /* ipp://... */
CUPS_DEVICE_PDL_DATASTREAM, /* socket://... */
CUPS_DEVICE_RIOUSBPRINT /* riousbprint://... */
} cups_devtype_t;
typedef struct
{
DNSServiceRef ref; /* Service reference for resolve */
char *name, /* Service name */
*domain, /* Domain name */
*fullName, /* Full name */
*make_and_model, /* Make and model from TXT record */
*device_id; /* 1284 device ID from TXT record */
cups_devtype_t type; /* Device registration type */
int priority, /* Priority associated with type */
cups_shared, /* CUPS shared printer? */
sent; /* Did we list the device? */
} cups_device_t;
/*
* Local globals...
*/
static int job_canceled = 0;
/* Set to 1 on SIGTERM */
/*
* Local functions...
*/
static void browse_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain, void *context);
static void browse_local_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain,
void *context);
static int compare_devices(cups_device_t *a, cups_device_t *b);
static void exec_backend(char **argv);
static cups_device_t *get_device(cups_array_t *devices,
const char *serviceName,
const char *regtype,
const char *replyDomain);
static void query_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *fullName, uint16_t rrtype,
uint16_t rrclass, uint16_t rdlen,
const void *rdata, uint32_t ttl,
void *context);
static void sigterm_handler(int sig);
static void unquote(char *dst, const char *src, size_t dstsize);
/*
* 'main()' - Browse for printers.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
const char *name; /* Backend name */
DNSServiceRef main_ref, /* Main service reference */
fax_ipp_ref, /* IPP fax service reference */
ipp_ref, /* IPP service reference */
ipp_tls_ref, /* IPP w/TLS service reference */
local_fax_ipp_ref, /* Local IPP fax service reference */
local_ipp_ref, /* Local IPP service reference */
local_ipp_tls_ref, /* Local IPP w/TLS service reference */
local_printer_ref, /* Local LPD service reference */
pdl_datastream_ref, /* AppSocket service reference */
printer_ref, /* LPD service reference */
riousbprint_ref; /* Remote IO service reference */
int fd; /* Main file descriptor */
fd_set input; /* Input set for select() */
struct timeval timeout; /* Timeout for select() */
cups_array_t *devices; /* Device array */
cups_device_t *device; /* Current device */
char uriName[1024]; /* Unquoted fullName for URI */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Don't buffer stderr, and catch SIGTERM...
*/
setbuf(stderr, NULL);
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, sigterm_handler);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = sigterm_handler;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, sigterm_handler);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
if (argc >= 6)
exec_backend(argv);
else if (argc != 1)
{
fprintf(stderr, "Usage: %s job user title copies options [filename(s)]\n",
argv[0]);
return (1);
}
/*
* Only do discovery when run as "dnssd"...
*/
if ((name = strrchr(argv[0], '/')) != NULL)
name ++;
else
name = argv[0];
if (strcmp(name, "dnssd"))
return (0);
/*
* Create an array to track devices...
*/
devices = cupsArrayNew((cups_array_func_t)compare_devices, NULL);
/*
* Browse for different kinds of printers...
*/
if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError)
{
perror("ERROR: Unable to create service connection");
return (1);
}
fd = DNSServiceRefSockFD(main_ref);
fax_ipp_ref = main_ref;
DNSServiceBrowse(&fax_ipp_ref, kDNSServiceFlagsShareConnection, 0,
"_fax-ipp._tcp", NULL, browse_callback, devices);
ipp_ref = main_ref;
DNSServiceBrowse(&ipp_ref, kDNSServiceFlagsShareConnection, 0,
"_ipp._tcp", NULL, browse_callback, devices);
ipp_tls_ref = main_ref;
DNSServiceBrowse(&ipp_tls_ref, kDNSServiceFlagsShareConnection, 0,
"_ipp-tls._tcp", NULL, browse_callback, devices);
local_fax_ipp_ref = main_ref;
DNSServiceBrowse(&local_fax_ipp_ref, kDNSServiceFlagsShareConnection,
kDNSServiceInterfaceIndexLocalOnly,
"_fax-ipp._tcp", NULL, browse_local_callback, devices);
local_ipp_ref = main_ref;
DNSServiceBrowse(&local_ipp_ref, kDNSServiceFlagsShareConnection,
kDNSServiceInterfaceIndexLocalOnly,
"_ipp._tcp", NULL, browse_local_callback, devices);
local_ipp_tls_ref = main_ref;
DNSServiceBrowse(&local_ipp_tls_ref, kDNSServiceFlagsShareConnection,
kDNSServiceInterfaceIndexLocalOnly,
"_ipp-tls._tcp", NULL, browse_local_callback, devices);
local_printer_ref = main_ref;
DNSServiceBrowse(&local_printer_ref, kDNSServiceFlagsShareConnection,
kDNSServiceInterfaceIndexLocalOnly,
"_printer._tcp", NULL, browse_local_callback, devices);
pdl_datastream_ref = main_ref;
DNSServiceBrowse(&pdl_datastream_ref, kDNSServiceFlagsShareConnection, 0,
"_pdl-datastream._tcp", NULL, browse_callback, devices);
printer_ref = main_ref;
DNSServiceBrowse(&printer_ref, kDNSServiceFlagsShareConnection, 0,
"_printer._tcp", NULL, browse_callback, devices);
riousbprint_ref = main_ref;
DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0,
"_riousbprint._tcp", NULL, browse_callback, devices);
/*
* Loop until we are killed...
*/
while (!job_canceled)
{
FD_ZERO(&input);
FD_SET(fd, &input);
timeout.tv_sec = 1;
timeout.tv_usec = 0;
if (select(fd + 1, &input, NULL, NULL, &timeout) < 0)
continue;
if (FD_ISSET(fd, &input))
{
/*
* Process results of our browsing...
*/
DNSServiceProcessResult(main_ref);
}
else
{
/*
* Announce any devices we've found...
*/
DNSServiceErrorType status; /* DNS query status */
cups_device_t *best; /* Best matching device */
char device_uri[1024]; /* Device URI */
int count; /* Number of queries */
for (device = (cups_device_t *)cupsArrayFirst(devices),
best = NULL, count = 0;
device;
device = (cups_device_t *)cupsArrayNext(devices))
if (!device->ref && !device->sent)
{
/*
* Found the device, now get the TXT record(s) for it...
*/
if (count < 10)
{
device->ref = main_ref;
fprintf(stderr, "DEBUG: Querying \"%s\"...\n", device->fullName);
status = DNSServiceQueryRecord(&(device->ref),
kDNSServiceFlagsShareConnection,
0, device->fullName,
kDNSServiceType_TXT,
kDNSServiceClass_IN, query_callback,
devices);
if (status != kDNSServiceErr_NoError)
{
fputs("ERROR: Unable to query for TXT records!\n", stderr);
fprintf(stderr, "DEBUG: DNSServiceQueryRecord returned %d\n",
status);
}
else
count ++;
}
}
else if (!device->sent)
{
/*
* Got the TXT records, now report the device...
*/
DNSServiceRefDeallocate(device->ref);
device->ref = 0;
if (!best)
best = device;
else if (strcasecmp(best->name, device->name) ||
strcasecmp(best->domain, device->domain))
{
unquote(uriName, best->fullName, sizeof(uriName));
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
"dnssd", NULL, uriName, 0,
best->cups_shared ? "/cups" : "/");
cupsBackendReport("network", device_uri, best->make_and_model,
best->name, best->device_id, NULL);
best->sent = 1;
best = device;
}
else if (best->priority > device->priority ||
(best->priority == device->priority &&
best->type < device->type))
{
best->sent = 1;
best = device;
}
else
device->sent = 1;
}
if (best)
{
unquote(uriName, best->fullName, sizeof(uriName));
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
"dnssd", NULL, uriName, 0,
best->cups_shared ? "/cups" : "/");
cupsBackendReport("network", device_uri, best->make_and_model,
best->name, best->device_id, NULL);
best->sent = 1;
}
}
}
return (CUPS_BACKEND_OK);
}
/*
* 'browse_callback()' - Browse devices.
*/
static void
browse_callback(
DNSServiceRef sdRef, /* I - Service reference */
DNSServiceFlags flags, /* I - Option flags */
uint32_t interfaceIndex, /* I - Interface number */
DNSServiceErrorType errorCode, /* I - Error, if any */
const char *serviceName, /* I - Name of service/device */
const char *regtype, /* I - Type of service */
const char *replyDomain, /* I - Service domain */
void *context) /* I - Devices array */
{
fprintf(stderr, "DEBUG2: browse_callback(sdRef=%p, flags=%x, "
"interfaceIndex=%d, errorCode=%d, serviceName=\"%s\", "
"regtype=\"%s\", replyDomain=\"%s\", context=%p)\n",
sdRef, flags, interfaceIndex, errorCode,
serviceName ? serviceName : "(null)",
regtype ? regtype : "(null)",
replyDomain ? replyDomain : "(null)",
context);
/*
* Only process "add" data...
*/
if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
return;
/*
* Get the device...
*/
get_device((cups_array_t *)context, serviceName, regtype, replyDomain);
}
/*
* 'browse_local_callback()' - Browse local devices.
*/
static void
browse_local_callback(
DNSServiceRef sdRef, /* I - Service reference */
DNSServiceFlags flags, /* I - Option flags */
uint32_t interfaceIndex, /* I - Interface number */
DNSServiceErrorType errorCode, /* I - Error, if any */
const char *serviceName, /* I - Name of service/device */
const char *regtype, /* I - Type of service */
const char *replyDomain, /* I - Service domain */
void *context) /* I - Devices array */
{
cups_device_t *device; /* Device */
fprintf(stderr, "DEBUG2: browse_local_callback(sdRef=%p, flags=%x, "
"interfaceIndex=%d, errorCode=%d, serviceName=\"%s\", "
"regtype=\"%s\", replyDomain=\"%s\", context=%p)\n",
sdRef, flags, interfaceIndex, errorCode,
serviceName ? serviceName : "(null)",
regtype ? regtype : "(null)",
replyDomain ? replyDomain : "(null)",
context);
/*
* Only process "add" data...
*/
if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
return;
/*
* Get the device...
*/
device = get_device((cups_array_t *)context, serviceName, regtype,
replyDomain);
/*
* Hide locally-registered devices...
*/
fprintf(stderr, "DEBUG: Hiding local printer \"%s\"...\n",
device->fullName);
device->sent = 1;
}
/*
* 'compare_devices()' - Compare two devices.
*/
static int /* O - Result of comparison */
compare_devices(cups_device_t *a, /* I - First device */
cups_device_t *b) /* I - Second device */
{
return (strcmp(a->name, b->name));
}
/*
* 'exec_backend()' - Execute the backend that corresponds to the
* resolved service name.
*/
static void
exec_backend(char **argv) /* I - Command-line arguments */
{
const char *resolved_uri, /* Resolved device URI */
*cups_serverbin; /* Location of programs */
char scheme[1024], /* Scheme from URI */
*ptr, /* Pointer into scheme */
filename[1024]; /* Backend filename */
/*
* Resolve the device URI...
*/
job_canceled = -1;
if ((resolved_uri = cupsBackendDeviceURI(argv)) == NULL)
exit(CUPS_BACKEND_FAILED);
/*
* Extract the scheme from the URI...
*/
strlcpy(scheme, resolved_uri, sizeof(scheme));
if ((ptr = strchr(scheme, ':')) != NULL)
*ptr = '\0';
/*
* Get the filename of the backend...
*/
if ((cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
cups_serverbin = CUPS_SERVERBIN;
snprintf(filename, sizeof(filename), "%s/backend/%s", cups_serverbin, scheme);
/*
* Overwrite the device URI and run the new backend...
*/
setenv("DEVICE_URI", resolved_uri, 1);
argv[0] = (char *)resolved_uri;
fprintf(stderr, "DEBUG: Executing backend \"%s\"...\n", filename);
execv(filename, argv);
fprintf(stderr, "ERROR: Unable to execute backend \"%s\": %s\n", filename,
strerror(errno));
exit(CUPS_BACKEND_STOP);
}
/*
* 'get_device()' - Create or update a device.
*/
static cups_device_t * /* O - Device */
get_device(cups_array_t *devices, /* I - Device array */
const char *serviceName, /* I - Name of service/device */
const char *regtype, /* I - Type of service */
const char *replyDomain) /* I - Service domain */
{
cups_device_t key, /* Search key */
*device; /* Device */
char fullName[kDNSServiceMaxDomainName];
/* Full name for query */
/*
* See if this is a new device...
*/
key.name = (char *)serviceName;
if (!strcmp(regtype, "_ipp._tcp.") ||
!strcmp(regtype, "_ipp-tls._tcp."))
key.type = CUPS_DEVICE_IPP;
else if (!strcmp(regtype, "_fax-ipp._tcp."))
key.type = CUPS_DEVICE_FAX_IPP;
else if (!strcmp(regtype, "_printer._tcp."))
key.type = CUPS_DEVICE_PRINTER;
else if (!strcmp(regtype, "_pdl-datastream._tcp."))
key.type = CUPS_DEVICE_PDL_DATASTREAM;
else
key.type = CUPS_DEVICE_RIOUSBPRINT;
for (device = cupsArrayFind(devices, &key);
device;
device = cupsArrayNext(devices))
if (strcasecmp(device->name, key.name))
break;
else if (device->type == key.type)
{
if (!strcasecmp(device->domain, "local.") &&
strcasecmp(device->domain, replyDomain))
{
/*
* Update the .local listing to use the "global" domain name instead.
* The backend will try local lookups first, then the global domain name.
*/
free(device->domain);
device->domain = strdup(replyDomain);
DNSServiceConstructFullName(fullName, device->name, regtype,
replyDomain);
free(device->fullName);
device->fullName = strdup(fullName);
}
return (device);
}
/*
* Yes, add the device...
*/
fprintf(stderr, "DEBUG: Found \"%s.%s%s\"...\n", serviceName, regtype,
replyDomain);
device = calloc(sizeof(cups_device_t), 1);
device->name = strdup(serviceName);
device->domain = strdup(replyDomain);
device->type = key.type;
device->priority = 50;
cupsArrayAdd(devices, device);
/*
* Set the "full name" of this service, which is used for queries...
*/
DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
device->fullName = strdup(fullName);
return (device);
}
/*
* 'query_callback()' - Process query data.
*/
static void
query_callback(
DNSServiceRef sdRef, /* I - Service reference */
DNSServiceFlags flags, /* I - Data flags */
uint32_t interfaceIndex, /* I - Interface */
DNSServiceErrorType errorCode, /* I - Error, if any */
const char *fullName, /* I - Full service name */
uint16_t rrtype, /* I - Record type */
uint16_t rrclass, /* I - Record class */
uint16_t rdlen, /* I - Length of record data */
const void *rdata, /* I - Record data */
uint32_t ttl, /* I - Time-to-live */
void *context) /* I - Devices array */
{
cups_array_t *devices; /* Device array */
char name[1024], /* Service name */
*ptr; /* Pointer into string */
cups_device_t dkey, /* Search key */
*device; /* Device */
fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, "
"interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
"rrtype=%u, rrclass=%u, rdlen=%u, rdata=%p, ttl=%u, "
"context=%p)\n",
sdRef, flags, interfaceIndex, errorCode,
fullName ? fullName : "(null)", rrtype, rrclass, rdlen, rdata, ttl,
context);
/*
* Only process "add" data...
*/
if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
return;
/*
* Lookup the service in the devices array.
*/
devices = (cups_array_t *)context;
dkey.name = name;
unquote(name, fullName, sizeof(name));
if ((dkey.domain = strstr(name, "._tcp.")) != NULL)
dkey.domain += 6;
else
dkey.domain = (char *)"local.";
if ((ptr = strstr(name, "._")) != NULL)
*ptr = '\0';
if (strstr(fullName, "_ipp._tcp.") ||
strstr(fullName, "_ipp-tls._tcp."))
dkey.type = CUPS_DEVICE_IPP;
else if (strstr(fullName, "_fax-ipp._tcp."))
dkey.type = CUPS_DEVICE_FAX_IPP;
else if (strstr(fullName, "_printer._tcp."))
dkey.type = CUPS_DEVICE_PRINTER;
else if (strstr(fullName, "_pdl-datastream._tcp."))
dkey.type = CUPS_DEVICE_PDL_DATASTREAM;
else
dkey.type = CUPS_DEVICE_RIOUSBPRINT;
for (device = cupsArrayFind(devices, &dkey);
device;
device = cupsArrayNext(devices))
{
if (strcasecmp(device->name, dkey.name) ||
strcasecmp(device->domain, dkey.domain))
{
device = NULL;
break;
}
else if (device->type == dkey.type)
{
/*
* Found it, pull out the priority and make and model from the TXT
* record and save it...
*/
const uint8_t *data, /* Pointer into data */
*datanext, /* Next key/value pair */
*dataend; /* End of entire TXT record */
uint8_t datalen; /* Length of current key/value pair */
char key[256], /* Key string */
value[256], /* Value string */
make_and_model[512],
/* Manufacturer and model */
model[256], /* Model */
device_id[2048];/* 1284 device ID */
device_id[0] = '\0';
make_and_model[0] = '\0';
strcpy(model, "Unknown");
for (data = rdata, dataend = data + rdlen;
data < dataend;
data = datanext)
{
/*
* Read a key/value pair starting with an 8-bit length. Since the
* length is 8 bits and the size of the key/value buffers is 256, we
* don't need to check for overflow...
*/
datalen = *data++;
if (!datalen || (data + datalen) >= dataend)
break;
datanext = data + datalen;
for (ptr = key; data < datanext && *data != '='; data ++)
*ptr++ = *data;
*ptr = '\0';
if (data < datanext && *data == '=')
{
data ++;
if (data < datanext)
memcpy(value, data, datanext - data);
value[datanext - data] = '\0';
}
else
continue;
if (!strncasecmp(key, "usb_", 4))
{
/*
* Add USB device ID information...
*/
ptr = device_id + strlen(device_id);
snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%s:%s;",
key + 4, value);
}
if (!strcasecmp(key, "usb_MFG") || !strcasecmp(key, "usb_MANU") ||
!strcasecmp(key, "usb_MANUFACTURER"))
strcpy(make_and_model, value);
else if (!strcasecmp(key, "usb_MDL") || !strcasecmp(key, "usb_MODEL"))
strcpy(model, value);
else if (!strcasecmp(key, "product") && !strstr(value, "Ghostscript"))
{
if (value[0] == '(')
{
/*
* Strip parenthesis...
*/
if ((ptr = value + strlen(value) - 1) > value && *ptr == ')')
*ptr = '\0';
strcpy(model, value + 1);
}
else
strcpy(model, value);
}
else if (!strcasecmp(key, "ty"))
{
strcpy(model, value);
if ((ptr = strchr(model, ',')) != NULL)
*ptr = '\0';
}
else if (!strcasecmp(key, "priority"))
device->priority = atoi(value);
else if ((device->type == CUPS_DEVICE_IPP ||
device->type == CUPS_DEVICE_PRINTER) &&
!strcasecmp(key, "printer-type"))
{
/*
* This is a CUPS printer!
*/
device->cups_shared = 1;
if (device->type == CUPS_DEVICE_PRINTER)
device->sent = 1;
}
}
if (device->device_id)
free(device->device_id);
if (!device_id[0] && strcmp(model, "Unknown"))
{
if (make_and_model[0])
snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;",
make_and_model, model);
else if (!strncasecmp(model, "designjet ", 10))
snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10);
else if (!strncasecmp(model, "stylus ", 7))
snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7);
else if ((ptr = strchr(model, ' ')) != NULL)
{
/*
* Assume the first word is the make...
*/
memcpy(make_and_model, model, ptr - model);
make_and_model[ptr - model] = '\0';
snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
make_and_model, ptr + 1);
}
}
if (device_id[0])
device->device_id = strdup(device_id);
else
device->device_id = NULL;
if (device->make_and_model)
free(device->make_and_model);
if (make_and_model[0])
{
strlcat(make_and_model, " ", sizeof(make_and_model));
strlcat(make_and_model, model, sizeof(make_and_model));
device->make_and_model = strdup(make_and_model);
}
else
device->make_and_model = strdup(model);
break;
}
}
if (!device)
fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
}
/*
* 'sigterm_handler()' - Handle termination signals...
*/
static void
sigterm_handler(int sig) /* I - Signal number (unused) */
{
if (job_canceled)
exit(CUPS_BACKEND_OK);
else
job_canceled = 1;
}
/*
* 'unquote()' - Unquote a name string.
*/
static void
unquote(char *dst, /* I - Destination buffer */
const char *src, /* I - Source string */
size_t dstsize) /* I - Size of destination buffer */
{
char *dstend = dst + dstsize - 1; /* End of destination buffer */
while (*src && dst < dstend)
{
if (*src == '\\')
{
src ++;
if (isdigit(src[0] & 255) && isdigit(src[1] & 255) &&
isdigit(src[2] & 255))
{
*dst++ = ((((src[0] - '0') * 10) + src[1] - '0') * 10) + src[2] - '0';
src += 3;
}
else
*dst++ = *src++;
}
else
*dst++ = *src ++;
}
*dst = '\0';
}
/*
* End of "$Id$".
*/
+209 -264
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -27,22 +27,6 @@
#include "backend-private.h"
#ifdef __linux
# include <sys/ioctl.h>
# include <linux/lp.h>
# define IOCNR_GET_DEVICE_ID 1
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
#endif /* __linux */
#ifdef __sun
# ifdef __sparc
# include <sys/ecppio.h>
# else
# include <sys/ioccom.h>
# include <sys/ecppsys.h>
# endif /* __sparc */
#endif /* __sun */
/*
* 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
@@ -60,18 +44,17 @@ backendGetDeviceID(
char *uri, /* O - Device URI */
int uri_size) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
manufacturer[256], /* Manufacturer string */
serial_number[1024]; /* Serial number string */
int manulen; /* Length of manufacturer string */
#ifdef __linux
#ifdef __APPLE__ /* This function is a no-op */
return (-1);
#else /* Get the device ID from the specified file descriptor... */
# ifdef __linux
int length; /* Length of device ID info */
#endif /* __linux */
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
int got_id = 0;
# endif /* __linux */
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
struct ecpp_device_id did; /* Device ID buffer */
#endif /* __sun && ECPPIOC_GETDEVID */
# endif /* __sun && ECPPIOC_GETDEVID */
DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
@@ -93,9 +76,6 @@ backendGetDeviceID(
if (make_model)
*make_model = '\0';
if (uri)
*uri = '\0';
if (fd >= 0)
{
/*
@@ -104,8 +84,83 @@ backendGetDeviceID(
*device_id = '\0';
#ifdef __linux
if (!ioctl(fd, LPIOC_GET_DEVICE_ID(device_id_size), device_id))
# ifdef __linux
if (ioctl(fd, LPIOC_GET_DEVICE_ID(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,
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
@@ -121,12 +176,19 @@ backendGetDeviceID(
* and then limit the length to the size of our buffer...
*/
if (length > (device_id_size - 2))
if (length > device_id_size)
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (device_id_size - 2))
length = device_id_size - 2;
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).
*/
length -= 2;
/*
* Copy the device ID text to the beginning of the buffer and
@@ -136,13 +198,14 @@ backendGetDeviceID(
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
# ifdef DEBUG
# ifdef DEBUG
else
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __linux */
DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
strerror(errno)));
# endif /* DEBUG */
# endif /* __linux */
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
did.mode = ECPP_CENTRONICS;
did.len = device_id_size - 1;
did.rlen = 0;
@@ -159,15 +222,19 @@ backendGetDeviceID(
else
device_id[device_id_size - 1] = '\0';
}
# ifdef DEBUG
# ifdef DEBUG
else
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __sun && ECPPIOC_GETDEVID */
DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
strerror(errno)));
# endif /* DEBUG */
# endif /* __sun && ECPPIOC_GETDEVID */
}
DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
if (scheme && uri)
*uri = '\0';
if (!*device_id)
return (-1);
@@ -184,111 +251,69 @@ backendGetDeviceID(
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 */
/*
* Look for the serial number field...
* Get the make, model, and serial numbers...
*/
if ((attr = strstr(device_id, "SERN:")) != NULL)
attr += 5;
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, ";SN:")) != NULL)
attr += 4;
num_values = _ppdGet1284Values(device_id, &values);
if (attr)
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)
{
strlcpy(serial_number, attr, sizeof(serial_number));
if ((delim = strchr(serial_number, ';')) != NULL)
*delim = '\0';
if (!strcasecmp(mfg, "Hewlett-Packard"))
mfg = "HP";
else if (!strcasecmp(mfg, "Lexmark International"))
mfg = "Lexmark";
}
else
serial_number[0] = '\0';
{
strlcpy(temp, make_model, sizeof(temp));
if ((tempptr = strchr(temp, ' ')) != NULL)
*tempptr = '\0';
mfg = temp;
}
if (!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.
*/
snprintf(uri, uri_size, "%s://", scheme);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, scheme, NULL, mfg, 0,
"/%s%s%s", mdl, sern ? "?serial=" : "", sern ? sern : "");
if ((attr = strstr(device_id, "MANUFACTURER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, "Manufacturer:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, "MFG:")) != NULL)
attr += 4;
if (attr)
{
strlcpy(manufacturer, attr, sizeof(manufacturer));
if ((delim = strchr(manufacturer, ';')) != NULL)
*delim = '\0';
if (!strcasecmp(manufacturer, "Hewlett-Packard"))
strcpy(manufacturer, "HP");
else if (!strcasecmp(manufacturer, "Lexmark International"))
strcpy(manufacturer, "Lexmark");
}
else
{
strlcpy(manufacturer, make_model, sizeof(manufacturer));
if ((delim = strchr(manufacturer, ' ')) != NULL)
*delim = '\0';
}
manulen = strlen(manufacturer);
for (uriptr = uri + strlen(uri), delim = manufacturer;
*delim && uriptr < (uri + uri_size - 3);
delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
*uriptr++ = '/';
if (!strncasecmp(make_model, manufacturer, manulen))
{
delim = make_model + manulen;
while (isspace(*delim & 255))
delim ++;
}
else
delim = make_model;
for (; *delim && uriptr < (uri + uri_size - 3); delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
if (serial_number[0])
{
/*
* Add the serial number to the URI...
*/
strlcpy(uriptr, "?serial=", uri_size - (uriptr - uri));
strlcat(uriptr, serial_number, uri_size - (uriptr - uri));
}
else
*uriptr = '\0';
cupsFreeOptions(num_values, values);
}
return (0);
#endif /* __APPLE__ */
}
@@ -302,10 +327,11 @@ backendGetMakeModel(
char *make_model, /* O - Make/model */
int make_model_size) /* I - Size of buffer */
{
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*mfg, /* Manufacturer string */
*mdl; /* Model string */
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 */
DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
@@ -328,12 +354,42 @@ backendGetMakeModel(
* Look for the description field...
*/
if ((attr = strstr(device_id, "DES:")) != NULL)
attr += 4;
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
attr += 12;
num_values = _ppdGet1284Values(device_id, &values);
if (attr)
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 || !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
@@ -344,119 +400,30 @@ backendGetMakeModel(
* containing at least one space and one letter.
*/
if ((delim = strchr(attr, ';')) == NULL)
delim = attr + strlen(attr);
if ((delim - attr) < 8)
attr = NULL;
else
if (strlen(des) >= 8)
{
char *ptr; /* Pointer into description */
int letters, /* Number of letters seen */
spaces; /* Number of spaces seen */
const char *ptr; /* Pointer into description */
int letters, /* Number of letters seen */
spaces; /* Number of spaces seen */
for (ptr = attr, letters = 0, spaces = 0; ptr < delim; ptr ++)
for (ptr = des, letters = 0, spaces = 0; *ptr; ptr ++)
{
if (isspace(*ptr & 255))
if (isspace(*ptr & 255))
spaces ++;
else if (isalpha(*ptr & 255))
letters ++;
if (spaces && letters)
if (spaces && letters)
break;
}
if (!spaces || !letters)
attr = NULL;
if (spaces && letters)
_ppdNormalizeMakeAndModel(des, make_model, make_model_size);
}
}
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "Manufacturer:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
mfg += 4;
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "Model:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
mdl += 4;
if (mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
if (mfg)
{
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
strlcpy(make_model, "HP", make_model_size);
else if (!strncasecmp(mfg, "Lexmark International", 21))
strlcpy(make_model, "Lexmark", make_model_size);
else
strlcpy(make_model, mfg, make_model_size);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
if (!strncasecmp(make_model, mdl, strlen(make_model)))
{
/*
* Just copy model string, since it has the manufacturer...
*/
strlcpy(make_model, mdl, make_model_size);
}
else
{
/*
* Concatenate the make and model...
*/
strlcat(make_model, " ", make_model_size);
strlcat(make_model, mdl, make_model_size);
}
}
else
{
/*
* Just copy model string, since it has the manufacturer...
*/
strlcpy(make_model, mdl, make_model_size);
}
}
else if (attr)
{
/*
* Use description...
*/
if (!strncasecmp(attr, "Hewlett-Packard hp ", 19))
{
/*
* Check for a common HP bug...
*/
strlcpy(make_model, "HP ", make_model_size);
strlcpy(make_model + 3, attr + 19, make_model_size - 3);
}
else if (!strncasecmp(attr, "Hewlett-Packard ", 16))
{
strlcpy(make_model, "HP ", make_model_size);
strlcpy(make_model + 3, attr + 16, make_model_size - 3);
}
else
{
strlcpy(make_model, attr, make_model_size);
}
}
else
if (!make_model[0])
{
/*
* Use "Unknown" as the printer make and model...
@@ -465,31 +432,9 @@ backendGetMakeModel(
strlcpy(make_model, "Unknown", make_model_size);
}
/*
* Strip trailing data...
*/
cupsFreeOptions(num_values, values);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
/*
* Strip trailing whitespace...
*/
for (delim = make_model + strlen(make_model) - 1; delim >= make_model; delim --)
if (isspace(*delim & 255))
*delim = '\0';
else
break;
/*
* Return...
*/
if (make_model[0])
return (0);
else
return (-1);
return (0);
}
-878
Ver Arquivo
@@ -1,878 +0,0 @@
/*
* "$Id$"
*
* Linux IEEE-1394 glue for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2002 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use
* of this software must display the following
* acknowledgement:
*
* This product includes software developed by Easy
* Software Products.
*
* 4. The name of Easy Software Products may not be used to
* endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* Contents:
*
* get_device_id() - Get the IEEE-1284 device ID for a node...
* get_unit_type() - Get the unit type for a node...
* show_data() - Show a data node...
* show_dir() - Show a directory list...
* ieee1394_list() - List the available printer devices.
* ieee1394_open() - Open a printer device.
* ieee1394_close() - Close a printer device.
* ieee1394_read() - Read from a printer device.
* ieee1394_write() - Write data to a printer device.
* ieee1394_error() - Return the last error.
*/
/*
* Include necessary headers.
*/
#include "ieee1394.h"
#include <cups/debug.h>
#include <libraw1394/raw1394.h>
#include <libraw1394/csr.h>
/*
* Limits...
*/
#define MAX_NODES 100
/*
* Structures...
*/
typedef struct
{
char uri[HTTP_MAX_URI],/* URI for this node... */
description[128],/* Description of port */
make_model[128];/* Make and model */
int port, /* Port where this node is found */
node; /* Node number */
unsigned long long addr; /* Management address */
} linux1394_node_t;
typedef struct
{
raw1394handle_t handle; /* Handle for printer device */
int node; /* Node number for printer device */
unsigned long long addr; /* Management address */
} linux1394_dev_t;
/*
* ORB messages for communication with the device...
*/
typedef struct /**** Login ORB Message */
{
unsigned char passwd_addr[8]; /* Password address */
unsigned char resp_addr[8]; /* Login response address */
unsigned char notify_excl; /* Notify and exclusive bits */
unsigned char recon_func; /* Reconnect time and function */
unsigned char lun[2]; /* Logical unit number */
unsigned char passwd_len[2]; /* Length of password */
unsigned char resp_len[2]; /* Length of login response */
unsigned char fifo_addr[8]; /* Local status FIFO address */
} login_orb_t;
typedef struct /**** Login Response Message ****/
{
unsigned char length[2]; /* Length of response */
unsigned char login_id[2]; /* Login ID */
unsigned char cmd_addr[8]; /* Command block agent address */
unsigned char reserved[2]; /* Reserved (0) */
unsigned char recon_hold[2]; /* Number of seconds to hold login */
} login_resp_t;
/*
* Local globals...
*/
static char error_string[1024] = "";
static int num_nodes;
static linux1394_node_t nodes[MAX_NODES];
/*
* 'get_device_id()' - Get the IEEE-1284 device ID for a node...
*/
static char * /* O - Device ID */
get_device_id(raw1394handle_t handle,/* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset,/* I - Offset to directory */
char *id, /* O - ID string */
int idlen) /* I - Size of ID string */
{
unsigned char data[1024], /* Data from ROM */
*dataptr; /* Pointer into data */
int length; /* Length of directory */
int datalen; /* Length of data */
unsigned long long dataoff; /* Offset of data */
DEBUG_printf(("get_device_id(handle = %p, node = %d, offset = %llx, id = %p, idlen = %d)\n",
handle, node, offset, id, idlen));
*id = '\0';
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (NULL);
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
DEBUG_printf((" length = %d\n", length));
/*
* Then read the directory, looking for unit directory or device tags...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (NULL);
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
data[2], data[3]));
if (data[0] == 0xd1)
{
/*
* Found the unit directory...
*/
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
return (get_device_id(handle, node, offset, id, idlen));
}
else if (data[0] == 0x81)
{
/*
* Found potential IEEE-1284 device ID...
*/
dataoff = offset + (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
if (raw1394_read(handle, 0xffc0 | node, dataoff, 4, (quadlet_t *)data) < 0)
return (NULL);
dataoff += 4;
/*
* Read the leaf value...
*/
datalen = (data[0] << 8) | data[1];
if (datalen > (sizeof(data) / 4))
datalen = sizeof(data) / 4;
for (dataptr = data; datalen > 0; datalen --, dataptr += 4, dataoff += 4)
if (raw1394_read(handle, 0xffc0 | node, dataoff, 4,
(quadlet_t *)dataptr) < 0)
return (NULL);
if (data[0] == 0 && memcmp(data + 8, "MFG:", 4) == 0)
{
/*
* Found the device ID...
*/
datalen = dataptr - data - 8;
if (datalen >= idlen)
datalen --;
memcpy(id, data + 8, datalen);
id[datalen] = '\0';
return (id);
}
}
offset += 4;
length --;
}
return (NULL);
}
/*
* 'get_man_addr()' - Get the management address for a node...
*/
static int /* O - Unit type */
get_man_addr(raw1394handle_t handle, /* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset) /* I - Offset to directory */
{
unsigned char data[4]; /* Data from ROM */
int length; /* Length of directory */
DEBUG_printf(("get_man_addr(handle = %p, node = %d, offset = %llx)\n",
handle, node, offset));
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
DEBUG_printf((" length = %d\n", length));
/*
* Then read the directory, looking for unit directory or type tags...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
data[2], data[3]));
if (data[0] == 0xd1)
{
/*
* Found the unit directory...
*/
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
return (get_man_addr(handle, node, offset));
}
else if (data[0] == 0x54)
{
/*
* Found the management address...
*/
return (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
}
offset += 4;
length --;
}
return (-1);
}
/*
* 'get_unit_type()' - Get the unit type for a node...
*/
static int /* O - Unit type */
get_unit_type(raw1394handle_t handle,/* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset)/* I - Offset to directory */
{
unsigned char data[4]; /* Data from ROM */
int length; /* Length of directory */
DEBUG_printf(("get_unit_type(handle = %p, node = %d, offset = %llx)\n",
handle, node, offset));
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
DEBUG_printf((" length = %d\n", length));
/*
* Then read the directory, looking for unit directory or type tags...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return (-1);
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
data[2], data[3]));
if (data[0] == 0xd1)
{
/*
* Found the unit directory...
*/
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
return (get_unit_type(handle, node, offset));
}
else if (data[0] == 0x14)
{
/*
* Found the unit type...
*/
return (data[1] & 0x1f);
}
offset += 4;
length --;
}
return (-1);
}
#ifdef DEBUG
/*
* 'show_data()' - Show a data node...
*/
static void
show_data(raw1394handle_t handle, /* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset, /* I - Offset to directory */
int indent) /* Amount to indent */
{
int i; /* Looping var */
unsigned char data[4]; /* Data from ROM */
int length; /* Length of data */
/*
* Read the data length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
/*
* Then read the data...
*/
for (i = 0; i < indent; i ++)
putchar(' ');
printf("LEAF (%d quadlets)\n", length);
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
for (i = 0; i < indent; i ++)
putchar(' ');
printf("%02X %02X %02X %02X '%c%c%c%c'\n",
data[0], data[1], data[2], data[3],
(data[0] < ' ' || data[0] >= 0x7f) ? '.' : data[0],
(data[1] < ' ' || data[1] >= 0x7f) ? '.' : data[1],
(data[2] < ' ' || data[2] >= 0x7f) ? '.' : data[2],
(data[3] < ' ' || data[3] >= 0x7f) ? '.' : data[3]);
offset += 4;
length --;
}
}
/*
* 'show_dir()' - Show a directory list...
*/
static void
show_dir(raw1394handle_t handle, /* I - Handle for device */
int node, /* I - Node number */
unsigned long long offset, /* I - Offset to directory */
int indent) /* Amount to indent */
{
int i; /* Looping var */
unsigned char data[4]; /* Data from ROM */
int length; /* Length of directory */
int value; /* Value in directory */
/*
* Read the directory length from the first quadlet...
*/
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
offset += 4;
/*
* The length is in the upper 16 bits...
*/
length = (data[0] << 8) | data[1];
/*
* Then read the directory...
*/
while (length > 0)
{
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
return;
for (i = 0; i < indent; i ++)
putchar(' ');
printf("%02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
value = (((data[1] << 8) | data[2]) << 8) | data[3];
switch (data[0] & 0xc0)
{
case 0x00 :
for (i = -4; i < indent; i ++)
putchar(' ');
printf("IMMEDIATE %d\n", value);
break;
case 0x40 :
for (i = -4; i < indent; i ++)
putchar(' ');
printf("CSR OFFSET +%06X\n", value);
break;
case 0x80 :
show_data(handle, node, offset + value * 4, indent + 4);
break;
case 0xc0 :
show_dir(handle, node, offset + value * 4, indent + 4);
break;
}
offset += 4;
length --;
}
}
#endif /* DEBUG */
/*
* 'ieee1394_list()' - List the available printer devices.
*/
ieee1394_info_t * /* O - Printer information */
ieee1394_list(int *num_devices) /* O - Number of printers */
{
int i, j; /* Looping vars */
raw1394handle_t handle; /* 1394 handle */
int num_ports; /* Number of ports */
struct raw1394_portinfo ports[100]; /* Port data... */
unsigned char guid[8]; /* Global unique ID */
int vendor; /* Vendor portion of GUID */
int unit_type; /* Unit type */
int addr; /* Management address offset */
char id[1024], /* Device ID string */
*idptr, /* Pointer into ID string */
*idsep; /* Pointer to separator */
ieee1394_info_t *devices; /* Device list */
/*
* Connect to the user-mode driver interface...
*/
handle = raw1394_new_handle();
num_ports = raw1394_get_port_info(handle, ports,
sizeof(ports) / sizeof(ports[0]));
DEBUG_printf(("num_ports = %d\n", num_ports));
/*
* Loop through the ports to discover what nodes are available.
*/
num_nodes = 0;
for (i = 0; i < num_ports; i ++)
{
DEBUG_printf(("ports[%d] = { nodes = %d, name = \"%s\" }\n", i,
ports[i].nodes, ports[i].name));
raw1394_set_port(handle, i);
for (j = 0; j < ports[i].nodes; j ++)
{
if (raw1394_read(handle, 0xffc0 | j,
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 12, 4,
(quadlet_t *)guid) < 0)
{
DEBUG_printf((" Node #%d: Unable to contact (%s)!\n", j,
strerror(errno)));
continue;
}
else
{
raw1394_read(handle, 0xffc0 | j,
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 16, 4,
(quadlet_t *)(guid + 4));
DEBUG_printf((" Node #%d: GUID = %02X%02X%02X%02X%02X%02X%02X%02X\n",
j, guid[0], guid[1], guid[2], guid[3], guid[4],
guid[5], guid[6], guid[7]));
vendor = (((guid[0] << 8) | guid[1]) << 8) | guid[2];
unit_type = get_unit_type(handle, j,
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
DEBUG_printf(("vendor = %x, unit_type = %d\n", vendor, unit_type));
if (unit_type == 2 && num_nodes < MAX_NODES)
{
/*
* Found a printer device; add it to the nodes list...
*/
#ifdef DEBUG
show_dir(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20, 0);
#endif /* DEBUG */
memset(nodes + num_nodes, 0, sizeof(linux1394_node_t));
sprintf(nodes[num_nodes].uri, "ieee1394://%02X%02X%02X%02X%02X%02X%02X%02X",
guid[0], guid[1], guid[2], guid[3], guid[4],
guid[5], guid[6], guid[7]);
nodes[num_nodes].port = i;
nodes[num_nodes].node = j;
addr = get_man_addr(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
if (addr < 0)
continue;
nodes[num_nodes].addr = CSR_REGISTER_BASE + addr;
DEBUG_printf(("Node address = %llx\n", nodes[num_nodes].addr));
get_device_id(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20,
id, sizeof(id));
if (id[0])
{
/*
* Grab the manufacturer and model name from the device ID
* string...
*/
idptr = id + 4;
idsep = strchr(id, ';');
if (idsep)
*idsep++ = '\0';
else
idsep = idptr;
snprintf(nodes[num_nodes].description,
sizeof(nodes[num_nodes].description),
"%s Firewire Printer", idptr);
if ((idptr = strstr(idsep, "DES:")) == NULL)
idptr = strstr(idsep, "MDL:");
if (idptr == NULL)
strcpy(nodes[num_nodes].make_model, "Unknown");
else
{
/*
* Grab the DES or MDL code...
*/
idptr += 4;
idsep = strchr(idptr, ';');
if (idsep)
*idsep = '\0';
if (strncmp(id + 4, idptr, strlen(id + 4)) == 0)
{
/*
* Use the description directly...
*/
strlcpy(nodes[num_nodes].make_model, idptr,
sizeof(nodes[num_nodes].make_model));
}
else
{
/*
* Add the manufacturer to the front of the name...
*/
snprintf(nodes[num_nodes].make_model,
sizeof(nodes[num_nodes].make_model),
"%s %s", id + 4, idptr);
}
}
}
else
{
/*
* Flag it as an unknown printer...
*/
sprintf(nodes[num_nodes].description,
"Unknown%06X Firewire Printer", vendor);
strcpy(nodes[num_nodes].make_model, "Unknown");
}
num_nodes ++;
}
}
}
}
/*
* Done querying the Firewire bus...
*/
raw1394_destroy_handle(handle);
/*
* Build an array of device info structures as needed...
*/
if (num_devices == NULL)
return (NULL);
*num_devices = num_nodes;
if (num_nodes)
{
if ((devices = calloc(sizeof(ieee1394_info_t), num_nodes)) != NULL)
{
for (i = 0; i < num_nodes; i ++)
{
strcpy(devices[i].uri, nodes[i].uri);
strcpy(devices[i].description, nodes[i].description);
strcpy(devices[i].make_model, nodes[i].make_model);
}
}
return (devices);
}
else
return (NULL);
}
/*
* 'ieee1394_open()' - Open a printer device.
*/
ieee1394_dev_t /* O - Printer device or NULL */
ieee1394_open(const char *uri) /* I - Device URI */
{
int i; /* Looping var */
linux1394_dev_t *ldev; /* Linux device */
/*
* Return early if we can't see any printers...
*/
if (num_nodes == 0)
ieee1394_list(NULL);
if (num_nodes == 0)
{
strcpy(error_string, "No IEEE-1394 printers found!");
return (NULL);
}
/*
* Look for the URI...
*/
for (i = 0; i < num_nodes; i ++)
if (strcmp(nodes[i].uri, uri) == 0)
break;
if (i >= num_nodes)
{
snprintf(error_string, sizeof(error_string), "Device %s not found!", uri);
return (NULL);
}
/*
* Now create a new device structure...
*/
if ((ldev = calloc(sizeof(linux1394_dev_t), 1)) == NULL)
{
strcpy(error_string, "Out of memory!");
return (NULL);
}
ldev->handle = raw1394_new_handle();
ldev->node = nodes[i].node;
ldev->addr = nodes[i].addr;
raw1394_set_port(ldev->handle, nodes[i].port);
error_string[0] = '\0';
return ((ieee1394_dev_t)ldev);
}
/*
* 'ieee1394_close()' - Close a printer device.
*/
int /* O - 0 on success, -1 on failure */
ieee1394_close(ieee1394_dev_t dev) /* I - Printer device */
{
linux1394_dev_t *ldev; /* Linux device */
ldev = (linux1394_dev_t *)dev;
raw1394_destroy_handle(ldev->handle);
free(ldev);
return (0);
}
/*
* 'ieee1394_read()' - Read from a printer device.
*/
int /* O - Number of bytes read or -1 */
ieee1394_read(ieee1394_dev_t dev, /* I - Printer device */
char *buffer, /* I - Read buffer */
int len) /* I - Max bytes to read */
{
linux1394_dev_t *ldev; /* Linux device */
ldev = (linux1394_dev_t *)dev;
return (0);
}
/*
* 'ieee1394_write()' - Write data to a printer device.
*/
int /* O - Number of bytes written or -1 */
ieee1394_write(ieee1394_dev_t dev, /* I - Printer device */
char *buffer, /* I - Buffer to write */
int len) /* I - Number of bytes to write */
{
linux1394_dev_t *ldev; /* Linux device */
ldev = (linux1394_dev_t *)dev;
/* if (raw1394_write(handle, 0xffc0 | j, 0, ,
(quadlet_t *)guid) < 0)*/
return (len);
}
/*
* 'ieee1394_error()' - Return the last error.
*/
const char * /* O - Error string or NULL */
ieee1394_error(void)
{
if (error_string[0])
return (error_string);
else
return (NULL);
}
/*
* End of "$Id$".
*/
-268
Ver Arquivo
@@ -1,268 +0,0 @@
/*
* "$Id$"
*
* IEEE-1394 backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2002 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use
* of this software must display the following
* acknowledgement:
*
* This product includes software developed by Easy
* Software Products.
*
* 4. The name of Easy Software Products may not be used to
* endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* Contents:
*
* main() - Send a file to the printer.
* list_devices() - List all known printer devices...
*/
/*
* Include necessary headers.
*/
#include "ieee1394.h"
/*
* Local functions...
*/
void list_devices(void);
/*
* 'main()' - Send a file to the printer.
*
* Usage:
*
* printer-uri job-id user title copies options [file]
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
ieee1394_dev_t dev; /* Printer device */
int fp; /* Print file */
int copies; /* Number of copies to print */
int rbytes; /* Number of bytes read from device */
size_t nbytes, /* Number of bytes read from file */
tbytes; /* Total number of bytes written */
char buffer[8192]; /* Input/output buffer */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Make sure status messages are not buffered...
*/
setbuf(stderr, NULL);
/*
* Check command-line...
*/
if (argc == 1)
{
list_devices();
return (0);
}
else if (argc < 6 || argc > 7)
{
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
argv[0]);
return (1);
}
/*
* If we have 7 arguments, print the file named on the command-line.
* Otherwise, send stdin instead...
*/
if (argc == 6)
{
fp = 0;
copies = 1;
}
else
{
/*
* Try to open the print file...
*/
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
return (1);
}
copies = atoi(argv[4]);
}
/*
* Try to open the printer device...
*/
fputs("STATE: +connecting-to-device\n", stderr);
do
{
if ((dev = ieee1394_open(argv[0])) == NULL)
{
fputs("INFO: Firewire printer busy; will retry in 30 seconds...\n", stderr);
sleep(30);
}
}
while (dev == NULL);
fputs("STATE: -connecting-to-device\n", stderr);
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
* current page... Only ignore SIGTERM if we are printing data from
* stdin (otherwise you can't cancel raw jobs...)
*/
if (argc < 7)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
/*
* Finally, send the print file...
*/
while (copies > 0)
{
copies --;
if (fp != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(fp, 0, SEEK_SET);
}
tbytes = 0;
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
{
/*
* Write the print data to the printer...
*/
tbytes += nbytes;
if (ieee1394_write(dev, buffer, nbytes) < 0)
{
perror("ERROR: Unable to send print file to printer");
break;
}
if ((rbytes = ieee1394_read(dev, buffer, sizeof(buffer))) > 0)
fprintf(stderr, "INFO: Read %d bytes from printer...\n", rbytes);
if (argc > 6)
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
(unsigned long)tbytes);
}
}
/*
* Close the printer device and input file and return...
*/
ieee1394_close(dev);
if (fp != 0)
close(fp);
fputs("INFO: Ready to print.\n", stderr);
return (0);
}
/*
* 'list_devices()' - List all known devices...
*/
void
list_devices(void)
{
int i, /* Looping var */
num_info; /* Number of devices */
ieee1394_info_t *info; /* Devices... */
/*
* Get the available devices...
*/
info = ieee1394_list(&num_info);
/*
* List them as needed...
*/
if (num_info > 0)
{
for (i = 0; i < num_info; i ++)
printf("direct %s \"%s\" \"%s\"\n", info[i].uri,
info[i].make_model, info[i].description);
free(info);
}
}
/*
* End of "$Id$".
*/
-104
Ver Arquivo
@@ -1,104 +0,0 @@
/*
* "$Id$"
*
* IEEE-1394 header for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2002 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use
* of this software must display the following
* acknowledgement:
*
* This product includes software developed by Easy
* Software Products.
*
* 4. The name of Easy Software Products may not be used to
* endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Include necessary headers.
*/
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
# include <fcntl.h>
#endif /* WIN32 */
/*
* Device information structure...
*/
typedef struct
{
char uri[HTTP_MAX_URI], /* Device URI */
description[128], /* Description of port */
make_model[128]; /* Make and model */
} ieee1394_info_t;
/*
* Private device connection information...
*/
typedef void *ieee1394_dev_t;
/*
* Prototypes for standard IEEE-1394 interface...
*/
extern ieee1394_info_t *ieee1394_list(int *num_devices);
extern ieee1394_dev_t ieee1394_open(const char *uri);
extern int ieee1394_close(ieee1394_dev_t dev);
extern int ieee1394_read(ieee1394_dev_t dev, char *buffer, int len);
extern int ieee1394_write(ieee1394_dev_t dev, char *buffer, int len);
extern const char *ieee1394_error(void);
/*
* End of "$Id$".
*/
+390 -199
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -22,6 +22,7 @@
* compress_files() - Compress print files...
* password_cb() - Disable the password prompt for
* cupsDoFileRequest().
* report_attr() - Report an IPP attribute value.
* report_printer_state() - Report the printer state.
* run_pictwps_filter() - Convert PICT files to PostScript when printing
* remotely.
@@ -33,17 +34,9 @@
*/
#include <cups/http-private.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "backend-private.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <cups/backend.h>
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/i18n.h>
#include <cups/string.h>
#include <signal.h>
#include <sys/wait.h>
/*
@@ -52,6 +45,8 @@
static char *password = NULL; /* Password for device URI */
static int password_tries = 0; /* Password tries */
static const char *auth_info_required = "none";
/* New auth-info-required value */
#ifdef __APPLE__
static char pstmpname[1024] = ""; /* Temporary PostScript file name */
#endif /* __APPLE__ */
@@ -72,6 +67,7 @@ static void check_printer_state(http_t *http, const char *uri,
static void compress_files(int num_files, char **files);
#endif /* HAVE_LIBZ */
static const char *password_cb(const char *);
static void report_attr(ipp_attribute_t *attr);
static int report_printer_state(ipp_t *ipp, int job_id);
#ifdef __APPLE__
@@ -96,7 +92,8 @@ main(int argc, /* I - Number of command-line args */
int send_options; /* Send job options? */
int num_options; /* Number of printer options */
cups_option_t *options; /* Printer options */
char method[255], /* Method in URI */
const char *device_uri; /* Device URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
@@ -105,6 +102,10 @@ main(int argc, /* I - Number of command-line args */
*name, /* Name of option */
*value, /* Value of option */
sep; /* Separator character */
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? */
int num_files; /* Number of files to print */
char **files, /* Files to print */
*filename; /* Pointer to single filename */
@@ -140,8 +141,16 @@ main(int argc, /* I - Number of command-line args */
int version; /* IPP version */
static const char * const pattrs[] =
{ /* Printer attributes we want */
"com.apple.print.recoverable-message",
"copies-supported",
"document-format-supported",
"marker-colors",
"marker-high-levels",
"marker-levels",
"marker-low-levels",
"marker-message",
"marker-names",
"marker-types",
"printer-is-accepting-jobs",
"printer-state",
"printer-state-message",
@@ -194,8 +203,9 @@ main(int argc, /* I - Number of command-line args */
else
s = argv[0];
printf("network %s \"Unknown\" \"Internet Printing Protocol (%s)\"\n",
s, s);
printf("network %s \"Unknown\" \"%s (%s)\"\n",
s, _cupsLangString(cupsLangDefault(),
_("Internet Printing Protocol")), s);
return (CUPS_BACKEND_OK);
}
else if (argc < 6)
@@ -225,18 +235,17 @@ main(int argc, /* I - Number of command-line args */
* Extract the hostname and printer name from the URI...
*/
if (httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource)) < HTTP_URI_OK)
{
_cupsLangPuts(stderr,
_("ERROR: Missing device URI on command-line and no "
"DEVICE_URI environment variable!\n"));
return (CUPS_BACKEND_STOP);
}
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
if (!strcmp(method, "https"))
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (!port)
port = IPP_PORT; /* Default to port 631 */
if (!strcmp(scheme, "https"))
cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
else
cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
@@ -246,7 +255,7 @@ main(int argc, /* I - Number of command-line args */
*/
compression = 0;
version = 1;
version = 11;
waitjob = 1;
waitprinter = 1;
contimeout = 7 * 24 * 60 * 60;
@@ -343,9 +352,13 @@ main(int argc, /* I - Number of command-line args */
else if (!strcasecmp(name, "version"))
{
if (!strcmp(value, "1.0"))
version = 0;
version = 10;
else if (!strcmp(value, "1.1"))
version = 1;
version = 11;
else if (!strcmp(value, "2.0"))
version = 20;
else if (!strcmp(value, "2.1"))
version = 21;
else
{
_cupsLangPrintf(stderr,
@@ -396,37 +409,52 @@ main(int argc, /* I - Number of command-line args */
* Copy stdin to a temporary file...
*/
int fd; /* File descriptor */
cups_file_t *fp; /* Temporary file */
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
int fd; /* File descriptor */
http_addrlist_t *addrlist; /* Address list */
off_t tbytes; /* Total bytes copied */
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
hostname);
return (CUPS_BACKEND_STOP);
}
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
perror("ERROR: unable to create temporary file");
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
if ((fp = cupsFileOpenFd(fd, compression ? "w9" : "w")) == NULL)
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
tbytes = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
httpAddrFreeList(addrlist);
close(fd);
/*
* Don't try printing files less than 2 bytes...
*/
if (tbytes <= 1)
{
perror("ERROR: unable to open temporary file");
close(fd);
_cupsLangPuts(stderr, _("ERROR: Empty print file!\n"));
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (cupsFileWrite(fp, buffer, bytes) < bytes)
{
perror("ERROR: unable to write to temporary file");
cupsFileClose(fp);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
cupsFileClose(fp);
/*
* Point to the single file from stdin...
*/
@@ -497,8 +525,8 @@ main(int argc, /* I - Number of command-line args */
do
{
_cupsLangPrintf(stderr, _("INFO: Connecting to %s on port %d...\n"),
hostname, port);
fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
{
@@ -518,8 +546,8 @@ main(int argc, /* I - Number of command-line args */
_("INFO: Unable to contact printer, queuing on next "
"printer in class...\n"));
if (argc == 6 || strcmp(filename, argv[6]))
unlink(filename);
if (tmpfilename[0])
unlink(tmpfilename);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
@@ -574,16 +602,16 @@ main(int argc, /* I - Number of command-line args */
}
while (http == NULL);
if (job_cancelled)
if (job_cancelled || !http)
{
if (argc == 6 || strcmp(filename, argv[6]))
unlink(filename);
if (tmpfilename[0])
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
@@ -597,13 +625,24 @@ main(int argc, /* I - Number of command-line args */
httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
ntohs(http->hostaddr->ipv4.sin_port));
/*
* See if the printer supports SNMP...
*/
if ((snmp_fd = _cupsSNMPOpen(http->hostaddr->addr.sa_family)) >= 0)
have_supplies = !backendSNMPSupplies(snmp_fd, http->hostaddr, &start_count,
NULL);
else
have_supplies = start_count = 0;
/*
* Build a URI for the printer and fill the standard IPP attributes for
* an IPP_PRINT_FILE request. We can't use the URI in argv[0] because it
* might contain username:password information...
*/
snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, hostname, port, resource);
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), scheme, NULL, hostname,
port, resource);
/*
* First validate the destination and see if the device supports multiple
@@ -617,12 +656,19 @@ main(int argc, /* I - Number of command-line args */
do
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Build the IPP request...
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -637,6 +683,9 @@ main(int argc, /* I - Number of command-line args */
fputs("DEBUG: Getting supported attributes...\n", stderr);
if (http->version < HTTP_1_1)
httpReconnect(http);
if ((supported = cupsDoRequest(http, request, resource)) == NULL)
ipp_status = cupsLastError();
else
@@ -668,16 +717,16 @@ main(int argc, /* I - Number of command-line args */
delay += 5;
}
else if ((ipp_status == IPP_BAD_REQUEST ||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version > 10)
{
/*
* Switch to IPP/1.0...
*/
_cupsLangPuts(stderr,
_("INFO: Printer does not support IPP/1.1, trying "
"IPP/1.0...\n"));
version = 0;
_cupsLangPrintf(stderr,
_("INFO: Printer does not support IPP/%d.%d, trying "
"IPP/1.0...\n"), version / 10, version % 10);
version = 10;
httpReconnect(http);
}
else if (ipp_status == IPP_NOT_FOUND)
@@ -689,6 +738,15 @@ main(int argc, /* I - Number of command-line args */
return (CUPS_BACKEND_STOP);
}
else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
{
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
"Negotiate", 9))
auth_info_required = "negotiate";
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
return (CUPS_BACKEND_AUTH_REQUIRED);
}
else
{
_cupsLangPrintf(stderr,
@@ -762,8 +820,8 @@ main(int argc, /* I - Number of command-line args */
ippDelete(supported);
httpClose(http);
if (argc == 6 || strcmp(filename, argv[6]))
unlink(filename);
if (tmpfilename[0])
unlink(tmpfilename);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
@@ -811,6 +869,12 @@ main(int argc, /* I - Number of command-line args */
while (copies_remaining > 0)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Build the IPP request...
*/
@@ -823,7 +887,8 @@ main(int argc, /* I - Number of command-line args */
else
request = ippNewRequest(IPP_PRINT_JOB);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -862,12 +927,13 @@ main(int argc, /* I - Number of command-line args */
num_options = cupsParseOptions(argv[5], 0, &options);
#ifdef __APPLE__
if (!strcasecmp(content_type, "application/pictwps") && num_files == 1)
if (!strcasecmp(final_content_type, "application/pictwps") &&
num_files == 1)
{
if (format_sup != NULL)
{
for (i = 0; i < format_sup->num_values; i ++)
if (!strcasecmp(content_type, format_sup->values[i].string.text))
if (!strcasecmp(final_content_type, format_sup->values[i].string.text))
break;
}
@@ -878,10 +944,18 @@ main(int argc, /* I - Number of command-line args */
* so convert the document to PostScript...
*/
if (run_pictwps_filter(argv, filename))
return (CUPS_BACKEND_FAILED);
if (run_pictwps_filter(argv, files[0]))
{
if (pstmpname[0])
unlink(pstmpname);
filename = pstmpname;
if (tmpfilename[0])
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
files[0] = pstmpname;
/*
* Change the MIME type to application/postscript and change the
@@ -907,7 +981,7 @@ main(int argc, /* I - Number of command-line args */
"document-format", NULL, final_content_type);
}
if (copies_sup && version > 0 && send_options)
if (copies_sup && version > 10 && send_options)
{
/*
* Only send options if the destination printer supports the copies
@@ -940,6 +1014,9 @@ main(int argc, /* I - Number of command-line args */
* Do the request...
*/
if (http->version < HTTP_1_1)
httpReconnect(http);
if (num_files > 1)
response = cupsDoRequest(http, request, resource);
else
@@ -962,21 +1039,44 @@ main(int argc, /* I - Number of command-line args */
sleep(10);
}
else if ((ipp_status == IPP_BAD_REQUEST ||
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
ipp_status == IPP_VERSION_NOT_SUPPORTED) && version > 10)
{
/*
* Switch to IPP/1.0...
*/
_cupsLangPuts(stderr,
_("INFO: Printer does not support IPP/1.1, trying "
"IPP/1.0...\n"));
version = 0;
_cupsLangPrintf(stderr,
_("INFO: Printer does not support IPP/%d.%d, trying "
"IPP/1.0...\n"), version / 10, version % 10);
version = 10;
httpReconnect(http);
}
else
{
/*
* Update auth-info-required as needed...
*/
_cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
cupsLastErrorString());
if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
{
fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
/*
* Normal authentication goes through the password callback, which sets
* auth_info_required to "username,password". Kerberos goes directly
* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
* here and set auth_info_required as needed...
*/
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
"Negotiate", 9))
auth_info_required = "negotiate";
}
}
}
else if ((job_id_attr = ippFindAttribute(response, "job-id",
IPP_TAG_INTEGER)) == NULL)
@@ -1001,9 +1101,19 @@ main(int argc, /* I - Number of command-line args */
{
for (i = 0; i < num_files; i ++)
{
request = ippNewRequest(IPP_SEND_DOCUMENT);
/*
* Check for side-channel requests...
*/
request->request.op.version[1] = version;
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Send the next file in the job...
*/
request = ippNewRequest(IPP_SEND_DOCUMENT);
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1021,6 +1131,9 @@ main(int argc, /* I - Number of command-line args */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, content_type);
if (http->version < HTTP_1_1)
httpReconnect(http);
ippDelete(cupsDoFileRequest(http, request, resource, files[i]));
if (cupsLastError() > IPP_OK_CONFLICT)
@@ -1042,7 +1155,7 @@ main(int argc, /* I - Number of command-line args */
}
else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
ipp_status == IPP_PRINTER_BUSY)
break;
continue;
else
copies_remaining --;
@@ -1055,14 +1168,21 @@ main(int argc, /* I - Number of command-line args */
_cupsLangPuts(stderr, _("INFO: Waiting for job to complete...\n"));
for (; !job_cancelled;)
for (delay = 1; !job_cancelled;)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Build an IPP_GET_JOB_ATTRIBUTES request...
*/
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1082,7 +1202,7 @@ main(int argc, /* I - Number of command-line args */
* Do the request...
*/
if (!copies_sup)
if (!copies_sup || http->version < HTTP_1_1)
httpReconnect(http);
response = cupsDoRequest(http, request, resource);
@@ -1135,6 +1255,19 @@ main(int argc, /* I - Number of command-line args */
break;
}
}
else
{
/*
* If the printer does not return a job-state attribute, it does not
* conform to the IPP specification - break out immediately and fail
* the job...
*/
fputs("DEBUG: No job-state available from printer - stopping queue.\n",
stderr);
ipp_status = IPP_INTERNAL_ERROR;
break;
}
}
ippDelete(response);
@@ -1146,10 +1279,14 @@ main(int argc, /* I - Number of command-line args */
check_printer_state(http, uri, resource, argv[2], version, job_id);
/*
* Wait 10 seconds before polling again...
* Wait 1-10 seconds before polling again...
*/
sleep(10);
sleep(delay);
delay ++;
if (delay > 10)
delay = 1;
}
}
@@ -1166,6 +1303,24 @@ main(int argc, /* I - Number of command-line args */
check_printer_state(http, uri, resource, argv[2], version, job_id);
/*
* Collect the final page count as needed...
*/
if (have_supplies &&
!backendSNMPSupplies(snmp_fd, http->hostaddr, &page_count, NULL) &&
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
#ifdef HAVE_GSSAPI
/*
* See if we used Kerberos at all...
*/
if (http->gssctx)
auth_info_required = "negotiate";
#endif /* HAVE_GSSAPI */
/*
* Free memory...
*/
@@ -1198,20 +1353,19 @@ main(int argc, /* I - Number of command-line args */
* Return the queue status...
*/
if (ipp_status == IPP_NOT_AUTHORIZED)
{
/*
* Authorization failures here mean that we need Kerberos. Username +
* password authentication is handled in the password_cb function.
*/
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
fputs("ATTR: auth-info-required=negotiate\n", stderr);
if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
return (CUPS_BACKEND_AUTH_REQUIRED);
}
else if (ipp_status == IPP_INTERNAL_ERROR)
return (CUPS_BACKEND_STOP);
else if (ipp_status > IPP_OK_CONFLICT)
return (CUPS_BACKEND_FAILED);
else
{
_cupsLangPuts(stderr, _("INFO: Ready to print.\n"));
return (CUPS_BACKEND_OK);
}
}
@@ -1233,7 +1387,8 @@ cancel_job(http_t *http, /* I - HTTP connection */
_cupsLangPuts(stderr, _("INFO: Canceling print job...\n"));
request = ippNewRequest(IPP_CANCEL_JOB);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1247,6 +1402,9 @@ cancel_job(http_t *http, /* I - HTTP connection */
* Do the request...
*/
if (http->version < HTTP_1_1)
httpReconnect(http);
ippDelete(cupsDoRequest(http, request, resource));
if (cupsLastError() > IPP_OK_CONFLICT)
@@ -1272,6 +1430,12 @@ check_printer_state(
*response; /* IPP response */
static const char * const attrs[] = /* Attributes we want */
{
"com.apple.print.recoverable-message",
"marker-colors",
"marker-levels",
"marker-message",
"marker-names",
"marker-types",
"printer-state-message",
"printer-state-reasons"
};
@@ -1282,7 +1446,8 @@ check_printer_state(
*/
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
request->request.op.version[1] = version;
request->request.op.version[0] = version / 10;
request->request.op.version[1] = version % 10;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
@@ -1299,6 +1464,9 @@ check_printer_state(
* Do the request...
*/
if (http->version < HTTP_1_1)
httpReconnect(http);
if ((response = cupsDoRequest(http, request, resource)) != NULL)
{
report_printer_state(response, job_id);
@@ -1394,7 +1562,13 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
{
(void)prompt;
if (password && password_tries < 3)
/*
* Remember that we need to authenticate...
*/
auth_info_required = "username,password";
if (password && *password && password_tries < 3)
{
password_tries ++;
@@ -1403,27 +1577,82 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
else
{
/*
* If there is no password set in the device URI, return the
* "authentication required" exit code...
* Give up after 3 tries or if we don't have a password to begin with...
*/
if (tmpfilename[0])
unlink(tmpfilename);
#ifdef __APPLE__
if (pstmpname[0])
unlink(pstmpname);
#endif /* __APPLE__ */
fputs("ATTR: auth-info-required=username,password\n", stderr);
exit(CUPS_BACKEND_AUTH_REQUIRED);
return (NULL); /* Eliminate compiler warning */
return (NULL);
}
}
/*
* 'report_attr()' - Report an IPP attribute value.
*/
static void
report_attr(ipp_attribute_t *attr) /* I - Attribute */
{
int i; /* Looping var */
char value[1024], /* Value string */
*valptr, /* Pointer into value string */
*attrptr; /* Pointer into attribute value */
/*
* Convert the attribute values into quoted strings...
*/
for (i = 0, valptr = value;
i < attr->num_values && valptr < (value + sizeof(value) - 10);
i ++)
{
if (i > 0)
*valptr++ = ',';
switch (attr->value_tag)
{
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
snprintf(valptr, sizeof(value) - (valptr - value), "%d",
attr->values[i].integer);
valptr += strlen(valptr);
break;
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
case IPP_TAG_KEYWORD :
*valptr++ = '\"';
for (attrptr = attr->values[i].string.text;
*attrptr && valptr < (value + sizeof(value) - 10);
attrptr ++)
{
if (*attrptr == '\\' || *attrptr == '\"')
*valptr++ = '\\';
*valptr++ = *attrptr;
}
*valptr++ = '\"';
break;
default :
/*
* Unsupported value type...
*/
return;
}
}
*valptr = '\0';
/*
* Tell the scheduler about the new values...
*/
fprintf(stderr, "ATTR: %s=%s\n", attr->name, value);
}
/*
* 'report_printer_state()' - Report the printer state.
*/
@@ -1434,14 +1663,14 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
{
int i; /* Looping var */
int count; /* Count of reasons shown... */
ipp_attribute_t *psm, /* pritner-state-message */
*reasons; /* printer-state-reasons */
ipp_attribute_t *caprm, /* com.apple.print.recoverable-message */
*psm, /* printer-state-message */
*reasons, /* printer-state-reasons */
*marker; /* marker-* attributes */
const char *reason; /* Current reason */
const char *message; /* Message to show */
char unknown[1024]; /* Unknown message string */
const char *prefix; /* Prefix for STATE: line */
char state[1024]; /* State string */
cups_lang_t *language; /* Current localization */
int saw_caprw; /* Saw com.apple.print.recoverable-warning state */
if ((psm = ippFindAttribute(ipp, "printer-state-message",
@@ -1452,95 +1681,59 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
IPP_TAG_KEYWORD)) == NULL)
return (0);
state[0] = '\0';
prefix = "STATE: ";
language = cupsLangDefault();
saw_caprw = 0;
state[0] = '\0';
prefix = "STATE: ";
for (i = 0, count = 0; i < reasons->num_values; i ++)
{
reason = reasons->values[i].string.text;
if (job_id == 0 || strcmp(reason, "paused"))
if (!strcmp(reason, "com.apple.print.recoverable-warning"))
saw_caprw = 1;
else if (strcmp(reason, "paused"))
{
strlcat(state, prefix, sizeof(state));
strlcat(state, reason, sizeof(state));
prefix = ",";
}
message = "";
if (!strncmp(reason, "media-needed", 12))
message = _("Media tray needs to be filled.");
else if (!strncmp(reason, "media-jam", 9))
message = _("Media jam!");
else if (!strncmp(reason, "moving-to-paused", 16) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
message = _("Printer off-line.");
else if (!strncmp(reason, "toner-low", 9))
message = _("Toner low.");
else if (!strncmp(reason, "toner-empty", 11))
message = _("Out of toner!");
else if (!strncmp(reason, "cover-open", 10))
message = _("Cover open.");
else if (!strncmp(reason, "interlock-open", 14))
message = _("Interlock open.");
else if (!strncmp(reason, "door-open", 9))
message = _("Door open.");
else if (!strncmp(reason, "input-tray-missing", 18))
message = _("Media tray missing!");
else if (!strncmp(reason, "media-low", 9))
message = _("Media tray almost empty.");
else if (!strncmp(reason, "media-empty", 11))
message = _("Media tray empty!");
else if (!strncmp(reason, "output-tray-missing", 19))
message = _("Output tray missing!");
else if (!strncmp(reason, "output-area-almost-full", 23))
message = _("Output bin almost full.");
else if (!strncmp(reason, "output-area-full", 16))
message = _("Output bin full!");
else if (!strncmp(reason, "marker-supply-low", 17))
message = _("Ink/toner almost empty.");
else if (!strncmp(reason, "marker-supply-empty", 19))
message = _("Ink/toner empty!");
else if (!strncmp(reason, "marker-waste-almost-full", 24))
message = _("Ink/toner waste bin almost full.");
else if (!strncmp(reason, "marker-waste-full", 17))
message = _("Ink/toner waste bin full!");
else if (!strncmp(reason, "fuser-over-temp", 15))
message = _("Fuser temperature high!");
else if (!strncmp(reason, "fuser-under-temp", 16))
message = _("Fuser temperature low!");
else if (!strncmp(reason, "opc-near-eol", 12))
message = _("OPC almost at end-of-life.");
else if (!strncmp(reason, "opc-life-over", 13))
message = _("OPC at end-of-life!");
else if (!strncmp(reason, "developer-low", 13))
message = _("Developer almost empty.");
else if (!strncmp(reason, "developer-empty", 15))
message = _("Developer empty!");
else if (strstr(reason, "error") != NULL)
{
message = unknown;
snprintf(unknown, sizeof(unknown), _("Unknown printer error (%s)!"),
reason);
}
if (message[0])
{
count ++;
if (strstr(reasons->values[i].string.text, "error"))
fprintf(stderr, "ERROR: %s\n", _cupsLangString(language, message));
else if (strstr(reasons->values[i].string.text, "warning"))
fprintf(stderr, "WARNING: %s\n", _cupsLangString(language, message));
else
fprintf(stderr, "INFO: %s\n", _cupsLangString(language, message));
}
}
fprintf(stderr, "%s\n", state);
if (state[0])
fprintf(stderr, "%s\n", state);
/*
* Relay com.apple.print.recoverable-message...
*/
if ((caprm = ippFindAttribute(ipp, "com.apple.print.recoverable-message",
IPP_TAG_TEXT)) != NULL)
fprintf(stderr, "WARNING: %s: %s\n",
saw_caprw ? "recoverable" : "recovered",
caprm->values[0].string.text);
/*
* Relay the current marker-* attribute values...
*/
if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-high-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-low-levels",
IPP_TAG_INTEGER)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
report_attr(marker);
if ((marker = ippFindAttribute(ipp, "marker-types", IPP_TAG_KEYWORD)) != NULL)
report_attr(marker);
return (count);
}
@@ -1601,8 +1794,7 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
if ((fd = cupsTempFd(pstmpname, sizeof(pstmpname))) < 0)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"),
strerror(errno));
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
if (ppdfile)
unlink(ppdfile);
return (-1);
@@ -1642,8 +1834,7 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
* file...
*/
close(1);
dup(fd);
dup2(fd, 1);
close(fd);
if (!getuid())
@@ -1652,8 +1843,11 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
* Change to an unpriviledged user...
*/
setgid(fileinfo.st_gid);
setuid(fileinfo.st_uid);
if (setgid(fileinfo.st_gid))
return (errno);
if (setuid(fileinfo.st_uid))
return (errno);
}
execlp("pictwpstops", printer, argv[1], argv[2], argv[3], argv[4], argv[5],
@@ -1673,7 +1867,6 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
_cupsLangPrintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"),
strerror(errno));
unlink(filename);
if (ppdfile)
unlink(ppdfile);
return (-1);
@@ -1688,7 +1881,6 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
_cupsLangPrintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"),
strerror(errno));
close(fd);
unlink(filename);
if (ppdfile)
unlink(ppdfile);
return (-1);
@@ -1708,7 +1900,6 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
_cupsLangPrintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"),
status);
unlink(filename);
return (status);
}
+126 -65
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -29,19 +29,11 @@
* Include necessary headers.
*/
#include <cups/backend.h>
#include <cups/http-private.h>
#include <cups/cups.h>
#include <cups/i18n.h>
#include <stdio.h>
#include <stdlib.h>
#include "backend-private.h"
#include <stdarg.h>
#include <ctype.h>
#include <cups/string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef WIN32
# include <winsock.h>
@@ -120,31 +112,32 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
*options, /* Pointer to options */
*name, /* Name of option */
*value, /* Value of option */
sep, /* Separator character */
*filename, /* File to print */
title[256]; /* Title string */
int port; /* Port number */
int fd; /* Print file */
int status; /* Status of LPD job */
int mode; /* Print mode */
int banner; /* Print banner page? */
int format; /* Print format */
int order; /* Order of control/data files */
int reserve; /* Reserve priviledged port? */
int sanitize_title; /* Sanitize title string? */
int manual_copies, /* Do manual copies? */
timeout, /* Timeout */
contimeout, /* Connection timeout */
copies; /* Number of copies */
const char *device_uri; /* Device URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
*options, /* Pointer to options */
*name, /* Name of option */
*value, /* Value of option */
sep, /* Separator character */
*filename, /* File to print */
title[256]; /* Title string */
int port; /* Port number */
int fd; /* Print file */
int status; /* Status of LPD job */
int mode; /* Print mode */
int banner; /* Print banner page? */
int format; /* Print format */
int order; /* Order of control/data files */
int reserve; /* Reserve priviledged port? */
int sanitize_title; /* Sanitize title string? */
int manual_copies, /* Do manual copies? */
timeout, /* Timeout */
contimeout, /* Connection timeout */
copies; /* Number of copies */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -181,7 +174,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 1)
{
puts("network lpd \"Unknown\" \"LPD/LPR Host or Printer\"");
printf("network lpd \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("LPD/LPR Host or Printer")));
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
@@ -196,11 +190,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the hostname and printer name from the URI...
*/
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
if ((device_uri = cupsBackendDeviceURI(argv)) == 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)
port = 515; /* Default to port 515 */
if (!username[0])
{
/*
@@ -386,7 +385,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
sanitize_title = !value[0] || !strcasecmp(value, "on") ||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
}
else if (!strcasecmp(name, "timeout"))
{
@@ -424,26 +423,37 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Copy stdin to a temporary file...
*/
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
http_addrlist_t *addrlist; /* Address list */
int snmp_fd; /* SNMP socket */
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
hostname);
return (CUPS_BACKEND_STOP);
}
snmp_fd = _cupsSNMPOpen(addrlist->addr.addr.sa_family);
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
perror("ERROR: unable to create temporary file");
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (write(fd, buffer, bytes) < bytes)
{
perror("ERROR: unable to write to temporary file");
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
filename = tmpfilename;
backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
httpAddrFreeList(addrlist);
}
else if (argc == 6)
{
@@ -577,7 +587,7 @@ lpd_command(int fd, /* I - Socket connection to LPD host */
if (lpd_write(fd, buf, bytes) < bytes)
{
perror("ERROR: Unable to send LPD command");
_cupsLangPrintError(_("ERROR: Unable to send LPD command"));
return (-1);
}
@@ -639,6 +649,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
char addrname[256]; /* Address name */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Socket address */
int snmp_fd, /* SNMP socket */
have_supplies; /* Printer supports supply levels? */
int copy; /* Copies written */
time_t start_time; /* Time of first connect */
int recoverable; /* Recoverable error shown? */
@@ -672,6 +684,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
sprintf(portname, "%d", port);
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -696,10 +711,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* First try to reserve a port for this connection...
*/
fputs("STATE: +connecting-to-device\n", stderr);
_cupsLangPrintf(stderr,
_("INFO: Attempting to connect to host %s for printer %s\n"),
hostname, printer);
fprintf(stderr, "DEBUG: Connecting to %s:%d for printer %s\n", hostname,
port, printer);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024, addr = addrlist,
delay = 5;;
@@ -742,7 +756,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if ((fd = socket(addr->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
{
perror("ERROR: Unable to create socket");
_cupsLangPrintError(_("ERROR: Unable to create socket"));
sleep(1);
continue;
@@ -759,7 +773,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if ((fd = rresvport_af(&lport, addr->addr.addr.sa_family)) < 0)
{
perror("ERROR: Unable to reserve port");
_cupsLangPrintError(_("ERROR: Unable to reserve port"));
sleep(1);
continue;
@@ -784,7 +798,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
error = errno;
close(fd);
fd = -1;
if (addr->next)
continue;
@@ -866,7 +879,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
#ifdef AF_INET6
if (addr->addr.addr.sa_family == AF_INET6)
@@ -880,6 +893,21 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
ntohs(addr->addr.ipv4.sin_port), lport);
/*
* See if the printer supports SNMP...
*/
if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
have_supplies = !backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL);
else
have_supplies = 0;
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, &(addr->addr));
/*
* Next, open the print file and figure out its size...
*/
@@ -895,7 +923,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
httpAddrFreeList(addrlist);
close(fd);
perror("ERROR: unable to stat print file");
_cupsLangPrintError(_("ERROR: unable to stat print file"));
return (CUPS_BACKEND_FAILED);
}
@@ -963,6 +991,16 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (order == ORDER_CONTROL_DATA)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, &(addr->addr));
/*
* Send the control file...
*/
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
(int)getpid() % 1000, localhost))
{
@@ -978,7 +1016,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
{
status = errno;
perror("ERROR: Unable to write control file");
_cupsLangPrintError(_("ERROR: Unable to write control file"));
}
else
{
@@ -1007,6 +1045,12 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (status == 0)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, &(addr->addr));
/*
* Send the print file...
*/
@@ -1042,7 +1086,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (lpd_write(fd, buffer, nbytes) < nbytes)
{
perror("ERROR: Unable to send print file to printer");
_cupsLangPrintError(_("ERROR: Unable to send print file to printer"));
break;
}
else
@@ -1056,7 +1100,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
status = errno;
else if (lpd_write(fd, "", 1) < 1)
{
perror("ERROR: Unable to send trailing nul to printer");
_cupsLangPrintError(_("ERROR: Unable to send trailing nul to printer"));
status = errno;
}
else
@@ -1094,6 +1138,16 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (status == 0 && order == ORDER_DATA_CONTROL)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, &(addr->addr));
/*
* Send control file...
*/
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
(int)getpid() % 1000, localhost))
{
@@ -1109,7 +1163,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
{
status = errno;
perror("ERROR: Unable to write control file");
_cupsLangPrintError(_("ERROR: Unable to write control file"));
}
else
{
@@ -1134,6 +1188,13 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
_cupsLangPuts(stderr, _("INFO: Control file sent successfully\n"));
}
/*
* Collect the final supply levels as needed...
*/
if (have_supplies)
backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL);
/*
* Close the socket connection and input file...
*/
+294
Ver Arquivo
@@ -0,0 +1,294 @@
/*
* "$Id$"
*
* Common network APIs for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 2006-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"
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* backendCheckSideChannel() - Check the side-channel for pending requests.
* backendNetworkSideCB() - Handle common network side-channel commands.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#include <limits.h>
#ifdef __hpux
# include <sys/time.h>
#else
# include <sys/select.h>
#endif /* __hpux */
/*
* '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);
}
/*
* '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[2048]; /* 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] = 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)
{
cups_snmp_t packet; /* Packet from printer */
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))
{
char *dataptr; /* Pointer into data */
int 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) - (dataptr - data), "%d",
packet.object_value.boolean);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_INTEGER :
snprintf(dataptr, sizeof(data) - (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 < 0)
i = 0;
else if (packet.object_value.string.num_bytes <
(sizeof(data) - (dataptr - data)))
i = packet.object_value.string.num_bytes;
else
i = (int)(sizeof(data) - (dataptr - data));
memcpy(dataptr, packet.object_value.string.bytes, i);
datalen += i;
break;
case CUPS_ASN1_OID :
_cupsSNMPOIDToString(packet.object_value.oid, dataptr,
sizeof(data) - (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) - (dataptr - data), "%d",
packet.object_value.counter);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_GAUGE :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
packet.object_value.gauge);
datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_TIMETICKS :
snprintf(dataptr, sizeof(data) - (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_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));
}
/*
* End of "$Id$".
*/
+78 -70
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* © Copyright 2004 Apple Computer, Inc. All rights reserved.
* Copyright 2004-2008 Apple Inc. All rights reserved.
*
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
* Inc. ("Apple") in consideration of your agreement to the following
@@ -70,6 +70,16 @@
* signalHandler() - handle SIGINT to close the session before quiting.
*/
/*
* This backend uses deprecated APIs for AppleTalk; we know this, so
* silence any warnings about it...
*/
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
# undef MAC_OS_X_VERSION_MIN_REQUIRED
#endif /* MAX_OS_X_VERSION_MIN_REQUIRED */
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_0
#include <config.h>
#include <stdio.h>
@@ -85,17 +95,17 @@
#include <sys/time.h>
#include <sys/errno.h>
#include <cups/cups.h>
#include <cups/backend.h>
#include <cups/sidechannel.h>
#include <cups/i18n.h>
#include <netat/appletalk.h>
#include <netat/atp.h>
#include <netat/ddp.h>
#include <netat/nbp.h>
#include <netat/pap.h>
#include <cups/cups.h>
#include <cups/backend.h>
#include <cups/sidechannel.h>
#include <cups/i18n.h>
#include <libkern/OSByteOrder.h>
#ifdef HAVE_APPLETALK_AT_PROTO_H
@@ -207,24 +217,17 @@ int main (int argc, const char * argv[])
if (argc == 1 || (argc == 2 && strcmp(argv[1], "-discover") == 0))
{
/* If listDevices() didn't find any devices or returns an error output a
* legacy style announcement.
*
*/
if (listDevices() <= 0)
puts("network pap \"Unknown\" \"AppleTalk Printer Access Protocol (pap)\"");
listDevices();
return 0;
}
if (argc < 6 || argc > 7)
{
fprintf(stderr, "argc = %d\n", argc);
for (err = 0; err < argc; err++) {
fprintf(stderr, "%02d:%s\n", err, argv[err]);
}
fprintf(stderr, "Usage: pap job-id user title copies options [file]\n");
exit(EINVAL);
_cupsLangPrintf(stderr,
_("Usage: %s job-id user title copies options [file]\n"),
argv[0]);
return (CUPS_BACKEND_FAILED);
}
/* If we have 7 arguments, print the file named on the command-line.
@@ -245,7 +248,7 @@ int main (int argc, const char * argv[])
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
return (1);
return (CUPS_BACKEND_FAILED);
}
copies = atoi(argv[4]);
@@ -275,7 +278,6 @@ int main (int argc, const char * argv[])
*/
static int listDevices(void)
{
int err = noErr;
int i;
int numberFound;
@@ -291,20 +293,21 @@ static int listDevices(void)
/* Make sure it's okay to use appletalk */
if (!okayToUseAppleTalk())
{
fprintf(stderr, "ERROR: AppleTalk disabled in System Preferences\n");
_cupsLangPuts(stderr, _("INFO: AppleTalk disabled in System Preferences\n"));
return -1; /* Network is down */
}
if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
if (zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone))
{
perror("ERROR: Unable to get default AppleTalk zone");
_cupsLangPrintError(_("ERROR: Unable to get default AppleTalk zone"));
return -2;
}
memcpy(zone, at_zone.str, MIN(at_zone.len, sizeof(zone)-1));
zone[MIN(at_zone.len, sizeof(zone)-1)] = '\0';
fprintf(stderr, "INFO: Using default AppleTalk zone \"%s\"\n", zone);
_cupsLangPrintf(stderr, _("INFO: Using default AppleTalk zone \"%s\"\n"),
zone);
addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
@@ -316,12 +319,14 @@ static int listDevices(void)
if ((numberFound = nbp_lookup(&entity, buf, MAX_PRINTERS, &retry)) < 0)
{
perror("ERROR: Unable to lookup AppleTalk printers");
_cupsLangPrintError(_("ERROR: Unable to lookup AppleTalk printers"));
return numberFound;
}
if (numberFound >= MAX_PRINTERS)
fprintf(stderr, "WARNING: Adding only the first %d printers found", MAX_PRINTERS);
_cupsLangPrintf(stderr,
_("WARNING: Adding only the first %d printers found"),
MAX_PRINTERS);
/* Not required but sort them so they look nice */
qsort(buf, numberFound, sizeof(at_nbptuple_t), nbptuple_compare);
@@ -404,14 +409,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
at_inet_t sendDataAddr;
at_inet_t src;
at_resp_t resp;
int userdata, xo, reqlen;
int userdata, xo = 0, reqlen;
u_short tid;
u_char bitmap;
int maxfdp1,
nbp_failures = 0;
struct timeval timeout, *timeoutPtr;
u_char flowQuantum = 1;
u_short recvSequence = 0;
time_t now,
start_time,
elasped_time,
@@ -444,7 +448,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
/* try to find our printer */
if ((err = nbp_make_entity(&entity, name, type, zone)) != noErr)
{
fprintf(stderr, "ERROR: Unable to make AppleTalk address: %s\n", strerror(errno));
_cupsLangPrintError(_("ERROR: Unable to make AppleTalk address"));
goto Exit;
}
@@ -485,7 +489,8 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
if ((err = papOpen(&tuple, &gConnID, &gSockfd, &gSessionAddr, &flowQuantum)) == 0)
break;
fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(err));
_cupsLangPrintf(stderr, _("WARNING: Unable to open \"%s:%s\": %s\n"),
name, zone, strerror(err));
}
else
{
@@ -495,14 +500,15 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
retry.interval = 2;
retry.retries = 3;
fprintf(stderr, "STATE: +apple-nbp-lookup-warning\n");
fprintf(stderr, "WARNING: Printer not responding\n");
_cupsLangPuts(stderr, _("WARNING: Printer not responding\n"));
}
}
}
else
{
fprintf(stderr, "STATE: +apple-appletalk-disabled-warning\n");
fprintf(stderr, "INFO: AppleTalk disabled in System Preferences.\n");
_cupsLangPuts(stderr,
_("INFO: AppleTalk disabled in System Preferences.\n"));
}
elasped_time = time(NULL) - start_time;
@@ -512,7 +518,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
if (connect_timeout && elasped_time > connect_timeout)
{
fprintf(stderr, "ERROR: Printer not responding\n");
_cupsLangPuts(stderr, _("ERROR: Printer not responding\n"));
err = ETIMEDOUT;
goto Exit; /* Waiting too long... */
}
@@ -555,14 +561,14 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
#endif /* HAVE_SIGSET */
fprintf(stderr, "INFO: Sending data\n");
_cupsLangPuts(stderr, _("INFO: Sending data\n"));
sendDataAddr = tuple.enu_addr;
/* Start the tickle packets and set a timeout alarm */
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_TICKLE, 0, false, false)) < 0)
{
perror("ERROR: Unable to send PAP tickle request");
_cupsLangPrintError(_("ERROR: Unable to send PAP tickle request"));
goto Exit;
}
signal(SIGALRM, signalHandler);
@@ -571,7 +577,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
/* Prime the pump with an initial send-data packet */
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0)
{
perror("ERROR: Unable to send initial PAP send data request");
_cupsLangPrintError(_("ERROR: Unable to send initial PAP send data request"));
goto Exit;
}
@@ -620,7 +626,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
/* Wait here for something interesting to happen */
if ((err = select(maxfdp1, &readSet, 0, 0, timeoutPtr)) < 0)
{
perror("ERROR: select");
_cupsLangPrintError(_("ERROR: select() failed"));
break;
}
@@ -628,7 +634,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
{
/* Time to send a status request */
if ((err = papSendRequest(gSockfd, &tuple.enu_addr, 0, AT_PAP_TYPE_SEND_STATUS, 0x01, false, false)) < 0)
perror("WARNING: Unable to send PAP status request");
_cupsLangPrintError(_("WARNING: Unable to send PAP status request"));
if (gStatusInterval)
nextStatusTime = time(NULL) + gStatusInterval;
@@ -679,7 +685,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
{
if ((rc = atp_look(gSockfd)) < 0)
{
perror("ERROR: Unable to look for PAP response");
_cupsLangPrintError(_("ERROR: Unable to look for PAP response"));
break;
}
@@ -692,7 +698,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
if ((err = atp_getresp(gSockfd, &tid, &resp)) < 0)
{
perror("ERROR: Unable to get PAP response");
_cupsLangPrintError(_("ERROR: Unable to get PAP response"));
break;
}
userdata = resp.userdata[0];
@@ -703,7 +709,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
reqlen = sizeof(atpReqBuf);
if ((err = atp_getreq(gSockfd, &src, atpReqBuf, &reqlen, &userdata, &xo, &tid, &bitmap, 0)) < 0)
{
perror("ERROR: Unable to get PAP request");
_cupsLangPrintError(_("ERROR: Unable to get PAP request"));
break;
}
}
@@ -723,7 +729,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
case AT_PAP_TYPE_SEND_DATA: /* Send-Data packet */
sendDataAddr.socket = src.socket;
gSendDataID = tid;
recvSequence = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false)
{
@@ -822,13 +828,15 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
goto Exit;
else
{
fprintf(stderr, "WARNING: Printer sent unexpected EOF\n");
_cupsLangPuts(stderr, _("WARNING: Printer sent unexpected EOF\n"));
}
}
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0)
{
fprintf(stderr, "ERROR: Error %d sending PAPSendData resuest: %s\n", err, strerror(errno));
_cupsLangPrintf(stderr,
_("ERROR: Error %d sending PAPSendData request: %s\n"),
err, strerror(errno));
goto Exit;
}
break;
@@ -843,11 +851,11 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
/* If this is EOF then were we expecting it? */
if (fileEOFSent == true)
{
fprintf(stderr, "WARNING: Printer sent unexpected EOF\n");
_cupsLangPuts(stderr, _("WARNING: Printer sent unexpected EOF\n"));
}
else
{
fprintf(stderr, "ERROR: Printer sent unexpected EOF\n");
_cupsLangPuts(stderr, _("ERROR: Printer sent unexpected EOF\n"));
}
goto Exit;
break;
@@ -856,11 +864,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
case AT_PAP_TYPE_OPEN_CONN_REPLY: /* Open-Connection-Reply packet */
case AT_PAP_TYPE_SEND_STATUS: /* Send-Status packet */
case AT_PAP_TYPE_CLOSE_CONN_REPLY: /* Close-Connection-Reply packet */
fprintf(stderr, "WARNING: Unexpected PAP packet of type %d\n", TYPE_OF(userdata));
_cupsLangPrintf(stderr, _("WARNING: Unexpected PAP packet of type %d\n"),
TYPE_OF(userdata));
break;
default:
fprintf(stderr, "WARNING: Unknown PAP packet of type %d\n", TYPE_OF(userdata));
_cupsLangPrintf(stderr, _("WARNING: Unknown PAP packet of type %d\n"),
TYPE_OF(userdata));
break;
}
@@ -901,8 +911,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
{
int result,
open_result,
userdata,
atp_err;
userdata;
time_t tm,
waitTime;
char data[10],
@@ -916,7 +925,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
socketfd = 0;
puserdata = (u_char *)&userdata;
fprintf(stderr, "INFO: Opening connection\n");
_cupsLangPuts(stderr, _("INFO: Opening connection\n"));
if ((*fd = atp_open(&socketfd)) < 0)
return -1;
@@ -951,8 +960,8 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
0, &resp, &retry, 0)) < 0)
if (atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
0, &resp, &retry, 0) < 0)
{
statusUpdate("Destination unreachable", 23);
result = EHOSTUNREACH;
@@ -1019,7 +1028,6 @@ static int papClose()
{
int fd;
u_short tmpID;
int result;
unsigned char rdata[ATP_DATA_SIZE];
int userdata;
u_char *puserdata = (u_char *)&userdata;
@@ -1072,9 +1080,9 @@ static int papClose()
resp.resp[0].iov_base = rdata;
resp.resp[0].iov_len = sizeof(rdata);
result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
result = close(fd);
close(fd);
}
return noErr;
}
@@ -1270,7 +1278,7 @@ int papCancelRequest(int sockfd, u_short tid)
* 'sidechannel_request()' - Handle side-channel requests.
*/
static void
static int
sidechannel_request()
{
cups_sc_command_t command; /* Request command */
@@ -1281,32 +1289,29 @@ sidechannel_request()
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
return;
}
return (-1);
switch (command)
{
case CUPS_SC_CMD_GET_BIDI: /* Is the connection bidirectional? */
data[0] = 1;
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
return (cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0));
break;
case CUPS_SC_CMD_GET_STATE: /* Return device state */
data[0] = CUPS_SC_STATE_ONLINE;
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
return (cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0));
break;
case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */
case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */
case CUPS_SC_CMD_GET_DEVICE_ID: /* Return IEEE-1284 device ID */
default:
cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
NULL, 0, 1.0);
return (cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
NULL, 0, 1.0));
break;
}
return;
return (0);
}
@@ -1448,7 +1453,9 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
}
else
{
fprintf(stderr, "WARNING: Boolean expected for waiteof option \"%s\"\n", value);
_cupsLangPrintf(stderr,
_("WARNING: Boolean expected for waiteof option \"%s\"\n"),
value);
}
}
else if (!strcasecmp(optionName, "status"))
@@ -1460,8 +1467,9 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
statusInterval = atoi(value);
if (value[0] < '0' || value[0] > '9' || statusInterval < 0)
{
fprintf(stderr, "WARNING: number expected for status option \"%s\"\n",
value);
_cupsLangPrintf(stderr,
_("WARNING: number expected for status option \"%s\"\n"),
value);
}
else
{
@@ -1680,7 +1688,7 @@ static int connectTimeout()
*/
static void signalHandler(int sigraised)
{
fprintf(stderr, "ERROR: There was a timeout error while sending data to the printer\n");
_cupsLangPuts(stderr, _("ERROR: There was a timeout error while sending data to the printer\n"));
papClose();
+34 -19
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -59,7 +59,8 @@
*/
static void list_devices(void);
static void side_cb(int print_fd, int device_fd, int use_bc);
static int side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
/*
@@ -146,7 +147,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
@@ -281,7 +284,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
@@ -324,7 +327,9 @@ list_devices(void)
char device[255], /* Device filename */
basedevice[255], /* Base device filename for ports */
device_id[1024], /* Device ID string */
make_model[1024]; /* Make and model */
make_model[1024], /* Make and model */
info[1024], /* Info string */
uri[1024]; /* Device URI */
if (!access("/dev/parallel/", 0))
@@ -350,13 +355,20 @@ list_devices(void)
* Now grab the IEEE 1284 device ID string...
*/
snprintf(uri, sizeof(uri), "parallel:%s", device);
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
NULL, NULL, 0))
printf("direct parallel:%s \"%s\" \"%s LPT #%d\" \"%s\"\n", device,
make_model, make_model, i + 1, device_id);
NULL, uri, sizeof(uri)))
{
snprintf(info, sizeof(info), "%s LPT #%d", make_model, i + 1);
cupsBackendReport("direct", uri, make_model, info, device_id, NULL);
}
else
printf("direct parallel:%s \"Unknown\" \"LPT #%d\"\n", device, i + 1);
{
snprintf(info, sizeof(info), "LPT #%d", i + 1);
cupsBackendReport("direct", uri, NULL, info, NULL, NULL);
}
close(fd);
}
@@ -558,7 +570,7 @@ list_devices(void)
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
}
}
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
@@ -603,10 +615,12 @@ list_devices(void)
* 'side_cb()' - Handle side-channel requests...
*/
static void
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int use_bc) /* I - Using back-channel? */
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 */
@@ -614,13 +628,13 @@ side_cb(int print_fd, /* I - Print file */
int datalen; /* Request/response data size */
(void)snmp_fd;
(void)addr;
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -636,6 +650,7 @@ side_cb(int print_fd, /* I - Print file */
break;
case CUPS_SC_CMD_GET_BIDI :
status = CUPS_SC_STATUS_OK;
data[0] = use_bc;
datalen = 1;
break;
@@ -662,7 +677,7 @@ side_cb(int print_fd, /* I - Print file */
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+70 -24
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Common run loop APIs for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -25,6 +25,7 @@
*/
#include "backend-private.h"
#include <limits.h>
#ifdef __hpux
# include <sys/time.h>
#else
@@ -141,10 +142,14 @@ backendDrainOutput(int print_fd, /* I - Print file descriptor */
ssize_t /* O - Total bytes on success, -1 on error */
backendRunLoop(
int print_fd, /* I - Print file descriptor */
int device_fd, /* I - Device file descriptor */
int use_bc, /* I - Use back-channel? */
void (*side_cb)(int, int, int)) /* I - Side-channel callback */
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? */
int (*side_cb)(int, int, int, http_addr_t *, int))
/* I - Side-channel callback */
{
int nfds; /* Maximum file descriptor value + 1 */
fd_set input, /* Input set for reading */
@@ -158,15 +163,18 @@ backendRunLoop(
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, use_bc=%d, "
"side_cb=%p)\n",
print_fd, device_fd, use_bc, side_cb);
"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
@@ -189,6 +197,14 @@ backendRunLoop(
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()...
@@ -212,25 +228,28 @@ backendRunLoop(
FD_SET(print_fd, &input);
if (use_bc)
FD_SET(device_fd, &input);
if (side_cb)
if (!print_bytes && side_cb)
FD_SET(CUPS_SC_FD, &input);
FD_ZERO(&output);
if (print_bytes || !use_bc)
if (print_bytes || (!use_bc && !side_cb))
FD_SET(device_fd, &output);
if (use_bc || side_cb)
{
if (select(nfds, &input, &output, NULL, NULL) < 0)
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)
if (errno == ENXIO && offline != 1 && update_state)
{
fputs("STATE: +offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
offline = 1;
}
else if (errno == EINTR && total_bytes == 0)
@@ -250,7 +269,16 @@ backendRunLoop(
*/
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
(*side_cb)(print_fd, device_fd, use_bc);
{
/*
* 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...
@@ -265,6 +293,12 @@ backendRunLoop(
CUPS_LLCAST bc_bytes);
cupsBackChannelWrite(bc_buffer, 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;
}
}
/*
@@ -318,18 +352,18 @@ backendRunLoop(
if (errno == ENOSPC)
{
if (paperout != 1)
if (paperout != 1 && update_state)
{
fputs("STATE: +media-empty-error\n", stderr);
fputs("STATE: +media-empty-warning\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Out of paper!\n"));
paperout = 1;
}
}
else if (errno == ENXIO)
{
if (offline != 1)
if (offline != 1 && update_state)
{
fputs("STATE: +offline-error\n", stderr);
fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
offline = 1;
}
@@ -343,16 +377,16 @@ backendRunLoop(
}
else
{
if (paperout)
if (paperout && update_state)
{
fputs("STATE: -media-empty-error\n", stderr);
fputs("STATE: -media-empty-warning\n", stderr);
paperout = 0;
}
if (offline)
if (offline && update_state)
{
fputs("STATE: -offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
fputs("STATE: -offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
offline = 0;
}
@@ -363,6 +397,18 @@ backendRunLoop(
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;
}
}
/*
+2 -1
Ver Arquivo
@@ -66,7 +66,8 @@
void
list_devices(void)
{
puts("direct scsi \"Unknown\" \"SCSI Printer\"");
printf("direct scsi \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("SCSI Printer")));
}
+2 -1
Ver Arquivo
@@ -79,7 +79,8 @@ int print_device(const char *resource, int fd, int copies) { return (1); }
void
list_devices(void)
{
puts("direct scsi \"Unknown\" \"SCSI Printer\"");
printf("direct scsi \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("SCSI Printer")));
}
+3 -1
Ver Arquivo
@@ -177,7 +177,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
+109 -69
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -84,7 +84,7 @@
*/
static void list_devices(void);
static void side_cb(int print_fd, int device_fd, int use_bc);
static int side_cb(int print_fd, int device_fd, int use_bc);
/*
@@ -109,7 +109,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sep; /* Option separator */
int port; /* Port number (not used) */
int copies; /* Number of copies to print */
int print_fd, /* Print file */
int side_eof = 0, /* Saw EOF on side-channel? */
print_fd, /* Print file */
device_fd; /* Serial device */
int nfds; /* Maximum file descriptor value + 1 */
fd_set input, /* Input set for reading */
@@ -185,7 +186,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
@@ -556,7 +559,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (!print_bytes)
FD_SET(print_fd, &input);
FD_SET(device_fd, &input);
FD_SET(CUPS_SC_FD, &input);
if (!print_bytes && !side_eof)
FD_SET(CUPS_SC_FD, &input);
FD_ZERO(&output);
if (print_bytes)
@@ -570,7 +574,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (FD_ISSET(CUPS_SC_FD, &input))
side_cb(print_fd, device_fd, 1);
{
/*
* 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, 1))
side_eof = 1;
continue;
}
/*
* Check if we have back-channel data ready...
@@ -601,7 +614,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (errno != EAGAIN || errno != EINTR)
{
perror("ERROR: Unable to read print data");
_cupsLangPrintError(_("ERROR: Unable to read print data"));
tcsetattr(device_fd, TCSADRAIN, &origopts);
@@ -677,7 +690,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
perror("ERROR: Unable to write print data");
_cupsLangPrintError(_("ERROR: Unable to write print data"));
tcsetattr(device_fd, TCSADRAIN, &origopts);
@@ -723,16 +736,18 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
static void
list_devices(void)
{
#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
/* Funky hex numbering used for some *
* devices */
#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ */
#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ || __FreeBSD_kernel__ */
#ifdef __linux
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
char info[255]; /* Device info/description */
# ifdef TIOCGSERIAL
struct serial_struct serinfo; /* serial port info */
# endif /* TIOCGSERIAL */
@@ -767,32 +782,35 @@ list_devices(void)
close(fd);
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
# if defined(_ARCH_PPC) || defined(powerpc) || defined(__powerpc)
printf("serial serial:%s?baud=230400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
printf("serial serial:%s?baud=230400 \"Unknown\" \"%s\"\n", device, info);
# else
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
# endif /* _ARCH_PPC || powerpc || __powerpc */
}
}
for (i = 0; i < 16; i ++)
{
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("USB Serial Port #%d")),
i + 1);
sprintf(device, "/dev/usb/ttyUSB%d", i);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
printf("serial serial:%s?baud=230400 \"Unknown\" \"%s\"\n", device, info);
}
sprintf(device, "/dev/ttyUSB%d", i);
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
printf("serial serial:%s?baud=230400 \"Unknown\" \"%s\"\n", device, info);
}
}
@@ -804,9 +822,9 @@ list_devices(void)
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" "
"\"Equinox ESP %d Port #%d\"\n",
device, i, j + 1);
"\"Equinox ESP %d Port #%d\"\n", device, i, j + 1);
}
}
}
@@ -909,8 +927,9 @@ list_devices(void)
}
}
#elif defined(__sun)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
char info[255]; /* Device info/description */
/*
@@ -920,14 +939,17 @@ list_devices(void)
for (i = 0; i < 26; i ++)
{
sprintf(device, "/dev/cua/%c", 'a' + i);
if (access(device, 0) == 0)
if (!access(device, 0))
{
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
# ifdef B115200
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
# else
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
printf("serial serial:%s?baud=38400 \"Unknown\" \"%s\"\n", device, info);
# endif /* B115200 */
}
}
/*
@@ -1023,10 +1045,11 @@ list_devices(void)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
char info[255]; /* Device info/description */
/*
@@ -1039,8 +1062,11 @@ list_devices(void)
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Standard Serial Port #%d\"\n",
device, i + 1);
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
}
}
@@ -1114,9 +1140,10 @@ list_devices(void)
}
}
#elif defined(__NetBSD__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
char info[255]; /* Device info/description */
/*
@@ -1129,8 +1156,11 @@ list_devices(void)
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
}
}
@@ -1183,38 +1213,51 @@ list_devices(void)
{
CFTypeRef serialNameAsCFString;
CFTypeRef bsdPathAsCFString;
CFTypeRef hiddenVal;
char serialName[128];
char bsdPath[1024];
Boolean result;
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
/* Check if hidden... */
hiddenVal = IORegistryEntrySearchCFProperty(serialService,
kIOServicePlane,
CFSTR("HiddenPort"),
kCFAllocatorDefault,
kIORegistryIterateRecursively |
kIORegistryIterateParents);
if (hiddenVal)
CFRelease(hiddenVal); /* This interface should not be used */
else
{
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
{
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
bsdPath, serialName);
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
bsdPath, serialName);
}
}
}
}
@@ -1237,7 +1280,7 @@ list_devices(void)
* 'side_cb()' - Handle side-channel requests...
*/
static void
static int /* O - 0 on success, -1 on error */
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int use_bc) /* I - Using back-channel? */
@@ -1251,11 +1294,7 @@ side_cb(int print_fd, /* I - Print file */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr,
_("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -1271,6 +1310,7 @@ side_cb(int print_fd, /* I - Print file */
break;
case CUPS_SC_CMD_GET_BIDI :
status = CUPS_SC_STATUS_OK;
data[0] = use_bc;
datalen = 1;
break;
@@ -1281,7 +1321,7 @@ side_cb(int print_fd, /* I - Print file */
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+889
Ver Arquivo
@@ -0,0 +1,889 @@
/*
* "$Id$"
*
* SNMP supplies functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2008-2009 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"
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* backendSNMPSupplies() - Get the current supplies for a device.
* backend_init_supplies() - Initialize the supplies list.
* backend_walk_cb() - Interpret the supply value responses.
* utf16_to_utf8() - Convert UTF-16 text to UTF-8.
*/
/*
* Include necessary headers.
*/
#include "backend-private.h"
#include <cups/array.h>
/*
* Local constants...
*/
#define CUPS_MAX_SUPPLIES 32 /* Maximum number of supplies for a printer */
#define CUPS_SUPPLY_TIMEOUT 2.0 /* Timeout for SNMP lookups */
/*
* Local structures...
*/
typedef struct /**** Printer supply data ****/
{
char name[CUPS_SNMP_MAX_STRING], /* Name of supply */
color[8]; /* Color: "#RRGGBB" or "none" */
int colorant, /* Colorant index */
type, /* Supply type */
max_capacity, /* Maximum capacity */
level; /* Current level value */
} backend_supplies_t;
typedef struct /**** Printer state table ****/
{
int bit; /* State bit */
const char *keyword; /* IPP printer-state-reasons keyword */
} backend_state_t;
/*
* Local globals...
*/
static http_addr_t current_addr; /* Current address */
static int current_state = -1;
/* Current device state bits */
static int charset = -1; /* Character set for supply names */
static int num_supplies = 0;
/* Number of supplies found */
static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
/* Supply information */
static const int hrDeviceDescr[] =
{ CUPS_OID_hrDeviceDescr, 1, -1 };
/* Device description OID */
static const int hrPrinterStatus[] =
{ CUPS_OID_hrPrinterStatus, 1, -1 };
/* Current state OID */
static const int hrPrinterDetectedErrorState[] =
{ CUPS_OID_hrPrinterDetectedErrorState, 1, -1 };
/* Current printer state bits OID */
static const int prtGeneralCurrentLocalization[] =
{ CUPS_OID_prtGeneralCurrentLocalization, 1, -1 };
static const int prtLocalizationCharacterSet[] =
{ CUPS_OID_prtLocalizationCharacterSet, 1, 1, -1 },
prtLocalizationCharacterSetOffset =
(sizeof(prtLocalizationCharacterSet) /
sizeof(prtLocalizationCharacterSet[0]));
static const int prtMarkerColorantValue[] =
{ CUPS_OID_prtMarkerColorantValue, -1 },
/* Colorant OID */
prtMarkerColorantValueOffset =
(sizeof(prtMarkerColorantValue) /
sizeof(prtMarkerColorantValue[0]));
/* Offset to colorant index */
static const int prtMarkerLifeCount[] =
{ CUPS_OID_prtMarkerLifeCount, 1, 1, -1 };
/* Page counter OID */
static const int prtMarkerSuppliesEntry[] =
{ CUPS_OID_prtMarkerSuppliesEntry, -1 };
/* Supplies OID */
static const int prtMarkerSuppliesColorantIndex[] =
{ CUPS_OID_prtMarkerSuppliesColorantIndex, -1 },
/* Colorant index OID */
prtMarkerSuppliesColorantIndexOffset =
(sizeof(prtMarkerSuppliesColorantIndex) /
sizeof(prtMarkerSuppliesColorantIndex[0]));
/* Offset to supply index */
static const int prtMarkerSuppliesDescription[] =
{ CUPS_OID_prtMarkerSuppliesDescription, -1 },
/* Description OID */
prtMarkerSuppliesDescriptionOffset =
(sizeof(prtMarkerSuppliesDescription) /
sizeof(prtMarkerSuppliesDescription[0]));
/* Offset to supply index */
static const int prtMarkerSuppliesLevel[] =
{ CUPS_OID_prtMarkerSuppliesLevel, -1 },
/* Level OID */
prtMarkerSuppliesLevelOffset =
(sizeof(prtMarkerSuppliesLevel) /
sizeof(prtMarkerSuppliesLevel[0]));
/* Offset to supply index */
static const int prtMarkerSuppliesMaxCapacity[] =
{ CUPS_OID_prtMarkerSuppliesMaxCapacity, -1 },
/* Max capacity OID */
prtMarkerSuppliesMaxCapacityOffset =
(sizeof(prtMarkerSuppliesMaxCapacity) /
sizeof(prtMarkerSuppliesMaxCapacity[0]));
/* Offset to supply index */
static const int prtMarkerSuppliesType[] =
{ CUPS_OID_prtMarkerSuppliesType, -1 },
/* Type OID */
prtMarkerSuppliesTypeOffset =
(sizeof(prtMarkerSuppliesType) /
sizeof(prtMarkerSuppliesType[0]));
/* Offset to supply index */
static const backend_state_t const printer_states[] =
{
{ CUPS_TC_lowPaper, "media-low-report" },
{ CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty, "media-empty-warning" },
{ CUPS_TC_lowToner, "toner-low-report" },
{ CUPS_TC_noToner, "toner-empty-warning" },
{ CUPS_TC_doorOpen, "door-open-report" },
{ CUPS_TC_jammed, "media-jam-warning" },
/* { CUPS_TC_offline, "offline-report" }, */ /* unreliable */
/* { CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint, "service-needed-warning" }, */ /* unreliable */
{ CUPS_TC_inputTrayMissing, "input-tray-missing-warning" },
{ CUPS_TC_outputTrayMissing, "output-tray-missing-warning" },
{ CUPS_TC_markerSupplyMissing, "marker-supply-missing-warning" },
{ CUPS_TC_outputNearFull, "output-area-almost-full-report" },
{ CUPS_TC_outputFull, "output-area-full-warning" }
};
/*
* Local functions...
*/
static void backend_init_supplies(int snmp_fd, http_addr_t *addr);
static void backend_walk_cb(cups_snmp_t *packet, void *data);
static void utf16_to_utf8(cups_utf8_t *dst, const unsigned char *src,
size_t srcsize, size_t dstsize, int le);
/*
* 'backendSNMPSupplies()' - Get the current supplies for a device.
*/
int /* O - 0 on success, -1 on error */
backendSNMPSupplies(
int snmp_fd, /* I - SNMP socket */
http_addr_t *addr, /* I - Printer address */
int *page_count, /* O - Page count */
int *printer_state) /* O - Printer state */
{
if (!httpAddrEqual(addr, &current_addr))
backend_init_supplies(snmp_fd, addr);
else if (num_supplies > 0)
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesLevel,
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
if (page_count)
*page_count = -1;
if (printer_state)
*printer_state = -1;
if (num_supplies > 0)
{
int i, /* Looping var */
new_state, /* New state value */
change_state; /* State change */
char value[CUPS_MAX_SUPPLIES * 4],
/* marker-levels value string */
*ptr; /* Pointer into value string */
cups_snmp_t packet; /* SNMP response packet */
/*
* Generate the marker-levels value string...
*/
for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr))
{
if (i)
*ptr++ = ',';
if (supplies[i].max_capacity > 0)
sprintf(ptr, "%d", 100 * supplies[i].level / supplies[i].max_capacity);
else
strcpy(ptr, "-1");
}
fprintf(stderr, "ATTR: marker-levels=%s\n", value);
/*
* Get the current printer status bits...
*/
if (!_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
hrPrinterDetectedErrorState))
return (-1);
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_OCTET_STRING)
return (-1);
if (packet.object_value.string.num_bytes == 2)
new_state = (packet.object_value.string.bytes[0] << 8) |
packet.object_value.string.bytes[1];
else if (packet.object_value.string.num_bytes == 1)
new_state = (packet.object_value.string.bytes[0] << 8);
else
new_state = 0;
if (current_state < 0)
change_state = 0xffff;
else
change_state = current_state ^ new_state;
for (i = 0;
i < (int)(sizeof(printer_states) / sizeof(printer_states[0]));
i ++)
if (change_state & printer_states[i].bit)
fprintf(stderr, "STATE: %c%s\n",
(new_state & printer_states[i].bit) ? '+' : '-',
printer_states[i].keyword);
current_state = new_state;
/*
* Get the current printer state...
*/
if (printer_state)
{
if (!_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
hrPrinterStatus))
return (-1);
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_INTEGER)
return (-1);
*printer_state = packet.object_value.integer;
}
/*
* Get the current page count...
*/
if (page_count)
{
if (!_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
prtMarkerLifeCount))
return (-1);
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_COUNTER)
return (-1);
*page_count = packet.object_value.counter;
}
return (0);
}
else
return (-1);
}
/*
* 'backend_init_supplies()' - Initialize the supplies list.
*/
static void
backend_init_supplies(
int snmp_fd, /* I - SNMP socket */
http_addr_t *addr) /* I - Printer address */
{
int i, /* Looping var */
type; /* Current marker type */
cups_file_t *cachefile; /* Cache file */
const char *cachedir; /* CUPS_CACHEDIR value */
char addrstr[1024], /* Address string */
cachefilename[1024], /* Cache filename */
description[CUPS_SNMP_MAX_STRING],
/* Device description string */
value[CUPS_MAX_SUPPLIES * (CUPS_SNMP_MAX_STRING * 2 + 3)],
/* Value string */
*ptr, /* Pointer into value string */
*name_ptr; /* Pointer into name string */
cups_snmp_t packet; /* SNMP response packet */
ppd_file_t *ppd; /* PPD file for this queue */
ppd_attr_t *ppdattr; /* cupsSNMPSupplies attribute */
static const char * const types[] = /* Supply types */
{
"other",
"unknown",
"toner",
"wasteToner",
"ink",
"inkCartridge",
"inkRibbon",
"wasteInk",
"opc",
"developer",
"fuserOil",
"solidWax",
"ribbonWax",
"wasteWax",
"fuser",
"coronaWire",
"fuserOilWick",
"cleanerUnit",
"fuserCleaningPad",
"transferUnit",
"tonerCartridge",
"fuserOiler",
"water",
"wasteWater",
"glueWaterAdditive",
"wastePaper",
"bindingSupply",
"bandingSupply",
"stitchingWire",
"shrinkWrap",
"paperWrap",
"staples",
"inserts",
"covers"
};
/*
* Reset state information...
*/
current_addr = *addr;
current_state = -1;
num_supplies = -1;
charset = -1;
memset(supplies, 0, sizeof(supplies));
/*
* See if we should be getting supply levels via SNMP...
*/
if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL &&
(ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&
ppdattr->value && strcasecmp(ppdattr->value, "true"))
{
ppdClose(ppd);
return;
}
ppdClose(ppd);
/*
* Get the device description...
*/
if (!_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
hrDeviceDescr))
return;
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_OCTET_STRING)
{
strlcpy(description, "Unknown", sizeof(description));
num_supplies = 0;
}
else
strlcpy(description, (char *)packet.object_value.string.bytes,
sizeof(description));
fprintf(stderr, "DEBUG2: hrDeviceDesc=\"%s\"\n", description);
/*
* See if we have already queried this device...
*/
httpAddrString(addr, addrstr, sizeof(addrstr));
if ((cachedir = getenv("CUPS_CACHEDIR")) == NULL)
cachedir = CUPS_CACHEDIR;
snprintf(cachefilename, sizeof(cachefilename), "%s/%s.snmp", cachedir,
addrstr);
if ((cachefile = cupsFileOpen(cachefilename, "r")) != NULL)
{
/*
* Yes, read the cache file:
*
* 2 num_supplies charset
* device description
* supply structures...
*/
if (cupsFileGets(cachefile, value, sizeof(value)))
{
if (sscanf(value, "2 %d%d", &num_supplies, &charset) == 2 &&
num_supplies <= CUPS_MAX_SUPPLIES &&
cupsFileGets(cachefile, value, sizeof(value)))
{
if (!strcmp(description, value))
cupsFileRead(cachefile, (char *)supplies,
num_supplies * sizeof(backend_supplies_t));
else
{
num_supplies = -1;
charset = -1;
}
}
else
{
num_supplies = -1;
charset = -1;
}
}
cupsFileClose(cachefile);
}
/*
* If the cache information isn't correct, scan for supplies...
*/
if (charset < 0)
{
/*
* Get the configured character set...
*/
int oid[CUPS_SNMP_MAX_OID]; /* OID for character set */
if (!_cupsSNMPWrite(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
prtGeneralCurrentLocalization))
return;
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_INTEGER)
{
fprintf(stderr,
"DEBUG: prtGeneralCurrentLocalization type is %x, expected %x!\n",
packet.object_type, CUPS_ASN1_INTEGER);
return;
}
fprintf(stderr, "DEBUG2: prtGeneralCurrentLocalization=%d\n",
packet.object_value.integer);
_cupsSNMPCopyOID(oid, prtLocalizationCharacterSet, CUPS_SNMP_MAX_OID);
oid[prtLocalizationCharacterSetOffset - 2] = packet.object_value.integer;
if (!_cupsSNMPWrite(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,
oid))
return;
if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
packet.object_type != CUPS_ASN1_INTEGER)
{
fprintf(stderr,
"DEBUG: prtLocalizationCharacterSet type is %x, expected %x!\n",
packet.object_type, CUPS_ASN1_INTEGER);
return;
}
fprintf(stderr, "DEBUG2: prtLocalizationCharacterSet=%d\n",
packet.object_value.integer);
charset = packet.object_value.integer;
}
if (num_supplies < 0)
{
/*
* Walk the printer configuration information...
*/
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry,
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
}
/*
* Save the cached information...
*/
if (num_supplies < 0)
num_supplies = 0;
if ((cachefile = cupsFileOpen(cachefilename, "w")) != NULL)
{
cupsFilePrintf(cachefile, "2 %d %d\n", num_supplies, charset);
cupsFilePrintf(cachefile, "%s\n", description);
if (num_supplies > 0)
cupsFileWrite(cachefile, (char *)supplies,
num_supplies * sizeof(backend_supplies_t));
cupsFileClose(cachefile);
}
if (num_supplies <= 0)
return;
/*
* Get the colors...
*/
for (i = 0; i < num_supplies; i ++)
strcpy(supplies[i].color, "none");
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerColorantValue,
CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL);
/*
* Output the marker-colors attribute...
*/
for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr))
{
if (i)
*ptr++ = ',';
strcpy(ptr, supplies[i].color);
}
fprintf(stderr, "ATTR: marker-colors=%s\n", value);
/*
* Output the marker-names attribute...
*/
for (i = 0, ptr = value; i < num_supplies; i ++)
{
if (i)
*ptr++ = ',';
*ptr++ = '\"';
for (name_ptr = supplies[i].name; *name_ptr;)
{
if (*name_ptr == '\\' || *name_ptr == '\"')
*ptr++ = '\\';
*ptr++ = *name_ptr++;
}
*ptr++ = '\"';
}
*ptr = '\0';
fprintf(stderr, "ATTR: marker-names=%s\n", value);
/*
* Output the marker-types attribute...
*/
for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr))
{
if (i)
*ptr++ = ',';
type = supplies[i].type;
if (type < CUPS_TC_other || type > CUPS_TC_covers)
strcpy(ptr, "unknown");
else
strcpy(ptr, types[type - CUPS_TC_other]);
}
fprintf(stderr, "ATTR: marker-types=%s\n", value);
}
/*
* 'backend_walk_cb()' - Interpret the supply value responses.
*/
static void
backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
void *data) /* I - User data (unused) */
{
int i, j, k; /* Looping vars */
static const char * const colors[8][2] =
{ /* Standard color names */
{ "black", "#000000" },
{ "blue", "#0000FF" },
{ "cyan", "#00FFFF" },
{ "green", "#00FF00" },
{ "magenta", "#FF00FF" },
{ "red", "#FF0000" },
{ "white", "#FFFFFF" },
{ "yellow", "#FFFF00" }
};
(void)data;
if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerColorantValue) &&
packet->object_type == CUPS_ASN1_OCTET_STRING)
{
/*
* Get colorant...
*/
i = packet->object_name[prtMarkerColorantValueOffset];
fprintf(stderr, "DEBUG2: prtMarkerColorantValue.1.%d = \"%s\"\n", i,
(char *)packet->object_value.string.bytes);
for (j = 0; j < num_supplies; j ++)
if (supplies[j].colorant == i)
{
for (k = 0; k < (int)(sizeof(colors) / sizeof(colors[0])); k ++)
if (!strcmp(colors[k][0], (char *)packet->object_value.string.bytes))
{
strcpy(supplies[j].color, colors[k][1]);
break;
}
}
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesColorantIndex))
{
/*
* Get colorant index...
*/
i = packet->object_name[prtMarkerSuppliesColorantIndexOffset];
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
packet->object_type != CUPS_ASN1_INTEGER)
return;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesColorantIndex.1.%d = %d\n", i,
packet->object_value.integer);
if (i > num_supplies)
num_supplies = i;
supplies[i - 1].colorant = packet->object_value.integer;
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesDescription))
{
/*
* Get supply name/description...
*/
i = packet->object_name[prtMarkerSuppliesDescriptionOffset];
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
packet->object_type != CUPS_ASN1_OCTET_STRING)
return;
if (i > num_supplies)
num_supplies = i;
switch (charset)
{
case CUPS_TC_csASCII :
case CUPS_TC_csUTF8 :
case CUPS_TC_csUnicodeASCII :
strlcpy(supplies[i - 1].name,
(char *)packet->object_value.string.bytes,
sizeof(supplies[0].name));
break;
case CUPS_TC_csISOLatin1 :
case CUPS_TC_csUnicodeLatin1 :
cupsCharsetToUTF8((cups_utf8_t *)supplies[i - 1].name,
(char *)packet->object_value.string.bytes,
sizeof(supplies[0].name), CUPS_ISO8859_1);
break;
case CUPS_TC_csShiftJIS :
cupsCharsetToUTF8((cups_utf8_t *)supplies[i - 1].name,
(char *)packet->object_value.string.bytes,
sizeof(supplies[0].name), CUPS_JIS_X0213);
break;
case CUPS_TC_csUCS4 :
case CUPS_TC_csUTF32 :
case CUPS_TC_csUTF32BE :
case CUPS_TC_csUTF32LE :
cupsUTF32ToUTF8((cups_utf8_t *)supplies[i - 1].name,
(cups_utf32_t *)packet->object_value.string.bytes,
sizeof(supplies[0].name));
break;
case CUPS_TC_csUnicode :
case CUPS_TC_csUTF16BE :
case CUPS_TC_csUTF16LE :
utf16_to_utf8((cups_utf8_t *)supplies[i - 1].name,
packet->object_value.string.bytes,
packet->object_value.string.num_bytes,
sizeof(supplies[0].name), charset == CUPS_TC_csUTF16LE);
break;
default :
/*
* If we get here, the printer is using an unknown character set and
* we just want to copy characters that look like ASCII...
*/
{
char *src, *dst; /* Pointers into strings */
/*
* Loop safe because both the object_value and supplies char arrays
* are CUPS_SNMP_MAX_STRING elements long.
*/
for (src = (char *)packet->object_value.string.bytes,
dst = supplies[i - 1].name;
*src;
src ++)
{
if ((*src & 0x80) || *src < ' ' || *src == 0x7f)
*dst++ = '?';
else
*dst++ = *src;
}
*dst = '\0';
}
break;
}
fprintf(stderr, "DEBUG2: prtMarkerSuppliesDescription.1.%d = \"%s\"\n", i,
supplies[i - 1].name);
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesLevel))
{
/*
* Get level...
*/
i = packet->object_name[prtMarkerSuppliesLevelOffset];
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
packet->object_type != CUPS_ASN1_INTEGER)
return;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesLevel.1.%d = %d\n", i,
packet->object_value.integer);
if (i > num_supplies)
num_supplies = i;
supplies[i - 1].level = packet->object_value.integer;
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesMaxCapacity))
{
/*
* Get max capacity...
*/
i = packet->object_name[prtMarkerSuppliesMaxCapacityOffset];
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
packet->object_type != CUPS_ASN1_INTEGER)
return;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesMaxCapacity.1.%d = %d\n", i,
packet->object_value.integer);
if (i > num_supplies)
num_supplies = i;
supplies[i - 1].max_capacity = packet->object_value.integer;
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesType))
{
/*
* Get marker type...
*/
i = packet->object_name[prtMarkerSuppliesTypeOffset];
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
packet->object_type != CUPS_ASN1_INTEGER)
return;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesType.1.%d = %d\n", i,
packet->object_value.integer);
if (i > num_supplies)
num_supplies = i;
supplies[i - 1].type = packet->object_value.integer;
}
}
/*
* 'utf16_to_utf8()' - Convert UTF-16 text to UTF-8.
*/
static void
utf16_to_utf8(
cups_utf8_t *dst, /* I - Destination buffer */
const unsigned char *src, /* I - Source string */
size_t srcsize, /* I - Size of source string */
size_t dstsize, /* I - Size of destination buffer */
int le) /* I - Source is little-endian? */
{
cups_utf32_t ch, /* Current character */
temp[CUPS_SNMP_MAX_STRING],
/* UTF-32 string */
*ptr; /* Pointer into UTF-32 string */
for (ptr = temp; srcsize >= 2;)
{
if (le)
ch = src[0] | (src[1] << 8);
else
ch = (src[0] << 8) | src[1];
src += 2;
srcsize -= 2;
if (ch >= 0xd800 && ch <= 0xdbff && srcsize >= 2)
{
/*
* Multi-word UTF-16 char...
*/
int lch; /* Lower word */
if (le)
lch = src[0] | (src[1] << 8);
else
lch = (src[0] << 8) | src[1];
if (lch >= 0xdc00 && lch <= 0xdfff)
{
src += 2;
srcsize -= 2;
ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000;
}
}
if (ptr < (temp + CUPS_SNMP_MAX_STRING - 1))
*ptr++ = ch;
}
*ptr = '\0';
cupsUTF32ToUTF8(dst, temp, dstsize);
}
/*
* End of "$Id$".
*/
+231 -1146
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+56 -84
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -17,7 +17,6 @@
* Contents:
*
* main() - Send a file to the printer or server.
* side_cb() - Handle side-channel requests...
* wait_bc() - Wait for back-channel data...
*/
@@ -47,7 +46,6 @@
* Local functions...
*/
static void side_cb(int print_fd, int device_fd, int use_bc);
static int wait_bc(int device_fd, int secs);
@@ -63,7 +61,8 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
char method[255], /* Method in URI */
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) */
@@ -73,7 +72,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sep; /* Option separator */
int print_fd; /* Print file */
int copies; /* Number of copies to print */
time_t start_time; /* Time of first connect */
time_t start_time, /* Time of first connect */
current_time, /* Current time */
wait_time; /* Time to wait before shutting down socket */
int recoverable; /* Recoverable error shown? */
int contimeout; /* Connection timeout */
int waiteof; /* Wait for end-of-file? */
@@ -85,6 +86,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Connected address */
char addrname[256]; /* Address name */
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 tbytes; /* Total number of bytes written */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
@@ -117,7 +122,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 1)
{
puts("network socket \"Unknown\" \"AppSocket/HP JetDirect\"");
printf("network socket \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("AppSocket/HP JetDirect")));
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
@@ -146,7 +152,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
perror("ERROR: unable to open print file");
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
@@ -157,9 +165,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the hostname and port number from the URI...
*/
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
if ((device_uri = cupsBackendDeviceURI(argv)) == 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)
@@ -250,6 +260,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sprintf(portname, "%d", port);
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -257,11 +270,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
return (CUPS_BACKEND_STOP);
}
_cupsLangPrintf(stderr,
_("INFO: Attempting to connect to host %s on port %d\n"),
hostname, port);
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
for (delay = 5;;)
{
@@ -332,9 +342,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (recoverable)
{
/*
* If we've shown a recoverable error make sure the printer proxies
* have a chance to see the recovered message. Not pretty but
* necessary for now...
* If we've shown a recoverable error make sure the printer proxies have a
* chance to see the recovered message. Not pretty but necessary for now...
*/
fputs("INFO: recovered: \n", stderr);
@@ -342,7 +351,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
#ifdef AF_INET6
if (addr->addr.addr.sa_family == AF_INET6)
@@ -356,6 +365,18 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
ntohs(addr->addr.ipv4.sin_port));
/*
* See if the printer supports SNMP...
*/
if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
{
have_supplies = !backendSNMPSupplies(snmp_fd, &(addr->addr), &start_count,
NULL);
}
else
have_supplies = start_count = 0;
/*
* Print everything...
*/
@@ -372,7 +393,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, 1, side_cb);
tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addr->addr), 1, 0,
backendNetworkSideCB);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
@@ -385,10 +407,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
/*
* Get any pending back-channel data...
* Wait up to 5 seconds to get any pending back-channel data...
*/
while (wait_bc(device_fd, 5) > 0);
wait_time = time(NULL) + 5;
while (wait_time >= time(&current_time))
if (wait_bc(device_fd, wait_time - current_time) <= 0)
break;
if (waiteof)
{
@@ -404,6 +429,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
while (wait_bc(device_fd, 90) > 0);
}
/*
* Collect the final page count as needed...
*/
if (have_supplies &&
!backendSNMPSupplies(snmp_fd, &(addr->addr), &page_count, NULL) &&
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
/*
* Close the socket connection...
*/
@@ -426,68 +460,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
/*
* 'side_cb()' - Handle side-channel requests...
*/
static void
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
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 */
const char *device_id; /* 1284DEVICEID env var */
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return;
}
switch (command)
{
case CUPS_SC_CMD_DRAIN_OUTPUT :
/*
* Our sockets disable the Nagle algorithm and data is sent immediately.
*/
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 :
data[0] = use_bc;
datalen = 1;
break;
case CUPS_SC_CMD_GET_DEVICE_ID :
if ((device_id = getenv("1284DEVICEID")) != NULL)
{
strlcpy(data, device_id, sizeof(data));
datalen = (int)strlen(data);
break;
}
default :
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
}
/*
* 'wait_bc()' - Wait for back-channel data...
*/
-1
Ver Arquivo
@@ -34,7 +34,6 @@
# include <fcntl.h>
#endif /* WIN32 */
#define DEBUG
#include "ieee1284.c"
+654
Ver Arquivo
@@ -0,0 +1,654 @@
/*
* "$Id$"
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2005 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"
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Run the named backend.
* sigterm_handler() - Flag when we get SIGTERM.
* usage() - Show usage information.
* walk_cb() - Show results of cupsSideChannelSNMPWalk...
*/
/*
* Include necessary headers.
*/
#include <stdio.h>
#include <stdlib.h>
#include <cups/string.h>
#include <cups/cups.h>
#include <cups/sidechannel.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.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);
static void walk_cb(const char *oid, const char *data, int datalen,
void *context);
/*
* 'main()' - Run the named backend.
*
* Usage:
*
* betest [-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 */
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 */
/*
* 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, 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, 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, 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, %s\n", oid,
statuses[scstatus], buffer);
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
statuses[scstatus], 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 [-oid 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(" -oid 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) */
{
printf("CUPS_SC_CMD_SNMP_WALK %s=%s (%d bytes)\n", oid, data, datalen);
}
/*
* End of "$Id$".
*/
+83
Ver Arquivo
@@ -0,0 +1,83 @@
/*
* "$Id$"
*
* SNMP supplies test program for the Common UNIX Printing System (CUPS).
*
* Copyright 2008 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"
* "LICENSE" which should have been included with this file. If this
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Show the supplies state of a printer.
*/
/*
* 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);
}
}
/*
* End of "$Id$".
*/
+430 -209
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+832
Ver Arquivo
@@ -0,0 +1,832 @@
/*
* "$Id$"
*
* Libusb interface code for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2009 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/".
*
* Contents:
*
* list_devices() - List the available printers.
* print_device() - Print a file to a USB device.
* close_device() - Close the connection to the USB printer.
* find_device() - Find or enumerate USB printers.
* get_device_id() - Get the IEEE-1284 device ID for the printer.
* list_cb() - List USB printers for discovery.
* make_device_uri() - Create a device URI for a USB printer.
* open_device() - Open a connection to the USB printer.
* print_cb() - Find a USB printer for printing.
* side_cb() - Handle side-channel requests.
*/
/*
* Include necessary headers...
*/
#include <usb.h>
#include <poll.h>
/*
* Local types...
*/
typedef struct usb_printer_s /**** USB Printer Data ****/
{
struct usb_device *device; /* Device info */
int conf, /* Configuration */
iface, /* Interface */
altset, /* Alternate setting */
write_endp, /* Write endpoint */
read_endp; /* Read endpoint */
struct usb_dev_handle *handle; /* Open handle to device */
} usb_printer_t;
typedef int (*usb_cb_t)(usb_printer_t *, const char *, const char *,
const void *);
/*
* Local functions...
*/
static int close_device(usb_printer_t *printer);
static usb_printer_t *find_device(usb_cb_t cb, const void *data);
static int get_device_id(usb_printer_t *printer, char *buffer,
size_t bufsize);
static int list_cb(usb_printer_t *printer, const char *device_uri,
const char *device_id, const void *data);
static char *make_device_uri(usb_printer_t *printer,
const char *device_id,
char *uri, size_t uri_size);
static int open_device(usb_printer_t *printer, int verbose);
static int print_cb(usb_printer_t *printer, const char *device_uri,
const char *device_id, const void *data);
static ssize_t side_cb(usb_printer_t *printer, int print_fd);
/*
* 'list_devices()' - List the available printers.
*/
void
list_devices(void)
{
fputs("DEBUG: list_devices\n", stderr);
find_device(list_cb, NULL);
}
/*
* '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 */
{
usb_printer_t *printer; /* Printer */
ssize_t bytes, /* Bytes read/written */
tbytes; /* Total bytes written */
char buffer[8192]; /* Print data buffer */
struct sigaction action; /* Actions for POSIX signals */
struct pollfd pfds[2]; /* Poll descriptors */
fputs("DEBUG: print_device\n", stderr);
/*
* Connect to the printer...
*/
while ((printer = find_device(print_cb, uri)) == NULL)
{
_cupsLangPuts(stderr,
_("INFO: Waiting for printer to become available...\n"));
sleep(5);
}
/*
* 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)
{
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGTERM, &action, NULL);
}
tbytes = 0;
pfds[0].fd = print_fd;
pfds[0].events = POLLIN;
pfds[1].fd = CUPS_SC_FD;
pfds[1].events = POLLIN;
while (copies > 0 && tbytes >= 0)
{
copies --;
if (print_fd != 0)
{
fputs("PAGE: 1 1\n", stderr);
lseek(print_fd, 0, SEEK_SET);
}
/*
* TODO: Add back-channel support, along with better write error handling.
*/
while (poll(pfds, 2, -1) > 0)
{
/*
* CUPS STR #3318: USB process hangs on end-of-file, making further
* printing impossible
*
* From a strict interpretation of POSIX poll(), POLLHUP should never be
* set without POLLIN, since POLLIN is the event you request. That said,
* it appears that some versions of Linux break this.
*/
if (pfds[0].revents & (POLLIN | POLLHUP))
{
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
{
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
bytes, 45000) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to write %d bytes to printer!\n"),
(int)bytes);
tbytes = -1;
break;
}
tbytes += bytes;
}
else if (bytes == 0 || (bytes < 0 && errno != EAGAIN && errno != EINTR))
break;
}
if (pfds[1].revents & (POLLIN | POLLHUP))
{
if ((bytes = side_cb(printer, print_fd)) < 0)
pfds[1].events = 0; /* Filter has gone away... */
else
tbytes += bytes;
}
}
}
/*
* Close our connection and return...
*/
close_device(printer);
return (CUPS_BACKEND_OK);
}
/*
* 'close_device()' - Close the connection to the USB printer.
*/
static int /* I - 0 on success, -1 on failure */
close_device(usb_printer_t *printer) /* I - Printer */
{
if (printer->handle)
{
/*
* Release interfaces before closing so that we know all data is written
* to the device...
*/
int number = printer->device->config[printer->conf].
interface[printer->iface].
altsetting[printer->altset].bInterfaceNumber;
usb_release_interface(printer->handle, number);
if (number != 0)
usb_release_interface(printer->handle, 0);
/*
* Close the interface and return...
*/
usb_close(printer->handle);
printer->handle = NULL;
}
return (0);
}
/*
* 'find_device()' - Find or enumerate USB printers.
*/
static usb_printer_t * /* O - Found printer */
find_device(usb_cb_t cb, /* I - Callback function */
const void *data) /* I - User data for callback */
{
struct usb_bus *bus; /* Current bus */
struct usb_device *device; /* Current device */
struct usb_config_descriptor *confptr;/* Pointer to current configuration */
struct usb_interface *ifaceptr; /* Pointer to current interface */
struct usb_interface_descriptor *altptr;
/* Pointer to current alternate setting */
struct usb_endpoint_descriptor *endpptr;
/* Pointer to current endpoint */
int conf, /* Current configuration */
iface, /* Current interface */
altset, /* Current alternate setting */
protocol, /* Current protocol */
endp, /* Current endpoint */
read_endp, /* Current read endpoint */
write_endp; /* Current write endpoint */
char device_id[1024],/* IEEE-1284 device ID */
device_uri[1024];
/* Device URI */
static usb_printer_t printer; /* Current printer */
/*
* Initialize libusb...
*/
usb_init();
fprintf(stderr, "DEBUG: usb_find_busses=%d\n", usb_find_busses());
fprintf(stderr, "DEBUG: usb_find_devices=%d\n", usb_find_devices());
/*
* Then loop through the devices it found...
*/
for (bus = usb_get_busses(); bus; bus = bus->next)
for (device = bus->devices; device; device = device->next)
{
/*
* Ignore devices with no configuration data and anything that is not
* a printer...
*/
if (!device->config || !device->descriptor.idVendor ||
!device->descriptor.idProduct)
continue;
for (conf = 0, confptr = device->config;
conf < device->descriptor.bNumConfigurations;
conf ++, confptr ++)
for (iface = 0, ifaceptr = confptr->interface;
iface < confptr->bNumInterfaces;
iface ++, ifaceptr ++)
{
/*
* Some printers offer multiple interfaces...
*/
protocol = 0;
for (altset = 0, altptr = ifaceptr->altsetting;
altset < ifaceptr->num_altsetting;
altset ++, altptr ++)
{
/*
* Currently we only support unidirectional and bidirectional
* printers. Future versions of this code will support the
* 1284.4 (packet mode) protocol as well.
*/
if (altptr->bInterfaceClass != USB_CLASS_PRINTER ||
altptr->bInterfaceSubClass != 1 ||
(altptr->bInterfaceProtocol != 1 && /* Unidirectional */
altptr->bInterfaceProtocol != 2) || /* Bidirectional */
altptr->bInterfaceProtocol < protocol)
continue;
read_endp = -1;
write_endp = -1;
for (endp = 0, endpptr = altptr->endpoint;
endp < altptr->bNumEndpoints;
endp ++, endpptr ++)
if ((endpptr->bmAttributes & USB_ENDPOINT_TYPE_MASK) ==
USB_ENDPOINT_TYPE_BULK)
{
if (endpptr->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
read_endp = endp;
else
write_endp = endp;
}
if (write_endp >= 0)
{
/*
* Save the best match so far...
*/
protocol = altptr->bInterfaceProtocol;
printer.altset = altset;
printer.write_endp = write_endp;
printer.read_endp = read_endp;
}
}
if (protocol > 0)
{
printer.device = device;
printer.conf = conf;
printer.iface = iface;
printer.handle = NULL;
if (!open_device(&printer, data != NULL))
{
if (!get_device_id(&printer, device_id, sizeof(device_id)))
{
make_device_uri(&printer, device_id, device_uri,
sizeof(device_uri));
if ((*cb)(&printer, device_uri, device_id, data))
{
printer.read_endp = printer.device->config[printer.conf].
interface[printer.iface].
altsetting[printer.altset].
endpoint[printer.read_endp].
bEndpointAddress;
printer.write_endp = printer.device->config[printer.conf].
interface[printer.iface].
altsetting[printer.altset].
endpoint[printer.write_endp].
bEndpointAddress;
return (&printer);
}
}
close_device(&printer);
}
}
}
}
/*
* If we get this far without returning, then we haven't found a printer
* to print to...
*/
return (NULL);
}
/*
* 'get_device_id()' - Get the IEEE-1284 device ID for the printer.
*/
static int /* O - 0 on success, -1 on error */
get_device_id(usb_printer_t *printer, /* I - Printer */
char *buffer, /* I - String buffer */
size_t bufsize) /* I - Number of bytes in buffer */
{
int length; /* Length of device ID */
if (usb_control_msg(printer->handle,
USB_TYPE_CLASS | USB_ENDPOINT_IN | USB_RECIP_INTERFACE,
0, printer->conf, printer->iface,
buffer, bufsize, 5000) < 0)
{
*buffer = '\0';
return (-1);
}
/*
* Extract the length of the device ID string from the first two
* bytes. The 1284 spec says the length is stored MSB first...
*/
length = (((unsigned)buffer[0] & 255) << 8) +
((unsigned)buffer[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 > bufsize)
length = (((unsigned)buffer[1] & 255) << 8) +
((unsigned)buffer[0] & 255);
if (length > bufsize)
length = bufsize;
length -= 2;
/*
* Copy the device ID text to the beginning of the buffer and
* nul-terminate.
*/
memmove(buffer, buffer + 2, length);
buffer[length] = '\0';
return (0);
}
/*
* 'list_cb()' - List USB printers for discovery.
*/
static int /* O - 0 to continue, 1 to stop */
list_cb(usb_printer_t *printer, /* I - Printer */
const char *device_uri, /* I - Device URI */
const char *device_id, /* I - IEEE-1284 device ID */
const void *data) /* I - User data (not used) */
{
char make_model[1024]; /* Make and model */
/*
* Get the device URI and make/model strings...
*/
backendGetMakeModel(device_id, make_model, sizeof(make_model));
/*
* Report the printer...
*/
cupsBackendReport("direct", device_uri, make_model, make_model, device_id,
NULL);
/*
* Keep going...
*/
return (0);
}
/*
* 'make_device_uri()' - Create a device URI for a USB printer.
*/
static char * /* O - Device URI */
make_device_uri(
usb_printer_t *printer, /* I - Printer */
const char *device_id, /* I - IEEE-1284 device ID */
char *uri, /* I - Device URI buffer */
size_t uri_size) /* I - Size of device URI buffer */
{
char options[1024]; /* Device URI options */
int num_values; /* Number of 1284 parameters */
cups_option_t *values; /* 1284 parameters */
const char *mfg, /* Manufacturer */
*mdl, /* Model */
*des, /* Description */
*sern; /* Serial number */
char tempmfg[256], /* Temporary manufacturer string */
tempsern[256], /* Temporary serial number string */
*tempptr; /* Pointer into temp string */
/*
* Get the make, model, and serial numbers...
*/
num_values = _ppdGet1284Values(device_id, &values);
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
if ((sern = cupsGetOption("SN", num_values, values)) == NULL)
{
/*
* Try getting the serial number from the device itself...
*/
int length = usb_get_string_simple(printer->handle,
printer->device->descriptor.
iSerialNumber,
tempsern, sizeof(tempsern) - 1);
if (length > 0)
{
tempsern[length] = '\0';
sern = tempsern;
}
}
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);
#ifdef __APPLE__
/*
* To maintain compatibility with the original IOKit-based backend on Mac OS X,
* don't map manufacturer names...
*/
if (!mfg)
#else
/*
* To maintain compatibility with the original character device backend on
* Linux and *BSD, map manufacturer names...
*/
if (mfg)
{
if (!strcasecmp(mfg, "Hewlett-Packard"))
mfg = "HP";
else if (!strcasecmp(mfg, "Lexmark International"))
mfg = "Lexmark";
}
else
#endif /* __APPLE__ */
{
/*
* No manufacturer? Use the model string or description...
*/
if (mdl)
_ppdNormalizeMakeAndModel(mdl, tempmfg, sizeof(tempmfg));
else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL ||
(des = cupsGetOption("DES", num_values, values)) != NULL)
_ppdNormalizeMakeAndModel(des, tempmfg, sizeof(tempmfg));
else
strlcpy(tempmfg, "Unknown", sizeof(tempmfg));
if ((tempptr = strchr(tempmfg, ' ')) != NULL)
*tempptr = '\0';
mfg = tempmfg;
}
/*
* Generate the device URI from the manufacturer, model, serial number,
* and interface number...
*/
if (sern)
{
if (printer->iface > 0)
snprintf(options, sizeof(options), "?serial=%s&interface=%d", sern,
printer->iface);
else
snprintf(options, sizeof(options), "?serial=%s", sern);
}
else if (printer->iface > 0)
snprintf(options, sizeof(options), "?interface=%d", printer->iface);
else
options[0] = '\0';
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, "usb", NULL, mfg, 0,
"/%s%s", mdl, options);
cupsFreeOptions(num_values, values);
return (uri);
}
/*
* 'open_device()' - Open a connection to the USB printer.
*/
static int /* O - 0 on success, -1 on error */
open_device(usb_printer_t *printer, /* I - Printer */
int verbose) /* I - Update connecting-to-device state? */
{
int number; /* Configuration/interface/altset numbers */
/*
* Return immediately if we are already connected...
*/
if (printer->handle)
return (0);
/*
* Try opening the printer...
*/
if ((printer->handle = usb_open(printer->device)) == NULL)
return (-1);
/*
* Then set the desired configuration...
*/
if (verbose)
fputs("STATE: +connecting-to-device\n", stderr);
number = printer->device->config[printer->conf].bConfigurationValue;
if (usb_set_configuration(printer->handle, number) < 0)
{
/*
* If the set fails, chances are that the printer only supports a
* single configuration. Technically these printers don't conform to
* the USB printer specification, but otherwise they'll work...
*/
if (errno != EBUSY)
fprintf(stderr, "DEBUG: Failed to set configuration %d for %04x:%04x\n",
number, printer->device->descriptor.idVendor,
printer->device->descriptor.idProduct);
}
/*
* Claim interfaces as needed...
*/
number = printer->device->config[printer->conf].interface[printer->iface].
altsetting[printer->altset].bInterfaceNumber;
while (usb_claim_interface(printer->handle, number) < 0)
{
if (errno != EBUSY)
fprintf(stderr, "DEBUG: Failed to claim interface %d for %04x:%04x: %s\n",
number, printer->device->descriptor.idVendor,
printer->device->descriptor.idProduct, strerror(errno));
goto error;
}
if (number != 0)
while (usb_claim_interface(printer->handle, 0) < 0)
{
if (errno != EBUSY)
fprintf(stderr, "DEBUG: Failed to claim interface 0 for %04x:%04x: %s\n",
printer->device->descriptor.idVendor,
printer->device->descriptor.idProduct, strerror(errno));
goto error;
}
/*
* Set alternate setting...
*/
number = printer->device->config[printer->conf].interface[printer->iface].
altsetting[printer->altset].bAlternateSetting;
while (usb_set_altinterface(printer->handle, number) < 0)
{
if (errno != EBUSY)
fprintf(stderr,
"DEBUG: Failed to set alternate interface %d for %04x:%04x: %s\n",
number, printer->device->descriptor.idVendor,
printer->device->descriptor.idProduct, strerror(errno));
goto error;
}
if (verbose)
fputs("STATE: -connecting-to-device\n", stderr);
return (0);
/*
* If we get here, there was a hard error...
*/
error:
if (verbose)
fputs("STATE: -connecting-to-device\n", stderr);
usb_close(printer->handle);
printer->handle = NULL;
return (-1);
}
/*
* 'print_cb()' - Find a USB printer for printing.
*/
static int /* O - 0 to continue, 1 to stop (found) */
print_cb(usb_printer_t *printer, /* I - Printer */
const char *device_uri, /* I - Device URI */
const char *device_id, /* I - IEEE-1284 device ID */
const void *data) /* I - User data (make, model, S/N) */
{
return (!strcmp((char *)data, device_uri));
}
/*
* 'side_cb()' - Handle side-channel requests.
*/
static ssize_t /* O - Number of bytes written */
side_cb(usb_printer_t *printer, /* I - Printer */
int print_fd) /* I - File to print */
{
ssize_t bytes, /* Bytes read/written */
tbytes; /* Total bytes written */
char buffer[8192]; /* Print data buffer */
struct pollfd pfd; /* Poll descriptor */
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 */
tbytes = 0;
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
return (-1);
switch (command)
{
case CUPS_SC_CMD_DRAIN_OUTPUT :
pfd.fd = print_fd;
pfd.events = POLLIN;
while (poll(&pfd, 1, 1000) > 0)
{
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
{
while (usb_bulk_write(printer->handle, printer->write_endp, buffer,
bytes, 5000) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to write %d bytes to printer!\n"),
(int)bytes);
tbytes = -1;
break;
}
tbytes += bytes;
}
else if (bytes < 0 && errno != EAGAIN && errno != EINTR)
break;
}
if (tbytes < 0)
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] = 0; /* TODO: Change to 1 when read supported */
datalen = 1;
break;
case CUPS_SC_CMD_GET_DEVICE_ID :
if (get_device_id(printer, data, sizeof(data)))
{
status = CUPS_SC_STATUS_IO_ERROR;
datalen = 0;
}
else
{
status = CUPS_SC_STATUS_OK;
datalen = strlen(data);
}
break;
default :
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (tbytes);
}
/*
* End of "$Id$".
*/
+46 -34
Ver Arquivo
@@ -5,7 +5,7 @@
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -28,7 +28,6 @@
* Include necessary headers.
*/
#include "ieee1284.c"
#include <sys/select.h>
@@ -37,7 +36,8 @@
*/
static int open_device(const char *uri, int *use_bc);
static void side_cb(int print_fd, int device_fd, int use_bc);
static int side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
/*
@@ -80,6 +80,14 @@ print_device(const char *uri, /* I - Device URI */
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
@@ -90,8 +98,8 @@ print_device(const char *uri, /* I - Device URI */
use_bc = strcasecmp(hostname, "Brother") &&
strcasecmp(hostname, "Canon") &&
strcasecmp(hostname, "Konica Minolta") &&
strcasecmp(hostname, "Minolta");
strncasecmp(hostname, "Konica", 6) &&
strncasecmp(hostname, "Minolta", 7);
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
if ((device_fd = open_device(uri, &use_bc)) == -1)
@@ -173,7 +181,17 @@ print_device(const char *uri, /* I - Device URI */
lseek(print_fd, 0, SEEK_SET);
}
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
#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)
_cupsLangPrintf(stderr,
@@ -210,6 +228,7 @@ list_devices(void)
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* Try to open each USB device...
*/
@@ -245,8 +264,8 @@ list_devices(void)
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
cupsBackendReport("direct", device_uri, make_model, make_model,
device_id, NULL);
close(fd);
}
@@ -273,15 +292,15 @@ list_devices(void)
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
cupsBackendReport("direct", device_uri, make_model, make_model,
device_id, NULL);
close(fd);
}
}
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
int i; /* Looping var */
char device[255]; /* Device filename */
@@ -345,7 +364,7 @@ open_device(const char *uri, /* I - Device URI */
* Find the correct USB device...
*/
do
for (;;)
{
for (busy = 0, i = 0; i < 16; i ++)
{
@@ -414,21 +433,11 @@ open_device(const char *uri, /* I - Device URI */
*/
if (busy)
{
_cupsLangPuts(stderr,
_("INFO: Printer busy; will retry in 5 seconds...\n"));
sleep(5);
}
sleep(5);
}
while (busy);
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
{
@@ -525,7 +534,7 @@ open_device(const char *uri, /* I - Device URI */
}
#else
{
if (use_bc)
if (*use_bc)
fd = open(uri + 4, O_RDWR | O_EXCL);
else
fd = -1;
@@ -551,10 +560,12 @@ open_device(const char *uri, /* I - Device URI */
* 'side_cb()' - Handle side-channel requests...
*/
static void
side_cb(int print_fd, /* I - Print file */
int device_fd, /* I - Device file */
int use_bc) /* I - Using back-channel? */
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 */
@@ -562,13 +573,13 @@ side_cb(int print_fd, /* I - Print file */
int datalen; /* Request/response data size */
(void)snmp_fd;
(void)addr;
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return;
}
return (-1);
switch (command)
{
@@ -584,6 +595,7 @@ side_cb(int print_fd, /* I - Print file */
break;
case CUPS_SC_CMD_GET_BIDI :
status = CUPS_SC_STATUS_OK;
data[0] = use_bc;
datalen = 1;
break;
@@ -610,7 +622,7 @@ side_cb(int print_fd, /* I - Print file */
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
}
+6 -11
Ver Arquivo
@@ -3,7 +3,7 @@
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -30,14 +30,7 @@
# include <ApplicationServices/ApplicationServices.h>
#endif /* __APPLE__ */
#include <cups/backend.h>
#include <cups/cups.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/string.h>
#include <cups/i18n.h>
#include <signal.h>
#include "backend-private.h"
#ifdef WIN32
# include <io.h>
@@ -62,9 +55,11 @@ int print_device(const char *uri, const char *hostname,
* Include the vendor-specific USB implementation...
*/
#ifdef __APPLE__
#ifdef HAVE_USB_H
# include "usb-libusb.c"
#elif defined(__APPLE__)
# include "usb-darwin.c"
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
# include "usb-unix.c"
#else
/*
+15 -12
Ver Arquivo
@@ -1,13 +1,16 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
lpc.o: lpc.c ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/ppd.h \
../cups/array.h ../cups/file.h ../cups/language.h ../cups/i18n.h \
../cups/transcode.h ../cups/debug.h ../cups/string.h ../config.h
lpq.o: lpq.c ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/i18n.h ../cups/transcode.h ../cups/debug.h
lpr.o: lpr.c ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/i18n.h ../cups/transcode.h
lprm.o: lprm.c ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/ppd.h \
../cups/array.h ../cups/file.h ../cups/language.h ../cups/i18n.h \
../cups/transcode.h ../cups/string.h ../config.h
lpc.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h
lpc.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
lpc.o: ../cups/i18n.h ../cups/transcode.h ../cups/debug.h ../cups/string.h
lpc.o: ../config.h
lpq.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
lpq.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h ../cups/array.h
lpq.o: ../cups/file.h ../cups/language.h ../cups/i18n.h ../cups/transcode.h
lpq.o: ../cups/debug.h
lpr.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
lpr.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h ../cups/array.h
lpr.o: ../cups/file.h ../cups/language.h ../cups/i18n.h ../cups/transcode.h
lprm.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h
lprm.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
lprm.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
+47 -2
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,6 +15,7 @@
include ../Makedefs
TARGETS = lpc lpq lpr lprm
OBJS = lpc.o lpq.o lpr.o lprm.o
@@ -26,6 +27,20 @@ OBJS = lpc.o lpq.o lpr.o lprm.o
all: $(TARGETS)
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all object files...
#
@@ -46,11 +61,27 @@ depend:
# Install all targets...
#
install: all
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 \
@@ -61,6 +92,20 @@ install: all
fi
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall all targets...
#
+1 -13
Ver Arquivo
@@ -230,7 +230,6 @@ show_status(http_t *http, /* I - HTTP connection to server */
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device, /* Device URI */
*delimiter; /* Char search result */
@@ -263,18 +262,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
* attributes-natural-language
*/
request = ippNew();
request->request.op.operation_id = CUPS_GET_PRINTERS;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
request = ippNewRequest(CUPS_GET_PRINTERS);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(requested) / sizeof(requested[0]),
+26 -11
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -340,7 +340,18 @@ show_jobs(const char *command, /* I - Command name */
char resource[1024]; /* Resource string */
char rankstr[255]; /* Rank string */
char namestr[1024]; /* Job name string */
static const char *ranks[10] = /* Ranking strings */
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",
@@ -355,8 +366,8 @@ show_jobs(const char *command, /* I - Command name */
};
DEBUG_printf(("show_jobs(%08x, %08x, %08x, %d, %d)\n", http, dest, user, id,
longstatus));
DEBUG_printf(("show_jobs(http=%p, dest=%p, user=%p, id=%d, longstatus%d)\n",
http, dest, user, id, longstatus));
if (http == NULL)
return (0);
@@ -368,21 +379,18 @@ show_jobs(const char *command, /* I - Command name */
* attributes-charset
* attributes-natural-language
* job-uri or printer-uri
* requested-attributes
*/
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
if (dest == NULL)
if (id)
{
if (id)
sprintf(resource, "ipp://localhost/jobs/%d", id);
else
strcpy(resource, "ipp://localhost/jobs");
snprintf(resource, sizeof(resource), "ipp://localhost/jobs/%d", id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, resource);
}
else
else if (dest)
{
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
NULL, "localhost", 0, "/printers/%s", dest);
@@ -390,6 +398,9 @@ show_jobs(const char *command, /* I - Command name */
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)
{
@@ -398,6 +409,10 @@ show_jobs(const char *command, /* I - Command name */
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
}
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...
*/
+32 -125
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -14,8 +14,7 @@
*
* Contents:
*
* main() - Parse options and send files for printing.
* sighandler() - Signal catcher for when we print from stdin...
* main() - Parse options and send files for printing.
*/
/*
@@ -30,25 +29,6 @@
#include <cups/cups.h>
#include <cups/i18n.h>
#ifndef WIN32
# include <unistd.h>
# include <signal.h>
/*
* Local functions.
*/
void sighandler(int);
#endif /* !WIN32 */
/*
* Globals...
*/
char tempfile[1024]; /* Temporary file for printing from stdin */
/*
* 'main()' - Parse options and send files for printing.
@@ -68,28 +48,18 @@ main(int argc, /* I - Number of command-line arguments */
int num_copies; /* Number of copies per file */
int num_files; /* Number of files to print */
const char *files[1000]; /* Files to print */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Selected destination */
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 */
ssize_t bytes; /* Bytes copied */
off_t filesize; /* Size of temp file */
int temp; /* Temporary file descriptor */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Signal action */
struct sigaction oldaction; /* Old signal action */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
_cupsSetLocale(argv);
deletefile = 0;
printer = NULL;
num_dests = 0;
dests = NULL;
dest = NULL;
num_options = 0;
options = NULL;
num_files = 0;
@@ -200,11 +170,11 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'l' : /* Literal/raw */
num_options = cupsAddOption("raw", "", num_options, &options);
num_options = cupsAddOption("raw", "true", num_options, &options);
break;
case 'p' : /* Prettyprint */
num_options = cupsAddOption("prettyprint", "", num_options,
num_options = cupsAddOption("prettyprint", "true", num_options,
&options);
break;
@@ -258,10 +228,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((instance = strrchr(printer, '/')) != NULL)
*instance++ = '\0';
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
if ((dest = cupsGetDest(printer, instance, num_dests, dests)) != NULL)
if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
{
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options,
@@ -355,10 +322,7 @@ main(int argc, /* I - Number of command-line arguments */
if (printer == NULL)
{
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL)
if ((dest = cupsGetNamedDest(NULL, NULL, NULL)) != NULL)
{
printer = dest->name;
@@ -387,7 +351,7 @@ main(int argc, /* I - Number of command-line arguments */
else
val = "LPDEST";
if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
if (printer && !cupsGetNamedDest(NULL, printer, NULL))
_cupsLangPrintf(stderr,
_("%s: Error - %s environment variable names "
"non-existent destination \"%s\"!\n"),
@@ -418,72 +382,38 @@ main(int argc, /* I - Number of command-line arguments */
unlink(files[i]);
}
}
else
else if ((job_id = cupsCreateJob(CUPS_HTTP_DEFAULT, printer,
title ? title : "(stdin)",
num_options, options)) > 0)
{
num_files = 1;
http_status_t status; /* Write status */
const char *format; /* Document format */
ssize_t bytes; /* Bytes read */
#ifndef WIN32
# if defined(HAVE_SIGSET)
sigset(SIGHUP, sighandler);
if (sigset(SIGINT, sighandler) == SIG_IGN)
sigset(SIGINT, SIG_IGN);
sigset(SIGTERM, sighandler);
# elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = sighandler;
sigaction(SIGHUP, &action, NULL);
sigaction(SIGINT, NULL, &oldaction);
if (oldaction.sa_handler != SIG_IGN)
sigaction(SIGINT, &action, NULL);
sigaction(SIGTERM, &action, NULL);
# else
signal(SIGHUP, sighandler);
if (signal(SIGINT, sighandler) == SIG_IGN)
signal(SIGINT, SIG_IGN);
signal(SIGTERM, sighandler);
# endif
#endif /* !WIN32 */
if (cupsGetOption("raw", num_options, options))
format = CUPS_FORMAT_RAW;
else if ((format = cupsGetOption("document-format", num_options,
options)) == NULL)
format = CUPS_FORMAT_AUTO;
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
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, bytes);
if (status != HTTP_CONTINUE)
{
_cupsLangPrintf(stderr,
_("%s: Error - unable to create temporary file "
"\"%s\" - %s\n"),
argv[0], tempfile, strerror(errno));
_("%s: Error - unable to queue from stdin - %s\n"),
argv[0], httpStatus(status));
return (1);
}
while ((bytes = read(0, buffer, sizeof(buffer))) > 0)
if (write(temp, buffer, bytes) < 0)
{
_cupsLangPrintf(stderr,
_("%s: Error - unable to write to temporary file "
"\"%s\" - %s\n"),
argv[0], tempfile, strerror(errno));
close(temp);
unlink(tempfile);
return (1);
}
filesize = lseek(temp, 0, SEEK_CUR);
close(temp);
if (filesize <= 0)
{
_cupsLangPrintf(stderr,
_("%s: Error - stdin is empty, so no job has been sent.\n"),
argv[0]);
unlink(tempfile);
return (1);
}
if (title)
job_id = cupsPrintFile(printer, tempfile, title, num_options, options);
else
job_id = cupsPrintFile(printer, tempfile, "(stdin)", num_options, options);
unlink(tempfile);
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
job_id = 0;
}
if (job_id < 1)
@@ -496,29 +426,6 @@ main(int argc, /* I - Number of command-line arguments */
}
#ifndef WIN32
/*
* 'sighandler()' - Signal catcher for when we print from stdin...
*/
void
sighandler(int s) /* I - Signal number */
{
/*
* Remove the temporary file we're using to print from stdin...
*/
unlink(tempfile);
/*
* Exit...
*/
exit(s);
}
#endif /* !WIN32 */
/*
* End of "$Id$".
*/
+57 -119
Ver Arquivo
@@ -37,19 +37,13 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
http_t *http; /* HTTP connection to server */
int i; /* Looping var */
int job_id; /* Job ID */
const char *dest; /* Destination printer */
const char *name; /* Destination printer */
char *instance; /* Pointer to instance name */
char uri[1024]; /* Printer or job URI */
ipp_t *request; /* IPP request */
ipp_t *response; /* IPP response */
ipp_op_t op; /* Operation */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
cups_dest_t *dest, /* Destination */
*defdest; /* Default destination */
http_encryption_t encryption; /* Encryption? */
int did_cancel; /* Did we cancel something? */
_cupsSetLocale(argv);
@@ -58,26 +52,9 @@ main(int argc, /* I - Number of command-line arguments */
* Setup to cancel individual print jobs...
*/
op = IPP_CANCEL_JOB;
job_id = 0;
dest = NULL;
response = NULL;
http = NULL;
encryption = cupsEncryption();
/*
* Open a connection to the server...
*/
if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL)
{
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
return (1);
}
num_dests = cupsGetDests2(http, &dests);
defdest = cupsGetDest(NULL, NULL, num_dests, dests);
dest = defdest ? defdest->name : NULL;
did_cancel = 0;
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
name = defdest ? defdest->name : NULL;
/*
* Process command-line arguments...
@@ -89,10 +66,7 @@ main(int argc, /* I - Number of command-line arguments */
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
encryption = HTTP_ENCRYPT_REQUIRED;
httpEncryption(http, encryption);
cupsSetEncryption(encryption);
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
@@ -102,25 +76,26 @@ main(int argc, /* I - Number of command-line arguments */
case 'P' : /* Cancel jobs on a printer */
if (argv[i][2])
dest = argv[i] + 2;
name = argv[i] + 2;
else
{
i ++;
dest = argv[i];
name = argv[i];
}
if ((instance = strchr(dest, '/')) != NULL)
if ((instance = strchr(name, '/')) != NULL)
*instance = '\0';
if (cupsGetDest(dest, NULL, num_dests, dests) == NULL)
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, name,
NULL)) == NULL)
{
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s\"!\n"),
argv[0], dest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return(1);
argv[0], name);
goto error;
}
cupsFreeDests(1, dest);
break;
case 'U' : /* Username */
@@ -135,7 +110,7 @@ main(int argc, /* I - Number of command-line arguments */
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
return (1);
goto error;
}
cupsSetUser(argv[i]);
@@ -155,34 +130,24 @@ main(int argc, /* I - Number of command-line arguments */
_("%s: Error - expected hostname after "
"\'-h\' option!\n"),
argv[0]);
return (1);
goto error;
}
else
cupsSetServer(argv[i]);
}
httpClose(http);
cupsFreeDests(num_dests, dests);
if (defdest)
cupsFreeDests(1, defdest);
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
encryption)) == NULL)
{
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
return (1);
}
num_dests = cupsGetDests2(http, &dests);
defdest = cupsGetDest(NULL, NULL, num_dests, dests);
dest = defdest ? defdest->name : NULL;
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
name = defdest ? defdest->name : NULL;
break;
default :
_cupsLangPrintf(stderr,
_("%s: Error - unknown option \'%c\'!\n"),
argv[0], argv[i][1]);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
goto error;
}
else
{
@@ -190,11 +155,17 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel a job or printer...
*/
if (isdigit(argv[i][0] & 255) &&
cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, argv[i], NULL)) != NULL)
cupsFreeDests(1, dest);
if (dest)
{
dest = NULL;
op = IPP_CANCEL_JOB;
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], "-"))
@@ -203,64 +174,23 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel all jobs
*/
op = IPP_PURGE_JOBS;
job_id = -1;
}
else
{
dest = argv[i];
job_id = 0;
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s\"!\n"),
argv[0], argv[i]);
goto error;
}
/*
* Build an IPP request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri + job-id *or* job-uri
* [requesting-user-name]
*/
request = ippNewRequest(op);
if (dest)
{
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
job_id);
}
else
{
sprintf(uri, "ipp://localhost/jobs/%d", job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
uri);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
/*
* Do the request and get back a response...
*/
if (op == IPP_PURGE_JOBS)
response = cupsDoRequest(http, request, "/admin/");
else
response = cupsDoRequest(http, request, "/jobs/");
ippDelete(response);
if (cupsLastError() > IPP_OK_CONFLICT)
if (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0) != IPP_OK)
{
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
goto error;
}
did_cancel = 1;
}
/*
@@ -268,19 +198,27 @@ main(int argc, /* I - Number of command-line arguments */
* (or default) printer...
*/
if (response == NULL)
if (!cupsCancelJob(dest, 0))
if (!did_cancel && cupsCancelJob2(CUPS_HTTP_DEFAULT, name, 0, 0) != IPP_OK)
{
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
goto error;
}
cupsFreeDests(num_dests, dests);
httpClose(http);
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);
}
+64 -56
Ver Arquivo
@@ -1,56 +1,64 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
help-index.o: help-index.c cgi-private.h cgi.h ../cups/cups.h \
../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h \
../cups/file.h ../cups/language.h ../cups/array.h help-index.h \
../cups/debug.h ../cups/i18n.h ../cups/transcode.h ../cups/string.h \
../config.h ../cups/dir.h
html.o: html.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
ipp-var.o: ipp-var.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
search.o: search.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
template.o: template.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
var.o: var.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
admin.o: admin.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h \
../cups/adminutil.h ../cups/cups.h ../cups/file.h
classes.o: classes.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
help.o: help.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
jobs.o: jobs.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
printers.o: printers.c cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h ../cups/debug.h \
../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
testcgi.o: testcgi.c cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h \
../cups/array.h help-index.h
testhi.o: testhi.c cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h \
../cups/array.h help-index.h
testtemplate.o: testtemplate.c cgi.h ../cups/cups.h ../cups/ipp.h \
../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h \
../cups/language.h ../cups/array.h help-index.h
# DO NOT DELETE
help-index.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
help-index.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
help-index.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
help-index.o: ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
help-index.o: ../cups/string.h ../config.h ../cups/dir.h
html.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
html.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
html.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
html.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
ipp-var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
ipp-var.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
ipp-var.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
ipp-var.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
search.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
search.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
search.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
search.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
template.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
template.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
template.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
template.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
var.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
var.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
var.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
admin.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
admin.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
admin.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
admin.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
admin.o: ../cups/adminutil.h ../cups/cups.h ../cups/file.h
classes.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
classes.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
classes.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
classes.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
help.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
help.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
help.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
help.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
jobs.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
jobs.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
jobs.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
makedocset.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
makedocset.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
makedocset.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
printers.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
printers.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
printers.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
testcgi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
testcgi.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
testcgi.o: ../cups/language.h ../cups/array.h help-index.h
testhi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
testhi.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
testhi.o: ../cups/language.h ../cups/array.h help-index.h
testtemplate.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
testtemplate.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
testtemplate.o: ../cups/file.h ../cups/language.h ../cups/array.h
testtemplate.o: help-index.h
websearch.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
websearch.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
websearch.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
+240 -29
Ver Arquivo
@@ -3,7 +3,7 @@
#
# CGI makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -15,11 +15,44 @@
include ../Makedefs
CGIS = admin.cgi classes.cgi help.cgi jobs.cgi printers.cgi
TARGETS = libcgi.a $(CGIS) testcgi testhi testtemplate
LIBOBJS = help-index.o html.o ipp-var.o search.o template.o var.o
OBJS = $(LIBOBJS) admin.o classes.o help.o \
jobs.o printers.o testcgi.o testhi.o testtemplate.o
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 \
websearch.o
CGIS = \
admin.cgi \
classes.cgi \
help.cgi \
jobs.cgi \
printers.cgi
LIBTARGETS = \
libcupscgi.a \
$(LIBCUPSCGI) \
websearch
UNITTARGETS = \
testcgi \
testhi \
testtemplate
TARGETS = \
$(LIBTARGETS) \
$(CGIS)
#
@@ -29,12 +62,27 @@ OBJS = $(LIBOBJS) admin.o classes.o help.o \
all: $(TARGETS)
#
# Make library targets...
#
libs: $(LIBTARGETS) $(UNITTESTS)
#
# Make unit tests...
#
unittests: $(UNITTARGETS)
#
# Clean all object files...
#
clean:
$(RM) $(OBJS) $(TARGETS)
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS) makedocset
$(RM) libcupscgi.so libcupscgi.sl libcupscgi.dylib
#
@@ -49,7 +97,21 @@ depend:
# Install all targets...
#
install: all
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; \
@@ -62,6 +124,45 @@ install: all
fi
#
# Install headers...
#
install-headers:
echo Installing header files in $(INCLUDEDIR)/cups...
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
$(INSTALL_DATA) cgi.h $(INCLUDEDIR)/cups
$(INSTALL_DATA) help-index.h $(INCLUDEDIR)/cups
#
# Install libraries...
#
install-libs: $(INSTALLSTATIC)
echo Installing libraries in $(LIBDIR)...
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) $(LIBCUPSCGI) $(LIBDIR)
if test $(LIBCUPSCGI) = "libcupscgi.so.1" -o $(LIBCUPSCGI) = "libcupscgi.sl.1"; then \
$(RM) $(LIBDIR)/`basename $(LIBCUPSCGI) .1`; \
$(LN) $(LIBCUPSCGI) $(LIBDIR)/`basename $(LIBCUPSCGI) .1`; \
fi
if test $(LIBCUPSCGI) = "libcupscgi.1.dylib"; then \
$(RM) $(LIBDIR)/libcupscgi.dylib; \
$(LN) $(LIBCUPSCGI) $(LIBDIR)/libcupscgi.dylib; \
fi
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
cp $(LIBCUPSCGI) $(SYMROOT); \
fi
installstatic:
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) -m 755 libcupscgi.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcupscgi.a
$(CHMOD) 555 $(LIBDIR)/libcupscgi.a
#
# Uninstall all targets...
#
@@ -71,13 +172,95 @@ uninstall:
$(RM) $(SERVERBIN)/cgi-bin/$$file; \
done
-$(RMDIR) $(SERVERBIN)/cgi-bin
$(RM) $(LIBDIR)/libcupscgi.1.dylib
$(RM) $(LIBDIR)/libcupscgi.a
$(RM) $(LIBDIR)/libcupscgi.dylib
$(RM) $(LIBDIR)/libcupscgi_s.a
$(RM) $(LIBDIR)/libcupscgi.sl
$(RM) $(LIBDIR)/libcupscgi.sl.1
$(RM) $(LIBDIR)/libcupscgi.so
$(RM) $(LIBDIR)/libcupscgi.so.1
-$(RMDIR) $(LIBDIR)
$(RM) $(INCLUDEDIR)/cups/cgi.h
$(RM) $(INCLUDEDIR)/cups/help-index.h
-$(RMDIR) $(INCLUDEDIR)/cups
#
# libcgi.a
# Automatic API help files...
#
libcgi.a: $(LIBOBJS)
apihelp:
mxmldoc --section "Programming" \
--title "CGI API" \
--css ../doc/cups-printable.css \
--header api-cgi.header --intro api-cgi.shtml \
cgi.h help-index.h $(LIBOBJS:.o=.c) >../doc/help/api-cgi.html
mxmldoc --tokens help/api-cgi.html api-cgi.xml >../doc/help/api-cgi.tokens
$(RM) api-cgi.xml
framedhelp:
mxmldoc --framed api-cgi \
--section "Programming" \
--title "CGI API" \
--css ../doc/cups-printable.css \
--header api-cgi.header --intro api-cgi.shtml \
cgi.h help-index.h $(LIBOBJS:.o=.c)
#
# libcupscgi.so.1, libcupscgi.sl.1
#
libcupscgi.so.1 libcupscgi.sl.1: $(LIBOBJS)
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
$(RM) `basename $@ .1`
$(LN) $@ `basename $@ .1`
#
# libcupscgi.1.dylib
#
libcupscgi.1.dylib: $(LIBOBJS) libcupscgi.exp
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/$@ \
-current_version 1.0.0 \
-compatibility_version 1.0.0 \
-exported_symbols_list libcupscgi.exp \
$(LIBOBJS) $(LIBS)
$(RM) libcupscgi.dylib
$(LN) $@ libcupscgi.dylib
#
# libcupscgi_s.a
#
libcupscgi_s.a: $(LIBOBJS)
echo Creating $@...
$(DSO) $(DSOFLAGS) -o libcupscgi_s.o $(LIBOBJS) $(LIBS)
$(RM) $@
$(AR) $(ARFLAGS) $@ libcupscgi_s.o
#
# libcupscgi.la
#
libcupscgi.la: $(LIBOBJS)
echo Linking $@...
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
-version-info 1:0 $(LIBS)
#
# libcupscgi.a
#
libcupscgi.a: $(LIBOBJS)
echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
@@ -88,75 +271,103 @@ libcgi.a: $(LIBOBJS)
# admin.cgi
#
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ admin.o libcgi.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ admin.o -lcupscgi $(LIBS)
#
# classes.cgi
#
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ classes.o libcgi.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ classes.o -lcupscgi $(LIBS)
#
# help.cgi
#
help.cgi: help.o ../Makedefs libcgi.a
help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ help.o libcgi.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ help.o -lcupscgi $(LIBS)
#
# jobs.cgi
#
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ jobs.o libcgi.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
#
# makedocset
#
makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
#
# printers.cgi
#
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ printers.o libcgi.a $(LIBS)
$(CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
#
# testcgi
#
testcgi: testcgi.o ../Makedefs libcgi.a ../cups/libcups.a
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testcgi.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
echo Testing CGI API...
./testcgi
#
# testhi
#
testhi: testhi.o ../Makedefs libcgi.a ../cups/libcups.a
testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testhi.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
echo Testing help index API...
./testhi
#
# testtemplate
#
testtemplate: testtemplate.o ../Makedefs libcgi.a ../cups/libcups.a
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ) $(LIBGSSAPI)
#
# websearch
#
websearch: websearch.o ../Makedefs libcupscgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ websearch.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
$(LIBZ) $(LIBGSSAPI)
#
+1541 -656
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+34
Ver Arquivo
@@ -0,0 +1,34 @@
<!--
"$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
CGI API header for CUPS.
Copyright 2009 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/".
-->
<h1 class='title'>CGI API</h1>
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Header</th>
<th>cups/cgi.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcupscgi</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
</tr>
</tbody>
</table></div>
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<!--
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
CGI API introduction for CUPS.
Copyright 2009 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/".
-->
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<p>The CGI API provides Common Gateway Interface functions for CUPS.</p>
+1 -1
Ver Arquivo
@@ -27,7 +27,7 @@
* Limits...
*/
#define CUPS_PAGE_MAX 10 /* Maximum items per page */
#define CUPS_PAGE_MAX 100 /* Maximum items per page */
/*
+19 -1
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI support library definitions.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -33,6 +33,14 @@
# include "help-index.h"
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Types...
*/
@@ -54,11 +62,13 @@ typedef struct cgi_file_s /**** Uploaded file data ****/
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);
@@ -72,6 +82,8 @@ 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);
@@ -91,8 +103,14 @@ 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_ */
/*
+138 -52
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,6 +15,7 @@
* Contents:
*
* main() - Main entry for CGI.
* do_class_op() - Do a class operation.
* show_all_classes() - Show all classes...
* show_class() - Show a single class.
*/
@@ -30,8 +31,10 @@
* Local functions...
*/
void show_all_classes(http_t *http, const char *username);
void show_class(http_t *http, const char *printer);
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);
/*
@@ -69,6 +72,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "classes");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we are displaying a printer or all classes...
@@ -80,6 +84,9 @@ main(int argc, /* I - Number of command-line arguments */
if (!*pclass)
pclass = NULL;
if (pclass)
cgiSetVariable("PRINTER_NAME", pclass);
}
/*
@@ -98,7 +105,7 @@ main(int argc, /* I - Number of command-line arguments */
* Get the default printer...
*/
if (!op)
if (!op || !cgiIsPOST())
{
/*
* Get the default destination...
@@ -138,21 +145,40 @@ main(int argc, /* I - Number of command-line arguments */
else
show_class(http, pclass);
}
else if (!strcasecmp(op, "print-test-page") && pclass)
cgiPrintTestPage(http, pclass);
else if (!strcasecmp(op, "move-jobs") && pclass)
cgiMoveJobs(http, pclass, 0);
else if (pclass)
{
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, "purge-jobs"))
do_class_op(http, pclass, IPP_PURGE_JOBS, cgiText(_("Purge Jobs")));
else if (!strcasecmp(op, "print-test-page"))
cgiPrintTestPage(http, pclass);
else if (!strcasecmp(op, "move-jobs"))
cgiMoveJobs(http, pclass, 0);
else
{
/*
* Unknown/bad operation...
*/
cgiStartHTML(pclass);
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
}
else
{
/*
* Unknown/bad operation...
*/
if (pclass)
cgiStartHTML(pclass);
else
cgiStartHTML(cgiText(_("Classes")));
cgiStartHTML(cgiText(_("Classes")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
@@ -171,11 +197,94 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* '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_PURGE_JOBS)
cgiCopyTemplateLang("printer-purge.tmpl");
}
cgiEndHTML();
}
/*
* 'show_all_classes()' - Show all classes...
*/
void
static void
show_all_classes(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
@@ -189,9 +298,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
count; /* Number of classes */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
char val[1024]; /* Form variable */
/*
@@ -227,7 +334,8 @@ show_all_classes(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
if ((var = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
search = cgiCompileSearch(var);
else
search = NULL;
@@ -255,8 +363,8 @@ show_all_classes(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
@@ -282,40 +390,18 @@ show_all_classes(http_t *http, /* I - Connection to server */
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/classes/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/classes/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
cgiSetVariable("THISURL", "/classes/");
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
}
/*
@@ -326,12 +412,12 @@ show_all_classes(http_t *http, /* I - Connection to server */
cgiCopyTemplateLang("classes-header.tmpl");
if (count > 0)
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("classes.tmpl");
if (count > 0)
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
/*
@@ -358,7 +444,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
* 'show_class()' - Show a single class.
*/
void
static void
show_class(http_t *http, /* I - Connection to server */
const char *pclass) /* I - Name of class */
{
@@ -385,7 +471,7 @@ show_class(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "classes.tmpl");
cgiGetAttributes(request, "class.tmpl");
/*
* Do the request and get back a response...
@@ -430,7 +516,7 @@ show_class(http_t *http, /* I - Connection to server */
* Show the class status...
*/
cgiCopyTemplateLang("classes.tmpl");
cgiCopyTemplateLang("class.tmpl");
/*
* Show jobs for the specified class...
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* On-line help index routines for the Common UNIX Printing System (CUPS).
* Online help index routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -500,7 +500,7 @@ helpSaveIndex(help_index_t *hi, /* I - Index */
else
{
if (cupsFilePrintf(fp, "%s %d " CUPS_LLFMT " " CUPS_LLFMT " \"%s\" \"%s\"\n",
node->filename, node->mtime,
node->filename, (int)node->mtime,
CUPS_LLCAST node->offset, CUPS_LLCAST node->length,
node->section ? node->section : "", node->text) < 0)
break;
@@ -1297,7 +1297,7 @@ help_sort_by_score(help_node_t *n1, /* I - First node */
n2, n2->score, n2->section ? n2->section : "", n2->text));
if (n1->score != n2->score)
return (n1->score - n2->score);
return (n2->score - n1->score);
if (n1->section && !n2->section)
return (1);
+13 -1
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* On-line help index definitions for the Common UNIX Printing System (CUPS).
* Online help index definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
@@ -23,6 +23,14 @@
# include <cups/array.h>
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Data structures...
*/
@@ -68,6 +76,10 @@ extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query,
const char *filename);
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_HELP_INDEX_H_ */
/*
+20 -7
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* On-line help CGI for the Common UNIX Printing System (CUPS).
* Online help CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -63,6 +63,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "help");
cgiSetVariable("REFRESH_PAGE", "");
/*
* Load the help index...
@@ -86,7 +87,7 @@ main(int argc, /* I - Number of command-line arguments */
{
perror(filename);
cgiStartHTML(cgiText(_("Help")));
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", "Unable to load help index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -102,7 +103,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
for (i = 0; i < argc; i ++)
fprintf(stderr, "argv[%d]=\"%s\"\n", i, argv[i]);
fprintf(stderr, "DEBUG: argv[%d]=\"%s\"\n", i, argv[i]);
if ((helpfile = getenv("PATH_INFO")) != NULL)
{
@@ -127,7 +128,7 @@ main(int argc, /* I - Number of command-line arguments */
{
perror(filename);
cgiStartHTML(cgiText(_("Help")));
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", "Unable to access help file!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -137,7 +138,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
{
cgiStartHTML(cgiText(_("Help")));
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", "Help file not in index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -168,17 +169,26 @@ main(int argc, /* I - Number of command-line arguments */
* Send a standard page header...
*/
cgiStartHTML(cgiText(_("Help")));
cgiStartHTML(cgiText(_("Online Help")));
}
/*
* Do a search as needed...
*/
if (cgiGetVariable("CLEAR"))
cgiSetVariable("QUERY", "");
query = cgiGetVariable("QUERY");
topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
cgiClearVariables();
if (query)
cgiSetVariable("QUERY", query);
if (topic)
cgiSetVariable("TOPIC", topic);
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
query ? query : "(null)", topic ? topic : "(null)");
@@ -356,7 +366,10 @@ main(int argc, /* I - Number of command-line arguments */
*/
if (!printable)
{
cgiCopyTemplateLang("help-trailer.tmpl");
cgiEndHTML();
}
else
puts("</BODY>\n</HTML>");
+85 -6
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTML support functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -14,10 +14,13 @@
*
* Contents:
*
* cgiEndHTML() - End a HTML page.
* cgiFormEncode() - Encode a string as a form variable...
* cgiStartHTML() - Start a HTML page.
* cgi_null_passwd() - Return a NULL password for authentication.
* cgiEndHTML() - End a HTML page.
* cgiEndMultipart() - End the delivery of a multipart web page.
* cgiFormEncode() - Encode a string as a form variable.
* cgiStartHTML() - Start a HTML page.
* cgiStartMultipart() - Start a multipart delivery of a web page.
* cgiSupportsMultipart() - Does the browser support multi-part documents?
* cgi_null_passwd() - Return a NULL password for authentication.
*/
/*
@@ -27,6 +30,14 @@
#include "cgi-private.h"
/*
* Local globals...
*/
static const char *cgi_multipart = NULL;
/* Multipart separator, if any */
/*
* Local functions...
*/
@@ -50,7 +61,22 @@ cgiEndHTML(void)
/*
* 'cgiFormEncode()' - Encode a string as a form variable...
* '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 */
@@ -144,6 +170,9 @@ cgiStartHTML(const char *title) /* I - Title of page */
* Tell the client to expect UTF-8 encoded HTML...
*/
if (cgi_multipart)
puts(cgi_multipart);
puts("Content-Type: text/html;charset=utf-8\n");
/*
@@ -157,6 +186,56 @@ cgiStartHTML(const char *title) /* I - Title of page */
}
/*
* '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)
{
const char *user_agent; /* User-Agent string */
static int supports_multipart = -1;/* Cached value */
if (supports_multipart < 0)
{
/*
* CUPS STR #3049: Apparently some browsers don't support multi-part
* documents, which makes them useless for many web sites. Rather than
* abandoning those users, we'll offer a degraded single-part mode...
*
* Currently we know that anything based on Gecko, MSIE, and Safari all
* work. We'll add more as they are reported/tested.
*/
if ((user_agent = getenv("HTTP_USER_AGENT")) != NULL &&
(strstr(user_agent, " Gecko/") != NULL ||
strstr(user_agent, " MSIE ") != NULL ||
strstr(user_agent, " Safari/") != NULL))
supports_multipart = 1;
else
supports_multipart = 0;
}
return (supports_multipart);
}
/*
* 'cgi_null_passwd()' - Return a NULL password for authentication.
*/
+267 -92
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -14,10 +14,11 @@
*
* Contents:
*
* cgiGetAttributes() - Get the list of attributes that are needed
* by the template file.
* cgiGetAttributes() - Get the list of attributes that are needed by the
* template file.
* cgiGetIPPObjects() - Get the objects in an IPP response.
* cgiMoveJobs() - Move one or more jobs.
* cgiPrintCommand() - Print a CUPS command job.
* cgiPrintTestPage() - Print a test page.
* cgiRewriteURL() - Rewrite a printer URI into a web browser URL...
* cgiSetIPPObjectVars() - Set CGI variables from an IPP object.
@@ -113,7 +114,7 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */
*/
for (nameptr = name; (ch = getc(in)) != EOF;)
if (strchr("}]<>=! \t\n", ch))
if (strchr("}]<>=!~ \t\n", ch))
break;
else if (nameptr > name && ch == '?')
break;
@@ -158,6 +159,8 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */
for (i = 0; i < num_attrs; i ++)
free(attrs[i]);
}
fclose(in);
}
@@ -285,8 +288,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
user = getenv("REMOTE_USER");
/*
* See if the user has already selected a new destination...
@@ -331,7 +333,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
NULL, job_uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "job-printer-uri");
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
if ((attr = ippFindAttribute(response, "job-printer-uri",
@@ -371,8 +373,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-uri-supported");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
CUPS_PRINTER_LOCAL);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
CUPS_PRINTER_SCANNER);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -412,7 +420,18 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
else
cgiStartHTML(cgiText(_("Move All Jobs")));
cgiCopyTemplateLang("job-move.tmpl");
if (cgiGetSize("JOB_PRINTER_NAME") > 0)
cgiCopyTemplateLang("job-move.tmpl");
else
{
if (job_id)
cgiSetVariable("MESSAGE", cgiText(_("Unable to move job")));
else
cgiSetVariable("MESSAGE", cgiText(_("Unable to move jobs")));
cgiSetVariable("ERROR", cgiText(_("No destinations added.")));
cgiCopyTemplateLang("error.tmpl");
}
}
else
{
@@ -472,10 +491,19 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
if (cupsLastError() <= IPP_OK_CONFLICT)
{
cgiRewriteURL(job_printer_uri, resource, sizeof(resource), NULL);
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
const char *path = strstr(job_printer_uri, "/printers/");
if (!path)
{
path = strstr(job_printer_uri, "/classes/");
cgiSetVariable("IS_CLASS", "YES");
}
if (path)
{
cgiFormEncode(uri, path, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
}
if (job_id)
@@ -501,6 +529,168 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
}
/*
* 'cgiPrintCommand()' - Print a CUPS command job.
*/
void
cgiPrintCommand(http_t *http, /* I - Connection to server */
const char *dest, /* I - Destination printer */
const char *command, /* I - Command to send */
const char *title) /* I - Page/job title */
{
int job_id; /* Command file job */
char uri[HTTP_MAX_URI], /* Job URI */
resource[1024], /* Printer resource path */
refresh[1024], /* Refresh URL */
command_file[1024]; /* Command "file" */
http_status_t status; /* Document status */
cups_option_t hold_option; /* job-hold-until option */
const char *user; /* User name */
ipp_t *request, /* Get-Job-Attributes request */
*response; /* Get-Job-Attributes response */
ipp_attribute_t *attr; /* Current job attribute */
static const char const *job_attrs[] =/* Job attributes we want */
{
"job-state",
"job-printer-state-message"
};
/*
* Create the CUPS command file...
*/
snprintf(command_file, sizeof(command_file), "#CUPS-COMMAND\n%s\n", command);
/*
* Show status...
*/
if (cgiSupportsMultipart())
{
cgiStartMultipart();
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
fflush(stdout);
}
/*
* Send the command file job...
*/
hold_option.name = "job-hold-until";
hold_option.value = "no-hold";
if ((user = getenv("REMOTE_USER")) != NULL)
cupsSetUser(user);
else
cupsSetUser("anonymous");
if ((job_id = cupsCreateJob(http, dest, title,
1, &hold_option)) < 1)
{
cgiSetVariable("MESSAGE", cgiText(_("Unable to send command to printer driver!")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
if (cgiSupportsMultipart())
cgiEndMultipart();
return;
}
status = cupsStartDocument(http, dest, job_id, NULL, CUPS_FORMAT_COMMAND, 1);
if (status == HTTP_CONTINUE)
status = cupsWriteRequestData(http, command_file,
strlen(command_file));
if (status == HTTP_CONTINUE)
cupsFinishDocument(http, dest);
if (cupsLastError() >= IPP_REDIRECTION_OTHER_SITE)
{
cgiSetVariable("MESSAGE", cgiText(_("Unable to send command to printer driver!")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
if (cgiSupportsMultipart())
cgiEndMultipart();
cupsCancelJob(dest, job_id);
return;
}
/*
* Wait for the job to complete...
*/
if (cgiSupportsMultipart())
{
for (;;)
{
/*
* Get the current job state...
*/
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
NULL, uri);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", 2, NULL, job_attrs);
if ((response = cupsDoRequest(http, request, "/")) != NULL)
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED ||
attr->values[0].integer == IPP_JOB_HELD)
{
ippDelete(response);
break;
}
/*
* Job not complete, so update the status...
*/
ippDelete(response);
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
fflush(stdout);
sleep(5);
}
}
/*
* Send the final page that reloads the printer's page...
*/
snprintf(resource, sizeof(resource), "/printers/%s", dest);
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "5;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
if (cgiSupportsMultipart())
cgiEndMultipart();
}
/*
* 'cgiPrintTestPage()' - Print a test page.
*/
@@ -523,8 +713,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
user = getenv("REMOTE_USER");
/*
* Locate the test page file...
@@ -533,7 +722,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
datadir = CUPS_DATADIR;
snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
snprintf(filename, sizeof(filename), "%s/data/testprint", datadir);
/*
* Point to the printer/class...
@@ -554,7 +743,6 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNewRequest(IPP_PRINT_JOB);
@@ -562,15 +750,13 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
if (user)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Test Page");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
@@ -593,6 +779,11 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
else if (cupsLastError() == IPP_NOT_AUTHORIZED)
{
puts("Status: 401\n");
exit(0);
}
cgiStartHTML(cgiText(_("Print Test Page")));
@@ -619,7 +810,7 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
int urlsize, /* I - Size of URL buffer */
const char *newresource) /* I - Replacement resource */
{
char method[HTTP_MAX_URI],
char scheme[HTTP_MAX_URI],
userpass[HTTP_MAX_URI],
hostname[HTTP_MAX_URI],
rawresource[HTTP_MAX_URI],
@@ -666,13 +857,13 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
* Convert the URI to a URL...
*/
httpSeparateURI(HTTP_URI_CODING_ALL, uri, method, sizeof(method), userpass,
httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass,
sizeof(userpass), hostname, sizeof(hostname), &port,
rawresource, sizeof(rawresource));
if (!strcmp(method, "ipp") ||
!strcmp(method, "http") ||
!strcmp(method, "https"))
if (!strcmp(scheme, "ipp") ||
!strcmp(scheme, "http") ||
!strcmp(scheme, "https"))
{
if (newresource)
{
@@ -711,7 +902,9 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
* Map local access to a local URI...
*/
if (!strcasecmp(hostname, "localhost") ||
if (!strcasecmp(hostname, "127.0.0.1") ||
!strcasecmp(hostname, "[::1]") ||
!strcasecmp(hostname, "localhost") ||
!strncasecmp(hostname, "localhost.", 10) ||
!strcasecmp(hostname, server) ||
!strcasecmp(hostname, servername))
@@ -733,7 +926,7 @@ cgiRewriteURL(const char *uri, /* I - Current URI */
ishttps ? "https" : "http",
userpass, hostname, port, resource);
else
snprintf(url, urlsize, "%s://%s:%d%s",
snprintf(url, urlsize, "%s://%s:%d%s",
ishttps ? "https" : "http",
hostname, port, resource);
}
@@ -845,7 +1038,7 @@ cgiSetIPPObjectVars(
remaining = sizeof(value) - (valptr - value);
if (!strcmp(attr->values[i].string.text, "printer-stopped"))
strlcpy(valptr, _("Printer Stopped"), remaining);
strlcpy(valptr, _("Printer Paused"), remaining);
else if (!strcmp(attr->values[i].string.text, "printer-added"))
strlcpy(valptr, _("Printer Added"), remaining);
else if (!strcmp(attr->values[i].string.text, "printer-modified"))
@@ -980,7 +1173,7 @@ cgiSetIPPObjectVars(
for (i = 0; i < attr->num_values; i ++)
{
if (i)
strlcat(valptr, ",", sizeof(value) - (valptr - value));
strlcat(valptr, ", ", sizeof(value) - (valptr - value));
valptr += strlen(valptr);
@@ -1205,11 +1398,12 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
int ascending, /* Order of jobs (0 = descending) */
first, /* First job to show */
count; /* Number of jobs */
const char *var; /* Form variable */
const char *var, /* Form variable */
*query, /* Query string */
*section; /* Section in web interface */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
char url[1024], /* Printer URI */
val[1024]; /* Form variable */
/*
@@ -1231,8 +1425,8 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
NULL, url);
}
else
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
"ipp://localhost/jobs");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
"ipp://localhost/");
if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
@@ -1250,10 +1444,14 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
if ((query = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
search = cgiCompileSearch(query);
else
{
query = NULL;
search = NULL;
}
jobs = cgiGetIPPObjects(response, search);
count = cupsArrayCount(jobs);
@@ -1278,16 +1476,27 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
else
{
ascending = !which_jobs || !strcasecmp(which_jobs, "not-completed");
cgiSetVariable("ORDER", ascending ? "asc" : "dec");
}
section = cgiGetVariable("SECTION");
cgiClearVariables();
if (query)
cgiSetVariable("QUERY", query);
cgiSetVariable("ORDER", ascending ? "asc" : "dec");
cgiSetVariable("SECTION", section);
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
if (which_jobs)
cgiSetVariable("WHICH_JOBS", which_jobs);
if (ascending)
{
@@ -1308,61 +1517,27 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
if (dest)
{
if (dest)
snprintf(url, sizeof(url), "/%s/%s?QUERY=", cgiGetVariable("SECTION"),
dest);
else
strlcpy(url, "/jobs/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
snprintf(val, sizeof(val), "/%s/%s", section, dest);
cgiSetVariable("PRINTER_NAME", dest);
cgiSetVariable("PRINTER_URI_SUPPORTED", val);
}
else
{
if (dest)
snprintf(url, sizeof(url), "/%s/%s?", cgiGetVariable("SECTION"), dest);
else
strlcpy(url, "/jobs/?", sizeof(url));
strlcpy(val, "/jobs/", sizeof(val));
urlptr = url + strlen(url);
}
if (which_jobs)
{
strlcpy(urlptr, "WHICH_JOBS=", urlend - urlptr);
urlptr += strlen(urlptr);
cgiFormEncode(urlptr, which_jobs, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
cgiSetVariable("THISURL", val);
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
}
/*
@@ -1376,12 +1551,12 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
cgiCopyTemplateLang("jobs-header.tmpl");
if (count > 0)
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("jobs.tmpl");
if (count > 0)
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
cupsArrayDelete(jobs);
+8 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Job status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -57,6 +57,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "jobs");
cgiSetVariable("REFRESH_PAGE", "");
/*
* Connect to the HTTP server...
@@ -77,7 +78,7 @@ main(int argc, /* I - Number of command-line arguments */
* Do the operation...
*/
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
{
/*
* Do the operation...
@@ -185,6 +186,11 @@ do_job_op(http_t *http, /* I - HTTP connection */
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")));
+40
Ver Arquivo
@@ -0,0 +1,40 @@
_cgiCheckVariables
_cgiClearVariables
_cgiCompileSearch
_cgiCopyTemplateFile
_cgiCopyTemplateLang
_cgiDoSearch
_cgiEndHTML
_cgiEndMultipart
_cgiFormEncode
_cgiFreeSearch
_cgiGetArray
_cgiGetAttributes
_cgiGetFile
_cgiGetIPPObjects
_cgiGetSize
_cgiGetTemplateDir
_cgiGetVariable
_cgiInitialize
_cgiIsPOST
_cgiMoveJobs
_cgiPrintCommand
_cgiPrintTestPage
_cgiRewriteURL
_cgiSetArray
_cgiSetIPPObjectVars
_cgiSetIPPVars
_cgiSetServerVersion
_cgiSetSize
_cgiSetVariable
_cgiShowIPPError
_cgiShowJobs
_cgiStartHTML
_cgiStartMultipart
_cgiSupportsMultipart
_cgiText
_helpDeleteIndex
_helpFindNode
_helpLoadIndex
_helpSaveIndex
_helpSearchIndex
+486
Ver Arquivo
@@ -0,0 +1,486 @@
/*
* "$Id$"
*
* Xcode documentation set generator.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* 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:
*
* makedocset directory *.tokens
*
* Contents:
*
* main() - Test the help index code.
* compare_html() - Compare the titles of two HTML files.
* compare_sections() - Compare the names of two help sections.
* compare_sections_files() - Compare the number of files and section names.
* write_index() - Write an index file for the CUPS help.
* write_info() - Write the Info.plist file.
* write_nodes() - Write the Nodes.xml file.
*/
/*
* Include necessary headers...
*/
#include "cgi.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 (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 (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 (strcasecmp(a->name, b->name));
}
/*
* 'write_index()' - Write an index file for the CUPS help.
*/
static void
write_index(const char *path, /* I - File to write */
help_index_t *hi) /* I - Index of files */
{
cups_file_t *fp; /* Output file */
help_node_t *node; /* Current help node */
_cups_section_t *section, /* Current section */
key; /* Section search key */
_cups_html_t *html; /* Current HTML file */
cups_array_t *sections, /* Sections in index */
*sections_files,/* Sections sorted by size */
*columns[3]; /* Columns in final HTML file */
int column, /* Current column */
lines[3], /* Number of lines in each column */
min_column, /* Smallest column */
min_lines; /* Smallest number of lines */
/*
* Build an array of sections and their files.
*/
sections = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
node;
node = (help_node_t *)cupsArrayNext(hi->nodes))
{
if (node->anchor)
continue;
key.name = node->section ? node->section : "Miscellaneous";
if ((section = (_cups_section_t *)cupsArrayFind(sections, &key)) == NULL)
{
section = (_cups_section_t *)calloc(1, sizeof(_cups_section_t));
section->name = key.name;
section->files = cupsArrayNew((cups_array_func_t)compare_html, NULL);
cupsArrayAdd(sections, section);
}
html = (_cups_html_t *)calloc(1, sizeof(_cups_html_t));
html->path = node->filename;
html->title = node->text;
cupsArrayAdd(section->files, html);
}
/*
* Build a sorted list of sections based on the number of files in each section
* and the section name...
*/
sections_files = cupsArrayNew((cups_array_func_t)compare_sections_files,
NULL);
for (section = (_cups_section_t *)cupsArrayFirst(sections);
section;
section = (_cups_section_t *)cupsArrayNext(sections))
cupsArrayAdd(sections_files, section);
/*
* Then build three columns to hold everything, trying to balance the number of
* lines in each column...
*/
for (column = 0; column < 3; column ++)
{
columns[column] = cupsArrayNew((cups_array_func_t)compare_sections, NULL);
lines[column] = 0;
}
for (section = (_cups_section_t *)cupsArrayFirst(sections_files);
section;
section = (_cups_section_t *)cupsArrayNext(sections_files))
{
for (min_column = 0, min_lines = lines[0], column = 1;
column < 3;
column ++)
{
if (lines[column] < min_lines)
{
min_column = column;
min_lines = lines[column];
}
}
cupsArrayAdd(columns[min_column], section);
lines[min_column] += cupsArrayCount(section->files) + 2;
}
/*
* Write the HTML file...
*/
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePuts(fp, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
"Transitional//EN\" "
"\"http://www.w3.org/TR/html4/loose.dtd\">\n"
"<html>\n"
"<head>\n"
"<title>CUPS Documentation</title>\n"
"<link rel='stylesheet' type='text/css' "
"href='cups-printable.css'>\n"
"</head>\n"
"<body>\n"
"<h1 class='title'>CUPS Documentation</h1>\n"
"<table width='100%' summary=''>\n"
"<tr>\n");
for (column = 0; column < 3; column ++)
{
if (column)
cupsFilePuts(fp, "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n");
cupsFilePuts(fp, "<td valign='top' width='33%'>");
for (section = (_cups_section_t *)cupsArrayFirst(columns[column]);
section;
section = (_cups_section_t *)cupsArrayNext(columns[column]))
{
cupsFilePrintf(fp, "<h2 class='title'>%s</h2>\n", section->name);
for (html = (_cups_html_t *)cupsArrayFirst(section->files);
html;
html = (_cups_html_t *)cupsArrayNext(section->files))
cupsFilePrintf(fp, "<p class='compact'><a href='%s'>%s</a></p>\n",
html->path, html->title);
}
cupsFilePuts(fp, "</td>\n");
}
cupsFilePuts(fp, "</tr>\n"
"</table>\n"
"</body>\n"
"</html>\n");
cupsFileClose(fp);
}
/*
* 'write_info()' - Write the Info.plist file.
*/
static void
write_info(const char *path, /* I - File to write */
const char *revision) /* I - Subversion revision number */
{
cups_file_t *fp; /* File */
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePrintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" "
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
"<plist version=\"1.0\">\n"
"<dict>\n"
"\t<key>CFBundleIdentifier</key>\n"
"\t<string>org.cups.docset</string>\n"
"\t<key>CFBundleName</key>\n"
"\t<string>CUPS Documentation</string>\n"
"\t<key>CFBundleVersion</key>\n"
"\t<string>%d.%d.%s</string>\n"
"\t<key>CFBundleShortVersionString</key>\n"
"\t<string>%d.%d.%d</string>\n"
"\t<key>DocSetFeedName</key>\n"
"\t<string>cups.org</string>\n"
"\t<key>DocSetFeedURL</key>\n"
"\t<string>http://www.cups.org/org.cups.docset.atom"
"</string>\n"
"\t<key>DocSetPublisherIdentifier</key>\n"
"\t<string>org.cups</string>\n"
"\t<key>DocSetPublisherName</key>\n"
"\t<string>CUPS</string>\n"
"</dict>\n"
"</plist>\n",
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, revision,
CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR, CUPS_VERSION_PATCH);
cupsFileClose(fp);
}
/*
* 'write_nodes()' - Write the Nodes.xml file.
*/
static void
write_nodes(const char *path, /* I - File to write */
help_index_t *hi) /* I - Index of files */
{
cups_file_t *fp; /* Output file */
int id; /* Current node ID */
help_node_t *node; /* Current help node */
int subnodes; /* Currently in Subnodes for file? */
int needclose; /* Need to close the current node? */
if ((fp = cupsFileOpen(path, "w")) == NULL)
{
fprintf(stderr, "makedocset: Unable to create %s: %s\n", path,
strerror(errno));
exit(1);
}
cupsFilePuts(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<DocSetNodes version=\"1.0\">\n"
"<TOC>\n"
"<Node id=\"0\">\n"
"<Name>CUPS Documentation</Name>\n"
"<Path>Documentation/index.html</Path>\n"
"</Node>\n");
for (node = (help_node_t *)cupsArrayFirst(hi->nodes), id = 1, subnodes = 0,
needclose = 0;
node;
node = (help_node_t *)cupsArrayNext(hi->nodes), id ++)
{
if (node->anchor)
{
if (!subnodes)
{
cupsFilePuts(fp, "<Subnodes>\n");
subnodes = 1;
}
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Anchor>%s</Anchor>\n"
"<Name>%s</Name>\n"
"</Node>\n", id, node->filename, node->anchor,
node->text);
}
else
{
if (subnodes)
{
cupsFilePuts(fp, "</Subnodes>\n");
subnodes = 0;
}
if (needclose)
cupsFilePuts(fp, "</Node>\n");
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Name>%s</Name>\n", id, node->filename, node->text);
needclose = 1;
}
}
if (subnodes)
cupsFilePuts(fp, "</Subnodes>\n");
if (needclose)
cupsFilePuts(fp, "</Node>\n");
cupsFilePuts(fp, "</TOC>\n"
"</DocSetNodes>\n");
cupsFileClose(fp);
}
/*
* End of "$Id$".
*/
+109 -178
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,7 +15,7 @@
* Contents:
*
* main() - Main entry for CGI.
* print_command() - Send a print command to the printer.
* do_printer_op() - Do a printer operation.
* show_all_printers() - Show all printers...
* show_printer() - Show a single printer.
*/
@@ -32,9 +32,10 @@
* Local functions...
*/
void print_command(http_t *http, const char *printer, const char *command);
void show_all_printers(http_t *http, const char *username);
void show_printer(http_t *http, const char *printer);
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);
/*
@@ -72,6 +73,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiSetVariable("SECTION", "printers");
cgiSetVariable("REFRESH_PAGE", "");
/*
* See if we are displaying a printer or all printers...
@@ -83,6 +85,9 @@ main(int argc, /* I - Number of command-line arguments */
if (!*printer)
printer = NULL;
if (printer)
cgiSetVariable("PRINTER_NAME", printer);
}
/*
@@ -101,7 +106,7 @@ main(int argc, /* I - Number of command-line arguments */
* Get the default printer...
*/
if (!op)
if (!op || !cgiIsPOST())
{
/*
* Get the default destination...
@@ -141,25 +146,48 @@ main(int argc, /* I - Number of command-line arguments */
else
show_printer(http, printer);
}
else if (!strcasecmp(op, "print-self-test-page") && printer)
print_command(http, printer, "PrintSelfTestPage");
else if (!strcasecmp(op, "clean-print-heads") && printer)
print_command(http, printer, "Clean all");
else if (!strcasecmp(op, "print-test-page") && printer)
cgiPrintTestPage(http, printer);
else if (!strcasecmp(op, "move-jobs") && printer)
cgiMoveJobs(http, printer, 0);
else if (printer)
{
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, "purge-jobs"))
do_printer_op(http, printer, IPP_PURGE_JOBS, cgiText(_("Purge Jobs")));
else if (!strcasecmp(op, "print-self-test-page"))
cgiPrintCommand(http, printer, "PrintSelfTestPage",
cgiText(_("Print Self-Test Page")));
else if (!strcasecmp(op, "clean-print-heads"))
cgiPrintCommand(http, printer, "Clean all",
cgiText(_("Clean Print Heads")));
else if (!strcasecmp(op, "print-test-page"))
cgiPrintTestPage(http, printer);
else if (!strcasecmp(op, "move-jobs"))
cgiMoveJobs(http, printer, 0);
else
{
/*
* Unknown/bad operation...
*/
cgiStartHTML(printer);
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
}
else
{
/*
* Unknown/bad operation...
*/
if (printer)
cgiStartHTML(printer);
else
cgiStartHTML(cgiText(_("Printers")));
cgiStartHTML(cgiText(_("Printers")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
@@ -179,117 +207,80 @@ main(int argc, /* I - Number of command-line arguments */
/*
* 'print_command()' - Send a print command to the printer.
* 'do_printer_op()' - Do a printer operation.
*/
void
print_command(http_t *http, /* I - Connection to server */
const char *printer, /* I - Printer */
const char *command) /* I - Command to send */
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 */
{
cups_file_t *fp; /* File pointer */
char filename[1024]; /* Temporary file */
ipp_t *request, /* IPP request */
*response; /* IPP response */
ipp_t *request; /* IPP request */
char uri[HTTP_MAX_URI], /* Printer URI */
resource[1024], /* POST resource path */
refresh[1024]; /* Refresh URL */
const char *user; /* Username */
resource[HTTP_MAX_URI]; /* Path for request */
/*
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* Create the CUPS command file to print...
*/
if ((fp = cupsTempFile2(filename, sizeof(filename))) == NULL)
{
cgiStartHTML(cgiText(_("Printer Maintenance")));
cgiSetVariable("MESSAGE", _("Unable to create temporary file:"));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return;
}
cupsFilePuts(fp, "#CUPS-COMMAND\n");
cupsFilePrintf(fp, "%s\n", command);
cupsFileClose(fp);
/*
* Point to the printer...
*/
snprintf(resource, sizeof(resource), "/printers/%s", printer);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", ippPort(), "/printers/%s", printer);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* Build a printer request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNewRequest(IPP_PRINT_JOB);
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);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, user);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "Printer Maintenance");
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
NULL, "application/postscript");
/*
* Do the request and get back a response...
*/
if ((response = cupsDoFileRequest(http, request, resource,
filename)) != NULL)
snprintf(resource, sizeof(resource), "/printers/%s", printer);
ippDelete(cupsDoRequest(http, request, resource));
if (cupsLastError() == IPP_NOT_AUTHORIZED)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
puts("Status: 401\n");
exit(0);
}
unlink(filename);
if (cupsLastError() <= IPP_OK_CONFLICT)
else if (cupsLastError() > IPP_OK_CONFLICT)
{
/*
* Automatically reload the printer status page...
*/
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
cgiShowIPPError(_("Unable to do maintenance command:"));
}
cgiStartHTML(cgiText(_("Printer Maintenance")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to send maintenance job:"));
else
{
cgiSetVariable("PRINTER_NAME", printer);
/*
* Redirect successful updates back to the printer page...
*/
cgiCopyTemplateLang("maintenance.tmpl");
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_PURGE_JOBS)
cgiCopyTemplateLang("printer-purge.tmpl");
}
cgiEndHTML();
@@ -300,7 +291,7 @@ print_command(http_t *http, /* I - Connection to server */
* 'show_all_printers()' - Show all printers...
*/
void
static void
show_all_printers(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
@@ -308,16 +299,13 @@ show_all_printers(http_t *http, /* I - Connection to server */
ipp_t *request, /* IPP request */
*response; /* IPP response */
cups_array_t *printers; /* Array of printer objects */
ipp_attribute_t *printer, /* Printer object */
*attr; /* Current attribute */
ipp_attribute_t *printer; /* Printer object */
int ascending, /* Order of printers (0 = descending) */
first, /* First printer to show */
count; /* Number of printers */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
char val[1024]; /* Form variable */
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
@@ -363,7 +351,8 @@ show_all_printers(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL)
if ((var = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
search = cgiCompileSearch(var);
else
search = NULL;
@@ -391,8 +380,8 @@ show_all_printers(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
@@ -404,82 +393,32 @@ show_all_printers(http_t *http, /* I - Connection to server */
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, first);
i < CUPS_PAGE_MAX && printer;
i ++, printer = (ipp_attribute_t *)cupsArrayNext(printers))
{
cgiSetIPPObjectVars(printer, NULL, i);
cgiSetArray("cupscommand", i, "0");
for (attr = printer; attr; attr = attr->next)
if (attr->group_tag != IPP_TAG_PRINTER || !attr->name)
break;
else if (!strcmp(attr->name, "printer-type"))
{
if (attr->values[0].integer & CUPS_PRINTER_COMMANDS)
cgiSetArray("cupscommand", i, "1");
break;
}
}
}
else
{
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, count - first - 1);
i < CUPS_PAGE_MAX && printer;
i ++, printer = (ipp_attribute_t *)cupsArrayPrev(printers))
{
cgiSetIPPObjectVars(printer, NULL, i);
cgiSetArray("cupscommand", i, "0");
for (attr = printer; attr; attr = attr->next)
if (attr->group_tag == IPP_TAG_ZERO || !attr->name)
break;
else if (!strcmp(attr->name, "printer-type"))
{
if (attr->values[0].integer & CUPS_PRINTER_COMMANDS)
cgiSetArray("cupscommand", i, "1");
break;
}
}
}
/*
* Save navigation URLs...
*/
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/printers/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/printers/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
cgiSetVariable("THISURL", "/printers/");
if (first > 0)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
}
if ((first + CUPS_PAGE_MAX) < count)
{
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
}
/*
@@ -490,12 +429,12 @@ show_all_printers(http_t *http, /* I - Connection to server */
cgiCopyTemplateLang("printers-header.tmpl");
if (count > 0)
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("printers.tmpl");
if (count > 0)
if (count > CUPS_PAGE_MAX)
cgiCopyTemplateLang("pager.tmpl");
/*
@@ -522,7 +461,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
* 'show_printer()' - Show a single printer.
*/
void
static void
show_printer(http_t *http, /* I - Connection to server */
const char *printer) /* I - Name of printer */
{
@@ -552,7 +491,7 @@ show_printer(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "printers.tmpl");
cgiGetAttributes(request, "printer.tmpl");
/*
* Do the request and get back a response...
@@ -567,14 +506,6 @@ show_printer(http_t *http, /* I - Connection to server */
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if ((attr = ippFindAttribute(response, "printer-type",
IPP_TAG_ENUM)) != NULL)
{
cgiSetVariable("cupscommand",
(attr->values[0].integer & CUPS_PRINTER_COMMANDS) ?
"1" : "0");
}
if (printer && (attr = ippFindAttribute(response, "printer-state",
IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer == IPP_PRINTER_PROCESSING)
@@ -605,7 +536,7 @@ show_printer(http_t *http, /* I - Connection to server */
* Show the printer status...
*/
cgiCopyTemplateLang("printers.tmpl");
cgiCopyTemplateLang("printer.tmpl");
/*
* Show jobs for the specified printer...
+26 -6
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Search routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -47,13 +47,21 @@ cgiCompileSearch(const char *query) /* I - Query string */
char *lword; /* Last word in query */
DEBUG_printf(("help_compile_search(query=\"%s\")\n", query ? query : "(nil)"));
DEBUG_printf(("cgiCompileSearch(query=\"%s\")\n", query));
/*
* Range check input...
*/
if (!query)
return (NULL);
/*
* Allocate a regular expression storage structure...
*/
re = (regex_t *)calloc(1, sizeof(regex_t));
if ((re = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
return (NULL);
/*
* Allocate a buffer to hold the regular expression string, starting
@@ -65,7 +73,11 @@ cgiCompileSearch(const char *query) /* I - Query string */
if (slen < 1024)
slen = 1024;
s = (char *)malloc(slen);
if ((s = (char *)malloc(slen)) == NULL)
{
free(re);
return (NULL);
}
/*
* Copy the query string to the regular expression, handling basic
@@ -162,7 +174,9 @@ cgiCompileSearch(const char *query) /* I - Query string */
* string + RE overhead...
*/
wlen = (sptr - s) + 4 * wlen + 2 * strlen(prefix) + 4;
wlen = (sptr - s) + 2 * 4 * wlen + 2 * strlen(prefix) + 11;
if (lword)
wlen += strlen(lword);
if (wlen > slen)
{
@@ -227,7 +241,13 @@ cgiCompileSearch(const char *query) /* I - Query string */
char *lword2; /* New "last word" */
lword2 = strdup(sword);
if ((lword2 = strdup(sword)) == NULL)
{
free(lword);
free(s);
free(re);
return (NULL);
}
strcpy(sptr, ".*|.*");
sptr += 5;
+57 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI template function.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -26,6 +26,7 @@
#include "cgi-private.h"
#include <errno.h>
#include <regex.h>
/*
@@ -53,6 +54,13 @@ cgiCopyTemplateFile(FILE *out, /* I - Output 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...
*/
@@ -111,7 +119,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
*locptr = '\0'; /* Strip charset */
}
fprintf(stderr, "DEBUG: lang=\"%s\", locale=\"%s\"...\n",
fprintf(stderr, "DEBUG2: lang=\"%s\", locale=\"%s\"...\n",
lang ? lang : "(null)", locale);
/*
@@ -229,6 +237,7 @@ cgi_copy(FILE *out, /* I - Output file */
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, "",
@@ -250,7 +259,7 @@ cgi_copy(FILE *out, /* I - Output file */
uriencode = 0;
for (s = name; (ch = getc(in)) != EOF;)
if (strchr("}]<>=! \t\n", ch))
if (strchr("}]<>=!~ \t\n", ch))
break;
else if (s == name && ch == '%')
uriencode = 1;
@@ -417,6 +426,7 @@ cgi_copy(FILE *out, /* I - Output file */
* {name<value?true:false} Less than
* {name>value?true:false} Greater than
* {name!value?true:false} Not equal
* {name~refex?true:false} Regex match
*/
op = ch;
@@ -427,7 +437,14 @@ cgi_copy(FILE *out, /* I - Output file */
* Test for existance...
*/
result = cgiGetArray(name, element) != NULL && outptr[0];
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
@@ -516,6 +533,39 @@ cgi_copy(FILE *out, /* I - Output file */
case '!' :
result = 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 expresion \"%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;
@@ -632,6 +682,8 @@ cgi_puts(const char *s, /* I - String to output */
fputs("&gt;", out);
else if (*s == '\"')
fputs("&quot;", out);
else if (*s == '\'')
fputs("&#39;", out);
else if (*s == '&')
fputs("&amp;", out);
else
@@ -652,7 +704,7 @@ cgi_puturi(const char *s, /* I - String to output */
{
while (*s)
{
if (strchr("%&+ <>#=", *s) || *s & 128)
if (strchr("%@&+ <>#=", *s) || *s < ' ' || *s & 128)
fprintf(out, "%%%02X", *s & 255);
else
putc(*s, out);
+98 -42
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI form variable and array functions.
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,6 +15,7 @@
* Contents:
*
* cgiCheckVariables() - Check for the presence of "required" variables.
* cgiClearVariables() - Clear all form variables.
* cgiGetArray() - Get an element from a form array...
* cgiGetFile() - Get the file (if any) that was submitted in the form.
* cgiGetSize() - Get the size of a form array value.
@@ -134,6 +135,31 @@ cgiCheckVariables(const char *names) /* I - Variables to look for */
}
/*
* 'cgiClearVariables()' - Clear all form variables.
*/
void
cgiClearVariables(void)
{
int i, j; /* Looping vars */
_cgi_var_t *v; /* Current variable */
for (v = form_vars, i = form_count; i > 0; v ++, i --)
{
_cupsStrFree(v->name);
for (j = 0; j < v->nvalues; j ++)
if (v->values[j])
_cupsStrFree(v->values[j]);
}
form_count = 0;
cgi_unlink_file();
}
/*
* 'cgiGetArray()' - Get an element from a form array...
*/
@@ -148,13 +174,10 @@ cgiGetArray(const char *name, /* I - Name of array variable */
if ((var = cgi_find_variable(name)) == NULL)
return (NULL);
if (var->nvalues == 1)
return (var->values[0]);
if (element < 0 || element >= var->nvalues)
return (NULL);
return (var->values[element]);
return (_cupsStrRetain(var->values[element]));
}
@@ -203,13 +226,13 @@ cgiGetVariable(const char *name) /* I - Name of variable */
#ifdef DEBUG
if (var == NULL)
printf("cgiGetVariable(\"%s\") is returning NULL...\n", name);
DEBUG_printf(("cgiGetVariable(\"%s\") is returning NULL...\n", name));
else
printf("cgiGetVariable(\"%s\") is returning \"%s\"...\n", name,
var->values[var->nvalues - 1]);
DEBUG_printf(("cgiGetVariable(\"%s\") is returning \"%s\"...\n", name,
var->values[var->nvalues - 1]));
#endif /* DEBUG */
return ((var == NULL) ? NULL : var->values[var->nvalues - 1]);
return ((var == NULL) ? NULL : _cupsStrRetain(var->values[var->nvalues - 1]));
}
@@ -242,7 +265,6 @@ cgiInitialize(void)
*/
setbuf(stdout, NULL);
puts("Content-type: text/plain\n");
#endif /* DEBUG */
/*
@@ -322,9 +344,15 @@ cgiSetArray(const char *name, /* I - Name of variable */
{
if (element >= var->avalues)
{
const char **temp; /* Temporary pointer */
temp = (const char **)realloc((void *)(var->values),
sizeof(char *) * (element + 16));
if (!temp)
return;
var->avalues = element + 16;
var->values = (const char **)realloc((void *)(var->values),
sizeof(char *) * var->avalues);
var->values = temp;
}
if (element >= var->nvalues)
@@ -335,9 +363,9 @@ cgiSetArray(const char *name, /* I - Name of variable */
var->nvalues = element + 1;
}
else if (var->values[element])
free((char *)var->values[element]);
_cupsStrFree((char *)var->values[element]);
var->values[element] = strdup(value);
var->values[element] = _cupsStrAlloc(value);
}
}
@@ -362,9 +390,15 @@ cgiSetSize(const char *name, /* I - Name of variable */
if (size >= var->avalues)
{
const char **temp; /* Temporary pointer */
temp = (const char **)realloc((void *)(var->values),
sizeof(char *) * (size + 16));
if (!temp)
return;
var->avalues = size + 16;
var->values = (const char **)realloc((void *)(var->values),
sizeof(char *) * var->avalues);
var->values = temp;
}
if (size > var->nvalues)
@@ -376,7 +410,7 @@ cgiSetSize(const char *name, /* I - Name of variable */
{
for (i = size; i < var->nvalues; i ++)
if (var->values[i])
free((void *)(var->values[i]));
_cupsStrFree((void *)(var->values[i]));
}
var->nvalues = size;
@@ -409,9 +443,9 @@ cgiSetVariable(const char *name, /* I - Name of variable */
{
for (i = 0; i < var->nvalues; i ++)
if (var->values[i])
free((char *)var->values[i]);
_cupsStrFree((char *)var->values[i]);
var->values[0] = strdup(value);
var->values[0] = _cupsStrAlloc(value);
var->nvalues = 1;
}
}
@@ -426,32 +460,41 @@ cgi_add_variable(const char *name, /* I - Variable name */
int element, /* I - Array element number */
const char *value) /* I - Variable value */
{
_cgi_var_t *var; /* New variable */
_cgi_var_t *var; /* New variable */
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
#ifdef DEBUG
printf("Adding variable \'%s\' with value \'%s\'...\n", name, value);
#endif /* DEBUG */
DEBUG_printf(("cgi_add_variable: Adding variable \'%s\' with value "
"\'%s\'...\n", name, value));
if (form_count >= form_alloc)
{
if (form_alloc == 0)
form_vars = malloc(sizeof(_cgi_var_t) * 16);
else
form_vars = realloc(form_vars, (form_alloc + 16) * sizeof(_cgi_var_t));
_cgi_var_t *temp_vars; /* Temporary form pointer */
if (form_alloc == 0)
temp_vars = malloc(sizeof(_cgi_var_t) * 16);
else
temp_vars = realloc(form_vars, (form_alloc + 16) * sizeof(_cgi_var_t));
if (!temp_vars)
return;
form_vars = temp_vars;
form_alloc += 16;
}
var = form_vars + form_count;
var->name = strdup(name);
var = form_vars + form_count;
if ((var->values = calloc(element + 1, sizeof(char *))) == NULL)
return;
var->name = _cupsStrAlloc(name);
var->nvalues = element + 1;
var->avalues = element + 1;
var->values = calloc(element + 1, sizeof(char *));
var->values[element] = strdup(value);
var->values[element] = _cupsStrAlloc(value);
form_count ++;
}
@@ -500,9 +543,7 @@ cgi_initialize_get(void)
char *data; /* Pointer to form data string */
#ifdef DEBUG
puts("Initializing variables using GET method...");
#endif /* DEBUG */
DEBUG_puts("cgi_initialize_get: Initializing variables using GET method...");
/*
* Check to see if there is anything for us to read...
@@ -756,9 +797,7 @@ cgi_initialize_post(void)
status; /* Return status */
#ifdef DEBUG
puts("Initializing variables using POST method...");
#endif /* DEBUG */
DEBUG_puts("cgi_initialize_post: Initializing variables using POST method...");
/*
* Check to see if there is anything for us to read...
@@ -784,11 +823,27 @@ cgi_initialize_post(void)
for (tbytes = 0; tbytes < length; tbytes += nbytes)
if ((nbytes = read(0, data + tbytes, length - tbytes)) < 0)
{
if (errno != EAGAIN)
{
free(data);
return (0);
}
else
nbytes = 0;
}
else if (nbytes == 0)
{
/*
* CUPS STR #3176: OpenBSD: Early end-of-file on POST data causes 100% CPU
*
* This should never happen, but does on OpenBSD. If we see early end-of-
* file, treat this as an error and process no data.
*/
free(data);
return (0);
}
data[length] = '\0';
@@ -905,7 +960,7 @@ cgi_initialize_string(const char *data) /* I - Form data string */
if (s > value)
s --;
while (s >= value && *s == ' ')
while (s >= value && isspace(*s & 255))
*s-- = '\0';
/*
@@ -970,7 +1025,7 @@ cgi_sort_variables(void)
int i;
puts("Sorting variables...");
DEBUG_puts("cgi_sort_variables: Sorting variables...");
#endif /* DEBUG */
if (form_count < 2)
@@ -980,10 +1035,11 @@ cgi_sort_variables(void)
(int (*)(const void *, const void *))cgi_compare_variables);
#ifdef DEBUG
puts("Sorted variable list is:");
DEBUG_puts("cgi_sort_variables: Sorted variable list is:");
for (i = 0; i < form_count; i ++)
printf("%d: %s (%d) = \"%s\" ...\n", i, form_vars[i].name,
form_vars[i].nvalues, form_vars[i].values[0]);
DEBUG_printf(("cgi_sort_variables: %d: %s (%d) = \"%s\" ...\n", i,
form_vars[i].name, form_vars[i].nvalues,
form_vars[i].values[0]));
#endif /* DEBUG */
}
+116
Ver Arquivo
@@ -0,0 +1,116 @@
/*
* "$Id$"
*
* Web search program for www.cups.org.
*
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* 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:
*
* websearch directory "search string"
*
* Contents:
*
* main() - Search a directory of help files.
* list_nodes() - List matching nodes.
*/
/*
* Include necessary headers...
*/
#include "cgi.h"
/*
* Local functions...
*/
static void list_nodes(help_index_t *hi, const char *title,
cups_array_t *nodes);
/*
* 'main()' - Test the help index code.
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
help_index_t *hi, /* Help index */
*search; /* Search index */
char indexname[1024]; /* Name of index file */
if (argc != 3)
{
puts("Usage: websearch directory \"search terms\"");
return (1);
}
/*
* Load the help index...
*/
snprintf(indexname, sizeof(indexname), "%s/.index", argv[1]);
hi = helpLoadIndex(indexname, argv[1]);
/*
* Do any searches...
*/
search = helpSearchIndex(hi, argv[2], NULL, NULL);
if (search)
list_nodes(hi, argv[1], search->sorted);
/*
* Return with no errors...
*/
return (0);
}
/*
* 'list_nodes()' - List nodes in an array...
*/
static void
list_nodes(help_index_t *hi, /* I - Help index */
const char *title, /* I - Title string */
cups_array_t *nodes) /* I - Nodes */
{
help_node_t *node, /* Current node */
*file; /* File node */
printf("%d\n", cupsArrayCount(nodes));
for (node = (help_node_t *)cupsArrayFirst(nodes);
node;
node = (help_node_t *)cupsArrayNext(nodes))
{
if (node->anchor)
{
file = helpFindNode(hi, node->filename, NULL);
printf("%d|%s#%s|%s|%s\n", node->score, node->filename, node->anchor,
node->text, file ? file->text : node->filename);
}
else
printf("%d|%s|%s|%s\n", node->score, node->filename, node->text,
node->text);
}
}
/*
* End of "$Id$".
*/
+60 -14
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2008 by Apple Inc.
# Copyright 1993-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -30,6 +30,20 @@ REPLACE = mime.convs mime.types
all:
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all config and object files...
#
@@ -45,31 +59,38 @@ depend:
#
# Install files...
# Install all targets...
#
install: all
$(INSTALL_DIR) -m 755 $(SERVERROOT)
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) $$file $(SERVERROOT)/$$file.N ; \
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file.N || true; \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
else \
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
fi ; \
done
$(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
-chgrp $(CUPS_GROUP) $(SERVERROOT)/cupsd.conf.default
$(INSTALL_CONFIG) -g $(CUPS_GROUP) cupsd.conf $(SERVERROOT)/cupsd.conf.default
$(INSTALL_DIR) -m 755 $(DATADIR)/mime
for file in $(REPLACE); do \
if test -r $(SERVERROOT)/$$file ; then \
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
if test -r $(DATADIR)/mime/$$file ; then \
$(MV) $(DATADIR)/mime/$$file $(DATADIR)/mime/$$file.O ; \
fi ; \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
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/$(PAMFILE) ; then \
if test -r $(BUILDROOT)$(PAMDIR)/cups ; then \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \
else \
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \
@@ -77,6 +98,27 @@ install: all
fi
#
# Install programs...
#
install-exec:
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall files...
#
@@ -86,6 +128,10 @@ uninstall:
$(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); \
+49 -13
Ver Arquivo
@@ -1,14 +1,13 @@
#
# "$Id$"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
# file.
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
#
# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel info
# Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
# for troubleshooting...
LogLevel @CUPS_LOG_LEVEL@
# Administrator user group...
SystemGroup @CUPS_SYSTEM_GROUPS@
@@ -22,6 +21,7 @@ Listen localhost:@DEFAULT_IPP_PORT@
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseLocalProtocols @CUPS_BROWSE_LOCAL_PROTOCOLS@
# Default authentication type, when authentication is required...
DefaultAuthType Basic
@@ -29,14 +29,11 @@ DefaultAuthType Basic
# Restrict access to the server...
<Location />
Order allow,deny
Allow localhost
</Location>
# Restrict access to the admin pages...
<Location /admin>
@ENCRYPTION_REQUIRED@
Order allow,deny
Allow localhost
</Location>
# Restrict access to configuration files...
@@ -44,13 +41,51 @@ DefaultAuthType Basic
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow localhost
</Location>
# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an administrator...
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job 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 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-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI>
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 CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
@@ -65,13 +100,14 @@ DefaultAuthType Basic
# 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 CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
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_PRINTADMIN_AUTH@
AuthType Default
Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
Order deny,allow
</Limit>
+42 -51
Ver Arquivo
@@ -7,7 +7,7 @@
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -38,62 +38,53 @@
# PostScript filters
#
application/pdf application/postscript 33 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
application/x-cshell application/postscript 33 texttops
application/x-csource application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/plain application/postscript 33 texttops
text/html application/postscript 33 texttops
image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
image/jpeg application/vnd.cups-postscript 66 imagetops
image/tiff application/vnd.cups-postscript 66 imagetops
image/x-bitmap application/vnd.cups-postscript 66 imagetops
image/x-photocd application/vnd.cups-postscript 66 imagetops
image/x-portable-anymap application/vnd.cups-postscript 66 imagetops
image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops
image/x-portable-graymap application/vnd.cups-postscript 66 imagetops
image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops
image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops
image/x-xbitmap application/vnd.cups-postscript 66 imagetops
image/x-xpixmap application/vnd.cups-postscript 66 imagetops
#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
image/x-sun-raster application/vnd.cups-postscript 66 imagetops
########################################################################
#
# Form filter...
#
# This filter does not currently exist, but the file format is defined
# in the IDD and registered with the IANA for future use...
#
#application/vnd.cups-form application/vnd.cups-postscript 33 formtops
application/pdf application/vnd.cups-postscript 66 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
application/x-cshell application/postscript 33 texttops
application/x-csource application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/plain application/postscript 33 texttops
text/css application/postscript 33 texttops
text/html application/postscript 33 texttops
image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
image/jpeg application/vnd.cups-postscript 66 imagetops
image/tiff application/vnd.cups-postscript 66 imagetops
image/x-bitmap application/vnd.cups-postscript 66 imagetops
image/x-photocd application/vnd.cups-postscript 66 imagetops
image/x-portable-anymap application/vnd.cups-postscript 66 imagetops
image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops
image/x-portable-graymap application/vnd.cups-postscript 66 imagetops
image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops
image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops
image/x-xbitmap application/vnd.cups-postscript 66 imagetops
image/x-xpixmap application/vnd.cups-postscript 66 imagetops
#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
image/x-sun-raster application/vnd.cups-postscript 66 imagetops
application/vnd.cups-banner application/postscript 33 bannertops
########################################################################
#
# Raster filters...
#
image/gif application/vnd.cups-raster 100 imagetoraster
image/png application/vnd.cups-raster 100 imagetoraster
image/jpeg application/vnd.cups-raster 100 imagetoraster
image/tiff application/vnd.cups-raster 100 imagetoraster
image/x-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-photocd application/vnd.cups-raster 100 imagetoraster
image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
image/gif application/vnd.cups-raster 100 imagetoraster
image/png application/vnd.cups-raster 100 imagetoraster
image/jpeg application/vnd.cups-raster 100 imagetoraster
image/tiff application/vnd.cups-raster 100 imagetoraster
image/x-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-photocd application/vnd.cups-raster 100 imagetoraster
image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
# pstoraster is part of GPL Ghostscript...
application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
+17 -11
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.types 6649 2007-07-11 21:46:42Z mike $"
# "$Id: mime.types 8783 2009-08-28 17:51:05Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
@@ -7,7 +7,7 @@
# VERSIONS OF CUPS. Instead, create a "local.types" file that
# reflects your local configuration changes.
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -33,6 +33,8 @@
# 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)
# string(offset,"string") True if bytes are identical to string
@@ -48,10 +50,12 @@
#
# 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. Type names are sorted
# in ascending order, so if two types use the same rules to resolve a type
# (e.g. doc extension for two types), the returned type will be the first
# type in the sorted list.
# 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.
@@ -91,7 +95,7 @@ application/vnd.hp-HPGL hpgl \
image/gif gif string(0,GIF87a) string(0,GIF89a)
image/png png string(0,<89>PNG)
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) +\
(char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
@@ -110,7 +114,7 @@ image/x-sun-raster ras string(0,<59a66a95>)
#image/fpx fpx
image/x-alias pix short(8,8) short(8,24)
image/x-bitmap bmp string(0,BM) && !printable(2,14)
image/x-bitmap bmp string(0,BM) + !printable(2,14)
image/x-icon ico
########################################################################
@@ -149,12 +153,14 @@ 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-form string(0,"<CUPSFORM>")
application/vnd.cups-pdf
application/vnd.cups-postscript
application/vnd.cups-ppd ppd string(0,"*PPD-Adobe:")
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \
string(0,"RaS2") 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) + \
@@ -171,5 +177,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
application/octet-stream
#
# End of "$Id: mime.types 6649 2007-07-11 21:46:42Z mike $".
# End of "$Id: mime.types 8783 2009-08-28 17:51:05Z mike $".
#
-3
Ver Arquivo
@@ -1,3 +0,0 @@
#%PAM-1.0
auth required pam_unix.so shadow nodelay nullok
account required pam_unix.so
+5
Ver Arquivo
@@ -0,0 +1,5 @@
# 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 -1
Ver Arquivo
@@ -1,2 +1,2 @@
auth required @PAMMOD@ nullok shadow
auth required @PAMMODAUTH@
account required @PAMMOD@
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
#
# "$Id$"
#
# Sample SNMP configuration file for CUPS. See "man smnp.conf" for a
# Sample SNMP configuration file for CUPS. See "man cups-smnp.conf" for a
# complete description of this file.
#
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id$"
dnl "$Id: cups-3264.m4 8524 2009-04-19 21:18:45Z mike $"
dnl
dnl 32/64-bit library support stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems])
INSTALL32=""
LIB32CUPS=""
@@ -28,7 +28,7 @@ AC_SUBST(LIB32CUPSIMAGE)
AC_SUBST(LIB32DIR)
AC_SUBST(UNINSTALL32)
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems])
INSTALL64=""
LIB64CUPS=""
@@ -136,5 +136,5 @@ case "$uname" in
esac
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-3264.m4 8524 2009-04-19 21:18:45Z mike $".
dnl
+158 -94
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-common.m4 6965 2007-09-17 21:34:07Z mike $"
dnl "$Id: cups-common.m4 8938 2009-12-18 23:52:01Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -19,15 +19,20 @@ AC_PREREQ(2.60)
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Versio number information...
CUPS_VERSION="1.3.2"
dnl Version number information...
CUPS_VERSION="1.4.3"
CUPS_REVISION=""
#if test -z "$CUPS_REVISION" -a -d .svn; then
# CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
#fi
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, "CUPS v$CUPS_VERSION$CUPS_REVISION")
AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
@@ -40,15 +45,11 @@ LDFLAGS="${LDFLAGS:=}"
dnl Checks for programs...
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
if test "$INSTALL" = "$ac_install_sh"; then
# Use full path to install-sh script...
INSTALL="`pwd`/install-sh -c"
fi
AC_PROG_CXX
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(LD,ld)
AC_PATH_PROG(LN,ln)
@@ -56,7 +57,18 @@ AC_PATH_PROG(MV,mv)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(RMDIR,rmdir)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(STRIP,strip)
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.])
@@ -64,13 +76,10 @@ fi
if test "x$CC" = x; then
AC_MSG_ERROR([Unable to find required C compiler command.])
fi
if test "x$CXX" = x; then
AC_MSG_ERROR([Unable to find required C++ compiler command.])
fi
dnl Static library option...
INSTALLSTATIC=""
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
AC_ARG_ENABLE(static, [ --enable-static install static libraries])
if test x$enable_static = xyes; then
echo Installing static libraries...
@@ -84,23 +93,20 @@ AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(getspent, sec gen)
LIBMALLOC=""
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
if test x$enable_mallinfo = xyes; then
AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
if test "$ac_cv_lib_c_mallinfo" = "no"; then
AC_CHECK_LIB(malloc,mallinfo,
LIBS="$LIBS"
LIBMALLOC="-lmalloc"
AC_DEFINE(HAVE_MALLINFO),
LIBS="$LIBS")
fi
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 turn on libpaper support, default=no])
AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
if test x$enable_libpaper = xyes; then
AC_CHECK_LIB(paper,systempapername,
@@ -135,8 +141,8 @@ else
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
dnl Checks for mkstemp and mkstemps functions.
AC_CHECK_FUNCS(mkstemp mkstemps)
dnl Check for random number functions...
AC_CHECK_FUNCS(random lrand48 arc4random)
dnl Check for geteuid function.
AC_CHECK_FUNCS(geteuid)
@@ -171,6 +177,40 @@ AC_TRY_COMPILE([#include <time.h>],[struct tm t;
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=""
AC_SUBST(LIBUSB)
if test x$enable_libusb = xyes; then
check_libusb=yes
elif test x$enable_libusb != xno -a $uname != Darwin; then
check_libusb=yes
else
check_libusb=no
fi
if test $check_libusb = yes; then
AC_CHECK_LIB(usb, usb_init,[
AC_CHECK_HEADER(usb.h,
AC_DEFINE(HAVE_USB_H)
LIBUSB="-lusb")])
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 Flags for "ar" command...
case $uname in
Darwin* | *BSD*)
@@ -183,36 +223,73 @@ esac
AC_SUBST(ARFLAGS)
dnl Extra platform-specific libraries...
dnl Prep libraries specifically for cupsd and backends...
BACKLIBS=""
CUPSDLIBS=""
DBUSDIR=""
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
CUPS_SYSTEM_AUTHKEY=""
AC_SUBST(BACKLIBS)
AC_SUBST(CUPSDLIBS)
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
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))
CUPSDLIBS="$CUPSDLIBS $LIBS"
fi
LIBS="$SAVELIBS"
FONTS="fonts"
AC_SUBST(FONTS)
LEGACY_BACKENDS="parallel scsi"
AC_SUBST(LEGACY_BACKENDS)
dnl Check for DBUS support
if test -d /etc/dbus-1; then
DBUSDIR="/etc/dbus-1"
else
DBUSDIR=""
fi
case $uname in
Darwin*)
FONTS=""
LEGACY_BACKENDS=""
BACKLIBS="-framework IOKit"
CUPSDLIBS="-sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
LIBS="-framework CoreFoundation $LIBS"
AC_ARG_ENABLE(dbus, [ --enable-dbus build with DBUS support])
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
DBUSDIR="$withval")
dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
if test "$uname" = "Darwin" -a $uversion -ge 70; then
AC_DEFINE(HAVE_CF_LOCALE_ID)
DBUS_NOTIFIER=""
DBUS_NOTIFIERLIBS=""
if test "x$enable_dbus" != xno; then
AC_PATH_PROG(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
DBUS_NOTIFIER="dbus"
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
AC_CHECK_LIB(dbus-1,
dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
`$PKGCONFIG --libs dbus-1`)
else
AC_MSG_RESULT(no)
fi
fi
fi
AC_SUBST(DBUSDIR)
AC_SUBST(DBUS_NOTIFIER)
AC_SUBST(DBUS_NOTIFIERLIBS)
dnl Extra platform-specific libraries...
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
CUPS_SYSTEM_AUTHKEY=""
FONTS="fonts"
LEGACY_BACKENDS="parallel scsi"
case $uname in
Darwin*)
LEGACY_BACKENDS=""
BACKLIBS="$BACKLIBS -framework IOKit"
CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration -weak_framework ApplicationServices"
LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
dnl Check for framework headers...
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
@@ -224,6 +301,9 @@ case $uname in
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
AC_CHECK_FUNCS(mbr_uid_to_uuid)
dnl Check for the vproc_transaction_begin/end stuff...
AC_CHECK_FUNCS(vproc_transaction_begin)
dnl Need <dlfcn.h> header...
AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
@@ -232,60 +312,44 @@ case $uname in
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)
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
;;
Linux*)
dnl Check for DBUS support
if test "x$enable_dbus" != xno; then
AC_PATH_PROG(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for DBUS)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBUS)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ], dbusdir="$withval", dbusdir="/etc/dbus-1")
DBUSDIR="$dbusdir"
AC_CHECK_LIB(dbus-1,
dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
else
AC_MSG_RESULT(no)
fi
if test "x$default_adminkey" != xdefault; then
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
elif grep -q system.print.operator /etc/authorization; then
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
else
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
fi
fi
;;
if test "x$default_operkey" != xdefault; then
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
elif grep -q system.print.operator /etc/authorization; then
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
else
CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
fi])
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
dnl Check for sandbox/Seatbelt support
AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
;;
esac
AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
dnl See if we have POSIX ACL support...
SAVELIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
CUPSDLIBS="$CUPSDLIBS $LIBS"
LIBS="$SAVELIBS"
AC_SUBST(BACKLIBS)
AC_SUBST(CUPSDLIBS)
AC_SUBST(DBUSDIR)
dnl New default port definition for IPP...
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
DEFAULT_IPP_PORT="$withval",
DEFAULT_IPP_PORT="631")
AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
AC_SUBST(FONTS)
AC_SUBST(LEGACY_BACKENDS)
dnl
dnl End of "$Id: cups-common.m4 6965 2007-09-17 21:34:07Z mike $".
dnl End of "$Id: cups-common.m4 8938 2009-12-18 23:52:01Z mike $".
dnl
+112 -47
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-compiler.m4 6976 2007-09-18 20:39:31Z mike $"
dnl "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -15,55 +15,83 @@ dnl
dnl Clear the debugging and non-shared library options unless the user asks
dnl for them...
INSTALL_STRIP=""
OPTIM=""
AC_SUBST(INSTALL_STRIP)
AC_SUBST(OPTIM)
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
[if test x$enable_debug = xyes; then
OPTIM="-g"
fi])
AC_ARG_WITH(optim, [ --with-optim set optimization flags ])
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; 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
UNITTESTS="unittests"
else
UNITTESTS=""
fi
AC_SUBST(UNITTESTS)
dnl Setup general architecture flags...
AC_ARG_WITH(archflags, [ --with-archflags="flags"
set default 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=""
LDARCHFLAGS=""
else
ARCHFLAGS="$with_archflags"
fi
if test -z "$with_ldarchflags"; then
if test "$uname" = Darwin; then
# Only link 32-bit programs - 64-bit is for the shared
# libraries...
# Only create 32-bit programs by default
LDARCHFLAGS="`echo $ARCHFLAGS | sed -e '1,$s/-arch x86_64//' -e '1,$s/-arch ppc64//'`"
else
LDARCHFLAGS="$ARCHFLAGS"
fi
else
LDARCHFLAGS="$with_ldarchflags"
fi
AC_SUBST(ARCHFLAGS)
AC_SUBST(LDARCHFLAGS)
dnl Setup support for separate 32/64-bit library generation...
AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
specifies 32-bit architecture flags])
AC_ARG_WITH(arch32flags, [ --with-arch32flags set 32-bit architecture flags])
ARCH32FLAGS=""
AC_SUBST(ARCH32FLAGS)
AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
specifies 64-bit architecture flags])
AC_ARG_WITH(arch64flags, [ --with-arch64flags set 64-bit architecture flags])
ARCH64FLAGS=""
AC_SUBST(ARCH64FLAGS)
dnl Position-Independent Executable support on Linux...
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
dnl Read-only data/program support on Linux...
AC_ARG_ENABLE(relro, [ --enable-relro use GCC relro option, default=no])
AC_ARG_ENABLE(relro, [ --enable-relro build with the GCC relro option])
dnl Update compiler options...
CXXLIBS=""
CXXLIBS="${CXXLIBS:=}"
AC_SUBST(CXXLIBS)
PIEFLAGS=""
@@ -73,7 +101,7 @@ RELROFLAGS=""
AC_SUBST(RELROFLAGS)
LIBCUPSORDER="libcups.order"
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder set libcups secorder file, default=libcups.order],
if test -f "$withval"; then
LIBCUPSORDER="$withval"
fi)
@@ -81,12 +109,15 @@ AC_SUBST(LIBCUPSORDER)
LIBCUPSIMAGEORDER="libcupsimage.order"
AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
libcupsimage secorder file, default=libcupsimage.order],
set libcupsimage secorder file, default=libcupsimage.order],
if test -f "$withval"; then
LIBCUPSIMAGEORDER="$withval"
fi)
AC_SUBST(LIBCUPSIMAGEORDER)
PHPOPTIONS=""
AC_SUBST(PHPOPTIONS)
if test -n "$GCC"; then
# Add GCC-specific compiler options...
if test -z "$OPTIM"; then
@@ -98,36 +129,61 @@ if test -n "$GCC"; then
fi
fi
# Generate position-independent code as needed...
if test $PICFLAG = 1 -a $uname != AIX; then
OPTIM="-fPIC $OPTIM"
fi
case $uname in
Linux*)
if test x$enable_pie = xyes; then
PIEFLAGS="-pie -fPIE"
fi
# 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(if GCC supports -fstack-protector)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector"
AC_TRY_LINK(,,
OPTIM="$OPTIM -fstack-protector"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
if test x$enable_relro = xyes; then
RELROFLAGS="-Wl,-z,relro"
fi
;;
*)
if test x$enable_pie = xyes; then
echo "Sorry, --enable-pie is not supported on this OS!"
fi
;;
esac
# The -pie 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.
AC_MSG_CHECKING(if GCC supports -pie)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -pie -fPIE"
AC_TRY_COMPILE(,,
PIEFLAGS="-pie -fPIE"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
if test "x$with_optim" = x; then
# Add useful warning options for tracking down problems...
OPTIM="-Wall -Wno-format-y2k $OPTIM"
# Additional warning options for alpha testing...
OPTIM="-Wshadow -Wunused $OPTIM"
# Additional warning options for development testing...
if test -d .svn; then
OPTIM="-Wshadow -Wunused $OPTIM"
CFLAGS="-Werror-implicit-function-declaration $CFLAGS"
PHPOPTIONS="-Wno-shadow"
fi
fi
case "$uname" in
Darwin*)
# -D_FORTIFY_SOURCE=2 adds additional object size
# checking, basically wrapping all string functions
# with buffer-limited ones. Not strictly needed for
# CUPS since we already use buffer-limited calls, but
# this will catch any additions that are broken.
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
if test x$enable_pie = xyes; then
# GCC 4 on Mac OS X needs -Wl,-pie as well
LDFLAGS="$LDFLAGS -Wl,-pie"
fi
;;
HP-UX*)
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
@@ -201,6 +257,12 @@ if test -n "$GCC"; then
;;
Linux*)
# 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"
fi
if test "x$enable_32bit" = xyes; then
# Build 32-bit libraries, 64-bit base...
if test -z "$with_arch32flags"; then
@@ -294,9 +356,6 @@ else
fi
CFLAGS="-Ae $CFLAGS"
# Warning 336 is "empty translation unit"
# Warning 829 is passing constant string as char *
CXXFLAGS="+W336,829 $CXXFLAGS"
if test $PICFLAG = 1; then
OPTIM="+z $OPTIM"
@@ -468,8 +527,8 @@ else
# cups-support@cups.org...
echo "Building CUPS with default compiler optimizations; contact"
echo "cups-bugs@cups.org with uname and compiler options needed"
echo "for your platform, or set the CFLAGS and CXXFLAGS"
echo "environment variable before running configure."
echo "for your platform, or set the CFLAGS and LDFLAGS environment"
echo "variables before running configure."
;;
esac
fi
@@ -490,6 +549,12 @@ case $uname in
OPTIM="$OPTIM -D_HPUX_SOURCE"
;;
Linux*)
# glibc 2.8 and higher breaks peer credentials unless you
# define _GNU_SOURCE...
OPTIM="$OPTIM -D_GNU_SOURCE"
;;
OSF*)
# Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
# to be POSIX-compliant...
@@ -498,5 +563,5 @@ case $uname in
esac
dnl
dnl End of "$Id: cups-compiler.m4 6976 2007-09-18 20:39:31Z mike $".
dnl End of "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $".
dnl
+139 -29
Ver Arquivo
@@ -1,10 +1,10 @@
dnl
dnl "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $"
dnl "$Id: cups-defaults.m4 8929 2009-12-15 22:40:37Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -15,7 +15,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
dnl Default languages...
LANGUAGES="`ls -1 locale/*.po | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
LANGUAGES="`ls -1 locale/cups_*.po | 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
@@ -43,8 +43,30 @@ AC_ARG_WITH(log_file_perm, [ --with-log-file-perm set default LogFilePerm va
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=actions],
CUPS_ACCESS_LOG_LEVEL="$withval",
CUPS_ACCESS_LOG_LEVEL="actions")
AC_SUBST(CUPS_ACCESS_LOG_LEVEL)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_ACCESS_LOG_LEVEL, "$CUPS_ACCESS_LOG_LEVEL")
dnl Default Browsing
AC_ARG_ENABLE(browsing, [ --enable-browsing enable Browsing by default, default=yes])
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)
@@ -101,8 +123,8 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS,
"$CUPS_BROWSE_REMOTE_PROTOCOLS")
dnl Default BrowseShortNames
AC_ARG_ENABLE(browse_short, [ --enable-browse-short-names
enable BrowseShortNames by default, default=yes])
AC_ARG_ENABLE(browse_short, [ --disable-browse-short-names
disable BrowseShortNames by default])
if test "x$enable_browse_short" = xno; then
CUPS_BROWSE_SHORT_NAMES="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 0)
@@ -113,7 +135,8 @@ fi
AC_SUBST(CUPS_BROWSE_SHORT_NAMES)
dnl Default DefaultShared
AC_ARG_ENABLE(default_shared, [ --enable-default-shared enable DefaultShared by default, default=yes])
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)
@@ -124,8 +147,8 @@ fi
AC_SUBST(CUPS_DEFAULT_SHARED)
dnl Default ImplicitClasses
AC_ARG_ENABLE(implicit, [ --enable-implicit-classes
enable ImplicitClasses by default, default=yes])
AC_ARG_ENABLE(implicit, [ --disable-implicit-classes
disable ImplicitClasses by default])
if test "x$enable_implicit" = xno; then
CUPS_IMPLICIT_CLASSES="No"
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 0)
@@ -137,7 +160,7 @@ AC_SUBST(CUPS_IMPLICIT_CLASSES)
dnl Default UseNetworkDefault
AC_ARG_ENABLE(use_network_default, [ --enable-use-network-default
enable UseNetworkDefault by default, default=auto])
set UseNetworkDefault to Yes by default])
if test "x$enable_use_network_default" != xno; then
AC_MSG_CHECKING(whether to use network default printers)
if test "x$enable_use_network_default" = xyes -o $uname != Darwin; then
@@ -185,6 +208,10 @@ AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
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)
@@ -215,6 +242,10 @@ AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
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$uname = xDarwin; then
@@ -246,9 +277,14 @@ AC_ARG_WITH(system_groups, [ --with-system-groups set default 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)
@@ -268,7 +304,7 @@ if test x$default_printcap != xno; then
case $uname in
Darwin*)
if test $uversion -ge 90; then
CUPS_DEFAULT_PRINTCAP=""
CUPS_DEFAULT_PRINTCAP="/Library/Preferences/org.cups.printers.plist"
else
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
fi
@@ -287,31 +323,70 @@ else
CUPS_DEFAULT_PRINTCAP=""
fi
AC_SUBST(CUPS_DEFAULT_PRINTCAP)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl Default MaxCopies value...
AC_ARG_WITH(max-copies, [ --with-max-copies set max copies value, default=100 ],
CUPS_MAX_COPIES="$withval",
if test "x$uname" = xDarwin; then
CUPS_MAX_COPIES="999"
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 $uname 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_MAX_COPIES="100"
fi)
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")
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")
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, [ --enable-raw-printing enable raw printing by default, default=auto])
AC_ARG_ENABLE(raw_printing, [ --disable-raw-printing do not allow raw printing by default])
if test "x$enable_raw_printing" != xno; then
AC_MSG_CHECKING(whether to enable raw printing)
if test "x$enable_raw_printing" = xyes -o $uname = Darwin; then
DEFAULT_RAW_PRINTING=""
AC_MSG_RESULT(yes)
else
DEFAULT_RAW_PRINTING="#"
AC_MSG_RESULT(no)
fi
DEFAULT_RAW_PRINTING=""
else
DEFAULT_RAW_PRINTING="#"
fi
@@ -337,6 +412,41 @@ AC_ARG_WITH(snmp-community, [ --with-snmp-community set SNMP community, defau
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 Filters
AC_ARG_ENABLE(bannertops, [ --enable-bannertops always build the banner filter ])
AC_ARG_ENABLE(texttops, [ --enable-texttops always build the text filter ])
if test "x$enable_bannertops" = xno; then
BANNERTOPS=""
elif test "x$enable_bannertops" = xyes; then
BANNERTOPS="bannertops"
elif test $uname = Darwin; then
BANNERTOPS=""
else
BANNERTOPS="bannertops"
fi
if test "x$enable_texttops" = xno; then
TEXTTOPS=""
elif test "x$enable_texttops" = xyes; then
TEXTTOPS="texttops"
elif test $uname = Darwin; then
TEXTTOPS=""
else
TEXTTOPS="texttops"
fi
AC_SUBST(BANNERTOPS)
AC_SUBST(TEXTTOPS)
dnl
dnl End of "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $".
dnl End of "$Id: cups-defaults.m4 8929 2009-12-15 22:40:37Z mike $".
dnl
+70 -12
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-directories.m4 6976 2007-09-18 20:39:31Z mike $"
dnl "$Id: cups-directories.m4 8497 2009-04-12 23:04:51Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -123,12 +123,14 @@ AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$w
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="99")
AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="00")
AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],smfmanifestdir="$withval",smfmanifestdir="")
INITDIR=""
INITDDIR=""
RCLEVELS="$rclevels"
RCSTART="$rcstart"
RCSTOP="$rcstop"
SMFMANIFESTDIR=""
if test x$rcdir = x; then
case "$uname" in
@@ -163,7 +165,7 @@ if test x$rcdir = x; then
RCSTOP="25"
;;
Linux | GNU)
Linux | GNU | GNU/k*BSD*)
# Linux/HURD seems to choose an init.d directory at random...
if test -d /sbin/init.d; then
# SuSE
@@ -192,8 +194,12 @@ if test x$rcdir = x; then
SunOS*)
# Solaris
INITDIR="/etc"
RCSTART="81"
if test "x$smfmanifestdir" != x; then
SMFMANIFESTDIR=$smfmanifestdir
else
INITDIR="/etc"
RCSTART="81"
fi
;;
*)
@@ -201,7 +207,7 @@ if test x$rcdir = x; then
;;
esac
else
elif test "x$rcdir" != xno; then
if test "x$rclevels" = x; then
INITDDIR="$rcdir"
else
@@ -214,6 +220,7 @@ AC_SUBST(INITDDIR)
AC_SUBST(RCLEVELS)
AC_SUBST(RCSTART)
AC_SUBST(RCSTOP)
AC_SUBST(SMFMANIFESTDIR)
dnl Xinetd support...
AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],XINETD="$withval",XINETD="")
@@ -225,10 +232,53 @@ if test "x$XINETD" = x -a ! -x /sbin/launchd; then
break
fi
done
elif test "x$XINETD" = xno; then
XINETD=""
fi
AC_SUBST(XINETD)
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="")
@@ -297,12 +347,11 @@ fi
AC_SUBST(CUPS_FONTPATH)
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH")
# Locale data (initial assignment allows us not to require autoconf 2.60)
localedir="${localedir:=}"
if test "$localedir" = "\${datarootdir}/locale" -o "$localedir" = ""; then
# Locale data
if test "$localedir" = "\${datarootdir}/locale"; then
case "$uname" in
Linux | GNU | *BSD* | Darwin*)
CUPS_LOCALEDIR="$datadir/locale"
CUPS_LOCALEDIR="$datarootdir/locale"
;;
OSF1* | AIX*)
@@ -362,10 +411,19 @@ AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
AC_SUBST(CUPS_SERVERROOT)
# Transient run-time state
CUPS_STATEDIR="$localstatedir/run/cups"
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
case "$uname" in
Darwin*)
# Darwin (Mac OS X)
CUPS_STATEDIR="$CUPS_SERVERROOT"
;;
*)
# All others
CUPS_STATEDIR="$localstatedir/run/cups"
;;
esac
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 6976 2007-09-18 20:39:31Z mike $".
dnl End of "$Id: cups-directories.m4 8497 2009-04-12 23:04:51Z mike $".
dnl
+22 -8
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id$"
dnl "$Id: cups-dnssd.m4 8789 2009-08-28 22:54:34Z mike $"
dnl
dnl DNS Service Discovery (aka Bonjour) stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -7,7 +7,7 @@ dnl http://www.dns-sd.org
dnl http://www.multicastdns.org/
dnl http://developer.apple.com/networking/bonjour/
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Apple Inc. and are protected by Federal copyright
@@ -16,39 +16,53 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(dnssd, [ --enable-dnssd turn on DNS Service Discovery support, default=yes])
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support])
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"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
DNSSDLIBS=""
DNSSD_BACKEND=""
if test x$enable_dnssd != xno; then
AC_CHECK_HEADER(dns_sd.h, [
case "$uname" in
Darwin*)
# Darwin and MacOS X...
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
AC_DEFINE(HAVE_DNSSD)
AC_DEFINE(HAVE_COREFOUNDATION)
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
DNSSD_BACKEND="dnssd"
;;
*)
# All others...
AC_CHECK_LIB(dns_sd,DNSServiceProcessResult,
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")
DNSSDLIBS="-ldns_sd"
DNSSD_BACKEND="dnssd",
AC_MSG_RESULT(no))
LIBS="$SAVELIBS"
;;
esac
])
fi
AC_SUBST(DNSSDLIBS)
AC_SUBST(DNSSD_BACKEND)
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-dnssd.m4 8789 2009-08-28 22:54:34Z mike $".
dnl
+27 -14
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id$"
dnl "$Id: cups-gssapi.m4 8659 2009-05-18 22:03:04Z mike $"
dnl
dnl GSSAPI/Kerberos library detection.
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products.
dnl
dnl This file contains Kerberos support code, copyright 2006 by
@@ -16,21 +16,34 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(gssapi, [ --enable-gssapi turn on GSSAPI support, default=yes])
AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support])
LIBGSSAPI=""
AC_SUBST(LIBGSSAPI)
if test x$enable_gssapi != xno; then
AC_PATH_PROG(KRB5CONFIG, krb5-config)
if test "x$KRB5CONFIG" != x; then
if test "x$uname" = "xDarwin"; then
# Mac OS X weak-links to the Kerberos framework...
LIBGSSAPI="-weak_framework Kerberos"
else
CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS"
CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS"
LIBGSSAPI="`$KRB5CONFIG --libs gssapi`"
fi
case "$uname" in
Darwin)
# Mac OS X weak-links to the Kerberos framework...
LIBGSSAPI="-weak_framework Kerberos"
;;
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...
@@ -61,6 +74,7 @@ if test x$enable_gssapi != xno; then
AC_CHECK_FUNC(gsskrb5_register_acceptor_identity,
AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY))
AC_CHECK_FUNC(krb5_cc_new_unique, AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE))
AC_CHECK_FUNC(krb5_ipc_client_set_target_uid, AC_DEFINE(HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID))
AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
if test $ac_cv_header_gssapi_gssapi_h = yes; then
@@ -95,7 +109,7 @@ AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service n
if test x$default_gssservicename != xno; then
if test "x$default_gssservicename" = "xdefault"; then
CUPS_DEFAULT_GSSSERVICENAME="ipp"
CUPS_DEFAULT_GSSSERVICENAME="host"
else
CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
fi
@@ -103,9 +117,8 @@ else
CUPS_DEFAULT_GSSSERVICENAME=""
fi
AC_SUBST(LIBGSSAPI)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-gssapi.m4 8659 2009-05-18 22:03:04Z mike $".
dnl
+7 -7
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-image.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Image library/filter stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
dnl See if we want the image filters included at all...
AC_ARG_ENABLE(image, [ --enable-image turn on image filters, default=auto])
AC_ARG_ENABLE(image, [ --enable-image always build the image filters])
IMGFILTERS=""
if test "x$enable_image" != xno; then
@@ -30,9 +30,9 @@ fi
AC_SUBST(IMGFILTERS)
dnl Check for image libraries...
AC_ARG_ENABLE(jpeg, [ --enable-jpeg turn on JPEG support, default=yes])
AC_ARG_ENABLE(png, [ --enable-png turn on PNG support, default=yes])
AC_ARG_ENABLE(tiff, [ --enable-tiff turn on TIFF support, default=yes])
AC_ARG_ENABLE(jpeg, [ --disable-jpeg disable JPEG support])
AC_ARG_ENABLE(png, [ --disable-png disable PNG support])
AC_ARG_ENABLE(tiff, [ --disable-tiff disable TIFF support])
LIBJPEG=""
LIBPNG=""
@@ -105,5 +105,5 @@ AC_SUBST(EXPORT_LIBZ)
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
dnl
dnl End of "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-image.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl launchd stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(launchd, [ --enable-launchd turn on launchd support, default=yes])
AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
DEFAULT_LAUNCHD_CONF=""
LAUNCHDLIBS=""
@@ -40,5 +40,5 @@ AC_SUBST(DEFAULT_LAUNCHD_CONF)
AC_SUBST(LAUNCHDLIBS)
dnl
dnl End of "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+23 -12
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ldap.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-ldap.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2003-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,29 +13,40 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(ldap, [ --enable-ldap turn on LDAP support, default=yes])
AC_ARG_WITH(openldap-libs, [ --with-openldap-libs set directory for OpenLDAP library],
AC_ARG_ENABLE(ldap, [ --disable-ldap disable LDAP support])
AC_ARG_WITH(ldap-libs, [ --with-ldap-libs set directory for LDAP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(openldap-includes, [ --with-openldap-includes
set directory for OpenLDAP includes],
AC_ARG_WITH(ldap-includes, [ --with-ldap-includes set directory for LDAP includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
LIBLDAP=""
if test x$enable_ldap != xno; then
AC_CHECK_HEADER(ldap.h,
AC_CHECK_HEADER(ldap.h, [
AC_CHECK_LIB(ldap, ldap_initialize,
AC_DEFINE(HAVE_LDAP)
AC_DEFINE(HAVE_OPENLDAP)
LIBLDAP="-lldap"))
AC_DEFINE(HAVE_LDAP)
AC_DEFINE(HAVE_OPENLDAP)
LIBLDAP="-lldap"
AC_CHECK_LIB(ldap, ldap_start_tls,
AC_DEFINE(HAVE_LDAP_SSL)),
AC_CHECK_LIB(ldap, ldap_init,
AC_DEFINE(HAVE_LDAP)
AC_DEFINE(HAVE_MOZILLA_LDAP)
LIBLDAP="-lldap"
AC_CHECK_HEADER(ldap_ssl.h, AC_DEFINE(HAVE_LDAP_SSL_H),,[#include <ldap.h>])
AC_CHECK_LIB(ldap, ldapssl_init,
AC_DEFINE(HAVE_LDAP_SSL)))
)
AC_CHECK_LIB(ldap, ldap_set_rebind_proc, AC_DEFINE(HAVE_LDAP_REBIND_PROC))
])
fi
AC_SUBST(LIBLDAP)
dnl
dnl End of "$Id: cups-ldap.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-ldap.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+7 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-libtool.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,14 +13,13 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
turn on building with libtool (UNSUPPORTED!), default=no],
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported
build with libtool (UNSUPPORTED!)],
[if test x$enable_libtool_unsupported != xno; then
LIBTOOL="$enable_libtool_unsupported"
enable_shared=no
echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
echo " (even if you have a support contract)"
echo "WARNING: libtool is not supported or endorsed by Apple Inc."
echo " WE DO NOT PROVIDE SUPPORT FOR LIBTOOL PROBLEMS."
else
LIBTOOL=""
fi])
@@ -36,5 +35,5 @@ if test x$LIBTOOL != x; then
fi
dnl
dnl End of "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-libtool.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+4 -12
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-manpages.m4 8230 2009-01-12 19:17:09Z mike $"
dnl
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -51,14 +51,6 @@ AC_SUBST(PMANDIR)
dnl Setup manpage extensions...
case "$uname" in
*BSD* | Darwin*)
# *BSD
MAN1EXT=1
MAN5EXT=5
MAN7EXT=7
MAN8EXT=8
MAN8DIR=8
;;
IRIX*)
# SGI IRIX
MAN1EXT=1
@@ -75,8 +67,8 @@ case "$uname" in
MAN8EXT=1m
MAN8DIR=1m
;;
Linux* | GNU*)
# Linux and GNU Hurd
Linux* | GNU* | Darwin*)
# Linux, GNU Hurd, and Mac OS X
MAN1EXT=1.gz
MAN5EXT=5.gz
MAN7EXT=7.gz
@@ -100,5 +92,5 @@ AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-manpages.m4 8230 2009-01-12 19:17:09Z mike $".
dnl
+7 -21
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-network.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-network.m4 7918 2008-09-08 22:03:01Z mike $"
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,11 +13,15 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_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...
@@ -29,24 +33,6 @@ fi
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
if test "$uname" = "SunOS"; then
case "$uversion" in
55* | 56*)
maxfiles=1024
;;
*)
maxfiles=4096
;;
esac
else
maxfiles=4096
fi
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler ],
maxfiles=$withval)
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
CUPS_DEFAULT_DOMAINSOCKET=""
dnl Domain socket support...
@@ -84,5 +70,5 @@ AC_CHECK_HEADERS(AppleTalk/at_proto.h,AC_DEFINE(HAVE_APPLETALK_AT_PROTO_H),,
[#include <netat/appletalk.h>])
dnl
dnl End of "$Id: cups-network.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-network.m4 7918 2008-09-08 22:03:01Z mike $".
dnl
+31 -18
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-pam.m4 8825 2009-09-22 21:53:31Z mike $"
dnl
dnl PAM stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,7 +13,8 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support, default=yes])
AC_ARG_ENABLE(pam, [ --disable-pam disable PAM support])
AC_ARG_WITH(pam_module, [ --with-pam-module specify the PAM module to use])
dnl Don't use PAM with AIX...
if test $uname = AIX; then
@@ -21,15 +22,18 @@ if test $uname = AIX; then
fi
PAMDIR=""
PAMFILE=""
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,
@@ -57,24 +61,32 @@ if test x$enable_pam != xno; then
case "$uname" in
Darwin*)
# Darwin, MacOS X
PAMFILE="pam.darwin"
;;
IRIX)
# SGI IRIX
PAMFILE="pam.irix"
# Darwin/Mac OS X
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...
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
if test -f /lib/security/$mod; then
PAMMOD="$mod"
break;
fi
done
if test "x$with_pam_module" != x; then
PAMMOD="pam_${with_pam_module}.so"
elif test -f /lib/security/pam_unix2.so; then
PAMMOD="pam_unix2.so"
elif test -f /lib/security/pam_unix.so; then
PAMMOD="pam_unix.so"
fi
PAMFILE="pam.std"
if test "x$PAMMOD" = xpam_unix.so; then
PAMMODAUTH="$PAMMOD shadow nodelay"
else
PAMMODAUTH="$PAMMOD nodelay"
fi
;;
esac
fi
@@ -83,7 +95,8 @@ AC_SUBST(PAMDIR)
AC_SUBST(PAMFILE)
AC_SUBST(PAMLIBS)
AC_SUBST(PAMMOD)
AC_SUBST(PAMMODAUTH)
dnl
dnl End of "$Id: cups-pam.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-pam.m4 8825 2009-09-22 21:53:31Z mike $".
dnl
+11 -8
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
dnl "$Id: cups-pap.m4 8524 2009-04-19 21:18:45Z mike $"
dnl
dnl PAP (AppleTalk) stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -15,14 +15,17 @@ dnl
# Currently the PAP backend is only supported on MacOS X with the AppleTalk
# SDK installed...
PAP=""
if test $uname = Darwin; then
PAP="pap"
AC_CHECK_HEADER(AppleTalk/at_proto.h)
fi
AC_ARG_ENABLE(pap, [ --enable-pap build with AppleTalk support])
PAP=""
AC_SUBST(PAP)
if test x$enable_pap = xyes -a $uname = Darwin; then
AC_CHECK_HEADER(netat/appletalk.h,[
PAP="pap"
AC_CHECK_HEADER(AppleTalk/at_proto.h)])
fi
dnl
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
dnl End of "$Id: cups-pap.m4 8524 2009-04-19 21:18:45Z mike $".
dnl
+66 -12
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pdf.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-pdf.m4 8760 2009-08-07 22:30:30Z mike $"
dnl
dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,22 +13,76 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(pdftops, [ --enable-pdftops build pdftops filter, default=auto ])
AC_ARG_WITH(pdftops, [ --with-pdftops set pdftops filter (gs,/path/to/gs,pdftops,/path/to/pdftops,none), default=pdftops ])
PDFTOPS=""
CUPS_PDFTOPS=""
CUPS_GHOSTSCRIPT=""
if test "x$enable_pdftops" != xno; then
AC_MSG_CHECKING(whether to build pdftops filter)
if test "x$enable_pdftops" = xyes -o $uname != Darwin; then
PDFTOPS="pdftops"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
case "x$with_pdftops" in
x) # Default/auto
if test $uname != Darwin; then
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
if test "x$CUPS_PDFTOPS" != x; then
AC_DEFINE(HAVE_PDFTOPS)
PDFTOPS="pdftops"
else
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
if test "x$CUPS_GHOSTSCRIPT" != x; then
AC_DEFINE(HAVE_GHOSTSCRIPT)
PDFTOPS="pdftops"
fi
fi
fi
fi
;;
xgs)
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
if test "x$CUPS_GHOSTSCRIPT" != x; then
AC_DEFINE(HAVE_GHOSTSCRIPT)
PDFTOPS="pdftops"
else
AC_MSG_ERROR(Unable to find gs program!)
exit 1
fi
;;
x/*/gs) # Use /path/to/gs without any check:
CUPS_GHOSTSCRIPT="$with_pdftops"
AC_DEFINE(HAVE_GHOSTSCRIPT)
PDFTOPS="pdftops"
;;
xpdftops)
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
if test "x$CUPS_PDFTOPS" != x; then
AC_DEFINE(HAVE_PDFTOPS)
PDFTOPS="pdftops"
else
AC_MSG_ERROR(Unable to find pdftops program!)
exit 1
fi
;;
x/*/pdftops) # Use /path/to/pdftops without any check:
CUPS_PDFTOPS="$with_pdftops"
AC_DEFINE(HAVE_PDFTOPS)
PDFTOPS="pdftops"
;;
xnone) # Make no pdftops filter if with_pdftops=none:
;;
*) # Invalid with_pdftops value:
AC_MSG_ERROR(Invalid with_pdftops value!)
exit 1
;;
esac
AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS")
AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
AC_SUBST(PDFTOPS)
dnl
dnl End of "$Id: cups-pdf.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-pdf.m4 8760 2009-08-07 22:30:30Z mike $".
dnl
+2 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id$"
dnl "$Id: cups-poll.m4 8524 2009-04-19 21:18:45Z mike $"
dnl
dnl Select/poll stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -18,5 +18,5 @@ AC_CHECK_FUNC(epoll_create, AC_DEFINE(HAVE_EPOLL))
AC_CHECK_FUNC(kqueue, AC_DEFINE(HAVE_KQUEUE))
dnl
dnl End of "$Id$".
dnl End of "$Id: cups-poll.m4 8524 2009-04-19 21:18:45Z mike $".
dnl
+10 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-scripting.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-scripting.m4 7915 2008-09-07 22:18:29Z mike $"
dnl
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -51,8 +51,13 @@ AC_ARG_WITH(php, [ --with-php set PHP interpreter for web interfac
CUPS_PHP="")
if test "x$CUPS_PHP" = x; then
AC_PATH_PROG(PHP,php)
CUPS_PHP="$PHP"
AC_PATH_PROG(PHPCGI,php-cgi)
if test "x$PHPCGI" = x; then
AC_PATH_PROG(PHP,php)
CUPS_PHP="$PHP"
else
CUPS_PHP="$PHPCGI"
fi
fi
AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
@@ -91,5 +96,5 @@ if test "x$CUPS_PYTHON" != x; then
fi
dnl
dnl End of "$Id: cups-scripting.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-scripting.m4 7915 2008-09-07 22:18:29Z mike $".
dnl
+66 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-sharedlibs.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -16,70 +16,126 @@ dnl
PICFLAG=1
DSOFLAGS="${DSOFLAGS:=}"
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=yes])
AC_ARG_ENABLE(shared, [ --disable-shared do not create shared libraries])
if test x$enable_shared != xno; then
case "$uname" in
SunOS* | UNIX_S*)
SunOS*)
LIBCUPS="libcups.so.2"
LIBCUPSCGI="libcupscgi.so.1"
LIBCUPSDRIVER="libcupsdriver.so.1"
LIBCUPSIMAGE="libcupsimage.so.2"
LIBCUPSMIME="libcupsmime.so.1"
LIBCUPSPPDC="libcupsppdc.so.1"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
;;
UNIX_S*)
LIBCUPS="libcups.so.2"
LIBCUPSCGI="libcupscgi.so.1"
LIBCUPSDRIVER="libcupsdriver.so.1"
LIBCUPSIMAGE="libcupsimage.so.2"
LIBCUPSMIME="libcupsmime.so.1"
LIBCUPSPPDC="libcupsppdc.so.1"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -Wl,-h,\`basename \$@\` -G \$(OPTIM)"
;;
HP-UX*)
case "$uarch" in
ia64)
LIBCUPS="libcups.so.2"
LIBCUPSCGI="libcupscgi.so.1"
LIBCUPSDRIVER="libcupsdriver.so.1"
LIBCUPSIMAGE="libcupsimage.so.2"
LIBCUPSMIME="libcupsmime.so.1"
LIBCUPSPPDC="libcupsppdc.so.1"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -Wl,-b,-z,+h,\`basename \$@\`"
;;
*)
LIBCUPS="libcups.sl.2"
LIBCUPSCGI="libcupscgi.sl.1"
LIBCUPSDRIVER="libcupsdriver.sl.1"
LIBCUPSIMAGE="libcupsimage.sl.2"
LIBCUPSMIME="libcupsmime.sl.1"
LIBCUPSPPDC="libcupsppdc.sl.1"
DSO="\$(LD)"
DSOXX="\$(LD)"
DSOFLAGS="$DSOFLAGS -b -z +h \`basename \$@\`"
;;
esac
;;
IRIX)
LIBCUPS="libcups.so.2"
LIBCUPSCGI="libcupscgi.so.1"
LIBCUPSDRIVER="libcupsdriver.so.1"
LIBCUPSIMAGE="libcupsimage.so.2"
LIBCUPSMIME="libcupsmime.so.1"
LIBCUPSPPDC="libcupsppdc.so.1"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -set_version,sgi2.6,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
OSF1* | Linux | GNU | *BSD*)
LIBCUPS="libcups.so.2"
LIBCUPSCGI="libcupscgi.so.1"
LIBCUPSDRIVER="libcupsdriver.so.1"
LIBCUPSIMAGE="libcupsimage.so.2"
LIBCUPSMIME="libcupsmime.so.1"
LIBCUPSPPDC="libcupsppdc.so.1"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
Darwin*)
LIBCUPS="libcups.2.dylib"
LIBCUPSCGI="libcupscgi.1.dylib"
LIBCUPSDRIVER="libcupsdriver.1.dylib"
LIBCUPSIMAGE="libcupsimage.2.dylib"
LIBCUPSMIME="libcupsmime.1.dylib"
LIBCUPSPPDC="libcupsppdc.1.dylib"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
;;
AIX*)
LIBCUPS="libcups_s.a"
LIBCUPSCGI="libcupscgi_s.a"
LIBCUPSDRIVER="libcupsdriver_s.a"
LIBCUPSIMAGE="libcupsimage_s.a"
LIBCUPSMIME="libcupsmime_s.a"
LIBCUPSPPDC="libcupsppdc_s.a"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry,-blibpath:\$(libdir)"
;;
*)
echo "Warning: shared libraries may not be supported. Trying -shared"
echo " option with compiler."
LIBCUPS="libcups.so.2"
LIBCUPSCGI="libcupscgi.so.1"
LIBCUPSDRIVER="libcupsdriver.so.1"
LIBCUPSIMAGE="libcupsimage.so.2"
LIBCUPSMIME="libcupsmime.so.1"
LIBCUPSPPDC="libcupsppdc.so.1"
DSO="\$(CC)"
DSOXX="\$(CXX)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
;;
esac
else
PICFLAG=0
LIBCUPS="libcups.a"
LIBCUPSCGI="libcupscgi.a"
LIBCUPSDRIVER="libcupsdriver.a"
LIBCUPSIMAGE="libcupsimage.a"
LIBCUPSMIME="libcupsmime.a"
LIBCUPSPPDC="libcupsppdc.a"
DSO=":"
DSOXX=":"
fi
# 32-bit and 64-bit libraries need variations of the standard
@@ -88,11 +144,16 @@ DSO32FLAGS="$DSOFLAGS"
DSO64FLAGS="$DSOFLAGS"
AC_SUBST(DSO)
AC_SUBST(DSOXX)
AC_SUBST(DSOFLAGS)
AC_SUBST(DSO32FLAGS)
AC_SUBST(DSO64FLAGS)
AC_SUBST(LIBCUPS)
AC_SUBST(LIBCUPSCGI)
AC_SUBST(LIBCUPSDRIVER)
AC_SUBST(LIBCUPSIMAGE)
AC_SUBST(LIBCUPSMIME)
AC_SUBST(LIBCUPSPPDC)
if test x$enable_shared = xno; then
LINKCUPS="../cups/libcups.a"
@@ -183,5 +244,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+4 -5
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-slp.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-slp.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,13 +13,12 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(slp, [ --enable-slp turn on SLP support, default=yes])
AC_ARG_ENABLE(slp, [ --disable-slp disable SLP support])
AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(openslp-includes, [ --with-openslp-includes set directory for OpenSLP includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
LIBSLP=""
@@ -35,5 +34,5 @@ AC_SUBST(LIBSLP)
dnl
dnl End of "$Id: cups-slp.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-slp.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+8 -17
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ssl.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,7 +13,7 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
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])
AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
@@ -22,12 +22,10 @@ AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL l
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
SSLFLAGS=""
SSLLIBS=""
ENCRYPTION_REQUIRED=""
if test x$enable_ssl != xno; then
dnl Look for CDSA...
@@ -35,10 +33,6 @@ if test x$enable_ssl != xno; then
if test $uname = Darwin; then
AC_CHECK_HEADER(Security/SecureTransport.h, [
SSLLIBS="-framework CoreFoundation -framework Security"
# MacOS X doesn't (yet) come with pre-installed encryption
# certificates for CUPS, so don't enable encryption on
# /admin just yet...
#ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_CDSASSL)
@@ -64,12 +58,11 @@ if test x$enable_ssl != xno; then
fi
dnl Then look for GNU TLS...
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
if test "x$LIBGNUTLSCONFIG" != x; then
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
ENCRYPTION_REQUIRED=" Encryption Required"
if $PKGCONFIG --exists gnutls; then
SSLLIBS=`$PKGCONFIG --libs gnutls`
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
fi
@@ -96,7 +89,6 @@ if test x$enable_ssl != xno; then
AC_CHECK_LIB(ssl,SSL_new,
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
SSLLIBS="-lssl $libcrypto"
ENCRYPTION_REQUIRED=" Encryption Required"
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_LIBSSL)],,
$libcrypto)
@@ -117,12 +109,11 @@ fi
AC_SUBST(SSLFLAGS)
AC_SUBST(SSLLIBS)
AC_SUBST(ENCRYPTION_REQUIRED)
EXPORT_SSLLIBS="$SSLLIBS"
AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $"
dnl "$Id: cups-threads.m4 8344 2009-02-10 17:05:35Z mike $"
dnl
dnl Threading stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2007-2009 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -13,7 +13,7 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
AC_ARG_ENABLE(threads, [ --disable-threads disable multi-threading support])
have_pthread=no
PTHREAD_FLAGS=""
@@ -50,5 +50,5 @@ fi
AC_SUBST(PTHREAD_FLAGS)
dnl
dnl End of "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $".
dnl End of "$Id: cups-threads.m4 8344 2009-02-10 17:05:35Z mike $".
dnl
+114 -32
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -31,7 +31,7 @@
#define CUPS_DEFAULT_USER "lp"
#define CUPS_DEFAULT_GROUP "sys"
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
#define CUPS_DEFAULT_PRINTADMIN_AUTH "@SYSTEM"
#define CUPS_DEFAULT_PRINTOPERATOR_AUTH "@SYSTEM"
/*
@@ -42,6 +42,21 @@
#define CUPS_DEFAULT_LOG_FILE_PERM 0644
/*
* Default logging settings...
*/
#define CUPS_DEFAULT_LOG_LEVEL "warn"
#define CUPS_DEFAULT_ACCESS_LOG_LEVEL "actions"
/*
* Default fatal error settings...
*/
#define CUPS_DEFAULT_FATAL_ERRORS "config"
/*
* Default browsing settings...
*/
@@ -69,6 +84,14 @@
#define CUPS_DEFAULT_PRINTCAP "/etc/printcap"
/*
* Default Samba and LPD config files...
*/
#define CUPS_DEFAULT_SMB_CONFIG_FILE ""
#define CUPS_DEFAULT_LPD_CONFIG_FILE ""
/*
* Default MaxCopies value...
*/
@@ -76,13 +99,6 @@
#define CUPS_DEFAULT_MAX_COPIES 100
/*
* Maximum number of file descriptors to support.
*/
#define CUPS_MAX_FDS 4096
/*
* Do we have domain socket support?
*/
@@ -130,6 +146,8 @@
#endif /* !HAVE_LIBPAM */
#undef HAVE_PAM_PAM_APPL_H
#undef HAVE_PAM_SET_ITEM
#undef HAVE_PAM_SETCRED
/*
@@ -297,6 +315,10 @@
#undef HAVE_LDAP
#undef HAVE_OPENLDAP
#undef HAVE_MOZILLA_LDAP
#undef HAVE_LDAP_SSL_H
#undef HAVE_LDAP_SSL
#undef HAVE_LDAP_REBIND_PROC
/*
@@ -313,14 +335,6 @@
#undef HAVE_DNSSD
/*
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
*/
#undef HAVE_COREFOUNDATION
#undef HAVE_SYSTEMCONFIGURATION
/*
* Do we have <sys/ioctl.h>?
*/
@@ -328,14 +342,6 @@
#undef HAVE_SYS_IOCTL_H
/*
* Do we have mkstemp() and/or mkstemps()?
*/
#undef HAVE_MKSTEMP
#undef HAVE_MKSTEMPS
/*
* Does the "tm" structure contain the "tm_gmtoff" member?
*/
@@ -378,6 +384,20 @@
#undef HAVE_HSTRERROR
/*
* Do we have res_init()?
*/
#undef HAVE_RES_INIT
/*
* Do we have <resolv.h>
*/
#undef HAVE_RESOLV_H
/*
* Do we have the <sys/sockio.h> header file?
*/
@@ -398,6 +418,7 @@
#undef HAVE_USERSEC_H
/*
* Do we have pthread support?
*/
@@ -428,6 +449,22 @@
#define CUPS_PYTHON "/usr/bin/python"
/*
* Location of the poppler/Xpdf pdftops program...
*/
#undef HAVE_PDFTOPS
#define CUPS_PDFTOPS "/usr/bin/pdftops"
/*
* Location of the Ghostscript gs program...
*/
#undef HAVE_GHOSTSCRIPT
#define CUPS_GHOSTSCRIPT "/usr/bin/gs"
/*
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
*/
@@ -445,13 +482,6 @@
#undef HAVE_CFBUNDLEPRIV_H
/*
* Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
*/
#undef HAVE_CF_LOCALE_ID
/*
* Do we have MacOSX 10.4's mbr_XXX functions()?
*/
@@ -496,6 +526,7 @@
#undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY
#undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
#undef HAVE_KRB5_CC_NEW_UNIQUE
#undef HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID
#undef HAVE_KRB5_H
#undef HAVE_HEIMDAL
@@ -544,6 +575,57 @@
#undef HAVE_REMOVEFILE
/*
* Do we have <sandbox.h>?
*/
#undef HAVE_SANDBOX_H
/*
* Which random number generator function to use...
*/
#undef HAVE_ARC4RANDOM
#undef HAVE_RANDOM
#undef HAVE_LRAND48
#ifdef HAVE_ARC4RANDOM
# define CUPS_RAND() arc4random()
# define CUPS_SRAND(v) arc4random_stir()
#elif defined(HAVE_RANDOM)
# define CUPS_RAND() random()
# define CUPS_SRAND(v) srandom(v)
#elif defined(HAVE_LRAND48)
# define CUPS_RAND() lrand48()
# define CUPS_SRAND(v) srand48(v)
#else
# define CUPS_RAND() rand()
# define CUPS_SRAND(v) srand(v)
#endif /* HAVE_ARC4RANDOM */
/*
* Do we have vproc_transaction_begin/end?
*/
#undef HAVE_VPROC_TRANSACTION_BEGIN
/*
* Do we have libusb?
*/
#undef HAVE_USB_H
/*
* Do we have libwrap and tcpd.h?
*/
#undef HAVE_TCPD_H
#endif /* !_CUPS_CONFIG_H_ */
/*
+4 -2
Ver Arquivo
@@ -64,11 +64,13 @@ AC_SUBST(UNINSTALL_LANGUAGES)
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
data/testprint
desktop/cups.desktop
doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html
init/org.cups.cups-lpd.plist
init/org.cups.cups-lpd.plist init/cups.xml
man/client.conf.man man/cups-deviced.man man/cups-driverd.man
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
man/cupsd.conf.man man/lpoptions.man
man/cupsd.conf.man man/drv.man man/lpoptions.man
templates/header.tmpl
$LANGFILES)
+26 -12
Ver Arquivo
@@ -4,7 +4,7 @@
#
# CUPS configuration utility.
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2008 by Apple Inc.
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,7 +15,8 @@
#
VERSION="@CUPS_VERSION@"
APIVERSION="1.3"
APIVERSION="1.4"
BUILD="@CUPS_BUILD@"
prefix=@prefix@
exec_prefix=@exec_prefix@
@@ -62,11 +63,12 @@ fi
usage ()
{
echo "Usage: cups-config --api-version"
echo " cups-config --build"
echo " cups-config --cflags"
echo " cups-config --datadir"
echo " cups-config --help"
echo " cups-config --ldflags"
echo " cups-config [--image] [--static] --libs"
echo " cups-config [--driver] [--image] [--static] --libs"
echo " cups-config --serverbin"
echo " cups-config --serverroot"
echo " cups-config --version"
@@ -81,18 +83,25 @@ fi
# Parse command line options
static=no
image=no
driver=no
while test $# -gt 0; do
case $1 in
--api-version)
echo $APIVERSION
;;
--build)
echo $BUILD
;;
--cflags)
echo $CFLAGS
;;
--datadir)
echo $cups_datadir
;;
--driver)
driver=yes
;;
--help)
usage 0
;;
@@ -104,18 +113,23 @@ while test $# -gt 0; do
;;
--libs)
if test $static = no; then
if test $image = no; then
echo -lcups $LIBS
else
echo -lcupsimage -lcups $IMGLIBS $LIBS
fi
libs="-lcups $LIBS";
if test $image = yes; then
libs="-lcupsimage $libs"
fi
if test $driver = yes; then
libs="-lcupsdriver $libs"
fi
else
if test $image = no; then
echo $libdir/libcups.a $LIBS
else
echo $imagelibdir/libcupsimage.a $libdir/libcups.a $IMGLIBS $LIBS
libs="$libdir/libcups.a $LIBS";
if test $image = yes; then
libs="$libdir/libcupsimage.a $IMGLIBS $libs"
fi
if test $driver = yes; then
libs="$libdir/libcupsdriver.a $libs"
fi
fi
echo $libs
;;
--serverbin)
echo $cups_serverbin
+396 -324
Ver Arquivo
@@ -1,324 +1,396 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
adminutil.o: adminutil.c adminutil.h cups.h ipp.h http.h string.h \
../config.h ppd.h array.h file.h language.h globals.h string.h \
http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
array.o: array.c array.h string.h ../config.h string.h debug.h
attr.o: attr.c ppd.h array.h file.h debug.h string.h ../config.h string.h
auth.o: auth.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
backchannel.o: backchannel.c cups.h ipp.h http.h string.h ../config.h \
ppd.h array.h file.h language.h
backend.o: backend.c backend.h string.h ../config.h string.h
custom.o: custom.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
dest.o: dest.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h
dir.o: dir.c dir.h string.h ../config.h string.h debug.h
emit.o: emit.c ppd.h array.h file.h string.h ../config.h string.h debug.h
encode.o: encode.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \
file.h language.h ipp-private.h string.h debug.h
file.o: file.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
getifaddrs.o: getifaddrs.c http-private.h ../config.h http.h string.h \
md5.h ipp-private.h ipp.h
getputfile.o: getputfile.c http-private.h ../config.h http.h string.h \
md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
string.h debug.h
globals.o: globals.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
http.o: http.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
http-addr.o: http-addr.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
http-addrlist.o: http-addrlist.c http-private.h ../config.h http.h \
string.h md5.h ipp-private.h ipp.h globals.h string.h cups.h ppd.h \
array.h file.h language.h i18n.h transcode.h debug.h
http-support.o: http-support.c debug.h globals.h string.h ../config.h \
string.h http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h \
array.h file.h language.h i18n.h transcode.h
ipp.o: ipp.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
ipp-support.o: ipp-support.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
langprintf.o: langprintf.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h
language.o: language.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
localize.o: localize.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
mark.o: mark.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \
file.h language.h string.h debug.h
md5.o: md5.c md5.h string.h ../config.h string.h
md5passwd.o: md5passwd.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h string.h
notify.o: notify.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h
options.o: options.c cups.h ipp.h http.h string.h ../config.h ppd.h \
array.h file.h language.h string.h debug.h
page.o: page.c ppd.h array.h file.h string.h ../config.h string.h
ppd.o: ppd.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
request.o: request.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
sidechannel.o: sidechannel.c sidechannel.h string.h ../config.h string.h
snprintf.o: snprintf.c string.h ../config.h string.h
string.o: string.c array.h debug.h string.h ../config.h string.h
tempfile.o: tempfile.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
transcode.o: transcode.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
usersys.o: usersys.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
util.o: util.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
testadmin.o: testadmin.c adminutil.h cups.h ipp.h http.h string.h \
../config.h ppd.h array.h file.h language.h string.h
testarray.o: testarray.c ../cups/string.h ../config.h string.h array.h \
dir.h debug.h
testcups.o: testcups.c cups.h ipp.h http.h string.h ../config.h ppd.h \
array.h file.h language.h
testfile.o: testfile.c string.h ../config.h string.h file.h debug.h
testhttp.o: testhttp.c http.h string.h ../config.h string.h
testi18n.o: testi18n.c i18n.h transcode.h language.h array.h string.h \
../config.h string.h
testipp.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h \
ipp.h http.h
testlang.o: testlang.c i18n.h transcode.h language.h array.h string.h \
../config.h string.h
testppd.o: testppd.c ../cups/string.h ../config.h string.h ppd.h array.h \
file.h
# DO NOT DELETE THIS LINE -- make depend depends on it.
adminutil.32.o: adminutil.c adminutil.c adminutil.h cups.h ipp.h http.h string.h \
../config.h ppd.h array.h file.h language.h globals.h string.h \
http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
array.32.o: array.c array.c array.h string.h ../config.h string.h debug.h
attr.32.o: attr.c attr.c ppd.h array.h file.h debug.h string.h ../config.h string.h
auth.32.o: auth.c auth.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
backchannel.32.o: backchannel.c backchannel.c cups.h ipp.h http.h string.h ../config.h \
ppd.h array.h file.h language.h
backend.32.o: backend.c backend.c backend.h string.h ../config.h string.h
custom.32.o: custom.c custom.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
dest.32.o: dest.c dest.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h
dir.32.o: dir.c dir.c dir.h string.h ../config.h string.h debug.h
emit.32.o: emit.c emit.c ppd.h array.h file.h string.h ../config.h string.h debug.h
encode.32.o: encode.c encode.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \
file.h language.h ipp-private.h string.h debug.h
file.32.o: file.c file.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
getifaddrs.32.o: getifaddrs.c getifaddrs.c http-private.h ../config.h http.h string.h \
md5.h ipp-private.h ipp.h
getputfile.32.o: getputfile.c getputfile.c http-private.h ../config.h http.h string.h \
md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
string.h debug.h
globals.32.o: globals.c globals.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
http.32.o: http.c http.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
http-addr.32.o: http-addr.c http-addr.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
http-addrlist.32.o: http-addrlist.c http-addrlist.c http-private.h ../config.h http.h \
string.h md5.h ipp-private.h ipp.h globals.h string.h cups.h ppd.h \
array.h file.h language.h i18n.h transcode.h debug.h
http-support.32.o: http-support.c http-support.c debug.h globals.h string.h ../config.h \
string.h http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h \
array.h file.h language.h i18n.h transcode.h
ipp.32.o: ipp.c ipp.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
ipp-support.32.o: ipp-support.c ipp-support.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
langprintf.32.o: langprintf.c langprintf.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h
language.32.o: language.c language.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
localize.32.o: localize.c localize.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
mark.32.o: mark.c mark.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \
file.h language.h string.h debug.h
md5.32.o: md5.c md5.c md5.h string.h ../config.h string.h
md5passwd.32.o: md5passwd.c md5passwd.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h string.h
notify.32.o: notify.c notify.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h
options.32.o: options.c options.c cups.h ipp.h http.h string.h ../config.h ppd.h \
array.h file.h language.h string.h debug.h
page.32.o: page.c page.c ppd.h array.h file.h string.h ../config.h string.h
ppd.32.o: ppd.c ppd.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
request.32.o: request.c request.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
sidechannel.32.o: sidechannel.c sidechannel.c sidechannel.h string.h ../config.h string.h
snprintf.32.o: snprintf.c snprintf.c string.h ../config.h string.h
string.32.o: string.c string.c array.h debug.h string.h ../config.h string.h
tempfile.32.o: tempfile.c tempfile.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
transcode.32.o: transcode.c transcode.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
usersys.32.o: usersys.c usersys.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
util.32.o: util.c util.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
testadmin.32.o: testadmin.c testadmin.c adminutil.h cups.h ipp.h http.h string.h \
../config.h ppd.h array.h file.h language.h string.h
testarray.32.o: testarray.c testarray.c ../cups/string.h ../config.h string.h array.h \
dir.h debug.h
testcups.32.o: testcups.c testcups.c cups.h ipp.h http.h string.h ../config.h ppd.h \
array.h file.h language.h
testfile.32.o: testfile.c testfile.c string.h ../config.h string.h file.h debug.h
testhttp.32.o: testhttp.c testhttp.c http.h string.h ../config.h string.h
testi18n.32.o: testi18n.c testi18n.c i18n.h transcode.h language.h array.h string.h \
../config.h string.h
testipp.32.o: testipp.c testipp.c ../cups/string.h ../config.h string.h ipp-private.h \
ipp.h http.h
testlang.32.o: testlang.c testlang.c i18n.h transcode.h language.h array.h string.h \
../config.h string.h
testppd.32.o: testppd.c testppd.c ../cups/string.h ../config.h string.h ppd.h array.h \
file.h
# DO NOT DELETE THIS LINE -- make depend depends on it.
adminutil.64.o: adminutil.c adminutil.c adminutil.h cups.h ipp.h http.h string.h \
../config.h ppd.h array.h file.h language.h globals.h string.h \
http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
array.64.o: array.c array.c array.h string.h ../config.h string.h debug.h
attr.64.o: attr.c attr.c ppd.h array.h file.h debug.h string.h ../config.h string.h
auth.64.o: auth.c auth.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
backchannel.64.o: backchannel.c backchannel.c cups.h ipp.h http.h string.h ../config.h \
ppd.h array.h file.h language.h
backend.64.o: backend.c backend.c backend.h string.h ../config.h string.h
custom.64.o: custom.c custom.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
dest.64.o: dest.c dest.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h
dir.64.o: dir.c dir.c dir.h string.h ../config.h string.h debug.h
emit.64.o: emit.c emit.c ppd.h array.h file.h string.h ../config.h string.h debug.h
encode.64.o: encode.c encode.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \
file.h language.h ipp-private.h string.h debug.h
file.64.o: file.c file.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
getifaddrs.64.o: getifaddrs.c getifaddrs.c http-private.h ../config.h http.h string.h \
md5.h ipp-private.h ipp.h
getputfile.64.o: getputfile.c getputfile.c http-private.h ../config.h http.h string.h \
md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
string.h debug.h
globals.64.o: globals.c globals.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
http.64.o: http.c http.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
http-addr.64.o: http-addr.c http-addr.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
http-addrlist.64.o: http-addrlist.c http-addrlist.c http-private.h ../config.h http.h \
string.h md5.h ipp-private.h ipp.h globals.h string.h cups.h ppd.h \
array.h file.h language.h i18n.h transcode.h debug.h
http-support.64.o: http-support.c http-support.c debug.h globals.h string.h ../config.h \
string.h http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h \
array.h file.h language.h i18n.h transcode.h
ipp.64.o: ipp.c ipp.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
ipp-support.64.o: ipp-support.c ipp-support.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
langprintf.64.o: langprintf.c langprintf.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h
language.64.o: language.c language.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
localize.64.o: localize.c localize.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
mark.64.o: mark.c mark.c cups.h ipp.h http.h string.h ../config.h ppd.h array.h \
file.h language.h string.h debug.h
md5.64.o: md5.c md5.c md5.h string.h ../config.h string.h
md5passwd.64.o: md5passwd.c md5passwd.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h string.h
notify.64.o: notify.c notify.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h
options.64.o: options.c options.c cups.h ipp.h http.h string.h ../config.h ppd.h \
array.h file.h language.h string.h debug.h
page.64.o: page.c page.c ppd.h array.h file.h string.h ../config.h string.h
ppd.64.o: ppd.c ppd.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
request.64.o: request.c request.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
sidechannel.64.o: sidechannel.c sidechannel.c sidechannel.h string.h ../config.h string.h
snprintf.64.o: snprintf.c snprintf.c string.h ../config.h string.h
string.64.o: string.c string.c array.h debug.h string.h ../config.h string.h
tempfile.64.o: tempfile.c tempfile.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
transcode.64.o: transcode.c transcode.c globals.h string.h ../config.h string.h \
http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h \
file.h language.h i18n.h transcode.h debug.h
usersys.64.o: usersys.c usersys.c http-private.h ../config.h http.h string.h md5.h \
ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h \
language.h i18n.h transcode.h debug.h
util.64.o: util.c util.c globals.h string.h ../config.h string.h http-private.h \
http.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h \
i18n.h transcode.h debug.h
testadmin.64.o: testadmin.c testadmin.c adminutil.h cups.h ipp.h http.h string.h \
../config.h ppd.h array.h file.h language.h string.h
testarray.64.o: testarray.c testarray.c ../cups/string.h ../config.h string.h array.h \
dir.h debug.h
testcups.64.o: testcups.c testcups.c cups.h ipp.h http.h string.h ../config.h ppd.h \
array.h file.h language.h
testfile.64.o: testfile.c testfile.c string.h ../config.h string.h file.h debug.h
testhttp.64.o: testhttp.c testhttp.c http.h string.h ../config.h string.h
testi18n.64.o: testi18n.c testi18n.c i18n.h transcode.h language.h array.h string.h \
../config.h string.h
testipp.64.o: testipp.c testipp.c ../cups/string.h ../config.h string.h ipp-private.h \
ipp.h http.h
testlang.64.o: testlang.c testlang.c i18n.h transcode.h language.h array.h string.h \
../config.h string.h
testppd.64.o: testppd.c testppd.c ../cups/string.h ../config.h string.h ppd.h array.h \
file.h
# DO NOT DELETE
adminutil.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
adminutil.o: file.h language.h globals.h string.h ../config.h http-private.h
adminutil.o: md5.h ipp-private.h i18n.h transcode.h debug.h
array.o: array.h versioning.h string.h ../config.h debug.h
attr.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
attr.o: language.h debug.h string.h ../config.h
auth.o: globals.h string.h ../config.h http-private.h http.h versioning.h
auth.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
auth.o: i18n.h transcode.h debug.h
backchannel.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
backchannel.o: language.h
backend.o: backend.h versioning.h globals.h string.h ../config.h
backend.o: http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
backend.o: array.h file.h language.h i18n.h transcode.h
conflicts.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
conflicts.o: file.h language.h string.h ../config.h debug.h
custom.o: globals.h string.h ../config.h http-private.h http.h versioning.h
custom.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
custom.o: i18n.h transcode.h debug.h
debug.o: globals.h string.h ../config.h http-private.h http.h versioning.h
debug.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
debug.o: i18n.h transcode.h debug.h
dest.o: debug.h globals.h string.h ../config.h http-private.h http.h
dest.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
dest.o: language.h i18n.h transcode.h pwgmedia.h
dir.o: dir.h versioning.h string.h ../config.h debug.h
emit.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
encode.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
encode.o: ipp-private.h string.h ../config.h debug.h
file.o: file-private.h http-private.h ../config.h http.h versioning.h md5.h
file.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
file.o: language.h i18n.h transcode.h debug.h
getdevices.o: globals.h string.h ../config.h http-private.h http.h
getdevices.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getdevices.o: file.h language.h i18n.h transcode.h debug.h
getifaddrs.o: http-private.h ../config.h http.h versioning.h md5.h
getifaddrs.o: ipp-private.h ipp.h
getputfile.o: globals.h string.h ../config.h http-private.h http.h
getputfile.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getputfile.o: file.h language.h i18n.h transcode.h debug.h
globals.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
globals.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
globals.o: i18n.h transcode.h
http.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.o: i18n.h transcode.h debug.h
http-addr.o: http-private.h ../config.h http.h versioning.h md5.h
http-addr.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.o: file.h language.h i18n.h transcode.h debug.h
http-addrlist.o: http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addrlist.o: file.h language.h i18n.h transcode.h debug.h
http-support.o: debug.h globals.h string.h ../config.h http-private.h http.h
http-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
http-support.o: file.h language.h i18n.h transcode.h
ipp.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
ipp.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
ipp.o: transcode.h debug.h
ipp-support.o: globals.h string.h ../config.h http-private.h http.h
ipp-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
ipp-support.o: file.h language.h i18n.h transcode.h debug.h
langprintf.o: globals.h string.h ../config.h http-private.h http.h
langprintf.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
langprintf.o: file.h language.h i18n.h transcode.h
language.o: globals.h string.h ../config.h http-private.h http.h versioning.h
language.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
language.o: i18n.h transcode.h debug.h
localize.o: globals.h string.h ../config.h http-private.h http.h versioning.h
localize.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
localize.o: i18n.h transcode.h ppd-private.h debug.h
mark.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
mark.o: string.h ../config.h debug.h pwgmedia.h
md5.o: md5.h string.h ../config.h
md5passwd.o: http-private.h ../config.h http.h versioning.h md5.h
md5passwd.o: ipp-private.h ipp.h string.h
notify.o: globals.h string.h ../config.h http-private.h http.h versioning.h
notify.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
notify.o: i18n.h transcode.h
options.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
options.o: string.h ../config.h debug.h
page.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
ppd.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
ppd.o: language.h globals.h string.h ../config.h http-private.h md5.h
ppd.o: ipp-private.h i18n.h transcode.h debug.h
pwgmedia.o: pwgmedia.h globals.h string.h ../config.h http-private.h http.h
pwgmedia.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
pwgmedia.o: file.h language.h i18n.h transcode.h debug.h
request.o: globals.h string.h ../config.h http-private.h http.h versioning.h
request.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
request.o: i18n.h transcode.h debug.h
sidechannel.o: sidechannel.h versioning.h string.h ../config.h debug.h
snmp.o: globals.h string.h ../config.h http-private.h http.h versioning.h
snmp.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
snmp.o: i18n.h transcode.h debug.h snmp-private.h
snprintf.o: string.h ../config.h
string.o: array.h versioning.h debug.h string.h ../config.h
tempfile.o: globals.h string.h ../config.h http-private.h http.h versioning.h
tempfile.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
tempfile.o: i18n.h transcode.h debug.h
transcode.o: globals.h string.h ../config.h http-private.h http.h
transcode.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
transcode.o: file.h language.h i18n.h transcode.h debug.h
usersys.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
usersys.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
usersys.o: i18n.h transcode.h debug.h
util.o: globals.h string.h ../config.h http-private.h http.h versioning.h
util.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
util.o: i18n.h transcode.h debug.h
testadmin.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
testadmin.o: file.h language.h string.h ../config.h
testarray.o: ../cups/string.h ../config.h string.h array.h versioning.h dir.h
testarray.o: debug.h
testconflicts.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
testconflicts.o: language.h string.h ../config.h
testcups.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testcups.o: string.h ../config.h
testfile.o: string.h ../config.h file.h versioning.h debug.h
testhttp.o: http-private.h ../config.h http.h versioning.h md5.h
testhttp.o: ipp-private.h ipp.h string.h
testi18n.o: i18n.h transcode.h language.h array.h versioning.h string.h
testi18n.o: ../config.h
testipp.o: ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h
testipp.o: versioning.h
testoptions.o: string.h ../config.h cups.h ipp.h http.h versioning.h ppd.h
testoptions.o: array.h file.h language.h
testlang.o: i18n.h transcode.h language.h array.h versioning.h string.h
testlang.o: ../config.h
testppd.o: ../cups/string.h ../config.h string.h cups.h ipp.h http.h
testppd.o: versioning.h ppd.h array.h file.h language.h pwgmedia.h
testsnmp.o: string.h ../config.h snmp-private.h http.h versioning.h
# DO NOT DELETE
adminutil.32.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
adminutil.32.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h
adminutil.32.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h
array.32.o: array.c array.h versioning.h string.h ../config.h debug.h
attr.32.o: attr.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
attr.32.o: attr.c language.h debug.h string.h ../config.h
auth.32.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h
auth.32.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
auth.32.o: auth.c i18n.h transcode.h debug.h
backchannel.32.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
backchannel.32.o: backchannel.c language.h
backend.32.o: backend.c backend.h versioning.h globals.h string.h ../config.h
backend.32.o: backend.c http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
backend.32.o: backend.c array.h file.h language.h i18n.h transcode.h
conflicts.32.o: conflicts.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
conflicts.32.o: conflicts.c file.h language.h string.h ../config.h debug.h
custom.32.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h
custom.32.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
custom.32.o: custom.c i18n.h transcode.h debug.h
debug.32.o: debug.c globals.h string.h ../config.h http-private.h http.h versioning.h
debug.32.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
debug.32.o: debug.c i18n.h transcode.h debug.h
dest.32.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
dest.32.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
dest.32.o: dest.c language.h i18n.h transcode.h pwgmedia.h
dir.32.o: dir.c dir.h versioning.h string.h ../config.h debug.h
emit.32.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
encode.32.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h
file.32.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
file.32.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
file.32.o: file.c language.h i18n.h transcode.h debug.h
getdevices.32.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
getdevices.32.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getdevices.32.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
getifaddrs.32.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h
getifaddrs.32.o: getifaddrs.c ipp-private.h ipp.h
getputfile.32.o: getputfile.c globals.h string.h ../config.h http-private.h http.h
getputfile.32.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getputfile.32.o: getputfile.c file.h language.h i18n.h transcode.h debug.h
globals.32.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
globals.32.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
globals.32.o: globals.c i18n.h transcode.h
http.32.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.32.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.32.o: http.c i18n.h transcode.h debug.h
http-addr.32.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
http-addr.32.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
http-addrlist.32.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.32.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addrlist.32.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h
http-support.32.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
http-support.32.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
http-support.32.o: http-support.c file.h language.h i18n.h transcode.h
ipp.32.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
ipp.32.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
ipp.32.o: ipp.c transcode.h debug.h
ipp-support.32.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h
ipp-support.32.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
ipp-support.32.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h
langprintf.32.o: langprintf.c globals.h string.h ../config.h http-private.h http.h
langprintf.32.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
langprintf.32.o: langprintf.c file.h language.h i18n.h transcode.h
language.32.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h
language.32.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
language.32.o: language.c i18n.h transcode.h debug.h
localize.32.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h
localize.32.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
localize.32.o: localize.c i18n.h transcode.h ppd-private.h debug.h
mark.32.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
mark.32.o: mark.c string.h ../config.h debug.h pwgmedia.h
md5.32.o: md5.c md5.h string.h ../config.h
md5passwd.32.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
md5passwd.32.o: md5passwd.c ipp-private.h ipp.h string.h
notify.32.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h
notify.32.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
notify.32.o: notify.c i18n.h transcode.h
options.32.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
options.32.o: options.c string.h ../config.h debug.h
page.32.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
ppd.32.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
ppd.32.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
ppd.32.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
pwgmedia.32.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
pwgmedia.32.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
pwgmedia.32.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
request.32.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
request.32.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
request.32.o: request.c i18n.h transcode.h debug.h
sidechannel.32.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h debug.h
snmp.32.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h
snmp.32.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
snmp.32.o: snmp.c i18n.h transcode.h debug.h snmp-private.h
snprintf.32.o: snprintf.c string.h ../config.h
string.32.o: string.c array.h versioning.h debug.h string.h ../config.h
tempfile.32.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h
tempfile.32.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
tempfile.32.o: tempfile.c i18n.h transcode.h debug.h
transcode.32.o: transcode.c globals.h string.h ../config.h http-private.h http.h
transcode.32.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
transcode.32.o: transcode.c file.h language.h i18n.h transcode.h debug.h
usersys.32.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
usersys.32.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
usersys.32.o: usersys.c i18n.h transcode.h debug.h
util.32.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h
util.32.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
util.32.o: util.c i18n.h transcode.h debug.h
testadmin.32.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
testadmin.32.o: testadmin.c file.h language.h string.h ../config.h
testarray.32.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
testarray.32.o: testarray.c debug.h
testconflicts.32.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
testconflicts.32.o: testconflicts.c language.h string.h ../config.h
testcups.32.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testcups.32.o: testcups.c string.h ../config.h
testfile.32.o: testfile.c string.h ../config.h file.h versioning.h debug.h
testhttp.32.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
testhttp.32.o: testhttp.c ipp-private.h ipp.h string.h
testi18n.32.o: testi18n.c i18n.h transcode.h language.h array.h versioning.h string.h
testi18n.32.o: testi18n.c ../config.h
testipp.32.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h
testipp.32.o: testipp.c versioning.h
testoptions.32.o: testoptions.c string.h ../config.h cups.h ipp.h http.h versioning.h ppd.h
testoptions.32.o: testoptions.c array.h file.h language.h
testlang.32.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
testlang.32.o: testlang.c ../config.h
testppd.32.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
testppd.32.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
testsnmp.32.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
# DO NOT DELETE
adminutil.64.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
adminutil.64.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h
adminutil.64.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h
array.64.o: array.c array.h versioning.h string.h ../config.h debug.h
attr.64.o: attr.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
attr.64.o: attr.c language.h debug.h string.h ../config.h
auth.64.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h
auth.64.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
auth.64.o: auth.c i18n.h transcode.h debug.h
backchannel.64.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
backchannel.64.o: backchannel.c language.h
backend.64.o: backend.c backend.h versioning.h globals.h string.h ../config.h
backend.64.o: backend.c http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
backend.64.o: backend.c array.h file.h language.h i18n.h transcode.h
conflicts.64.o: conflicts.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
conflicts.64.o: conflicts.c file.h language.h string.h ../config.h debug.h
custom.64.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h
custom.64.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
custom.64.o: custom.c i18n.h transcode.h debug.h
debug.64.o: debug.c globals.h string.h ../config.h http-private.h http.h versioning.h
debug.64.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
debug.64.o: debug.c i18n.h transcode.h debug.h
dest.64.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
dest.64.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
dest.64.o: dest.c language.h i18n.h transcode.h pwgmedia.h
dir.64.o: dir.c dir.h versioning.h string.h ../config.h debug.h
emit.64.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
encode.64.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h
file.64.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
file.64.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
file.64.o: file.c language.h i18n.h transcode.h debug.h
getdevices.64.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
getdevices.64.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getdevices.64.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
getifaddrs.64.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h
getifaddrs.64.o: getifaddrs.c ipp-private.h ipp.h
getputfile.64.o: getputfile.c globals.h string.h ../config.h http-private.h http.h
getputfile.64.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
getputfile.64.o: getputfile.c file.h language.h i18n.h transcode.h debug.h
globals.64.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
globals.64.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
globals.64.o: globals.c i18n.h transcode.h
http.64.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.64.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.64.o: http.c i18n.h transcode.h debug.h
http-addr.64.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
http-addr.64.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
http-addrlist.64.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.64.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addrlist.64.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h
http-support.64.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
http-support.64.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
http-support.64.o: http-support.c file.h language.h i18n.h transcode.h
ipp.64.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
ipp.64.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
ipp.64.o: ipp.c transcode.h debug.h
ipp-support.64.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h
ipp-support.64.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
ipp-support.64.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h
langprintf.64.o: langprintf.c globals.h string.h ../config.h http-private.h http.h
langprintf.64.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
langprintf.64.o: langprintf.c file.h language.h i18n.h transcode.h
language.64.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h
language.64.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
language.64.o: language.c i18n.h transcode.h debug.h
localize.64.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h
localize.64.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
localize.64.o: localize.c i18n.h transcode.h ppd-private.h debug.h
mark.64.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
mark.64.o: mark.c string.h ../config.h debug.h pwgmedia.h
md5.64.o: md5.c md5.h string.h ../config.h
md5passwd.64.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
md5passwd.64.o: md5passwd.c ipp-private.h ipp.h string.h
notify.64.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h
notify.64.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
notify.64.o: notify.c i18n.h transcode.h
options.64.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
options.64.o: options.c string.h ../config.h debug.h
page.64.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
ppd.64.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
ppd.64.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
ppd.64.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
pwgmedia.64.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
pwgmedia.64.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
pwgmedia.64.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
request.64.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
request.64.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
request.64.o: request.c i18n.h transcode.h debug.h
sidechannel.64.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h debug.h
snmp.64.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h
snmp.64.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
snmp.64.o: snmp.c i18n.h transcode.h debug.h snmp-private.h
snprintf.64.o: snprintf.c string.h ../config.h
string.64.o: string.c array.h versioning.h debug.h string.h ../config.h
tempfile.64.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h
tempfile.64.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
tempfile.64.o: tempfile.c i18n.h transcode.h debug.h
transcode.64.o: transcode.c globals.h string.h ../config.h http-private.h http.h
transcode.64.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
transcode.64.o: transcode.c file.h language.h i18n.h transcode.h debug.h
usersys.64.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
usersys.64.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
usersys.64.o: usersys.c i18n.h transcode.h debug.h
util.64.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h
util.64.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
util.64.o: util.c i18n.h transcode.h debug.h
testadmin.64.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
testadmin.64.o: testadmin.c file.h language.h string.h ../config.h
testarray.64.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
testarray.64.o: testarray.c debug.h
testconflicts.64.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
testconflicts.64.o: testconflicts.c language.h string.h ../config.h
testcups.64.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testcups.64.o: testcups.c string.h ../config.h
testfile.64.o: testfile.c string.h ../config.h file.h versioning.h debug.h
testhttp.64.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
testhttp.64.o: testhttp.c ipp-private.h ipp.h string.h
testi18n.64.o: testi18n.c i18n.h transcode.h language.h array.h versioning.h string.h
testi18n.64.o: testi18n.c ../config.h
testipp.64.o: testipp.c ../cups/string.h ../config.h string.h ipp-private.h ipp.h http.h
testipp.64.o: testipp.c versioning.h
testoptions.64.o: testoptions.c string.h ../config.h cups.h ipp.h http.h versioning.h ppd.h
testoptions.64.o: testoptions.c array.h file.h language.h
testlang.64.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
testlang.64.o: testlang.c ../config.h
testppd.64.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
testppd.64.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
testsnmp.64.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
+247 -60
Ver Arquivo
@@ -3,7 +3,7 @@
#
# API library Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007 by Apple Inc.
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -28,12 +28,15 @@ LIBOBJS = \
auth.o \
backchannel.o \
backend.o \
conflicts.o \
custom.o \
debug.o \
dest.o \
dir.o \
emit.o \
encode.o \
file.o \
getdevices.o \
getifaddrs.o \
getputfile.o \
globals.o \
@@ -53,8 +56,10 @@ LIBOBJS = \
options.o \
page.o \
ppd.o \
pwgmedia.o \
request.o \
sidechannel.o \
snmp.o \
snprintf.o \
string.o \
tempfile.o \
@@ -69,13 +74,16 @@ OBJS = \
$(LIB64OBJS) \
testadmin.o \
testarray.o \
testconflicts.o \
testcups.o \
testfile.o \
testhttp.o \
testi18n.o \
testipp.o \
testoptions.o \
testlang.o \
testppd.o \
testsnmp.o \
php_cups_wrap.o
@@ -91,32 +99,41 @@ HEADERS = \
dir.h \
file.h \
http.h \
i18n.h \
ipp.h \
language.h \
ppd.h \
raster.h \
sidechannel.h \
transcode.h
transcode.h \
versioning.h
#
# Targets in this directory...
#
TARGETS = \
LIBTARGETS = \
$(LIBCUPS) \
$(LIB32CUPS) \
$(LIB64CUPS) \
libcups.a \
libcups.a
UNITTARGETS = \
testadmin \
testarray \
testconflicts \
testcups \
testfile \
testhttp \
testi18n \
testipp \
testlang \
testppd
testoptions \
testppd \
testsnmp
TARGETS = \
$(LIBTARGETS)
#
@@ -126,12 +143,26 @@ TARGETS = \
all: $(TARGETS)
#
# Make library targets...
#
libs: $(LIBTARGETS)
#
# Make unit tests...
#
unittests: $(UNITTARGETS)
#
# Remove object and target files...
#
clean:
$(RM) $(OBJS) $(TARGETS)
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
$(RM) libcups.so libcups.sl libcups.dylib
$(RM) -r 32bit 64bit
@@ -145,16 +176,50 @@ depend:
makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1
$(RM) Dependencies
cp Dependencies.tmp Dependencies
sed -r -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
sed -r -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
sed -E -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
sed -E -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
$(RM) Dependencies.tmp
#
# Install object and target files...
# Install all targets...
#
install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
#
# Install programs...
#
install-exec:
#
# Install headers...
#
install-headers:
echo Installing header files into $(INCLUDEDIR)/cups...
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
for file in $(HEADERS); do \
$(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
done
#
# Install libraries...
#
install-libs: $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
echo Installing libraries in $(LIBDIR)...
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
@@ -162,34 +227,28 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
$(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
fi
if test $(LIBCUPS) = "libcups.2.dylib"; then \
$(STRIP) -x $(LIBDIR)/$(LIBCUPS); \
$(RM) $(LIBDIR)/libcups.dylib; \
$(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
fi
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(TARGETS); do \
cp $$file $(SYMROOT); \
done \
cp $(LIBCUPS) $(SYMROOT); \
fi
installstatic:
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) libcups.a $(LIBDIR)
$(INSTALL_LIB) -m 755 libcups.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcups.a
installhdrs:
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
for file in $(HEADERS); do \
$(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
done
$(CHMOD) 555 $(LIBDIR)/libcups.a
install32bit:
echo Installing libraries in $(LIB32DIR)...
$(INSTALL_DIR) -m 755 $(LIB32DIR)
$(INSTALL_LIB) 32bit/libcups.so.2 $(LIB32DIR)/libcups.so.2
$(LN) libcups.so.2 $(LIB32DIR)/libcups.so
install64bit:
echo Installing libraries in $(LIB64DIR)...
$(INSTALL_DIR) -m 755 $(LIB64DIR)
$(INSTALL_LIB) 64bit/libcups.so.2 $(LIB64DIR)/libcups.so.2
$(LN) libcups.so.2 $(LIB64DIR)/libcups.so
@@ -231,7 +290,8 @@ uninstall64bit:
libcups.so.2 libcups.sl.2: $(LIBOBJS)
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
$(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) `basename $@ .2`
$(LN) $@ `basename $@ .2`
@@ -243,7 +303,8 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
32bit/libcups.so.2: $(LIB32OBJS)
echo Linking 32-bit $@...
-mkdir 32bit
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBGSSAPI) \
$(DNSSDLIBS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 32bit/libcups.so
$(LN) libcups.so.2 32bit/libcups.so
@@ -255,7 +316,8 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
64bit/libcups.so.2: $(LIB64OBJS)
echo Linking 64-bit $@...
-mkdir 64bit
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBGSSAPI) \
$(DNSSDLIBS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(RM) 64bit/libcups.so
$(LN) libcups.so.2 64bit/libcups.so
@@ -264,7 +326,7 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
# libcups.2.dylib
#
libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) libcups.exp
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/$@ \
@@ -272,7 +334,8 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
-compatibility_version 2.0.0 \
-exported_symbols_list libcups.exp \
-sectorder __TEXT __text $(LIBCUPSORDER) \
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
$(COMMONLIBS) $(LIBZ)
$(RM) libcups.dylib
$(LN) $@ libcups.dylib
@@ -283,7 +346,9 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
libcups_s.a: $(LIBOBJS) libcups_s.exp
echo Creating $@...
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o \
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
$(COMMONLIBS) $(LIBZ) -lm
$(RM) $@
$(AR) $(ARFLAGS) $@ libcups_s.o
@@ -294,8 +359,9 @@ libcups_s.a: $(LIBOBJS) libcups_s.exp
libcups.la: $(LIBOBJS)
echo Linking $@...
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
-version-info 2:8 $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
-rpath $(LIBDIR) -version-info 2:8 $(LIBGSSAPI) $(SSLLIBS) \
$(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -340,7 +406,7 @@ php_cups_wrap.c: cups.h
testadmin: testadmin.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testadmin.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -349,8 +415,20 @@ testadmin: testadmin.o libcups.a
testarray: testarray.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testarray.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running array API tests...
./testarray
#
# testconflicts (dependency on static CUPS library is intentional)
#
testconflicts: testconflicts.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testconflicts.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -360,7 +438,7 @@ testarray: testarray.o libcups.a
testcups: testcups.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testcups.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -369,8 +447,10 @@ testcups: testcups.o libcups.a
testfile: testfile.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testfile.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running file API tests...
./testfile
#
@@ -379,8 +459,10 @@ testfile: testfile.o libcups.a
testhttp: testhttp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running HTTP API tests...
./testhttp
#
@@ -389,8 +471,10 @@ testhttp: testhttp.o libcups.a
testipp: testipp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testipp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running IPP API tests...
./testipp
#
@@ -399,8 +483,10 @@ testipp: testipp.o libcups.a
testi18n: testi18n.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testi18n.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running internationalization API tests...
./testi18n
#
@@ -409,18 +495,44 @@ testi18n: testi18n.o libcups.a
testlang: testlang.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testlang.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running language API tests...
./testlang
#
# testoptions (dependency on static CUPS library is intentional)
#
testoptions: testoptions.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testoptions.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running option API tests...
./testoptions
#
# testppd (dependency on static CUPS library is intentional)
#
testppd: testppd.o libcups.a
testppd: testppd.o libcups.a test.ppd test2.ppd
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
echo Running PPD API tests...
./testppd
#
# testsnmp (dependency on static CUPS library is intentional)
#
testsnmp: testsnmp.o libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testsnmp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -429,29 +541,104 @@ testppd: testppd.o libcups.a
apihelp:
echo Generating CUPS API help files...
mxmldoc --section "Programming" \
--title "Introduction to CUPS Programming" \
--css ../doc/cups-printable.css \
--header api-overview.header --intro api-overview.shtml \
>../doc/help/api-overview.html
mxmldoc --section "Programming" --title "Array API" \
--intro api-array.shtml \
--css ../doc/cups-printable.css \
--header api-array.header --intro api-array.shtml \
api-array.xml \
array.h array.c >../doc/help/api-array.html
mxmldoc --tokens help/api-array.html api-array.xml >../doc/help/api-array.tokens
$(RM) api-array.xml
mxmldoc --section "Programming" --title "CUPS API" \
--intro api-cups.shtml \
cups.h dest.c getputfile.c language.c notify.c \
--css ../doc/cups-printable.css \
--header api-cups.header --intro api-cups.shtml \
api-cups.xml \
cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c >../doc/help/api-cups.html
mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
$(RM) api-cups.xml
mxmldoc --section "Programming" --title "File and Directory APIs" \
--intro api-filedir.shtml \
--css ../doc/cups-printable.css \
--header api-filedir.header --intro api-filedir.shtml \
api-filedir.xml \
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
mxmldoc --tokens api-filedir.xml >../doc/help/api-filedir.tokens
$(RM) api-filedir.xml
mxmldoc --section "Programming" --title "PPD API" \
--intro api-ppd.shtml \
ppd.h attr.c custom.c emit.c localize.c mark.c page.c \
--css ../doc/cups-printable.css \
--header api-ppd.header --intro api-ppd.shtml \
api-ppd.xml \
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
ppd.c >../doc/help/api-ppd.html
mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
$(RM) api-ppd.xml
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
--intro api-httpipp.shtml \
http.h ipp.h auth.c encode.c http.c http-addr.c \
http-support.c ipp.c ipp-support.c md5passwd.c \
request.c >../doc/help/api-httpipp.html
mxmldoc --section "Programming" --title "Filter and Backend APIs" \
--intro api-filter.shtml \
backchannel.c sidechannel.c sidechannel.h >../doc/help/api-filter.html
--css ../doc/cups-printable.css \
--header api-httpipp.header --intro api-httpipp.shtml \
api-httpipp.xml \
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
http.c http-addr.c http-support.c ipp.c ipp-support.c \
md5passwd.c request.c >../doc/help/api-httpipp.html
mxmldoc --tokens help/api-httpipp.html api-httpipp.xml >../doc/help/api-httpipp.tokens
$(RM) api-httpipp.xml
mxmldoc --section "Programming" \
--title "Filter and Backend Programming" \
--css ../doc/cups-printable.css \
--header api-filter.header --intro api-filter.shtml \
api-filter.xml \
backchannel.c backend.h backend.c sidechannel.c sidechannel.h \
>../doc/help/api-filter.html
mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
$(RM) api-filter.xml
framedhelp:
echo Generating CUPS API help files...
mxmldoc --framed api-overview \
--section "Programming" \
--title "Introduction to CUPS Programming" \
--css ../doc/cups-printable.css \
--header api-overview.header --intro api-overview.shtml
mxmldoc --framed api-array \
--section "Programming" --title "Array API" \
--css ../doc/cups-printable.css \
--header api-array.header --intro api-array.shtml \
array.h array.c
mxmldoc --framed api-cups \
--section "Programming" --title "CUPS API" \
--css ../doc/cups-printable.css \
--header api-cups.header --intro api-cups.shtml \
cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c
mxmldoc --framed api-filedir \
--section "Programming" --title "File and Directory APIs" \
--css ../doc/cups-printable.css \
--header api-filedir.header --intro api-filedir.shtml \
file.h file.c dir.h dir.c
mxmldoc --framed api-ppd \
--section "Programming" --title "PPD API" \
--css ../doc/cups-printable.css \
--header api-ppd.header --intro api-ppd.shtml \
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
page.c ppd.c
mxmldoc --framed api-httpipp \
--section "Programming" --title "HTTP and IPP APIs" \
--css ../doc/cups-printable.css \
--header api-httpipp.header --intro api-httpipp.shtml \
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
http.c http-addr.c http-support.c ipp.c ipp-support.c \
md5passwd.c request.c
mxmldoc --framed api-filter \
--section "Programming" \
--title "Filter and Backend Programming" \
--css ../doc/cups-printable.css \
--header api-filter.header --intro api-filter.shtml \
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
#

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