Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 89fbf56cfd Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.3.6@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
2132 arquivos alterados com 191633 adições e 123123 exclusões
-783
Ver Arquivo
@@ -1,783 +0,0 @@
CHANGES-1.3.txt
---------------
CHANGES IN CUPS V1.3.10
- Documentation fixes (STR #2994, STR #2995, STR #3008)
- 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)
- The scheduler now protects against DNS rebinding attacks on
localhost.
- SECURITY: The PNG image reading code did not validate the
image size properly, leading to a potential buffer overflow
(STR #2974)
- 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.
+528 -271
Ver Arquivo
@@ -1,277 +1,534 @@
CHANGES.txt - 2008-12-15
CHANGES.txt - 2008-02-15
------------------------
CHANGES IN CUPS V1.4b2
CHANGES IN CUPS V1.3.6
- 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.
- 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.4b1
CHANGES IN CUPS V1.3.5
- 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.
- 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.
+2 -3
Ver Arquivo
@@ -1,4 +1,4 @@
CREDITS.txt - 2008-12-08
CREDITS.txt - 2007-09-10
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
@@ -30,11 +30,10 @@ like to thank the following individuals for their contributions:
Daniel Nylander - 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 Gonzlez Riopedre - Spanish localization.
Juan Pablo González Riopedre - Spanish localization.
Opher Shachar - Hebrew localization.
Stuart Stevens - HP JetDirect IPP information.
Andrea Suatoni - IRIX desktop integration and testing.
+70 -90
Ver Arquivo
@@ -1,9 +1,10 @@
INSTALL - CUPS v1.4b2 - 2008-12-15
INSTALL - CUPS v1.3.6 - 2008-02-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 ****
@@ -13,61 +14,70 @@ be found in "CHANGES.txt".
BEFORE YOU BEGIN
You'll need ANSI-compliant C and C++ compilers, plus a make program and
POSIX-compliant shell (/bin/sh). The GNU compiler tools and Bash work well
and we have tested the current CUPS code against several versions of GCC
with excellent results.
You'll need ANSI-compliant C and C++ compilers, plus a make
program and Bourne shell. The GNU compiler tools work well -
we've tested the current CUPS code against several versions
of GCC with excellent results.
The makefiles used by the project should work with 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".
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).
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.
Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB
libraries for image support, the CDSA, GNU TLS, or OpenSSL
libraries for encryption support, and the OpenLDAP and
OpenSLP libraries for directory services support. CUPS will
compile and run without these, however you'll miss out on
many of the features provided by CUPS.
Also, please note that CUPS 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.
Kerberos support requires MIT Kerberos 1.6.3 or later or
or Heimdal Kerberos, 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.
COMPILING THE SUBVERSION REPOSITORY CODE
COMPILING FROM SUBVERSION
The CUPS Subversion repository doesn't hold a copy of the pre-built
configure script. You'll need to run the GNU autoconf software (2.60 or
higher) to create it:
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) before compiling the
software from Subversion:
autoconf -f
CONFIGURATION
CUPS uses GNU autoconf, so you should find the usual "configure" script in
the main CUPS source directory. To configure CUPS for your system, type:
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"
@@ -85,15 +95,6 @@ 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
@@ -105,26 +106,11 @@ 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
@@ -132,10 +118,12 @@ 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.
You can also build binary packages that can be installed on
other machines using the RPM spec file
("packaging/cups.spec") or EPM list file
("packaging/cups.list"). The latter also supports building
of binary RPMs, so it may be more convenient to use - we use
EPM to build all of our binary distributions.
You can find the RPM software at:
@@ -143,7 +131,7 @@ INSTALLING THE SOFTWARE
The EPM software is available at:
http://www.epmhome.org/
http://www.easysw.com/epm/
CREATING BINARY DISTRIBUTIONS WITH EPM
@@ -157,8 +145,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
@@ -175,27 +163,19 @@ 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. Set the CUPS_DEBUG_LOG environment variable to a filename to
append logging information at run-time. Use the name "-" to send the
messages to stderr.
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.
+8 -25
Ver Arquivo
@@ -22,7 +22,6 @@ AWK = @AWK@
CC = @LIBTOOL@ @CC@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
DSOXX = @DSOXX@
HTMLDOC = @HTMLDOC@
INSTALL = @INSTALL@
LD = @LD@
@@ -35,17 +34,17 @@ RM = @RM@ -f
RMDIR = @RMDIR@
SED = @SED@
SHELL = /bin/sh
STRIP = @STRIP@
#
# Installation programs...
#
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_SCRIPT = $(INSTALL) -m 755
@@ -78,11 +77,7 @@ UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@
#
LIBCUPS = @LIBCUPS@
LIBCUPSCGI = @LIBCUPSCGI@
LIBCUPSDRIVER = @LIBCUPSDRIVER@
LIBCUPSIMAGE = @LIBCUPSIMAGE@
LIBCUPSMIME = @LIBCUPSMIME@
LIBCUPSPPDC = @LIBCUPSPPDC@
LIBJPEG = @LIBJPEG@
LIBLDAP = @LIBLDAP@
LIBMALLOC = @LIBMALLOC@
@@ -91,8 +86,6 @@ LIBPNG = @LIBPNG@
LIBSLP = @LIBSLP@
LIBGSSAPI = @LIBGSSAPI@
LIBTIFF = @LIBTIFF@
LIBUSB = @LIBUSB@
LIBWRAP = @LIBWRAP@
LIBZ = @LIBZ@
#
@@ -122,24 +115,19 @@ ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \
ARCHFLAGS = @ARCHFLAGS@
ARFLAGS = @ARFLAGS@
BACKLIBS = @BACKLIBS@
BANNERTOPS = @BANNERTOPS@
CFLAGS = @CPPFLAGS@ @CFLAGS@
COMMONLIBS = @LIBS@
CUPSDLIBS = @CUPSDLIBS@
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
DBUS_NOTIFIER = @DBUS_NOTIFIER@
DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
DNSSD_BACKEND = @DNSSD_BACKEND@
DSOFLAGS = -L../cups @DSOFLAGS@
DSOFLAGS = @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
DNSSDLIBS = @DNSSDLIBS@
FONTS = @FONTS@
IMGLIBS = @IMGLIBS@
IMGFILTERS = @IMGFILTERS@
LAUNCHDLIBS = @LAUNCHDLIBS@
LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
-L../scheduler @LDARCHFLAGS@ \
LDFLAGS = -L../cups -L../filter @LDARCHFLAGS@ \
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
LEGACY_BACKENDS = @LEGACY_BACKENDS@
LIBCUPSORDER = @LIBCUPSORDER@
@@ -153,12 +141,8 @@ 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...
@@ -237,7 +221,6 @@ REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
SBINDIR = $(BUILDROOT)@sbindir@
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
SMFMANIFESTDIR = @SMFMANIFESTDIR@
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
XINETD = @XINETD@
@@ -259,7 +242,7 @@ DBUSDIR = @DBUSDIR@
#
.SILENT:
.SUFFIXES: .1 .1.gz .1m .1m.gz .3 .3.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
.SUFFIXES: .1 .1.gz .1m .1m.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
.c.o:
echo Compiling $<...
@@ -277,12 +260,12 @@ DBUSDIR = @DBUSDIR@
echo Compiling $<...
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c $<
.man.1 .man.1m .man.3 .man.5 .man.7 .man.8:
.man.1 .man.1m .man.5 .man.7 .man.8:
echo Linking $<...
$(RM) $@
$(LN) $< $@
.man.1.gz .man.1m.gz .man.3.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
.man.1.gz .man.1m.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
echo -n Compressing $<...
$(RM) $@
gzip -v9 <$< >$@
+24 -114
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,22 +15,14 @@
include Makedefs
#
# Don't run top-level build targets in parallel...
#
.NOTPARALLEL:
#
# Directories to make...
#
DIRS = cups filter backend berkeley cgi-bin driver locale man monitor \
notifier ppdc scheduler systemv test \
DIRS = cups backend berkeley cgi-bin filter locale man monitor \
notifier $(PDFTOPS) scheduler systemv test \
$(PHPDIR) \
conf data doc examples $(FONTS) templates
conf data doc $(FONTS) ppd templates
#
@@ -39,55 +31,13 @@ DIRS = cups filter backend berkeley cgi-bin driver 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) 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;\
(cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
done
@@ -115,15 +65,12 @@ distclean: clean
$(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/drv.man man/lpoptions.man
$(RM) man/cupsd.conf.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 clang cups/charmaps cups/locale driver/test
-$(RM) -r autom4te*.cache
#
@@ -137,17 +84,6 @@ depend:
done
#
# Run the clang.llvm.org static code analysis tool on the C sources.
#
.PHONY: clang
clang:
$(RM) -r clang
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) \
CC=ccc-analyzer CXX=ccc-analyzer clean all
#
# Generate a ctags file...
#
@@ -157,20 +93,13 @@ ctags:
#
# Install everything...
# Install object and target files...
#
install: install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
install: installhdrs
for dir in $(DIRS); do\
echo Installing data files in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
echo Installing in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install) || exit 1;\
done
echo Installing cups-config script...
$(INSTALL_DIR) -m 755 $(BINDIR)
@@ -193,7 +122,13 @@ install-data:
fi
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
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 \
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; \
@@ -211,11 +146,6 @@ install-data:
$(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; \
@@ -243,37 +173,17 @@ install-data:
$(INSTALL_DATA) desktop/cups-128.png $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
fi
#
# Install header files...
#
install-headers:
for dir in $(DIRS); do\
echo Installing header files in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\
done
#
# Install programs...
# Install source and header files...
#
install-exec: all
for dir in $(DIRS); do\
echo Installing programs in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
done
installsrc:
gnutar --dereference --exclude=.svn -cf - . | gnutar -C $(SRCROOT) -xf -
#
# Install libraries...
#
install-libs: libs
for dir in $(DIRS); do\
echo Installing libraries in $$dir... ;\
(cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
done
installhdrs:
(cd cups ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;\
(cd filter ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;
#
+100 -103
Ver Arquivo
@@ -1,160 +1,150 @@
README - CUPS v1.4b2 - 2008-12-15
README - CUPS v1.3.6 - 2008-02-15
---------------------------------
**********************************************************************
**********************************************************************
********** **********
********** THIS IS BETA-RELEASE SOFTWARE. DO NOT USE ON **********
********** PRODUCTION SYSTEMS! REPORT PROBLEMS TO THE **********
********** CUPS FORUMS OR BUG REPORTING PAGES: **********
********** **********
********** http://www.cups.org/newsgroups.php (FORUMS) **********
********** http://www.cups.org/str.php (BUGS) **********
********** **********
**********************************************************************
**********************************************************************
Looking for compile instructions? Read the file "INSTALL.txt"
instead...
INTRODUCTION
The Common UNIX Printing System ("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 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.
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 uses the Internet Printing Protocol ("IPP") as the basis
for managing print jobs and queues. The Line Printer Daemon
("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
JetDirect) protocols are also supported with reduced
functionality. CUPS adds network printer browsing and
PostScript Printer Description ("PPD") based printing options
to support real-world printing under UNIX.
CUPS is licensed under the GNU General Public License and GNU Library
General Public License versions 2. See the file "LICENSE.txt" for more
information.
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.
READING THE DOCUMENTATION
Once you have installed the software you can access the documentation (and
a bunch of other stuff) online at:
Once you have installed the software you can access the
documentation (and a bunch of other stuff) on-line at:
http://localhost:631/
If you're having trouble getting that far, the documentation is located
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 resources.
See the CUPS web site at "http://www.cups.org/" for other
site links.
SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
CUPS includes a web-based administration tool that allows you to manage
printers, classes, and jobs on your server. Open the following URL in your
browser to access the printer administration tools:
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:
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/admin/lpadmin 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 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 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
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
Run the "lpinfo -m" command to list the available drivers:
lpinfo -m
Run the "lpinfo -v" command to list the available printers:
Run the "lpinfo" 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 device-uri -m ppd-name
lpadmin -p printername -E -v URI -m filename.ppd
Network printers typically use "socket" or "lpd" URIs:
lpadmin -p printername -E -v socket://11.22.33.44 -m ppd-name
lpadmin -p printername -E -v lpd://11.22.33.44/ -m ppd-name
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
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
The sample drivers provide basic printing capabilities, but
generally do not exercise the full potential of the printers
or CUPS.
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 -o media=A4 -o resolution=600dpi filename
lpr -o media=A4 -o resolution=600dpi filename
lp -omedia=A4 -oresolution=600dpi filename
lpr -omedia=A4 -oresolution=600dpi filename
CUPS recognizes many types of images files as well as PDF, PostScript,
HP-GL/2, and text files, so you can print those files directly rather than
through an application.
CUPS recognizes many types of images files as well as PDF,
PostScript, HP-GL/2, and text files, so you can print those
files directly rather than through an application.
If you have an application that generates output specifically for your
printer then you need to use the "-oraw" or "-l" options:
If you have an application that generates output specifically
for your printer then you need to use the "-oraw" or "-l"
options:
lp -o raw filename
lp -oraw filename
lpr -l filename
This will prevent the filters from misinterpreting your print
@@ -163,15 +153,22 @@ PRINTING FILES
LEGAL STUFF
CUPS is Copyright 2007-2008 by Apple Inc. CUPS, the CUPS logo, and the
Common UNIX Printing System are trademarks of Apple Inc.
CUPS is Copyright 2007-2008 Apple Inc. All Rights Reserved.
CUPS, the CUPS logo, and the Common UNIX Printing System are
trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
This software is based in part on the work of the Independent JPEG Group.
The PDF filter (pdftops) is based on the Xpdf software,
Copyright 1996-2005 by Derek B. Noonburg.
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.
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.
+49 -75
Ver Arquivo
@@ -1,76 +1,50 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
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
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
+31 -89
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Backend makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,13 +17,12 @@
include ../Makedefs
RBACKENDS = ipp lpd $(DNSSD_BACKEND)
RBACKENDS = ipp lpd
UBACKENDS = $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
TARGETS = test1284 testbackend testsupplies \
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
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
#
@@ -33,26 +32,12 @@ OBJS = ipp.o lpd.o dnssd.o pap.o parallel.o scsi.o serial.o snmp.o \
all: $(TARGETS)
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all object files...
#
clean:
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http mdns
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http
#
@@ -67,34 +52,16 @@ depend:
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
#
# Install programs...
#
install-exec:
install: all
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
for file in $(RBACKENDS); do \
$(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \
$(LIBTOOL) $(INSTALL) -m 700 $$file $(SERVERBIN)/backend; \
done
for file in $(UBACKENDS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
done
$(RM) $(SERVERBIN)/backend/http
$(LN) ipp $(SERVERBIN)/backend/http
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 \
@@ -103,20 +70,6 @@ install-exec:
fi
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall all targets...
#
@@ -130,6 +83,15 @@ uninstall:
-$(RMDIR) $(SERVERBIN)
#
# betest
#
betest: betest.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o betest betest.o $(LIBS)
#
# test1284
#
@@ -137,27 +99,7 @@ uninstall:
test1284: test1284.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
# testbackend
#
testbackend: testbackend.o ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(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) $(COMMONLIBS) $(LIBZ)
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
#
@@ -172,23 +114,24 @@ libbackend.a: $(LIBOBJS)
#
# dnssd
# ieee1394
#
dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
ieee1394: ieee1394.o ieee1394-linux.o
echo Linking $@...
$(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
$(RM) mdns
$(LN) dnssd mdns
$(CC) $(LDFLAGS) -o ieee1394 ieee1394.o ieee1394-linux.o -lraw1394 $(LIBS)
ieee1394.o: ieee1394.h
ieee1394-linux.o: ieee1394.h
#
# ipp
#
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
ipp: ipp.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS)
$(RM) http
$(LN) ipp http
@@ -197,9 +140,9 @@ ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
# lpd
#
lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
lpd: lpd.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
#
@@ -264,9 +207,8 @@ socket: socket.o ../cups/$(LIBCUPS) libbackend.a
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
$(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-unix.c
#
+12 -222
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend support definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -25,10 +25,9 @@
# include <cups/backend.h>
# include <cups/sidechannel.h>
# include <cups/ppd-private.h>
# include <cups/cups.h>
# include <cups/debug.h>
# include <cups/i18n.h>
# include <cups/snmp-private.h>
# include <stdlib.h>
# include <errno.h>
# include <cups/string.h>
@@ -44,229 +43,20 @@ 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_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_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
/*
* Prototypes...
*/
extern void backendCheckSideChannel(int snmp_fd, http_addr_t *addr);
extern int backendDrainOutput(int print_fd, int device_fd);
extern int backendGetDeviceID(int fd, char *device_id,
int device_id_size,
char *make_model,
int make_model_size,
const char *scheme, char *uri,
int uri_size);
extern int backendGetMakeModel(const char *device_id,
char *make_model,
int make_model_size);
extern void 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,
void (*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);
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));
# ifdef __cplusplus
}
+78
Ver Arquivo
@@ -0,0 +1,78 @@
/*
* "$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$".
*/
-802
Ver Arquivo
@@ -1,802 +0,0 @@
/*
* "$Id$"
*
* DNS-SD discovery backend 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() - Browse for printers.
* browse_callback() - Browse devices.
* browse_local_callback() - Browse local devices.
* compare_devices() - Compare two devices.
* get_device() - Create or update a device.
* query_callback() - Process query data.
* 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 */
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 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 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 */
/*
* Check command-line...
*/
setbuf(stderr, NULL);
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...
*/
for (;;)
{
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 */
static const char * const schemes[] =
{ "lpd", "ipp", "ipp", "socket", "riousbprint" };
/* URI schemes for devices */
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))
{
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
schemes[best->type], NULL, best->fullName, 0,
best->cups_shared ? "/cups" : "/");
cupsBackendReport("network", device_uri, best->make_and_model,
best->name, NULL, 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)
{
httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
schemes[best->type], NULL, best->fullName, 0,
best->cups_shared ? "/cups" : "/");
cupsBackendReport("network", device_uri, best->make_and_model,
best->name, NULL, NULL);
best->sent = 1;
}
}
}
}
/*
* '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 */
{
int result = strcmp(a->name, b->name);
if (result)
return (result);
else
return (strcmp(a->domain, b->domain));
}
/*
* '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...
*/
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 URIs 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;
key.domain = (char *)replyDomain;
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) ||
strcasecmp(device->domain, key.domain))
break;
else if (device->type == key.type)
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 name */
cups_device_t key, /* 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;
key.name = name;
unquote(name, fullName, sizeof(name));
if ((key.domain = strstr(name, "._tcp.")) != NULL)
key.domain += 6;
else
key.domain = (char *)"local.";
if ((ptr = strstr(name, "._")) != NULL)
*ptr = '\0';
if (strstr(fullName, "_ipp._tcp.") ||
strstr(fullName, "_ipp-tls._tcp."))
key.type = CUPS_DEVICE_IPP;
else if (strstr(fullName, "_fax-ipp._tcp."))
key.type = CUPS_DEVICE_FAX_IPP;
else if (strstr(fullName, "_printer._tcp."))
key.type = CUPS_DEVICE_PRINTER;
else if (strstr(fullName, "_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) ||
strcasecmp(device->domain, key.domain))
{
device = NULL;
break;
}
else if (device->type == key.type)
{
/*
* Found it, pull out the priority and make and model from the TXT
* record and save it...
*/
const void *value; /* Pointer to value */
uint8_t valueLen; /* Length of value (max 255) */
char make_and_model[512], /* Manufacturer and model */
model[256], /* Model */
priority[256]; /* Priority */
value = TXTRecordGetValuePtr(rdlen, rdata, "priority", &valueLen);
if (value && valueLen)
{
memcpy(priority, value, valueLen);
priority[valueLen] = '\0';
device->priority = atoi(priority);
}
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MFG",
&valueLen)) == NULL)
value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MANUFACTURER",
&valueLen);
if (value && valueLen)
{
memcpy(make_and_model, value, valueLen);
make_and_model[valueLen] = '\0';
}
else
make_and_model[0] = '\0';
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MDL",
&valueLen)) == NULL)
value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MODEL", &valueLen);
if (value && valueLen)
{
memcpy(model, value, valueLen);
model[valueLen] = '\0';
}
else if ((value = TXTRecordGetValuePtr(rdlen, rdata, "product",
&valueLen)) != NULL && valueLen > 2)
{
if (((char *)value)[0] == '(')
{
/*
* Strip parenthesis...
*/
memcpy(model, value + 1, valueLen - 2);
model[valueLen - 2] = '\0';
}
else
{
memcpy(model, value, valueLen);
model[valueLen] = '\0';
}
if (!strcasecmp(model, "GPL Ghostscript") ||
!strcasecmp(model, "GNU Ghostscript") ||
!strcasecmp(model, "ESP Ghostscript"))
{
if ((value = TXTRecordGetValuePtr(rdlen, rdata, "ty",
&valueLen)) != NULL)
{
memcpy(model, value, valueLen);
model[valueLen] = '\0';
if ((ptr = strchr(model, ',')) != NULL)
*ptr = '\0';
}
else
strcpy(model, "Unknown");
}
}
else
strcpy(model, "Unknown");
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);
if ((device->type == CUPS_DEVICE_IPP ||
device->type == CUPS_DEVICE_PRINTER) &&
TXTRecordGetValuePtr(rdlen, rdata, "printer-type", &valueLen))
{
/*
* This is a CUPS printer!
*/
device->cups_shared = 1;
if (device->type == CUPS_DEVICE_PRINTER)
device->sent = 1;
}
break;
}
}
if (!device)
fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
}
/*
* '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$".
*/
+292 -162
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -64,17 +64,19 @@ backendGetDeviceID(
char *uri, /* O - Device URI */
int uri_size) /* I - Size of buffer */
{
#ifdef __APPLE__ /* This function is a no-op */
return (-1);
#else /* Get the device ID from the specified file descriptor... */
# ifdef __linux
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
manufacturer[256], /* Manufacturer string */
serial_number[1024]; /* Serial number string */
int manulen; /* Length of manufacturer string */
#ifdef __linux
int length; /* Length of device ID info */
int got_id = 0;
# endif /* __linux */
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
#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, "
@@ -104,83 +106,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 */
/*
* 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.
* 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...
*/
if (uri && !strncmp(uri, "parallel:/dev/", 14))
snprintf(devparport, sizeof(devparport), "/dev/parport%s",
uri + strlen(uri) - 1);
if ((devparportfd = open(devparport, O_RDWR | O_NOCTTY)) != -1)
{
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...
*/
* Claim the device...
*/
snprintf(devparport, sizeof(devparport), "/dev/parport%s",
uri + strlen(uri) - 1);
if ((devparportfd = open(devparport, O_RDWR | O_NOCTTY)) != -1)
if (!ioctl(devparportfd, PPCLAIM))
{
/*
* Claim the device...
*/
fcntl(devparportfd, F_SETFL, fcntl(devparportfd, F_GETFL) | O_NONBLOCK);
if (!ioctl(devparportfd, PPCLAIM))
mode = IEEE1284_MODE_COMPAT;
if (!ioctl(devparportfd, PPNEGOT, &mode))
{
fcntl(devparportfd, F_SETFL, fcntl(devparportfd, F_GETFL) | O_NONBLOCK);
/*
* Put the device into Device ID mode...
*/
mode = IEEE1284_MODE_COMPAT;
mode = IEEE1284_MODE_NIBBLE | IEEE1284_DEVICEID;
if (!ioctl(devparportfd, PPNEGOT, &mode))
{
/*
* Put the device into Device ID mode...
* Read the 1284 device ID...
*/
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;
}
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);
/*
* Release the device...
*/
ioctl(devparportfd, PPRELEASE);
}
close(devparportfd);
}
}
else
got_id = 1;
}
else
got_id = 1;
if (got_id)
if (got_id)
{
/*
* Extract the length of the device ID string from the first two
@@ -211,14 +213,13 @@ backendGetDeviceID(
memmove(device_id, device_id + 2, length);
device_id[length] = '\0';
}
# ifdef DEBUG
# ifdef DEBUG
else
DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
strerror(errno)));
# endif /* DEBUG */
# endif /* __linux */
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;
@@ -235,12 +236,11 @@ backendGetDeviceID(
else
device_id[device_id_size - 1] = '\0';
}
# ifdef DEBUG
# ifdef DEBUG
else
DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
strerror(errno)));
# endif /* DEBUG */
# endif /* __sun && ECPPIOC_GETDEVID */
printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
# endif /* DEBUG */
#endif /* __sun && ECPPIOC_GETDEVID */
}
DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
@@ -264,61 +264,111 @@ 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 */
/*
* Get the make, model, and serial numbers...
* Look for the serial number field...
*/
num_values = _ppdGet1284Values(device_id, &values);
if ((attr = strstr(device_id, "SERN:")) != NULL)
attr += 5;
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, ";SN:")) != NULL)
attr += 4;
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
sern = cupsGetOption("SN", num_values, values);
if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
mfg = cupsGetOption("MFG", num_values, values);
if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
mdl = cupsGetOption("MDL", num_values, values);
if (mfg)
if (attr)
{
if (!strcasecmp(mfg, "Hewlett-Packard"))
mfg = "HP";
else if (!strcasecmp(mfg, "Lexmark International"))
mfg = "Lexmark";
strlcpy(serial_number, attr, sizeof(serial_number));
if ((delim = strchr(serial_number, ';')) != NULL)
*delim = '\0';
}
else
{
strlcpy(temp, make_model, sizeof(temp));
if ((tempptr = strchr(temp, ' ')) != NULL)
*tempptr = '\0';
mfg = temp;
}
serial_number[0] = '\0';
/*
* Generate the device URI from the manufacturer, make_model, and
* serial number strings.
*/
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, scheme, NULL, mfg, 0,
"/%s%s%s", mdl, sern ? "?serial=" : "", sern ? sern : "");
snprintf(uri, uri_size, "%s://", scheme);
cupsFreeOptions(num_values, values);
if ((attr = strstr(device_id, "MANUFACTURER:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, "Manufacturer:")) != NULL)
attr += 13;
else if ((attr = strstr(device_id, "MFG:")) != NULL)
attr += 4;
if (attr)
{
strlcpy(manufacturer, attr, sizeof(manufacturer));
if ((delim = strchr(manufacturer, ';')) != NULL)
*delim = '\0';
if (!strcasecmp(manufacturer, "Hewlett-Packard"))
strcpy(manufacturer, "HP");
else if (!strcasecmp(manufacturer, "Lexmark International"))
strcpy(manufacturer, "Lexmark");
}
else
{
strlcpy(manufacturer, make_model, sizeof(manufacturer));
if ((delim = strchr(manufacturer, ' ')) != NULL)
*delim = '\0';
}
manulen = strlen(manufacturer);
for (uriptr = uri + strlen(uri), delim = manufacturer;
*delim && uriptr < (uri + uri_size - 3);
delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
*uriptr++ = '/';
if (!strncasecmp(make_model, manufacturer, manulen))
{
delim = make_model + manulen;
while (isspace(*delim & 255))
delim ++;
}
else
delim = make_model;
for (; *delim && uriptr < (uri + uri_size - 3); delim ++)
if (*delim == ' ')
{
*uriptr++ = '%';
*uriptr++ = '2';
*uriptr++ = '0';
}
else
*uriptr++ = *delim;
if (serial_number[0])
{
/*
* Add the serial number to the URI...
*/
strlcpy(uriptr, "?serial=", uri_size - (uriptr - uri));
strlcat(uriptr, serial_number, uri_size - (uriptr - uri));
}
else
*uriptr = '\0';
}
return (0);
#endif /* __APPLE__ */
}
@@ -332,11 +382,10 @@ backendGetMakeModel(
char *make_model, /* O - Make/model */
int make_model_size) /* I - Size of buffer */
{
int num_values; /* Number of keys and values */
cups_option_t *values; /* Keys and values */
const char *mfg, /* Manufacturer string */
*mdl, /* Model string */
*des; /* Description string */
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*mfg, /* Manufacturer string */
*mdl; /* Model string */
DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
@@ -359,42 +408,12 @@ backendGetMakeModel(
* Look for the description field...
*/
num_values = _ppdGet1284Values(device_id, &values);
if ((attr = strstr(device_id, "DES:")) != NULL)
attr += 4;
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
attr += 12;
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)
if (attr)
{
/*
* Make sure the description contains something useful, since some
@@ -405,30 +424,119 @@ backendGetMakeModel(
* containing at least one space and one letter.
*/
if (strlen(des) >= 8)
if ((delim = strchr(attr, ';')) == NULL)
delim = attr + strlen(attr);
if ((delim - attr) < 8)
attr = NULL;
else
{
const char *ptr; /* Pointer into description */
int letters, /* Number of letters seen */
spaces; /* Number of spaces seen */
char *ptr; /* Pointer into description */
int letters, /* Number of letters seen */
spaces; /* Number of spaces seen */
for (ptr = des, letters = 0, spaces = 0; *ptr; ptr ++)
for (ptr = attr, letters = 0, spaces = 0; ptr < delim; 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)
_ppdNormalizeMakeAndModel(des, make_model, make_model_size);
if (!spaces || !letters)
attr = NULL;
}
}
if (!make_model[0])
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "Manufacturer:")) != NULL)
mfg += 13;
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
mfg += 4;
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "Model:")) != NULL)
mdl += 6;
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
mdl += 4;
if (mdl)
{
/*
* Build a make-model string from the manufacturer and model attributes...
*/
if (mfg)
{
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
strlcpy(make_model, "HP", make_model_size);
else if (!strncasecmp(mfg, "Lexmark International", 21))
strlcpy(make_model, "Lexmark", make_model_size);
else
strlcpy(make_model, mfg, make_model_size);
if ((delim = strchr(make_model, ';')) != NULL)
*delim = '\0';
if (!strncasecmp(make_model, mdl, strlen(make_model)))
{
/*
* Just copy model string, since it has the manufacturer...
*/
strlcpy(make_model, mdl, make_model_size);
}
else
{
/*
* Concatenate the make and model...
*/
strlcat(make_model, " ", make_model_size);
strlcat(make_model, mdl, make_model_size);
}
}
else
{
/*
* Just copy model string, since it has the manufacturer...
*/
strlcpy(make_model, mdl, make_model_size);
}
}
else if (attr)
{
/*
* Use description...
*/
if (!strncasecmp(attr, "Hewlett-Packard hp ", 19))
{
/*
* Check for a common HP bug...
*/
strlcpy(make_model, "HP ", make_model_size);
strlcpy(make_model + 3, attr + 19, make_model_size - 3);
}
else if (!strncasecmp(attr, "Hewlett-Packard ", 16))
{
strlcpy(make_model, "HP ", make_model_size);
strlcpy(make_model + 3, attr + 16, make_model_size - 3);
}
else
{
strlcpy(make_model, attr, make_model_size);
}
}
else
{
/*
* Use "Unknown" as the printer make and model...
@@ -437,9 +545,31 @@ backendGetMakeModel(
strlcpy(make_model, "Unknown", make_model_size);
}
cupsFreeOptions(num_values, values);
/*
* Strip trailing data...
*/
return (0);
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);
}
+878
Ver Arquivo
@@ -0,0 +1,878 @@
/*
* "$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
@@ -0,0 +1,268 @@
/*
* "$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
@@ -0,0 +1,104 @@
/*
* "$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$".
*/
+27 -207
Ver Arquivo
@@ -22,7 +22,6 @@
* 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.
@@ -34,9 +33,17 @@
*/
#include <cups/http-private.h>
#include "backend-private.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.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>
/*
@@ -65,7 +72,6 @@ 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__
@@ -90,7 +96,6 @@ 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 */
const char *device_uri; /* Device URI */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
@@ -100,10 +105,6 @@ 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 */
@@ -139,14 +140,8 @@ 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-levels",
"marker-message",
"marker-names",
"marker-types",
"printer-is-accepting-jobs",
"printer-state",
"printer-state-message",
@@ -199,9 +194,8 @@ main(int argc, /* I - Number of command-line args */
else
s = argv[0];
printf("network %s \"Unknown\" \"%s (%s)\"\n",
s, _cupsLangString(cupsLangDefault(),
_("Internet Printing Protocol")), s);
printf("network %s \"Unknown\" \"Internet Printing Protocol (%s)\"\n",
s, s);
return (CUPS_BACKEND_OK);
}
else if (argc < 6)
@@ -231,10 +225,7 @@ main(int argc, /* I - Number of command-line args */
* Extract the hostname and printer name from the URI...
*/
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
if (httpSeparateURI(HTTP_URI_CODING_ALL, device_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)
@@ -412,49 +403,33 @@ main(int argc, /* I - Number of command-line args */
cups_file_t *fp; /* Temporary file */
char buffer[8192]; /* Buffer for copying */
int bytes; /* Number of bytes read */
off_t tbytes; /* Total bytes copied */
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
perror("ERROR: unable to create temporary file");
return (CUPS_BACKEND_FAILED);
}
if ((fp = cupsFileOpenFd(fd, compression ? "w9" : "w")) == NULL)
{
_cupsLangPrintError(_("ERROR: Unable to open temporary file"));
perror("ERROR: unable to open temporary file");
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
tbytes = 0;
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (cupsFileWrite(fp, buffer, bytes) < bytes)
{
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
perror("ERROR: unable to write to temporary file");
cupsFileClose(fp);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
else
tbytes += bytes;
cupsFileClose(fp);
/*
* Don't try printing files less than 2 bytes...
*/
if (tbytes <= 1)
{
_cupsLangPuts(stderr, _("ERROR: Empty print file!\n"));
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
/*
* Point to the single file from stdin...
*/
@@ -525,9 +500,8 @@ main(int argc, /* I - Number of command-line args */
do
{
fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
_cupsLangPrintf(stderr, _("INFO: Connecting to %s on port %d...\n"),
hostname, port);
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
{
@@ -612,7 +586,7 @@ main(int argc, /* I - Number of command-line args */
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
@@ -626,16 +600,6 @@ 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
@@ -656,12 +620,6 @@ main(int argc, /* I - Number of command-line args */
do
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Build the IPP request...
*/
@@ -856,12 +814,6 @@ 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...
*/
@@ -1061,16 +1013,6 @@ main(int argc, /* I - Number of command-line args */
{
for (i = 0; i < num_files; i ++)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Send the next file in the job...
*/
request = ippNewRequest(IPP_SEND_DOCUMENT);
request->request.op.version[1] = version;
@@ -1112,7 +1054,7 @@ main(int argc, /* I - Number of command-line args */
}
else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
ipp_status == IPP_PRINTER_BUSY)
continue;
break;
else
copies_remaining --;
@@ -1127,12 +1069,6 @@ main(int argc, /* I - Number of command-line args */
for (delay = 1; !job_cancelled;)
{
/*
* Check for side-channel requests...
*/
backendCheckSideChannel(snmp_fd, http->hostaddr);
/*
* Build an IPP_GET_JOB_ATTRIBUTES request...
*/
@@ -1246,15 +1182,6 @@ 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);
/*
* Free memory...
*/
@@ -1361,12 +1288,6 @@ 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"
};
@@ -1489,7 +1410,7 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
{
(void)prompt;
if (password && *password && password_tries < 3)
if (password && password_tries < 3)
{
password_tries ++;
@@ -1519,74 +1440,6 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
}
/*
* '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.
*/
@@ -1597,17 +1450,14 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
{
int i; /* Looping var */
int count; /* Count of reasons shown... */
ipp_attribute_t *caprm, /* com.apple.print.recoverable-message */
*psm, /* printer-state-message */
*reasons, /* printer-state-reasons */
*marker; /* marker-* attributes */
ipp_attribute_t *psm, /* pritner-state-message */
*reasons; /* printer-state-reasons */
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",
@@ -1618,16 +1468,15 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
IPP_TAG_KEYWORD)) == NULL)
return (0);
saw_caprw = 0;
state[0] = '\0';
prefix = "STATE: ";
language = cupsLangDefault();
state[0] = '\0';
prefix = "STATE: ";
language = cupsLangDefault();
for (i = 0, count = 0; i < reasons->num_values; i ++)
{
reason = reasons->values[i].string.text;
if (strcmp(reason, "paused"))
if (job_id == 0 || strcmp(reason, "paused"))
{
strlcat(state, prefix, sizeof(state));
strlcat(state, reason, sizeof(state));
@@ -1642,10 +1491,9 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
else if (!strncmp(reason, "media-jam", 9))
message = _("Media jam!");
else if (!strncmp(reason, "moving-to-paused", 16) ||
!strncmp(reason, "offline", 7) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
message = _("Printer offline.");
message = _("Printer off-line.");
else if (!strncmp(reason, "toner-low", 9))
message = _("Toner low.");
else if (!strncmp(reason, "toner-empty", 11))
@@ -1688,8 +1536,6 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
message = _("Developer almost empty.");
else if (!strncmp(reason, "developer-empty", 15))
message = _("Developer empty!");
else if (!strcmp(reason, "com.apple.print.recoverable-warning"))
saw_caprw = 1;
else if (strstr(reason, "error") != NULL)
{
message = unknown;
@@ -1712,32 +1558,6 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
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-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);
}
+52 -97
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -29,11 +29,19 @@
* Include necessary headers.
*/
#include <cups/backend.h>
#include <cups/http-private.h>
#include "backend-private.h"
#include <cups/cups.h>
#include <cups/i18n.h>
#include <stdio.h>
#include <stdlib.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>
@@ -112,32 +120,31 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
const char *device_uri; /* Device URI */
char 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 */
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 */
#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 */
@@ -174,8 +181,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 1)
{
printf("network lpd \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("LPD/LPR Host or Printer")));
puts("network lpd \"Unknown\" \"LPD/LPR Host or Printer\"");
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
@@ -190,10 +196,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the hostname and printer name from the URI...
*/
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
@@ -430,18 +433,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
perror("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)
{
_cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
perror("ERROR: unable to write to temporary file");
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
filename = tmpfilename;
}
else if (argc == 6)
{
@@ -575,7 +580,7 @@ lpd_command(int fd, /* I - Socket connection to LPD host */
if (lpd_write(fd, buf, bytes) < bytes)
{
_cupsLangPrintError(_("ERROR: Unable to send LPD command"));
perror("ERROR: Unable to send LPD command");
return (-1);
}
@@ -637,8 +642,6 @@ 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? */
@@ -697,9 +700,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
*/
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Connecting to %s:%d for printer %s\n",
hostname, port, printer);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
_cupsLangPrintf(stderr,
_("INFO: Attempting to connect to host %s for printer %s\n"),
hostname, printer);
for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024, addr = addrlist,
delay = 5;;
@@ -742,7 +745,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if ((fd = socket(addr->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create socket"));
perror("ERROR: Unable to create socket");
sleep(1);
continue;
@@ -759,7 +762,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if ((fd = rresvport_af(&lport, addr->addr.addr.sa_family)) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to reserve port"));
perror("ERROR: Unable to reserve port");
sleep(1);
continue;
@@ -866,7 +869,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
#ifdef AF_INET6
if (addr->addr.addr.sa_family == AF_INET6)
@@ -880,21 +883,6 @@ 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...
*/
@@ -910,7 +898,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
httpAddrFreeList(addrlist);
close(fd);
_cupsLangPrintError(_("ERROR: unable to stat print file"));
perror("ERROR: unable to stat print file");
return (CUPS_BACKEND_FAILED);
}
@@ -978,16 +966,6 @@ 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))
{
@@ -1003,7 +981,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
{
status = errno;
_cupsLangPrintError(_("ERROR: Unable to write control file"));
perror("ERROR: Unable to write control file");
}
else
{
@@ -1032,12 +1010,6 @@ 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...
*/
@@ -1073,7 +1045,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (lpd_write(fd, buffer, nbytes) < nbytes)
{
_cupsLangPrintError(_("ERROR: Unable to send print file to printer"));
perror("ERROR: Unable to send print file to printer");
break;
}
else
@@ -1087,7 +1059,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
status = errno;
else if (lpd_write(fd, "", 1) < 1)
{
_cupsLangPrintError(_("ERROR: Unable to send trailing nul to printer"));
perror("ERROR: Unable to send trailing nul to printer");
status = errno;
}
else
@@ -1125,16 +1097,6 @@ 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))
{
@@ -1150,7 +1112,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
{
status = errno;
_cupsLangPrintError(_("ERROR: Unable to write control file"));
perror("ERROR: Unable to write control file");
}
else
{
@@ -1175,13 +1137,6 @@ 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...
*/
-277
Ver Arquivo
@@ -1,277 +0,0 @@
/*
* "$Id$"
*
* Common network APIs for the Common UNIX Printing System (CUPS).
*
* 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
* 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.
*/
void
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))
{
_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 (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);
break;
case CUPS_ASN1_INTEGER :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
packet.object_value.integer);
break;
case CUPS_ASN1_BIT_STRING :
case CUPS_ASN1_OCTET_STRING :
strlcpy(dataptr, packet.object_value.string,
sizeof(data) - (dataptr - data));
break;
case CUPS_ASN1_OID :
_cupsSNMPOIDToString(packet.object_value.oid, dataptr,
sizeof(data) - (dataptr - data));
break;
case CUPS_ASN1_HEX_STRING :
for (i = 0;
i < packet.object_value.hex_string.num_bytes &&
dataptr < (data + sizeof(data) - 3);
i ++, dataptr += 2)
sprintf(dataptr, "%02X",
packet.object_value.hex_string.bytes[i]);
break;
case CUPS_ASN1_COUNTER :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%d",
packet.object_value.counter);
break;
case CUPS_ASN1_GAUGE :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
packet.object_value.gauge);
break;
case CUPS_ASN1_TIMETICKS :
snprintf(dataptr, sizeof(data) - (dataptr - data), "%u",
packet.object_value.timeticks);
break;
default :
fprintf(stderr, "DEBUG: Unknown OID value type %02X!\n",
packet.object_type);
break;
}
fprintf(stderr, "DEBUG: Returning %s %s\n", data, data + datalen);
status = CUPS_SC_STATUS_OK;
datalen += (int)strlen(data + datalen);
}
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, packet.object_value.string, 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);
break;
}
default :
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
datalen = 0;
break;
}
cupsSideChannelWrite(command, status, data, datalen, 1.0);
}
/*
* End of "$Id$".
*/
+48 -54
Ver Arquivo
@@ -224,10 +224,12 @@ int main (int argc, const char * argv[])
if (argc < 6 || argc > 7)
{
_cupsLangPrintf(stderr,
_("Usage: %s job-id user title copies options [file]\n"),
argv[0]);
return (CUPS_BACKEND_FAILED);
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);
}
/* If we have 7 arguments, print the file named on the command-line.
@@ -248,7 +250,7 @@ int main (int argc, const char * argv[])
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
return (1);
}
copies = atoi(argv[4]);
@@ -278,6 +280,7 @@ int main (int argc, const char * argv[])
*/
static int listDevices(void)
{
int err = noErr;
int i;
int numberFound;
@@ -293,21 +296,20 @@ static int listDevices(void)
/* Make sure it's okay to use appletalk */
if (!okayToUseAppleTalk())
{
_cupsLangPuts(stderr, _("INFO: AppleTalk disabled in System Preferences\n"));
fprintf(stderr, "INFO: AppleTalk disabled in System Preferences\n");
return -1; /* Network is down */
}
if (zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone))
if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
{
_cupsLangPrintError(_("ERROR: Unable to get default AppleTalk zone"));
perror("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';
_cupsLangPrintf(stderr, _("INFO: Using default AppleTalk zone \"%s\"\n"),
zone);
fprintf(stderr, "INFO: Using default AppleTalk zone \"%s\"\n", zone);
addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
@@ -319,14 +321,12 @@ static int listDevices(void)
if ((numberFound = nbp_lookup(&entity, buf, MAX_PRINTERS, &retry)) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to lookup AppleTalk printers"));
perror("ERROR: Unable to lookup AppleTalk printers");
return numberFound;
}
if (numberFound >= MAX_PRINTERS)
_cupsLangPrintf(stderr,
_("WARNING: Adding only the first %d printers found"),
MAX_PRINTERS);
fprintf(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);
@@ -409,13 +409,14 @@ 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 = 0, reqlen;
int userdata, xo, 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,
@@ -448,7 +449,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)
{
_cupsLangPrintError(_("ERROR: Unable to make AppleTalk address"));
fprintf(stderr, "ERROR: Unable to make AppleTalk address: %s\n", strerror(errno));
goto Exit;
}
@@ -489,8 +490,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
if ((err = papOpen(&tuple, &gConnID, &gSockfd, &gSessionAddr, &flowQuantum)) == 0)
break;
_cupsLangPrintf(stderr, _("WARNING: Unable to open \"%s:%s\": %s\n"),
name, zone, strerror(err));
fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(err));
}
else
{
@@ -500,15 +500,14 @@ 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");
_cupsLangPuts(stderr, _("WARNING: Printer not responding\n"));
fprintf(stderr, "WARNING: Printer not responding\n");
}
}
}
else
{
fprintf(stderr, "STATE: +apple-appletalk-disabled-warning\n");
_cupsLangPuts(stderr,
_("INFO: AppleTalk disabled in System Preferences.\n"));
fprintf(stderr, "INFO: AppleTalk disabled in System Preferences.\n");
}
elasped_time = time(NULL) - start_time;
@@ -518,7 +517,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
if (connect_timeout && elasped_time > connect_timeout)
{
_cupsLangPuts(stderr, _("ERROR: Printer not responding\n"));
fprintf(stderr, "ERROR: Printer not responding\n");
err = ETIMEDOUT;
goto Exit; /* Waiting too long... */
}
@@ -561,14 +560,14 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
#endif /* HAVE_SIGSET */
_cupsLangPuts(stderr, _("INFO: Sending data\n"));
fprintf(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)
{
_cupsLangPrintError(_("ERROR: Unable to send PAP tickle request"));
perror("ERROR: Unable to send PAP tickle request");
goto Exit;
}
signal(SIGALRM, signalHandler);
@@ -577,7 +576,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)
{
_cupsLangPrintError(_("ERROR: Unable to send initial PAP send data request"));
perror("ERROR: Unable to send initial PAP send data request");
goto Exit;
}
@@ -626,7 +625,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)
{
_cupsLangPrintError(_("ERROR: select() failed"));
perror("ERROR: select");
break;
}
@@ -634,7 +633,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)
_cupsLangPrintError(_("WARNING: Unable to send PAP status request"));
perror("WARNING: Unable to send PAP status request");
if (gStatusInterval)
nextStatusTime = time(NULL) + gStatusInterval;
@@ -685,7 +684,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
{
if ((rc = atp_look(gSockfd)) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to look for PAP response"));
perror("ERROR: Unable to look for PAP response");
break;
}
@@ -698,7 +697,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
if ((err = atp_getresp(gSockfd, &tid, &resp)) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to get PAP response"));
perror("ERROR: Unable to get PAP response");
break;
}
userdata = resp.userdata[0];
@@ -709,7 +708,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)
{
_cupsLangPrintError(_("ERROR: Unable to get PAP request"));
perror("ERROR: Unable to get PAP request");
break;
}
}
@@ -729,7 +728,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;
OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
recvSequence = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false)
{
@@ -828,15 +827,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
goto Exit;
else
{
_cupsLangPuts(stderr, _("WARNING: Printer sent unexpected EOF\n"));
fprintf(stderr, "WARNING: Printer sent unexpected EOF\n");
}
}
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Error %d sending PAPSendData request: %s\n"),
err, strerror(errno));
fprintf(stderr, "ERROR: Error %d sending PAPSendData resuest: %s\n", err, strerror(errno));
goto Exit;
}
break;
@@ -851,11 +848,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)
{
_cupsLangPuts(stderr, _("WARNING: Printer sent unexpected EOF\n"));
fprintf(stderr, "WARNING: Printer sent unexpected EOF\n");
}
else
{
_cupsLangPuts(stderr, _("ERROR: Printer sent unexpected EOF\n"));
fprintf(stderr, "ERROR: Printer sent unexpected EOF\n");
}
goto Exit;
break;
@@ -864,13 +861,11 @@ 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 */
_cupsLangPrintf(stderr, _("WARNING: Unexpected PAP packet of type %d\n"),
TYPE_OF(userdata));
fprintf(stderr, "WARNING: Unexpected PAP packet of type %d\n", TYPE_OF(userdata));
break;
default:
_cupsLangPrintf(stderr, _("WARNING: Unknown PAP packet of type %d\n"),
TYPE_OF(userdata));
fprintf(stderr, "WARNING: Unknown PAP packet of type %d\n", TYPE_OF(userdata));
break;
}
@@ -911,7 +906,8 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
{
int result,
open_result,
userdata;
userdata,
atp_err;
time_t tm,
waitTime;
char data[10],
@@ -925,7 +921,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
socketfd = 0;
puserdata = (u_char *)&userdata;
_cupsLangPuts(stderr, _("INFO: Opening connection\n"));
fprintf(stderr, "INFO: Opening connection\n");
if ((*fd = atp_open(&socketfd)) < 0)
return -1;
@@ -960,8 +956,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_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
0, &resp, &retry, 0) < 0)
if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
0, &resp, &retry, 0)) < 0)
{
statusUpdate("Destination unreachable", 23);
result = EHOSTUNREACH;
@@ -1028,6 +1024,7 @@ static int papClose()
{
int fd;
u_short tmpID;
int result;
unsigned char rdata[ATP_DATA_SIZE];
int userdata;
u_char *puserdata = (u_char *)&userdata;
@@ -1080,9 +1077,9 @@ static int papClose()
resp.resp[0].iov_base = rdata;
resp.resp[0].iov_len = sizeof(rdata);
atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
close(fd);
result = close(fd);
}
return noErr;
}
@@ -1456,9 +1453,7 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
}
else
{
_cupsLangPrintf(stderr,
_("WARNING: Boolean expected for waiteof option \"%s\"\n"),
value);
fprintf(stderr, "WARNING: Boolean expected for waiteof option \"%s\"\n", value);
}
}
else if (!strcasecmp(optionName, "status"))
@@ -1470,9 +1465,8 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
statusInterval = atoi(value);
if (value[0] < '0' || value[0] > '9' || statusInterval < 0)
{
_cupsLangPrintf(stderr,
_("WARNING: number expected for status option \"%s\"\n"),
value);
fprintf(stderr, "WARNING: number expected for status option \"%s\"\n",
value);
}
else
{
@@ -1691,7 +1685,7 @@ static int connectTimeout()
*/
static void signalHandler(int sigraised)
{
_cupsLangPuts(stderr, _("ERROR: There was a timeout error while sending data to the printer\n"));
fprintf(stderr, "ERROR: There was a timeout error while sending data to the printer\n");
papClose();
+11 -26
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -59,8 +59,7 @@
*/
static void list_devices(void);
static void side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
static void side_cb(int print_fd, int device_fd, int use_bc);
/*
@@ -147,9 +146,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
}
@@ -284,7 +281,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, -1, NULL, use_bc, side_cb);
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
@@ -328,7 +325,6 @@ list_devices(void)
basedevice[255], /* Base device filename for ports */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
info[1024], /* Info string */
uri[1024]; /* Device URI */
@@ -360,15 +356,10 @@ list_devices(void)
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
NULL, uri, sizeof(uri)))
{
snprintf(info, sizeof(info), "%s LPT #%d", make_model, i + 1);
cupsBackendReport("direct", uri, make_model, info, device_id, NULL);
}
printf("direct %s \"%s\" \"%s LPT #%d\" \"%s\"\n", uri,
make_model, make_model, i + 1, device_id);
else
{
snprintf(info, sizeof(info), "LPT #%d", i + 1);
cupsBackendReport("direct", uri, NULL, info, NULL, NULL);
}
printf("direct %s \"Unknown\" \"LPT #%d\"\n", uri, i + 1);
close(fd);
}
@@ -570,7 +561,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__) || defined(__FreeBSD_kernel__)
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
int i; /* Looping var */
int fd; /* File descriptor */
char device[255]; /* Device filename */
@@ -616,11 +607,9 @@ list_devices(void)
*/
static void
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? */
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 */
@@ -628,9 +617,6 @@ 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))
@@ -653,7 +639,6 @@ 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;
+17 -53
Ver Arquivo
@@ -25,7 +25,6 @@
*/
#include "backend-private.h"
#include <limits.h>
#ifdef __hpux
# include <sys/time.h>
#else
@@ -142,13 +141,10 @@ 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 snmp_fd, /* I - SNMP socket or -1 if none */
http_addr_t *addr, /* I - Address of device */
int use_bc, /* I - Use back-channel? */
void (*side_cb)(int, int, int, http_addr_t *, int))
/* I - Side-channel callback */
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 nfds; /* Maximum file descriptor value + 1 */
fd_set input, /* Input set for reading */
@@ -162,18 +158,15 @@ 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, snmp_fd=%d, "
"addr=%p, use_bc=%d, side_cb=%p)\n",
print_fd, device_fd, snmp_fd, addr, use_bc, side_cb);
"DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d, "
"side_cb=%p)\n",
print_fd, device_fd, use_bc, side_cb);
/*
* If we are printing data from a print driver on stdin, ignore SIGTERM
@@ -219,7 +212,7 @@ backendRunLoop(
FD_SET(print_fd, &input);
if (use_bc)
FD_SET(device_fd, &input);
if (!print_bytes && side_cb)
if (side_cb)
FD_SET(CUPS_SC_FD, &input);
FD_ZERO(&output);
@@ -228,10 +221,7 @@ backendRunLoop(
if (use_bc || side_cb)
{
timeout.tv_sec = 5;
timeout.tv_usec = 0;
if (select(nfds, &input, &output, NULL, &timeout) < 0)
if (select(nfds, &input, &output, NULL, NULL) < 0)
{
/*
* Pause printing to clear any pending errors...
@@ -239,8 +229,8 @@ backendRunLoop(
if (errno == ENXIO && offline != 1)
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
fputs("STATE: +offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
offline = 1;
}
else if (errno == EINTR && total_bytes == 0)
@@ -260,15 +250,7 @@ backendRunLoop(
*/
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
{
/*
* Do the side-channel request, then start back over in the select
* loop since it may have read from print_fd...
*/
(*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc);
continue;
}
(*side_cb)(print_fd, device_fd, use_bc);
/*
* Check if we have back-channel data ready...
@@ -283,12 +265,6 @@ 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;
}
}
/*
@@ -344,7 +320,7 @@ backendRunLoop(
{
if (paperout != 1)
{
fputs("STATE: +media-empty-warning\n", stderr);
fputs("STATE: +media-empty-error\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Out of paper!\n"));
paperout = 1;
}
@@ -353,7 +329,7 @@ backendRunLoop(
{
if (offline != 1)
{
fputs("STATE: +offline-report\n", stderr);
fputs("STATE: +offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
offline = 1;
}
@@ -369,14 +345,14 @@ backendRunLoop(
{
if (paperout)
{
fputs("STATE: -media-empty-warning\n", stderr);
fputs("STATE: -media-empty-error\n", stderr);
paperout = 0;
}
if (offline)
{
fputs("STATE: -offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
fputs("STATE: -offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
offline = 0;
}
@@ -387,18 +363,6 @@ 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;
}
}
/*
+1 -2
Ver Arquivo
@@ -66,8 +66,7 @@
void
list_devices(void)
{
printf("direct scsi \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("SCSI Printer")));
puts("direct scsi \"Unknown\" \"SCSI Printer\"");
}
+1 -2
Ver Arquivo
@@ -79,8 +79,7 @@ int print_device(const char *resource, int fd, int copies) { return (1); }
void
list_devices(void)
{
printf("direct scsi \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("SCSI Printer")));
puts("direct scsi \"Unknown\" \"SCSI Printer\"");
}
+1 -3
Ver Arquivo
@@ -177,9 +177,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
}
+33 -63
Ver Arquivo
@@ -185,9 +185,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
}
@@ -558,8 +556,7 @@ 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);
if (!print_bytes)
FD_SET(CUPS_SC_FD, &input);
FD_SET(CUPS_SC_FD, &input);
FD_ZERO(&output);
if (print_bytes)
@@ -573,15 +570,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
*/
if (FD_ISSET(CUPS_SC_FD, &input))
{
/*
* Do the side-channel request, then start back over in the select
* loop since it may have read from print_fd...
*/
side_cb(print_fd, device_fd, 1);
continue;
}
/*
* Check if we have back-channel data ready...
@@ -612,7 +601,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (errno != EAGAIN || errno != EINTR)
{
_cupsLangPrintError(_("ERROR: Unable to read print data"));
perror("ERROR: Unable to read print data");
tcsetattr(device_fd, TCSADRAIN, &origopts);
@@ -688,7 +677,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
_cupsLangPrintError(_("ERROR: Unable to write print data"));
perror("ERROR: Unable to write print data");
tcsetattr(device_fd, TCSADRAIN, &origopts);
@@ -734,18 +723,16 @@ 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__) || defined(__FreeBSD_kernel__)
#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
/* Funky hex numbering used for some *
* devices */
#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ || __FreeBSD_kernel__ */
#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ */
#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 */
@@ -780,35 +767,32 @@ 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\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=230400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# else
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# endif /* _ARCH_PPC || powerpc || __powerpc */
}
}
for (i = 0; i < 16; i ++)
{
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\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
}
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\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
device, i + 1);
}
}
@@ -820,9 +804,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);
}
}
}
@@ -925,9 +909,8 @@ list_devices(void)
}
}
#elif defined(__sun)
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
char info[255]; /* Device info/description */
int i, j, n; /* Looping vars */
char device[255]; /* Device filename */
/*
@@ -937,18 +920,14 @@ list_devices(void)
for (i = 0; i < 26; i ++)
{
sprintf(device, "/dev/cua/%c", 'a' + i);
if (!access(device, 0))
{
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
if (access(device, 0) == 0)
# ifdef B115200
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# else
printf("serial serial:%s?baud=38400 \"Unknown\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
# endif /* B115200 */
}
}
/*
@@ -1044,11 +1023,10 @@ list_devices(void)
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
#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 */
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
/*
@@ -1061,11 +1039,8 @@ list_devices(void)
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Standard Serial Port #%d\"\n",
device, i + 1);
}
}
@@ -1139,10 +1114,9 @@ list_devices(void)
}
}
#elif defined(__NetBSD__)
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
char info[255]; /* Device info/description */
int i, j; /* Looping vars */
int fd; /* File descriptor */
char device[255]; /* Device filename */
/*
@@ -1155,11 +1129,8 @@ list_devices(void)
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
{
close(fd);
snprintf(info, sizeof(info),
_cupsLangString(cupsLangDefault(), _("Serial Port #%d")), i + 1);
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", device, info);
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
device, i + 1);
}
}
@@ -1300,7 +1271,6 @@ 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;
-707
Ver Arquivo
@@ -1,707 +0,0 @@
/*
* "$Id$"
*
* SNMP supplies functions 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:
*
* backendSNMPSupplies() - Get the current supplies for a device.
* backend_init_supplies() - Initialize the supplies list.
* backend_walk_cb() - Interpret the supply value responses...
*/
/*
* 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 */
/*
* Local structures...
*/
typedef struct
{
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;
/*
* Local globals...
*/
static http_addr_t current_addr; /* Current address */
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 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 */
/*
* 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);
/*
* '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, 0.5,
backend_walk_cb, NULL);
if (page_count)
*page_count = -1;
if (printer_state)
*printer_state = -1;
if (num_supplies > 0)
{
int i; /* Looping var */
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, 0.5) ||
packet.object_type != CUPS_ASN1_OCTET_STRING)
return (-1);
i = ((packet.object_value.string[0] & 255) << 8) |
(packet.object_value.string[1] & 255);
if (i & CUPS_TC_lowPaper)
fputs("STATE: +media-low-report\n", stderr);
else
fputs("STATE: -media-low-report\n", stderr);
if (i & (CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty))
fputs("STATE: +media-empty-warning\n", stderr);
else
fputs("STATE: -media-empty-warning\n", stderr);
if (i & CUPS_TC_lowToner)
fputs("STATE: +toner-low-report\n", stderr);
else
fputs("STATE: -toner-low-report\n", stderr);
if (i & CUPS_TC_noToner)
fputs("STATE: +toner-empty-warning\n", stderr);
else
fputs("STATE: -toner-empty-warning\n", stderr);
if (i & CUPS_TC_doorOpen)
fputs("STATE: +door-open-report\n", stderr);
else
fputs("STATE: -door-open-report\n", stderr);
if (i & CUPS_TC_jammed)
fputs("STATE: +media-jam-warning\n", stderr);
else
fputs("STATE: -media-jam-warning\n", stderr);
if (i & CUPS_TC_offline)
fputs("STATE: +offline-report\n", stderr);
else
fputs("STATE: -offline-report\n", stderr);
if (i & (CUPS_TC_serviceRequested | CUPS_TC_overduePreventMaint))
fputs("STATE: +service-needed-warning\n", stderr);
else
fputs("STATE: -service-needed-warning\n", stderr);
if (i & CUPS_TC_inputTrayMissing)
fputs("STATE: +input-tray-missing-warning\n", stderr);
else
fputs("STATE: -input-tray-missing-warning\n", stderr);
if (i & CUPS_TC_outputTrayMissing)
fputs("STATE: +output-tray-missing-warning\n", stderr);
else
fputs("STATE: -output-tray-missing-warning\n", stderr);
if (i & CUPS_TC_markerSupplyMissing)
fputs("STATE: +marker-supply-missing-warning\n", stderr);
else
fputs("STATE: -marker-supply-missing-warning\n", stderr);
if (i & CUPS_TC_outputNearFull)
fputs("STATE: +output-area-almost-full-report\n", stderr);
else
fputs("STATE: -output-area-almost-full-report\n", stderr);
if (i & CUPS_TC_outputFull)
fputs("STATE: +output-area-full-warning\n", stderr);
else
fputs("STATE: -output-area-full-warning\n", stderr);
/*
* 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, 0.5) ||
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, 0.5) ||
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;
num_supplies = -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, 0.5) ||
packet.object_type != CUPS_ASN1_OCTET_STRING)
{
strlcpy(description, "Unknown", sizeof(description));
num_supplies = 0;
}
else
strlcpy(description, packet.object_value.string, sizeof(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:
*
* 1 num_supplies
* device description
* supply structures...
*/
if (cupsFileGets(cachefile, value, sizeof(value)))
{
if (sscanf(value, "1 %d", &num_supplies) == 1 &&
num_supplies <= CUPS_MAX_SUPPLIES &&
cupsFileGets(cachefile, value, sizeof(value)))
{
if ((ptr = value + strlen(value) - 1) >= value && *ptr == '\n')
*ptr = '\n';
if (!strcmp(description, value))
cupsFileRead(cachefile, (char *)supplies,
num_supplies * sizeof(backend_supplies_t));
else
num_supplies = -1;
}
else
num_supplies = -1;
}
cupsFileClose(cachefile);
}
/*
* If the cache information isn't correct, scan for supplies...
*/
if (num_supplies < 0)
{
/*
* Walk the printer configuration information...
*/
_cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
_cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry, 0.5,
backend_walk_cb, NULL);
}
/*
* Save the cached information...
*/
if (num_supplies < 0)
num_supplies = 0;
if ((cachefile = cupsFileOpen(cachefilename, "w")) != NULL)
{
cupsFilePrintf(cachefile, "1 %d\n", num_supplies);
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, 0.5,
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,
packet->object_value.string);
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], packet->object_value.string))
{
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;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesDescription.1.%d = \"%s\"\n", i,
packet->object_value.string);
if (i > num_supplies)
num_supplies = i;
strlcpy(supplies[i - 1].name, packet->object_value.string,
sizeof(supplies[0].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;
}
}
/*
* End of "$Id$".
*/
+1166 -229
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+76 -50
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -17,6 +17,7 @@
* Contents:
*
* main() - Send a file to the printer or server.
* side_cb() - Handle side-channel requests...
* wait_bc() - Wait for back-channel data...
*/
@@ -46,6 +47,7 @@
* Local functions...
*/
static void side_cb(int print_fd, int device_fd, int use_bc);
static int wait_bc(int device_fd, int secs);
@@ -61,7 +63,6 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
const char *device_uri; /* Device URI */
char method[255], /* Method in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
@@ -72,9 +73,7 @@ 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 */
current_time, /* Current time */
wait_time; /* Time to wait before shutting down socket */
time_t start_time; /* Time of first connect */
int recoverable; /* Recoverable error shown? */
int contimeout; /* Connection timeout */
int waiteof; /* Wait for end-of-file? */
@@ -86,10 +85,6 @@ 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 */
@@ -122,8 +117,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (argc == 1)
{
printf("network socket \"Unknown\" \"%s\"\n",
_cupsLangString(cupsLangDefault(), _("AppSocket/HP JetDirect")));
puts("network socket \"Unknown\" \"AppSocket/HP JetDirect\"");
return (CUPS_BACKEND_OK);
}
else if (argc < 6 || argc > 7)
@@ -152,9 +146,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
perror("ERROR: unable to open print file");
return (CUPS_BACKEND_FAILED);
}
@@ -165,10 +157,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* Extract the hostname and port number from the URI...
*/
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
method, sizeof(method), username, sizeof(username),
hostname, sizeof(hostname), &port,
resource, sizeof(resource));
@@ -268,9 +257,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
return (CUPS_BACKEND_STOP);
}
fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
_cupsLangPrintf(stderr,
_("INFO: Attempting to connect to host %s on port %d\n"),
hostname, port);
fputs("STATE: +connecting-to-device\n", stderr);
@@ -353,7 +342,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
#ifdef AF_INET6
if (addr->addr.addr.sa_family == AF_INET6)
@@ -367,18 +356,6 @@ 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...
*/
@@ -395,8 +372,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, snmp_fd, &(addr->addr), 1,
backendNetworkSideCB);
tbytes = backendRunLoop(print_fd, device_fd, 1, side_cb);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
@@ -409,13 +385,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
}
/*
* Wait up to 5 seconds to get any pending back-channel data...
* Get any pending back-channel data...
*/
wait_time = time(NULL) + 5;
while (wait_time >= time(&current_time))
if (wait_bc(device_fd, wait_time - current_time) <= 0)
break;
while (wait_bc(device_fd, 5) > 0);
if (waiteof)
{
@@ -431,15 +404,6 @@ 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...
*/
@@ -462,6 +426,68 @@ 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,6 +34,7 @@
# include <fcntl.h>
#endif /* WIN32 */
#define DEBUG
#include "ieee1284.c"
-391
Ver Arquivo
@@ -1,391 +0,0 @@
/*
* "$Id$"
*
* Backend test program for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 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.
* usage() - Show usage information.
*/
/*
* 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>
/*
* Local functions...
*/
static void usage(void);
/*
* '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_query = 0, /* Do PostScript query? */
do_side_tests = 0, /* Test side-channel ops? */
do_trickle = 0; /* Trickle data to backend */
char scheme[255], /* Scheme in URI == backend */
backend[1024]; /* Backend path */
const char *serverbin; /* CUPS_SERVERBIN environment variable */
int back_fds[2], /* Back-channel pipe */
side_fds[2], /* Side-channel socket */
data_fds[2], /* Data pipe */
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], "-ps"))
do_query = 1;
else if (!strcmp(argv[first_arg], "-s"))
do_side_tests = 1;
else if (!strcmp(argv[first_arg], "-t"))
do_trickle = 1;
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_query)
{
pipe(data_fds);
if ((pid = fork()) == 0)
{
/*
* Trickle/query child comes here... Rearrange file descriptors so that
* FD
*/
close(0);
open("/dev/null", O_RDONLY);
close(1);
dup(data_fds[1]);
close(data_fds[0]);
close(data_fds[1]);
close(3);
dup(back_fds[0]);
close(back_fds[0]);
close(back_fds[1]);
close(4);
dup(side_fds[0]);
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
{
/*
* Do a simple PostScript query job to get the default page size.
*/
char buffer[1024]; /* Buffer for response data */
ssize_t bytes; /* Number of bytes of response data */
static const char *ps_query = /* PostScript query file */
"%!\n"
"save\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"
"restore\n"
"\004";
write(1, ps_query, strlen(ps_query));
write(2, "DEBUG: START\n", 13);
while ((bytes = cupsBackChannelRead(buffer, sizeof(buffer), 30.0)) > 0)
write(2, buffer, bytes);
write(2, "\nDEBUG: END\n", 12);
}
exit(0);
}
else if (pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
}
}
else
data_fds[0] = data_fds[1] = -1;
/*
* Execute the backend...
*/
if ((pid = fork()) == 0)
{
/*
* Child comes here...
*/
if (do_trickle || do_query)
{
close(0);
dup(data_fds[0]);
close(data_fds[0]);
close(data_fds[1]);
}
close(3);
dup(back_fds[1]);
close(back_fds[0]);
close(back_fds[1]);
close(4);
dup(side_fds[1]);
close(side_fds[0]);
close(side_fds[1]);
execv(backend, argv + first_arg);
fprintf(stderr, "textbackend: Unable to execute \"%s\": %s\n", backend,
strerror(errno));
return (errno);
}
else if (pid < 0)
{
perror("testbackend: Unable to fork");
return (1);
}
/*
* Parent comes here, setup back and side channel file descriptors...
*/
if (do_trickle || do_query)
{
close(data_fds[0]);
close(data_fds[1]);
}
close(3);
dup(back_fds[0]);
close(back_fds[0]);
close(back_fds[1]);
close(4);
dup(side_fds[0]);
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, 5.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);
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(".1.3.6.1.2.1.43.10.2.1.4.1.1", buffer,
&length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET returned %s, %s\n", 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]);
}
while (wait(&status) != pid);
if (status)
{
if (WIFEXITED(status))
printf("%s exited with status %d!\n", backend, WEXITSTATUS(status));
else
printf("%s crashed with signal %d!\n", backend, WTERMSIG(status));
}
/*
* Exit accordingly...
*/
return (status != 0);
}
/*
* 'usage()' - Show usage information.
*/
static void
usage(void)
{
fputs("Usage: testbackend [-ps] [-s] [-t] device-uri job-id user title copies "
"options [file]\n", stderr);
exit(1);
}
/*
* End of "$Id$".
*/
-83
Ver Arquivo
@@ -1,83 +0,0 @@
/*
* "$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$".
*/
+132 -159
Ver Arquivo
@@ -65,7 +65,7 @@
* cfstr_create_trim() - Create CFString and trim whitespace characters.
* parse_options() - Parse uri options.
* setup_cfLanguage() - Create AppleLanguages array from LANG environment var.
* run_legacy_backend() - Re-exec backend as ppc or i386.
* run_ppc_backend() - Re-exec i386 backend as ppc.
* sigterm_handler() - SIGTERM handler.
* next_line() - Find the next line in a buffer.
* parse_pserror() - Scan the backchannel data for postscript errors.
@@ -92,17 +92,13 @@
#include <cups/debug.h>
#include <cups/sidechannel.h>
#include <cups/i18n.h>
#include "backend-private.h"
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/usb/IOUSBLib.h>
#include <IOKit/IOCFPlugIn.h>
#include <spawn.h>
#include <pthread.h>
extern char **environ;
/*
* WAIT_EOF_DELAY is number of seconds we'll wait for responses from
@@ -278,11 +274,11 @@ static void setup_cfLanguage(void);
static void soft_reset();
static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__)
static pid_t child_pid; /* Child PID */
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
static void run_ppc_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
static void sigterm_handler(int sig); /* SIGTERM handler */
#endif /* __i386__ || __x86_64__ */
#endif /* __i386__ */
#ifdef PARSE_PS_ERRORS
static const char *next_line (const char *buffer);
@@ -361,14 +357,9 @@ print_device(const char *uri, /* I - Device URI */
if (!g.make || !g.model)
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
if (!g.make)
fputs("DEBUG: USB make string is NULL!\n", stderr);
if (!g.model)
fputs("DEBUG: USB model string is NULL!\n", stderr);
return (CUPS_BACKEND_STOP);
_cupsLangPrintf(stderr,
_("ERROR: Unable to create make and model strings\n"));
return CUPS_BACKEND_STOP;
}
fputs("STATE: +connecting-to-device\n", stderr);
@@ -395,18 +386,17 @@ print_device(const char *uri, /* I - Device URI */
status = registry_open(&driverBundlePath);
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__)
/*
* If we were unable to load the class drivers for this printer it's
* probably because they're ppc or i386. In this case try to run this
* backend as i386 or ppc executables so we can use them...
* If we were unable to load the class drivers for this printer it's probably because they're ppc-only.
* In this case try to fork & exec this backend as a ppc executable so we can use them...
*/
if (status == -2)
{
run_legacy_backend(argc, argv, print_fd);
run_ppc_backend(argc, argv, print_fd);
/* Never returns here */
}
#endif /* __i386__ || __x86_64__ */
#endif /* __i386__ */
if (status == -2)
{
@@ -419,13 +409,12 @@ print_device(const char *uri, /* I - Device URI */
strlcpy(print_buffer, "USB class driver", sizeof(print_buffer));
fputs("STATE: +apple-missing-usbclassdriver-error\n", stderr);
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
fprintf(stderr, "DEBUG: Could not load %s\n", print_buffer);
_cupsLangPrintf(stderr, _("FATAL: Could not load %s\n"), print_buffer);
if (driverBundlePath)
CFRelease(driverBundlePath);
return (CUPS_BACKEND_STOP);
return CUPS_BACKEND_STOP;
}
if (driverBundlePath)
@@ -437,9 +426,8 @@ print_device(const char *uri, /* I - Device URI */
countdown -= PRINTER_POLLING_INTERVAL;
if (countdown <= 0)
{
_cupsLangPuts(stderr,
_("INFO: Waiting for printer to become available...\n"));
fprintf(stderr, "DEBUG: USB printer status: 0x%08x\n", (int)status);
_cupsLangPrintf(stderr, _("INFO: Printer busy (status:0x%08x)\n"),
(int)status);
countdown = SUBSEQUENT_LOG_INTERVAL; /* subsequent log entries, every 15 seconds */
}
}
@@ -484,9 +472,8 @@ print_device(const char *uri, /* I - Device URI */
if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL))
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
fputs("DEBUG: Couldn't create side-channel thread!\n", stderr);
return (CUPS_BACKEND_STOP);
_cupsLangPuts(stderr, _("WARNING: Couldn't create side channel\n"));
return CUPS_BACKEND_STOP;
}
}
@@ -502,9 +489,8 @@ print_device(const char *uri, /* I - Device URI */
if (pthread_create(&read_thread_id, NULL, read_thread, NULL))
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error!\n"));
fputs("DEBUG: Couldn't create read thread!\n", stderr);
return (CUPS_BACKEND_STOP);
_cupsLangPuts(stderr, _("WARNING: Couldn't create read channel\n"));
return CUPS_BACKEND_STOP;
}
/*
@@ -518,11 +504,11 @@ print_device(const char *uri, /* I - Device URI */
while (status == noErr && copies-- > 0)
{
_cupsLangPuts(stderr, _("INFO: Sending print data...\n"));
_cupsLangPuts(stderr, _("INFO: Sending data\n"));
if (print_fd != STDIN_FILENO)
{
fputs("PAGE: 1 1\n", stderr);
fputs("PAGE: 1 1", stderr);
lseek(print_fd, 0, SEEK_SET);
}
@@ -586,9 +572,8 @@ print_device(const char *uri, /* I - Device URI */
}
else if (errno != EAGAIN)
{
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
perror("DEBUG: select");
return (CUPS_BACKEND_STOP);
_cupsLangPrintf(stderr, _("ERROR: select() returned %d\n"), (int)errno);
return CUPS_BACKEND_STOP;
}
}
@@ -619,8 +604,7 @@ print_device(const char *uri, /* I - Device URI */
if (errno != EAGAIN || errno != EINTR)
{
_cupsLangPuts(stderr, _("ERROR: Unable to read print data!\n"));
perror("DEBUG: read");
perror("ERROR: Unable to read print data");
return CUPS_BACKEND_STOP;
}
@@ -648,12 +632,14 @@ print_device(const char *uri, /* I - Device URI */
status = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
/*
* Ignore timeout errors, but retain the number of bytes written to
* avoid sending duplicate data (<rdar://problem/6254911>)...
* Ignore timeout errors...
*/
if (status == kIOUSBTransactionTimeout)
{
status = 0;
bytes = 0;
}
if (status || bytes < 0)
{
@@ -662,11 +648,8 @@ print_device(const char *uri, /* I - Device URI */
*/
OSStatus err = (*g.classdriver)->Abort(g.classdriver);
_cupsLangPuts(stderr, _("ERROR: Unable to send print data!\n"));
fprintf(stderr, "DEBUG: USB class driver WritePipe returned %ld\n",
(long)status);
fprintf(stderr, "DEBUG: USB class driver Abort returned %ld\n",
(long)err);
_cupsLangPrintf(stderr, _("ERROR: %ld: (canceled:%ld)\n"),
(long)status, (long)err);
status = CUPS_BACKEND_STOP;
break;
}
@@ -755,7 +738,6 @@ print_device(const char *uri, /* I - Device URI */
* Force the read thread to exit...
*/
g.wait_eof = 0;
pthread_kill(read_thread_id, SIGTERM);
}
}
@@ -1026,23 +1008,25 @@ static Boolean list_device_cb(void *refcon,
{
CFStringRef make = NULL, model = NULL, serial = NULL;
char uristr[1024], makestr[1024], modelstr[1024], serialstr[1024];
char optionsstr[1024], idstr[1024], make_modelstr[1024];
char optionsstr[1024], idstr[1024];
copy_deviceinfo(deviceIDString, &make, &model, &serial);
CFStringGetCString(deviceIDString, idstr, sizeof(idstr),
kCFStringEncodingUTF8);
backendGetMakeModel(idstr, make_modelstr, sizeof(make_modelstr));
modelstr[0] = '/';
if (!make ||
!CFStringGetCString(make, makestr, sizeof(makestr),
kCFStringEncodingUTF8))
CFStringGetCString(deviceIDString, idstr, sizeof(idstr),
kCFStringEncodingUTF8);
if (make)
CFStringGetCString(make, makestr, sizeof(makestr),
kCFStringEncodingUTF8);
else
strcpy(makestr, "Unknown");
if (!model ||
!CFStringGetCString(model, &modelstr[1], sizeof(modelstr)-1,
kCFStringEncodingUTF8))
if (model)
CFStringGetCString(model, &modelstr[1], sizeof(modelstr)-1,
kCFStringEncodingUTF8);
else
strcpy(modelstr + 1, "Printer");
optionsstr[0] = '\0';
@@ -1057,8 +1041,18 @@ static Boolean list_device_cb(void *refcon,
httpAssembleURI(HTTP_URI_CODING_ALL, uristr, sizeof(uristr), "usb", NULL, makestr, 0, modelstr);
strncat(uristr, optionsstr, sizeof(uristr));
cupsBackendReport("direct", uristr, make_modelstr, make_modelstr, idstr,
NULL);
/*
* Fix common HP 1284 bug...
*/
if (!strcasecmp(makestr, "Hewlett-Packard"))
strcpy(makestr, "HP");
if (!strncasecmp(modelstr + 1, "hp ", 3))
_cups_strcpy(modelstr + 1, modelstr + 4);
printf("direct %s \"%s %s\" \"%s %s USB\" \"%s\"\n", uristr, makestr,
&modelstr[1], makestr, &modelstr[1], idstr);
release_deviceinfo(&make, &model, &serial);
CFRelease(deviceIDString);
@@ -1140,8 +1134,8 @@ static Boolean find_device_cb(void *refcon,
if (!keepLooking && g.status_timer != NULL)
{
fputs("STATE: -offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
fputs("STATE: -offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
CFRelease(g.status_timer);
g.status_timer = NULL;
@@ -1158,8 +1152,8 @@ static Boolean find_device_cb(void *refcon,
static void status_timer_cb(CFRunLoopTimerRef timer,
void *info)
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is offline.\n"));
fputs("STATE: +offline-error\n", stderr);
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
if (getenv("CLASS") != NULL)
{
@@ -1195,10 +1189,8 @@ static void copy_deviceinfo(CFStringRef deviceIDString,
if (make != NULL)
*make = copy_value_for_key(deviceIDString, makeKeys);
if (model != NULL)
*model = copy_value_for_key(deviceIDString, modelKeys);
if (serial != NULL)
*serial = copy_value_for_key(deviceIDString, serialKeys);
}
@@ -1286,9 +1278,11 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
}
}
#ifdef DEBUG
char bundlestr[1024];
CFStringGetCString(bundle, bundlestr, sizeof(bundlestr), kCFStringEncodingUTF8);
fprintf(stderr, "DEBUG: load_classdriver(%s) (kr:0x%08x)\n", bundlestr, (int)kr);
#endif /* DEBUG */
return kr;
}
@@ -1713,8 +1707,8 @@ static void setup_cfLanguage(void)
lang[0] = CFStringCreateWithCString(kCFAllocatorDefault, requestedLang, kCFStringEncodingUTF8);
langArray = CFArrayCreate(kCFAllocatorDefault, (const void **)lang, sizeof(lang) / sizeof(lang[0]), &kCFTypeArrayCallBacks);
CFPreferencesSetValue(CFSTR("AppleLanguages"), langArray, kCFPreferencesCurrentApplication, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
fprintf(stderr, "DEBUG: usb: AppleLanguages=\"%s\"\n", requestedLang);
CFPreferencesSetAppValue(CFSTR("AppleLanguages"), langArray, kCFPreferencesCurrentApplication);
DEBUG_printf((stderr, "DEBUG: usb: AppleLanguages = \"%s\"\n", requestedLang));
CFRelease(lang[0]);
CFRelease(langArray);
@@ -1724,42 +1718,36 @@ static void setup_cfLanguage(void)
}
#pragma mark -
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__)
/*!
* @function run_legacy_backend
* @function run_ppc_backend
*
* @abstract Starts child backend process running as a ppc or i386 executable.
* @abstract Starts child backend process running as a ppc executable.
*
* @result Never returns; always calls exit().
*
* @discussion
*/
static void run_legacy_backend(int argc,
char *argv[],
int fd)
static void run_ppc_backend(int argc,
char *argv[],
int fd)
{
int i;
int exitstatus = 0;
int childstatus;
pid_t waitpid_status;
char *my_argv[32];
char *usb_legacy_status;
char *usb_ppc_status;
/*
* If we're running as x86_64 or i386 and couldn't load the class driver
* (because it's ppc or i386), then try to re-exec ourselves in ppc or i386
* mode to try again. If we don't have a ppc or i386 architecture we may be
* running with the same architecture again so guard against this by setting
* and testing an environment variable...
*/
/*
* If we're running as i386 and couldn't load the class driver (because they'it's
* ppc-only) then try to re-exec ourselves in ppc mode to try again. If we don't have
* a ppc architecture we may be running i386 again so guard against this by setting
* and testing an environment variable...
*/
usb_ppc_status = getenv("USB_PPC_STATUS");
# ifdef __x86_64__
usb_legacy_status = getenv("USB_I386_STATUS");
# else
usb_legacy_status = getenv("USB_PPC_STATUS");
# endif /* __x86_64__ */
if (!usb_legacy_status)
if (usb_ppc_status == NULL)
{
/*
* Setup a SIGTERM handler then block it before forking...
@@ -1768,9 +1756,6 @@ static void run_legacy_backend(int argc,
struct sigaction action; /* POSIX signal action */
sigset_t newmask, /* New signal mask */
oldmask; /* Old signal mask */
char usbpath[1024]; /* Path to USB backend */
const char *cups_serverbin;/* Path to CUPS binaries */
memset(&action, 0, sizeof(action));
sigaddset(&action.sa_mask, SIGTERM);
@@ -1781,62 +1766,55 @@ static void run_legacy_backend(int argc,
sigaddset(&newmask, SIGTERM);
sigprocmask(SIG_BLOCK, &newmask, &oldmask);
/*
* Set the environment variable...
*/
# ifdef __x86_64__
setenv("USB_I386_STATUS", "1", false);
# else
setenv("USB_PPC_STATUS", "1", false);
# endif /* __x86_64__ */
/*
* Tell the kernel to use the specified CPU architecture...
*/
# ifdef __x86_64__
cpu_type_t cpu = CPU_TYPE_I386;
# else
cpu_type_t cpu = CPU_TYPE_POWERPC;
# endif /* __x86_64__ */
size_t ocount = 1;
posix_spawnattr_t attrs;
if (!posix_spawnattr_init(&attrs))
if ((child_pid = fork()) == 0)
{
posix_spawnattr_setsigdefault(&attrs, &oldmask);
if (posix_spawnattr_setbinpref_np(&attrs, 1, &cpu, &ocount) || ocount != 1)
{
# ifdef __x86_64__
perror("DEBUG: Unable to set binary preference to i386");
# else
perror("DEBUG: Unable to set binary preference to ppc");
# endif /* __x86_64__ */
_cupsLangPrintf(stderr, _("Unable to use legacy USB class driver!\n"));
exit(CUPS_BACKEND_STOP);
}
/*
* Child comes here...
*/
setenv("USB_PPC_STATUS", "1", false);
/*
* Unblock signals before doing the exec...
*/
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_DFL;
sigaction(SIGTERM, &action, NULL);
sigprocmask(SIG_SETMASK, &oldmask, NULL);
/*
* Tell the kernel the next exec call should favor the ppc architecture...
*/
int mib[] = { CTL_KERN, KERN_AFFINITY, 1, 1 };
int namelen = 4;
sysctl(mib, namelen, NULL, NULL, NULL, 0);
/*
* Set up the arguments and call exec...
*/
for (i = 0; i < argc && i < (sizeof(my_argv)/sizeof(my_argv[0])) - 1; i++)
my_argv[i] = argv[i];
my_argv[i] = NULL;
execv("/usr/libexec/cups/backend/usb", my_argv);
perror("/usr/libexec/cups/backend/usb");
exit(errno);
}
/*
* Set up the arguments and call posix_spawn...
*/
if ((cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
cups_serverbin = CUPS_SERVERBIN;
snprintf(usbpath, sizeof(usbpath), "%s/backend/usb", cups_serverbin);
for (i = 0; i < argc && i < (sizeof(my_argv) / sizeof(my_argv[0])) - 1; i ++)
my_argv[i] = argv[i];
my_argv[i] = NULL;
if (posix_spawn(&child_pid, usbpath, NULL, &attrs, my_argv, environ))
else if (child_pid < 0)
{
fprintf(stderr, "DEBUG: Unable to exec %s: %s\n", usbpath,
strerror(errno));
_cupsLangPrintf(stderr, _("Unable to use legacy USB class driver!\n"));
exit(CUPS_BACKEND_STOP);
/*
* Error - couldn't fork a new process!
*/
perror("fork");
exit(errno);
}
/*
@@ -1852,33 +1830,28 @@ static void run_legacy_backend(int argc,
close(fd);
close(1);
fprintf(stderr, "DEBUG: Started usb(legacy) backend (PID %d)\n",
(int)child_pid);
fprintf(stderr, "DEBUG: Started usb(ppc) backend (PID %d)\n", (int)child_pid);
while ((waitpid_status = waitpid(child_pid, &childstatus, 0)) == (pid_t)-1 && errno == EINTR)
usleep(1000);
if (WIFSIGNALED(childstatus))
{
exitstatus = CUPS_BACKEND_STOP;
fprintf(stderr, "DEBUG: usb(legacy) backend %d crashed on signal %d!\n",
child_pid, WTERMSIG(childstatus));
exitstatus = WTERMSIG(childstatus);
fprintf(stderr, "DEBUG: usb(ppc) backend %d crashed on signal %d!\n", child_pid, exitstatus);
}
else
{
if ((exitstatus = WEXITSTATUS(childstatus)) != 0)
fprintf(stderr,
"DEBUG: usb(legacy) backend %d stopped with status %d!\n",
child_pid, exitstatus);
fprintf(stderr, "DEBUG: usb(ppc) backend %d stopped with status %d!\n", child_pid, exitstatus);
else
fprintf(stderr, "DEBUG: usb(legacy) backend %d exited with no errors\n",
child_pid);
fprintf(stderr, "DEBUG: PID %d exited with no errors\n", child_pid);
}
}
else
{
fputs("DEBUG: usb(legacy) backend running native again\n", stderr);
exitstatus = CUPS_BACKEND_STOP;
fputs("DEBUG: usb child running i386 again\n", stderr);
exitstatus = ENOENT;
}
exit(exitstatus);
@@ -1898,7 +1871,7 @@ static void sigterm_handler(int sig)
exit(1);
}
#endif /* __i386__ || __x86_64__ */
#endif /* __i386__ */
#ifdef PARSE_PS_ERRORS
-819
Ver Arquivo
@@ -1,819 +0,0 @@
/*
* "$Id$"
*
* Libusb interface code for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-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"
* 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.
*/
if (poll(pfds, 2, -1) > 0)
{
if (pfds[0].revents & POLLIN)
{
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
{
while (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 && errno != EAGAIN && errno != EINTR)
break;
}
if (pfds[1].revents & POLLIN)
tbytes += side_cb(printer, print_fd);
}
}
/*
* 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 - 2))
length = (((unsigned)buffer[1] & 255) << 8) +
((unsigned)buffer[0] & 255);
if (length > (bufsize - 2))
length = bufsize - 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))
{
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
return (0);
}
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$".
*/
+15 -39
Ver Arquivo
@@ -5,7 +5,7 @@
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -28,6 +28,7 @@
* Include necessary headers.
*/
#include "ieee1284.c"
#include <sys/select.h>
@@ -36,8 +37,7 @@
*/
static int open_device(const char *uri, int *use_bc);
static void side_cb(int print_fd, int device_fd, int snmp_fd,
http_addr_t *addr, int use_bc);
static void side_cb(int print_fd, int device_fd, int use_bc);
/*
@@ -80,14 +80,6 @@ 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
@@ -181,17 +173,7 @@ print_device(const char *uri, /* I - Device URI */
lseek(print_fd, 0, SEEK_SET);
}
#ifdef __sun
/*
* CUPS STR #3028: Solaris' usbprn driver apparently does not support
* select() or poll(), so we can't support the sidechannel either...
*/
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, NULL);
#else
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, side_cb);
#endif /* __sun */
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
@@ -228,7 +210,6 @@ list_devices(void)
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
/*
* Try to open each USB device...
*/
@@ -264,8 +245,8 @@ list_devices(void)
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
cupsBackendReport("direct", device_uri, make_model, make_model,
device_id, NULL);
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
close(fd);
}
@@ -292,15 +273,15 @@ list_devices(void)
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
make_model, sizeof(make_model),
"usb", device_uri, sizeof(device_uri)))
cupsBackendReport("direct", device_uri, make_model, make_model,
device_id, NULL);
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
make_model, make_model, i + 1, device_id);
close(fd);
}
}
#elif defined(__hpux)
#elif defined(__osf)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
int i; /* Looping var */
char device[255]; /* Device filename */
@@ -433,10 +414,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);
}
}
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
@@ -561,11 +543,9 @@ open_device(const char *uri, /* I - Device URI */
*/
static void
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? */
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 */
@@ -573,9 +553,6 @@ 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))
@@ -598,7 +575,6 @@ 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;
+11 -6
Ver Arquivo
@@ -3,7 +3,7 @@
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -30,7 +30,14 @@
# include <ApplicationServices/ApplicationServices.h>
#endif /* __APPLE__ */
#include "backend-private.h"
#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>
#ifdef WIN32
# include <io.h>
@@ -55,11 +62,9 @@ int print_device(const char *uri, const char *hostname,
* Include the vendor-specific USB implementation...
*/
#ifdef HAVE_USB_H
# include "usb-libusb.c"
#elif defined(__APPLE__)
#ifdef __APPLE__
# include "usb-darwin.c"
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# include "usb-unix.c"
#else
/*
+12 -15
Ver Arquivo
@@ -1,16 +1,13 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
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
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
+2 -45
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,7 +15,6 @@
include ../Makedefs
TARGETS = lpc lpq lpr lprm
OBJS = lpc.o lpq.o lpr.o lprm.o
@@ -27,20 +26,6 @@ OBJS = lpc.o lpq.o lpr.o lprm.o
all: $(TARGETS)
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all object files...
#
@@ -61,21 +46,7 @@ depend:
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
#
# Install programs...
#
install-exec:
install: all
$(INSTALL_DIR) -m 755 $(BINDIR)
$(INSTALL_BIN) lpq $(BINDIR)
$(INSTALL_BIN) lpr $(BINDIR)
@@ -90,20 +61,6 @@ install-exec:
fi
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall all targets...
#
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -355,8 +355,8 @@ show_jobs(const char *command, /* I - Command name */
};
DEBUG_printf(("show_jobs(http=%p, dest=%p, user=%p, id=%d, longstatus%d)\n",
http, dest, user, id, longstatus));
DEBUG_printf(("show_jobs(%08x, %08x, %08x, %d, %d)\n", http, dest, user, id,
longstatus));
if (http == NULL)
return (0);
+123 -30
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -14,7 +14,8 @@
*
* Contents:
*
* main() - Parse options and send files for printing.
* main() - Parse options and send files for printing.
* sighandler() - Signal catcher for when we print from stdin...
*/
/*
@@ -29,6 +30,25 @@
#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.
@@ -48,18 +68,28 @@ 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 */
cups_dest_t *dest; /* Selected destination */
int num_dests; /* Number of destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Selected destination */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
int deletefile; /* Delete file after print? */
char buffer[8192]; /* Copy buffer */
ssize_t bytes; /* Bytes copied */
off_t filesize; /* Size of temp file */
int temp; /* Temporary file descriptor */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Signal action */
struct sigaction oldaction; /* Old signal action */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
_cupsSetLocale(argv);
deletefile = 0;
printer = NULL;
dest = NULL;
num_dests = 0;
dests = NULL;
num_options = 0;
options = NULL;
num_files = 0;
@@ -228,7 +258,10 @@ main(int argc, /* I - Number of command-line arguments */
if ((instance = strrchr(printer, '/')) != NULL)
*instance++ = '\0';
if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
if ((dest = cupsGetDest(printer, instance, num_dests, dests)) != NULL)
{
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options,
@@ -322,7 +355,10 @@ main(int argc, /* I - Number of command-line arguments */
if (printer == NULL)
{
if ((dest = cupsGetNamedDest(NULL, NULL, NULL)) != NULL)
if (num_dests == 0)
num_dests = cupsGetDests(&dests);
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL)
{
printer = dest->name;
@@ -351,7 +387,7 @@ main(int argc, /* I - Number of command-line arguments */
else
val = "LPDEST";
if (printer && !cupsGetNamedDest(NULL, printer, NULL))
if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
_cupsLangPrintf(stderr,
_("%s: Error - %s environment variable names "
"non-existent destination \"%s\"!\n"),
@@ -382,38 +418,72 @@ main(int argc, /* I - Number of command-line arguments */
unlink(files[i]);
}
}
else if ((job_id = cupsCreateJob(CUPS_HTTP_DEFAULT, printer,
title ? title : "(stdin)",
num_options, options)) > 0)
else
{
http_status_t status; /* Write status */
const char *format; /* Document format */
ssize_t bytes; /* Bytes read */
num_files = 1;
#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;
if (cupsGetOption("raw", num_options, options))
format = CUPS_FORMAT_RAW;
else if ((format = cupsGetOption("document-format", num_options,
options)) == NULL)
format = CUPS_FORMAT_AUTO;
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 */
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)
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
_cupsLangPrintf(stderr,
_("%s: Error - unable to queue from stdin - %s\n"),
argv[0], httpStatus(status));
_("%s: Error - unable to create temporary file "
"\"%s\" - %s\n"),
argv[0], tempfile, strerror(errno));
return (1);
}
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
job_id = 0;
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 (job_id < 1)
@@ -426,6 +496,29 @@ 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$".
*/
+119 -57
Ver Arquivo
@@ -37,13 +37,19 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
http_t *http; /* HTTP connection to server */
int i; /* Looping var */
int job_id; /* Job ID */
const char *name; /* Destination printer */
const char *dest; /* Destination printer */
char *instance; /* Pointer to instance name */
cups_dest_t *dest, /* Destination */
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 */
*defdest; /* Default destination */
int did_cancel; /* Did we cancel something? */
http_encryption_t encryption; /* Encryption? */
_cupsSetLocale(argv);
@@ -52,9 +58,26 @@ main(int argc, /* I - Number of command-line arguments */
* Setup to cancel individual print jobs...
*/
did_cancel = 0;
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
name = defdest ? defdest->name : NULL;
op = IPP_CANCEL_JOB;
job_id = 0;
dest = NULL;
response = NULL;
http = NULL;
encryption = cupsEncryption();
/*
* 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;
/*
* Process command-line arguments...
@@ -66,7 +89,10 @@ main(int argc, /* I - Number of command-line arguments */
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
encryption = HTTP_ENCRYPT_REQUIRED;
httpEncryption(http, encryption);
cupsSetEncryption(encryption);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
@@ -76,26 +102,25 @@ main(int argc, /* I - Number of command-line arguments */
case 'P' : /* Cancel jobs on a printer */
if (argv[i][2])
name = argv[i] + 2;
dest = argv[i] + 2;
else
{
i ++;
name = argv[i];
dest = argv[i];
}
if ((instance = strchr(name, '/')) != NULL)
if ((instance = strchr(dest, '/')) != NULL)
*instance = '\0';
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, name,
NULL)) == NULL)
if (cupsGetDest(dest, NULL, num_dests, dests) == NULL)
{
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s\"!\n"),
argv[0], name);
goto error;
argv[0], dest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return(1);
}
cupsFreeDests(1, dest);
break;
case 'U' : /* Username */
@@ -110,7 +135,7 @@ main(int argc, /* I - Number of command-line arguments */
_("%s: Error - expected username after "
"\'-U\' option!\n"),
argv[0]);
goto error;
return (1);
}
cupsSetUser(argv[i]);
@@ -130,24 +155,34 @@ main(int argc, /* I - Number of command-line arguments */
_("%s: Error - expected hostname after "
"\'-h\' option!\n"),
argv[0]);
goto error;
return (1);
}
else
cupsSetServer(argv[i]);
}
if (defdest)
cupsFreeDests(1, defdest);
httpClose(http);
cupsFreeDests(num_dests, dests);
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
name = defdest ? defdest->name : NULL;
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
encryption)) == NULL)
{
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
return (1);
}
num_dests = cupsGetDests2(http, &dests);
defdest = cupsGetDest(NULL, NULL, num_dests, dests);
dest = defdest ? defdest->name : NULL;
break;
default :
_cupsLangPrintf(stderr,
_("%s: Error - unknown option \'%c\'!\n"),
argv[0], argv[i][1]);
goto error;
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
else
{
@@ -155,17 +190,11 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel a job or printer...
*/
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, argv[i], NULL)) != NULL)
cupsFreeDests(1, dest);
if (dest)
if (isdigit(argv[i][0] & 255) &&
cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
{
name = argv[i];
job_id = 0;
}
else if (isdigit(argv[i][0] & 255))
{
name = NULL;
dest = NULL;
op = IPP_CANCEL_JOB;
job_id = atoi(argv[i]);
}
else if (!strcmp(argv[i], "-"))
@@ -174,23 +203,64 @@ main(int argc, /* I - Number of command-line arguments */
* Cancel all jobs
*/
job_id = -1;
op = IPP_PURGE_JOBS;
}
else
{
_cupsLangPrintf(stderr,
_("%s: Error - unknown destination \"%s\"!\n"),
argv[0], argv[i]);
goto error;
dest = argv[i];
job_id = 0;
}
if (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0) != IPP_OK)
/*
* 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)
{
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
goto error;
}
did_cancel = 1;
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
}
/*
@@ -198,27 +268,19 @@ main(int argc, /* I - Number of command-line arguments */
* (or default) printer...
*/
if (!did_cancel && cupsCancelJob2(CUPS_HTTP_DEFAULT, name, 0, 0) != IPP_OK)
if (response == NULL)
if (!cupsCancelJob(dest, 0))
{
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
goto error;
cupsFreeDests(num_dests, dests);
httpClose(http);
return (1);
}
if (defdest)
cupsFreeDests(1, defdest);
cupsFreeDests(num_dests, dests);
httpClose(http);
return (0);
/*
* If we get here there was an error, so clean up...
*/
error:
if (defdest)
cupsFreeDests(1, defdest);
return (1);
}
+56 -61
Ver Arquivo
@@ -1,61 +1,56 @@
# 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
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
# 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
+28 -221
Ver Arquivo
@@ -3,7 +3,7 @@
#
# CGI makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -15,43 +15,11 @@
include ../Makedefs
LIBOBJS = \
help-index.o \
html.o \
ipp-var.o \
search.o \
template.o \
var.o
OBJS = \
$(LIBOBJS) \
admin.o \
classes.o \
help.o \
jobs.o \
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)
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
#
@@ -61,27 +29,12 @@ TARGETS = \
all: $(TARGETS)
#
# Make library targets...
#
libs: $(LIBTARGETS) $(UNITTESTS)
#
# Make unit tests...
#
unittests: $(UNITTARGETS)
#
# Clean all object files...
#
clean:
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
$(RM) libcupscgi.so libcupscgi.sl libcupscgi.dylib
$(RM) $(OBJS) $(TARGETS)
#
@@ -96,21 +49,7 @@ depend:
# Install all targets...
#
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
#
# Install programs...
#
install-exec:
install: all
$(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
for file in $(CGIS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
@@ -123,44 +62,6 @@ install-exec:
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) libcupscgi.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcupscgi.a
#
# Uninstall all targets...
#
@@ -170,93 +71,13 @@ 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
#
# Automatic API help files...
# libcgi.a
#
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
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)
libcgi.a: $(LIBOBJS)
echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
@@ -267,91 +88,77 @@ libcupscgi.a: $(LIBOBJS)
# admin.cgi
#
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ admin.o -lcupscgi $(LIBS)
$(CC) $(LDFLAGS) -o $@ admin.o libcgi.a $(LIBS)
#
# classes.cgi
#
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ classes.o -lcupscgi $(LIBS)
$(CC) $(LDFLAGS) -o $@ classes.o libcgi.a $(LIBS)
#
# help.cgi
#
help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
help.cgi: help.o ../Makedefs libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ help.o -lcupscgi $(LIBS)
$(CC) $(LDFLAGS) -o $@ help.o libcgi.a $(LIBS)
#
# jobs.cgi
#
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
$(CC) $(LDFLAGS) -o $@ jobs.o libcgi.a $(LIBS)
#
# printers.cgi
#
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
$(CC) $(LDFLAGS) -o $@ printers.o libcgi.a $(LIBS)
#
# testcgi
#
testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
testcgi: testcgi.o ../Makedefs libcgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
echo Testing CGI API...
./testcgi
$(CC) $(LDFLAGS) -o $@ testcgi.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
#
# testhi
#
testhi: testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
testhi: testhi.o ../Makedefs libcgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
echo Testing help index API...
./testhi
$(CC) $(LDFLAGS) -o $@ testhi.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
#
# testtemplate
#
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
testtemplate: testtemplate.o ../Makedefs libcgi.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/libcups.a \
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcgi.a ../cups/libcups.a \
$(COMMONLIBS) $(SSLLIBS) $(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) $(LIBZ) $(LIBGSSAPI)
#
# Dependencies...
#
+615 -1360
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+1 -1
Ver Arquivo
@@ -27,7 +27,7 @@
* Limits...
*/
#define CUPS_PAGE_MAX 100 /* Maximum items per page */
#define CUPS_PAGE_MAX 10 /* Maximum items per page */
/*
+1 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI support library definitions.
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -59,7 +59,6 @@ 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);
@@ -73,8 +72,6 @@ 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);
@@ -94,7 +91,6 @@ 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 const char *cgiText(const char *message);
#endif /* !_CUPS_CGI_H_ */
+52 -137
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,7 +15,6 @@
* 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.
*/
@@ -31,10 +30,8 @@
* Local functions...
*/
static void do_class_op(http_t *http, const char *printer, ipp_op_t op,
const char *title);
static void show_all_classes(http_t *http, const char *username);
static void show_class(http_t *http, const char *printer);
void show_all_classes(http_t *http, const char *username);
void show_class(http_t *http, const char *printer);
/*
@@ -83,9 +80,6 @@ main(int argc, /* I - Number of command-line arguments */
if (!*pclass)
pclass = NULL;
if (pclass)
cgiSetVariable("PRINTER_NAME", pclass);
}
/*
@@ -104,7 +98,7 @@ main(int argc, /* I - Number of command-line arguments */
* Get the default printer...
*/
if (!op || !cgiIsPOST())
if (!op)
{
/*
* Get the default destination...
@@ -144,40 +138,21 @@ main(int argc, /* I - Number of command-line arguments */
else
show_class(http, pclass);
}
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 if (!strcasecmp(op, "print-test-page") && pclass)
cgiPrintTestPage(http, pclass);
else if (!strcasecmp(op, "move-jobs") && pclass)
cgiMoveJobs(http, pclass, 0);
else
{
/*
* Unknown/bad operation...
*/
cgiStartHTML(cgiText(_("Classes")));
if (pclass)
cgiStartHTML(pclass);
else
cgiStartHTML(cgiText(_("Classes")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
@@ -196,94 +171,11 @@ 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...
*/
static void
void
show_all_classes(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
@@ -297,7 +189,9 @@ show_all_classes(http_t *http, /* I - Connection to server */
count; /* Number of classes */
const char *var; /* Form variable */
void *search; /* Search data */
char val[1024]; /* Form variable */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
/*
@@ -333,8 +227,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
@@ -362,8 +255,8 @@ show_all_classes(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
@@ -389,18 +282,40 @@ show_all_classes(http_t *http, /* I - Connection to server */
* Save navigation URLs...
*/
cgiSetVariable("THISURL", "/classes/");
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/classes/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/classes/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
if (first > 0)
{
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
@@ -411,12 +326,12 @@ show_all_classes(http_t *http, /* I - Connection to server */
cgiCopyTemplateLang("classes-header.tmpl");
if (count > CUPS_PAGE_MAX)
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("classes.tmpl");
if (count > CUPS_PAGE_MAX)
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
/*
@@ -443,7 +358,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
* 'show_class()' - Show a single class.
*/
static void
void
show_class(http_t *http, /* I - Connection to server */
const char *pclass) /* I - Name of class */
{
@@ -470,7 +385,7 @@ show_class(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "class.tmpl");
cgiGetAttributes(request, "classes.tmpl");
/*
* Do the request and get back a response...
@@ -515,7 +430,7 @@ show_class(http_t *http, /* I - Connection to server */
* Show the class status...
*/
cgiCopyTemplateLang("class.tmpl");
cgiCopyTemplateLang("classes.tmpl");
/*
* Show jobs for the specified class...
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Online help index routines for the Common UNIX Printing System (CUPS).
* On-line help index routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 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, (int)node->mtime,
node->filename, 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 (n2->score - n1->score);
return (n1->score - n2->score);
if (n1->section && !n2->section)
return (1);
+1 -1
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* Online help index definitions for the Common UNIX Printing System (CUPS).
* On-line help index definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
+6 -12
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Online help CGI for the Common UNIX Printing System (CUPS).
* On-line help CGI for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -86,7 +86,7 @@ main(int argc, /* I - Number of command-line arguments */
{
perror(filename);
cgiStartHTML(cgiText(_("Online Help")));
cgiStartHTML(cgiText(_("Help")));
cgiSetVariable("ERROR", "Unable to load help index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -127,7 +127,7 @@ main(int argc, /* I - Number of command-line arguments */
{
perror(filename);
cgiStartHTML(cgiText(_("Online Help")));
cgiStartHTML(cgiText(_("Help")));
cgiSetVariable("ERROR", "Unable to access help file!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -137,7 +137,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
{
cgiStartHTML(cgiText(_("Online Help")));
cgiStartHTML(cgiText(_("Help")));
cgiSetVariable("ERROR", "Help file not in index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -168,16 +168,13 @@ main(int argc, /* I - Number of command-line arguments */
* Send a standard page header...
*/
cgiStartHTML(cgiText(_("Online Help")));
cgiStartHTML(cgiText(_("Help")));
}
/*
* Do a search as needed...
*/
if (cgiGetVariable("CLEAR"))
cgiSetVariable("QUERY", "");
query = cgiGetVariable("QUERY");
topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
@@ -359,10 +356,7 @@ main(int argc, /* I - Number of command-line arguments */
*/
if (!printable)
{
cgiCopyTemplateLang("help-trailer.tmpl");
cgiEndHTML();
}
else
puts("</BODY>\n</HTML>");
+5 -43
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTML support functions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -14,12 +14,10 @@
*
* Contents:
*
* 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...
* cgi_null_passwd() - Return a NULL password for authentication.
* 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.
*/
/*
@@ -29,14 +27,6 @@
#include "cgi-private.h"
/*
* Local globals...
*/
static const char *cgi_multipart = NULL;
/* Multipart separator, if any */
/*
* Local functions...
*/
@@ -59,18 +49,6 @@ cgiEndHTML(void)
}
/*
* 'cgiEndMultipart()' - End the delivery of a multipart web page.
*/
void
cgiEndMultipart(void)
{
if (cgi_multipart)
printf("\n%s--\n", cgi_multipart);
}
/*
* 'cgiFormEncode()' - Encode a string as a form variable...
*/
@@ -166,9 +144,6 @@ 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");
/*
@@ -182,19 +157,6 @@ 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");
puts("Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
cgi_multipart = "--CUPS-MULTIPART";
}
/*
* 'cgi_null_passwd()' - Return a NULL password for authentication.
*/
+69 -183
Ver Arquivo
@@ -14,11 +14,10 @@
*
* 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.
@@ -114,7 +113,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;
@@ -475,16 +474,10 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
if (cupsLastError() <= IPP_OK_CONFLICT)
{
const char *path = strstr(job_printer_uri, "/printers/");
if (!path)
path = strstr(job_printer_uri, "/classes/");
if (path)
{
cgiFormEncode(uri, path, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
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);
}
if (job_id)
@@ -510,155 +503,6 @@ 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...
*/
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();
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();
cgiEndMultipart();
cupsCancelJob(dest, job_id);
return;
}
/*
* Wait for the job to complete...
*/
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)
{
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();
cgiEndMultipart();
}
/*
* 'cgiPrintTestPage()' - Print a test page.
*/
@@ -690,7 +534,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", datadir);
snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir);
/*
* Point to the printer/class...
@@ -711,6 +555,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNewRequest(IPP_PRINT_JOB);
@@ -725,6 +570,9 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
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...
*/
@@ -1004,7 +852,7 @@ cgiSetIPPObjectVars(
remaining = sizeof(value) - (valptr - value);
if (!strcmp(attr->values[i].string.text, "printer-stopped"))
strlcpy(valptr, _("Printer Paused"), remaining);
strlcpy(valptr, _("Printer Stopped"), 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"))
@@ -1139,7 +987,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);
@@ -1366,8 +1214,9 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
count; /* Number of jobs */
const char *var; /* Form variable */
void *search; /* Search data */
char url[1024], /* Printer URI */
val[1024]; /* Form variable */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
/*
@@ -1408,8 +1257,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
@@ -1437,8 +1285,8 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
@@ -1467,23 +1315,61 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
* Save navigation URLs...
*/
if (dest)
snprintf(val, sizeof(val), "/%s/%s", cgiGetVariable("SECTION"), dest);
else
strlcpy(val, "/jobs/", sizeof(val));
urlend = url + sizeof(url);
cgiSetVariable("THISURL", val);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
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);
}
else
{
if (dest)
snprintf(url, sizeof(url), "/%s/%s?", cgiGetVariable("SECTION"), dest);
else
strlcpy(url, "/jobs/?", sizeof(url));
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);
if (first > 0)
{
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
@@ -1497,12 +1383,12 @@ cgiShowJobs(http_t *http, /* I - Connection to server */
cgiCopyTemplateLang("jobs-header.tmpl");
if (count > CUPS_PAGE_MAX)
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("jobs.tmpl");
if (count > CUPS_PAGE_MAX)
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cupsArrayDelete(jobs);
+1 -1
Ver Arquivo
@@ -77,7 +77,7 @@ main(int argc, /* I - Number of command-line arguments */
* Do the operation...
*/
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
{
/*
* Do the operation...
-38
Ver Arquivo
@@ -1,38 +0,0 @@
_cgiCheckVariables
_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
_cgiText
_helpDeleteIndex
_helpFindNode
_helpLoadIndex
_helpSaveIndex
_helpSearchIndex
+181 -106
Ver Arquivo
@@ -15,7 +15,7 @@
* Contents:
*
* main() - Main entry for CGI.
* do_printer_op() - Do a printer operation.
* print_command() - Send a print command to the printer.
* show_all_printers() - Show all printers...
* show_printer() - Show a single printer.
*/
@@ -32,10 +32,9 @@
* Local functions...
*/
static void do_printer_op(http_t *http, const char *printer, ipp_op_t op,
const char *title);
static void show_all_printers(http_t *http, const char *username);
static void show_printer(http_t *http, const char *printer);
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);
/*
@@ -84,9 +83,6 @@ main(int argc, /* I - Number of command-line arguments */
if (!*printer)
printer = NULL;
if (printer)
cgiSetVariable("PRINTER_NAME", printer);
}
/*
@@ -105,7 +101,7 @@ main(int argc, /* I - Number of command-line arguments */
* Get the default printer...
*/
if (!op || !cgiIsPOST())
if (!op)
{
/*
* Get the default destination...
@@ -145,48 +141,25 @@ main(int argc, /* I - Number of command-line arguments */
else
show_printer(http, printer);
}
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 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
{
/*
* Unknown/bad operation...
*/
cgiStartHTML(cgiText(_("Printers")));
if (printer)
cgiStartHTML(printer);
else
cgiStartHTML(cgiText(_("Printers")));
cgiCopyTemplateLang("error-op.tmpl");
cgiEndHTML();
}
@@ -206,80 +179,122 @@ main(int argc, /* I - Number of command-line arguments */
/*
* 'do_printer_op()' - Do a printer operation.
* 'print_command()' - Send a print command to the printer.
*/
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 */
void
print_command(http_t *http, /* I - Connection to server */
const char *printer, /* I - Printer */
const char *command) /* I - Command to send */
{
ipp_t *request; /* IPP request */
cups_file_t *fp; /* File pointer */
char filename[1024]; /* Temporary file */
ipp_t *request, /* IPP request */
*response; /* IPP response */
char uri[HTTP_MAX_URI], /* Printer URI */
resource[HTTP_MAX_URI]; /* Path for request */
resource[1024], /* POST resource path */
refresh[1024]; /* Refresh URL */
const char *user; /* Username */
/*
* Build a printer request, which requires the following
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
user = "guest";
/*
* Create the CUPS command file to print...
*/
if ((fp = cupsTempFile2(filename, sizeof(filename))) == NULL)
{
cgiStartHTML(cgiText(_("Printer Maintenance")));
cgiSetVariable("MESSAGE", _("Unable to create temporary file:"));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
return;
}
cupsFilePuts(fp, "#CUPS-COMMAND\n");
cupsFilePrintf(fp, "%s\n", command);
cupsFileClose(fp);
/*
* Point to the printer...
*/
snprintf(resource, sizeof(resource), "/printers/%s", printer);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", ippPort(), "/printers/%s", printer);
/*
* Build an IPP_PRINT_JOB request, which requires the following
* attributes:
*
* attributes-charset
* attributes-natural-language
* printer-uri
* requesting-user-name
* document-format
*/
request = ippNewRequest(op);
request = ippNewRequest(IPP_PRINT_JOB);
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...
*/
snprintf(resource, sizeof(resource), "/printers/%s", printer);
ippDelete(cupsDoRequest(http, request, resource));
if ((response = cupsDoFileRequest(http, request, resource,
filename)) != NULL)
{
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
if (cupsLastError() == IPP_NOT_AUTHORIZED)
ippDelete(response);
}
unlink(filename);
if (cupsLastError() <= IPP_OK_CONFLICT)
{
/*
* Automatically reload the printer status page...
*/
cgiFormEncode(uri, resource, sizeof(uri));
snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
}
else 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:"));
}
cgiStartHTML(cgiText(_("Printer Maintenance")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to send maintenance job:"));
else
{
/*
* Redirect successful updates back to the printer page...
*/
cgiSetVariable("PRINTER_NAME", printer);
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");
cgiCopyTemplateLang("maintenance.tmpl");
}
cgiEndHTML();
@@ -290,7 +305,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
* 'show_all_printers()' - Show all printers...
*/
static void
void
show_all_printers(http_t *http, /* I - Connection to server */
const char *user) /* I - Username */
{
@@ -298,13 +313,16 @@ 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 */
ipp_attribute_t *printer, /* Printer object */
*attr; /* Current attribute */
int ascending, /* Order of printers (0 = descending) */
first, /* First printer to show */
count; /* Number of printers */
const char *var; /* Form variable */
void *search; /* Search data */
char val[1024]; /* Form variable */
char url[1024], /* URL for prev/next/this */
*urlptr, /* Position in URL */
*urlend; /* End of URL */
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
@@ -350,8 +368,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
* Get a list of matching job objects.
*/
if ((var = cgiGetVariable("QUERY")) != NULL &&
!cgiGetVariable("CLEAR"))
if ((var = cgiGetVariable("QUERY")) != NULL)
search = cgiCompileSearch(var);
else
search = NULL;
@@ -379,8 +396,8 @@ show_all_printers(http_t *http, /* I - Connection to server */
if (first < 0)
first = 0;
sprintf(val, "%d", count);
cgiSetVariable("TOTAL", val);
sprintf(url, "%d", count);
cgiSetVariable("TOTAL", url);
if ((var = cgiGetVariable("ORDER")) != NULL)
ascending = !strcasecmp(var, "asc");
@@ -392,32 +409,82 @@ 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...
*/
cgiSetVariable("THISURL", "/printers/");
urlend = url + sizeof(url);
if ((var = cgiGetVariable("QUERY")) != NULL)
{
strlcpy(url, "/printers/?QUERY=", sizeof(url));
urlptr = url + strlen(url);
cgiFormEncode(urlptr, var, urlend - urlptr);
urlptr += strlen(urlptr);
strlcpy(urlptr, "&", urlend - urlptr);
urlptr += strlen(urlptr);
}
else
{
strlcpy(url, "/printers/?", sizeof(url));
urlptr = url + strlen(url);
}
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
cgiSetVariable("THISURL", url);
if (first > 0)
{
sprintf(val, "%d", first - CUPS_PAGE_MAX);
cgiSetVariable("PREV", val);
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("PREVURL", url);
}
if ((first + CUPS_PAGE_MAX) < count)
{
sprintf(val, "%d", first + CUPS_PAGE_MAX);
cgiSetVariable("NEXT", val);
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
cgiSetVariable("NEXTURL", url);
}
/*
@@ -428,12 +495,12 @@ show_all_printers(http_t *http, /* I - Connection to server */
cgiCopyTemplateLang("printers-header.tmpl");
if (count > CUPS_PAGE_MAX)
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
cgiCopyTemplateLang("printers.tmpl");
if (count > CUPS_PAGE_MAX)
if (count > 0)
cgiCopyTemplateLang("pager.tmpl");
/*
@@ -460,7 +527,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
* 'show_printer()' - Show a single printer.
*/
static void
void
show_printer(http_t *http, /* I - Connection to server */
const char *printer) /* I - Name of printer */
{
@@ -490,7 +557,7 @@ show_printer(http_t *http, /* I - Connection to server */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
cgiGetAttributes(request, "printer.tmpl");
cgiGetAttributes(request, "printers.tmpl");
/*
* Do the request and get back a response...
@@ -505,6 +572,14 @@ 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)
@@ -535,7 +610,7 @@ show_printer(http_t *http, /* I - Connection to server */
* Show the printer status...
*/
cgiCopyTemplateLang("printer.tmpl");
cgiCopyTemplateLang("printers.tmpl");
/*
* Show jobs for the specified printer...
+2 -11
Ver Arquivo
@@ -47,14 +47,7 @@ cgiCompileSearch(const char *query) /* I - Query string */
char *lword; /* Last word in query */
DEBUG_printf(("cgiCompileSearch(query=\"%s\")\n", query));
/*
* Range check input...
*/
if (!query)
return (NULL);
DEBUG_printf(("help_compile_search(query=\"%s\")\n", query ? query : "(nil)"));
/*
* Allocate a regular expression storage structure...
@@ -174,9 +167,7 @@ cgiCompileSearch(const char *query) /* I - Query string */
* string + RE overhead...
*/
wlen = (sptr - s) + 2 * 4 * wlen + 2 * strlen(prefix) + 11;
if (lword)
wlen += strlen(lword);
wlen = (sptr - s) + 4 * wlen + 2 * strlen(prefix) + 4;
if (wlen > slen)
{
+1 -37
Ver Arquivo
@@ -26,7 +26,6 @@
#include "cgi-private.h"
#include <errno.h>
#include <regex.h>
/*
@@ -237,7 +236,6 @@ 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, "",
@@ -259,7 +257,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;
@@ -426,7 +424,6 @@ 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;
@@ -526,39 +523,6 @@ 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;
+18 -13
Ver Arquivo
@@ -203,10 +203,10 @@ cgiGetVariable(const char *name) /* I - Name of variable */
#ifdef DEBUG
if (var == NULL)
DEBUG_printf(("cgiGetVariable(\"%s\") is returning NULL...\n", name));
printf("cgiGetVariable(\"%s\") is returning NULL...\n", name);
else
DEBUG_printf(("cgiGetVariable(\"%s\") is returning \"%s\"...\n", name,
var->values[var->nvalues - 1]));
printf("cgiGetVariable(\"%s\") is returning \"%s\"...\n", name,
var->values[var->nvalues - 1]);
#endif /* DEBUG */
return ((var == NULL) ? NULL : var->values[var->nvalues - 1]);
@@ -242,6 +242,7 @@ cgiInitialize(void)
*/
setbuf(stdout, NULL);
puts("Content-type: text/plain\n");
#endif /* DEBUG */
/*
@@ -443,8 +444,9 @@ cgi_add_variable(const char *name, /* I - Variable name */
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
DEBUG_printf(("cgi_add_variable: Adding variable \'%s\' with value "
"\'%s\'...\n", name, value));
#ifdef DEBUG
printf("Adding variable \'%s\' with value \'%s\'...\n", name, value);
#endif /* DEBUG */
if (form_count >= form_alloc)
{
@@ -520,7 +522,9 @@ cgi_initialize_get(void)
char *data; /* Pointer to form data string */
DEBUG_puts("cgi_initialize_get: Initializing variables using GET method...");
#ifdef DEBUG
puts("Initializing variables using GET method...");
#endif /* DEBUG */
/*
* Check to see if there is anything for us to read...
@@ -774,7 +778,9 @@ cgi_initialize_post(void)
status; /* Return status */
DEBUG_puts("cgi_initialize_post: Initializing variables using POST method...");
#ifdef DEBUG
puts("Initializing variables using POST method...");
#endif /* DEBUG */
/*
* Check to see if there is anything for us to read...
@@ -925,7 +931,7 @@ cgi_initialize_string(const char *data) /* I - Form data string */
if (s > value)
s --;
while (s >= value && isspace(*s & 255))
while (s >= value && *s == ' ')
*s-- = '\0';
/*
@@ -990,7 +996,7 @@ cgi_sort_variables(void)
int i;
DEBUG_puts("cgi_sort_variables: Sorting variables...");
puts("Sorting variables...");
#endif /* DEBUG */
if (form_count < 2)
@@ -1000,11 +1006,10 @@ cgi_sort_variables(void)
(int (*)(const void *, const void *))cgi_compare_variables);
#ifdef DEBUG
DEBUG_puts("cgi_sort_variables: Sorted variable list is:");
puts("Sorted variable list is:");
for (i = 0; i < form_count; i ++)
DEBUG_printf(("cgi_sort_variables: %d: %s (%d) = \"%s\" ...\n", i,
form_vars[i].name, form_vars[i].nvalues,
form_vars[i].values[0]));
printf("%d: %s (%d) = \"%s\" ...\n", i, form_vars[i].name,
form_vars[i].nvalues, form_vars[i].values[0]);
#endif /* DEBUG */
}
-109
Ver Arquivo
@@ -1,109 +0,0 @@
/*
* "$Id$"
*
* Web search program for www.cups.org.
*
* Copyright 2007-2008 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(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(argv[1], search->sorted);
/*
* Return with no errors...
*/
return (0);
}
/*
* 'list_nodes()' - List nodes in an array...
*/
static void
list_nodes(const char *title, /* I - Title string */
cups_array_t *nodes) /* I - Nodes */
{
help_node_t *node; /* Current node */
printf("%d\n", cupsArrayCount(nodes));
for (node = (help_node_t *)cupsArrayFirst(nodes);
node;
node = (help_node_t *)cupsArrayNext(nodes))
{
if (node->anchor)
printf("%d|%s#%s|%s\n", node->score, node->filename, node->anchor,
node->text);
else
printf("%d|%s|%s\n", node->score, node->filename, node->text);
}
}
/*
* End of "$Id$".
*/
+6 -55
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1993-2006 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -30,20 +30,6 @@ REPLACE = mime.convs mime.types
all:
#
# Make library targets...
#
libs:
#
# Make unit tests...
#
unittests:
#
# Clean all config and object files...
#
@@ -59,17 +45,11 @@ depend:
#
# Install all targets...
# Install files...
#
install: all install-data install-headers install-libs install-exec
#
# Install data files...
#
install-data:
install: all
$(INSTALL_DIR) -m 755 $(SERVERROOT)
for file in $(KEEP); do \
if test -r $(SERVERROOT)/$$file ; then \
$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
@@ -81,15 +61,11 @@ install-data:
done
$(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
-chgrp $(CUPS_GROUP) $(SERVERROOT)/cupsd.conf.default
$(INSTALL_DIR) -m 755 $(DATADIR)/mime
for file in $(REPLACE); do \
if test -r $(DATADIR)/mime/$$file ; then \
$(MV) $(DATADIR)/mime/$$file $(DATADIR)/mime/$$file.O ; \
fi ; \
if test -r $(SERVERROOT)/$$file ; then \
$(MV) $(SERVERROOT)/$$file $(DATADIR)/mime/$$file.O ; \
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
fi ; \
$(INSTALL_DATA) $$file $(DATADIR)/mime ; \
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
done
-if test x$(PAMDIR) != x; then \
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \
@@ -101,27 +77,6 @@ install-data:
fi
#
# Install programs...
#
install-exec:
#
# Install headers...
#
install-headers:
#
# Install libraries...
#
install-libs:
#
# Uninstall files...
#
@@ -131,10 +86,6 @@ 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); \
+4 -46
Ver Arquivo
@@ -6,9 +6,9 @@
# file.
#
# Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
# for troubleshooting...
LogLevel @CUPS_LOG_LEVEL@
# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel info
# Administrator user group...
SystemGroup @CUPS_SYSTEM_GROUPS@
@@ -22,7 +22,6 @@ Listen localhost:@DEFAULT_IPP_PORT@
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseLocalProtocols @CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS@
# Default authentication type, when authentication is required...
DefaultAuthType Basic
@@ -48,46 +47,7 @@ DefaultAuthType Basic
# 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 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_PRINTADMIN_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@
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
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
@@ -108,13 +68,11 @@ DefaultAuthType Basic
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
Order deny,allow
</Limit>
<Limit All>
AuthType Default
Order deny,allow
</Limit>
</Policy>
+51 -41
Ver Arquivo
@@ -7,7 +7,7 @@
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -38,52 +38,62 @@
# 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
application/vnd.cups-banner application/postscript 33 bannertops
application/pdf application/postscript 33 pdftops
application/postscript application/vnd.cups-postscript 66 pstops
application/vnd.hp-HPGL application/postscript 66 hpgltops
application/x-cshell application/postscript 33 texttops
application/x-csource application/postscript 33 texttops
application/x-perl application/postscript 33 texttops
application/x-shell application/postscript 33 texttops
text/plain application/postscript 33 texttops
text/html application/postscript 33 texttops
image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
image/jpeg application/vnd.cups-postscript 66 imagetops
image/tiff application/vnd.cups-postscript 66 imagetops
image/x-bitmap application/vnd.cups-postscript 66 imagetops
image/x-photocd application/vnd.cups-postscript 66 imagetops
image/x-portable-anymap application/vnd.cups-postscript 66 imagetops
image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops
image/x-portable-graymap application/vnd.cups-postscript 66 imagetops
image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops
image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops
image/x-xbitmap application/vnd.cups-postscript 66 imagetops
image/x-xpixmap application/vnd.cups-postscript 66 imagetops
#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
image/x-sun-raster application/vnd.cups-postscript 66 imagetops
########################################################################
#
# Form filter...
#
# This filter does not currently exist, but the file format is defined
# in the IDD and registered with the IANA for future use...
#
#application/vnd.cups-form application/vnd.cups-postscript 33 formtops
########################################################################
#
# Raster filters...
#
image/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
+5 -9
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $"
# "$Id: mime.types 6649 2007-07-11 21:46:42Z 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-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
@@ -33,8 +33,6 @@
# 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
@@ -151,14 +149,12 @@ 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") \
string(0,"RaS2") string(0,"2SaR") \
string(0,"RaS3") string(0,"3SaR")
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
string(0,<1B>@) \
(contains(0,128,<1B>%-12345X) + \
@@ -175,5 +171,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
application/octet-stream
#
# End of "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $".
# End of "$Id: mime.types 6649 2007-07-11 21:46:42Z mike $".
#
-5
Ver Arquivo
@@ -1,5 +0,0 @@
# cups: auth account password session
auth required pam_opendirectory.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so
+32 -113
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $"
dnl "$Id: cups-common.m4 7325 2008-02-18 18:59:46Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -20,19 +20,11 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="1.4b2"
CUPS_VERSION="1.3.6"
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")
@@ -45,8 +37,13 @@ LDFLAGS="${LDFLAGS:=}"
dnl Checks for programs...
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
if test "$INSTALL" = "$ac_install_sh"; then
# Use full path to install-sh script...
INSTALL="`pwd`/install-sh -c"
fi
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(HTMLDOC,htmldoc)
@@ -56,18 +53,7 @@ AC_PATH_PROG(MV,mv)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(RMDIR,rmdir)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(XDGOPEN,xdg-open)
if test "x$XDGOPEN" = x; then
CUPS_HTMLVIEW="htmlview"
else
CUPS_HTMLVIEW="$XDGOPEN"
fi
AC_SUBST(CUPS_HTMLVIEW)
AC_MSG_CHECKING(for install-sh script)
INSTALL="`pwd`/install-sh -c"
AC_SUBST(INSTALL)
AC_MSG_RESULT(using $INSTALL)
AC_PATH_PROG(STRIP,strip)
if test "x$AR" = x; then
AC_MSG_ERROR([Unable to find required library archive command.])
@@ -75,6 +61,9 @@ 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=""
@@ -95,11 +84,14 @@ LIBMALLOC=""
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
if test x$enable_mallinfo = xyes; then
SAVELIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
LIBMALLOC="$LIBS"
LIBS="$SAVELIBS"
AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
if test "$ac_cv_lib_c_mallinfo" = "no"; then
AC_CHECK_LIB(malloc,mallinfo,
LIBS="$LIBS"
LIBMALLOC="-lmalloc"
AC_DEFINE(HAVE_MALLINFO),
LIBS="$LIBS")
fi
fi
AC_SUBST(LIBMALLOC)
@@ -140,9 +132,6 @@ else
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
dnl Check for random number functions...
AC_CHECK_FUNCS(random mrand48 lrand48)
dnl Checks for mkstemp and mkstemps functions.
AC_CHECK_FUNCS(mkstemp mkstemps)
@@ -179,40 +168,6 @@ 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, default=auto])
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, default=no])
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*)
@@ -234,11 +189,8 @@ AC_SUBST(CUPSDLIBS)
dnl See if we have POSIX ACL support...
SAVELIBS="$LIBS"
LIBS=""
AC_ARG_ENABLE(acl, [ --enable-acl enable POSIX ACL support, default=auto])
if test "x$enable_acl" != xno; then
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
CUPSDLIBS="$CUPSDLIBS $LIBS"
fi
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
CUPSDLIBS="$CUPSDLIBS $LIBS"
LIBS="$SAVELIBS"
dnl Check for DBUS support
@@ -252,9 +204,6 @@ AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto
AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
DBUSDIR="$withval")
DBUS_NOTIFIER=""
DBUS_NOTIFIERLIBS=""
if test "x$enable_dbus" != xno; then
AC_PATH_PROG(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" != x; then
@@ -265,23 +214,17 @@ if test "x$enable_dbus" != xno; then
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
CUPSDLIBS="$CUPSDLIBS `$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`)
if $PKGCONFIG --exists glib-2.0 && $PKGCONFIG --exists dbus-glib-1; then
DBUS_NOTIFIER="dbus"
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs glib-2.0` `$PKGCONFIG --libs dbus-glib-1` `$PKGCONFIG --libs dbus-1`"
CFLAGS="$CFLAGS `$PKGCONFIG --cflags glib-2.0`"
fi
dbus_message_iter_init_append,
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
`$PKGCONFIG --libs dbus-1`)
else
AC_MSG_RESULT(no)
DBUSDIR=""
fi
fi
fi
AC_SUBST(DBUSDIR)
AC_SUBST(DBUS_NOTIFIER)
AC_SUBST(DBUS_NOTIFIERLIBS)
dnl Extra platform-specific libraries...
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
@@ -291,11 +234,11 @@ LEGACY_BACKENDS="parallel scsi"
case $uname in
Darwin*)
# FONTS=""
FONTS=""
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"
CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
LIBS="-framework CoreFoundation $LIBS"
dnl Check for framework headers...
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
@@ -315,35 +258,11 @@ 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)
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
if test "x$default_operkey" != xdefault; then
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
elif grep -q system.print.operator /etc/authorization; then
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
else
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
fi])
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))
dnl Check for sandbox/Seatbelt support
AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
;;
esac
@@ -354,5 +273,5 @@ AC_SUBST(FONTS)
AC_SUBST(LEGACY_BACKENDS)
dnl
dnl End of "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $".
dnl End of "$Id: cups-common.m4 7325 2008-02-18 18:59:46Z mike $".
dnl
+28 -62
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $"
dnl "$Id: cups-compiler.m4 7247 2008-01-23 15:13:56Z mike $"
dnl
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -15,57 +15,31 @@ 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])
AC_ARG_ENABLE(debug_printfs, [ --enable-debug-printfs turn on debug printfs, default=no])
AC_ARG_ENABLE(unit_tests, [ --enable-unit-tests turn on unit tests, default=no])
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"
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)
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
[if test x$enable_debug = xyes; then
OPTIM="-g"
fi])
dnl Setup general architecture flags...
AC_ARG_WITH(archflags, [ --with-archflags="flags"
set default architecture flags ])
AC_ARG_WITH(ldarchflags, [ --with-ldarchflags="flags"
set default 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 create 32-bit programs by default
# Only link 32-bit programs - 64-bit is for the shared
# libraries...
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)
@@ -82,11 +56,14 @@ AC_ARG_WITH(arch64flags, [ --with-arch64flags="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])
dnl Update compiler options...
CXXLIBS="${CXXLIBS:=}"
CXXLIBS=""
AC_SUBST(CXXLIBS)
PIEFLAGS=""
@@ -110,9 +87,6 @@ AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
fi)
AC_SUBST(LIBCUPSIMAGEORDER)
PHPOPTIONS=""
AC_SUBST(PHPOPTIONS)
if test -n "$GCC"; then
# Add GCC-specific compiler options...
if test -z "$OPTIM"; then
@@ -144,14 +118,16 @@ if test -n "$GCC"; then
# 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$enable_pie = xyes; then
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, ignoring --enable-pie))
CFLAGS="$OLDCFLAGS"
fi
if test "x$with_optim" = x; then
# Add useful warning options for tracking down problems...
@@ -159,8 +135,6 @@ if test -n "$GCC"; then
# 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
@@ -172,11 +146,6 @@ if test -n "$GCC"; then
# 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*)
@@ -351,6 +320,9 @@ 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"
@@ -522,8 +494,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 LDFLAGS environment"
echo "variables before running configure."
echo "for your platform, or set the CFLAGS, CXXFLAGS, and LDFLAGS"
echo "environment variables before running configure."
;;
esac
fi
@@ -544,12 +516,6 @@ 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...
@@ -558,5 +524,5 @@ case $uname in
esac
dnl
dnl End of "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $".
dnl End of "$Id: cups-compiler.m4 7247 2008-01-23 15:13:56Z mike $".
dnl
+11 -106
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-defaults.m4 8106 2008-11-11 00:57:12Z mike $"
dnl "$Id: cups-defaults.m4 7296 2008-02-12 00:20:32Z mike $"
dnl
dnl Default cupsd configuration settings for the Common UNIX Printing System
dnl (CUPS).
@@ -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/cups_*.po | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
LANGUAGES="`ls -1 locale/*.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
@@ -28,7 +28,11 @@ AC_SUBST(LANGUAGES)
dnl Default ConfigFilePerm
AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
CUPS_CONFIG_FILE_PERM="$withval",
CUPS_CONFIG_FILE_PERM="640")
if test "x$uname" = xDarwin; then
CUPS_CONFIG_FILE_PERM="644"
else
CUPS_CONFIG_FILE_PERM="640"
fi)
AC_SUBST(CUPS_CONFIG_FILE_PERM)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
@@ -39,28 +43,6 @@ 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])
if test "x$enable_browsing" = xno; then
@@ -286,7 +268,7 @@ if test x$default_printcap != xno; then
case $uname in
Darwin*)
if test $uversion -ge 90; then
CUPS_DEFAULT_PRINTCAP="/Library/Preferences/org.cups.printers.plist"
CUPS_DEFAULT_PRINTCAP=""
else
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
fi
@@ -305,63 +287,13 @@ else
CUPS_DEFAULT_PRINTCAP=""
fi
AC_SUBST(CUPS_DEFAULT_PRINTCAP)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
dnl Default LPD config file...
AC_ARG_WITH(lpdconfigfile, [ --with-lpdconfigfile set default LPDConfigFile URI],
default_lpdconfigfile="$withval",
default_lpdconfigfile="default")
if test x$default_lpdconfigfile != xno; then
if test "x$default_lpdconfigfile" = "xdefault"; then
case $uname in
Darwin*)
CUPS_DEFAULT_LPD_CONFIG_FILE="launchd:///System/Library/LaunchDaemons/org.cups.cups-lpd.plist"
;;
*)
if test -d /etc/xinetd.d; then
CUPS_DEFAULT_LPD_CONFIG_FILE="xinetd:///etc/xinetd.d/cups-lpd"
else
CUPS_DEFAULT_LPD_CONFIG_FILE=""
fi
;;
esac
else
CUPS_DEFAULT_LPD_CONFIG_FILE="$default_lpdconfigfile"
fi
else
CUPS_DEFAULT_LPD_CONFIG_FILE=""
fi
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG_FILE, "$CUPS_DEFAULT_LPD_CONFIG_FILE")
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=auto ],
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="9999"
CUPS_MAX_COPIES="999"
else
CUPS_MAX_COPIES="100"
fi)
@@ -413,33 +345,6 @@ AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP
AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl Filters
AC_ARG_ENABLE(bannertops, [ --enable-bannertops build with default banner filter, default=auto ])
AC_ARG_ENABLE(texttops, [ --enable-texttops build with default text filter, default=auto ])
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 8106 2008-11-11 00:57:12Z mike $".
dnl End of "$Id: cups-defaults.m4 7296 2008-02-12 00:20:32Z mike $".
dnl
+10 -59
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $"
dnl "$Id: cups-directories.m4 6976 2007-09-18 20:39:31Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -123,14 +123,12 @@ 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
@@ -165,7 +163,7 @@ if test x$rcdir = x; then
RCSTOP="25"
;;
Linux | GNU | GNU/k*BSD*)
Linux | GNU)
# Linux/HURD seems to choose an init.d directory at random...
if test -d /sbin/init.d; then
# SuSE
@@ -194,12 +192,8 @@ if test x$rcdir = x; then
SunOS*)
# Solaris
if test "x$smfmanifestdir" != x; then
SMFMANIFESTDIR=$smfmanifestdir
else
INITDIR="/etc"
RCSTART="81"
fi
INITDIR="/etc"
RCSTART="81"
;;
*)
@@ -207,7 +201,7 @@ if test x$rcdir = x; then
;;
esac
elif test "x$rcdir" != xno; then
else
if test "x$rclevels" = x; then
INITDDIR="$rcdir"
else
@@ -220,7 +214,6 @@ 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="")
@@ -232,53 +225,10 @@ 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="")
@@ -347,11 +297,12 @@ fi
AC_SUBST(CUPS_FONTPATH)
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH")
# Locale data
if test "$localedir" = "\${datarootdir}/locale"; then
# Locale data (initial assignment allows us not to require autoconf 2.60)
localedir="${localedir:=}"
if test "$localedir" = "\${datarootdir}/locale" -o "$localedir" = ""; then
case "$uname" in
Linux | GNU | *BSD* | Darwin*)
CUPS_LOCALEDIR="$datarootdir/locale"
CUPS_LOCALEDIR="$datadir/locale"
;;
OSF1* | AIX*)
@@ -416,5 +367,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $".
dnl End of "$Id: cups-directories.m4 6976 2007-09-18 20:39:31Z mike $".
dnl
+5 -7
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $"
dnl "$Id$"
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-2008 by Apple Inc.
dnl Copyright 2007 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
@@ -22,10 +22,10 @@ AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service
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, [
@@ -36,11 +36,10 @@ if test x$enable_dnssd != xno; then
AC_DEFINE(HAVE_DNSSD)
AC_DEFINE(HAVE_COREFOUNDATION)
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
DNSSD_BACKEND="dnssd"
;;
*)
# All others...
AC_CHECK_LIB(dns_sd,TXTRecordGetValuePtr,
AC_CHECK_LIB(dns_sd,DNSServiceProcessResult,
AC_DEFINE(HAVE_DNSSD)
DNSSDLIBS="-ldns_sd")
;;
@@ -49,8 +48,7 @@ if test x$enable_dnssd != xno; then
fi
AC_SUBST(DNSSDLIBS)
AC_SUBST(DNSSD_BACKEND)
dnl
dnl End of "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $".
dnl End of "$Id$".
dnl
+11 -22
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $"
dnl "$Id: cups-ldap.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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
@@ -14,39 +14,28 @@ 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(ldap-libs, [ --with-ldap-libs set directory for LDAP library],
AC_ARG_WITH(openldap-libs, [ --with-openldap-libs set directory for OpenLDAP library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
AC_ARG_WITH(ldap-includes, [ --with-ldap-includes set directory for LDAP includes],
AC_ARG_WITH(openldap-includes, [ --with-openldap-includes
set directory for OpenLDAP includes],
CFLAGS="-I$withval $CFLAGS"
CXXFLAGS="-I$withval $CXXFLAGS"
CPPFLAGS="-I$withval $CPPFLAGS",)
LIBLDAP=""
if test x$enable_ldap != xno; then
AC_CHECK_HEADER(ldap.h, [
AC_CHECK_HEADER(ldap.h,
AC_CHECK_LIB(ldap, ldap_initialize,
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))
])
AC_DEFINE(HAVE_LDAP)
AC_DEFINE(HAVE_OPENLDAP)
LIBLDAP="-lldap"))
fi
AC_SUBST(LIBLDAP)
dnl
dnl End of "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $".
dnl End of "$Id: cups-ldap.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+3 -7
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-network.m4 7918 2008-09-08 22:03:01Z mike $"
dnl "$Id: cups-network.m4 7140 2007-12-19 01:47:57Z mike $"
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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,15 +13,11 @@ 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...
@@ -70,5 +66,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 7918 2008-09-08 22:03:01Z mike $".
dnl End of "$Id: cups-network.m4 7140 2007-12-19 01:47:57Z mike $".
dnl
+10 -25
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z mike $"
dnl "$Id: cups-pam.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl PAM stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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,6 @@ 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_WITH(pam_module, [ --with-pam-module specify the PAM module to use, default=auto])
dnl Don't use PAM with AIX...
if test $uname = AIX; then
@@ -31,8 +30,6 @@ if test x$enable_pam != xno; then
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,
@@ -61,33 +58,21 @@ if test x$enable_pam != xno; then
case "$uname" in
Darwin*)
# Darwin, MacOS X
if test "x$with_pam_module" != x; then
PAMFILE="pam.$with_pam_module"
elif test -f /usr/lib/pam/pam_opendirectory.so; then
PAMFILE="pam.opendirectory"
else
PAMFILE="pam.securityserver"
fi
PAMFILE="pam.darwin"
;;
IRIX)
# SGI IRIX
PAMFILE="pam.irix"
;;
*)
# All others; this test might need to be updated
# as Linux distributors move things around...
if test "x$with_pam_module" != x; then
PAMMOD="pam_${with_pam_module}.so"
else
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
fi
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
if test -f /lib/security/$mod; then
PAMMOD="$mod"
break;
fi
done
PAMFILE="pam.std"
;;
@@ -100,5 +85,5 @@ AC_SUBST(PAMLIBS)
AC_SUBST(PAMMOD)
dnl
dnl End of "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z mike $".
dnl End of "$Id: cups-pam.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+6 -9
Ver Arquivo
@@ -3,7 +3,7 @@ dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
dnl
dnl PAP (AppleTalk) stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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,17 +15,14 @@ dnl
# Currently the PAP backend is only supported on MacOS X with the AppleTalk
# SDK installed...
AC_ARG_ENABLE(pap, [ --enable-pap build with AppleTalk support, default=auto])
PAP=""
AC_SUBST(PAP)
if test x$enable_pap != xno -a $uname = Darwin; then
AC_CHECK_HEADER(netat/appletalk.h,[
PAP="pap"
AC_CHECK_HEADER(AppleTalk/at_proto.h)])
if test $uname = Darwin; then
PAP="pap"
AC_CHECK_HEADER(AppleTalk/at_proto.h)
fi
AC_SUBST(PAP)
dnl
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
dnl
+9 -26
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $"
dnl "$Id: cups-pdf.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 by Apple Inc.
dnl Copyright 2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -18,34 +18,17 @@ AC_ARG_ENABLE(pdftops, [ --enable-pdftops build pdftops filter, default=
PDFTOPS=""
if test "x$enable_pdftops" != xno; then
AC_PATH_PROG(CUPS_PDFTOPS, pdftops)
if test "x$CUPS_PDFTOPS" != x; then
AC_DEFINE(HAVE_PDFTOPS)
fi
AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS")
AC_PATH_PROG(CUPS_GHOSTSCRIPT, gs)
if test "x$CUPS_GHOSTSCRIPT" != x; then
AC_DEFINE(HAVE_GHOSTSCRIPT)
fi
AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT")
if test "x$CUPS_PDFTOPS" != x -o "x$CUPS_GHOSTSCRIPT" != x; then
AC_MSG_CHECKING(whether to build pdftops filter)
if test x$enable_pdftops = xyes -o $uname != Darwin; then
PDFTOPS="pdftops"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
elif test x$enable_pdftops = xyes; then
AC_MSG_ERROR(Unable to find pdftops or gs programs!)
exit 1
AC_MSG_CHECKING(whether to build pdftops filter)
if test "x$enable_pdftops" = xyes -o $uname != Darwin; then
PDFTOPS="pdftops"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(PDFTOPS)
dnl
dnl End of "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $".
dnl End of "$Id: cups-pdf.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+5 -10
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-scripting.m4 7915 2008-09-07 22:18:29Z mike $"
dnl "$Id: cups-scripting.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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,13 +51,8 @@ AC_ARG_WITH(php, [ --with-php set PHP interpreter for web interfac
CUPS_PHP="")
if test "x$CUPS_PHP" = x; then
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
AC_PATH_PROG(PHP,php)
CUPS_PHP="$PHP"
fi
AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
@@ -96,5 +91,5 @@ if test "x$CUPS_PYTHON" != x; then
fi
dnl
dnl End of "$Id: cups-scripting.m4 7915 2008-09-07 22:18:29Z mike $".
dnl End of "$Id: cups-scripting.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+4 -65
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $"
dnl "$Id: cups-sharedlibs.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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
@@ -20,122 +20,66 @@ AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, defau
if test x$enable_shared != xno; then
case "$uname" in
SunOS*)
SunOS* | 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)"
;;
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
@@ -144,16 +88,11 @@ 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"
@@ -244,5 +183,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+4 -3
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $"
dnl "$Id: cups-slp.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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
@@ -19,6 +19,7 @@ AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP l
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=""
@@ -34,5 +35,5 @@ AC_SUBST(LIBSLP)
dnl
dnl End of "$Id: cups-slp.m4 7241 2008-01-22 22:34:52Z mike $".
dnl End of "$Id: cups-slp.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+4 -3
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
dnl "$Id: cups-ssl.m4 6649 2007-07-11 21:46:42Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
dnl
dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 2007 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
@@ -22,6 +22,7 @@ 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=""
@@ -123,5 +124,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
dnl End of "$Id: cups-ssl.m4 6649 2007-07-11 21:46:42Z mike $".
dnl
+1 -90
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2008 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -42,21 +42,6 @@
#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...
*/
@@ -84,14 +69,6 @@
#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...
*/
@@ -146,8 +123,6 @@
#endif /* !HAVE_LIBPAM */
#undef HAVE_PAM_PAM_APPL_H
#undef HAVE_PAM_SET_ITEM
#undef HAVE_PAM_SETCRED
/*
@@ -315,10 +290,6 @@
#undef HAVE_LDAP
#undef HAVE_OPENLDAP
#undef HAVE_MOZILLA_LDAP
#undef HAVE_LDAP_SSL_H
#undef HAVE_LDAP_SSL
#undef HAVE_LDAP_REBIND_PROC
/*
@@ -400,20 +371,6 @@
#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?
*/
@@ -464,22 +421,6 @@
#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?
*/
@@ -589,36 +530,6 @@
#undef HAVE_REMOVEFILE
/*
* Do we have <sandbox.h>?
*/
#undef HAVE_SANDBOX_H
/*
* Which random number generator function to use...
*/
#undef HAVE_RANDOM
#undef HAVE_MRAND48
#undef HAVE_LRAND48
/*
* Do we have libusb?
*/
#undef HAVE_USB_H
/*
* Do we have libwrap and tcpd.h?
*/
#undef HAVE_TCPD_H
#endif /* !_CUPS_CONFIG_H_ */
/*
+2 -4
Ver Arquivo
@@ -64,13 +64,11 @@ 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/cups.xml
init/org.cups.cups-lpd.plist
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/drv.man man/lpoptions.man
man/cupsd.conf.man man/lpoptions.man
templates/header.tmpl
$LANGFILES)
+12 -26
Ver Arquivo
@@ -4,7 +4,7 @@
#
# CUPS configuration utility.
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,8 +15,7 @@
#
VERSION="@CUPS_VERSION@"
APIVERSION="1.4"
BUILD="@CUPS_BUILD@"
APIVERSION="1.3"
prefix=@prefix@
exec_prefix=@exec_prefix@
@@ -63,12 +62,11 @@ 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 [--driver] [--image] [--static] --libs"
echo " cups-config [--image] [--static] --libs"
echo " cups-config --serverbin"
echo " cups-config --serverroot"
echo " cups-config --version"
@@ -83,25 +81,18 @@ 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
;;
@@ -113,23 +104,18 @@ while test $# -gt 0; do
;;
--libs)
if test $static = no; then
libs="-lcups $LIBS";
if test $image = yes; then
libs="-lcupsimage $libs"
fi
if test $driver = yes; then
libs="-lcupsdriver $libs"
fi
if test $image = no; then
echo -lcups $LIBS
else
echo -lcupsimage -lcups $IMGLIBS $LIBS
fi
else
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"
if test $image = no; then
echo $libdir/libcups.a $LIBS
else
echo $imagelibdir/libcupsimage.a $libdir/libcups.a $IMGLIBS $LIBS
fi
fi
echo $libs
;;
--serverbin)
echo $cups_serverbin
+324 -384
Ver Arquivo
@@ -1,384 +1,324 @@
# 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
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: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
file.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
file.o: 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
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
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
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
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
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
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 http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
file.32.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
file.32.o: file.c 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
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
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
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
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
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
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 http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
file.64.o: file.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
file.64.o: file.c 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
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
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
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
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
testsnmp.64.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
# 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
+42 -238
Ver Arquivo
@@ -3,7 +3,7 @@
#
# API library Makefile for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2008 by Apple Inc.
# Copyright 2007 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -28,15 +28,12 @@ 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 \
@@ -58,7 +55,6 @@ LIBOBJS = \
ppd.o \
request.o \
sidechannel.o \
snmp.o \
snprintf.o \
string.o \
tempfile.o \
@@ -73,16 +69,13 @@ 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
@@ -98,41 +91,32 @@ HEADERS = \
dir.h \
file.h \
http.h \
i18n.h \
ipp.h \
language.h \
ppd.h \
raster.h \
sidechannel.h \
transcode.h \
versioning.h
transcode.h
#
# Targets in this directory...
#
LIBTARGETS = \
TARGETS = \
$(LIBCUPS) \
$(LIB32CUPS) \
$(LIB64CUPS) \
libcups.a
UNITTARGETS = \
libcups.a \
testadmin \
testarray \
testconflicts \
testcups \
testfile \
testhttp \
testi18n \
testipp \
testlang \
testoptions \
testppd \
testsnmp
TARGETS = \
$(LIBTARGETS)
testppd
#
@@ -142,26 +126,12 @@ TARGETS = \
all: $(TARGETS)
#
# Make library targets...
#
libs: $(LIBTARGETS)
#
# Make unit tests...
#
unittests: $(UNITTARGETS)
#
# Remove object and target files...
#
clean:
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
$(RM) $(OBJS) $(TARGETS)
$(RM) libcups.so libcups.sl libcups.dylib
$(RM) -r 32bit 64bit
@@ -175,50 +145,16 @@ depend:
makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1
$(RM) Dependencies
cp 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
sed -r -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
sed -r -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
$(RM) Dependencies.tmp
#
# Install all targets...
# Install object and target files...
#
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: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
$(INSTALL_DIR) -m 755 $(LIBDIR)
$(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
@@ -226,12 +162,15 @@ install-libs: $(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); \
cp $(LIBCUPS) $(SYMROOT); \
for file in $(TARGETS); do \
cp $$file $(SYMROOT); \
done \
fi
installstatic:
@@ -239,14 +178,18 @@ installstatic:
$(INSTALL_LIB) libcups.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcups.a
installhdrs:
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
for file in $(HEADERS); do \
$(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
done
install32bit:
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
@@ -321,7 +264,7 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
# libcups.2.dylib
#
libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) libcups.exp
libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
echo Linking $@...
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
-install_name $(libdir)/$@ \
@@ -406,19 +349,7 @@ testadmin: testadmin.o libcups.a
testarray: testarray.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(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 \
$(CC) $(LDFLAGS) -o $@ testarray.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
@@ -438,10 +369,8 @@ testcups: testcups.o libcups.a
testfile: testfile.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o libcups.a \
$(CC) $(LDFLAGS) -o $@ testfile.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
echo Running file API tests...
./testfile
#
@@ -450,10 +379,8 @@ testfile: testfile.o libcups.a
testhttp: testhttp.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o libcups.a \
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
echo Running HTTP API tests...
./testhttp
#
@@ -462,10 +389,8 @@ testhttp: testhttp.o libcups.a
testipp: testipp.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o libcups.a \
$(CC) $(LDFLAGS) -o $@ testipp.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
echo Running IPP API tests...
./testipp
#
@@ -474,10 +399,8 @@ testipp: testipp.o libcups.a
testi18n: testi18n.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o libcups.a \
$(CC) $(LDFLAGS) -o $@ testi18n.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
echo Running internationalization API tests...
./testi18n
#
@@ -486,22 +409,8 @@ testi18n: testi18n.o libcups.a
testlang: testlang.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o libcups.a \
$(CC) $(LDFLAGS) -o $@ testlang.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(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) $(COMMONLIBS) $(LIBZ)
echo Running option API tests...
./testoptions
#
@@ -510,19 +419,7 @@ testoptions: testoptions.o libcups.a
testppd: testppd.o libcups.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(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 \
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \
$(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
@@ -532,122 +429,29 @@ testsnmp: testsnmp.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" \
--css ../doc/cups-printable.css \
--header api-array.header --intro api-array.shtml \
--intro api-array.shtml \
array.h array.c >../doc/help/api-array.html
mxmldoc --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 \
--intro api-cups.shtml \
cups.h dest.c getputfile.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c >../doc/help/api-cups.html
mxmldoc --section "Programming" --title "File and Directory APIs" \
--css ../doc/cups-printable.css \
--header api-filedir.header --intro api-filedir.shtml \
--intro api-filedir.shtml \
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
mxmldoc --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 \
--intro api-ppd.shtml \
ppd.h attr.c custom.c emit.c localize.c mark.c page.c \
ppd.c >../doc/help/api-ppd.html
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
--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 >../doc/help/api-httpipp.html
mxmldoc --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 \
>../doc/help/api-filter.html
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
docsets:
echo Generating CUPS API documentation sets...
../tools/makedocset --docset org.cups.overview.docset \
--title "Introduction to CUPS Programming" \
--header api-overview.header --intro api-overview.shtml
../tools/makedocset --docset org.cups.array.docset \
--title "Array API" \
--header api-array.header --intro api-array.shtml \
array.h array.c
../tools/makedocset --docset org.cups.cups.docset \
--title "CUPS API" \
--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
../tools/makedocset --docset org.cups.filedir.docset \
--title "File and Directory APIs" \
--header api-filedir.header --intro api-filedir.shtml \
file.h file.c dir.h dir.c
../tools/makedocset --docset org.cups.ppd.docset \
--title "PPD API" \
--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
../tools/makedocset --docset org.cups.httpipp.docset \
--title "HTTP and IPP APIs" \
--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
../tools/makedocset --docset org.cups.filter.docset \
--title "Filter and Backend Programming" \
--header api-filter.header --intro api-filter.shtml \
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
--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
#
+48 -152
Ver Arquivo
@@ -75,13 +75,11 @@ static void write_option(cups_file_t *dstfp, int order,
/*
* 'cupsAdminCreateWindowsPPD()' - Create the Windows PPD file for a printer.
*
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - PPD file or NULL */
cupsAdminCreateWindowsPPD(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
http_t *http, /* I - Connection to server */
const char *dest, /* I - Printer or class */
char *buffer, /* I - Filename buffer */
int bufsize) /* I - Size of filename buffer */
@@ -123,9 +121,6 @@ cupsAdminCreateWindowsPPD(
if (buffer)
*buffer = '\0';
if (!http)
http = _cupsConnect();
if (!http || !dest || !buffer || bufsize < 2)
return (NULL);
@@ -262,9 +257,9 @@ cupsAdminCreateWindowsPPD(
if ((ptr = strchr(line, ':')) == NULL)
{
snprintf(line, sizeof(line),
_cupsLangString(language, _("Missing value on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
_cupsLangString(language, _("Missing value on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
cupsFileClose(srcfp);
cupsFileClose(dstfp);
@@ -283,7 +278,7 @@ cupsAdminCreateWindowsPPD(
_cupsLangString(language,
_("Missing double quote on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
cupsFileClose(srcfp);
cupsFileClose(dstfp);
@@ -302,7 +297,7 @@ cupsAdminCreateWindowsPPD(
_cupsLangString(language,
_("Bad option + choice on line %d!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
cupsFileClose(srcfp);
cupsFileClose(dstfp);
@@ -345,7 +340,10 @@ cupsAdminCreateWindowsPPD(
if (linenum == 0)
{
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, _("Empty PPD file!"), 1);
snprintf(line, sizeof(line),
_cupsLangString(language, _("Empty PPD file!")),
linenum);
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
cupsFileClose(dstfp);
unlink(buffer);
@@ -388,7 +386,7 @@ cupsAdminCreateWindowsPPD(
{
write_option(dstfp, jclorder ++, "cupsJobSheetsStart", "Start Banner",
"job-sheets", suppattr, defattr, 0, 2);
write_option(dstfp, jclorder, "cupsJobSheetsEnd", "End Banner",
write_option(dstfp, jclorder ++, "cupsJobSheetsEnd", "End Banner",
"job-sheets", suppattr, defattr, 1, 2);
}
@@ -403,8 +401,6 @@ cupsAdminCreateWindowsPPD(
/*
* 'cupsAdminExportSamba()' - Export a printer to Samba.
*
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
@@ -435,7 +431,7 @@ cupsAdminExportSamba(
if (!dest || !ppd || !samba_server || !samba_user || !samba_password)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
_cupsSetError(IPP_INTERNAL_ERROR, NULL);
return (0);
}
@@ -445,7 +441,7 @@ cupsAdminExportSamba(
if ((fp = cupsTempFile2(authfile, sizeof(authfile))) == NULL)
{
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
return (0);
}
@@ -498,7 +494,7 @@ cupsAdminExportSamba(
_("Unable to copy Windows 2000 printer "
"driver files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -533,7 +529,7 @@ cupsAdminExportSamba(
_("Unable to copy CUPS printer driver "
"files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -576,7 +572,7 @@ cupsAdminExportSamba(
_("Unable to install Windows 2000 printer "
"driver files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -621,7 +617,7 @@ cupsAdminExportSamba(
_("Unable to copy Windows 9x printer "
"driver files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -650,7 +646,7 @@ cupsAdminExportSamba(
_("Unable to install Windows 9x printer "
"driver files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -702,7 +698,7 @@ cupsAdminExportSamba(
_("Unable to copy 64-bit Windows printer "
"driver files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -737,7 +733,7 @@ cupsAdminExportSamba(
_("Unable to copy 64-bit CUPS printer driver "
"files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -780,7 +776,7 @@ cupsAdminExportSamba(
_("Unable to install Windows 2000 printer "
"driver files (%d)!")), status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -805,16 +801,13 @@ cupsAdminExportSamba(
"are installed!")),
sizeof(message));
_cupsSetError(IPP_NOT_FOUND, message, 0);
_cupsSetError(IPP_NOT_FOUND, message);
_cupsLangPrintf(logfile, "%s\n", message);
}
if (have_drivers == 0)
{
_cupsSetError(IPP_NOT_FOUND, message, 0);
unlink(authfile);
_cupsSetError(IPP_NOT_FOUND, message);
return (0);
}
@@ -832,7 +825,7 @@ cupsAdminExportSamba(
_("Unable to set Windows printer driver (%d)!")),
status);
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
if (logfile)
_cupsLangPrintf(logfile, "%s\n", message);
@@ -854,12 +847,12 @@ cupsAdminExportSamba(
* The returned settings should be freed with cupsFreeOptions() when
* you are done with them.
*
* @since CUPS 1.3/Mac OS X 10.5@
* @since CUPS 1.3@
*/
int /* O - 1 on success, 0 on failure */
cupsAdminGetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
http_t *http, /* I - Connection to server */
int *num_settings, /* O - Number of settings */
cups_option_t **settings) /* O - Settings */
{
@@ -878,7 +871,7 @@ cupsAdminGetServerSettings(
int /* O - 1 on success, 0 on failure */
_cupsAdminGetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
http_t *http, /* I - Connection to server */
int *num_settings, /* O - Number of settings */
cups_option_t **settings) /* O - Settings */
{
@@ -897,63 +890,9 @@ _cupsAdminGetServerSettings(
* Range check input...
*/
if (!http)
{
/*
* See if we are connected to the same server...
*/
if (cg->http)
{
/*
* Compare the connection hostname, port, and encryption settings to
* the cached defaults; these were initialized the first time we
* connected...
*/
if (strcmp(cg->http->hostname, cg->server) ||
cg->ipp_port != _httpAddrPort(cg->http->hostaddr) ||
(cg->http->encryption != cg->encryption &&
cg->http->encryption == HTTP_ENCRYPT_NEVER))
{
/*
* Need to close the current connection because something has changed...
*/
httpClose(cg->http);
cg->http = NULL;
}
}
/*
* (Re)connect as needed...
*/
if (!cg->http)
{
if ((cg->http = _httpCreate(cupsServer(), ippPort(),
cupsEncryption())) == NULL)
{
if (errno)
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
else
_cupsSetError(IPP_SERVICE_UNAVAILABLE,
_("Unable to connect to host."), 1);
if (num_settings)
*num_settings = 0;
if (settings)
*settings = NULL;
return (0);
}
}
}
if (!http || !num_settings || !settings)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
_cupsSetError(IPP_INTERNAL_ERROR, NULL);
if (num_settings)
*num_settings = 0;
@@ -980,9 +919,9 @@ _cupsAdminGetServerSettings(
snprintf(message, sizeof(message),
_cupsLangString(cupsLangDefault(), _("Open of %s failed: %s")),
_cupsLangString(cupsLangDefault(), _("open of %s failed: %s")),
cupsdconf, strerror(errno));
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
}
}
else
@@ -1019,7 +958,7 @@ _cupsAdminGetServerSettings(
if (!value && strncmp(line, "</", 2))
value = line + strlen(line);
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) && value)
if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
{
char *port; /* Pointer to port number, if any */
@@ -1075,7 +1014,7 @@ _cupsAdminGetServerSettings(
{
in_policy = 0;
}
else if (!strcasecmp(line, "<Limit") && in_policy && value)
else if (!strcasecmp(line, "<Limit") && in_policy)
{
/*
* See if the policy limit is for the Cancel-Job operation...
@@ -1108,7 +1047,7 @@ _cupsAdminGetServerSettings(
{
cancel_policy = 0;
}
else if (!strcasecmp(line, "<Location") && value)
else if (!strcasecmp(line, "<Location"))
{
in_admin_location = !strcasecmp(value, "/admin");
in_location = 1;
@@ -1118,7 +1057,7 @@ _cupsAdminGetServerSettings(
in_admin_location = 0;
in_location = 0;
}
else if (!strcasecmp(line, "Allow") && value &&
else if (!strcasecmp(line, "Allow") &&
strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
#ifdef AF_LOCAL
&& *value != '/'
@@ -1197,12 +1136,12 @@ _cupsAdminGetServerSettings(
/*
* 'cupsAdminSetServerSettings()' - Set settings on the server.
*
* @since CUPS 1.3/Mac OS X 10.5@
* @since CUPS 1.3@
*/
int /* O - 1 on success, 0 on failure */
cupsAdminSetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
http_t *http, /* I - Connection to server */
int num_settings, /* I - Number of settings */
cups_option_t *settings) /* I - Settings */
{
@@ -1218,7 +1157,7 @@ cupsAdminSetServerSettings(
int /* O - 1 on success, 0 on failure */
_cupsAdminSetServerSettings(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
http_t *http, /* I - Connection to server */
int num_settings, /* I - Number of settings */
cups_option_t *settings) /* I - Settings */
{
@@ -1271,12 +1210,9 @@ _cupsAdminSetServerSettings(
* Range check input...
*/
if (!http)
http = _cupsConnect();
if (!http || !num_settings || !settings)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
_cupsSetError(IPP_INTERNAL_ERROR, NULL);
return (0);
}
@@ -1285,12 +1221,12 @@ _cupsAdminSetServerSettings(
* Get the cupsd.conf file...
*/
if (get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
&remote) == HTTP_OK)
if ((status = get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
&remote)) == HTTP_OK)
{
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
{
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
return (0);
}
}
@@ -1447,7 +1383,7 @@ _cupsAdminSetServerSettings(
if (remote)
unlink(cupsdconf);
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
return (0);
}
@@ -1522,8 +1458,6 @@ _cupsAdminSetServerSettings(
!strcasecmp(line, "BrowseAddress") ||
!strcasecmp(line, "BrowseAllow") ||
!strcasecmp(line, "BrowseDeny") ||
!strcasecmp(line, "BrowseLocalProtocols") ||
!strcasecmp(line, "BrowseRemoteProtocols") ||
!strcasecmp(line, "BrowseOrder")) &&
(remote_printers >= 0 || share_printers >= 0))
{
@@ -1540,19 +1474,6 @@ _cupsAdminSetServerSettings(
if (new_remote_printers || new_share_printers)
{
const char *localp = cupsGetOption("BrowseLocalProtocols",
num_settings, settings);
const char *remotep = cupsGetOption("BrowseRemoteProtocols",
num_settings, settings);
if (!localp)
localp = cupsGetOption("BrowseLocalProtocols", cupsd_num_settings,
cupsd_settings);
if (!remotep)
remotep = cupsGetOption("BrowseRemoteProtocols", cupsd_num_settings,
cupsd_settings);
if (new_remote_printers && new_share_printers)
cupsFilePuts(temp,
"# Enable printer sharing and shared printers.\n");
@@ -1567,36 +1488,10 @@ _cupsAdminSetServerSettings(
cupsFilePuts(temp, "BrowseOrder allow,deny\n");
if (new_remote_printers)
{
cupsFilePuts(temp, "BrowseAllow all\n");
if (!remotep)
remotep = CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS;
cupsFilePrintf(temp, "BrowseRemoteProtocols %s\n", remotep);
}
else
cupsFilePuts(temp, "BrowseRemoteProtocols\n");
cupsd_num_settings = cupsAddOption("BrowseRemoteProtocols", remotep,
cupsd_num_settings,
&cupsd_settings);
if (new_share_printers)
{
cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
if (!localp)
localp = CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS;
cupsFilePrintf(temp, "BrowseLocalProtocols %s\n", localp);
}
else
cupsFilePuts(temp, "BrowseLocalProtocols\n");
cupsd_num_settings = cupsAddOption("BrowseLocalProtocols", localp,
cupsd_num_settings,
&cupsd_settings);
}
else
{
@@ -1619,7 +1514,7 @@ _cupsAdminSetServerSettings(
else
{
cupsFilePuts(temp, "# Show general information in error_log.\n");
cupsFilePuts(temp, "LogLevel " CUPS_DEFAULT_LOG_LEVEL "\n");
cupsFilePuts(temp, "LogLevel info\n");
}
}
else if (!strcasecmp(line, "<Policy"))
@@ -1798,7 +1693,8 @@ _cupsAdminSetServerSettings(
else if ((((in_admin_location || in_conf_location || in_root_location) &&
remote_admin >= 0) ||
(in_root_location && share_printers >= 0)) &&
(!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
(((!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny")) &&
!strcasecmp(value, "@LOCAL")) ||
!strcasecmp(line, "Order")))
continue;
else if (in_cancel_job == 2)
@@ -1898,7 +1794,7 @@ _cupsAdminSetServerSettings(
else
{
cupsFilePuts(temp, "# Show general information in error_log.\n");
cupsFilePuts(temp, "LogLevel " CUPS_DEFAULT_LOG_LEVEL "\n");
cupsFilePuts(temp, "LogLevel info\n");
}
}
@@ -2260,7 +2156,7 @@ get_cupsd_conf(
snprintf(message, sizeof(message),
_cupsLangString(cupsLangDefault(), _("stat of %s failed: %s")),
name, strerror(errno));
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
_cupsSetError(IPP_INTERNAL_ERROR, message);
*name = '\0';
@@ -2282,7 +2178,7 @@ get_cupsd_conf(
{
*name = '\0';
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
invalidate_cupsd_cache(cg);
+4 -4
Ver Arquivo
@@ -58,16 +58,16 @@ extern int cupsAdminExportSamba(const char *dest, const char *ppd,
const char *samba_server,
const char *samba_user,
const char *samba_password,
FILE *logfile) _CUPS_API_1_2;
FILE *logfile);
extern char *cupsAdminCreateWindowsPPD(http_t *http, const char *dest,
char *buffer, int bufsize) _CUPS_API_1_2;
char *buffer, int bufsize);
extern int cupsAdminGetServerSettings(http_t *http,
int *num_settings,
cups_option_t **settings) _CUPS_API_1_3;
cups_option_t **settings);
extern int cupsAdminSetServerSettings(http_t *http,
int num_settings,
cups_option_t *settings) _CUPS_API_1_3;
cups_option_t *settings);
# ifdef __cplusplus
-32
Ver Arquivo
@@ -1,32 +0,0 @@
<!--
"$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
Array API header 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"
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/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Header</th>
<th>cups/array.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcups</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>
+20 -152
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
"$Id: api-array.shtml 6649 2007-07-11 21:46:42Z mike $"
Array API introduction for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 2007 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -13,165 +13,33 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<h2 class='title'>Introduction</h2>
<p>The CUPS array API provides a high-performance generic array container.
The contents of the array container can be sorted and the container itself is
designed for optimal speed and memory usage under a wide variety of conditions.
Sorted arrays use a binary search algorithm from the last found or inserted
element to quickly find matching elements in the array. Arrays created with the
optional hash function can often find elements with a single lookup. The
<a href='#cups_array_t'><code>cups_array_t</code></a> type is used when
referring to a CUPS array.</p>
<p>The CUPS array API provides a high-performance generic array
container. The contents of the array container can be sorted and
the container itself is designed for optimal speed and memory
usage under a wide variety of conditions.</p>
<p>The CUPS scheduler (<tt>cupsd</tt>) and many of the CUPS API
functions use the array API to efficiently manage large lists of
data.</p>
<h3><a name='MANAGING_ARRAYS'>Managing Arrays</a></h3>
<h2 class='title'>General Usage</h2>
<p>Arrays are created using either the
<a href='#cupsArrayNew'><code>cupsArrayNew</code></a> or
<a href='#cupsArrayNew2'><code>cupsArrayNew2</code></a> functions. The
first function creates a new array with the specified callback function
and user data pointer:</p>
<p>The <var>&lt;cups/array.h&gt;</var> header file must be
included to use the <tt>cupsArray</tt> functions.</p>
<pre class='example'>
#include &lt;cups/array.h&gt;
<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>
static int compare_func(void *first, void *second, void *user_data);
void *user_data;
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>(compare_func, user_data);
<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>
<p>The comparison function (type
<a href="#cups_arrayfunc_t"><code>cups_arrayfunc_t</code></a>) is called
whenever an element is added to the array and can be <code>NULL</code> to
create an unsorted array. The function returns -1 if the first element should
come before the second, 0 if the first and second elements should have the same
ordering, and 1 if the first element should come after the second.</p>
<h2 class='title'>Compatibility</h2>
<p>The "user_data" pointer is passed to your comparison function. Pass
<code>NULL</code> if you do not need to associate the elements in your array
with additional information.</p>
<p>The <a href='#cupsArrayNew2'><code>cupsArrayNew2</code></a> function adds
two more arguments to support hashed lookups, which can potentially provide
instantaneous ("O(1)") lookups in your array:</p>
<pre class='example'>
#include &lt;cups/array.h&gt;
#define HASH_SIZE 512 /* Size of hash table */
static int compare_func(void *first, void *second, void *user_data);
static int hash_func(void *element, void *user_data);
void *user_data;
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew2'>cupsArrayNew2</a>(compare_func, user_data, hash_func, HASH_SIZE);
</pre>
<p>The hash function (type
<a href="#cups_ahash_func_t"><code>cups_ahash_func_t</code></a>) should return a
number from 0 to (hash_size-1) that (hopefully) uniquely identifies the
element and is called whenever you look up an element in the array with
<a href='#cupsArrayFind'><code>cupsArrayFind</code></a>. The hash size is
only limited by available memory, but generally should not be larger than
16384 to realize any performance improvement.</p>
<p>Once you have created the array, you add elements using the
<a href='#cupsArrayAdd'><code>cupsArrayAdd</code></a>
<a href='#cupsArrayInsert'><code>cupsArrayInsert</code></a> functions.
The first function adds an element to the array, adding the new element
after any elements that have the same order, while the second inserts the
element before others with the same order. For unsorted arrays,
<a href='#cupsArrayAdd'><code>cupsArrayAdd</code></a> appends the element to
the end of the array while
<a href='#cupsArrayInsert'><code>cupsArrayInsert</code></a> inserts the
element at the beginning of the array. For example, the following code
creates a sorted array of character strings:</p>
<pre class='example'>
#include &lt;cups/array.h&gt;
/* Use strcmp() to compare strings - it will ignore the user_data pointer */
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>((<a href='#cups_array_func_t'>cups_array_func_t</a>)strcmp, NULL);
/* Add four strings to the array */
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "One Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Two Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Red Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Blue Fish");
</pre>
<p>Elements are removed using the
<a href='#cupsArrayRemove'><code>cupsArrayRemove</code></a> function, for
example:</p>
<pre class='example'>
#include &lt;cups/array.h&gt;
/* Use strcmp() to compare strings - it will ignore the user_data pointer */
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>((<a href='#cups_array_func_t'>cups_array_func_t</a>)strcmp, NULL);
/* Add four strings to the array */
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "One Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Two Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Red Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Blue Fish");
/* Remove "Red Fish" */
<a href='#cupsArrayRemove'>cupsArrayRemove</a>(array, "Red Fish");
</pre>
<p>Finally, you free the memory used by the array using the
<a href='#cupsArrayDelete'><code>cupsArrayDelete</code></a> function. All
of the memory for the array and hash table (if any) is freed, however <em>CUPS
does not free the elements</em> - if necessary, you must allocate and free the
elements yourself.</p>
<h3><a name='FINDING_AND_ENUMERATING'>Finding and Enumerating Elements</a></h3>
<p>CUPS provides several functions to find and enumerate elements in an
array. Each one sets or updates a "current index" into the array, such that
future lookups will start where the last one left off:</p>
<dl>
<dt><a href='#cupsArrayFind'><code>cupsArrayFind</code></a></dt>
<dd>Returns the first matching element.</dd>
<dt><a href='#cupsArrayFirst'><code>cupsArrayFirst</code></a></dt>
<dd>Returns the first element in the array.</dd>
<dt><a href='#cupsArrayIndex'><code>cupsArrayIndex</code></a></dt>
<dd>Returns the Nth element in the array, starting at 0.</dd>
<dt><a href='#cupsArrayLast'><code>cupsArrayLast</code></a></dt>
<dd>Returns the last element in the array.</dd>
<dt><a href='#cupsArrayNext'><code>cupsArrayNext</code></a></dt>
<dd>Returns the next element in the array.</dd>
<dt><a href='#cupsArrayPrev'><code>cupsArrayPrev</code></a></dt>
<dd>Returns the previous element in the array.</dd>
</dl>
<p>Each of these functions returns <code>NULL</code> when there is no
corresponding element. For example, a simple <code>for</code> loop using the
<a href='#cupsArrayFirst'><code>cupsArrayFirst</code></a> and
<a href='#cupsArrayNext'><code>cupsArrayNext</code></a> functions will
enumerate all of the strings in our previous example:</p>
<pre class='example'>
#include &lt;cups/array.h&gt;
/* Use strcmp() to compare strings - it will ignore the user_data pointer */
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew'>cupsArrayNew</a>((<a href='#cups_array_func_t'>cups_array_func_t</a>)strcmp, NULL);
/* Add four strings to the array */
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "One Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Two Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Red Fish");
<a href='#cupsArrayAdd'>cupsArrayAdd</a>(array, "Blue Fish");
/* Show all of the strings in the array */
char *s;
for (s = (char *)<a href='#cupsArrayFirst'>cupsArrayFirst</a>(array); s != NULL; s = (char *)<a href='#cupsArrayNext'>cupsArrayNext</a>(array))
puts(s);
</pre>
<p>All of these functions require CUPS 1.2 or higher.</p>
-38
Ver Arquivo
@@ -1,38 +0,0 @@
<!--
"$Id: api-cups.header 8087 2008-10-27 21:37:05Z mike $"
CUPS API header 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"
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/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Header</th>
<th>cups/cups.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcups</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
Programming: <a href='api-array.html' target='_top'>Array API</a><br>
Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a><br>
Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
Programming: <a href='api-raster.html' target='_top'>Raster API</a></td>
</tr>
</tbody>
</table></div>
+25 -420
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-cups.shtml 7337 2008-02-22 04:44:04Z mike $"
"$Id: api-cups.shtml 6649 2007-07-11 21:46:42Z mike $"
CUPS API introduction for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 2007 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -13,430 +13,35 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<h2 class='title'>Introduction</h2>
<p>The CUPS API provides the convenience functions needed to support
applications, filters, printer drivers, and backends that need to interface
with the CUPS scheduler.</p>
<p>The CUPS library provides a whole collection of interfaces
needed to support the internal needs of the CUPS software as well
as the needs of applications, filters, printer drivers, and
backends.</p>
<h3><a name='CLIENTS_AND_SERVERS'>Clients and Servers</a></h3>
<p>Unlike the rest of CUPS, the CUPS API library is provided
under the GNU Library General Public License. This means that you
can use the CUPS API library in both proprietary and open-source
programs.</p>
<p>CUPS is based on the Internet Printing Protocol ("IPP"), which allows
clients (applications) to communicate with a server (the scheduler) to get a
list of printers, send print jobs, and so forth. You identify which server
you want to communicate with using a pointer to the opaque structure
<code>http_t</code>. All of the examples in this document use the
<code>CUPS_HTTP_DEFAULT</code> constant, referring to the default connection
to the scheduler. The <a href='api-httpipp.html' target='_top'>HTTP and IPP
APIs</a> document provides more information on server connections.</p>
<h2 class='title'>General Usage</h2>
<h3><a name='PRINTERS_AND_CLASSES'>Printers and Classes</a></h3>
<p>The <var>&lt;cups/cups.h&gt;</var> header file must be included to
use the CUPS functions.</p>
<p>Printers and classes (collections of printers) are accessed through
the <a href="#cups_dest_t"><code>cups_dest_t</code></a> structure which
includes the name (<code>name</code>), instance (<code>instance</code> -
a way of selecting certain saved options/settings), and the options and
attributes associated with that destination (<code>num_options</code> and
<code>options</code>). Destinations are created using the
<a href="#cupsGetDests"><code>cupsGetDests</code></a> function and freed
using the <a href='#cupsFreeDests'><code>cupsFreeDests</code></a> function.
The <a href='#cupsGetDest'><code>cupsGetDest</code></a> function finds a
specific destination for printing:</p>
<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dests;
int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
<a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
/* do something wiith dest */
<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>
<p>Passing <code>NULL</code> to
<a href='#cupsGetDest'><code>cupsGetDest</code></a> for the destination name
will return the default destination. Similarly, passing a <code>NULL</code>
instance will return the default instance for that destination.</p>
<h2 class='title'>Compatibility</h2>
<div class='table'><table summary='Table 1: Printer Attributes' width='80%'>
<caption>Table 1: <a name='TABLE1'>Printer Attributes</a></caption>
<thead>
<tr>
<th>Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"auth-info-required"</td>
<td>The type of authentication required for printing to this
destination: "none", "username,password", "domain,username,password",
or "negotiate" (Kerberos)</td>
</tr>
<tr>
<td>"printer-info"</td>
<td>The human-readable description of the destination such as "My
Laser Printer".</td>
</tr>
<tr>
<td>"printer-is-accepting-jobs"</td>
<td>"1" if the destination is accepting new jobs, "0" if not.</td>
</tr>
<tr>
<td>"printer-is-shared"</td>
<td>"1" if the destination is being shared with other computers, "0" if
not.</td>
</tr>
<tr>
<td>"printer-location"</td>
<td>The human-readable location of the destination such as "Lab 4".</td>
</tr>
<tr>
<td>"printer-make-and-model"</td>
<td>The human-readable make and model of the destination such as "HP
LaserJet 4000 Series".</td>
</tr>
<tr>
<td>"printer-state"</td>
<td>"3" if the destination is idle, "4" if the destination is printing
a job, and "5" if the destination is stopped.</td>
</tr>
<tr>
<td>"printer-state-change-time"</td>
<td>The UNIX time when the destination entered the current state.</td>
</tr>
<tr>
<td>"printer-state-reasons"</td>
<td>Additional comma-delimited state keywords for the destination
such as "media-tray-empty-error" and "toner-low-warning".</td>
</tr>
<tr>
<td>"printer-type"</td>
<td>The <a href='#cups_printer_t'><code>cups_printer_t</code></a>
value associated with the destination.</td>
</tr>
</tbody>
</table></div>
<h3><a name='OPTIONS'>Options</a></h3>
<p>Options are stored in arrays of
<a href='#cups_option_t'><code>cups_option_t</code></a> structures. Each
option has a name (<code>name</code>) and value (<code>value</code>)
associated with it. The <a href='#cups_dest_t'><code>cups_dest_t</code></a>
<code>num_options</code> and <code>options</code> members contain the
default options for a particular destination, along with several informational
attributes about the destination as shown in <a href='#TABLE1'>Table 1</a>.
The <a href='#cupsGetOption'><code>cupsGetOption</code></a> function gets
the value for the named option. For example, the following code lists the
available destinations and their human-readable descriptions:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dests;
int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
int i;
const char *value;
for (i = num_dests, dest = dests; i > 0; i --, dest ++)
if (dest->instance == NULL)
{
value = <a href='#cupsGetOption'>cupsGetOption</a>("printer-info", dest->num_options, dest->options);
printf("%s (%s)\n", dest->name, value ? value : "no description");
}
<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
</pre>
<p>You can create your own option arrays using the
<a href='#cupsAddOption'><code>cupsAddOption</code></a> function, which
adds a single named option to an array:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
int num_options = 0;
<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
/* The returned num_options value is updated as needed */
num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "value", num_options, &amp;options);
/* This adds a second option value */
num_options = <a href='#cupsAddOption'>cupsAddOption</a>("second", "value", num_options, &amp;options);
/* This replaces the first option we added */
num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "new value", num_options, &amp;options);
</pre>
<p>Use a <code>for</code> loop to copy the options from a destination:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
int i;
int num_options = 0;
<a href='#cups_option_t'>cups_option_t</a> *options = NULL;
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
for (i = 0; i < dest->num_options; i ++)
num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value,
num_options, &amp;options);
</pre>
<p>Use the <a href='#cupsFreeOptions'><code>cupsFreeOptions</code></a>
function to free the options array when you are done using it:</p>
<pre class='example'>
<a href='#cupsFreeOptions'>cupsFreeOptions</a>(num_options, options);
</pre>
<h3><a name='PRINT_JOBS'>Print Jobs</a></h3>
<p>Print jobs are identified by a locally-unique job ID number from 1 to
2<sup>31</sup>-1 and have options and one or more files for printing to a
single destination. The <a href='#cupsPrintFile'><code>cupsPrintFile</code></a>
function creates a new job with one file. The following code prints the CUPS
test page file:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
int num_options;
<a href='#cups_option_t'>cups_option_t</a> *options;
int job_id;
/* Print a single file */
job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps",
"Test Print", num_options, options);
</pre>
<p>The <a href='#cupsPrintFiles'><code>cupsPrintFiles</code></a> function
creates a job with multiple files. The files are provided in a
<code>char *</code> array:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
int num_options;
<a href='#cups_option_t'>cups_option_t</a> *options;
int job_id;
char *files[3] = { "file1.pdf", "file2.pdf", "file3.pdf" };
/* Print three files */
job_id = <a href='#cupsPrintFiles'>cupsPrintFiles</a>(dest->name, 3, files, "Test Print", num_options, options);
</pre>
<p>Finally, the <a href='#cupsCreateJob'><code>cupsCreateJob</code></a>
function creates a new job with no files in it. Files are added using the
<a href='#cupsStartDocument'><code>cupsStartDocument</code></a>,
<a href='api-httpipp.html#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>,
and <a href='#cupsFinishDocument'><code>cupsFinishDocument</code></a> functions.
The following example creates a job with 10 text files for printing:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
int num_options;
<a href='#cups_option_t'>cups_option_t</a> *options;
int job_id;
int i;
char buffer[1024];
/* Create the job */
job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files",
num_options, options);
/* If the job is created, add 10 files */
if (job_id > 0)
{
for (i = 1; i &lt;= 10; i ++)
{
snprintf(buffer, sizeof(buffer), "file%d.txt", i);
<a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer,
CUPS_FORMAT_TEXT, i == 10);
snprintf(buffer, sizeof(buffer),
"File %d\n"
"\n"
"One fish,\n"
"Two fish,\n
"Red fish,\n
"Blue fish\n", i);
/* cupsWriteRequestData can be called as many times as needed */
<a href='#cupsWriteRequestData'>cupsWriteRequestData</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
<a href='#cupsFinishDocument'>cupsFinishDocument</a>(CUPS_HTTP_DEFAULT, dest->name);
}
}
</pre>
<p>Once you have created a job, you can monitor its status using the
<a href='#cupsGetJobs'><code>cupsGetJobs</code></a> function, which returns
an array of <a href='#cups_job_t'><code>cups_job_t</code></a> structures.
Each contains the job ID (<code>id</code>), destination name
(<code>dest</code>), title (<code>title</code>), and other information
associated with the job. The job array is freed using the
<a href='#cupsFreeJobs'><code>cupsFreeJobs</code></a> function. The following
example monitors a specific job ID, showing the current job state once every
5 seconds until the job is completed:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
int job_id;
int num_jobs;
<a href='#cups_job_t'>cups_job_t</a> *jobs;
int i;
ipp_jstate_t job_state = IPP_JOB_PENDING;
while (job_state &lt; IPP_JOB_STOPPED)
{
/* Get my jobs (1) with any state (-1) */
num_jobs = <a href='#cupsGetJobs'>cupsGetJobs</a>(&amp;jobs, dest->name, 1, -1);
/* Loop to find my job */
job_state = IPP_JOB_COMPLETED;
for (i = 0; i &lt; num_jobs; i ++)
if (jobs[i].id == job_id)
{
job_state = jobs[i].state;
break;
}
/* Free the job array */
<a href='#cupsFreeJobs'>cupsFreeJobs</a>(num_jobs, jobs);
/* Show the current state */
switch (job_state)
{
case IPP_JOB_PENDING :
printf("Job %d is pending.\n", job_id);
break;
case IPP_JOB_HELD :
printf("Job %d is held.\n", job_id);
break;
case IPP_JOB_PROCESSING :
printf("Job %d is processing.\n", job_id);
break;
case IPP_JOB_STOPPED :
printf("Job %d is stopped.\n", job_id);
break;
case IPP_JOB_CANCELED :
printf("Job %d is canceled.\n", job_id);
break;
case IPP_JOB_ABORTED :
printf("Job %d is aborted.\n", job_id);
break;
case IPP_JOB_COMPLETED :
printf("Job %d is completed.\n", job_id);
break;
}
/* Sleep if the job is not finished */
if (job_state &lt; IPP_JOB_STOPPED)
sleep(5);
}
</pre>
<p>To cancel a job, use the
<a href='#cupsCancelJob'><code>cupsCancelJob</code></a> function with the
job ID:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#cups_dest_t'>cups_dest_t</a> *dest;
int job_id;
<a href='#cupsCancelJob'>cupsCancelJob</a>(dest->name, job_id);
</pre>
<h3><a name='ERROR_HANDLING'>Error Handling</a></h3>
<p>If any of the CUPS API printing functions returns an error, the reason for
that error can be found by calling the
<a href='#cupsLastError'><code>cupsLastError</code></a> and
<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> functions.
<a href='#cupsLastError'><code>cupsLastError</code></a> returns the last IPP
error code
(<a href='api-httpipp.html#ipp_status_t'><code>ipp_status_t</code></a>)
that was encountered, while
<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> returns
a (localized) human-readable string that can be shown to the user. For example,
if any of the job creation functions returns a job ID of 0, you can use
<a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> to show
the reason why the job could not be created:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
int job_id;
if (job_id == 0)
puts(cupsLastErrorString());
</pre>
<h3><a name='PASSWORDS_AND_AUTHENTICATION'>Passwords and Authentication</a></h3>
<p>CUPS supports authentication of any request, including submission of print
jobs. The default mechanism for getting the username and password is to use the
login user and a password from the console.</p>
<p>To support other types of applications, in particular Graphical User
Interfaces ("GUIs"), the CUPS API provides functions to set the default
username and to register a callback function that returns a password string.</p>
<p>The <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a>
function is used to set a password callback in your program. Only one
function can be used at any time.</p>
<p>The <a href="#cupsSetUser"><code>cupsSetUser</code></a> function sets the
current username for authentication. This function can be called by your
password callback function to change the current username as needed.</p>
<p>The following example shows a simple password callback that gets a
username and password from the user:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
const char *
my_password_cb(const char *prompt)
{
char user[65];
puts(prompt);
/* Get a username from the user */
printf("Username: ");
if (fgets(user, sizeof(user), stdin) == NULL)
return (NULL);
/* Strip the newline from the string and set the user */
user[strlen(user) - 1] = '\0';
<a href='#cupsSetUser'>cupsSetUser</a>(user);
/* Use getpass() to ask for the password... */
return (getpass("Password: "));
}
<a href='#cupsSetPasswordCB'>cupsSetPasswordCB</a>(my_password_cb);
</pre>
<p>Similarly, a GUI could display the prompt string in a window with input
fields for the username and password. The username should default to the
string returned by the <a href="#cupsUser"><code>cupsUser</code></a>
function.</p>
<p>Unless otherwise specified, the CUPS API functions require
CUPS 1.1 or higher.</p>
-34
Ver Arquivo
@@ -1,34 +0,0 @@
<!--
"$Id: api-filedir.header 8087 2008-10-27 21:37:05Z mike $"
File and Directory API header 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"
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/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Headers</th>
<th>cups/file.h<br>
cups/dir.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcups</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
Programming: <a href='api-cups.html' target='_top'>CUPS API</a></td>
</tr>
</tbody>
</table></div>
+32 -6
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
"$Id: api-filedir.shtml 6649 2007-07-11 21:46:42Z mike $"
File and directory API introduction for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 2007 by Apple Inc.
Copyright 1997-2005 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -13,19 +13,45 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name="OVERVIEW">Overview</a></h2>
<h2 class='title'>Introduction</h2>
<p>The CUPS file and directory APIs provide portable interfaces
for manipulating files and listing files and directories. Unlike
stdio <code>FILE</code> streams, the <code>cupsFile</code> functions
stdio <tt>FILE</tt> streams, the <tt>cupsFile</tt> functions
allow you to open more than 256 files at any given time. They
also manage the platform-specific details of locking, large file
support, line endings (CR, LF, or CR LF), and reading and writing
files using Flate ("gzip") compression. Finally, you can also
connect, read from, and write to network connections using the
<code>cupsFile</code> functions.</p>
<tt>cupsFile</tt> functions.</p>
<p>The <code>cupsDir</code> functions manage the platform-specific
<p>The <tt>cupsDir</tt> functions manage the platform-specific
details of directory access/listing and provide a convenient way
to get both a list of files and the information (permissions,
size, timestamp, etc.) for each of those files.</p>
<p>The CUPS scheduler (<tt>cupsd</tt>), <tt>mailto</tt> notifier,
and many of the CUPS API functions use these functions for
everything except console (stdin, stdout, stderr) I/O.</p>
<h2 class='title'>General Usage</h2>
<p>The <var>&lt;cups/dir.h&gt;</var> and
<var>&lt;cups/file.h&gt;</var> header files must be included to
use the <tt>cupsDir</tt> and <tt>cupsFile</tt> functions,
respectively.</p>
<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>
<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>
<h2 class='title'>Compatibility</h2>
<p>All of these functions require CUPS 1.2 or higher.</p>
-38
Ver Arquivo
@@ -1,38 +0,0 @@
<!--
"$Id: api-filter.header 8087 2008-10-27 21:37:05Z mike $"
Filter and backend programming header 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"
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/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Headers</th>
<th>cups/backend.h<br>
cups/sidechannel.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcups</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
</tr>
</tbody>
</table></div>
+141 -486
Ver Arquivo
@@ -1,10 +1,9 @@
<!--
"$Id: api-filter.shtml 7962 2008-09-18 17:31:33Z mike $"
"$Id: api-filter.shtml 6649 2007-07-11 21:46:42Z mike $"
Filter and backend programming introduction for the Common UNIX Printing
System (CUPS).
Filter and backend API introduction for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 2007 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -14,396 +13,46 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name="OVERVIEW">Overview</a></h2>
<h2 class='title'>Introduction</h2>
<p>Filters (which include printer drivers and port monitors) and backends
are used to convert job files to a printable format and send that data to the
printer itself. All of these programs use a common interface for processing
print jobs and communicating status information to the scheduler. Each is run
with a standard set of command-line arguments:<p>
<p>The CUPS filter and backend APIs define standard exit codes
and provide access to the backchannel data stream. They are only
used when writing backends, filters, and port monitors.</p>
<dl class="code">
<h2 class='title'>General Usage</h2>
<dt>argv[1]</dt>
<dd>The job ID</dd>
<p>The <var>&lt;cups/backend.h&gt;</var> and
<var>&lt;cups/cups.h&gt;</var> header files must be included to
use the <tt>CUPS_BACKEND_</tt> constants and
<tt>cupsBackChannel</tt> functions, respectively.</p>
<dt>argv[2]</dt>
<dd>The user printing the job</dd>
<p>The <var>&lt;cups/sidechannel.h&gt;</var> header file must be
included to use the <tt>CUPS_SC_</tt> constants and <tt>cupsSideChannel</tt> functions.</p>
<dt>argv[3]</dt>
<dd>The job name/title</dd>
<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>
<dt>argv[4]</dt>
<dd>The number of copies to print</dd>
<dt>argv[5]</dt>
<dd>The options that were provided when the job was submitted</dd>
<dt>argv[6]</dt>
<dd>The file to print (first program only)</dd>
</dl>
<p>The scheduler runs one or more of these programs to print any given job. The
first filter reads from the print file and writes to the standard output, while
the remaining filters read from the standard input and write to the standard
output. The backend is the last filter in the chain and writes to the
device.</p>
<h3><a name="SECURITY">Security Considerations</a></h3>
<p>It is always important to use security programming practices. Filters and
most backends are run as a non-priviledged user, so the major security
consideration is resource utilization - filters should not depend on unlimited
amounts of CPU, memory, or disk space, and should protect against conditions
that could lead to excess usage of any resource like infinite loops and
unbounded recursion. In addition, filters must <em>never</em> allow the user to
specify an arbitrary file path to a separator page, template, or other file
used by the filter since that can lead to an unauthorized disclosure of
information. <em>Always</em> treat input as suspect and validate it!</p>
<p>If you are developing a backend that runs as root, make sure to check for
potential buffer overflows, integer under/overflow conditions, and file
accesses since these can lead to privilege escalations. When writing files,
always validate the file path and <em>never</em> allow a user to determine
where to store a file.</p>
<blockquote><b>Note:</b>
<p><em>Never</em> write files to a user's home directory. Aside from the
security implications, CUPS is a network print service and as such the network
user may not be the same as the local user and/or there may not be a local home
directory to write to.</p>
<p>In addition, some operating systems provide additional security mechanisms
that further limit file system access, even for backends running as root. On
Mac OS X, for example, no backend may write to a user's home directory.</p>
</blockquote>
<h3><a name="TEMPFILES">Temporary Files</a></h3>
<p>Temporary files should be created in the directory specified by the
"TMPDIR" environment variable. The
<a href="#cupsTempFile2"><code>cupsTempFile2</code></a> function can be
used to safely create temporary files in this directory.</p>
<h3><a name="COPIES">Copy Generation</a></h3>
<p>The <code>argv[4]</code> argument specifies the number of copies to produce
of the input file. In general, you should only generate copies if the
<em>filename</em> argument is supplied. The only exception to this are
filters that produce device-independent PostScript output, since the PostScript
filter <var>pstops</var> is responsible for generating copies of PostScript
files.</p>
<h3><a name="EXITCODES">Exit Codes</a></h3>
<p>Filters must exit with status 0 when they successfully generate print data
or 1 when they encounter an error. Backends can return any of the
<a href="#cups_backend_t"><code>cups_backend_t</code></a> constants.</p>
<h3><a name="ENVIRONMENT">Environment Variables</a></h3>
<p>The following environment variables are defined by the printing system
when running print filters and backends:</p>
<dl class="code">
<dt>APPLE_LANGUAGES</dt>
<dd>The Apple language identifier associated with the job
(Mac OS X only).</dd>
<dt>CHARSET</dt>
<dd>The job character set, typically "utf-8".</dd>
<dt>CLASS</dt>
<dd>When a job is submitted to a printer class, contains the name of
the destination printer class. Otherwise this environment
variable will not be set.</dd>
<dt>CONTENT_TYPE</dt>
<dd>The MIME type associated with the file (e.g.
application/postscript).</dd>
<dt>CUPS_CACHEDIR</dt>
<dd>The directory where cache files can be stored. Cache files can be
used to retain information between jobs or files in a job.</dd>
<dt>CUPS_DATADIR</dt>
<dd>The directory where (read-only) CUPS data files can be found.</dd>
<dt>CUPS_FILETYPE</dt>
<dd>The type of file being printed: "job-sheet" for a banner page and
"document" for a regular print file.</dd>
<dt>CUPS_SERVERROOT</dt>
<dd>The root directory of the server.</dd>
<dt>DEVICE_URI</dt>
<dd>The device-uri associated with the printer.</dd>
<dt>FINAL_CONTENT_TYPE</dt>
<dd>The MIME type associated with the printer (e.g.
application/vnd.cups-postscript).</dd>
<dt>LANG</dt>
<dd>The language locale associated with the job.</dd>
<dt>PPD</dt>
<dd>The full pathname of the PostScript Printer Description (PPD)
file for this printer.</dd>
<dt>PRINTER</dt>
<dd>The queue name of the class or printer.</dd>
<dt>RIP_CACHE</dt>
<dd>The recommended amount of memory to use for Raster Image
Processors (RIPs).</dd>
<dt>TMPDIR</dt>
<dd>The directory where temporary files should be created.</dd>
</dl>
<h3><a name="MESSAGES">Communicating with the Scheduler</a></h3>
<p>Filters and backends communicate with the scheduler by writing messages
to the standard error file. The scheduler reads messages from all filters in
a job and processes the message based on its prefix. For example, the following
code sets the current printer state message to "Printing page 5":</p>
<pre class="example">
int page = 5;
fprintf(stderr, "INFO: Printing page %d\n", page);
<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>
<p>Each message is a single line of text starting with one of the following
prefix strings:</p>
<dl class="code">
<h2 class='title'>Compatibility</h2>
<dt>ALERT: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "alert" log level.</dd>
<dt>ATTR: attribute=value [attribute=value]</dt>
<dd>Sets the named printer or job attribute(s). Typically this is used
to set the <code>marker-colors</code>, <code>marker-levels</code>,
<code>marker-message</code>, <code>marker-names</code>,
<code>marker-types</code>, <code>printer-alert</code>, and
<code>printer-alert-description</code> printer attributes. Standard
<code>marker-types</code> values are listed in <a href='#TABLE1'>Table
1</a>.</dd>
<dt>CRIT: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "critical" log
level.</dd>
<dt>DEBUG: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "debug" log level.</dd>
<dt>DEBUG2: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "debug2" log level.</dd>
<dt>EMERG: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "emergency" log
level.</dd>
<dt>ERROR: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "error" log level.
Use "ERROR:" messages for non-persistent processing errors.</dd>
<dt>INFO: message</dt>
<dd>Sets the printer-state-message attribute. If the current log level
is set to "debug2", also adds the specified message to the current error
log file using the "info" log level.</dd>
<dt>NOTICE: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "notice" log level.</dd>
<dt>PAGE: page-number #-copies</dt>
<dt>PAGE: total #-pages</dt>
<dd>Adds an entry to the current page log file. The first form adds
#-copies to the job-media-sheets-completed attribute. The second
form sets the job-media-sheets-completed attribute to #-pages.</dd>
<dt>PPD: keyword=value [keyword=value ...]</dt>
<dd>Changes or adds keywords to the printer's PPD file. Typically
this is used to update installable options or default media settings
based on the printer configuration.</dd>
<dt>STATE: printer-state-reason [printer-state-reason ...]</dt>
<dt>STATE: + printer-state-reason [printer-state-reason ...]</dt>
<dt>STATE: - printer-state-reason [printer-state-reason ...]</dt>
<dd>Sets, adds, or removes printer-state-reason keywords to the
current queue. Typically this is used to indicate persistent media,
ink, toner, and configuration conditions or errors on a printer.
<a href='#TABLE2'>Table 2</a> lists the standard state keywords -
use vendor-prefixed ("com.acme.foo") keywords for custom states.</dd>
<dt>WARNING: message</dt>
<dd>Sets the printer-state-message attribute and adds the specified
message to the current error log file using the "warning" log
level.</dd>
</dl>
<p>Messages without one of these prefixes are treated as if they began with
the "DEBUG:" prefix string.</p>
<p>The <tt>cupsBackChannel</tt> functions require CUPS 1.2 or higher. The <tt>cupsSideChannel</tt> functions require CUPS 1.3 or higher.</p>
<div class='table'><table width='80%' summary='Table 1: Standard marker-types Values'>
<caption>Table 1: <a name='TABLE1'>Standard marker-types Values</a></caption>
<thead>
<tr>
<th>marker-type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>developer</td>
<td>Developer unit</td>
</tr>
<tr>
<td>fuser</td>
<td>Fuser unit</td>
</tr>
<tr>
<td>fuserCleaningPad</td>
<td>Fuser cleaning pad</td>
</tr>
<tr>
<td>fuserOil</td>
<td>Fuser oil</td>
</tr>
<tr>
<td>ink</td>
<td>Ink supply</td>
</tr>
<tr>
<td>opc</td>
<td>Photo conductor</td>
</tr>
<tr>
<td>solidWax</td>
<td>Wax supply</td>
</tr>
<tr>
<td>staples</td>
<td>Staple supply</td>
</tr>
<tr>
<td>toner</td>
<td>Toner supply</td>
</tr>
<tr>
<td>transferUnit</td>
<td>Transfer unit</td>
</tr>
<tr>
<td>wasteInk</td>
<td>Waste ink tank</td>
</tr>
<tr>
<td>wasteToner</td>
<td>Waste toner tank</td>
</tr>
<tr>
<td>wasteWax</td>
<td>Waste wax tank</td>
</tr>
</tbody>
</table></div>
<h2 class='title'>Using the cupsBackChannel APIs</h2>
<br>
<p>The <tt>cupsBackChannel</tt> APIs allow your filters, drivers, and port monitors to read data back from a printer and your backends to send data from a printer to the filters, drivers, and port monitors associated with the current job. Back-channel data is normally sent by the printer in response to a command sent from your program to the printer via <tt>stdout</tt>.</p>
<div class='table'><table width='80%' summary='Table 2: Standard State Keywords'>
<caption>Table 2: <a name='TABLE2'>Standard State Keywords</a></caption>
<thead>
<tr>
<th>Keyword</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>connecting-to-device</td>
<td>Connecting to printer but not printing yet</td>
</tr>
<tr>
<td>cover-open</td>
<td>A cover is open on the printer</td>
</tr>
<tr>
<td>input-tray-missing</td>
<td>An input tray is missing from the printer</td>
</tr>
<tr>
<td>marker-supply-empty</td>
<td>Out of ink</td>
</tr>
<tr>
<td>marker-supply-low</td>
<td>Low on ink</td>
</tr>
<tr>
<td>marker-waste-almost-full</td>
<td>Waste tank almost full</td>
</tr>
<tr>
<td>marker-waste-full</td>
<td>Waste tank full</td>
</tr>
<tr>
<td>media-empty</td>
<td>Out of media</td>
</tr>
<tr>
<td>media-jam</td>
<td>Media is jammed in the printer</td>
</tr>
<tr>
<td>media-low</td>
<td>Low on media</td>
</tr>
<tr>
<td>paused</td>
<td>Stop the printer</td>
</tr>
<tr>
<td>timed-out</td>
<td>Unable to connect to printer</td>
</tr>
<tr>
<td>toner-empty</td>
<td>Out of toner</td>
</tr>
<tr>
<td>toner-low</td>
<td>Low on toner</td>
</tr>
</tbody>
</table></div>
<p>The <tt>cupsBackChannelRead()</tt> function reads data from the printer via the backend. You provide a timeout in seconds along with a buffer pointer and the size of that buffer. It returns the number of bytes or -1 if there was an error. The following code example shows how to poll for back-channel data in your program:</p>
<h3><a name="COMMUNICATING_BACKEND">Communicating with the Backend</a></h3>
<p>Filters can communicate with the backend via the
<a href="#cupsBackChannelRead"><code>cupsBackChannelRead</code></a> and
<a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a>
functions. The
<a href="#cupsBackChannelRead"><code>cupsBackChannelRead</code></a> function
reads data that has been sent back from the device and is typically used to
obtain status and configuration information. For example, the following code
polls the backend for back-channel data:</p>
<pre class="example">
<pre class='command'>
#include &lt;cups/cups.h&gt;
char buffer[8192];
@@ -413,29 +62,83 @@ ssize_t bytes;
bytes = cupsBackChannelRead(buffer, sizeof(buffer), 0.0);
</pre>
<p>Filters can also use <code>select()</code> or <code>poll()</code> on the
back-channel file descriptor (3 or <code>CUPS_BC_FD</code>) to read data only
when it is available.</p>
<p>If you are writing a backend, the <tt>cupsBackChannelWrite()</tt> function sends any back-channel data you have received from the printer to upstream filters in the print filter chain. We recommend using a timeout of 1.0 seconds:</p>
<p>The
<a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a>
function allows you to get out-of-band status information and do synchronization
with the device. For example, the following code gets the current IEEE-1284
device ID string from the backend:</p>
<pre class='command'>
#include &lt;cups/cups.h&gt;
<pre class="example">
char buffer[8192];
ssize_t bytes;
/* Use a timeout of 1.0 seconds to give filters a chance to read */
cupsBackChannelWrite(buffer, bytes, 1.0);
</pre>
<h2 class='title'>Using the cupsSideChannel APIs</h2>
<p>The <tt>cupsSideChannel</tt> APIs allow your filters, drivers, port monitors, and backend to send and receive the following out-of-band commands:</p>
<ul>
<li><tt>CUPS_SC_CMD_SOFT_RESET</tt> - Do a soft reset</li>
<li><tt>CUPS_SC_CMD_DRAIN_OUTPUT</tt> - Drain all pending output</li>
<li><tt>CUPS_SC_CMD_GET_BIDI</tt> - Return bidirectional capabilities</li>
<li><tt>CUPS_SC_CMD_GET_DEVICE_ID</tt> - Return the IEEE-1284 device ID</li>
<li><tt>CUPS_SC_CMD_GET_STATE</tt> - Return the device state</li>
</ul>
<h3>Sending Commands from a Filter, Driver, or Port Monitor</h3>
<p>The <tt>cupsSideChannelDoRequest()</tt> function is used by filters, drivers, and port monitors to send a command to the backend and read back a response:</p>
<pre class='command'>
cups_sc_status_t cupsSideChannelDoRequest(cups_sc_command_t command,
char *data, int *datalen,
double timeout);
</pre>
<p>The <tt>CUPS_SC_CMD_SOFT_RESET</tt> and <tt>CUPS_SC_CMD_DRAIN_OUTPUT</tt> commands do not return any data values, while the others return one or more bytes. The <tt>timeout</tt> parameter allows your program to poll or wait for the command to complete - use a timeout of 30 seconds for <tt>CUPS_SC_CMD_SOFT_RESET</tt> and <tt>CUPS_SC_CMD_DRAIN_OUTPUT</tt> and a timeout of 1 second for all other commands.</p>
<p><tt>CUPS_SC_CMD_GET_BIDI</tt> returns a single <tt>char</tt> value that tells you whether the backend supports bidirectional communications:</p>
<pre class='command'>
#include &lt;cups/sidechannel.h&gt;
char data;
int datalen;
cups_sc_bidi_t bidi;
cups_sc_status_t status;
/* Tell cupsSideChannelDoRequest() how big our buffer is... */
datalen = 1;
/* Get the bidirectional capabilities, waiting for up to 1 second */
status = cupsSideChannelDoRequest(CUPS_SC_CMD_GET_BIDI, &amp;data, &amp;datalen, 1.0);
/* Use the returned value if OK was returned and the length is still 1 */
if (status == CUPS_SC_STATUS_OK && datalen == 1)
bidi = (cups_sc_bidi_t)data;
else
bidi = CUPS_SC_BIDI_NOT_SUPPORTED;
</pre>
<p><tt>CUPS_SC_CMD_GET_DEVICE_ID</tt> returns a string of characters containing the IEEE-1284 device ID for the connected printer:</p>
<pre class='command'>
#include &lt;cups/sidechannel.h&gt;
char data[2049];
int datalen;
<a href="#cups_sc_status_t">cups_sc_status_t</a> status;
cups_sc_status_t status;
/* Tell cupsSideChannelDoRequest() how big our buffer is, less 1 byte for
nul-termination... */
/* Tell cupsSideChannelDoRequest() how big our buffer is, less 1 byte for nul-termination... */
datalen = sizeof(data) - 1;
/* Get the IEEE-1284 device ID, waiting for up to 1 second */
status = <a href="#cupsSideChannelDoRequest">cupsSideChannelDoRequest</a>(CUPS_SC_CMD_GET_DEVICE_ID, data, &amp;datalen, 1.0);
status = cupsSideChannelDoRequest(CUPS_SC_CMD_GET_DEVICE_ID, data, &amp;datalen, 1.0);
/* Use the returned value if OK was returned and the length is non-zero */
if (status == CUPS_SC_STATUS_OK && datalen > 0)
@@ -444,54 +147,59 @@ else
data[0] = '\0';
</pre>
<h3><a name="COMMUNICATING_FILTER">Communicating with Filters</a></h3>
<p><tt>CUPS_SC_CMD_GET_STATE</tt> returns a single <tt>char</tt> value that tells you the current device state:</p>
<p>Backends communicate with filters using the reciprocal functions
<a href="#cupsBackChannelWrite"><code>cupsBackChannelWrite</code></a>,
<a href="#cupsSideChannelRead"><code>cupsSideChannelRead</code></a>, and
<a href="#cupsSideChannelWrite"><code>cupsSideChannelWrite</code></a>. We
recommend writing back-channel data using a timeout of 1.0 seconds:</p>
<pre class="example">
#include &lt;cups/cups.h&gt;
char buffer[8192];
ssize_t bytes;
/* Obtain data from printer/device */
...
/* Use a timeout of 1.0 seconds to give filters a chance to read */
cupsBackChannelWrite(buffer, bytes, 1.0);
</pre>
<p>The <a href="#cupsSideChannelRead"><code>cupsSideChannelRead</code></a>
function reads a side-channel command from a filter, driver, or port monitor.
Backends can either poll for commands using a <code>timeout</code> of 0.0, wait
indefinitely for commands using a <code>timeout</code> of -1.0 (probably in a
separate thread for that purpose), or use <code>select</code> or
<code>poll</code> on the <code>CUPS_SC_FD</code> file descriptor (4) to handle
input and output on several file descriptors at the same time.</p>
<p>Once a command is processed, the backend uses the
<a href="#cupsSideChannelWrite"><code>cupsSideChannelWrite</code></a> function
to send its response. For example, the following code shows how to poll for a
side-channel command and respond to it:</p>
<pre class="example">
<pre class='command'>
#include &lt;cups/sidechannel.h&gt;
<a href="#cups_sc_command_t">cups_sc_command_t</a> command;
<a href="#cups_sc_status_t">cups_sc_status_t</a> status;
char data[2048];
int datalen = sizeof(data);
char data;
int datalen;
cups_sc_state_t state;
cups_sc_status_t status;
/* Tell cupsSideChannelDoRequest() how big our buffer is... */
datalen = 1;
/* Get the bidirectional capabilities, waiting for up to 1 second */
status = cupsSideChannelDoRequest(CUPS_SC_CMD_GET_STATE, &amp;data, &amp;datalen, 1.0);
/* Use the returned value if OK was returned and the length is still 1 */
if (status == CUPS_SC_STATUS_OK && datalen == 1)
state = (cups_sc_state_t)data;
else
state = CUPS_SC_STATE_OFFLINE;
</pre>
<h3>Handling Commands in your Backend</h3>
<p>The <tt>cupsSideChannelRead()</tt> function is used by backends to read a command from a filter, driver, or port monitor:</p>
<pre class='command'>
int cupsSideChannelRead(cups_sc_command_t &amp;command,
cups_sc_status_t &amp;status,
char *data, int *datalen, double timeout);
</pre>
<p>Backends can either poll for commands using a <tt>timeout</tt> of 0.0, wait indefinitely for commands using a <tt>timeout</tt> of -1.0 (probably in a separate thread for that purpose), or use <tt>select()</tt> or <tt>poll()</tt> on the <tt>CUPS_SC_FD</tt> file descriptor (4) to handle input and output on several file descriptors at the same time. Backends can pass <tt>NULL</tt> for the <tt>data</tt> and <tt>datalen</tt> parameters, since none of the commands sent by upstream filters contain any data at this time.</p>
<p>Once a command is processed, the backend uses the <tt>cupsSideChannelWrite()</tt> function to send its response:</p>
<pre class='command'>
#include &lt;cups/sidechannel.h&gt;
cups_sc_command_t command;
cups_sc_status_t status;
/* Poll for a command... */
if (!<a href="#cupsSideChannelRead">cupsSideChannelRead</a>(&amp;command, &amp;status, data, &amp;datalen, 0.0))
if (!cupsSideChannelRead(&amp;command, &amp;status, NULL, NULL, 0.0))
{
char data[2048];
int datalen;
switch (command)
{
/* handle supported commands, fill data/datalen/status with values as needed */
... handle supported commands, file data/datalen/status with values as needed ...
default :
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
@@ -500,59 +208,6 @@ if (!<a href="#cupsSideChannelRead">cupsSideChannelRead</a>(&amp;command, &amp;s
}
/* Send a response... */
<a href="#cupsSideChannelWrite">cupsSideChannelWrite</a>(command, status, data, datalen, 1.0);
cupsSideChannelWrite(command, status, data, datalen, 1.0);
}
</pre>
<h3><a name="SNMP">Doing SNMP Queries with Network Printers</a></h3>
<p>The Simple Network Management Protocol (SNMP) allows you to get the current
status, page counter, and supply levels from most network printers. Every
piece of information is associated with an Object Identifier (OID), and
every printer has a <em>community</em> name associated with it. OIDs can be
queried directly or by "walking" over a range of OIDs with a common prefix.</p>
<p>The two CUPS SNMP functions provide a simple API for querying network
printers through the side-channel interface. Each accepts a string containing
an OID like ".1.3.6.1.2.1.43.10.2.1.4.1.1" (the standard page counter OID)
along with a timeout for the query.</p>
<p>The <a href="#cupsSideChannelSNMPGet"><code>cupsSideChannelSNMPGet</code></a>
function queries a single OID and returns the value as a string in a buffer
you supply:</p>
<pre class="example">
#include &lt;cups/sidechannel.h&gt;
char data[512];
int datalen = sizeof(data);
if (<a href="#cupsSideChannelSNMPGet">cupsSideChannelSNMPGet</a>(".1.3.6.1.2.1.43.10.2.1.4.1.1", data, &amp;datalen, 5.0)
== CUPS_SC_STATUS_OK)
{
/* Do something with the value */
printf("Page counter is: %s\n", data);
}
</pre>
<p>The
<a href="#cupsSideChannelSNMPWalk"><code>cupsSideChannelSNMPWalk</code></a>
function allows you to query a whole group of OIDs, calling a function of your
choice for each OID that is found:</p>
<pre class="example">
#include &lt;cups/sidechannel.h&gt;
void
my_callback(const char *oid, const char *data, int datalen, void *context)
{
/* Do something with the value */
printf("%s=%s\n", oid, data);
}
...
void *my_data;
<a href="#cupsSideChannelSNMPWalk">cupsSNMPSideChannelWalk</a>(".1.3.6.1.2.1.43", 5.0, my_callback, my_data);
</pre>
-35
Ver Arquivo
@@ -1,35 +0,0 @@
<!--
"$Id: api-httpipp.header 8087 2008-10-27 21:37:05Z mike $"
HTTP and IPP API header for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
law. Distribution and use rights are outlined in the file "LICENSE.txt"
which should have been included with this file. If this file is
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Header</th>
<th>cups/cups.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcups</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html'>Introduction to CUPS Programming</a><br>
Programming: <a href='api-cups.html'>CUPS API</a><br>
References: <a href='spec-ipp.html'>CUPS Implementation of IPP</a></td>
</tr>
</tbody>
</table></div>
+22 -302
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-httpipp.shtml 7684 2008-06-23 16:47:38Z mike $"
"$Id: api-httpipp.shtml 6649 2007-07-11 21:46:42Z mike $"
HTTP and IPP API introduction for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 2007 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -13,311 +13,31 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<h2 class='title'>Introduction</h2>
<p>The CUPS HTTP and IPP APIs provide low-level access to the HTTP and IPP
protocols and CUPS scheduler. They are typically used by monitoring and
administration programs to perform specific functions not supported by the
high-level CUPS API functions.</p>
<p>The CUPS HTTP and IPP APIs provide low-level access to the
HTTP and IPP protocols and CUPS scheduler. They are typically
used by monitoring and administration programs to perform
specific functions not supported by the high-level CUPS API
functions.</p>
<p>The HTTP APIs use an opaque structure called
<a href='#http_t'><code>http_t</code></a> to manage connections to
a particular HTTP or IPP server. The
<a href='#httpConnectEncrypt'><code>httpConnectEncrypt</code></a> function is
used to create an instance of this structure for a particular server.
The constant <code>CUPS_HTTP_DEFAULT</code> can be used with all of the
<code>cups</code> functions to refer to the default CUPS server - the functions
create a per-thread <a href='#http_t'><code>http_t</code></a> as needed.</p>
<h2 class='title'>General Usage</h2>
<p>The IPP APIs use two structures for requests (messages sent to the CUPS
scheduler) and responses (messages sent back to your application from the
scheduler). The <a href='#ipp_t'><code>ipp_t</code></a> structure holds a
complete request or response and is allocated using the
<a href='#ippNew'><code>ippNew</code></a> or
<a href='#ippNewRequest'><code>ippNewRequest</code></a> functions and
freed using the <a href='#ippDelete'><code>ippDelete</code></a> function.</p>
<p>The <var>&lt;cups/cups.h&gt;</var> header file must be included to
use the HTTP and IPP functions.</p>
<p>The second structure is called
<a href='#ipp_attribute_t'><code>ipp_attribute_t</code></a> and holds a
single IPP attribute which consists of a group tag (<code>group_tag</code>), a
value type tag (<code>value_tag</code>), the attribute name (<code>name</code>),
and 1 or more values (<code>values[]</code>). Attributes are added to an
<a href='#ipp_t'><code>ipp_t</code></a> structure using one of the
<code>ippAdd</code> functions. For example, use
<a href='#ippAddString'><code>ippAddString</code></a> to add a
"requesting-user-name" string attribute to a request:</p>
<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_GET_JOBS);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>
<p>Once you have created an IPP request, use the <code>cups</code>
functions to send the request to and read the response from the server.
For example, the <a href='#cupsDoRequest'><code>cupsDoRequest</code></a>
function can be used for simple query operations that do not involve files:</p>
<h2 class='title'>Compatibility</h2>
<pre class='example'>
#include &lt;cups/cups.h&gt;
<a href='#ipp_t'>ipp_t</a> *<a name='get_jobs'>get_jobs</a>(void)
{
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_GET_JOBS);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
return (<a href='#cupsDoRequest'>cupsDoRequest</a>(CUPS_HTTP_DEFAULT, request, "/"));
}
</pre>
<p>The <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function frees
the request structure and returns an IPP response structure or NULL pointer if
the request could not be sent to the server. Once you have a response from
the server, you can either use the
<a href='#ippFindAttribute'><code>ippFindAttribute</code></a> and
<a href='#ippFindNextAttribute'><code>ippFindNextAttribute</code></a> functions
to find specific attributes, for example:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *response;
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
attr = <a href='#ippFindAttribute'>ippFindAttribute</a>(response, "printer-state", IPP_TAG_ENUM);
</pre>
<p>You can also walk the list of attributes with a simple <code>for</code> loop
like this:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *response;
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
for (attr = response->attrs; attr != NULL; attr = attr->next)
if (attr->name == NULL)
puts("--SEPARATOR--");
else
puts(attr->name);
</pre>
<p>The <code>for</code> loop approach is normally used when collecting
attributes for multiple objects (jobs, printers, etc.) in a response. Attributes
with <code>NULL</code> names indicate a separator between the attributes of
each object. For example, the following code will list the jobs returned from
our previous <a href='#get_jobs'><code>get_jobs</code></a> example code:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *response = <a href='#get_jobs'>get_jobs</a>();
if (response != NULL)
{
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
int job_id = 0;
char *job_name = NULL;
char *job_originating_user_name = NULL;
puts("Job ID Owner Title");
puts("------ ---------------- ---------------------------------");
for (attr = response->attrs; attr != NULL; attr = attr->next)
{
/* Attributes without names are separators between jobs */
if (attr->name == NULL)
{
if (job_id > 0 &amp;&amp; job_name != NULL &amp;&amp; job_originating_user_name != NULL)
printf("%5d %-16s %s\n", job_id, job_originating_user_name, job_name);
job_id = 0;
job_name = NULL;
job_originating_user_name = NULL;
continue;
}
else if (!strcmp(attr->name, "job-id") &amp;&amp; attr->value_tag == IPP_TAG_INTEGER)
job_id = attr->values[0].integer;
else if (!strcmp(attr->name, "job-name") &amp;&amp; attr->value_tag == IPP_TAG_NAME)
job_name = attr->values[0].string.text;
else if (!strcmp(attr->name, "job-originating-user-name") &amp;&amp;
attr->value_tag == IPP_TAG_NAME)
job_originating_user_name = attr->values[0].string.text;
}
if (job_id > 0 &amp;&amp; job_name != NULL &amp;&amp; job_originating_user_name != NULL)
printf("%5d %-16s %s\n", job_id, job_originating_user_name, job_name);
}
</pre>
<h3><a name='CREATING_URI_STRINGS'>Creating URI Strings</a></h3>
<p>To ensure proper encoding, the
<a href='#httpAssembleURIf'><code>httpAssembleURIf</code></a> function must be
used to format a "printer-uri" string for all printer-based requests:</p>
<pre class='example'>
const char *name = "Foo";
char uri[1024];
<a href='#ipp_t'>ipp_t</a> *request;
<a href='#httpAssembleURIf'>httpAssembleURIf</a>(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, cupsServer(),
ippPort(), "/printers/%s", name);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
</pre>
<h3><a name='SENDING_REQUESTS_WITH_FILES'>Sending Requests with Files</a></h3>
<p>The <a href='#cupsDoFileRequest'><code>cupsDoFileRequest</code></a> and
<a href='#cupsDoIORequest'><code>cupsDoIORequest</code></a> functions are
used for requests involving files. The
<a href='#cupsDoFileRequest'><code>cupsDoFileRequest</code></a> function
attaches the named file to a request and is typically used when sending a print
file or changing a printer's PPD file:</p>
<pre class='example'>
const char *filename = "/usr/share/cups/data/testprint.ps";
const char *name = "Foo";
char uri[1024];
char resource[1024];
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_PRINT_JOB);
<a href='#ipp_t'>ipp_t</a> *response;
/* Use httpAssembleURIf for the printer-uri string */
<a href='#httpAssembleURIf'>httpAssembleURIf</a>(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, cupsServer(),
ippPort(), "/printers/%s", name);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, "testprint.ps");
/* Use snprintf for the resource path */
snprintf(resource, sizeof(resource), "/printers/%s", name);
response = <a href='#cupsDoFileRequest'>cupsDoFileRequest</a>(CUPS_HTTP_DEFAULT, request, resource, filename);
</pre>
<p>The <a href='#cupsDoIORequest'><code>cupsDoIORequest</code></a> function
optionally attaches a file to the request and optionally saves a file in the
response from the server. It is used when using a pipe for the request
attachment or when using a request that returns a file, currently only
<code>CUPS_GET_DOCUMENT</code> and <code>CUPS_GET_PPD</code>. For example,
the following code will download the PPD file for the sample HP LaserJet
printer driver:</p>
<pre class='example'>
char tempfile[1024];
int tempfd;
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(CUPS_GET_PPD);
<a href='#ipp_t'>ipp_t</a> *response;
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
NULL, "laserjet.ppd");
tempfd = cupsTempFd(tempfile, sizeof(tempfile));
response = <a href='#cupsDoIORequest'>cupsDoIORequest</a>(CUPS_HTTP_DEFAULT, request, "/", -1, tempfd);
</pre>
<p>The example passes <code>-1</code> for the input file descriptor to specify
that no file is to be attached to the request. The PPD file attached to the
response is written to the temporary file descriptor we created using the
<code>cupsTempFd</code> function.</p>
<h3><a name='ASYNCHRONOUS_REQUEST_PROCESSING'>Asynchronous Request Processing</a></h3>
<p>The <a href='#cupsSendRequest'><code>cupsSendRequest</code></a> and
<a href='#cupsGetResponse'><code>cupsGetResponse</code></a> support
asynchronous communications with the server. Unlike the other request
functions, the IPP request is not automatically freed, so remember to
free your request with the <a href='#ippDelete'><code>ippDelete</code></a>
function.</p>
<p>File data is attached to the request using the
<a href='#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>
function, while file data returned from the server is read using the
<a href='#cupsReadResponseData'><code>cupsReadResponseData</code></a>
function. We can rewrite the previous <code>CUPS_GET_PPD</code> example
to use the asynchronous functions quite easily:</p>
<pre class='example'>
char tempfile[1024];
int tempfd;
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(CUPS_GET_PPD);
<a href='#ipp_t'>ipp_t</a> *response;
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
NULL, "laserjet.ppd");
tempfd = cupsTempFd(tempfile, sizeof(tempfile));
if (<a href='#cupsSendRequest'>cupsSendRequest</a>(CUPS_HTTP_DEFAULT, request, "/") == HTTP_CONTINUE)
{
response = <a href='#cupsGetResponse'>cupsGetResponse</a>(CUPS_HTTP_DEFAULT, "/");
if (response != NULL)
{
ssize_t bytes;
char buffer[8192];
while ((bytes = <a href='#cupsReadResponseData'>cupsReadResponseData</a>(CUPS_HTTP_DEFAULT, buffer, sizeof(buffer))) > 0)
write(tempfd, buffer, bytes);
}
}
/* Free the request! */
<a href='#ippDelete'>ippDelete</a>(request);
</pre>
<p>The <a href='#cupsSendRequest'><code>cupsSendRequest</code></a> function
returns the initial HTTP request status, typically either
<code>HTTP_CONTINUE</code> or <code>HTTP_UNAUTHORIZED</code>. The latter status
is returned when the request requires authentication of some sort. The
<a href='#cupsDoAuthentication'><code>cupsDoAuthentication</code></a> function
must be called when your see <code>HTTP_UNAUTHORIZED</code> and the request
re-sent. We can add authentication support to our example code by using a
<code>do ... while</code> loop:</p>
<pre class='example'>
char tempfile[1024];
int tempfd;
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(CUPS_GET_PPD);
<a href='#ipp_t'>ipp_t</a> *response;
http_status_t status;
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
NULL, "laserjet.ppd");
tempfd = cupsTempFd(tempfile, sizeof(tempfile));
/* Loop for authentication */
do
{
status = <a href='#cupsSendRequest'>cupsSendRequest</a>(CUPS_HTTP_DEFAULT, request, "/");
if (status == HTTP_UNAUTHORIZED)
{
/* Try to authenticate, break out of the loop if that fails */
if (<a href='#cupsDoAuthentication'>cupsDoAuthentication</a>(CUPS_HTTP_DEFAULT, "POST", "/"))
break;
}
}
while (status != HTTP_CONTINUE &amp;&amp; status != HTTP_UNAUTHORIZED);
if (status == HTTP_CONTINUE)
{
response = <a href='#cupsGetResponse'>cupsGetResponse</a>(CUPS_HTTP_DEFAULT, "/");
if (response != NULL)
{
ssize_t bytes;
char buffer[8192];
while ((bytes = <a href='#cupsReadResponseData'>cupsReadResponseData</a>(CUPS_HTTP_DEFAULT, buffer, sizeof(buffer))) > 0)
write(tempfd, buffer, bytes);
}
}
/* Free the request! */
<a href='#ippDelete'>ippDelete</a>(request);
</pre>
<p>Unless otherwise specified, the HTTP and IPP API functions
require CUPS 1.1 or higher.</p>
-52
Ver Arquivo
@@ -1,52 +0,0 @@
<!--
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
Introduction to CUPS programming header 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"
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/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Headers</th>
<th>cups/cups.h<br>
cups/array.h<br>
cups/backend.h<br>
cups/dir.h<br>
cups/file.h<br>
cups/ppd.h<br>
cups/raster.h<br>
cups/sidechannel.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Libraries</th>
<td>-lcups<br>
-lcupsimage</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
Programming: <a href='ppd-compiler.html' target='_top'>Introduction to the PPD Compiler</a><br>
Programming: <a href='api-array.html' target='_top'>Array API</a><br>
Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a><br>
Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
References: <a href='ref-ppdcfile.html' target='_top'>PPD Compiler Driver Information File Reference</a><br>
Specifications: <a href='spec-ppd.html' target='_top'>CUPS PPD Extensions</a></td>
</tr>
</tbody>
</table></div>
-95
Ver Arquivo
@@ -1,95 +0,0 @@
<!--
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
Introduction to CUPS programming content 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"
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>CUPS provides two libraries that interface with the different parts of the
printing system. The "cups" library provides all of the common application and
filter functions while the "cupsimage" library provides all of the imaging
functions used in raster printer drivers. The "cups" library functions are
accessed by including the <var>&lt;cups/cups.h&gt;</var> header, while
"cupsimage" functions are found in the <var>&lt;cups/raster.h&gt;</var>
header.</p>
<h2 class="title"><a name="COMPILING">Compiling Programs</a></h2>
<p>The CUPS libraries can be used from any C, C++, or Objective C program.
The method of compiling against the libraries varies depending on the
operating system and installation of CUPS. The following sections show how
to compile a simple program (shown below) in two common environments.</p>
<p>The following simple program lists the available printers on the system:</p>
<pre class="example">
#include &lt;stdio.h&gt;
#include &lt;cups/cups.h&gt;
int main(void)
{
int i;
cups_dest_t *dests, *dest;
int num_dests = cupsGetDests(&amp;dests);
for (i = num_dests, dest = dests; i &gt; 0; i --, dest ++)
{
if (dest->instance)
printf("%s/%s\n", dest->name, dest->instance);
else
puts(dest->name);
}
return (0);
}
</pre>
<h3><a name="XCODE">Compiling with Xcode</a></h3>
<p>In Xcode, choose <var>New Project...</var> from the <var>File</var> menu,
then select the <var>Standard Tool</var> project type under <var>Command Line
Utility</var>. Click <var>Next</var> and choose a project directory. Click
<var>Next</var> to create the project.</p>
<p>In the project window, double-click on the <var>Targets</var> group and
control-click on the simple target to show the context menu. Choose
<var>Existing Framework...</var> from the <var>Add</var> submenu. When the file
chooser sheet appears, press the <kbd>/</kbd> key and enter "/usr/lib". Scroll
down the file list and select the <var>libcups.dylib</var> file. Click the
<var>Add</var> button in the file chooser and attributes sheets.</p>
<p>In the project window, double-click on the <var>main.c</var> source file.
Replace the template source code with the listing above and save it. Click the
<var>Build and Go</var> button to build the sample program and run it.</p>
<h3><a name="COMMANDLINE">Compiling with GCC</a></h3>
<p>From the command-line, create a file called <var>sample.c</var> using your
favorite editor and then run the following command to compile it with GCC and
run it:</p>
<pre class="command">
gcc -o simple `cups-config --cflags` simple.c `cups-config --libs`
./simple
</pre>
<p>The <code>cups-config</code> command provides the compiler flags
("cups-config --cflags") and libraries ("cups-config --libs") needed for the
local system.</p>
<h2 class="title"><a name="WHERETOGO">Where to Go Next</a></h2>
<p>If you are developing a print filter, driver, or backend, see the
<a href="api-filter.html" target="_top">Filter and Backend Programming</a>
guide. Raster printer driver developers should also read the
<a href="api-raster.html" target="_top">Raster API</a> reference.</p>
-34
Ver Arquivo
@@ -1,34 +0,0 @@
<!--
"$Id: api-ppd.header 8087 2008-10-27 21:37:05Z mike $"
PPD API header 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"
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/".
-->
<div class='summary'><table summary='General Information'>
<thead>
<tr>
<th>Header</th>
<th>cups/ppd.h</th>
</tr>
</thead>
<tbody>
<tr>
<th>Library</th>
<td>-lcups</td>
</tr>
<tr>
<th>See Also</th>
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
Specifications: <a href='spec-ppd.html' target='_top'>CUPS PPD Extensions</a></td>
</tr>
</tbody>
</table></div>
+22 -196
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-ppd.shtml 7616 2008-05-28 00:34:13Z mike $"
"$Id: api-ppd.shtml 6649 2007-07-11 21:46:42Z mike $"
PPD API introduction for the Common UNIX Printing System (CUPS).
Copyright 2007-2008 by Apple Inc.
Copyright 2007 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -13,205 +13,31 @@
file is missing or damaged, see the license at "http://www.cups.org/".
-->
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<h2 class='title'>Introduction</h2>
<p>The CUPS PPD API provides read-only access the data in PostScript Printer
Description ("PPD") files which are used for all printers with a driver. With
it you can obtain the data necessary to display printer options to users, mark
option choices and check for conflicting choices, and output marked choices in
PostScript output. The <a href="#ppd_file_t"><code>ppd_file_t</code></a>
structure contains all of the information in a PPD file.</p>
<p>The CUPS PPD API provides read-only access the data in
PostScript Printer Description ("PPD") files. With it you can
display printer options to users, mark option choices and check
for conflicting choices, and output marked choices in PostScript
output.</p>
<blockquote><b>Note:</b>
<h2 class='title'>General Usage</h2>
<p>The CUPS PPD API uses the terms "option" and "choice" instead of the Adobe
terms "MainKeyword" and "OptionKeyword" to refer to specific printer options and
features. CUPS also treats option ("MainKeyword") and choice ("OptionKeyword")
values as case-insensitive strings, so option "InputSlot" and choice "Upper"
are equivalent to "inputslot" and "upper", respectively.</p>
</blockquote>
<p>The <var>&lt;cups/ppd.h&gt;</var> header file must be included
to use the <tt>ppd</tt> functions.</p>
<h3><a name="LOADING">Loading a PPD File</a></h3>
<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>
<p>The <a href="#ppdOpenFile"><code>ppdOpenFile</code></a> function "opens" a
PPD file and loads it into memory. For example, the following code opens the
current printer's PPD file in a CUPS filter:</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd = <a href="#ppdOpenFile">ppdOpenFile</a>(getenv("PPD"));
<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>
<p>The return value is a pointer to a new
<a href="#ppd_file_t"><code>ppd_file_t</code></a> structure or <code>NULL</code>
if the PPD file does not exist or cannot be loaded. The
<a href="#ppdClose"><code>ppdClose</code></a> function frees the memory used
by the structure:</p>
<h2 class='title'>Compatibility</h2>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppdClose">ppdClose</a>(ppd);
</pre>
<p>Once closed, pointers to the <a href="#ppd_file_t"><code>ppd_file_t</code></a>
structure and any data in it will no longer be valid.</p>
<h3><a name="OPTIONS_AND_GROUPS">Options and Groups</a></h3>
<p>PPD files support multiple options, which are stored in arrays of
<a href="#ppd_option_t"><code>ppd_option_t</code></a> and
<a href="#ppd_choice_t"><code>ppd_choice_t</code></a> structures.</p>
<p>Each option in turn is associated with a group stored in a
<a href="#ppd_group_t"><code>ppd_group_t</code></a> structure. Groups can be
specified in the PPD file; if an option is not associated with a group
then it is put in an automatically-generated "General" group. Groups can also
have sub-groups, however CUPS currently ignores sub-groups because of past
abuses of this functionality.</p>
<p>Option choices are selected by marking them using one of three functions. The
first is <a href="#ppdMarkDefaults"><code>ppdMarkDefaults</code></a> which
selects all of the default options in the PPD file:</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppdMarkDefaults">ppdMarkDefaults</a>(ppd);
</pre>
<p>The second is <a href="#ppdMarkOption"><code>ppdMarkOption</code></a>
which selects a single option choice in the PPD file. For example, the following
code selects the upper paper tray:</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppdMarkOption">ppdMarkOption</a>(ppd, "InputSlot", "Upper");
</pre>
<p>The last function is
<a href="#cupsMarkOptions"><code>cupsMarkOptions</code></a> which selects
multiple option choices in the PPD file from an array of CUPS options, mapping
IPP attributes like "media" and "sides" to their corresponding PPD options. You
typically use this function in a print filter with
<code>cupsParseOptions</code> and
<a href="#ppdMarkDefaults"><code>ppdMarkDefaults</code></a> to select all of
the option choices needed for the job, for example:</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd = <a href="#ppdOpenFile">ppdOpenFile</a>(getenv("PPD"));
cups_option_t *options = NULL;
int num_options = cupsParseOptions(argv[5], 0, &amp;options);
<a href="#ppdMarkDefaults">ppdMarkDefaults</a>(ppd);
<a href="#cupsMarkOptions">cupsMarkOptions</a>(ppd, num_options, options);
cupsFreeOptions(num_options, options);
</pre>
<h3><a name="CONSTRAINTS">Constraints</a></h3>
<p>PPD files support specification of conflict conditions, called
constraints, between different options. Constraints are stored in an array of
<a href="#ppd_const_t"><code>ppd_const_t</code></a> structures which specify
the options and choices that conflict with each other. The
<a href="#ppdConflicts"><code>ppdConflicts</code></a> function tells you
how many of the selected options are incompatible. Since constraints are
normally specified in pairs, the returned value is typically an even number.</p>
<h3><a name="PAGE_SIZES">Page Sizes</a></h3>
<p>Page sizes are special options which have physical dimensions and margins
associated with them. The size information is stored in
<a href="#ppd_size_t"><code>ppd_size_t</code></a> structures and is available
by looking up the named size with the
<a href="#ppdPageSize"><code>ppdPageSize</code></a> function. The page size and
margins are returned in units called points; there are 72 points per inch. If
you pass <code>NULL</code> for the size, the currently selected size is
returned:</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, NULL);
</pre>
<p>Besides the standard page sizes listed in a PPD file, some printers
support variable or custom page sizes. Custom page sizes are supported if the
<code>variables_sizes</code> member of the
<a href="#ppd_file_t"><code>ppd_file_t</code></a> structure is non-zero.
The <code>custom_min</code>, <code>custom_max</code>, and
<code>custom_margins</code> members of the
<a href="#ppd_file_t"><code>ppd_file_t</code></a> structure define the limits
of the printable area. To get the resulting media size, use a page size string
of the form "Custom.<I>width</I>x<I>length</I>", where "width" and "length" are
in points. Custom page size names can also be specified in inches
("Custom.<i>width</i>x<i>height</i>in"), centimeters
("Custom.<i>width</i>x<i>height</i>cm"), or millimeters
("Custom.<i>width</i>x<i>height</i>mm"):</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd;
/* Get an 576x720 point custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.576x720");
/* Get an 8x10 inch custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.8x10in");
/* Get a 100x200 millimeter custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.100x200mm");
/* Get a 12.7x34.5 centimeter custom page size */
<a href="#ppd_size_t">ppd_size_t</a> *size = <a href="#ppdPageSize">ppdPageSize</a>(ppd, "Custom.12.7x34.5cm");
</pre>
<p>If the PPD does not support variable page sizes, the
<a href="#ppdPageSize"><code>ppdPageSize</code></a> function will return
<code>NULL</code>.</p>
<h3><a name="ATTRIBUTES">Attributes</a></h3>
<p>Every PPD file is composed of one or more attributes. Most of these
attributes are used to define groups, options, choices, and page sizes,
however several informational attributes may be present which you can access
in your program or filter. Attributes normally look like one of the following
examples in a PPD file:</p>
<pre class="example">
*name: "value"
*name spec: "value"
*name spec/text: "value"
</pre>
<p>The <a href="#ppdFindAttr"><code>ppdFindAttr</code></a> and
<a href="#ppdFindNextAttr"><code>ppdFindNextAttr</code></a> functions find the
first and next instances, respectively, of the named attribute with the given
"spec" string and return a <a href="#ppd_attr_t"><code>ppd_attr_t</code></a>
structure. If you provide a NULL specifier string, all attributes with the
given name will be returned. For example, the following code lists all of the
<code>Product</code> attributes in a PPD file:</p>
<pre class="example">
#include &lt;cups/ppd.h&gt;
<a href="#ppd_file_t">ppd_file_t</a> *ppd;
<a href="#ppd_attr_t">ppd_attr_t</a> *attr;
for (attr = <a href="#ppdFindAttr">ppdFindAttr</a>(ppd, "Product", NULL);
attr != NULL;
attr = <a href="#ppdFindNextAttr">ppdFindNextAttr</a>(ppd, "Product", NULL))
puts(attr->value);
</pre>
<p>Unless otherwise specified, the PPD API functions require CUPS
1.1 or higher.</p>

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