Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| c20b887ba5 |
@@ -1,217 +0,0 @@
|
||||
CHANGES-1.0.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS v1.0.5
|
||||
|
||||
- The HP-GL/2 filter did not correctly set the pen color
|
||||
for pens other than #1.
|
||||
- The scheduler would only accept 26 simultaneous jobs
|
||||
under some OS releases (mkstemp() limitation.) It now
|
||||
handles up to 2^32 simultaneous jobs.
|
||||
- The PostScript filter loaded the printer's PPD file
|
||||
twice.
|
||||
- The PAM authentication code now uses pam_strerror() to
|
||||
provide a textual error message in the error_log file.
|
||||
- The scheduler now copies PPD and interface script
|
||||
files instead of moving them; this fixes installations
|
||||
with a separate requests directory.
|
||||
- The PostScript RIP did not generate correct 6-color
|
||||
output.
|
||||
- Several filters were marking PPD options twice when
|
||||
they didn't need to.
|
||||
- The scheduler did not save the printer or class state
|
||||
after an accept-jobs or reject-jobs operation.
|
||||
- The cupsGetDefault() function now ignores the PRINTER
|
||||
environment variable if it is set to "lp".
|
||||
- New ippErrorString() function to get textual error
|
||||
messages.
|
||||
- Better error reporting in the System V commands.
|
||||
- The lpadmin and lpstat commands always tried to
|
||||
connect to the default server.
|
||||
- The text filter didn't load the charset files from the
|
||||
correct location.
|
||||
- Wasn't sending a WWW-Authenticate: field to HTTP
|
||||
clients when authentication was required.
|
||||
- httpSeparate() didn't always set the default port
|
||||
number for known methods.
|
||||
- The HP-GL/2 filter now looks for "PSwidth,length"
|
||||
instead of (the correct) "PSlength,width" as
|
||||
documented by HP. It appears that many major CAD
|
||||
applications are broken and this change allows the
|
||||
auto-rotation to work with them.
|
||||
- The IPP "printer-resolution" option was not being
|
||||
translated.
|
||||
- The charset files did not include the Microsoft
|
||||
"standard" characters from 128 to 159 (unused by the
|
||||
ISO-8859-x charsets)
|
||||
- The scheduler was chunking the Content-Type field from
|
||||
CGI programs; this problem was most noticeable with
|
||||
Microsoft Internet Explorer 5.
|
||||
- By popular demand, the printers, jobs, and classes
|
||||
CGIs no longer force a reload of the page every 10/30
|
||||
seconds.
|
||||
- The scheduler incorrectly required that the IPP client
|
||||
provide a document-format attribute for the
|
||||
validate-job operation.
|
||||
- Clients that sent bad IPP requests without the
|
||||
required attributes-natural-language and
|
||||
attributes-charset attributes would crash the
|
||||
scheduler.
|
||||
|
||||
|
||||
CHANGES IN CUPS v1.0.4
|
||||
|
||||
- Documentation updates.
|
||||
- Jobs would get stuck in the queue and wouldn't print
|
||||
until you enabled the queue.
|
||||
- The lp and lpr commands now catch SIGHUP and SIGINTR.
|
||||
- The lp and lpr commands now use sigaction or sigset
|
||||
when available.
|
||||
- CUPS library updates for WIN32/OS-2
|
||||
|
||||
|
||||
CHANGES IN CUPS v1.0.3
|
||||
|
||||
- Documentation updates.
|
||||
- The lpq man page was missing.
|
||||
- The configure script was not properly detecting the
|
||||
image libraries.
|
||||
- The top-level makefile was calling "make" instead of
|
||||
"$(MAKE)".
|
||||
- PostScript filter fixes for number-up, OutputOrder,
|
||||
and %Trailer.
|
||||
- The imagetops filter didn't end the base-85 encoding
|
||||
properly if the image data was not a multiple of 4
|
||||
bytes in length.
|
||||
- The imagetoraster filter didn't generate good banded
|
||||
RGB or CMY data (was dividing the line width by 4
|
||||
instead of 3...)
|
||||
- The imagetoraster filter now records the bounding
|
||||
box of the image on the page.
|
||||
- The CUPS image library cache code wasn't working as
|
||||
designed; images larger than the maximum RIP cache
|
||||
would eventually thrash using the same cache tile.
|
||||
- The CUPS image library TIFF loading code didn't
|
||||
handle unknown resolution units properly; the fixed
|
||||
code uses a default resolution of 128 PPI.
|
||||
- cupsGetClasses() and cupsGetPrinters() did not free
|
||||
existing strings if they ran out of memory.
|
||||
- The scheduler logs incorrectly contained 3 digits for
|
||||
the timezone offset instead of 4.
|
||||
- The scheduler now does a lookup for the default user
|
||||
and group ID; the previous hardcoded values caused
|
||||
problems with the LPD backend.
|
||||
- The cancel-job operation now allows any user in the
|
||||
system group to cancel any job.
|
||||
- The cancel-job operation stopped the print queue if
|
||||
the job was being printed.
|
||||
- Now only stop printers if the backend fails. If the
|
||||
filter fails then the failure is noted in the
|
||||
error_log and printing continues with the next file in
|
||||
the queue.
|
||||
- Now log whether a filter fails because of a signal
|
||||
or because it returned a non-zero exit status.
|
||||
- The root user now always passes the system group test.
|
||||
- Printers with an interface script and remote printers
|
||||
and classes didn't have a printer-make-and-model
|
||||
attribute.
|
||||
- Added logging of lost/timed-out remote printers.
|
||||
- The HP-GL/2 filter was scaling the pen width twice.
|
||||
- Updated the HP-GL/2 filter to use a single SP (Set
|
||||
Pen) procedure. This makes the output smaller and is
|
||||
more appropriate since the filter keeps track of the
|
||||
pen states already.
|
||||
- The scheduler didn't handle passwords with spaces.
|
||||
- The IPP backend now does multiple copies and retries
|
||||
if the destination server requires it (e.g. HP
|
||||
JetDirect.)
|
||||
- The disable command didn't implement the "-c" option
|
||||
(cancel all jobs.)
|
||||
- Changed the CMYK generation function for the image file
|
||||
and PostScript RIPs.
|
||||
- The lp command didn't support the "-h" option as
|
||||
documented.
|
||||
- The AppSocket, IPP, and LPD backends now retry on all
|
||||
network errors. This should prevent stopped queues
|
||||
caused by a printer being disconnected from the
|
||||
network or powered off.
|
||||
- The scheduler now restarts a job if the corresponding
|
||||
printer is modified.
|
||||
- The image RIPs now rotate the image if needed to fit
|
||||
on the page.
|
||||
|
||||
|
||||
CHANGES IN CUPS v1.0.2
|
||||
|
||||
- The HP-GL/2 filter didn't always scale the output
|
||||
correctly.
|
||||
- The HP-GL/2 filter now supports changing the page size
|
||||
automatically when the "fitplot" option is not used.
|
||||
- The cancel-job operation was expecting a resource name
|
||||
of the form "/job/#" instead of "/jobs/#"; this
|
||||
prevented the cancel and lprm commands from working.
|
||||
- The backends didn't log pages when files were printed
|
||||
using the "-oraw" option.
|
||||
- The authorization code did not work with the Slackware
|
||||
long shadow password package because its crypt() can
|
||||
return NULL.
|
||||
- The chunking code didn't work for reading the response
|
||||
of a POST request.
|
||||
- cupsGetPPD() now does authentication as needed.
|
||||
- The N-up code in the PostScript filter didn't work
|
||||
with some printers (grestoreall would restore the
|
||||
default blank page and device settings).
|
||||
- The N-up code in the PostScript filter didn't scale
|
||||
the pages to fit within the imageable area of the
|
||||
page.
|
||||
- Wasn't doing an fchown() on the request files. This
|
||||
caused problems when the default root account group
|
||||
and CUPS group were not the same.
|
||||
|
||||
|
||||
CHANGES IN CUPS v1.0.1
|
||||
|
||||
- Documentation updates.
|
||||
- Fixed a bunch of possible buffer-overflow conditions.
|
||||
- The scheduler now supports authentication using PAM.
|
||||
- Updated the Italian message file.
|
||||
- httpEncode64() didn't add an extra "=" if there was
|
||||
only one byte in the last three-byte group.
|
||||
- Now drop any trailing character set from the locale
|
||||
string (e.g. "en_US.ISO_8859-1" becomes "en_US")
|
||||
- Fixed "timezone" vs "tm_gmtoff" usage for BSD-based
|
||||
operating systems.
|
||||
- Updated IPP security so that "get" operations can be
|
||||
done from any resource name; this allows the CGIs to
|
||||
work with printer authentication enabled so long as
|
||||
authentication isn't turned on for the whole "site".
|
||||
- The IPP code didn't properly handle the "unsupported"
|
||||
group; this caused problems with the HP JetDirect since
|
||||
it doesn't seem to support the "copies" attribute.
|
||||
- The HTTP chunking code was missing a CR LF pair at the
|
||||
end of a 0-length chunk.
|
||||
- The httpSeparate() function didn't handle embedded
|
||||
usernames and passwords in the URI properly.
|
||||
- Doing "lpadmin -p printer -E" didn't restart printing
|
||||
if there were pending jobs.
|
||||
- The cancel-job operation now requires either a
|
||||
requesting-user-name attribute or an authenticated
|
||||
username.
|
||||
- The add-printer code did not report errors if the
|
||||
interface script or PPD file could not be renamed.
|
||||
- Request files are now created without world read
|
||||
permissions.
|
||||
- Added a cupsLastError() function to the CUPS API to
|
||||
retrieve the IPP error code from the last request.
|
||||
- Options are now case-insensitive.
|
||||
- The lpq command now provides 10 characters for the
|
||||
username instead of the original (Berkeley standard)
|
||||
7.
|
||||
- The cancel command needed a local CUPS server to work
|
||||
(or the appropriate ServerName in cupsd.conf)
|
||||
- The cancel and lprm commands didn't report the IPP
|
||||
error if the job could not be cancelled.
|
||||
- The lp and lpr commands didn't intercept SIGTERM to
|
||||
remove temporary files when printing from stdin.
|
||||
- The lp and lpr commands didn't report the IPP error if
|
||||
the job could not be printed.
|
||||
-3462
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-1261
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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.
|
||||
-277
@@ -1,277 +0,0 @@
|
||||
CHANGES.txt - 2008-12-15
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.4b2
|
||||
|
||||
- Documentation updates (STR #2983, STR #2998, STR #3021)
|
||||
- The cupstestppd utility now validates the FileVersion and
|
||||
FormatVersion values in PPD files.
|
||||
- The default cupsd.conf file did not reflect the
|
||||
--with-local-protocols value set at compile-time (STR #3037)
|
||||
- The cupsGetPPD* APIs now create symlinks to local PPD files
|
||||
rather than copying them whenever possible.
|
||||
- Various performance optimizations in the string pool, dests, and
|
||||
options implementations.
|
||||
- The cupsGetDests* APIs now return the marker and printer-commands
|
||||
attributes.
|
||||
- Side-channel SNMP lookups would not work when cupsSNMPSupplies
|
||||
was set to False in the PPD file.
|
||||
- Localized the device descriptions for the SCSI, serial,
|
||||
and network backends (STR #3014)
|
||||
- Added a Spanish localization (STR #3015)
|
||||
- Added support for marker-low-levels and marker-high-levels
|
||||
attributes.
|
||||
- The scheduler could hang writing a long log line.
|
||||
- The cupsGetDevices() function now has an "include_schemes"
|
||||
parameter.
|
||||
- The lpinfo command now supports --include-schemes and
|
||||
--exclude-schemes options.
|
||||
- The CUPS-Get-PPDs operation now supports the include-schemes
|
||||
and exclude-schemes attributes.
|
||||
- The CUPS-Get-Devices operation now supports the include-schemes
|
||||
attribute.
|
||||
- The print filters now support a replacement for the fitplot
|
||||
option called "fit-to-page".
|
||||
- The LPD backend no longer tries to collect page accounting
|
||||
information since the LPD protocol does not allow us to
|
||||
prevent race conditions.
|
||||
- The scheduler did not save the last marker-change-time value.
|
||||
- Fixed a problem with printing to some IPP printers, including
|
||||
CUPS 1.1.x.
|
||||
- Fixed a redirection problem with the printer web page (STR #3012)
|
||||
- Fixed a PPD compiler problem with the loading of message
|
||||
catalogs (STR #2990)
|
||||
- Fixed a PPD compiler problem with the loading of .strings files
|
||||
(STR #2989)
|
||||
- The cupsfilter utility did not set the CONTENT_TYPE environment
|
||||
variable when running filters.
|
||||
- The scheduler now waits to allow system sleep until the jobs
|
||||
have all stopped.
|
||||
- The IPP, LPD, and socket backends used different "connecting"
|
||||
progress messages.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4b1
|
||||
|
||||
- Documentation updates (STR #2567)
|
||||
- The PPD compiler now allows local message catalogs to
|
||||
override the standard CUPS translations (STR #2642)
|
||||
- The ppdmerge command did not merge custom option strings
|
||||
(STR #2863)
|
||||
- The scheduler now supports the Hold-New-Jobs and
|
||||
Release-Held-New-Jobs operations; these are exposed via the
|
||||
cupsdisable and cupsenable commands (STR #2332)
|
||||
- The lpstat command is now much faster when displaying the
|
||||
status of a single printer (STR #2843)
|
||||
- The scheduler now caches information from PPD files to provide
|
||||
significantly faster startup time with large numbers of PPDs
|
||||
(STR #1293)
|
||||
- CUPS-Get-Driver now provides much better driver matching based
|
||||
on the IEEE-1284 device ID and make/model strings (STR #2707)
|
||||
- Now support the cupsSNMPSupplies keyword to control whether
|
||||
the network backends query the SNMP Printer MIB for supply
|
||||
levels.
|
||||
- Now support and use a new banner file format for better text
|
||||
support and easier customization (STR #2490)
|
||||
- The scheduler now sets the PRINTER_INFO and PRINTER_LOCATION
|
||||
environment variables from the corresponding IPP attributes.
|
||||
- The ippRead*() and ippWrite*() functions no longer use a
|
||||
stack-based buffer (STR #2388)
|
||||
- The CUPS-Add-Modify-Printer operation now allows you to set
|
||||
the printer-state-reasons attribute.
|
||||
- The "set printer options" page now supports auto-configuration
|
||||
of printer options (STR #1440)
|
||||
- The web interface now provides an advanced server settings
|
||||
form.
|
||||
- The web interface's "modify printer" pages now make it
|
||||
easier to change just one setting (STR #1919)
|
||||
- The scheduler now supports a plist PrintcapFormat.
|
||||
- The scheduler now supports multiple addresses in Allow and
|
||||
Deny lines, just like Apache (STR #2947)
|
||||
- Added CUPS_JOBTYPE environment variable for job filters so
|
||||
they know whether they are printing a banner or document
|
||||
file (STR #2799)
|
||||
- Added support for printer filtering by the cupsfilter
|
||||
command (STR #2562)
|
||||
- Added a SSLOptions directive to allow Windows clients to
|
||||
talk to CUPS in FIPS mode (STR #2827)
|
||||
- Renamed the accept and reject commands to cupsaccept and
|
||||
cupsreject; the old names are still available (STR #2936)
|
||||
- The locale/translate utility needed an update to work with
|
||||
Google (STR #2882)
|
||||
- The lpstat command now supports a -H option to display the
|
||||
default server (STR #2833)
|
||||
- The scheduler now supports a FatalErrors directive to control
|
||||
which errors should cause the scheduler to exit (STR #2536)
|
||||
- The scheduler now uses the php-cgi program if it is available
|
||||
(STR #2923)
|
||||
- The scheduler now supports a DefaultPaperSize directive
|
||||
(STR #2848)
|
||||
- The scheduler now passes the job-originating-host-name
|
||||
value to filters in the options argument (STR #2558)
|
||||
- CUPS now supports job tickets in PDF files (STR #2903)
|
||||
- Added a DBUS notifier (STR #2529)
|
||||
- The LPD mini-daemon now passes the document name when queuing
|
||||
print jobs (STR #2482)
|
||||
- The IPP backend did not relay com.apple.print.recoverable-message
|
||||
values.
|
||||
- The scheduler now supports a job-media-progress attribute to
|
||||
track the progress of individual pages.
|
||||
- The sample HP driver now supports A5 (STR #2798)
|
||||
- The CUPS web interface menu item now uses the xdg-open
|
||||
command, when available (STR #2724)
|
||||
- The cups-lpd program now supports the -h option (STR #2794)
|
||||
- The scheduler now sets the PAM_TTY parameter and the
|
||||
PAM_ESTABLISH_CRED credential flag (STR #2745)
|
||||
- The scheduler now logs unsuccessful requests to the error_log
|
||||
file as errors (STR #2616)
|
||||
- Added support for a "retry-current-job" error policy that
|
||||
retries the current job immediately when the backend encounters
|
||||
an error (STR #2555)
|
||||
- The scheduler now returns a "forbidden" error when a user
|
||||
correctly authenticates but does not have permission to
|
||||
continue further (STR #2101)
|
||||
- The scheduler now loads both the server and CA certificates
|
||||
(if present) from the ServerCertificate file (STR #2146)
|
||||
- New RSS subscriptions now create their feed files immediately
|
||||
(STR #2853)
|
||||
- Added support for a device-location attribute which provides
|
||||
the physical location of a printer device.
|
||||
- Added a cupsBackendReport() API which handles quoting of the
|
||||
device data by a backend.
|
||||
- Added support for custom options in the web interface
|
||||
(STR #1729)
|
||||
- Added support for Mozilla LDAP, reconnection to LDAP servers,
|
||||
and improved LDAP performance (STR #1962)
|
||||
- Added Solaris SMF support (STR #1477)
|
||||
- Added optional support for using TCP wrappers to limit access
|
||||
to CUPS (STR #263)
|
||||
- Added ppdPageSizeLimits API.
|
||||
- Added support for new cupsMediaQualifier2, cupsMediaQualifier3,
|
||||
cupsMinSize, and cupsMaxSize attributes.
|
||||
- Added cupsResolveConflicts and ppdInstallableConflict APIs.
|
||||
- Added support for new cupsUIConstraints and cupsUIResolver
|
||||
attributes for better option conflict detection and
|
||||
resolution.
|
||||
- Increased the maximum size of 1284 device ID strings to
|
||||
256 bytes (STR #2877)
|
||||
- Added an AccessLogLevel directive to cupsd.conf to control
|
||||
what is logged to the access_log file.
|
||||
- The default LogLevel is now "warn" instead of "info" to reduce
|
||||
the amount of logging that is done to disk by default.
|
||||
- The PPD compiler did not include OID query keywords in PPD
|
||||
files (STR #2871)
|
||||
- The cups-driverd helper program now directly supports driver
|
||||
information files.
|
||||
- The USB backend now uses libusb when available (STR #1575)
|
||||
- Added ppdLocalizeAttr function to get the localized version
|
||||
of an attribute.
|
||||
- MIME types now support a priority() attribute (STR #2719)
|
||||
- The standard MIME types are now installed in
|
||||
DataDir/mime (STR #2719)
|
||||
- The lpoptions command now describes custom options and
|
||||
the necessary parameters (STR #2660)
|
||||
- The ppdmerge program did not support Simplified Chinese
|
||||
or Traditional Chinese language version strings (STR #2851)
|
||||
- The PPD compiler now supports localizable attributes
|
||||
(STR #2738)
|
||||
- The ppdpo utility now includes cupsIPPReasons values in
|
||||
the message catalogs it generates (STR #2754)
|
||||
- The PPD compiler now supports conditional directives
|
||||
(STR #2636)
|
||||
- The ppdc utility now supports a "-t" option to test PPD
|
||||
files (STR #2739)
|
||||
- The ppdc utility now supports a "-m" option to use the
|
||||
ModelName value as the output filename.
|
||||
- The ppdc utility now supports a FileName directive to
|
||||
set an alternate output filename (STR #2740)
|
||||
- The side-channel API now supports SNMP queries for the
|
||||
standard network backends.
|
||||
- Added a PageLogFormat directive to the cupsd.conf file to
|
||||
control the format of lines in the page_log file.
|
||||
- Filters can now send PPD: messages to stderr to set PPD
|
||||
keywords like DefaultPageSize while a job is printing.
|
||||
- Added a mdns backend for discovery and printing to printers
|
||||
that advertise themselves via DNS-SD (Bonjour)
|
||||
- The ipp, lpd, and socket backends now support DNS-SD service
|
||||
name resolution.
|
||||
- The scheduler now uses a single shared file descriptor for
|
||||
all DNS-SD registrations (STR #2674)
|
||||
- The ipp, lpd, and socket backends now support SNMP-based
|
||||
page accounting and supply level monitoring (STR #1655)
|
||||
- Added support for cupsPJLDisplay attribute to control what
|
||||
PJL commands are used to display the job information.
|
||||
- Driver information files can now be installed in
|
||||
/Library/Printers/PPDs.drv on Mac OS X.
|
||||
- The CUPS image library now supports reading images larger
|
||||
than 2GB.
|
||||
- The scheduler now delays writing config and state files to
|
||||
reduce disk activity (STR #2684)
|
||||
- The CUPS-Get-Devices operation now supports the
|
||||
exclude-schemes and timeout attributes to control which
|
||||
backends are polled and for how long.
|
||||
- The cups-deviced helper application now runs backends in
|
||||
parallel to get the list of devices faster.
|
||||
- Added --enable-pap configure option.
|
||||
- The default cupsd.conf file now includes an "authenticated"
|
||||
policy which requires authentication for remote print jobs.
|
||||
- Added support for Czech and Hungarian in PPD files
|
||||
(STR #2735, STR #2736)
|
||||
- The PPD compiler tools now support Mac OS X .strings files
|
||||
for localization (STR #2737)
|
||||
- ppdOpen*() now default the colorspace member to PPD_CS_N
|
||||
when no DefaultColorSpace attribute is present in the PPD
|
||||
file.
|
||||
- The build system has been updated to support separate
|
||||
installation of data, program, header, and library files.
|
||||
- All support libraries are now built as shared libraries
|
||||
by default.
|
||||
- The scheduler now manages ICC color profiles on Mac OS X.
|
||||
- The network backends (ipp, lpd, socket) now support
|
||||
SNMP-based supply and page count monitoring (STR #1655)
|
||||
- The lppasswd program is no longer installed setuid to
|
||||
root to make the default installation more secure.
|
||||
- Added a new ppdLocalizeMarkerName() function to get
|
||||
the localized version of a marker-names value.
|
||||
- The scheduler now provides the printer-dns-sd-name
|
||||
attribute for printers shared via DNS-SD/Bonjour.
|
||||
- The pdftops filter now executes the Xpdf or poppler
|
||||
pdftops utility to convert PDF files (STR #1471)
|
||||
- Bonjour printer registrations now advertise as local or
|
||||
global based on the current access policies for the
|
||||
printer.
|
||||
- cupsGetDests*() and cupsSetDests*() now track the last
|
||||
used printer preference on Mac OS X.
|
||||
- Added a new streaming request API (STR #2261)
|
||||
- Added a new cupsGetNamedDest() function to the CUPS
|
||||
library for faster printing with lp and lpr (STR #2638)
|
||||
- The scheduler now sets the PAM RHOST value on systems
|
||||
that support it (STR #2637)
|
||||
- The scheduler now sandboxes child processes when
|
||||
possible.
|
||||
- The Cancel-Job operation now supports a purge-job
|
||||
attriibute to purge a specified job.
|
||||
- ppdEmit* and ppdCollect* now use the NonUIOrderDependency
|
||||
attributes for custom option selections.
|
||||
- The web interface now enables/disables the printer
|
||||
sharing (formerly publishing) controls based on the
|
||||
server-is-sharing-printers state (STR #2233)
|
||||
- The scheduler now tracks printer sharing via the
|
||||
server-is-sharing-printers attribute, and manages LPD
|
||||
and SMB sharing as well (STR #2233)
|
||||
- The web interface now allows you to go back to the make/
|
||||
manufacturer page if there is no matching printer driver
|
||||
on the model page (STR #2436)
|
||||
- The printer list now shows the default media, banner, and
|
||||
duplex options as well as the color and duplex capabilities
|
||||
of printers (STR #1175)
|
||||
- The web interface look-n-feel has been updated (STR #2492)
|
||||
- The scheduler now supports a CUPS-Get-Document operation
|
||||
that returns the specified print job document (STR #118)
|
||||
- The cupsfilter utility now supports a "-J jobid" option
|
||||
to filter the document from the specified job.
|
||||
- The scheduler (cupsd) now supports a new option (-t) to
|
||||
do a syntax check of the cupsd.conf file (STR #2003)
|
||||
- Added new cupsGetPPD3() API to allow applications to
|
||||
cache PPDs safely (STR #1473)
|
||||
- Added generic PostScript and PCL printer driver PPDs.
|
||||
@@ -1,47 +0,0 @@
|
||||
CREDITS.txt - 2008-12-08
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
like to thank the following individuals for their contributions:
|
||||
|
||||
Nathaniel Barbour - Lots of testing and feedback.
|
||||
N. Becker - setsid().
|
||||
Philippe Combes - French localization and buttons script.
|
||||
Jean-Eric Cuendet - GhostScript filters for CUPS.
|
||||
Van Dang - HTTP and IPP policeman.
|
||||
L. Peter Deutsch - MD5 code.
|
||||
Dr. ZP Han - setgid()/setuid().
|
||||
Guy Harris - *BSD shared libraries and lots of other
|
||||
fixes.
|
||||
Bjoern Jacke - I18N stuff.
|
||||
Wang Jian - CUPS RPM corrections.
|
||||
Roderick Johnstone - Beta tester of the millenium.
|
||||
Till Kamppeter - Bug fixes, beta testing, evangelism.
|
||||
Kenshi Muto - Japanese localization, patches, and
|
||||
testing.
|
||||
Tomohiro Kato - Japanese localization.
|
||||
Kiko - Bug fixes.
|
||||
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
|
||||
Marek Laane - Estonian translation.
|
||||
Mark Lawrence - Microsoft interoperability testing.
|
||||
Jeff Licquia - Bug fixes, beta testing, evangelism.
|
||||
Jason McMullan - Original CUPS RPM distributions.
|
||||
Wes Morgan - *BSD fixes.
|
||||
Daniel Nylander - Swedish localization.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
Citra Paska - Indonesian localization.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Vincenzo Reale - Italian localization.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
Juan Pablo Gonz‡lez Riopedre - Spanish localization.
|
||||
Opher Shachar - Hebrew localization.
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
Andrea Suatoni - IRIX desktop integration and testing.
|
||||
Teppo Turlianen - Finnish localization.
|
||||
Tim Waugh - Lots of patches, testing, and Linux
|
||||
integration.
|
||||
Yugami - LDAP browsing support.
|
||||
|
||||
If I've missed someone, please let me know by sending an email to
|
||||
"msweet@apple.com".
|
||||
-201
@@ -1,201 +0,0 @@
|
||||
INSTALL - CUPS v1.4b2 - 2008-12-15
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source code. For more
|
||||
information on CUPS see the file called "README.txt". A complete change log can
|
||||
be found in "CHANGES.txt".
|
||||
|
||||
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
|
||||
**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
|
||||
**** GHOSTSCRIPT WITH THE "cups" DRIVER AFTER YOU INSTALL ****
|
||||
**** CUPS. ****
|
||||
|
||||
|
||||
BEFORE YOU BEGIN
|
||||
|
||||
You'll need ANSI-compliant C and C++ compilers, plus a make program and
|
||||
POSIX-compliant shell (/bin/sh). The GNU compiler tools and Bash work well
|
||||
and we have tested the current CUPS code against several versions of GCC
|
||||
with excellent results.
|
||||
|
||||
The makefiles used by the project should work with most versions of make.
|
||||
We've tested them with GNU make as well as the make programs shipped by
|
||||
Compaq, HP, SGI, and Sun. BSD users should use GNU make (gmake) since BSD
|
||||
make does not support "include".
|
||||
|
||||
Besides these tools you'll want 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.
|
||||
|
||||
Also, please note that CUPS does not include the Ghostscript-based
|
||||
PostScript filter needed by non-PostScript printers. You *must* download
|
||||
GPL Ghostscript separately from the CUPS web site if you want to print
|
||||
PostScript files to non-PostScript printers on operating systems other than
|
||||
Mac OS X.
|
||||
|
||||
|
||||
COMPILING THE SUBVERSION REPOSITORY CODE
|
||||
|
||||
The CUPS Subversion repository doesn't hold a copy of the pre-built
|
||||
configure script. You'll need to run the GNU autoconf software (2.60 or
|
||||
higher) to create it:
|
||||
|
||||
autoconf -f
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
|
||||
CUPS uses GNU autoconf, so you should find the usual "configure" script in
|
||||
the main CUPS source directory. To configure CUPS for your system, type:
|
||||
|
||||
./configure
|
||||
|
||||
The default installation will put the CUPS software in the "/etc", "/usr",
|
||||
and "/var" directories on your system, which will overwrite any existing
|
||||
printing commands on your system. Use the "--prefix" option to install the
|
||||
CUPS software in another location:
|
||||
|
||||
./configure --prefix=/some/directory
|
||||
|
||||
To see a complete list of configuration options, use the --help option:
|
||||
|
||||
./configure --help
|
||||
|
||||
If any of the dependent libraries are not installed in a system default
|
||||
location (typically "/usr/include" and "/usr/lib") you'll need to set the
|
||||
CFLAGS, CPPFLAGS, CXXFLAGS, DSOFLAGS, and LDFLAGS environment variables
|
||||
prior to running configure:
|
||||
|
||||
setenv CFLAGS "-I/some/directory"
|
||||
setenv CPPFLAGS "-I/some/directory"
|
||||
setenv CXXFLAGS "-I/some/directory"
|
||||
setenv DSOFLAGS "-L/some/directory"
|
||||
setenv LDFLAGS "-L/some/directory"
|
||||
./configure ...
|
||||
|
||||
or:
|
||||
|
||||
CFLAGS="-I/some/directory" \
|
||||
CPPFLAGS="-I/some/directory" \
|
||||
CXXFLAGS="-I/some/directory" \
|
||||
DSOFLAGS="-L/some/directory" \
|
||||
LDFLAGS="-L/some/directory" \
|
||||
./configure ...
|
||||
|
||||
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
|
||||
|
||||
or if you have FreeBSD, NetBSD, or OpenBSD type:
|
||||
|
||||
gmake ENTER
|
||||
|
||||
to build the software.
|
||||
|
||||
|
||||
TESTING THE SOFTWARE
|
||||
|
||||
Aside from the built-in unit tests, CUPS includes an automated test
|
||||
framework for testing the entire printing system. To run the tests, just
|
||||
type:
|
||||
|
||||
make check ENTER
|
||||
|
||||
or if you have FreeBSD, NetBSD, or OpenBSD type:
|
||||
|
||||
gmake check ENTER
|
||||
|
||||
The test framework runs a copy of the CUPS scheduler (cupsd) on port 8631
|
||||
in /tmp/cups-$USER and produces a nice HTML report of the results.
|
||||
|
||||
|
||||
INSTALLING THE SOFTWARE
|
||||
|
||||
Once you have built the software you need to install it. The "install"
|
||||
target provides a quick way to install the software on your local system:
|
||||
|
||||
make install ENTER
|
||||
|
||||
or for FreeBSD, NetBSD, or OpenBSD:
|
||||
|
||||
gmake install ENTER
|
||||
|
||||
You can also build binary packages that can be installed on other machines
|
||||
using the RPM spec file ("packaging/cups.spec") or EPM list file
|
||||
("packaging/cups.list"). The latter also supports building of binary RPMs,
|
||||
so it may be more convenient to use.
|
||||
|
||||
You can find the RPM software at:
|
||||
|
||||
http://www.rpm.org/
|
||||
|
||||
The EPM software is available at:
|
||||
|
||||
http://www.epmhome.org/
|
||||
|
||||
|
||||
CREATING BINARY DISTRIBUTIONS WITH EPM
|
||||
|
||||
The top level makefile supports generation of many types of binary
|
||||
distributions using EPM. To build a binary distribution type:
|
||||
|
||||
make <format> ENTER
|
||||
|
||||
or
|
||||
|
||||
gmake <format> ENTER
|
||||
|
||||
for FreeBSD, NetBSD, and OpenBSD. The <format> target is one of the
|
||||
following:
|
||||
|
||||
epm - Builds a script + tarfile package
|
||||
aix - Builds an AIX package
|
||||
bsd - Builds a *BSD package
|
||||
deb - Builds a Debian package
|
||||
depot - Builds a HP-UX package (also swinstall)
|
||||
inst - Builds an IRIX package (also tardist)
|
||||
osx - Builds a MacOS X package
|
||||
pkg - Builds a Solaris package
|
||||
rpm - Builds a RPM package
|
||||
setld - Build a Tru64 UNIX package
|
||||
slackware - Build a Slackware package
|
||||
swinstall - Build a HP-UX package (also depot)
|
||||
tardist - Builds an IRIX package (also inst)
|
||||
|
||||
|
||||
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:
|
||||
|
||||
http://www.cups.org/newsgroups.php
|
||||
|
||||
Include your operating system and version, compiler and version, and any
|
||||
errors or problems you've run into. The "config.log" file and the output
|
||||
from the configure script and make should also be sent, as it often helps to
|
||||
determine the cause of your problem.
|
||||
|
||||
If you are running a version of Linux, be sure to provide the Linux
|
||||
distribution you have, too.
|
||||
+386
@@ -0,0 +1,386 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Software License Agreement - Common UNIX Printing System</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR=#ffffff>
|
||||
|
||||
<H2 ALIGN="CENTER">Common UNIX Printing System License Agreement</H2>
|
||||
|
||||
<P ALIGN="CENTER">Copyright 1997-1999 by Easy Software Products<BR>
|
||||
44141 AIRPORT VIEW DR STE 204<BR>
|
||||
HOLLYWOOD, MARYLAND 20636-3111 USA<BR>
|
||||
<BR>
|
||||
Voice: +1.301.373.9603<BR>
|
||||
Email: cups-info@cups.org<BR>
|
||||
WWW: http://www.cups.org
|
||||
|
||||
<H3>Introduction</H3>
|
||||
|
||||
<P>The Common UNIX Printing System<SUP>TM</SUP>, or CUPS<SUP>TM</SUP>,
|
||||
is provided under the GNU General Public License, Version 2. A copy of
|
||||
this license follows this introduction.
|
||||
|
||||
<P>For those not familiar with the GNU General Public License, the license
|
||||
basically allows you to:
|
||||
|
||||
<UL>
|
||||
|
||||
<LI>Use the CUPS software at no charge.
|
||||
|
||||
<LI>Distribute verbatim copies of the software in source or
|
||||
binary form.
|
||||
|
||||
<LI>Sell verbatim copies of the software for a media fee, or
|
||||
sell support for the software.
|
||||
|
||||
<LI>Distribute or sell printer drivers and filters that use the
|
||||
CUPS API so long as source code is made available under the GPL.
|
||||
|
||||
</UL>
|
||||
|
||||
<P>What this license <B>does not</B> allow you to do is make changes or
|
||||
add features to CUPS and then sell a binary distribution without source
|
||||
code. You have to provide source for any new drivers, changes, or
|
||||
additions to the software, and all code must be provided under the GPL.
|
||||
|
||||
<P>Also, since we have trademarked the Common UNIX Printing System, CUPS,
|
||||
and CUPS logo, you may not release a derivative product using those names
|
||||
without permission from Easy Software Products.
|
||||
|
||||
<H3>Binary Distribution Rights</H3>
|
||||
|
||||
<P>Easy Software Products also sells rights to the CUPS source code
|
||||
under a binary distribution license for vendors that are unable to
|
||||
release source code for their drivers or additions and modifications to
|
||||
CUPS under the GPL. For pricing information please contact us at the
|
||||
address shown above.
|
||||
|
||||
<P>The Common UNIX Printing System utilizes GNU GhostScript 4.03 to
|
||||
convert PostScript files into a stream of raster images. For binary
|
||||
distribution licensing of this software, please contact:
|
||||
|
||||
<BLOCKQUOTE>Miles Jones<BR>
|
||||
Director of Marketing<BR>
|
||||
Artifex Software Inc.<BR>
|
||||
454 Las Gallinas Ave., Suite 108<BR>
|
||||
San Rafael, CA 94903 USA<BR>
|
||||
Voice: +1.415.492.9861<BR>
|
||||
Fax: +1.415.492.9862<BR>
|
||||
EMail: info@arsoft.com
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3>Support</H3>
|
||||
|
||||
<P>Easy Software Products sells software support for distributors and
|
||||
resellers of CUPS. Support for users of CUPS is available from Easy
|
||||
Software Products through our ESP Print software.
|
||||
|
||||
<H3>Trademarks</H3>
|
||||
|
||||
<P>The Common UNIX Printing System, CUPS, and the CUPS logo are the
|
||||
trademark property of Easy Software Products. Any derivative of this
|
||||
software may not use any of these trademarks without the expressed
|
||||
written consent of Easy Software Products.
|
||||
|
||||
<H2 ALIGN="CENTER">GNU General Public License</H2>
|
||||
|
||||
<P ALIGN="CENTER">Version 2, June 1991<BR>
|
||||
<BR>
|
||||
Copyright 1989, 1991 Free Software Foundation, Inc.<BR>
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
<P ALIGN="CENTER">Everyone is permitted to copy and distribute verbatim
|
||||
copies of this license document, but changing it is not allowed.
|
||||
|
||||
<H3>Preamble</H3>
|
||||
|
||||
<P>The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
<P>When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
<P>To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
<P>For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
<P>We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
<P>Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
<P>Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
<P>The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
<H3>GNU GENERAL PUBLIC LICENSE<BR>
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H3>
|
||||
|
||||
<OL START="0">
|
||||
|
||||
<LI>This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
<P>Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
<LI>You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
<P>You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
<LI>You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
<OL TYPE="a">
|
||||
|
||||
<LI>You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
<LI>You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
<LI>if the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
</OL>
|
||||
|
||||
<P>These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
<P>Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
<P>In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
<LI>You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
<OL TYPE="a">
|
||||
|
||||
<LI>Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
<LI>Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
<LI>Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
</OL>
|
||||
|
||||
<P>The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
<P>If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
<LI>You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
<LI>You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
<LI>Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
<LI>If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
<P>If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
<P>It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
<P>This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
<LI>If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
<LI>The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
<P>Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
<LI>If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
</OL>
|
||||
|
||||
<H3>NO WARRANTY</H3>
|
||||
|
||||
<OL START="11">
|
||||
|
||||
<LI>BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
<LI>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
</OL>
|
||||
|
||||
<H3>END OF TERMS AND CONDITIONS</H3>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
+330
-966
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+59
-229
@@ -3,182 +3,68 @@
|
||||
#
|
||||
# Common makefile definitions for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
# @configure_input@
|
||||
#
|
||||
# Copyright 1997-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
#
|
||||
# Programs...
|
||||
#
|
||||
|
||||
AR = @AR@
|
||||
AWK = @AWK@
|
||||
CC = @LIBTOOL@ @CC@
|
||||
CXX = @LIBTOOL@ @CXX@
|
||||
DSO = @DSO@
|
||||
DSOXX = @DSOXX@
|
||||
HTMLDOC = @HTMLDOC@
|
||||
INSTALL = @INSTALL@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN = @LN@ -sf
|
||||
MV = @MV@
|
||||
PHPCONFIG = @PHPCONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@ -f
|
||||
RMDIR = @RMDIR@
|
||||
SED = @SED@
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
||||
#
|
||||
# Installation programs...
|
||||
#
|
||||
|
||||
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 @INSTALL_STRIP@
|
||||
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_MAN = $(INSTALL) -m 644
|
||||
INSTALL_SCRIPT = $(INSTALL) -m 755
|
||||
|
||||
#
|
||||
# Default user, group, and system groups for the scheduler...
|
||||
#
|
||||
|
||||
CUPS_USER = @CUPS_USER@
|
||||
CUPS_GROUP = @CUPS_GROUP@
|
||||
CUPS_SYSTEM_GROUPS = @CUPS_SYSTEM_GROUPS@
|
||||
CUPS_PRIMARY_SYSTEM_GROUP = @CUPS_PRIMARY_SYSTEM_GROUP@
|
||||
|
||||
#
|
||||
# Default permissions...
|
||||
#
|
||||
|
||||
CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
|
||||
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
|
||||
|
||||
#
|
||||
# Languages to install...
|
||||
#
|
||||
|
||||
LANGUAGES = @LANGUAGES@
|
||||
INSTALL_LANGUAGES = @INSTALL_LANGUAGES@
|
||||
UNINSTALL_LANGUAGES = @UNINSTALL_LANGUAGES@
|
||||
|
||||
#
|
||||
# Libraries...
|
||||
#
|
||||
|
||||
LIBCUPS = @LIBCUPS@
|
||||
LIBCUPSCGI = @LIBCUPSCGI@
|
||||
LIBCUPSDRIVER = @LIBCUPSDRIVER@
|
||||
LIBCUPSIMAGE = @LIBCUPSIMAGE@
|
||||
LIBCUPSMIME = @LIBCUPSMIME@
|
||||
LIBCUPSPPDC = @LIBCUPSPPDC@
|
||||
LIBJPEG = @LIBJPEG@
|
||||
LIBLDAP = @LIBLDAP@
|
||||
LIBMALLOC = @LIBMALLOC@
|
||||
LIBPAPER = @LIBPAPER@
|
||||
LIBPNG = @LIBPNG@
|
||||
LIBSLP = @LIBSLP@
|
||||
LIBGSSAPI = @LIBGSSAPI@
|
||||
LIBTIFF = @LIBTIFF@
|
||||
LIBUSB = @LIBUSB@
|
||||
LIBWRAP = @LIBWRAP@
|
||||
LIBZ = @LIBZ@
|
||||
|
||||
#
|
||||
# Install static libraries?
|
||||
#
|
||||
|
||||
INSTALLSTATIC = @INSTALLSTATIC@
|
||||
AR = @AR@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CHMOD = @CHMOD@
|
||||
CP = @CP@
|
||||
HTMLDOC = @HTMLDOC@
|
||||
LN = /bin/ln -sf
|
||||
MKDIR = @MKDIR@ -p
|
||||
NROFF = @NROFF@
|
||||
PACK = @PACK@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@ -f
|
||||
SED = @SED@
|
||||
SHELL = /bin/sh
|
||||
SMBCLIENT = @SMBCLIENT@
|
||||
|
||||
#
|
||||
# Program options...
|
||||
#
|
||||
# ARCHFLAGS Defines the default architecture build options.
|
||||
# ARCH32FLAGS Defines the 32-bit architecture build options, used
|
||||
# when compiling separate 32/64-bit libraries.
|
||||
# ARCH64FLAGS Defines the 64-bit architecture build options, used
|
||||
# when compiling separate 32/64-bit libraries.
|
||||
# OPTIM Defines the common compiler optimization/debugging options
|
||||
# for all architectures.
|
||||
# OPTIONS Defines other compile-time options (currently only -DDEBUG
|
||||
# for extra debug info)
|
||||
# OPTIM defines the common compiler optimization/debugging options.
|
||||
# OPTIONS defines other compile-time options (currently only -dDEBUG for
|
||||
# extra debug info)
|
||||
#
|
||||
|
||||
ALL_CFLAGS = -I.. -D_CUPS_SOURCE $(CFLAGS) $(SSLFLAGS) \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
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@
|
||||
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@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
|
||||
LEGACY_BACKENDS = @LEGACY_BACKENDS@
|
||||
LIBCUPSORDER = @LIBCUPSORDER@
|
||||
LIBCUPSIMAGEORDER = @LIBCUPSIMAGEORDER@
|
||||
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
OPTIM = @OPTIM@
|
||||
OPTIONS =
|
||||
PAMLIBS = @PAMLIBS@
|
||||
PAP = @PAP@
|
||||
PDFTOPS = @PDFTOPS@
|
||||
PHPDIR = @PHPDIR@
|
||||
PHPOPTIONS = @PHPOPTIONS@ -I../.. `$(PHPCONFIG) --includes`
|
||||
SSLFLAGS = @SSLFLAGS@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
TEXTTOPS = @TEXTTOPS@
|
||||
UNITTESTS = @UNITTESTS@
|
||||
|
||||
ARFLAGS = crvs
|
||||
CFLAGS = @CFLAGS@ $(OPTIM) -I.. $(OPTIONS)
|
||||
IMGLIBS = @IMGLIBS@ $(LIBS) -lm
|
||||
LDFLAGS = @LDFLAGS@ $(OPTIM)
|
||||
LIBS = @LIBS@ -L../cups -lcups
|
||||
OPTIM = @OPTIM@
|
||||
OPTIONS =
|
||||
|
||||
#
|
||||
# Separate 32/64-bit library support...
|
||||
# Formatted man page extension...
|
||||
#
|
||||
|
||||
ARCH32FLAGS = @ARCH32FLAGS@
|
||||
DSO32FLAGS = @DSO32FLAGS@
|
||||
INSTALL32 = @INSTALL32@
|
||||
LIB32CUPS = @LIB32CUPS@
|
||||
LIB32CUPSIMAGE = @LIB32CUPSIMAGE@
|
||||
LIB32DIR = $(BUILDROOT)@LIB32DIR@
|
||||
UNINSTALL32 = @UNINSTALL32@
|
||||
|
||||
ARCH64FLAGS = @ARCH64FLAGS@
|
||||
DSO64FLAGS = @DSO64FLAGS@
|
||||
INSTALL64 = @INSTALL64@
|
||||
LIB64CUPS = @LIB64CUPS@
|
||||
LIB64CUPSIMAGE = @LIB64CUPSIMAGE@
|
||||
LIB64DIR = $(BUILDROOT)@LIB64DIR@
|
||||
UNINSTALL64 = @UNINSTALL64@
|
||||
CAT = @CAT@
|
||||
|
||||
#
|
||||
# Directories...
|
||||
@@ -188,16 +74,12 @@ UNINSTALL64 = @UNINSTALL64@
|
||||
# We have to define these first because autoconf uses ${prefix}
|
||||
# and ${exec_prefix} for most of the other directories...
|
||||
#
|
||||
# The "datarootdir" variable may not get defined if you are using
|
||||
# a version of autoconf prior to 2.60.
|
||||
#
|
||||
# This is immediately followed by definition in ALL CAPS for the
|
||||
# needed directories...
|
||||
#
|
||||
|
||||
bindir = @bindir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
exec_prefix = @exec_prefix@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
@@ -213,80 +95,28 @@ srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
BUILDROOT = $(DSTROOT)
|
||||
|
||||
AMANDIR = $(BUILDROOT)@AMANDIR@
|
||||
BINDIR = $(BUILDROOT)@bindir@
|
||||
CACHEDIR = $(BUILDROOT)@CUPS_CACHEDIR@
|
||||
DATADIR = $(BUILDROOT)@CUPS_DATADIR@
|
||||
DOCDIR = $(BUILDROOT)@CUPS_DOCROOT@
|
||||
ICONDIR = @ICONDIR@
|
||||
INCLUDEDIR = $(BUILDROOT)$(includedir)
|
||||
INITDIR = @INITDIR@
|
||||
INITDDIR = @INITDDIR@
|
||||
LIBDIR = $(BUILDROOT)$(libdir)
|
||||
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
|
||||
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
|
||||
MANDIR = $(BUILDROOT)@mandir@
|
||||
MENUDIR = @MENUDIR@
|
||||
PMANDIR = $(BUILDROOT)@PMANDIR@
|
||||
RCLEVELS = @RCLEVELS@
|
||||
RCSTART = @RCSTART@
|
||||
RCSTOP = @RCSTOP@
|
||||
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
|
||||
SBINDIR = $(BUILDROOT)@sbindir@
|
||||
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
|
||||
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
|
||||
SMFMANIFESTDIR = @SMFMANIFESTDIR@
|
||||
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
|
||||
XINETD = @XINETD@
|
||||
|
||||
MAN1EXT = @MAN1EXT@
|
||||
MAN5EXT = @MAN5EXT@
|
||||
MAN7EXT = @MAN7EXT@
|
||||
MAN8EXT = @MAN8EXT@
|
||||
MAN8DIR = @MAN8DIR@
|
||||
|
||||
PAMDIR = @PAMDIR@
|
||||
PAMFILE = @PAMFILE@
|
||||
|
||||
DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
|
||||
DBUSDIR = @DBUSDIR@
|
||||
|
||||
BINDIR = @bindir@
|
||||
DATADIR = @CUPS_DATADIR@
|
||||
INCLUDEDIR = $(includedir)/cups
|
||||
LIBDIR = $(libdir)
|
||||
LOCALEDIR = @CUPS_LOCALEDIR@
|
||||
MANDIR = @mandir@
|
||||
SBINDIR = @sbindir@
|
||||
SERVERROOT = @CUPS_SERVERROOT@
|
||||
|
||||
#
|
||||
# Rules...
|
||||
#
|
||||
|
||||
.SILENT:
|
||||
.SUFFIXES: .1 .1.gz .1m .1m.gz .3 .3.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
|
||||
|
||||
.SUFFIXES: .a .c .gz .h .o .z .1 .5 .8
|
||||
.c.o:
|
||||
echo Compiling $<...
|
||||
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c $<
|
||||
|
||||
.c.32.o:
|
||||
echo Compiling 32-bit $<...
|
||||
$(CC) $(ARCH32FLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<
|
||||
|
||||
.c.64.o:
|
||||
echo Compiling 64-bit $<...
|
||||
$(CC) $(ARCH64FLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<
|
||||
|
||||
.cxx.o:
|
||||
echo Compiling $<...
|
||||
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c $<
|
||||
|
||||
.man.1 .man.1m .man.3 .man.5 .man.7 .man.8:
|
||||
echo Linking $<...
|
||||
$(RM) $@
|
||||
$(LN) $< $@
|
||||
|
||||
.man.1.gz .man.1m.gz .man.3.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
|
||||
echo -n Compressing $<...
|
||||
$(RM) $@
|
||||
gzip -v9 <$< >$@
|
||||
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
.1.z .5.z .8.z .1.gz .5.gz .8.gz:
|
||||
echo Formatting $<...
|
||||
$(NROFF) -man $< >t
|
||||
$(PACK) t
|
||||
-mv t.$(CAT) $@
|
||||
|
||||
#
|
||||
# End of "$Id$"
|
||||
|
||||
+33
-336
@@ -3,94 +3,44 @@
|
||||
#
|
||||
# Top-level Makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
# Copyright 1997-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include Makedefs
|
||||
|
||||
|
||||
#
|
||||
# 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 \
|
||||
$(PHPDIR) \
|
||||
conf data doc examples $(FONTS) templates
|
||||
|
||||
DIRS = cups backend berkeley cgi-bin filter man pstoraster \
|
||||
scheduler systemv
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all:
|
||||
chmod +x cups-config
|
||||
echo Using ARCHFLAGS="$(ARCHFLAGS)"
|
||||
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
|
||||
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
|
||||
echo Using CC="$(CC)"
|
||||
echo Using CXX="$(CC)"
|
||||
echo Using DSOFLAGS="$(DSOFLAGS)"
|
||||
echo Using LDFLAGS="$(LDFLAGS)"
|
||||
echo Using LIBS="$(LIBS)"
|
||||
for dir in $(DIRS); do\
|
||||
echo Making all in $$dir... ;\
|
||||
(cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\
|
||||
(cd $$dir; make);\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Make library targets...
|
||||
#
|
||||
|
||||
libs:
|
||||
echo Using ARCHFLAGS="$(ARCHFLAGS)"
|
||||
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
|
||||
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
|
||||
echo Using CC="$(CC)"
|
||||
echo Using CXX="$(CC)"
|
||||
echo Using DSOFLAGS="$(DSOFLAGS)"
|
||||
echo Using LDFLAGS="$(LDFLAGS)"
|
||||
echo Using LIBS="$(LIBS)"
|
||||
for dir in $(DIRS); do\
|
||||
echo Making libraries in $$dir... ;\
|
||||
(cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Make unit test targets...
|
||||
#
|
||||
|
||||
unittests:
|
||||
echo Using ARCHFLAGS="$(ARCHFLAGS)"
|
||||
echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
|
||||
echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
|
||||
echo Using CC="$(CC)"
|
||||
echo Using CXX="$(CC)"
|
||||
echo Using DSOFLAGS="$(DSOFLAGS)"
|
||||
echo Using LDFLAGS="$(LDFLAGS)"
|
||||
echo Using LIBS="$(LIBS)"
|
||||
for dir in $(DIRS); do\
|
||||
echo Making all in $$dir... ;\
|
||||
(cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Remove object and target files...
|
||||
#
|
||||
@@ -98,281 +48,28 @@ unittests:
|
||||
clean:
|
||||
for dir in $(DIRS); do\
|
||||
echo Cleaning in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
|
||||
(cd $$dir; make clean);\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Remove all non-distribution files...
|
||||
# Install object and target files...
|
||||
#
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makedefs config.h config.log config.status
|
||||
$(RM) cups-config
|
||||
$(RM) conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
|
||||
$(RM) doc/help/ref-cupsd-conf.html doc/help/standard.html doc/index.html
|
||||
$(RM) init/cups.sh init/cups-lpd init/org.cups.cups-lpd.plist
|
||||
$(RM) man/client.conf.man
|
||||
$(RM) man/cups-deviced.man man/cups-driverd.man
|
||||
$(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
|
||||
$(RM) man/cupsd.conf.man man/drv.man man/lpoptions.man
|
||||
$(RM) packaging/cups.list
|
||||
$(RM) packaging/cups-desc.plist packaging/cups-info.plist
|
||||
$(RM) templates/header.tmpl
|
||||
$(RM) desktop/cups.desktop
|
||||
$(RM) init/cups.xml
|
||||
-$(RM) doc/*/index.html
|
||||
-$(RM) templates/*/header.tmpl
|
||||
-$(RM) -r autom4te*.cache clang cups/charmaps cups/locale driver/test
|
||||
|
||||
|
||||
#
|
||||
# Make dependencies
|
||||
#
|
||||
|
||||
depend:
|
||||
install:
|
||||
for dir in $(DIRS); do\
|
||||
echo Making dependencies in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
|
||||
echo Installing in $$dir... ;\
|
||||
(cd $$dir; make install);\
|
||||
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...
|
||||
#
|
||||
|
||||
ctags:
|
||||
ctags -R .
|
||||
|
||||
|
||||
#
|
||||
# Install everything...
|
||||
#
|
||||
|
||||
install: install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
install-data:
|
||||
for dir in $(DIRS); do\
|
||||
echo Installing data files in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\
|
||||
done
|
||||
echo Installing cups-config script...
|
||||
$(INSTALL_DIR) -m 755 $(BINDIR)
|
||||
$(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
|
||||
if test "x$(INITDIR)" != x; then \
|
||||
echo Installing init scripts...; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
|
||||
for level in $(RCLEVELS); do \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
|
||||
$(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups; \
|
||||
if test `uname` = HP-UX; then \
|
||||
level=`expr $$level - 1`; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
|
||||
fi; \
|
||||
$(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups; \
|
||||
done; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
|
||||
$(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \
|
||||
fi
|
||||
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
|
||||
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
|
||||
if test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
|
||||
echo Installing LaunchDaemons configuration files...; \
|
||||
$(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
|
||||
$(INSTALL_DATA) init/org.cups.cups-lpd.plist $(BUILDROOT)/System/Library/LaunchDaemons; \
|
||||
case `uname -r` in \
|
||||
8.*) \
|
||||
$(INSTALL_DIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices; \
|
||||
$(INSTALL_SCRIPT) init/PrintingServices.launchd $(BUILDROOT)/System/Library/StartupItems/PrintingServices/PrintingServices; \
|
||||
$(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)/System/Library/StartupItems/PrintingServices/StartupParameters.plist; \
|
||||
$(INSTALL_DIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices/Resources/English.lproj; \
|
||||
$(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)/System/Library/StartupItems/PrintingServices/Resources/English.lproj/Localizable.strings; \
|
||||
;; \
|
||||
esac \
|
||||
else \
|
||||
echo Installing RC script...; \
|
||||
$(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; \
|
||||
$(INSTALL_DATA) packaging/cups-dbus.conf $(BUILDROOT)$(DBUSDIR)/system.d/cups.conf; \
|
||||
fi
|
||||
if test "x$(XINETD)" != x; then \
|
||||
echo Installing xinetd configuration file for cups-lpd...; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
|
||||
$(INSTALL_DATA) init/cups-lpd $(BUILDROOT)$(XINETD)/cups-lpd; \
|
||||
fi
|
||||
if test "x$(MENUDIR)" != x; then \
|
||||
echo Installing desktop menu...; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(MENUDIR); \
|
||||
$(INSTALL_DATA) desktop/cups.desktop $(BUILDROOT)$(MENUDIR); \
|
||||
fi
|
||||
if test "x$(ICONDIR)" != x; then \
|
||||
echo Installing desktop icons...; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps; \
|
||||
$(INSTALL_DATA) desktop/cups-16.png $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps; \
|
||||
$(INSTALL_DATA) desktop/cups-32.png $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps; \
|
||||
$(INSTALL_DATA) desktop/cups-64.png $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps; \
|
||||
$(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-exec: all
|
||||
for dir in $(DIRS); do\
|
||||
echo Installing programs in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Install libraries...
|
||||
#
|
||||
|
||||
install-libs: libs
|
||||
for dir in $(DIRS); do\
|
||||
echo Installing libraries in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Uninstall object and target files...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for dir in $(DIRS); do\
|
||||
echo Uninstalling in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
|
||||
done
|
||||
echo Uninstalling cups-config script...
|
||||
$(RM) $(BINDIR)/cups-config
|
||||
-$(RMDIR) $(BINDIR)
|
||||
echo Uninstalling startup script...
|
||||
if test "x$(INITDIR)" != x; then \
|
||||
$(RM) $(BUILDROOT)$(INITDIR)/init.d/cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDIR)/init.d; \
|
||||
$(RM) $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
|
||||
$(RM) $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
|
||||
$(RM) $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
|
||||
$(RM) $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
|
||||
fi
|
||||
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then \
|
||||
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
|
||||
$(RM) $(BUILDROOT)$(INITDDIR)/PrintingServices; \
|
||||
$(RM) $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
|
||||
$(RM) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
|
||||
elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
|
||||
$(RM) $(BUILDROOT)$(INITDDIR)/org.cups.cupsd.plist; \
|
||||
$(RM) $(BUILDROOT)$(INITDDIR)/org.cups.cups-lpd.plist; \
|
||||
$(RMDIR) $(BUILDROOT)/System/Library/StartupItems/PrintingServices; \
|
||||
else \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
|
||||
fi \
|
||||
$(RMDIR) $(BUILDROOT)$(INITDDIR); \
|
||||
fi
|
||||
if test "x$(DBUSDIR)" != x; then \
|
||||
echo Uninstalling cups.conf in $(DBUSDIR)...;\
|
||||
$(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
|
||||
$(RMDIR) $(BUILDROOT)$(DBUSDIR); \
|
||||
fi
|
||||
$(RM) $(BUILDROOT)/etc/xinetd.d/cups-lpd
|
||||
$(RM) $(BUILDROOT)/usr/share/applications/cups.desktop
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/16x16/apps/cups.png
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/32x32/apps/cups.png
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/64x64/apps/cups.png
|
||||
$(RM) $(BUILDROOT)/usr/share/icons/hicolor/128x128/apps/cups.png
|
||||
|
||||
|
||||
#
|
||||
# Run the test suite...
|
||||
#
|
||||
|
||||
test: all
|
||||
echo Running CUPS test suite...
|
||||
cd test; ./run-stp-tests.sh
|
||||
|
||||
|
||||
check: all
|
||||
echo Running CUPS test suite with defaults...
|
||||
cd test; ./run-stp-tests.sh 1 0 n
|
||||
|
||||
|
||||
#
|
||||
# Make software distributions using EPM (http://www.easysw.com/epm/)...
|
||||
#
|
||||
|
||||
EPMFLAGS = -v --output-dir dist $(EPMARCH)
|
||||
|
||||
aix bsd deb depot inst pkg setld slackware swinstall tardist:
|
||||
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
|
||||
|
||||
epm:
|
||||
epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
|
||||
|
||||
osx:
|
||||
epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list
|
||||
|
||||
rpm:
|
||||
epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list
|
||||
|
||||
.PHONEY: dist
|
||||
dist: all
|
||||
$(RM) -r dist
|
||||
$(MAKE) $(MFLAGS) epm
|
||||
case `uname` in \
|
||||
*BSD*) $(MAKE) $(MFLAGS) bsd;; \
|
||||
Darwin*) $(MAKE) $(MFLAGS) osx;; \
|
||||
IRIX*) $(MAKE) $(MFLAGS) tardist;; \
|
||||
Linux*) $(MAKE) $(MFLAGS) rpm;; \
|
||||
SunOS*) $(MAKE) $(MFLAGS) pkg;; \
|
||||
esac
|
||||
|
||||
echo Installing in conf...
|
||||
(cd conf; make install)
|
||||
echo Installing in data...
|
||||
(cd data; make install)
|
||||
echo Installing in doc...
|
||||
(cd doc; make install)
|
||||
echo Installing in fonts...
|
||||
(cd fonts; make install)
|
||||
echo Installing in ppd...
|
||||
(cd ppd; make install)
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>README - Common UNIX Printing System</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H1>README - CUPS v1.0b4</H1>
|
||||
|
||||
<H2>Contents</H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="#intro">Introduction</A>
|
||||
<LI><A HREF="#require">Requirements</A>
|
||||
<LI><A HREF="#use">Using CUPS</A>
|
||||
<LI><A HREF="#known">Known Problems</A>
|
||||
<LI><A HREF="#report">Reporting Problems</A>
|
||||
<LI><A HREF="#resources">Other Resources</A>
|
||||
<LI><A HREF="#legal">Legal Stuff</A>
|
||||
</UL>
|
||||
|
||||
<H2><A NAME="intro">Introduction</A></H2>
|
||||
|
||||
The Common UNIX Printing System provides a portable printing layer for
|
||||
UNIX® operating systems. It has been developed by Easy Software
|
||||
Products to promote a standard printing solution for all UNIX vendors
|
||||
and users. CUPS provides the System V and Berkeley command-line
|
||||
interfaces.
|
||||
|
||||
<P>CUPS uses the Internet Printing Protocol (IETF-IPP) as the basis
|
||||
for managing print jobs and queues. The Line Printer Daemon (LPD,
|
||||
RFC1179), Server Message Block (SMB), and AppSocket protocols are also
|
||||
supported with reduced functionality.
|
||||
|
||||
<P>CUPS adds network printer browsing and PostScript Printer
|
||||
Description ("PPD")-based printing options to support real
|
||||
world applications under UNIX.
|
||||
|
||||
<P>CUPS also includes a customized version of GNU GhostScript (currently
|
||||
based off GNU GhostScript 4.03) and an image file RIP that can be used to
|
||||
support non-PostScript printers.
|
||||
|
||||
<H2><A NAME="require">Requirements</A></H2>
|
||||
|
||||
You'll need an ANSI C compiler to build CUPS on your system. As its name
|
||||
implies, CUPS is designed to run on the UNIX operating system, however
|
||||
the CUPS interface library and most of the filters and backends supplied
|
||||
with CUPS should also run under Microsoft® Windows®.
|
||||
|
||||
<P>For the image file filters you'll need the JPEG, PNG, TIFF, and ZLIB
|
||||
libraries. CUPS will build without these, but with reduced functionality.
|
||||
|
||||
<P>If you make changes to the man pages you'll need GNU groff or another
|
||||
nroff-like package.
|
||||
|
||||
<P>The documentation is formatted using the HTMLDOC software (again, not
|
||||
needed unless you make changes.)
|
||||
|
||||
<H2><A NAME="use">Using CUPS</A></H2>
|
||||
|
||||
<P>Pre-compiled binary distributions are available for CUPS from our
|
||||
web site at
|
||||
<A HREF="http://www.cups.org/software.html">http://www.cups.org/software.html</A>.
|
||||
If you'd like to build CUPS from the source, please read the Software
|
||||
Administrator's Manual.
|
||||
|
||||
<P>Once you have installed CUPS, the Software Administrator's Manual and
|
||||
Software User's Manual are excellent places to start setting things up.
|
||||
|
||||
<H2><A NAME="known">Known Problems</A></H2>
|
||||
|
||||
The following known problems are being worked on and should be resolved for
|
||||
the fourth beta release of CUPS:
|
||||
|
||||
<UL>
|
||||
|
||||
<LI>Documentation is not completed.
|
||||
|
||||
<LI>The lpc command currently only supports the help and status
|
||||
commands.
|
||||
|
||||
</UL>
|
||||
|
||||
CUPS has been built and tested on the following operating systems:
|
||||
|
||||
<UL>
|
||||
<LI>Digital UNIX 4.0d
|
||||
<LI>HP-UX 10.20 and 11.0
|
||||
<LI>IRIX 5.3, 6.2, 6.5.3
|
||||
<LI>Linux (RedHat 5.2)
|
||||
<LI>Solaris 2.5.1, 2.6, 2.7 (aka 7)
|
||||
</UL>
|
||||
|
||||
The client libraries and filters have been successfully compiled under
|
||||
Microsoft Windows using Visual C++ 6.0.
|
||||
|
||||
<H2><A NAME="report">Reporting Problems</A></H2>
|
||||
|
||||
If you have problems, please send an email to
|
||||
<A HREF="mailto:cups-support@cups.org">cups-support@cups.org</A>. Include
|
||||
your operating system and version, compiler and version, and any errors
|
||||
or problems you've run into.
|
||||
|
||||
<H2><A NAME="resources">Other Resources</A></H2>
|
||||
|
||||
See the CUPS web site at "http://www.cups.org" for other site links.
|
||||
|
||||
<P>You can subscribe to the CUPS mailing list by sending a message containing
|
||||
"subscribe cups" to <A HREF="mailto:majordomo@cups.org">majordomo@cups.org</A>.
|
||||
This list is provided to discuss problems, questions, and improvements to
|
||||
the CUPS software. New releases of CUPS are announced to this list as well.
|
||||
|
||||
<H2><A NAME="legal">Legal Stuff</A></H2>
|
||||
|
||||
CUPS is Copyright 1993-1999 by Easy Software Products. CUPS, the CUPS logo,
|
||||
and the Common UNIX Printing System are the trademark property of Easy Software
|
||||
Products.
|
||||
|
||||
<P>CUPS is provided under the terms of the
|
||||
<A HREF="LICENSE.html">GNU General Public License</A>
|
||||
which is located in the files "LICENSE.html" and "LICENSE.txt". For commercial
|
||||
support and "binary-only" licensing information, please contact:
|
||||
|
||||
<UL>
|
||||
Attn: CUPS Licensing Information
|
||||
<BR>Easy Software Products
|
||||
<BR>44141 Airport View Drive, Suite 204
|
||||
<BR>Hollywood, Maryland 20636-3111 USA
|
||||
|
||||
<P>Voice: +1.301.373.9603
|
||||
<BR>Email: <A HREF="mailto:cups-info@cups.org">cups-info@cups.org</A>
|
||||
<BR>WWW: <A HREF="http://www.cups.org">http://www.cups.org</A>
|
||||
</UL>
|
||||
|
||||
<P>If you're interested in a complete, commercial printing solution for UNIX,
|
||||
check out our ESP Print software at <A HREF="http://www.easysw.com/print.html">
|
||||
http://www.easysw.com/print.html</A>.
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
+82
-139
@@ -1,177 +1,120 @@
|
||||
README - CUPS v1.4b2 - 2008-12-15
|
||||
---------------------------------
|
||||
README - CUPS v1.0b4
|
||||
--------------------
|
||||
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
********** **********
|
||||
********** 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) **********
|
||||
********** **********
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
CONTENTS
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
instead...
|
||||
* Introduction
|
||||
* Requirements
|
||||
* Using CUPS
|
||||
* Known Problems
|
||||
* Reporting Problems
|
||||
* Other Resources
|
||||
* Legal Stuff
|
||||
|
||||
|
||||
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!
|
||||
The Common UNIX Printing System provides a portable printing layer for UNIX®
|
||||
operating systems. It has been developed by Easy Software Products to
|
||||
promote a standard printing solution for all UNIX vendors and users. CUPS
|
||||
provides the System V and Berkeley command-line interfaces.
|
||||
|
||||
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 (IETF-IPP) as the basis for
|
||||
managing print jobs and queues. The Line Printer Daemon (LPD, RFC1179),
|
||||
Server Message Block (SMB), and AppSocket protocols are also supported with
|
||||
reduced functionality.
|
||||
|
||||
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 adds network printer browsing and PostScript Printer Description
|
||||
("PPD")-based printing options to support real world applications under
|
||||
UNIX.
|
||||
|
||||
CUPS also includes a customized version of GNU GhostScript (currently based
|
||||
off GNU GhostScript 4.03) and an image file RIP that can be used to support
|
||||
non-PostScript printers.
|
||||
|
||||
|
||||
READING THE DOCUMENTATION
|
||||
REQUIREMENTS
|
||||
|
||||
Once you have installed the software you can access the documentation (and
|
||||
a bunch of other stuff) online at:
|
||||
You'll need an ANSI C compiler to build CUPS on your system. As its name
|
||||
implies, CUPS is designed to run on the UNIX operating system, however the
|
||||
CUPS interface library and most of the filters and backends supplied with
|
||||
CUPS should also run under Microsoft® Windows®.
|
||||
|
||||
http://localhost:631/
|
||||
For the image file filters you'll need the JPEG, PNG, TIFF, and ZLIB
|
||||
libraries. CUPS will build without these, but with reduced functionality.
|
||||
|
||||
If you're having trouble getting that far, the documentation is located
|
||||
under the "doc/help" directory.
|
||||
If you make changes to the man pages you'll need GNU groff or another
|
||||
nroff-like package.
|
||||
|
||||
Please read the documentation before asking questions.
|
||||
The documentation is formatted using the HTMLDOC software (again, not needed
|
||||
unless you make changes.)
|
||||
|
||||
|
||||
GETTING SUPPORT AND OTHER RESOURCES
|
||||
USING CUPS
|
||||
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! We also provide many
|
||||
discussion forums which are available at:
|
||||
Pre-compiled binary distributions are available for CUPS from our web site
|
||||
at http://www.cups.org/software.html. If you'd like to build CUPS from the
|
||||
source, please read the Software Administrator's Manual.
|
||||
|
||||
http://www.cups.org/newsgroups.php
|
||||
|
||||
See the CUPS web site at "http://www.cups.org/" for other resources.
|
||||
Once you have installed CUPS, the Software Administrator's Manual and
|
||||
Software User's Manual are excellent places to start setting things up.
|
||||
|
||||
|
||||
SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
|
||||
KNOWN PROBLEMS
|
||||
|
||||
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:
|
||||
The following known problems are being worked on and should be resolved for
|
||||
the fourth beta release of CUPS:
|
||||
|
||||
http://localhost:631/admin/
|
||||
* Documentation is not completed.
|
||||
* The lpc command currently only supports the help and status commands.
|
||||
|
||||
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.
|
||||
CUPS has been built and tested on the following operating systems:
|
||||
|
||||
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.
|
||||
* Digital UNIX 4.0d
|
||||
* HP-UX 10.20 and 11.0
|
||||
* IRIX 5.3, 6.2, 6.5.3
|
||||
* Linux (RedHat 5.2)
|
||||
* Solaris 2.5.1, 2.6, 2.7 (aka 7)
|
||||
|
||||
The client libraries and filters have been successfully compiled under
|
||||
Microsoft Windows using Visual C++ 6.0.
|
||||
|
||||
|
||||
SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
|
||||
REPORTING PROBLEMS
|
||||
|
||||
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
|
||||
|
||||
Run the "lpinfo -m" command to list the available drivers:
|
||||
|
||||
lpinfo -m
|
||||
|
||||
Run the "lpinfo -v" command to list the available printers:
|
||||
|
||||
lpinfo -v
|
||||
|
||||
Then use the correct URI to add the printer using the "lpadmin" command:
|
||||
|
||||
lpadmin -p printername -E -v device-uri -m ppd-name
|
||||
|
||||
Network printers typically use "socket" or "lpd" URIs:
|
||||
|
||||
lpadmin -p printername -E -v socket://11.22.33.44 -m ppd-name
|
||||
lpadmin -p printername -E -v lpd://11.22.33.44/ -m ppd-name
|
||||
|
||||
The sample drivers provide basic printing capabilities, but generally do not
|
||||
exercise the full potential of the printers or CUPS. The 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
|
||||
If you have problems, please send an email to cups-support@cups.org. Include
|
||||
your operating system and version, compiler and version, and any errors or
|
||||
problems you've run into.
|
||||
|
||||
|
||||
PRINTING FILES
|
||||
OTHER RESOURCES
|
||||
|
||||
CUPS provides both the System V "lp" and Berkeley "lpr" commands for
|
||||
printing:
|
||||
See the CUPS web site at "http://www.cups.org" for other site links.
|
||||
|
||||
lp filename
|
||||
lpr filename
|
||||
|
||||
Both the "lp" and "lpr" commands support printing options for the driver:
|
||||
|
||||
lp -o media=A4 -o resolution=600dpi filename
|
||||
lpr -o media=A4 -o resolution=600dpi filename
|
||||
|
||||
CUPS recognizes many types of images files as well as PDF, PostScript,
|
||||
HP-GL/2, and text files, so you can print those files directly rather than
|
||||
through an application.
|
||||
|
||||
If you have an application that generates output specifically for your
|
||||
printer then you need to use the "-oraw" or "-l" options:
|
||||
|
||||
lp -o raw filename
|
||||
lpr -l filename
|
||||
|
||||
This will prevent the filters from misinterpreting your print
|
||||
file.
|
||||
You can subscribe to the CUPS mailing list by sending a message containing
|
||||
"subscribe cups" to majordomo@cups.org. This list is provided to discuss
|
||||
problems, questions, and improvements to the CUPS software. New releases of
|
||||
CUPS are announced to this list as well.
|
||||
|
||||
|
||||
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 1993-1999 by Easy Software Products. CUPS, the CUPS logo,
|
||||
and the Common UNIX Printing System are the trademark property of Easy
|
||||
Software Products.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
CUPS is provided under the terms of the GNU General Public License which is
|
||||
located in the files "LICENSE.html" and "LICENSE.txt". For commercial
|
||||
support and "binary-only" licensing information, please contact:
|
||||
|
||||
This software is based in part on the work of the Independent JPEG Group.
|
||||
Attn: CUPS Licensing Information
|
||||
Easy Software Products
|
||||
44141 Airport View Drive, Suite 204
|
||||
Hollywood, Maryland 20636-3111 USA
|
||||
|
||||
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.
|
||||
Voice: +1.301.373.9603
|
||||
Email: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
|
||||
If you're interested in a complete, commercial printing solution for UNIX,
|
||||
check out our ESP Print software at http://www.easysw.com/print.html.
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# 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
|
||||
+46
-208
@@ -3,28 +3,29 @@
|
||||
#
|
||||
# Backend makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
# Copyright 1997-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# This file is subject to the Apple OS-Developed Software exception.
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
RBACKENDS = ipp lpd $(DNSSD_BACKEND)
|
||||
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 = ipp lpd parallel serial smb socket
|
||||
OBJS = ipp.o lpd.o parallel.o serial.o socket.o
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
@@ -32,249 +33,86 @@ 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
|
||||
|
||||
|
||||
#
|
||||
# Update dependencies (without system header dependencies...)
|
||||
#
|
||||
|
||||
depend:
|
||||
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
|
||||
|
||||
rm -f $(OBJS) $(TARGETS)
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
install-data:
|
||||
|
||||
|
||||
#
|
||||
# Install programs...
|
||||
#
|
||||
|
||||
install-exec:
|
||||
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
|
||||
for file in $(RBACKENDS); do \
|
||||
$(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \
|
||||
done
|
||||
for file in $(UBACKENDS); do \
|
||||
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
|
||||
done
|
||||
$(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 \
|
||||
cp $$file $(SYMROOT); \
|
||||
done \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install headers...
|
||||
#
|
||||
|
||||
install-headers:
|
||||
|
||||
|
||||
#
|
||||
# Install libraries...
|
||||
#
|
||||
|
||||
install-libs:
|
||||
|
||||
|
||||
#
|
||||
# Uninstall all targets...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for file in $(RBACKENDS) $(UBACKENDS); do \
|
||||
$(RM) $(SERVERBIN)/backend/$$file; \
|
||||
done
|
||||
$(RM) $(SERVERBIN)/backend/http
|
||||
-$(RMDIR) $(SERVERBIN)/backend
|
||||
-$(RMDIR) $(SERVERBIN)
|
||||
|
||||
|
||||
#
|
||||
# test1284
|
||||
#
|
||||
|
||||
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)
|
||||
|
||||
|
||||
#
|
||||
# libbackend.a
|
||||
#
|
||||
|
||||
libbackend.a: $(LIBOBJS)
|
||||
echo Archiving $@...
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# dnssd
|
||||
#
|
||||
|
||||
dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
|
||||
$(RM) mdns
|
||||
$(LN) dnssd mdns
|
||||
|
||||
install:
|
||||
-$(MKDIR) $(SERVERROOT)/backend
|
||||
$(CP) $(TARGETS) $(SERVERROOT)/backend
|
||||
$(LN) ipp $(SERVERROOT)/backend/http
|
||||
$(CHMOD) u+s $(SERVERROOT)/backend/lpd
|
||||
|
||||
#
|
||||
# ipp
|
||||
#
|
||||
|
||||
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
ipp: ipp.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
|
||||
$(RM) http
|
||||
$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS)
|
||||
$(LN) ipp http
|
||||
|
||||
ipp.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# lpd
|
||||
#
|
||||
|
||||
lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a
|
||||
lpd: lpd.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# pap
|
||||
#
|
||||
|
||||
pap: pap.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o pap pap.o $(BACKLIBS) $(LIBS) -framework AppleTalk
|
||||
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
|
||||
|
||||
lpd.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# parallel
|
||||
#
|
||||
|
||||
parallel: parallel.o ../cups/$(LIBCUPS) libbackend.a
|
||||
parallel: parallel.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o parallel parallel.o libbackend.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# scsi
|
||||
#
|
||||
|
||||
scsi: scsi.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o scsi scsi.o $(LIBS)
|
||||
|
||||
scsi.o: scsi.c scsi-irix.c scsi-linux.c
|
||||
$(CC) $(LDFLAGS) -o parallel parallel.o $(LIBS)
|
||||
|
||||
parallel.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# serial
|
||||
#
|
||||
|
||||
serial: serial.o ../cups/$(LIBCUPS) libbackend.a
|
||||
serial: serial.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o serial serial.o libbackend.a $(BACKLIBS) $(LIBS)
|
||||
$(CC) $(LDFLAGS) -o serial serial.o $(LIBS)
|
||||
|
||||
serial.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# snmp
|
||||
# smb
|
||||
#
|
||||
# Note: reading through these commands is a good way to get a headache... :)
|
||||
#
|
||||
|
||||
snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
|
||||
|
||||
smb: smb.sh ../Makedefs
|
||||
echo Generating $@...
|
||||
$(RM) smb
|
||||
sedcmd="1,\$$s/^SMBCLIENT=.\*/SMBCLIENT=`echo $(SMBCLIENT) | sed -e '1,$$s/\\//\\\\\\//g'`/" ;\
|
||||
$(SED) -e "$$sedcmd" <smb.sh >smb
|
||||
$(CHMOD) +x smb
|
||||
|
||||
#
|
||||
# socket
|
||||
#
|
||||
|
||||
socket: socket.o ../cups/$(LIBCUPS) libbackend.a
|
||||
socket: socket.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# usb
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
$(CC) $(LDFLAGS) -o socket socket.o $(LIBS)
|
||||
|
||||
socket.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Backend support definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_BACKEND_PRIVATE_H_
|
||||
# define _CUPS_BACKEND_PRIVATE_H_
|
||||
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
# include <cups/backend.h>
|
||||
# include <cups/sidechannel.h>
|
||||
# include <cups/ppd-private.h>
|
||||
# include <cups/debug.h>
|
||||
# include <cups/i18n.h>
|
||||
# include <cups/snmp-private.h>
|
||||
# include <stdlib.h>
|
||||
# include <errno.h>
|
||||
# include <cups/string.h>
|
||||
# include <signal.h>
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* OID constants...
|
||||
*/
|
||||
|
||||
/* Host MIB */
|
||||
#define CUPS_OID_mib2 1,3,6,1,2,1
|
||||
|
||||
#define CUPS_OID_system CUPS_OID_mib2,1
|
||||
#define CUPS_OID_sysLocation CUPS_OID_system,6
|
||||
|
||||
#define CUPS_OID_host CUPS_OID_mib2,25
|
||||
|
||||
#define CUPS_OID_hrSystem CUPS_OID_host,1
|
||||
|
||||
#define CUPS_OID_hrStorage CUPS_OID_host,2
|
||||
|
||||
#define CUPS_OID_hrDevice CUPS_OID_host,3
|
||||
#define CUPS_OID_hrDeviceTable CUPS_OID_hrDevice,2
|
||||
#define CUPS_OID_hrDeviceEntry CUPS_OID_hrDeviceTable,1
|
||||
#define CUPS_OID_hrDeviceIndex CUPS_OID_hrDeviceEntry,1
|
||||
#define CUPS_OID_hrDeviceType CUPS_OID_hrDeviceEntry,2
|
||||
#define CUPS_OID_hrDeviceDescr CUPS_OID_hrDeviceEntry,3
|
||||
|
||||
#define CUPS_OID_hrPrinterTable CUPS_OID_hrDevice,5
|
||||
#define CUPS_OID_hrPrinterEntry CUPS_OID_hrPrinterTable,1
|
||||
#define CUPS_OID_hrPrinterStatus CUPS_OID_hrPrinterEntry,1
|
||||
#define CUPS_OID_hrPrinterDetectedErrorState CUPS_OID_hrPrinterEntry,2
|
||||
|
||||
/* Printer MIB */
|
||||
#define CUPS_OID_printmib CUPS_OID_mib2,43
|
||||
|
||||
#define CUPS_OID_prtGeneral CUPS_OID_printmib,5
|
||||
#define CUPS_OID_prtGeneralTable CUPS_OID_prtGeneral,1
|
||||
#define CUPS_OID_prtGeneralEntry CUPS_OID_prtGeneralTable,1
|
||||
#define CUPS_OID_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);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_BACKEND_PRIVATE_H_ */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -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$".
|
||||
*/
|
||||
@@ -1,71 +0,0 @@
|
||||
Preliminary Design for CUPS Firewire Printer Backend - 03/19/2002
|
||||
-----------------------------------------------------------------
|
||||
|
||||
OVERVIEW
|
||||
|
||||
Easy Software Products will develop an IEEE-1394, a.k.a.
|
||||
Firewire, printing interface for its Common UNIX Printing
|
||||
System ("CUPS") for initial use under the Linux operating
|
||||
system. A follow-on implementation for MacOS X is
|
||||
anticipated as well.
|
||||
|
||||
The operating system interfaces for IEEE-1394 ports vary
|
||||
widely; the CUPS printing interface will abstract the OS
|
||||
layer to a simpler interface geared towards discovering,
|
||||
opening, reading from, writing to, and closing IEEE-1394
|
||||
printers.
|
||||
|
||||
The initial development of the CUPS backend will be targeted
|
||||
at the EPSON Stylus Pro 10000 large format printer, which
|
||||
requires the bandwidth provided by Firewire in order to
|
||||
print at full speed. This printer supports printing via
|
||||
Serial Bus Protocol 2 (SBP-2) using the SCSI and PWG command
|
||||
sets. The CUPS backend will implement the PWG command set on
|
||||
LUN 0 only.
|
||||
|
||||
|
||||
OS ABSTRACTION LAYER
|
||||
|
||||
The OS abstraction layer will be a thin client library that
|
||||
implements the following functions:
|
||||
|
||||
ieee1394_list
|
||||
ieee1394_open
|
||||
ieee1394_close
|
||||
ieee1394_read
|
||||
ieee1394_write
|
||||
ieee1394_error
|
||||
|
||||
The "ieee1394_list" function will list all of the available
|
||||
printer devices on the bus. The device information will
|
||||
consist of the device URI (ieee1394:/something) used to
|
||||
access the device and the make and model information, if
|
||||
available, for the device ("EPSON Stylus Printer").
|
||||
|
||||
The "ieee1394_open" and "ieee1394_close" functions will open
|
||||
and close a connection to the printer, respectively.
|
||||
|
||||
The "ieee1394_read" and "ieee1394_write" functions will read
|
||||
and write data to and from the printer, respectively. The
|
||||
read function will be non-blocking, returning data only if
|
||||
there is data coming back from the printer.
|
||||
|
||||
The "ieee1394_error" function will return a string
|
||||
describing the last error or NULL if no error occurred.
|
||||
|
||||
The library will be responsible for creating any background
|
||||
threads that are needed to monitor the connection to the
|
||||
printer.
|
||||
|
||||
|
||||
CUPS BACKEND
|
||||
|
||||
The CUPS backend will use the OS abstraction layer to list
|
||||
and access the Firewire printers. The "main" function will
|
||||
read and write printer data, while the "list_devices"
|
||||
function will be called as necessary to identify the
|
||||
available devices.
|
||||
|
||||
The CUPS 1.1 backend will record any status information in
|
||||
the error log file, while the 1.2 backend will supply it to
|
||||
the printer driver process.
|
||||
@@ -1,35 +0,0 @@
|
||||
Easy Software Products
|
||||
44141 Airport View Drive
|
||||
Suite 204
|
||||
Hollywood, Maryland 20636
|
||||
+1.301.373.9600
|
||||
March 8, 2002
|
||||
|
||||
|
||||
Subject: EPSON Firewire Printer Driver for Linux
|
||||
|
||||
Currently, no Firewire printer support exists for Linux. Since
|
||||
the latest EPSON printer products depend on the Firewire
|
||||
interface to print at full speed, a solution is needed to
|
||||
support customers using Linux as their server platform.
|
||||
|
||||
The Linux Firewire subsystem provides a user-mode driver
|
||||
interface that allows driver programs to access Firewire
|
||||
devices. Easy Software Products will utilize this interface to
|
||||
develop a "backend" program for the Common UNIX Printing System
|
||||
that will allow users to print to EPSON printers using the
|
||||
Firewire interface.
|
||||
|
||||
After examining the Linux interface, we estimate that it will
|
||||
require approximately 30 hours of development time to write,
|
||||
test, and document the Firewire backend, for a total cost of
|
||||
$3,000. The new backend will become a standard part of the CUPS
|
||||
software distribution and will be included with at least the
|
||||
following Linux distributions:
|
||||
|
||||
- Caldera Linux
|
||||
- Mandrake Linux
|
||||
- Red Hat Linux
|
||||
- SuSE Linux
|
||||
|
||||
ESP will provide EPSON with binaries for Red Hat Linux 7.2.
|
||||
@@ -1,448 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* 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:
|
||||
*
|
||||
* backendGetDeviceID() - Get the IEEE-1284 device ID string and
|
||||
* corresponding URI.
|
||||
* backendGetMakeModel() - Get the make and model string from the device ID.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "backend-private.h"
|
||||
|
||||
#ifdef __linux
|
||||
# include <sys/ioctl.h>
|
||||
# include <linux/lp.h>
|
||||
# define IOCNR_GET_DEVICE_ID 1
|
||||
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
|
||||
# include <linux/parport.h>
|
||||
# include <linux/ppdev.h>
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
#endif /* __linux */
|
||||
|
||||
#ifdef __sun
|
||||
# ifdef __sparc
|
||||
# include <sys/ecppio.h>
|
||||
# else
|
||||
# include <sys/ioccom.h>
|
||||
# include <sys/ecppsys.h>
|
||||
# endif /* __sparc */
|
||||
#endif /* __sun */
|
||||
|
||||
|
||||
/*
|
||||
* 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
|
||||
* corresponding URI.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
backendGetDeviceID(
|
||||
int fd, /* I - File descriptor */
|
||||
char *device_id, /* O - 1284 device ID */
|
||||
int device_id_size, /* I - Size of buffer */
|
||||
char *make_model, /* O - Make/model */
|
||||
int make_model_size, /* I - Size of buffer */
|
||||
const char *scheme, /* I - URI scheme */
|
||||
char *uri, /* O - Device URI */
|
||||
int uri_size) /* I - Size of buffer */
|
||||
{
|
||||
#ifdef __APPLE__ /* This function is a no-op */
|
||||
return (-1);
|
||||
|
||||
#else /* Get the device ID from the specified file descriptor... */
|
||||
# ifdef __linux
|
||||
int length; /* Length of device ID info */
|
||||
int got_id = 0;
|
||||
# endif /* __linux */
|
||||
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
struct ecpp_device_id did; /* Device ID buffer */
|
||||
# endif /* __sun && ECPPIOC_GETDEVID */
|
||||
|
||||
|
||||
DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
|
||||
"make_model=%p, make_model_size=%d, scheme=\"%s\", "
|
||||
"uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
|
||||
make_model, make_model_size, scheme ? scheme : "(null)",
|
||||
uri, uri_size));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!device_id || device_id_size < 32)
|
||||
{
|
||||
DEBUG_puts("backendGetDeviceID: Bad args!");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (make_model)
|
||||
*make_model = '\0';
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
/*
|
||||
* Get the device ID string...
|
||||
*/
|
||||
|
||||
*device_id = '\0';
|
||||
|
||||
# ifdef __linux
|
||||
if (ioctl(fd, LPIOC_GET_DEVICE_ID(device_id_size), device_id))
|
||||
{
|
||||
/*
|
||||
* Linux has to implement things differently for every device it seems.
|
||||
* Since the standard parallel port driver does not provide a simple
|
||||
* ioctl() to get the 1284 device ID, we have to open the "raw" parallel
|
||||
* device corresponding to this port and do some negotiation trickery
|
||||
* to get the current device ID.
|
||||
*/
|
||||
|
||||
if (uri && !strncmp(uri, "parallel:/dev/", 14))
|
||||
{
|
||||
char devparport[16]; /* /dev/parportN */
|
||||
int devparportfd, /* File descriptor for raw device */
|
||||
mode; /* Port mode */
|
||||
|
||||
|
||||
/*
|
||||
* Since the Linux parallel backend only supports 4 parallel port
|
||||
* devices, just grab the trailing digit and use it to construct a
|
||||
* /dev/parportN filename...
|
||||
*/
|
||||
|
||||
snprintf(devparport, sizeof(devparport), "/dev/parport%s",
|
||||
uri + strlen(uri) - 1);
|
||||
|
||||
if ((devparportfd = open(devparport, O_RDWR | O_NOCTTY)) != -1)
|
||||
{
|
||||
/*
|
||||
* Claim the device...
|
||||
*/
|
||||
|
||||
if (!ioctl(devparportfd, PPCLAIM))
|
||||
{
|
||||
fcntl(devparportfd, F_SETFL, fcntl(devparportfd, F_GETFL) | O_NONBLOCK);
|
||||
|
||||
mode = IEEE1284_MODE_COMPAT;
|
||||
|
||||
if (!ioctl(devparportfd, PPNEGOT, &mode))
|
||||
{
|
||||
/*
|
||||
* Put the device into Device ID mode...
|
||||
*/
|
||||
|
||||
mode = IEEE1284_MODE_NIBBLE | IEEE1284_DEVICEID;
|
||||
|
||||
if (!ioctl(devparportfd, PPNEGOT, &mode))
|
||||
{
|
||||
/*
|
||||
* Read the 1284 device ID...
|
||||
*/
|
||||
|
||||
if ((length = read(devparportfd, device_id,
|
||||
device_id_size - 1)) >= 2)
|
||||
{
|
||||
device_id[length] = '\0';
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Release the device...
|
||||
*/
|
||||
|
||||
ioctl(devparportfd, PPRELEASE);
|
||||
}
|
||||
|
||||
close(devparportfd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
got_id = 1;
|
||||
|
||||
if (got_id)
|
||||
{
|
||||
/*
|
||||
* Extract the length of the device ID string from the first two
|
||||
* bytes. The 1284 spec says the length is stored MSB first...
|
||||
*/
|
||||
|
||||
length = (((unsigned)device_id[0] & 255) << 8) +
|
||||
((unsigned)device_id[1] & 255);
|
||||
|
||||
/*
|
||||
* Check to see if the length is larger than our buffer; first
|
||||
* assume that the vendor incorrectly implemented the 1284 spec,
|
||||
* and then limit the length to the size of our buffer...
|
||||
*/
|
||||
|
||||
if (length > (device_id_size - 2))
|
||||
length = (((unsigned)device_id[1] & 255) << 8) +
|
||||
((unsigned)device_id[0] & 255);
|
||||
|
||||
if (length > (device_id_size - 2))
|
||||
length = device_id_size - 2;
|
||||
|
||||
/*
|
||||
* Copy the device ID text to the beginning of the buffer and
|
||||
* nul-terminate.
|
||||
*/
|
||||
|
||||
memmove(device_id, device_id + 2, length);
|
||||
device_id[length] = '\0';
|
||||
}
|
||||
# ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
|
||||
strerror(errno)));
|
||||
# endif /* DEBUG */
|
||||
# endif /* __linux */
|
||||
|
||||
# if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
did.mode = ECPP_CENTRONICS;
|
||||
did.len = device_id_size - 1;
|
||||
did.rlen = 0;
|
||||
did.addr = device_id;
|
||||
|
||||
if (!ioctl(fd, ECPPIOC_GETDEVID, &did))
|
||||
{
|
||||
/*
|
||||
* Nul-terminate the device ID text.
|
||||
*/
|
||||
|
||||
if (did.rlen < (device_id_size - 1))
|
||||
device_id[did.rlen] = '\0';
|
||||
else
|
||||
device_id[device_id_size - 1] = '\0';
|
||||
}
|
||||
# ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("backendGetDeviceID: ioctl failed - %s\n",
|
||||
strerror(errno)));
|
||||
# endif /* DEBUG */
|
||||
# endif /* __sun && ECPPIOC_GETDEVID */
|
||||
}
|
||||
|
||||
DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
|
||||
|
||||
if (scheme && uri)
|
||||
*uri = '\0';
|
||||
|
||||
if (!*device_id)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Get the make and model...
|
||||
*/
|
||||
|
||||
if (make_model)
|
||||
backendGetMakeModel(device_id, make_model, make_model_size);
|
||||
|
||||
/*
|
||||
* Then generate a device URI...
|
||||
*/
|
||||
|
||||
if (scheme && uri && uri_size > 32)
|
||||
{
|
||||
int num_values; /* Number of keys and values */
|
||||
cups_option_t *values; /* Keys and values in device ID */
|
||||
const char *mfg, /* Manufacturer */
|
||||
*mdl, /* Model */
|
||||
*sern; /* Serial number */
|
||||
char temp[256], /* Temporary manufacturer string */
|
||||
*tempptr; /* Pointer into temp string */
|
||||
|
||||
|
||||
/*
|
||||
* Get the make, model, and serial numbers...
|
||||
*/
|
||||
|
||||
num_values = _ppdGet1284Values(device_id, &values);
|
||||
|
||||
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
|
||||
sern = cupsGetOption("SN", num_values, values);
|
||||
|
||||
if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
|
||||
mfg = cupsGetOption("MFG", num_values, values);
|
||||
|
||||
if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
|
||||
mdl = cupsGetOption("MDL", num_values, values);
|
||||
|
||||
if (mfg)
|
||||
{
|
||||
if (!strcasecmp(mfg, "Hewlett-Packard"))
|
||||
mfg = "HP";
|
||||
else if (!strcasecmp(mfg, "Lexmark International"))
|
||||
mfg = "Lexmark";
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(temp, make_model, sizeof(temp));
|
||||
|
||||
if ((tempptr = strchr(temp, ' ')) != NULL)
|
||||
*tempptr = '\0';
|
||||
|
||||
mfg = temp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the device URI from the manufacturer, make_model, and
|
||||
* serial number strings.
|
||||
*/
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, uri_size, scheme, NULL, mfg, 0,
|
||||
"/%s%s%s", mdl, sern ? "?serial=" : "", sern ? sern : "");
|
||||
|
||||
cupsFreeOptions(num_values, values);
|
||||
}
|
||||
|
||||
return (0);
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'backendGetMakeModel()' - Get the make and model string from the device ID.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
backendGetMakeModel(
|
||||
const char *device_id, /* O - 1284 device ID */
|
||||
char *make_model, /* O - Make/model */
|
||||
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 */
|
||||
|
||||
|
||||
DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
|
||||
"make_model=%p, make_model_size=%d)\n", device_id,
|
||||
make_model, make_model_size));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!device_id || !*device_id || !make_model || make_model_size < 32)
|
||||
{
|
||||
DEBUG_puts("backendGetMakeModel: Bad args!");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
*make_model = '\0';
|
||||
|
||||
/*
|
||||
* Look for the description field...
|
||||
*/
|
||||
|
||||
num_values = _ppdGet1284Values(device_id, &values);
|
||||
|
||||
if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
|
||||
mdl = cupsGetOption("MDL", num_values, values);
|
||||
|
||||
if (mdl)
|
||||
{
|
||||
/*
|
||||
* Build a make-model string from the manufacturer and model attributes...
|
||||
*/
|
||||
|
||||
if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
|
||||
mfg = cupsGetOption("MFG", num_values, values);
|
||||
|
||||
if (!mfg || !strncasecmp(mdl, mfg, strlen(mfg)))
|
||||
{
|
||||
/*
|
||||
* Just copy the model string, since it has the manufacturer...
|
||||
*/
|
||||
|
||||
_ppdNormalizeMakeAndModel(mdl, make_model, make_model_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Concatenate the make and model...
|
||||
*/
|
||||
|
||||
char temp[1024]; /* Temporary make and model */
|
||||
|
||||
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
|
||||
_ppdNormalizeMakeAndModel(temp, make_model, make_model_size);
|
||||
}
|
||||
}
|
||||
else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL ||
|
||||
(des = cupsGetOption("DES", num_values, values)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Make sure the description contains something useful, since some
|
||||
* printer manufacturers (HP) apparently don't follow the standards
|
||||
* they helped to define...
|
||||
*
|
||||
* Here we require the description to be 8 or more characters in length,
|
||||
* containing at least one space and one letter.
|
||||
*/
|
||||
|
||||
if (strlen(des) >= 8)
|
||||
{
|
||||
const char *ptr; /* Pointer into description */
|
||||
int letters, /* Number of letters seen */
|
||||
spaces; /* Number of spaces seen */
|
||||
|
||||
|
||||
for (ptr = des, letters = 0, spaces = 0; *ptr; ptr ++)
|
||||
{
|
||||
if (isspace(*ptr & 255))
|
||||
spaces ++;
|
||||
else if (isalpha(*ptr & 255))
|
||||
letters ++;
|
||||
|
||||
if (spaces && letters)
|
||||
break;
|
||||
}
|
||||
|
||||
if (spaces && letters)
|
||||
_ppdNormalizeMakeAndModel(des, make_model, make_model_size);
|
||||
}
|
||||
}
|
||||
|
||||
if (!make_model[0])
|
||||
{
|
||||
/*
|
||||
* Use "Unknown" as the printer make and model...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, "Unknown", make_model_size);
|
||||
}
|
||||
|
||||
cupsFreeOptions(num_values, values);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+272
-1836
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+195
-1169
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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$".
|
||||
*/
|
||||
-1699
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+64
-574
@@ -3,64 +3,45 @@
|
||||
*
|
||||
* Parallel port backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* Copyright 1997-1999 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"
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the specified parallel port.
|
||||
* list_devices() - List all parallel devices.
|
||||
* side_cb() - Handle side-channel requests...
|
||||
* main() - Send a file to the specified parallel port.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "backend-private.h"
|
||||
#include <cups/cups.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/string.h>
|
||||
|
||||
#ifdef __hpux
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <sys/select.h>
|
||||
#endif /* __hpux */
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <termios.h>
|
||||
# include <sys/socket.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __sgi
|
||||
# include <invent.h>
|
||||
# ifndef INV_EPP_ECP_PLP
|
||||
# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */
|
||||
# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */
|
||||
# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */
|
||||
# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */
|
||||
# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */
|
||||
# endif /* !INV_EPP_ECP_PLP */
|
||||
#endif /* __sgi */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
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);
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
@@ -71,62 +52,29 @@ static void side_cb(int print_fd, int device_fd, int snmp_fd,
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options; /* Pointer to options */
|
||||
int port; /* Port number (not used) */
|
||||
int print_fd, /* Print file */
|
||||
device_fd, /* Parallel device */
|
||||
use_bc; /* Read back-channel data? */
|
||||
int copies; /* Number of copies to print */
|
||||
size_t tbytes; /* Total number of bytes written */
|
||||
struct termios opts; /* Parallel port options */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options; /* Pointer to options */
|
||||
int port; /* Port number (not used) */
|
||||
FILE *fp; /* Print file */
|
||||
int fd; /* Parallel device */
|
||||
int error; /* Error code (if any) */
|
||||
size_t nbytes, /* Number of bytes written */
|
||||
tbytes; /* Total number of bytes written */
|
||||
char buffer[8192]; /* Output buffer */
|
||||
struct termios opts; /* Parallel port options */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
if (argc < 6 || argc > 7)
|
||||
{
|
||||
list_devices();
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
fputs("Usage: parallel job-id user title copies options [file]\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -135,35 +83,25 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
print_fd = 0;
|
||||
copies = 1;
|
||||
}
|
||||
fp = stdin;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
|
||||
if ((fp = fopen(argv[6], "rb")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open print file \"%s\": %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
perror("ERROR: unable to open print file");
|
||||
return (1);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the device name and options from the URI...
|
||||
*/
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
|
||||
method, sizeof(method), username, sizeof(username),
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource));
|
||||
httpSeparate(argv[0], method, username, hostname, &port, resource);
|
||||
|
||||
/*
|
||||
* See if there are any options...
|
||||
@@ -183,504 +121,56 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Open the parallel port device...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
if ((fd = open(resource, O_WRONLY)) == -1)
|
||||
{
|
||||
#if defined(__linux) || defined(__FreeBSD__)
|
||||
/*
|
||||
* The Linux and FreeBSD parallel port drivers currently are broken WRT
|
||||
* select() and bidirection I/O...
|
||||
*/
|
||||
|
||||
device_fd = open(resource, O_WRONLY | O_EXCL);
|
||||
use_bc = 0;
|
||||
|
||||
#else
|
||||
if ((device_fd = open(resource, O_RDWR | O_EXCL)) < 0)
|
||||
{
|
||||
device_fd = open(resource, O_WRONLY | O_EXCL);
|
||||
use_bc = 0;
|
||||
}
|
||||
else
|
||||
use_bc = 1;
|
||||
#endif /* __linux || __FreeBSD__ */
|
||||
|
||||
if (device_fd == -1)
|
||||
{
|
||||
if (getenv("CLASS") != NULL)
|
||||
{
|
||||
/*
|
||||
* If the CLASS environment variable is set, the job was submitted
|
||||
* to a class and not to a specific queue. In this case, we want
|
||||
* to abort immediately so that the job can be requeued on the next
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
sleep(30);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer not connected; will retry in 30 "
|
||||
"seconds...\n"));
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
perror("ERROR: Unable to open parallel port device file");
|
||||
return (1);
|
||||
}
|
||||
while (device_fd < 0);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Set any options provided...
|
||||
*/
|
||||
|
||||
tcgetattr(device_fd, &opts);
|
||||
tcgetattr(fd, &opts);
|
||||
|
||||
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
|
||||
|
||||
/**** No options supported yet ****/
|
||||
|
||||
tcsetattr(device_fd, TCSANOW, &opts);
|
||||
tcsetattr(fd, TCSANOW, &opts);
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
tbytes = 0;
|
||||
|
||||
while (copies > 0 && tbytes >= 0)
|
||||
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
|
||||
{
|
||||
copies --;
|
||||
/*
|
||||
* Write the print data to the printer...
|
||||
*/
|
||||
|
||||
if (print_fd != 0)
|
||||
if (write(fd, buffer, nbytes) < nbytes)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(print_fd, 0, SEEK_SET);
|
||||
perror("ERROR: Unable to send print file to printer");
|
||||
break;
|
||||
}
|
||||
else
|
||||
tbytes += nbytes;
|
||||
|
||||
tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, side_cb);
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
#else
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST tbytes);
|
||||
if (argc > 6)
|
||||
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the socket connection and input file and return...
|
||||
*/
|
||||
|
||||
close(device_fd);
|
||||
close(fd);
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
|
||||
if (print_fd != 0)
|
||||
close(print_fd);
|
||||
|
||||
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List all parallel devices.
|
||||
*/
|
||||
|
||||
static void
|
||||
list_devices(void)
|
||||
{
|
||||
#if defined(__hpux) || defined(__sgi) || defined(__sun)
|
||||
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
/* Funky hex numbering used for some devices */
|
||||
#endif /* __hpux || __sgi || __sun */
|
||||
|
||||
#ifdef __linux
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255], /* Device filename */
|
||||
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 */
|
||||
|
||||
|
||||
if (!access("/dev/parallel/", 0))
|
||||
strcpy(basedevice, "/dev/parallel/");
|
||||
else if (!access("/dev/printers/", 0))
|
||||
strcpy(basedevice, "/dev/printers/");
|
||||
else
|
||||
strcpy(basedevice, "/dev/lp");
|
||||
|
||||
for (i = 0; i < 4; i ++)
|
||||
{
|
||||
/*
|
||||
* Open the port, if available...
|
||||
*/
|
||||
|
||||
sprintf(device, "%s%d", basedevice, i);
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
fd = open(device, O_WRONLY);
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
/*
|
||||
* Now grab the IEEE 1284 device ID string...
|
||||
*/
|
||||
|
||||
snprintf(uri, sizeof(uri), "parallel:%s", device);
|
||||
|
||||
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
NULL, uri, sizeof(uri)))
|
||||
{
|
||||
snprintf(info, sizeof(info), "%s LPT #%d", make_model, i + 1);
|
||||
cupsBackendReport("direct", uri, make_model, info, device_id, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(info, sizeof(info), "LPT #%d", i + 1);
|
||||
cupsBackendReport("direct", uri, NULL, info, NULL, NULL);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#elif defined(__sgi)
|
||||
int i, j, n; /* Looping vars */
|
||||
char device[255]; /* Device filename */
|
||||
inventory_t *inv; /* Hardware inventory info */
|
||||
|
||||
|
||||
/*
|
||||
* IRIX maintains a hardware inventory of most devices...
|
||||
*/
|
||||
|
||||
setinvent();
|
||||
|
||||
while ((inv = getinvent()) != NULL)
|
||||
{
|
||||
if (inv->inv_class == INV_PARALLEL &&
|
||||
(inv->inv_type == INV_ONBOARD_PLP ||
|
||||
inv->inv_type == INV_EPP_ECP_PLP))
|
||||
{
|
||||
/*
|
||||
* Standard parallel port...
|
||||
*/
|
||||
|
||||
puts("direct parallel:/dev/plp \"Unknown\" \"Onboard Parallel Port\"");
|
||||
}
|
||||
else if (inv->inv_class == INV_PARALLEL &&
|
||||
inv->inv_type == INV_EPC_PLP)
|
||||
{
|
||||
/*
|
||||
* EPC parallel port...
|
||||
*/
|
||||
|
||||
printf("direct parallel:/dev/plp%d \"Unknown\" \"Integral EPC parallel port, Ebus slot %d\"\n",
|
||||
inv->inv_controller, inv->inv_controller);
|
||||
}
|
||||
}
|
||||
|
||||
endinvent();
|
||||
|
||||
/*
|
||||
* Central Data makes serial and parallel "servers" that can be
|
||||
* connected in a number of ways. Look for ports...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 10; i ++)
|
||||
for (j = 0; j < 8; j ++)
|
||||
for (n = 0; n < 32; n ++)
|
||||
{
|
||||
if (i == 8) /* EtherLite */
|
||||
sprintf(device, "/dev/lpn%d%c", j, funky_hex[n]);
|
||||
else if (i == 9) /* PCI */
|
||||
sprintf(device, "/dev/lpp%d%c", j, funky_hex[n]);
|
||||
else /* SCSI */
|
||||
sprintf(device, "/dev/lp%d%d%c", i, j, funky_hex[n]);
|
||||
|
||||
if (access(device, 0) == 0)
|
||||
{
|
||||
if (i == 8)
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
|
||||
device, j, n);
|
||||
else if (i == 9)
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data PCI Parallel Port, ID %d, port %d\"\n",
|
||||
device, j, n);
|
||||
else
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
|
||||
device, i, j, n);
|
||||
}
|
||||
}
|
||||
#elif defined(__sun)
|
||||
int i, j, n; /* Looping vars */
|
||||
char device[255]; /* Device filename */
|
||||
|
||||
|
||||
/*
|
||||
* Standard parallel ports...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 10; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/ecpp%d", i);
|
||||
if (access(device, 0) == 0)
|
||||
printf("direct parallel:%s \"Unknown\" \"Sun IEEE-1284 Parallel Port #%d\"\n",
|
||||
device, i + 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/bpp%d", i);
|
||||
if (access(device, 0) == 0)
|
||||
printf("direct parallel:%s \"Unknown\" \"Sun Standard Parallel Port #%d\"\n",
|
||||
device, i + 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/lp%d", i);
|
||||
|
||||
if (access(device, 0) == 0)
|
||||
printf("direct parallel:%s \"Unknown\" \"PC Parallel Port #%d\"\n",
|
||||
device, i + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* MAGMA parallel ports...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 40; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/pm%02d", i);
|
||||
if (access(device, 0) == 0)
|
||||
printf("direct parallel:%s \"Unknown\" \"MAGMA Parallel Board #%d Port #%d\"\n",
|
||||
device, (i / 10) + 1, (i % 10) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Central Data parallel ports...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 9; i ++)
|
||||
for (j = 0; j < 8; j ++)
|
||||
for (n = 0; n < 32; n ++)
|
||||
{
|
||||
if (i == 8) /* EtherLite */
|
||||
sprintf(device, "/dev/sts/lpN%d%c", j, funky_hex[n]);
|
||||
else
|
||||
sprintf(device, "/dev/sts/lp%c%d%c", i + 'C', j,
|
||||
funky_hex[n]);
|
||||
|
||||
if (access(device, 0) == 0)
|
||||
{
|
||||
if (i == 8)
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
|
||||
device, j, n);
|
||||
else
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
|
||||
device, i, j, n);
|
||||
}
|
||||
}
|
||||
#elif defined(__hpux)
|
||||
int i, j, n; /* Looping vars */
|
||||
char device[255]; /* Device filename */
|
||||
|
||||
|
||||
/*
|
||||
* Standard parallel ports...
|
||||
*/
|
||||
|
||||
if (access("/dev/rlp", 0) == 0)
|
||||
puts("direct parallel:/dev/rlp \"Unknown\" \"Standard Parallel Port (/dev/rlp)\"");
|
||||
|
||||
for (i = 0; i < 7; i ++)
|
||||
for (j = 0; j < 7; j ++)
|
||||
{
|
||||
sprintf(device, "/dev/c%dt%dd0_lp", i, j);
|
||||
if (access(device, 0) == 0)
|
||||
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d,%d\"\n",
|
||||
device, i, j);
|
||||
}
|
||||
|
||||
/*
|
||||
* Central Data parallel ports...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 9; i ++)
|
||||
for (j = 0; j < 8; j ++)
|
||||
for (n = 0; n < 32; n ++)
|
||||
{
|
||||
if (i == 8) /* EtherLite */
|
||||
sprintf(device, "/dev/lpN%d%c", j, funky_hex[n]);
|
||||
else
|
||||
sprintf(device, "/dev/lp%c%d%c", i + 'C', j,
|
||||
funky_hex[n]);
|
||||
|
||||
if (access(device, 0) == 0)
|
||||
{
|
||||
if (i == 8)
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data EtherLite Parallel Port, ID %d, port %d\"\n",
|
||||
device, j, n);
|
||||
else
|
||||
printf("direct parallel:%s \"Unknown\" \"Central Data SCSI Parallel Port, logical bus %d, ID %d, port %d\"\n",
|
||||
device, i, j, n);
|
||||
}
|
||||
}
|
||||
#elif defined(__osf__)
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255]; /* Device filename */
|
||||
|
||||
|
||||
for (i = 0; i < 3; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/lp%d", i);
|
||||
if ((fd = open(device, O_WRONLY)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
|
||||
}
|
||||
}
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255]; /* Device filename */
|
||||
|
||||
|
||||
for (i = 0; i < 3; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/lpt%d", i);
|
||||
if ((fd = open(device, O_WRONLY)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d (interrupt-driven)\"\n", device, i + 1);
|
||||
}
|
||||
|
||||
sprintf(device, "/dev/lpa%d", i);
|
||||
if ((fd = open(device, O_WRONLY)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d (polled)\"\n", device, i + 1);
|
||||
}
|
||||
}
|
||||
#elif defined(_AIX)
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255]; /* Device filename */
|
||||
|
||||
|
||||
for (i = 0; i < 8; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/lp%d", i);
|
||||
if ((fd = open(device, O_WRONLY)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
printf("direct parallel:%s \"Unknown\" \"Parallel Port #%d\"\n", device, i + 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'side_cb()' - Handle side-channel requests...
|
||||
*/
|
||||
|
||||
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? */
|
||||
{
|
||||
cups_sc_command_t command; /* Request command */
|
||||
cups_sc_status_t status; /* Request/response status */
|
||||
char data[2048]; /* Request/response data */
|
||||
int datalen; /* Request/response data size */
|
||||
|
||||
|
||||
(void)snmp_fd;
|
||||
(void)addr;
|
||||
|
||||
datalen = sizeof(data);
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case CUPS_SC_CMD_DRAIN_OUTPUT :
|
||||
if (backendDrainOutput(print_fd, device_fd))
|
||||
status = CUPS_SC_STATUS_IO_ERROR;
|
||||
else if (tcdrain(device_fd))
|
||||
status = CUPS_SC_STATUS_IO_ERROR;
|
||||
else
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
|
||||
datalen = 0;
|
||||
break;
|
||||
|
||||
case CUPS_SC_CMD_GET_BIDI :
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
data[0] = use_bc;
|
||||
datalen = 1;
|
||||
break;
|
||||
|
||||
case CUPS_SC_CMD_GET_DEVICE_ID :
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
if (backendGetDeviceID(device_fd, data, sizeof(data) - 1,
|
||||
NULL, 0, NULL, NULL, 0))
|
||||
{
|
||||
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
|
||||
datalen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
datalen = strlen(data);
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
|
||||
datalen = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
cupsSideChannelWrite(command, status, data, datalen, 1.0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,414 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Common run loop 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:
|
||||
*
|
||||
* backendDrainOutput() - Drain pending print data to the device.
|
||||
* backendRunLoop() - Read and write print and back-channel data.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "backend-private.h"
|
||||
#include <limits.h>
|
||||
#ifdef __hpux
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <sys/select.h>
|
||||
#endif /* __hpux */
|
||||
|
||||
|
||||
/*
|
||||
* 'backendDrainOutput()' - Drain pending print data to the device.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
backendDrainOutput(int print_fd, /* I - Print file descriptor */
|
||||
int device_fd) /* I - Device file descriptor */
|
||||
{
|
||||
int nfds; /* Maximum file descriptor value + 1 */
|
||||
fd_set input; /* Input set for reading */
|
||||
ssize_t print_bytes, /* Print bytes read */
|
||||
bytes; /* Bytes written */
|
||||
char print_buffer[8192], /* Print data buffer */
|
||||
*print_ptr; /* Pointer into print data buffer */
|
||||
struct timeval timeout; /* Timeout for read... */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: backendDrainOutput(print_fd=%d, device_fd=%d)\n",
|
||||
print_fd, device_fd);
|
||||
|
||||
/*
|
||||
* Figure out the maximum file descriptor value to use with select()...
|
||||
*/
|
||||
|
||||
nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
|
||||
|
||||
/*
|
||||
* Now loop until we are out of data from print_fd...
|
||||
*/
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/*
|
||||
* Use select() to determine whether we have data to copy around...
|
||||
*/
|
||||
|
||||
FD_ZERO(&input);
|
||||
FD_SET(print_fd, &input);
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
if (select(nfds, &input, NULL, NULL, &timeout) < 0)
|
||||
return (-1);
|
||||
|
||||
if (!FD_ISSET(print_fd, &input))
|
||||
return (0);
|
||||
|
||||
if ((print_bytes = read(print_fd, print_buffer,
|
||||
sizeof(print_buffer))) < 0)
|
||||
{
|
||||
/*
|
||||
* Read error - bail if we don't see EAGAIN or EINTR...
|
||||
*/
|
||||
|
||||
if (errno != EAGAIN || errno != EINTR)
|
||||
{
|
||||
perror("ERROR: Unable to read print data");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
print_bytes = 0;
|
||||
}
|
||||
else if (print_bytes == 0)
|
||||
{
|
||||
/*
|
||||
* End of file, return...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Read %d bytes of print data...\n",
|
||||
(int)print_bytes);
|
||||
|
||||
for (print_ptr = print_buffer; print_bytes > 0;)
|
||||
{
|
||||
if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
|
||||
{
|
||||
/*
|
||||
* Write error - bail if we don't see an error we can retry...
|
||||
*/
|
||||
|
||||
if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN &&
|
||||
errno != EINTR && errno != ENOTTY)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to write print data: %s\n"),
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
|
||||
|
||||
print_bytes -= bytes;
|
||||
print_ptr += bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'backendRunLoop()' - Read and write print and back-channel data.
|
||||
*/
|
||||
|
||||
ssize_t /* O - Total bytes on success, -1 on error */
|
||||
backendRunLoop(
|
||||
int print_fd, /* I - Print file descriptor */
|
||||
int device_fd, /* I - Device file descriptor */
|
||||
int snmp_fd, /* I - SNMP socket or -1 if none */
|
||||
http_addr_t *addr, /* I - Address of device */
|
||||
int use_bc, /* I - Use back-channel? */
|
||||
void (*side_cb)(int, int, int, http_addr_t *, int))
|
||||
/* I - Side-channel callback */
|
||||
{
|
||||
int nfds; /* Maximum file descriptor value + 1 */
|
||||
fd_set input, /* Input set for reading */
|
||||
output; /* Output set for writing */
|
||||
ssize_t print_bytes, /* Print bytes read */
|
||||
bc_bytes, /* Backchannel bytes read */
|
||||
total_bytes, /* Total bytes written */
|
||||
bytes; /* Bytes written */
|
||||
int paperout; /* "Paper out" status */
|
||||
int offline; /* "Off-line" status */
|
||||
char print_buffer[8192], /* Print data buffer */
|
||||
*print_ptr, /* Pointer into print data buffer */
|
||||
bc_buffer[1024]; /* Back-channel data buffer */
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
time_t curtime, /* Current time */
|
||||
snmp_update = 0;
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
fprintf(stderr,
|
||||
"DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, snmp_fd=%d, "
|
||||
"addr=%p, use_bc=%d, side_cb=%p)\n",
|
||||
print_fd, device_fd, snmp_fd, addr, use_bc, side_cb);
|
||||
|
||||
/*
|
||||
* If we are printing data from a print driver on stdin, ignore SIGTERM
|
||||
* so that the driver can finish out any page data, e.g. to eject the
|
||||
* current page. We only do this for stdin printing as otherwise there
|
||||
* is no way to cancel a raw print job...
|
||||
*/
|
||||
|
||||
if (!print_fd)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
#else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Figure out the maximum file descriptor value to use with select()...
|
||||
*/
|
||||
|
||||
nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
|
||||
|
||||
/*
|
||||
* Now loop until we are out of data from print_fd...
|
||||
*/
|
||||
|
||||
for (print_bytes = 0, print_ptr = print_buffer, offline = -1,
|
||||
paperout = -1, total_bytes = 0;;)
|
||||
{
|
||||
/*
|
||||
* Use select() to determine whether we have data to copy around...
|
||||
*/
|
||||
|
||||
FD_ZERO(&input);
|
||||
if (!print_bytes)
|
||||
FD_SET(print_fd, &input);
|
||||
if (use_bc)
|
||||
FD_SET(device_fd, &input);
|
||||
if (!print_bytes && side_cb)
|
||||
FD_SET(CUPS_SC_FD, &input);
|
||||
|
||||
FD_ZERO(&output);
|
||||
if (print_bytes || (!use_bc && !side_cb))
|
||||
FD_SET(device_fd, &output);
|
||||
|
||||
if (use_bc || side_cb)
|
||||
{
|
||||
timeout.tv_sec = 5;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
if (select(nfds, &input, &output, NULL, &timeout) < 0)
|
||||
{
|
||||
/*
|
||||
* Pause printing to clear any pending errors...
|
||||
*/
|
||||
|
||||
if (errno == ENXIO && offline != 1)
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
|
||||
offline = 1;
|
||||
}
|
||||
else if (errno == EINTR && total_bytes == 0)
|
||||
{
|
||||
fputs("DEBUG: Received an interrupt before any bytes were "
|
||||
"written, aborting!\n", stderr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have a side-channel request ready...
|
||||
*/
|
||||
|
||||
if (side_cb && FD_ISSET(CUPS_SC_FD, &input))
|
||||
{
|
||||
/*
|
||||
* Do the side-channel request, then start back over in the select
|
||||
* loop since it may have read from print_fd...
|
||||
*/
|
||||
|
||||
(*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have back-channel data ready...
|
||||
*/
|
||||
|
||||
if (FD_ISSET(device_fd, &input))
|
||||
{
|
||||
if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
|
||||
CUPS_LLCAST bc_bytes);
|
||||
cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
|
||||
}
|
||||
else if (bc_bytes < 0 && errno != EAGAIN && errno != EINTR)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Error reading back-channel data: %s\n",
|
||||
strerror(errno));
|
||||
use_bc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we have print data ready...
|
||||
*/
|
||||
|
||||
if (FD_ISSET(print_fd, &input))
|
||||
{
|
||||
if ((print_bytes = read(print_fd, print_buffer,
|
||||
sizeof(print_buffer))) < 0)
|
||||
{
|
||||
/*
|
||||
* Read error - bail if we don't see EAGAIN or EINTR...
|
||||
*/
|
||||
|
||||
if (errno != EAGAIN || errno != EINTR)
|
||||
{
|
||||
perror("ERROR: Unable to read print data");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
print_bytes = 0;
|
||||
}
|
||||
else if (print_bytes == 0)
|
||||
{
|
||||
/*
|
||||
* End of file, break out of the loop...
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
print_ptr = print_buffer;
|
||||
|
||||
fprintf(stderr, "DEBUG: Read %d bytes of print data...\n",
|
||||
(int)print_bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the device is ready to receive data and we have data to
|
||||
* send...
|
||||
*/
|
||||
|
||||
if (print_bytes && FD_ISSET(device_fd, &output))
|
||||
{
|
||||
if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
|
||||
{
|
||||
/*
|
||||
* Write error - bail if we don't see an error we can retry...
|
||||
*/
|
||||
|
||||
if (errno == ENOSPC)
|
||||
{
|
||||
if (paperout != 1)
|
||||
{
|
||||
fputs("STATE: +media-empty-warning\n", stderr);
|
||||
_cupsLangPuts(stderr, _("ERROR: Out of paper!\n"));
|
||||
paperout = 1;
|
||||
}
|
||||
}
|
||||
else if (errno == ENXIO)
|
||||
{
|
||||
if (offline != 1)
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
|
||||
offline = 1;
|
||||
}
|
||||
}
|
||||
else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
|
||||
{
|
||||
fprintf(stderr, _("ERROR: Unable to write print data: %s\n"),
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (paperout)
|
||||
{
|
||||
fputs("STATE: -media-empty-warning\n", stderr);
|
||||
paperout = 0;
|
||||
}
|
||||
|
||||
if (offline)
|
||||
{
|
||||
fputs("STATE: -offline-report\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
|
||||
offline = 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
|
||||
|
||||
print_bytes -= bytes;
|
||||
print_ptr += bytes;
|
||||
total_bytes += bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Do SNMP updates periodically...
|
||||
*/
|
||||
|
||||
if (snmp_fd >= 0 && time(&curtime) >= snmp_update)
|
||||
{
|
||||
if (backendSNMPSupplies(snmp_fd, addr, NULL, NULL))
|
||||
snmp_update = INT_MAX;
|
||||
else
|
||||
snmp_update = curtime + 5;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return with success...
|
||||
*/
|
||||
|
||||
return (total_bytes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,241 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IRIX SCSI printer support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2003-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the
|
||||
* above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use
|
||||
* of this software must display the following
|
||||
* acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Easy
|
||||
* Software Products.
|
||||
*
|
||||
* 4. The name of Easy Software Products may not be used to
|
||||
* endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* list_devices() - List the available SCSI printer devices.
|
||||
* print_device() - Print a file to a SCSI device.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <bstring.h> /* memcpy() and friends */
|
||||
#include <sys/dsreq.h> /* SCSI interface stuff */
|
||||
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List the available SCSI printer devices.
|
||||
*/
|
||||
|
||||
void
|
||||
list_devices(void)
|
||||
{
|
||||
printf("direct scsi \"Unknown\" \"%s\"\n",
|
||||
_cupsLangString(cupsLangDefault(), _("SCSI Printer")));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'print_device()' - Print a file to a SCSI device.
|
||||
*/
|
||||
|
||||
int /* O - Print status */
|
||||
print_device(const char *resource, /* I - SCSI device */
|
||||
int fd, /* I - File to print */
|
||||
int copies) /* I - Number of copies to print */
|
||||
{
|
||||
int scsi_fd; /* SCSI file descriptor */
|
||||
char buffer[8192]; /* Data buffer */
|
||||
int bytes; /* Number of bytes */
|
||||
int try; /* Current try */
|
||||
dsreq_t scsi_req; /* SCSI request */
|
||||
char scsi_cmd[6]; /* SCSI command data */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure we have a valid resource name...
|
||||
*/
|
||||
|
||||
if (strncmp(resource, "/dev/scsi/", 10) != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"),
|
||||
resource);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the SCSI device file...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
{
|
||||
if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
|
||||
{
|
||||
if (getenv("CLASS") != NULL)
|
||||
{
|
||||
/*
|
||||
* If the CLASS environment variable is set, the job was submitted
|
||||
* to a class and not to a specific queue. In this case, we want
|
||||
* to abort immediately so that the job can be requeued on the next
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (errno != EAGAIN && errno != EBUSY)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (scsi_fd == -1);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Now that we are "connected" to the port, ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
* current page... Only ignore SIGTERM if we are printing data from
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (fd != 0)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
#else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the print file to the device...
|
||||
*/
|
||||
|
||||
while (copies > 0)
|
||||
{
|
||||
if (fd != 0)
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
||||
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
memset(&scsi_req, 0, sizeof(scsi_req));
|
||||
|
||||
scsi_req.ds_flags = DSRQ_WRITE;
|
||||
scsi_req.ds_time = 60 * 1000;
|
||||
scsi_req.ds_cmdbuf = scsi_cmd;
|
||||
scsi_req.ds_cmdlen = 6;
|
||||
scsi_req.ds_databuf = buffer;
|
||||
scsi_req.ds_datalen = bytes;
|
||||
|
||||
scsi_cmd[0] = 0x0a; /* Group 0 print command */
|
||||
scsi_cmd[1] = 0x00;
|
||||
scsi_cmd[2] = bytes / 65536;
|
||||
scsi_cmd[3] = bytes / 256;
|
||||
scsi_cmd[4] = bytes;
|
||||
scsi_cmd[5] = 0x00;
|
||||
|
||||
for (try = 0; try < 10; try ++)
|
||||
if (ioctl(scsi_fd, DS_ENTER, &scsi_req) < 0 ||
|
||||
scsi_req.ds_status != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: SCSI command timed out (%d); "
|
||||
"retrying...\n"), scsi_req.ds_status);
|
||||
sleep(try + 1);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
if (try >= 10)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
|
||||
scsi_req.ds_status);
|
||||
close(scsi_fd);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
copies --;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the device and return...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,260 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Linux SCSI printer support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2003-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the
|
||||
* above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use
|
||||
* of this software must display the following
|
||||
* acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Easy
|
||||
* Software Products.
|
||||
*
|
||||
* 4. The name of Easy Software Products may not be used to
|
||||
* endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* list_devices() - List the available SCSI printer devices.
|
||||
* print_device() - Print a file to a SCSI device.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <scsi/sg.h>
|
||||
#include <cups/i18n.h>
|
||||
|
||||
|
||||
/*
|
||||
* We currently only support the Linux 2.4 generic SCSI interface.
|
||||
*/
|
||||
|
||||
#ifndef SG_DXFER_TO_DEV
|
||||
/*
|
||||
* Dummy functions that do nothing on unsupported platforms...
|
||||
*/
|
||||
void list_devices(void) {}
|
||||
int print_device(const char *resource, int fd, int copies) { return (1); }
|
||||
#else
|
||||
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List the available SCSI printer devices.
|
||||
*/
|
||||
|
||||
void
|
||||
list_devices(void)
|
||||
{
|
||||
printf("direct scsi \"Unknown\" \"%s\"\n",
|
||||
_cupsLangString(cupsLangDefault(), _("SCSI Printer")));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'print_device()' - Print a file to a SCSI device.
|
||||
*/
|
||||
|
||||
int /* O - Print status */
|
||||
print_device(const char *resource, /* I - SCSI device */
|
||||
int fd, /* I - File to print */
|
||||
int copies) /* I - Number of copies to print */
|
||||
{
|
||||
int scsi_fd; /* SCSI file descriptor */
|
||||
char buffer[8192]; /* Data buffer */
|
||||
int bytes; /* Number of bytes */
|
||||
int try; /* Current try */
|
||||
sg_io_hdr_t scsi_req; /* SCSI request */
|
||||
unsigned char scsi_cmd[6], /* SCSI command data */
|
||||
scsi_sense[32]; /* SCSI sense data */
|
||||
# if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
# endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure we have a valid resource name...
|
||||
*/
|
||||
|
||||
if (strncmp(resource, "/dev/sg", 7) != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"),
|
||||
resource);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the SCSI device file...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
{
|
||||
if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
|
||||
{
|
||||
if (getenv("CLASS") != NULL)
|
||||
{
|
||||
/*
|
||||
* If the CLASS environment variable is set, the job was submitted
|
||||
* to a class and not to a specific queue. In this case, we want
|
||||
* to abort immediately so that the job can be requeued on the next
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (errno != EAGAIN && errno != EBUSY)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (scsi_fd == -1);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Now that we are "connected" to the port, ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
* current page... Only ignore SIGTERM if we are printing data from
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (fd != 0)
|
||||
{
|
||||
# ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
# elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
# else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
# endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the print file to the device...
|
||||
*/
|
||||
|
||||
while (copies > 0)
|
||||
{
|
||||
if (fd != 0)
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
||||
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
memset(&scsi_req, 0, sizeof(scsi_req));
|
||||
|
||||
scsi_req.interface_id = 'S';
|
||||
scsi_req.dxfer_direction = SG_DXFER_TO_DEV;
|
||||
scsi_req.cmd_len = 6;
|
||||
scsi_req.mx_sb_len = sizeof(scsi_sense);
|
||||
scsi_req.iovec_count = 0;
|
||||
scsi_req.dxfer_len = bytes;
|
||||
scsi_req.dxferp = buffer;
|
||||
scsi_req.cmdp = scsi_cmd;
|
||||
scsi_req.sbp = scsi_sense;
|
||||
scsi_req.timeout = 60 * 1000;
|
||||
|
||||
scsi_cmd[0] = 0x0a; /* Group 0 print command */
|
||||
scsi_cmd[1] = 0x00;
|
||||
scsi_cmd[2] = bytes / 65536;
|
||||
scsi_cmd[3] = bytes / 256;
|
||||
scsi_cmd[4] = bytes;
|
||||
scsi_cmd[5] = 0x00;
|
||||
|
||||
for (try = 0; try < 10; try ++)
|
||||
if (ioctl(scsi_fd, SG_IO, &scsi_req) < 0 ||
|
||||
scsi_req.status != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: SCSI command timed out (%d); "
|
||||
"retrying...\n"), scsi_req.status);
|
||||
sleep(try + 1);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
if (try >= 10)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
|
||||
scsi_req.status);
|
||||
close(scsi_fd);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
copies --;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the device and return...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
#endif /* !SG_DXFER_TO_DEV */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* SCSI printer backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2003-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the
|
||||
* above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use
|
||||
* of this software must display the following
|
||||
* acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Easy
|
||||
* Software Products.
|
||||
*
|
||||
* 4. The name of Easy Software Products may not be used to
|
||||
* endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the specified SCSI printer.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/backend.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.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>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
# endif /* HAVE_SYS_IOCTL_H */
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
void list_devices(void);
|
||||
int print_device(const char *resource, int fd, int copies);
|
||||
|
||||
|
||||
#if defined(__linux__) && defined(HAVE_SCSI_SG_H)
|
||||
# include "scsi-linux.c"
|
||||
#elif defined(__sgi)
|
||||
# include "scsi-irix.c"
|
||||
#else
|
||||
/*
|
||||
* Dummy functions that do nothing on unsupported platforms...
|
||||
*/
|
||||
void list_devices(void) {}
|
||||
int print_device(const char *resource, int fd, int copies) { return (CUPS_BACKEND_FAILED); }
|
||||
#endif /* __linux && HAVE_SCSI_SG_H */
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Send a file to the specified SCSI printer.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options; /* Pointer to options */
|
||||
int port; /* Port number (not used) */
|
||||
int fp; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
int status; /* Exit status */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
list_devices();
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have 7 arguments, print the file named on the command-line.
|
||||
* 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)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open print file \"%s\": %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the device name and options from the URI...
|
||||
*/
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
|
||||
method, sizeof(method), username, sizeof(username),
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource));
|
||||
|
||||
/*
|
||||
* See if there are any options...
|
||||
*/
|
||||
|
||||
if ((options = strchr(resource, '?')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Yup, terminate the device name string and move to the first
|
||||
* character of the options...
|
||||
*/
|
||||
|
||||
*options++ = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
status = print_device(resource, fp, copies);
|
||||
|
||||
/*
|
||||
* Close input file and return...
|
||||
*/
|
||||
|
||||
if (fp != 0)
|
||||
close(fp);
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+90
-1113
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Arquivo executável
+88
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# SMB printing script for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1993-1999 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44145 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
SMBCLIENT=/usr/local/samba/bin/smbclient
|
||||
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# printer job user title copies options [filename]
|
||||
#
|
||||
|
||||
if [ $# -lt 5 -o $# -gt 6 ]; then
|
||||
# Too few or too many arguments
|
||||
echo 'Usage: smb job-id user title copies options [file]' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# If "filename" is not on the command-line, then we read the print
|
||||
# data from stdin and write it to a temporary file.
|
||||
#
|
||||
|
||||
if [ $# = 5 ]; then
|
||||
# Collect all print data and put it in a temporary file...
|
||||
if [ "$TMPDIR" = "" ]; then
|
||||
TMPDIR=/var/tmp
|
||||
fi
|
||||
|
||||
filename="$TMPDIR/$$.smb"
|
||||
cat >$filename
|
||||
else
|
||||
# Use the file on the command-line...
|
||||
filename="$6"
|
||||
fi
|
||||
|
||||
#
|
||||
# Take apart the URI in $0...
|
||||
#
|
||||
|
||||
uri="$0"
|
||||
host=`echo $uri | awk -F/ '{print substr($3, index($3, "@") + 1)}'`
|
||||
user=`echo $uri | awk -F/ '{print substr($3, 0, index($3, "@") - 1)}'`
|
||||
if [ "$user" != "" ]; then
|
||||
user="-U $user"
|
||||
fi
|
||||
printer=`echo $uri | awk -F/ '{print $4}'`
|
||||
|
||||
#
|
||||
# Send the file to the remote system...
|
||||
#
|
||||
|
||||
$SMBCLIENT //$host/$printer $user -P -N <<EOF
|
||||
print $filename
|
||||
EOF
|
||||
|
||||
#
|
||||
# Lastly, remove the temporary file as needed...
|
||||
#
|
||||
|
||||
if [ $# = 5 ]; then
|
||||
rm -f $filename
|
||||
fi
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -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, ¤t_addr))
|
||||
backend_init_supplies(snmp_fd, addr);
|
||||
else if (num_supplies > 0)
|
||||
_cupsSNMPWalk(snmp_fd, ¤t_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, ¤t_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, ¤t_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$".
|
||||
*/
|
||||
-1339
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,172 +0,0 @@
|
||||
snmp.txt - 2006-04-19
|
||||
---------------------
|
||||
|
||||
This file lists the "interesting" bits from the command:
|
||||
|
||||
snmpwalk -v 1 -c public HOST .1
|
||||
|
||||
for many network print servers and internal cards. It is mainly here
|
||||
for SNMP documentation and development purposes.
|
||||
|
||||
|
||||
AXIS 5600
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM J.sp.00,JETDIRECT EX,JD28,EEPROM 6.16.5
|
||||
SNMPv2-MIB::sysName.0 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Hewlett-Packard hp LaserJet 3380
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Axis AXIS 5600
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: Axis AXIS 5600
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.3 = OID: SNMPv2-SMI::zeroDotZero
|
||||
SNMPv2-SMI::enterprises.11.2.4.3.10.8.0 = STRING: "AXIS433AE8"
|
||||
SNMPv2-SMI::enterprises.368.2.3.2.601.0 = INTEGER: 9100
|
||||
SNMPv2-SMI::enterprises.368.2.3.2.602.0 = INTEGER: 9101
|
||||
SNMPv2-SMI::enterprises.368.2.3.2.603.0 = INTEGER: 9102
|
||||
SNMPv2-SMI::enterprises.368.2.3.10.901.0 = STRING: "AXIS433AE8"
|
||||
|
||||
|
||||
AXIS OfficeBasic
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: AXIS OfficeBasic Parallel Network Print Server V6.43 Sep 4 2003
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: EPSON Stylus Photo 870
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
|
||||
|
||||
DLink DP-301P+
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: D-Link DP-301P+ Print Server
|
||||
|
||||
|
||||
Genicom ML280
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: GENICOM microLaser 280
|
||||
SNMPv2-MIB::sysName.0 = STRING: PRQ_004F75
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: MANUFACTURER:GENICOM;MODEL:microLaser 280;
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.3369.1.1.2.4
|
||||
|
||||
|
||||
EPSON Type-B Network Card
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: EPSON Type-B 10Base-T/100Base-TX Print Server
|
||||
SNMPv2-MIB::sysName.0 = STRING: StylusPro7600-BB87A8
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: EPSON Stylus Pro 7600
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.1248.1.2.1.22.69.109.117.108.97.116.101.83.116.121.108.117.115.32.80.114.111.32.55.54.48.48
|
||||
SNMPv2-SMI::enterprises.11.2.3.9.1.1.7.0 = STRING: "MFG:EPSON;CMD:ESCPL2,BDC;MDL:Stylus Pro 7600;CLS:PRINTER;DES:EPSON Stylus Pro 7600;"
|
||||
SNMPv2-SMI::enterprises.1248.1.2.2.1.1.1.1.1 = STRING: "MFG:EPSON;CMD:ESCPL2,BDC;MDL:Stylus Pro 7600;CLS:PRINTER;DES:EPSON Stylus Pro 7600;"
|
||||
|
||||
|
||||
EPSON Wireless 802.11b Print Server
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: EPSON Wireless LAN Print Interface compatible with an HP JETDIRECT EX
|
||||
SNMPv2-MIB::sysName.0 = STRING: EAI_0F550B
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
|
||||
|
||||
HP JetDirect EX3plus
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM D.04.03,JETDIRECT EX,JD26,EEPROM D.05.22
|
||||
SNMPv2-MIB::sysName.0 = STRING: NPID1EC0F
|
||||
|
||||
|
||||
HP LJ4000
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM G.05.34,JETDIRECT,JD30,EEPROM G.08.32
|
||||
SNMPv2-MIB::sysName.0 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP LaserJet 4000 Series
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1.2.5
|
||||
|
||||
|
||||
HP CLJ4550
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM L.20.07,JETDIRECT,JD84,EEPROM L.21.22,CIDATE 07/06/2001
|
||||
SNMPv2-MIB::sysName.0 = STRING: NPI02FDE7
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP Color LaserJet 4550
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Hewlett-Packard Dynamic RAM Disk
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1.2.14
|
||||
|
||||
|
||||
Lexmark C522
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: Lexmark C522 version NS.NP.N212 kernel 2.6.6 All-N-1
|
||||
SNMPv2-MIB::sysName.0 = STRING: ET0004000D0CCA
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDeviceProcessor
|
||||
HOST-RESOURCES-MIB::hrDeviceType.4 = OID: HOST-RESOURCES-TYPES::hrDeviceSerialPort
|
||||
HOST-RESOURCES-MIB::hrDeviceType.5 = OID: HOST-RESOURCES-TYPES::hrDeviceNetwork
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Lexmark C522 9421TTV LS.FA.P129
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Nonvolatile RAM
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: IBM 750 Rev CXr
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.4 = STRING: USB Interface
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.5 = STRING: Network Interface
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.3 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.4 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.5 = OID: SNMPv2-SMI::enterprises.641.1
|
||||
SNMPv2-SMI::enterprises.641.2.1.2.1.2.1 = STRING: "Lexmark C522"
|
||||
SNMPv2-SMI::enterprises.641.2.1.2.1.3.1 = STRING: "MANUFACTURER:Lexmark International;COMMAND SET:;MODEL:Lexmark C522"
|
||||
|
||||
|
||||
Linksys EPSX3
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: ETHERNET MULTI-ENVIRONMENT.ROM, JETDIRECT EX, EEPROM 6016
|
||||
|
||||
|
||||
NetGear PS113
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: A SNMP proxy agent.
|
||||
|
||||
|
||||
Okidata C7200
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: OkiLAN 6200e
|
||||
SNMPv2-MIB::sysName.0 = STRING: OKI7009715
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolat
|
||||
ileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: C7200
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: FLASH0
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.2001.1.1.1.1
|
||||
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.1 = STRING: "IEEE 1284"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.2 = STRING: "EtherTalk Phase 2"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.3 = STRING: "LPD"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.4 = STRING: "Netware Rprinter"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.5 = STRING: "Netware Bindery or NDS Pserver"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.6 = STRING: "Raw TCP Port 9100"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.7 = STRING: "FTP"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.8 = STRING: "DLC/LLC"
|
||||
SNMPv2-SMI::enterprises.2001.1.1.1.1.1.3530.0 = STRING: "C7200"
|
||||
|
||||
|
||||
Xerox N2025
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: Xerox DocuPrint N2025 Network Laser Printer - 2.12-02
|
||||
SNMPv2-MIB::sysName.0 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceParallelPort
|
||||
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDeviceNetwork
|
||||
HOST-RESOURCES-MIB::hrDeviceType.6 = OID: HOST-RESOURCES-TYPES::hrDeviceProcessor
|
||||
HOST-RESOURCES-MIB::hrDeviceType.7 = OID: HOST-RESOURCES-TYPES::hrDeviceOther
|
||||
HOST-RESOURCES-MIB::hrDeviceType.9 = OID: HOST-RESOURCES-TYPES::hrDeviceVolatileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceType.10 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Xerox DocuPrint N2025 Network Laser Printer - 2.12-02
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: IEEE 1284 port
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: Ethernet port
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.6 = STRING: Motorola Power PC
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.7 = STRING: USB Port
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.9 = STRING: RAM Memory
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.10 = STRING: ROM Memory
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.253.8.62.1.3.2.17.1
|
||||
|
||||
+122
-401
@@ -3,50 +3,50 @@
|
||||
*
|
||||
* AppSocket backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* Copyright 1997-1999 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"
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the printer or server.
|
||||
* wait_bc() - Wait for back-channel data...
|
||||
* main() - Send a file to the printer or server.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/http-private.h>
|
||||
#include "backend-private.h"
|
||||
#include <cups/cups.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <cups/string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <winsock.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <netdb.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int wait_bc(int device_fd, int secs);
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
@@ -57,81 +57,34 @@ static int wait_bc(int device_fd, int secs);
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
const char *device_uri; /* Device URI */
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (not used) */
|
||||
*options, /* Pointer to options */
|
||||
*name, /* Name of option */
|
||||
*value, /* Value of option */
|
||||
sep; /* Option separator */
|
||||
int print_fd; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
time_t start_time, /* Time of first connect */
|
||||
current_time, /* Current time */
|
||||
wait_time; /* Time to wait before shutting down socket */
|
||||
int recoverable; /* Recoverable error shown? */
|
||||
int contimeout; /* Connection timeout */
|
||||
int waiteof; /* Wait for end-of-file? */
|
||||
int port; /* Port number */
|
||||
char portname[255]; /* Port name */
|
||||
int delay; /* Delay for retries... */
|
||||
int device_fd; /* AppSocket */
|
||||
int error; /* Error code (if any) */
|
||||
http_addrlist_t *addrlist, /* Address list */
|
||||
*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 */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024]; /* Resource info (not used) */
|
||||
FILE *fp; /* Print file */
|
||||
int port; /* Port number */
|
||||
int fd; /* AppSocket */
|
||||
int error; /* Error code (if any) */
|
||||
struct sockaddr_in addr; /* Socket address */
|
||||
struct hostent *hostaddr; /* Host address */
|
||||
int wbytes; /* Number of bytes written */
|
||||
size_t nbytes, /* Number of bytes read */
|
||||
tbytes; /* Total number of bytes written */
|
||||
char buffer[8192], /* Output buffer */
|
||||
*bufptr; /* Pointer into buffer */
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
fd_set input; /* Input set for select() */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
if (argc < 6 || argc > 7)
|
||||
{
|
||||
printf("network socket \"Unknown\" \"%s\"\n",
|
||||
_cupsLangString(cupsLangDefault(), _("AppSocket/HP JetDirect")));
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -140,369 +93,137 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*/
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
print_fd = 0;
|
||||
copies = 1;
|
||||
}
|
||||
fp = stdin;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
|
||||
if ((fp = fopen(argv[6], "rb")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open print file \"%s\": %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
perror("ERROR: unable to open print file");
|
||||
return (1);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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,
|
||||
method, sizeof(method), username, sizeof(username),
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource));
|
||||
httpSeparate(argv[0], method, username, hostname, &port, resource);
|
||||
|
||||
if (port == 0)
|
||||
port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */
|
||||
|
||||
/*
|
||||
* Get options, if any...
|
||||
*/
|
||||
|
||||
waiteof = 1;
|
||||
contimeout = 7 * 24 * 60 * 60;
|
||||
|
||||
if ((options = strchr(resource, '?')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Yup, terminate the device name string and move to the first
|
||||
* character of the options...
|
||||
*/
|
||||
|
||||
*options++ = '\0';
|
||||
|
||||
/*
|
||||
* Parse options...
|
||||
*/
|
||||
|
||||
while (*options)
|
||||
{
|
||||
/*
|
||||
* Get the name...
|
||||
*/
|
||||
|
||||
name = options;
|
||||
|
||||
while (*options && *options != '=' && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if ((sep = *options) != '\0')
|
||||
*options++ = '\0';
|
||||
|
||||
if (sep == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
|
||||
value = options;
|
||||
|
||||
while (*options && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if (*options)
|
||||
*options++ = '\0';
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
|
||||
/*
|
||||
* Process the option...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(name, "waiteof"))
|
||||
{
|
||||
/*
|
||||
* Set the wait-for-eof value...
|
||||
*/
|
||||
|
||||
waiteof = !value[0] || !strcasecmp(value, "on") ||
|
||||
!strcasecmp(value, "yes") || !strcasecmp(value, "true");
|
||||
}
|
||||
else if (!strcasecmp(name, "contimeout"))
|
||||
{
|
||||
/*
|
||||
* Set the connection timeout...
|
||||
*/
|
||||
|
||||
if (atoi(value) > 0)
|
||||
contimeout = atoi(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Then try to connect to the remote host...
|
||||
*/
|
||||
|
||||
recoverable = 0;
|
||||
start_time = time(NULL);
|
||||
|
||||
sprintf(portname, "%d", port);
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
|
||||
if ((hostaddr = gethostbyname(hostname)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s",
|
||||
hostname, strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
|
||||
hostname, port);
|
||||
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
|
||||
fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
|
||||
hostname, port);
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
memcpy(&(addr.sin_addr), hostaddr->h_addr, hostaddr->h_length);
|
||||
addr.sin_family = hostaddr->h_addrtype;
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
for (delay = 5;;)
|
||||
for (;;)
|
||||
{
|
||||
if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
|
||||
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
error = errno;
|
||||
device_fd = -1;
|
||||
perror("ERROR: Unable to connect to printer");
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (getenv("CLASS") != NULL)
|
||||
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
||||
{
|
||||
error = errno;
|
||||
close(fd);
|
||||
fd = -1;
|
||||
|
||||
if (error == ECONNREFUSED)
|
||||
{
|
||||
/*
|
||||
* If the CLASS environment variable is set, the job was submitted
|
||||
* to a class and not to a specific queue. In this case, we want
|
||||
* to abort immediately so that the job can be requeued on the next
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (error == ECONNREFUSED || error == EHOSTDOWN ||
|
||||
error == EHOSTUNREACH)
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Printer not responding!\n"));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; "
|
||||
"will retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
|
||||
sleep(delay);
|
||||
|
||||
if (delay < 30)
|
||||
delay += 5;
|
||||
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in 30 seconds...\n",
|
||||
hostname);
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr, "DEBUG: Connection error: %s\n",
|
||||
strerror(errno));
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: recoverable: Unable to connect to printer; "
|
||||
"will retry in 30 seconds...\n"));
|
||||
sleep(30);
|
||||
perror("ERROR: Unable to connect to printer");
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (recoverable)
|
||||
{
|
||||
/*
|
||||
* If we've shown a recoverable error make sure the printer proxies
|
||||
* have a chance to see the recovered message. Not pretty but
|
||||
* necessary for now...
|
||||
*/
|
||||
|
||||
fputs("INFO: recovered: \n", stderr);
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.addr.sa_family == AF_INET6)
|
||||
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",
|
||||
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
|
||||
ntohs(addr->addr.ipv6.sin6_port));
|
||||
else
|
||||
#endif /* AF_INET6 */
|
||||
if (addr->addr.addr.sa_family == AF_INET)
|
||||
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
|
||||
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
|
||||
ntohs(addr->addr.ipv4.sin_port));
|
||||
|
||||
/*
|
||||
* See if the printer supports SNMP...
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
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...
|
||||
*/
|
||||
fputs("INFO: Connected to host, sending print job...\n", stderr);
|
||||
|
||||
tbytes = 0;
|
||||
|
||||
while (copies > 0 && tbytes >= 0)
|
||||
{
|
||||
copies --;
|
||||
|
||||
if (print_fd != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(print_fd, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addr->addr), 1,
|
||||
backendNetworkSideCB);
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
#else
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST tbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait up to 5 seconds to get any pending back-channel data...
|
||||
*/
|
||||
|
||||
wait_time = time(NULL) + 5;
|
||||
while (wait_time >= time(¤t_time))
|
||||
if (wait_bc(device_fd, wait_time - current_time) <= 0)
|
||||
break;
|
||||
|
||||
if (waiteof)
|
||||
while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0)
|
||||
{
|
||||
/*
|
||||
* Shutdown the socket and wait for the other end to finish...
|
||||
* Write the print data to the printer...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Print file sent, waiting for printer to finish...\n"));
|
||||
tbytes += nbytes;
|
||||
bufptr = buffer;
|
||||
|
||||
shutdown(device_fd, 1);
|
||||
|
||||
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...
|
||||
*/
|
||||
|
||||
close(device_fd);
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
*/
|
||||
|
||||
if (print_fd != 0)
|
||||
close(print_fd);
|
||||
|
||||
if (tbytes >= 0)
|
||||
_cupsLangPuts(stderr, _("INFO: Ready to print.\n"));
|
||||
|
||||
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'wait_bc()' - Wait for back-channel data...
|
||||
*/
|
||||
|
||||
static int /* O - # bytes read or -1 on error */
|
||||
wait_bc(int device_fd, /* I - Socket */
|
||||
int secs) /* I - Seconds to wait */
|
||||
{
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
fd_set input; /* Input set for select() */
|
||||
ssize_t bytes; /* Number of back-channel bytes read */
|
||||
char buffer[1024]; /* Back-channel buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Wait up to "secs" seconds for backchannel data...
|
||||
*/
|
||||
|
||||
timeout.tv_sec = secs;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
FD_ZERO(&input);
|
||||
FD_SET(device_fd, &input);
|
||||
|
||||
if (select(device_fd + 1, &input, NULL, NULL, &timeout) > 0)
|
||||
{
|
||||
/*
|
||||
* Grab the data coming back and spit it out to stderr...
|
||||
*/
|
||||
|
||||
if ((bytes = read(device_fd, buffer, sizeof(buffer))) > 0)
|
||||
while (nbytes > 0)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
|
||||
(int)bytes);
|
||||
cupsBackChannelWrite(buffer, bytes, 1.0);
|
||||
if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
|
||||
{
|
||||
perror("ERROR: Unable to send print file to printer");
|
||||
break;
|
||||
}
|
||||
|
||||
nbytes -= wbytes;
|
||||
bufptr += wbytes;
|
||||
}
|
||||
|
||||
return (bytes);
|
||||
/*
|
||||
* Check for possible data coming back from the printer...
|
||||
*/
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
FD_ZERO(&input);
|
||||
FD_SET(fd, &input);
|
||||
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
|
||||
{
|
||||
/*
|
||||
* Grab the data coming back and spit it out to stderr...
|
||||
*/
|
||||
|
||||
if ((nbytes = recv(fd, buffer, sizeof(buffer), 0)) > 0)
|
||||
fprintf(stderr, "INFO: Received %u bytes of back-channel data!\n",
|
||||
nbytes);
|
||||
}
|
||||
else if (argc > 6)
|
||||
fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes);
|
||||
}
|
||||
else
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Close the socket connection and input file and return...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IEEE-1284 support functions test program for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* Copyright 2007 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"
|
||||
* "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() - Test the device-ID functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
#include "ieee1284.c"
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Test the device-ID functions.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line args */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
fd; /* File descriptor */
|
||||
char device_id[1024], /* 1284 device ID string */
|
||||
make_model[1024], /* make-and-model string */
|
||||
uri[1024]; /* URI string */
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
puts("Usage: test1284 device-file [... device-file-N]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if ((fd = open(argv[i], O_RDWR)) < 0)
|
||||
{
|
||||
perror(argv[i]);
|
||||
return (errno);
|
||||
}
|
||||
|
||||
printf("%s:\n", argv[i]);
|
||||
|
||||
backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
|
||||
sizeof(make_model), "test", uri, sizeof(uri));
|
||||
|
||||
printf(" device_id=\"%s\"\n", device_id);
|
||||
printf(" make_model=\"%s\"\n", make_model);
|
||||
printf(" uri=\"%s\"\n", uri);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -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$".
|
||||
*/
|
||||
@@ -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$".
|
||||
*/
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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$".
|
||||
*/
|
||||
|
||||
@@ -1,634 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* USB port backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* This file is included from "usb.c" when compiled on UNIX/Linux.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* 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:
|
||||
*
|
||||
* print_device() - Print a file to a USB device.
|
||||
* list_devices() - List all USB devices.
|
||||
* open_device() - Open a USB device...
|
||||
* side_cb() - Handle side-channel requests...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <sys/select.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/*
|
||||
* 'print_device()' - Print a file to a USB device.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
print_device(const char *uri, /* I - Device URI */
|
||||
const char *hostname, /* I - Hostname/manufacturer */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
char *options, /* I - Device options/serial number */
|
||||
int print_fd, /* I - File descriptor to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int use_bc; /* Use backchannel path? */
|
||||
int device_fd; /* USB device */
|
||||
size_t tbytes; /* Total number of bytes written */
|
||||
struct termios opts; /* Parallel port options */
|
||||
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
/*
|
||||
* Open the USB port device...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
/*
|
||||
* *BSD's ulpt driver currently does not support the
|
||||
* back-channel, incorrectly returns data ready on a select(),
|
||||
* and locks up on read()...
|
||||
*/
|
||||
|
||||
use_bc = 0;
|
||||
|
||||
#elif defined(__sun)
|
||||
/*
|
||||
* CUPS STR #3028: Solaris' usbprn driver apparently does not support
|
||||
* select() or poll(), so we can't support backchannel...
|
||||
*/
|
||||
|
||||
use_bc = 0;
|
||||
|
||||
#else
|
||||
/*
|
||||
* Disable backchannel data when printing to Brother, Canon, or
|
||||
* Minolta USB printers - apparently these printers will return
|
||||
* the IEEE-1284 device ID over and over and over when they get
|
||||
* a read request...
|
||||
*/
|
||||
|
||||
use_bc = strcasecmp(hostname, "Brother") &&
|
||||
strcasecmp(hostname, "Canon") &&
|
||||
strncasecmp(hostname, "Konica", 6) &&
|
||||
strncasecmp(hostname, "Minolta", 7);
|
||||
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
|
||||
|
||||
if ((device_fd = open_device(uri, &use_bc)) == -1)
|
||||
{
|
||||
if (getenv("CLASS") != NULL)
|
||||
{
|
||||
/*
|
||||
* If the CLASS environment variable is set, the job was submitted
|
||||
* to a class and not to a specific queue. In this case, we want
|
||||
* to abort immediately so that the job can be requeued on the next
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 10 seconds...\n"));
|
||||
sleep(10);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
|
||||
errno == ENODEV)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer not connected; will retry in 30 "
|
||||
"seconds...\n"));
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (device_fd < 0);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Set any options provided...
|
||||
*/
|
||||
|
||||
tcgetattr(device_fd, &opts);
|
||||
|
||||
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
|
||||
|
||||
/**** No options supported yet ****/
|
||||
|
||||
tcsetattr(device_fd, TCSANOW, &opts);
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
tbytes = 0;
|
||||
|
||||
while (copies > 0 && tbytes >= 0)
|
||||
{
|
||||
copies --;
|
||||
|
||||
if (print_fd != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(print_fd, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
#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 */
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
#else
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST tbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the USB port and return...
|
||||
*/
|
||||
|
||||
close(device_fd);
|
||||
|
||||
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List all USB devices.
|
||||
*/
|
||||
|
||||
void
|
||||
list_devices(void)
|
||||
{
|
||||
#ifdef __linux
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
device_uri[1024], /* Device URI string */
|
||||
make_model[1024]; /* Make and model */
|
||||
|
||||
|
||||
/*
|
||||
* Try to open each USB device...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 16; i ++)
|
||||
{
|
||||
/*
|
||||
* Linux has a long history of changing the standard filenames used
|
||||
* for USB printer devices. We get the honor of trying them all...
|
||||
*/
|
||||
|
||||
sprintf(device, "/dev/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
continue;
|
||||
|
||||
sprintf(device, "/dev/usb/lp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
continue;
|
||||
|
||||
sprintf(device, "/dev/usb/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri)))
|
||||
cupsBackendReport("direct", device_uri, make_model, make_model,
|
||||
device_id, NULL);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
#elif defined(__sgi)
|
||||
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
device_uri[1024], /* Device URI string */
|
||||
make_model[1024]; /* Make and model */
|
||||
|
||||
|
||||
/*
|
||||
* Open each USB device...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 8; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/usb/printer%d", i);
|
||||
|
||||
if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
|
||||
{
|
||||
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri)))
|
||||
cupsBackendReport("direct", device_uri, make_model, make_model,
|
||||
device_id, NULL);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#elif defined(__hpux)
|
||||
#elif defined(__osf)
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
||||
int i; /* Looping var */
|
||||
char device[255]; /* Device filename */
|
||||
|
||||
|
||||
for (i = 0; i < 8; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/ulpt%d", i);
|
||||
if (!access(device, 0))
|
||||
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
|
||||
|
||||
sprintf(device, "/dev/unlpt%d", i);
|
||||
if (!access(device, 0))
|
||||
printf("direct usb:%s \"Unknown\" \"USB Printer #%d (no reset)\"\n", device, i + 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'open_device()' - Open a USB device...
|
||||
*/
|
||||
|
||||
static int /* O - File descriptor or -1 on error */
|
||||
open_device(const char *uri, /* I - Device URI */
|
||||
int *use_bc) /* O - Set to 0 for unidirectional */
|
||||
{
|
||||
int fd; /* File descriptor */
|
||||
|
||||
|
||||
/*
|
||||
* The generic implementation just treats the URI as a device filename...
|
||||
* Specific operating systems may also support using the device serial
|
||||
* number and/or make/model.
|
||||
*/
|
||||
|
||||
if (!strncmp(uri, "usb:/dev/", 9))
|
||||
#ifdef __linux
|
||||
{
|
||||
/*
|
||||
* Do not allow direct devices anymore...
|
||||
*/
|
||||
|
||||
errno = ENODEV;
|
||||
return (-1);
|
||||
}
|
||||
else if (!strncmp(uri, "usb://", 6))
|
||||
{
|
||||
/*
|
||||
* For Linux, try looking up the device serial number or model...
|
||||
*/
|
||||
|
||||
int i; /* Looping var */
|
||||
int busy; /* Are any ports busy? */
|
||||
char device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
make_model[1024], /* Make and model */
|
||||
device_uri[1024]; /* Device URI string */
|
||||
|
||||
|
||||
/*
|
||||
* Find the correct USB device...
|
||||
*/
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (busy = 0, i = 0; i < 16; i ++)
|
||||
{
|
||||
/*
|
||||
* Linux has a long history of changing the standard filenames used
|
||||
* for USB printer devices. We get the honor of trying them all...
|
||||
*/
|
||||
|
||||
sprintf(device, "/dev/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
|
||||
{
|
||||
sprintf(device, "/dev/usb/lp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
|
||||
{
|
||||
sprintf(device, "/dev/usb/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If the open failed because it was busy, flag it so we retry
|
||||
* as needed...
|
||||
*/
|
||||
|
||||
if (errno == EBUSY)
|
||||
busy = 1;
|
||||
|
||||
device_uri[0] = '\0';
|
||||
}
|
||||
|
||||
if (!strcmp(uri, device_uri))
|
||||
{
|
||||
/*
|
||||
* Yes, return this file descriptor...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n",
|
||||
device);
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* This wasn't the one...
|
||||
*/
|
||||
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we get here and at least one of the printer ports showed up
|
||||
* as "busy", then sleep for a bit and retry...
|
||||
*/
|
||||
|
||||
if (busy)
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 5 seconds...\n"));
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
{
|
||||
/*
|
||||
* Do not allow direct devices anymore...
|
||||
*/
|
||||
|
||||
errno = ENODEV;
|
||||
return (-1);
|
||||
}
|
||||
else if (!strncmp(uri, "usb://", 6))
|
||||
{
|
||||
/*
|
||||
* For Solaris, try looking up the device serial number or model...
|
||||
*/
|
||||
|
||||
int i; /* Looping var */
|
||||
int busy; /* Are any ports busy? */
|
||||
char device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
make_model[1024], /* Make and model */
|
||||
device_uri[1024]; /* Device URI string */
|
||||
|
||||
|
||||
/*
|
||||
* Find the correct USB device...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
for (i = 0, busy = 0; i < 8; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/usb/printer%d", i);
|
||||
|
||||
if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
|
||||
backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri));
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If the open failed because it was busy, flag it so we retry
|
||||
* as needed...
|
||||
*/
|
||||
|
||||
if (errno == EBUSY)
|
||||
busy = 1;
|
||||
|
||||
device_uri[0] = '\0';
|
||||
}
|
||||
|
||||
if (!strcmp(uri, device_uri))
|
||||
{
|
||||
/*
|
||||
* Yes, return this file descriptor...
|
||||
*/
|
||||
|
||||
fputs("DEBUG: Setting use_bc to 0!\n", stderr);
|
||||
|
||||
*use_bc = 0;
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* This wasn't the one...
|
||||
*/
|
||||
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we get here and at least one of the printer ports showed up
|
||||
* as "busy", then sleep for a bit and retry...
|
||||
*/
|
||||
|
||||
if (busy)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer is busy; will retry in 5 seconds...\n"));
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
while (busy);
|
||||
|
||||
/*
|
||||
* Couldn't find the printer, return "no such device or address"...
|
||||
*/
|
||||
|
||||
errno = ENODEV;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if (*use_bc)
|
||||
fd = open(uri + 4, O_RDWR | O_EXCL);
|
||||
else
|
||||
fd = -1;
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
fd = open(uri + 4, O_WRONLY | O_EXCL);
|
||||
*use_bc = 0;
|
||||
}
|
||||
|
||||
return (fd);
|
||||
}
|
||||
#endif /* __linux */
|
||||
else
|
||||
{
|
||||
errno = ENODEV;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'side_cb()' - Handle side-channel requests...
|
||||
*/
|
||||
|
||||
static 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? */
|
||||
{
|
||||
cups_sc_command_t command; /* Request command */
|
||||
cups_sc_status_t status; /* Request/response status */
|
||||
char data[2048]; /* Request/response data */
|
||||
int datalen; /* Request/response data size */
|
||||
|
||||
|
||||
(void)snmp_fd;
|
||||
(void)addr;
|
||||
|
||||
datalen = sizeof(data);
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case CUPS_SC_CMD_DRAIN_OUTPUT :
|
||||
if (backendDrainOutput(print_fd, device_fd))
|
||||
status = CUPS_SC_STATUS_IO_ERROR;
|
||||
else if (tcdrain(device_fd))
|
||||
status = CUPS_SC_STATUS_IO_ERROR;
|
||||
else
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
|
||||
datalen = 0;
|
||||
break;
|
||||
|
||||
case CUPS_SC_CMD_GET_BIDI :
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
data[0] = use_bc;
|
||||
datalen = 1;
|
||||
break;
|
||||
|
||||
case CUPS_SC_CMD_GET_DEVICE_ID :
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
if (backendGetDeviceID(device_fd, data, sizeof(data) - 1,
|
||||
NULL, 0, NULL, NULL, 0))
|
||||
{
|
||||
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
|
||||
datalen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = CUPS_SC_STATUS_OK;
|
||||
datalen = strlen(data);
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
|
||||
datalen = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
cupsSideChannelWrite(command, status, data, datalen, 1.0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-265
@@ -1,265 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* USB port backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* 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:
|
||||
*
|
||||
* list_devices() - List all available USB devices to stdout.
|
||||
* print_device() - Print a file to a USB device.
|
||||
* main() - Send a file to the specified USB port.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* A header order dependency requires this be first */
|
||||
# include <ApplicationServices/ApplicationServices.h>
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#include "backend-private.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <termios.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
void list_devices(void);
|
||||
int print_device(const char *uri, const char *hostname,
|
||||
const char *resource, char *options,
|
||||
int print_fd, int copies, int argc, char *argv[]);
|
||||
|
||||
|
||||
/*
|
||||
* Include the vendor-specific USB implementation...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_USB_H
|
||||
# include "usb-libusb.c"
|
||||
#elif defined(__APPLE__)
|
||||
# include "usb-darwin.c"
|
||||
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
||||
# include "usb-unix.c"
|
||||
#else
|
||||
/*
|
||||
* Use dummy functions that do nothing on unsupported platforms...
|
||||
* These can be used as templates for implementing USB printing on new
|
||||
* platforms...
|
||||
*/
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List all available USB devices to stdout.
|
||||
*/
|
||||
|
||||
void
|
||||
list_devices(void)
|
||||
{
|
||||
/*
|
||||
* Don't have any devices to list... Use output of the form:
|
||||
*
|
||||
* direct usb:/make/model?serial=foo "Make Model" "USB Printer"
|
||||
*
|
||||
* Note that "Hewlett Packard" or any other variation MUST be mapped to
|
||||
* "HP" for compatibility with the PPD and ICC specs.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'print_device()' - Print a file to a USB device.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
print_device(const char *uri, /* I - Device URI */
|
||||
const char *hostname, /* I - Hostname/manufacturer */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
char *options, /* I - Device options/serial number */
|
||||
int print_fd, /* I - File descriptor to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
/*
|
||||
* Can't print, so just reference the arguments to eliminate compiler
|
||||
* warnings and return and exit status of 1. Normally you would use the
|
||||
* arguments to send a file to the printer and return 0 if everything
|
||||
* worked OK and non-zero if there was an error.
|
||||
*/
|
||||
|
||||
(void)uri;
|
||||
(void)hostname;
|
||||
(void)resource;
|
||||
(void)options;
|
||||
(void)print_fd;
|
||||
(void)copies;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Send a file to the specified USB port.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int print_fd; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
int status; /* Exit status */
|
||||
int port; /* Port number (not used) */
|
||||
const char *uri; /* Device URI */
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options; /* Pointer to options */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
list_devices();
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the device name and options from the URI...
|
||||
*/
|
||||
|
||||
uri = cupsBackendDeviceURI(argv);
|
||||
|
||||
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri,
|
||||
method, sizeof(method), username, sizeof(username),
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource)) < HTTP_URI_OK)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: No device URI found in argv[0] or in DEVICE_URI "
|
||||
"environment variable!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if there are any options...
|
||||
*/
|
||||
|
||||
if ((options = strchr(resource, '?')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Yup, terminate the device name string and move to the first
|
||||
* character of the options...
|
||||
*/
|
||||
|
||||
*options++ = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have 7 arguments, print the file named on the command-line.
|
||||
* Otherwise, send stdin instead...
|
||||
*/
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
print_fd = 0;
|
||||
copies = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to open print file %s - %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
status = print_device(uri, hostname, resource, options, print_fd, copies,
|
||||
argc, argv);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
*/
|
||||
|
||||
if (print_fd != 0)
|
||||
close(print_fd);
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,16 +0,0 @@
|
||||
# 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
|
||||
+29
-99
@@ -3,162 +3,92 @@
|
||||
#
|
||||
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
# Copyright 1997-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
|
||||
TARGETS = lpc lpq lpr lprm
|
||||
OBJS = lpc.o lpq.o lpr.o lprm.o
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
||||
#
|
||||
# Make library targets...
|
||||
#
|
||||
|
||||
libs:
|
||||
|
||||
|
||||
#
|
||||
# Make unit tests...
|
||||
#
|
||||
|
||||
unittests:
|
||||
|
||||
|
||||
#
|
||||
# Clean all object files...
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS)
|
||||
|
||||
|
||||
#
|
||||
# Update dependencies (without system header dependencies...)
|
||||
#
|
||||
|
||||
depend:
|
||||
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
|
||||
|
||||
rm -f $(OBJS) $(TARGETS)
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
install-data:
|
||||
|
||||
|
||||
#
|
||||
# Install programs...
|
||||
#
|
||||
|
||||
install-exec:
|
||||
$(INSTALL_DIR) -m 755 $(BINDIR)
|
||||
$(INSTALL_BIN) lpq $(BINDIR)
|
||||
$(INSTALL_BIN) lpr $(BINDIR)
|
||||
$(INSTALL_BIN) lprm $(BINDIR)
|
||||
$(INSTALL_DIR) -m 755 $(SBINDIR)
|
||||
$(INSTALL_BIN) lpc $(SBINDIR)
|
||||
if test "x$(SYMROOT)" != "x"; then \
|
||||
$(INSTALL_DIR) $(SYMROOT); \
|
||||
for file in $(TARGETS); do \
|
||||
cp $$file $(SYMROOT); \
|
||||
done \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install headers...
|
||||
#
|
||||
|
||||
install-headers:
|
||||
|
||||
|
||||
#
|
||||
# Install libraries...
|
||||
#
|
||||
|
||||
install-libs:
|
||||
|
||||
|
||||
#
|
||||
# Uninstall all targets...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BINDIR)/lpq
|
||||
$(RM) $(BINDIR)/lpr
|
||||
$(RM) $(BINDIR)/lprm
|
||||
$(RM) $(SBINDIR)/lpc
|
||||
-$(RMDIR) $(SBINDIR)
|
||||
-$(RMDIR) $(BINDIR)
|
||||
|
||||
install:
|
||||
-$(MKDIR) $(BINDIR)
|
||||
-$(MKDIR) $(SBINDIR)
|
||||
$(CP) lpr lprm $(BINDIR)
|
||||
$(CP) lpc $(SBINDIR)
|
||||
|
||||
#
|
||||
# lpc
|
||||
#
|
||||
|
||||
lpc: lpc.o ../cups/$(LIBCUPS)
|
||||
lpc: lpc.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
|
||||
|
||||
lpc.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# lpq
|
||||
#
|
||||
|
||||
lpq: lpq.o ../cups/$(LIBCUPS)
|
||||
lpq: lpq.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
|
||||
|
||||
lpq.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# lpr
|
||||
#
|
||||
|
||||
lpr: lpr.o ../cups/$(LIBCUPS)
|
||||
lpr: lpr.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
|
||||
|
||||
lpr.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# lprm
|
||||
#
|
||||
|
||||
lprm: lprm.o ../cups/$(LIBCUPS)
|
||||
lprm: lprm.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
|
||||
lprm.o: ../cups/cups.h ../Makedefs
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
+163
-159
@@ -3,14 +3,23 @@
|
||||
*
|
||||
* "lpc" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
@@ -27,20 +36,20 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
#include <cups/string.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int compare_strings(const char *, const char *, int);
|
||||
static void do_command(http_t *, const char *, const char *);
|
||||
static void show_help(const char *);
|
||||
static void show_status(http_t *, const char *);
|
||||
static int compare_strings(char *, char *, int);
|
||||
static void do_command(http_t *, char *, char *);
|
||||
static void show_help(char *);
|
||||
static void show_status(http_t *, char *);
|
||||
|
||||
|
||||
/*
|
||||
@@ -48,21 +57,20 @@ static void show_status(http_t *, const char *);
|
||||
*/
|
||||
|
||||
int
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
http_t *http; /* Connection to server */
|
||||
char line[1024], /* Input line from user */
|
||||
*params; /* Pointer to parameters */
|
||||
int i; /* Looping var */
|
||||
http_t *http; /* Connection to server */
|
||||
char line[1024], /* Input line from user */
|
||||
*params; /* Pointer to parameters */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
http = httpConnect(cupsServer(), ippPort());
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
@@ -78,59 +86,39 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* Do the command prompt thing...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> "));
|
||||
printf("lpc> ");
|
||||
while (fgets(line, sizeof(line), stdin) != NULL)
|
||||
{
|
||||
/*
|
||||
* Strip trailing whitespace...
|
||||
* Strip the trailing newline...
|
||||
*/
|
||||
|
||||
for (params = line + strlen(line) - 1; params >= line;)
|
||||
if (!isspace(*params & 255))
|
||||
break;
|
||||
else
|
||||
*params-- = '\0';
|
||||
|
||||
/*
|
||||
* Strip leading whitespace...
|
||||
*/
|
||||
|
||||
for (params = line; isspace(*params & 255); params ++);
|
||||
|
||||
if (params > line)
|
||||
_cups_strcpy(line, params);
|
||||
|
||||
if (!line[0])
|
||||
{
|
||||
/*
|
||||
* Nothing left, just show a prompt...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> "));
|
||||
continue;
|
||||
}
|
||||
line[strlen(line) - 1] = '\0';
|
||||
|
||||
/*
|
||||
* Find any options in the string...
|
||||
*/
|
||||
|
||||
while (isspace(line[0]))
|
||||
strcpy(line, line + 1);
|
||||
|
||||
for (params = line; *params != '\0'; params ++)
|
||||
if (isspace(*params & 255))
|
||||
if (isspace(*params))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Remove whitespace between the command and parameters...
|
||||
*/
|
||||
|
||||
while (isspace(*params & 255))
|
||||
while (isspace(*params))
|
||||
*params++ = '\0';
|
||||
|
||||
/*
|
||||
* The "quit" and "exit" commands exit; otherwise, process as needed...
|
||||
*/
|
||||
|
||||
if (!compare_strings(line, "quit", 1) ||
|
||||
!compare_strings(line, "exit", 2))
|
||||
if (compare_strings(line, "quit", 1) == 0 ||
|
||||
compare_strings(line, "exit", 2) == 0)
|
||||
break;
|
||||
|
||||
if (*params == '\0')
|
||||
@@ -142,7 +130,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* Put another prompt out to the user...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> "));
|
||||
printf("lpc> ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,12 +148,12 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* 'compare_strings()' - Compare two command-line strings.
|
||||
*/
|
||||
|
||||
static int /* O - -1 or 1 = no match, 0 = match */
|
||||
compare_strings(const char *s, /* I - Command-line string */
|
||||
const char *t, /* I - Option string */
|
||||
int tmin) /* I - Minimum number of unique chars in option */
|
||||
static int /* O - -1 or 1 = no match, 0 = match */
|
||||
compare_strings(char *s, /* I - Command-line string */
|
||||
char *t, /* I - Option string */
|
||||
int tmin) /* I - Minimum number of unique chars in option */
|
||||
{
|
||||
int slen; /* Length of command-line string */
|
||||
int slen; /* Length of command-line string */
|
||||
|
||||
|
||||
slen = strlen(s);
|
||||
@@ -181,18 +169,17 @@ compare_strings(const char *s, /* I - Command-line string */
|
||||
*/
|
||||
|
||||
static void
|
||||
do_command(http_t *http, /* I - HTTP connection to server */
|
||||
const char *command, /* I - Command string */
|
||||
const char *params) /* I - Parameters for command */
|
||||
do_command(http_t *http, /* I - HTTP connection to server */
|
||||
char *command, /* I - Command string */
|
||||
char *params) /* I - Parameters for command */
|
||||
{
|
||||
if (!compare_strings(command, "status", 4))
|
||||
if (compare_strings(command, "status", 4) == 0)
|
||||
show_status(http, params);
|
||||
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
|
||||
else if (compare_strings(command, "help", 1) == 0 ||
|
||||
strcmp(command, "?") == 0)
|
||||
show_help(params);
|
||||
else
|
||||
_cupsLangPrintf(stdout,
|
||||
_("%s is not implemented by the CUPS version of lpc.\n"),
|
||||
command);
|
||||
puts("?Invalid command");
|
||||
}
|
||||
|
||||
|
||||
@@ -201,21 +188,21 @@ do_command(http_t *http, /* I - HTTP connection to server */
|
||||
*/
|
||||
|
||||
static void
|
||||
show_help(const char *command) /* I - Command to describe or NULL */
|
||||
show_help(char *command) /* I - Command to describe or NULL */
|
||||
{
|
||||
if (!command)
|
||||
if (command == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stdout,
|
||||
_("Commands may be abbreviated. Commands are:\n"
|
||||
"\n"
|
||||
"exit help quit status ?\n"));
|
||||
puts("Commands may be abbreviated. Commands are:");
|
||||
puts("");
|
||||
puts("exit help quit status ?");
|
||||
}
|
||||
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
|
||||
_cupsLangPrintf(stdout, _("help\t\tget help on commands\n"));
|
||||
else if (!compare_strings(command, "status", 4))
|
||||
_cupsLangPrintf(stdout, _("status\t\tshow status of daemon and queue\n"));
|
||||
else if (compare_strings(command, "help", 1) == 0 ||
|
||||
strcmp(command, "?") == 0)
|
||||
puts("help\t\tget help on commands");
|
||||
else if (compare_strings(command, "status", 4) == 0)
|
||||
puts("status\t\tshow status of daemon and queue");
|
||||
else
|
||||
_cupsLangPrintf(stdout, _("?Invalid help command unknown\n"));
|
||||
puts("?Invalid help command unknown");
|
||||
}
|
||||
|
||||
|
||||
@@ -224,32 +211,27 @@ show_help(const char *command) /* I - Command to describe or NULL */
|
||||
*/
|
||||
|
||||
static void
|
||||
show_status(http_t *http, /* I - HTTP connection to server */
|
||||
const char *dests) /* I - Destinations */
|
||||
show_status(http_t *http, /* I - HTTP connection to server */
|
||||
char *dests) /* I - Destinations */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
char *printer, /* Printer name */
|
||||
*device, /* Device URI */
|
||||
*delimiter; /* Char search result */
|
||||
ipp_pstate_t pstate; /* Printer state */
|
||||
int accepting; /* Is printer accepting jobs? */
|
||||
int jobcount; /* Count of current jobs */
|
||||
const char *dptr, /* Pointer into destination list */
|
||||
*ptr; /* Pointer into printer name */
|
||||
int match; /* Non-zero if this job matches */
|
||||
static const char *requested[] = /* Requested attributes */
|
||||
{
|
||||
"device-uri",
|
||||
"printer-is-accepting-jobs",
|
||||
"printer-name",
|
||||
"printer-state",
|
||||
"queued-job-count"
|
||||
};
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response, /* IPP Response */
|
||||
*jobs; /* IPP Get Jobs response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
char *printer, /* Printer name */
|
||||
*device; /* Device URI */
|
||||
ipp_pstate_t pstate; /* Printer state */
|
||||
int accepting; /* Is printer accepting jobs? */
|
||||
int jobcount; /* Count of current jobs */
|
||||
char *dptr, /* Pointer into destination list */
|
||||
*ptr; /* Pointer into printer name */
|
||||
int match; /* Non-zero if this job matches */
|
||||
char printer_uri[HTTP_MAX_URI];
|
||||
/* Printer URI */
|
||||
|
||||
|
||||
DEBUG_printf(("show_status(http=%p, dests=\"%s\")\n", http, dests));
|
||||
DEBUG_printf(("show_status(%08x, %08x)\n", http, dests));
|
||||
|
||||
if (http == NULL)
|
||||
return;
|
||||
@@ -262,17 +244,24 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
* attributes-natural-language
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_PRINTERS);
|
||||
request = ippNew();
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", sizeof(requested) / sizeof(requested[0]),
|
||||
NULL, requested);
|
||||
request->request.op.operation_id = CUPS_GET_PRINTERS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
if ((response = cupsDoRequest(http, request, "/printers/")) != NULL)
|
||||
{
|
||||
DEBUG_puts("show_status: request succeeded...");
|
||||
|
||||
@@ -305,21 +294,21 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
|
||||
{
|
||||
if (!strcmp(attr->name, "device-uri") &&
|
||||
if (strcmp(attr->name, "printer-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
printer = attr->values[0].string.text;
|
||||
|
||||
if (strcmp(attr->name, "device-uri") == 0 &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
device = attr->values[0].string.text;
|
||||
else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
|
||||
attr->value_tag == IPP_TAG_BOOLEAN)
|
||||
accepting = attr->values[0].boolean;
|
||||
else if (!strcmp(attr->name, "printer-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
printer = attr->values[0].string.text;
|
||||
else if (!strcmp(attr->name, "printer-state") &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
|
||||
if (strcmp(attr->name, "printer-state") == 0 &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
pstate = (ipp_pstate_t)attr->values[0].integer;
|
||||
else if (!strcmp(attr->name, "queued-job-count") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobcount = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "printer-is-accepting-jobs") == 0 &&
|
||||
attr->value_tag == IPP_TAG_BOOLEAN)
|
||||
accepting = attr->values[0].boolean;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
@@ -336,13 +325,6 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* A single 'all' printer name is special, meaning all printers.
|
||||
*/
|
||||
|
||||
if (dests != NULL && !strcmp(dests, "all"))
|
||||
dests = NULL;
|
||||
|
||||
/*
|
||||
* See if this is a printer we're interested in...
|
||||
*/
|
||||
@@ -357,7 +339,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
* Skip leading whitespace and commas...
|
||||
*/
|
||||
|
||||
while (isspace(*dptr & 255) || *dptr == ',')
|
||||
while (isspace(*dptr) || *dptr == ',')
|
||||
dptr ++;
|
||||
|
||||
if (*dptr == '\0')
|
||||
@@ -371,8 +353,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
|
||||
ptr ++, dptr ++);
|
||||
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
|
||||
isspace(*dptr & 255)))
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr)))
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
@@ -382,9 +363,9 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
* Skip trailing junk...
|
||||
*/
|
||||
|
||||
while (!isspace(*dptr & 255) && *dptr != '\0')
|
||||
while (!isspace(*dptr) && *dptr != '\0')
|
||||
dptr ++;
|
||||
while (isspace(*dptr & 255) || *dptr == ',')
|
||||
while (isspace(*dptr) || *dptr == ',')
|
||||
dptr ++;
|
||||
|
||||
if (*dptr == '\0')
|
||||
@@ -398,46 +379,69 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
if (match)
|
||||
{
|
||||
/*
|
||||
* If the printer state is "IPP_PRINTER_PROCESSING", then grab the
|
||||
* current job for the printer.
|
||||
*/
|
||||
|
||||
if (pstate == IPP_PRINTER_PROCESSING)
|
||||
{
|
||||
/*
|
||||
* Build an IPP_GET_JOBS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* limit
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = IPP_GET_JOBS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL,
|
||||
cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL,
|
||||
language->language);
|
||||
|
||||
sprintf(printer_uri, "ipp://localhost/printers/%s", printer);
|
||||
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, printer_uri);
|
||||
|
||||
if ((jobs = cupsDoRequest(http, request, "/jobs/")) != NULL)
|
||||
{
|
||||
for (attr = jobs->attrs; attr != NULL; attr = attr->next)
|
||||
if (strcmp(attr->name, "job-id") == 0)
|
||||
jobcount ++;
|
||||
|
||||
ippDelete(jobs);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display it...
|
||||
*/
|
||||
|
||||
printf("%s:\n", printer);
|
||||
if (!strncmp(device, "file:", 5))
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tprinter is on device \'%s\' speed -1\n"),
|
||||
device + 5);
|
||||
if (strncmp(device, "file:", 5) == 0)
|
||||
printf("\tprinter is on device \'%s\' speed -1\n", device + 5);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Just show the scheme...
|
||||
*/
|
||||
|
||||
if ((delimiter = strchr(device, ':')) != NULL )
|
||||
{
|
||||
*delimiter = '\0';
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tprinter is on device \'%s\' speed -1\n"),
|
||||
device);
|
||||
}
|
||||
}
|
||||
|
||||
if (accepting)
|
||||
_cupsLangPuts(stdout, _("\tqueuing is enabled\n"));
|
||||
else
|
||||
_cupsLangPuts(stdout, _("\tqueuing is disabled\n"));
|
||||
|
||||
if (pstate != IPP_PRINTER_STOPPED)
|
||||
_cupsLangPuts(stdout, _("\tprinting is enabled\n"));
|
||||
else
|
||||
_cupsLangPuts(stdout, _("\tprinting is disabled\n"));
|
||||
|
||||
printf("\tprinter is on device \'%s\' speed -1\n", device);
|
||||
printf("\tqueuing is %sabled\n", accepting ? "en" : "dis");
|
||||
printf("\tprinting is %sabled\n",
|
||||
pstate == IPP_PRINTER_STOPPED ? "dis" : "en");
|
||||
if (jobcount == 0)
|
||||
_cupsLangPuts(stdout, _("\tno entries\n"));
|
||||
puts("\tno entries");
|
||||
else
|
||||
_cupsLangPrintf(stdout, _("\t%d entries\n"), jobcount);
|
||||
|
||||
_cupsLangPuts(stdout, _("\tdaemon present\n"));
|
||||
printf("\t%d entries\n", jobcount);
|
||||
puts("\tdaemon present");
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
|
||||
+106
-411
@@ -3,21 +3,26 @@
|
||||
*
|
||||
* "lpq" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Parse options and commands.
|
||||
* show_jobs() - Show jobs.
|
||||
* show_printer() - Show printer status.
|
||||
* usage() - Show program usage.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -30,9 +35,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/string.h>
|
||||
#include <ctype.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
|
||||
|
||||
@@ -40,11 +45,7 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static http_t *connect_server(const char *, http_t *);
|
||||
static int show_jobs(const char *, http_t *, const char *,
|
||||
const char *, const int, const int);
|
||||
static void show_printer(const char *, http_t *, const char *);
|
||||
static void usage(void);
|
||||
static int show_jobs(http_t *, char *, char *, int, int);
|
||||
|
||||
|
||||
/*
|
||||
@@ -52,38 +53,32 @@ static void usage(void);
|
||||
*/
|
||||
|
||||
int
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
http_t *http; /* Connection to server */
|
||||
const char *dest, /* Desired printer */
|
||||
*user, /* Desired user */
|
||||
*val; /* Environment variable name */
|
||||
char *instance; /* Printer instance */
|
||||
int id, /* Desired job ID */
|
||||
all, /* All printers */
|
||||
interval, /* Reporting interval */
|
||||
longstatus; /* Show file details */
|
||||
int num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests; /* Destinations */
|
||||
int i; /* Looping var */
|
||||
http_t *http; /* Connection to server */
|
||||
char *dest, /* Desired printer */
|
||||
*user; /* Desired user */
|
||||
int id, /* Desired job ID */
|
||||
interval, /* Reporting interval */
|
||||
longstatus; /* Show file details */
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
http = httpConnect(cupsServer(), ippPort());
|
||||
|
||||
/*
|
||||
* Check for command-line options...
|
||||
*/
|
||||
|
||||
http = NULL;
|
||||
dest = NULL;
|
||||
user = NULL;
|
||||
id = 0;
|
||||
interval = 0;
|
||||
longstatus = 0;
|
||||
all = 0;
|
||||
num_dests = 0;
|
||||
dests = NULL;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '+')
|
||||
@@ -92,107 +87,14 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
{
|
||||
switch (argv[i][1])
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
|
||||
if (http)
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Sorry, no encryption support compiled in!\n"),
|
||||
argv[0]);
|
||||
#endif /* HAVE_SSL */
|
||||
break;
|
||||
|
||||
case 'U' : /* Username */
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetUser(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected username after "
|
||||
"\'-U\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
cupsSetUser(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P' : /* Printer */
|
||||
if (argv[i][2])
|
||||
dest = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i >= argc)
|
||||
{
|
||||
httpClose(http);
|
||||
cupsFreeDests(num_dests, dests);
|
||||
|
||||
usage();
|
||||
}
|
||||
|
||||
dest = argv[i];
|
||||
}
|
||||
|
||||
if ((instance = strchr(dest, '/')) != NULL)
|
||||
*instance++ = '\0';
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests2(http, &dests);
|
||||
|
||||
if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
|
||||
{
|
||||
if (instance)
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown destination \"%s/%s\"!\n"),
|
||||
argv[0], dest, instance);
|
||||
else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Unknown destination \"%s\"!\n"),
|
||||
argv[0], dest);
|
||||
|
||||
return (1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'a' : /* All printers */
|
||||
all = 1;
|
||||
break;
|
||||
|
||||
case 'h' : /* Connect to host */
|
||||
if (http)
|
||||
{
|
||||
httpClose(http);
|
||||
http = NULL;
|
||||
}
|
||||
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetServer(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected hostname after "
|
||||
"\'-h\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
cupsSetServer(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'l' : /* Long status */
|
||||
@@ -200,77 +102,25 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
default :
|
||||
httpClose(http);
|
||||
cupsFreeDests(num_dests, dests);
|
||||
|
||||
usage();
|
||||
break;
|
||||
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
else if (isdigit(argv[i][0] & 255))
|
||||
else if (isdigit(argv[i][0]))
|
||||
id = atoi(argv[i]);
|
||||
else
|
||||
user = argv[i];
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (dest == NULL && !all)
|
||||
{
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests2(http, &dests);
|
||||
|
||||
for (i = 0; i < num_dests; i ++)
|
||||
if (dests[i].is_default)
|
||||
dest = dests[i].name;
|
||||
|
||||
if (dest == NULL)
|
||||
{
|
||||
val = NULL;
|
||||
|
||||
if ((dest = getenv("LPDEST")) == NULL)
|
||||
{
|
||||
if ((dest = getenv("PRINTER")) != NULL)
|
||||
{
|
||||
if (!strcmp(dest, "lp"))
|
||||
dest = NULL;
|
||||
else
|
||||
val = "PRINTER";
|
||||
}
|
||||
}
|
||||
else
|
||||
val = "LPDEST";
|
||||
|
||||
if (dest && !cupsGetDest(dest, NULL, num_dests, dests))
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: error - %s environment variable names "
|
||||
"non-existent destination \"%s\"!\n"),
|
||||
argv[0], val, dest);
|
||||
else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: error - no default destination available.\n"),
|
||||
argv[0]);
|
||||
httpClose(http);
|
||||
cupsFreeDests(num_dests, dests);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Show the status in a loop...
|
||||
*/
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (dest)
|
||||
show_printer(argv[0], http, dest);
|
||||
|
||||
i = show_jobs(argv[0], http, dest, user, id, longstatus);
|
||||
i = show_jobs(http, dest, user, id, longstatus);
|
||||
|
||||
if (i && interval)
|
||||
{
|
||||
fflush(stdout);
|
||||
sleep(interval);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -279,7 +129,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* Close the connection to the server and return...
|
||||
*/
|
||||
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
|
||||
return (0);
|
||||
@@ -287,60 +136,31 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* 'connect_server()' - Connect to the server as necessary...
|
||||
* 'show_jobs()' - Show printers.
|
||||
*/
|
||||
|
||||
static http_t * /* O - New HTTP connection */
|
||||
connect_server(const char *command, /* I - Command name */
|
||||
http_t *http) /* I - Current HTTP connection */
|
||||
static int /* O - Number of jobs in queue */
|
||||
show_jobs(http_t *http, /* I - HTTP connection to server */
|
||||
char *dest, /* I - Destination */
|
||||
char *user, /* I - User */
|
||||
int id, /* I - Job ID */
|
||||
int longstatus) /* I - 1 if long report desired */
|
||||
{
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return (http);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_jobs()' - Show jobs.
|
||||
*/
|
||||
|
||||
static int /* O - Number of jobs in queue */
|
||||
show_jobs(const char *command, /* I - Command name */
|
||||
http_t *http, /* I - HTTP connection to server */
|
||||
const char *dest, /* I - Destination */
|
||||
const char *user, /* I - User */
|
||||
const int id, /* I - Job ID */
|
||||
const int longstatus) /* I - 1 if long report desired */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
const char *jobdest, /* Pointer into job-printer-uri */
|
||||
*jobuser, /* Pointer to job-originating-user-name */
|
||||
*jobname; /* Pointer to job-name */
|
||||
ipp_jstate_t jobstate; /* job-state */
|
||||
int jobid, /* job-id */
|
||||
jobsize, /* job-k-octets */
|
||||
#ifdef __osf__
|
||||
jobpriority, /* job-priority */
|
||||
#endif /* __osf__ */
|
||||
jobcount, /* Number of jobs */
|
||||
jobcopies, /* Number of copies */
|
||||
rank; /* Rank of job */
|
||||
char resource[1024]; /* Resource string */
|
||||
char rankstr[255]; /* Rank string */
|
||||
char namestr[1024]; /* Job name string */
|
||||
static const char *ranks[10] = /* Ranking strings */
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
char *jobdest, /* Pointer into job-printer-uri */
|
||||
*jobuser, /* Pointer to job-originating-user-name */
|
||||
*jobname; /* Pointer to job-name */
|
||||
ipp_jstate_t jobstate; /* job-state */
|
||||
int jobid, /* job-id */
|
||||
jobsize, /* job-k-octets */
|
||||
jobpriority, /* job-priority */
|
||||
jobcount, /* Number of jobs */
|
||||
rank; /* Rank of job */
|
||||
char resource[1024]; /* Resource string */
|
||||
static char *ranks[10] = /* Ranking strings */
|
||||
{
|
||||
"th",
|
||||
"st",
|
||||
@@ -355,8 +175,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);
|
||||
@@ -368,9 +188,21 @@ show_jobs(const char *command, /* I - Command name */
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* job-uri or printer-uri
|
||||
* [
|
||||
*/
|
||||
|
||||
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
if (dest == NULL)
|
||||
{
|
||||
@@ -384,10 +216,9 @@ show_jobs(const char *command, /* I - Command name */
|
||||
}
|
||||
else
|
||||
{
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
|
||||
NULL, "localhost", 0, "/printers/%s", dest);
|
||||
sprintf(resource, "ipp://localhost/printers/%s", dest);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
|
||||
@@ -402,17 +233,13 @@ show_jobs(const char *command, /* I - Command name */
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if (!longstatus)
|
||||
puts("Rank\tPri Owner Job Files Total Size");
|
||||
|
||||
jobcount = 0;
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
if ((response = cupsDoRequest(http, request, "/jobs/")) != NULL)
|
||||
{
|
||||
if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
|
||||
ippDelete(response);
|
||||
return (0);
|
||||
}
|
||||
|
||||
rank = 1;
|
||||
|
||||
/*
|
||||
@@ -437,52 +264,43 @@ show_jobs(const char *command, /* I - Command name */
|
||||
|
||||
jobid = 0;
|
||||
jobsize = 0;
|
||||
#ifdef __osf__
|
||||
jobpriority = 50;
|
||||
#endif /* __osf__ */
|
||||
jobstate = IPP_JOB_PENDING;
|
||||
jobname = "untitled";
|
||||
jobuser = NULL;
|
||||
jobdest = NULL;
|
||||
jobcopies = 1;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
|
||||
{
|
||||
if (!strcmp(attr->name, "job-id") &&
|
||||
if (strcmp(attr->name, "job-id") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-k-octets") &&
|
||||
if (strcmp(attr->name, "job-k-octets") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobsize = attr->values[0].integer;
|
||||
jobsize = attr->values[0].integer * 1024;
|
||||
|
||||
#ifdef __osf__
|
||||
if (!strcmp(attr->name, "job-priority") &&
|
||||
if (strcmp(attr->name, "job-priority") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobpriority = attr->values[0].integer;
|
||||
#endif /* __osf__ */
|
||||
|
||||
if (!strcmp(attr->name, "job-state") &&
|
||||
if (strcmp(attr->name, "job-state") == 0 &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
jobstate = (ipp_jstate_t)attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-printer-uri") &&
|
||||
if (strcmp(attr->name, "job-printer-uri") == 0 &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL)
|
||||
jobdest ++;
|
||||
|
||||
if (!strcmp(attr->name, "job-originating-user-name") &&
|
||||
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
jobuser = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "job-name") &&
|
||||
if (strcmp(attr->name, "job-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
jobname = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "copies") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobcopies = attr->values[0].integer;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
@@ -498,174 +316,51 @@ show_jobs(const char *command, /* I - Command name */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!longstatus && jobcount == 0)
|
||||
#ifdef __osf__
|
||||
_cupsLangPuts(stdout,
|
||||
_("Rank Owner Pri Job Files"
|
||||
" Total Size\n"));
|
||||
#else
|
||||
_cupsLangPuts(stdout,
|
||||
_("Rank Owner Job File(s)"
|
||||
" Total Size\n"));
|
||||
#endif /* __osf__ */
|
||||
|
||||
jobcount ++;
|
||||
|
||||
/*
|
||||
* Display the job...
|
||||
*/
|
||||
|
||||
if (jobstate == IPP_JOB_PROCESSING)
|
||||
strcpy(rankstr, "active");
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Make the rank show the "correct" suffix for each number
|
||||
* (11-13 are the only special cases, for English anyways...)
|
||||
*/
|
||||
|
||||
if ((rank % 100) >= 11 && (rank % 100) <= 13)
|
||||
snprintf(rankstr, sizeof(rankstr), "%dth", rank);
|
||||
else
|
||||
snprintf(rankstr, sizeof(rankstr), "%d%s", rank, ranks[rank % 10]);
|
||||
|
||||
rank ++;
|
||||
}
|
||||
|
||||
if (longstatus)
|
||||
{
|
||||
_cupsLangPuts(stdout, "\n");
|
||||
puts("");
|
||||
|
||||
if (jobcopies > 1)
|
||||
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
|
||||
jobname);
|
||||
if (jobstate == IPP_JOB_PROCESSING)
|
||||
printf("%s: active\t\t\t\t ", jobuser);
|
||||
else
|
||||
strlcpy(namestr, jobname, sizeof(namestr));
|
||||
{
|
||||
printf("%s: %d%s\t\t\t\t ", jobuser, rank, ranks[rank % 10]);
|
||||
rank ++;
|
||||
}
|
||||
|
||||
_cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]\n"),
|
||||
jobuser, rankstr, jobid);
|
||||
_cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes\n"),
|
||||
namestr, 1024.0 * jobsize);
|
||||
printf("[job %03dlocalhost]\n", jobid);
|
||||
printf("\t%-33s%d bytes\n", jobname, jobsize);
|
||||
}
|
||||
else
|
||||
#ifdef __osf__
|
||||
_cupsLangPrintf(stdout,
|
||||
_("%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"),
|
||||
rankstr, jobuser, jobpriority, jobid, jobname,
|
||||
1024.0 * jobsize);
|
||||
#else
|
||||
_cupsLangPrintf(stdout,
|
||||
_("%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"),
|
||||
rankstr, jobuser, jobid, jobname, 1024.0 * jobsize);
|
||||
#endif /* __osf */
|
||||
{
|
||||
if (jobstate == IPP_JOB_PROCESSING)
|
||||
printf("active\t");
|
||||
else
|
||||
{
|
||||
printf("%d%s\t", rank, ranks[rank % 10]);
|
||||
rank ++;
|
||||
}
|
||||
|
||||
printf(" %-5d%-7.7s%-7d%-19s%d bytes\n", jobpriority, jobuser, jobid,
|
||||
jobname, jobsize);
|
||||
}
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (jobcount == 0)
|
||||
_cupsLangPuts(stdout, _("no entries\n"));
|
||||
|
||||
return (jobcount);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_printer()' - Show printer status.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_printer(const char *command, /* I - Command name */
|
||||
http_t *http, /* I - HTTP connection to server */
|
||||
const char *dest) /* I - Destination */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
ipp_pstate_t state; /* Printer state */
|
||||
char uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
|
||||
|
||||
if (http == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", dest);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
|
||||
ippDelete(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL)
|
||||
state = (ipp_pstate_t)attr->values[0].integer;
|
||||
else
|
||||
state = IPP_PRINTER_STOPPED;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case IPP_PRINTER_IDLE :
|
||||
_cupsLangPrintf(stdout, _("%s is ready\n"), dest);
|
||||
break;
|
||||
case IPP_PRINTER_PROCESSING :
|
||||
_cupsLangPrintf(stdout, _("%s is ready and printing\n"),
|
||||
dest);
|
||||
break;
|
||||
case IPP_PRINTER_STOPPED :
|
||||
_cupsLangPrintf(stdout, _("%s is not ready\n"), dest);
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'usage()' - Show program usage.
|
||||
*/
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("Usage: lpq [-P dest] [-U username] [-h hostname[:port]] "
|
||||
"[-l] [+interval]\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
+102
-301
@@ -3,14 +3,23 @@
|
||||
*
|
||||
* "lpr" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
@@ -23,11 +32,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <cups/string.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -35,31 +40,26 @@
|
||||
*/
|
||||
|
||||
int
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i, j; /* Looping var */
|
||||
int job_id; /* Job ID */
|
||||
char ch; /* Option character */
|
||||
char *printer, /* Destination printer or class */
|
||||
*instance; /* Instance */
|
||||
const char *title, /* Job title */
|
||||
*val; /* Environment variable name */
|
||||
int num_copies; /* Number of copies per file */
|
||||
int num_files; /* Number of files to print */
|
||||
const char *files[1000]; /* Files to print */
|
||||
cups_dest_t *dest; /* Selected destination */
|
||||
int num_options; /* Number of options */
|
||||
cups_option_t *options; /* Options */
|
||||
int deletefile; /* Delete file after print? */
|
||||
char buffer[8192]; /* Copy buffer */
|
||||
int i; /* Looping var */
|
||||
int job_id; /* Job ID */
|
||||
char *dest; /* Destination printer */
|
||||
char *title; /* Job title */
|
||||
int priority; /* Job priority (1-100) */
|
||||
int num_copies; /* Number of copies per file */
|
||||
int num_files; /* Number of files printed */
|
||||
int num_options; /* Number of options */
|
||||
cups_option_t *options; /* Options */
|
||||
int silent; /* Silent or verbose output? */
|
||||
char tempfile[1024]; /* Temporary file for printing from stdin */
|
||||
char buffer[8192]; /* Copy buffer */
|
||||
FILE *temp; /* Temporary file pointer */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
deletefile = 0;
|
||||
printer = NULL;
|
||||
dest = NULL;
|
||||
silent = 0;
|
||||
dest = cupsGetDefault();
|
||||
num_options = 0;
|
||||
options = NULL;
|
||||
num_files = 0;
|
||||
@@ -67,76 +67,12 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '-')
|
||||
switch (ch = argv[i][1])
|
||||
switch (argv[i][1])
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Sorry, no encryption support compiled in!\n"),
|
||||
argv[0]);
|
||||
#endif /* HAVE_SSL */
|
||||
break;
|
||||
|
||||
case 'U' : /* Username */
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetUser(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected username after "
|
||||
"\'-U\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
cupsSetUser(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'H' : /* Connect to host */
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetServer(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected hostname after "
|
||||
"\'-H\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
cupsSetServer(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case '1' : /* TROFF font set 1 */
|
||||
case '2' : /* TROFF font set 2 */
|
||||
case '3' : /* TROFF font set 3 */
|
||||
case '4' : /* TROFF font set 4 */
|
||||
case 'i' : /* indent */
|
||||
case 'w' : /* width */
|
||||
if (argv[i][2] == '\0')
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected value after \'-%c\' "
|
||||
"option!\n"), argv[0], ch);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
case 'c' : /* CIFPLOT */
|
||||
case 'd' : /* DVI */
|
||||
case 'f' : /* FORTRAN */
|
||||
@@ -144,98 +80,33 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
case 'n' : /* Ditroff */
|
||||
case 't' : /* Troff */
|
||||
case 'v' : /* Raster image */
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Warning - \'%c\' format modifier not "
|
||||
"supported - output may not be correct!\n"),
|
||||
argv[0], ch);
|
||||
break;
|
||||
|
||||
case 'o' : /* Option */
|
||||
if (argv[i][2] != '\0')
|
||||
num_options = cupsParseOptions(argv[i] + 2, num_options, &options);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: error - expected option=value after "
|
||||
"\'-o\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
num_options = cupsParseOptions(argv[i], num_options, &options);
|
||||
}
|
||||
fprintf(stderr, "Warning: \'%c\' format modifier not supported - output may not be correct!\n",
|
||||
argv[i][1]);
|
||||
break;
|
||||
|
||||
case 'l' : /* Literal/raw */
|
||||
num_options = cupsAddOption("raw", "true", num_options, &options);
|
||||
num_options = cupsParseOptions("raw", num_options, &options);
|
||||
break;
|
||||
|
||||
case 'p' : /* Prettyprint */
|
||||
num_options = cupsAddOption("prettyprint", "true", num_options,
|
||||
&options);
|
||||
num_options = cupsParseOptions("prettyprint", num_options, &options);
|
||||
break;
|
||||
|
||||
case 'h' : /* Suppress burst page */
|
||||
num_options = cupsAddOption("job-sheets", "none", num_options,
|
||||
&options);
|
||||
break;
|
||||
|
||||
case 's' : /* Don't use symlinks */
|
||||
break;
|
||||
|
||||
case 'm' : /* Mail on completion */
|
||||
{
|
||||
char email[1024]; /* EMail address */
|
||||
|
||||
|
||||
snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(),
|
||||
httpGetHostname(NULL, buffer, sizeof(buffer)));
|
||||
num_options = cupsAddOption("notify-recipient-uri", email,
|
||||
num_options, &options);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q' : /* Queue file but don't print */
|
||||
num_options = cupsAddOption("job-hold-until", "indefinite",
|
||||
num_options, &options);
|
||||
break;
|
||||
|
||||
case 'r' : /* Remove file after printing */
|
||||
deletefile = 1;
|
||||
case 'm' : /* mail on completion */
|
||||
fputs("Warning: email notification is not supported!\n", stderr);
|
||||
break;
|
||||
|
||||
case 'P' : /* Destination printer or class */
|
||||
if (argv[i][2] != '\0')
|
||||
printer = argv[i] + 2;
|
||||
dest = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected destination after "
|
||||
"\'-P\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
printer = argv[i];
|
||||
}
|
||||
|
||||
if ((instance = strrchr(printer, '/')) != NULL)
|
||||
*instance++ = '\0';
|
||||
|
||||
if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
|
||||
{
|
||||
for (j = 0; j < dest->num_options; j ++)
|
||||
if (cupsGetOption(dest->options[j].name, num_options,
|
||||
options) == NULL)
|
||||
num_options = cupsAddOption(dest->options[j].name,
|
||||
dest->options[j].value,
|
||||
num_options, &options);
|
||||
dest = argv[i];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -245,18 +116,15 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected copy count after "
|
||||
"\'-#\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
num_copies = atoi(argv[i]);
|
||||
}
|
||||
|
||||
if (num_copies < 1 || num_copies > 100)
|
||||
{
|
||||
fputs("lpr: Number copies must be between 1 and 100.\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
sprintf(buffer, "%d", num_copies);
|
||||
num_options = cupsAddOption("copies", buffer, num_options, &options);
|
||||
break;
|
||||
@@ -269,157 +137,90 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected name after \'-%c\' "
|
||||
"option!\n"), argv[0], ch);
|
||||
return (1);
|
||||
}
|
||||
|
||||
title = argv[i];
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown option \'%c\'!\n"),
|
||||
argv[0], argv[i][1]);
|
||||
fprintf(stderr, "lpr: Unknown option \'%c\'!\n", argv[i][1]);
|
||||
return (1);
|
||||
}
|
||||
else if (num_files < 1000)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Print a file...
|
||||
*/
|
||||
|
||||
if (access(argv[i], R_OK) != 0)
|
||||
if (dest == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unable to access \"%s\" - %s\n"),
|
||||
argv[0], argv[i], strerror(errno));
|
||||
return (1);
|
||||
fputs("lpr: error - no default destination available.\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
files[num_files] = argv[i];
|
||||
num_files ++;
|
||||
|
||||
if (title == NULL)
|
||||
if (title)
|
||||
job_id = cupsPrintFile(dest, argv[i], title, num_options, options);
|
||||
else
|
||||
{
|
||||
if ((title = strrchr(argv[i], '/')) != NULL)
|
||||
title ++;
|
||||
char *filename;
|
||||
|
||||
if ((filename = strrchr(argv[i], '/')) != NULL)
|
||||
filename ++;
|
||||
else
|
||||
title = argv[i];
|
||||
filename = argv[i];
|
||||
|
||||
job_id = cupsPrintFile(dest, argv[i], filename, num_options, options);
|
||||
}
|
||||
|
||||
if (job_id < 1)
|
||||
{
|
||||
fprintf(stderr, "lpr: unable to print file \'%s\'.\n", argv[i]);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - too many files - \"%s\"\n"),
|
||||
argv[0], argv[i]);
|
||||
|
||||
/*
|
||||
* See if we have any files to print; if not, print from stdin...
|
||||
* See if we printed anything; if not, print from stdin...
|
||||
*/
|
||||
|
||||
if (printer == NULL)
|
||||
if (num_files == 0)
|
||||
{
|
||||
if ((dest = cupsGetNamedDest(NULL, NULL, NULL)) != NULL)
|
||||
if (dest == NULL)
|
||||
{
|
||||
printer = dest->name;
|
||||
|
||||
for (j = 0; j < dest->num_options; j ++)
|
||||
if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
|
||||
num_options = cupsAddOption(dest->options[j].name,
|
||||
dest->options[j].value,
|
||||
num_options, &options);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
val = NULL;
|
||||
|
||||
if ((printer = getenv("LPDEST")) == NULL)
|
||||
{
|
||||
if ((printer = getenv("PRINTER")) != NULL)
|
||||
{
|
||||
if (!strcmp(printer, "lp"))
|
||||
printer = NULL;
|
||||
else
|
||||
val = "PRINTER";
|
||||
}
|
||||
}
|
||||
else
|
||||
val = "LPDEST";
|
||||
|
||||
if (printer && !cupsGetNamedDest(NULL, printer, NULL))
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - %s environment variable names "
|
||||
"non-existent destination \"%s\"!\n"),
|
||||
argv[0], val, printer);
|
||||
else if (cupsLastError() == IPP_NOT_FOUND)
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - no default destination available.\n"),
|
||||
argv[0]);
|
||||
else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - scheduler not responding!\n"),
|
||||
argv[0]);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (num_files > 0)
|
||||
{
|
||||
job_id = cupsPrintFiles(printer, num_files, files, title, num_options, options);
|
||||
|
||||
if (deletefile && job_id > 0)
|
||||
{
|
||||
/*
|
||||
* Delete print files after printing...
|
||||
*/
|
||||
|
||||
for (i = 0; i < num_files; i ++)
|
||||
unlink(files[i]);
|
||||
}
|
||||
}
|
||||
else if ((job_id = cupsCreateJob(CUPS_HTTP_DEFAULT, printer,
|
||||
title ? title : "(stdin)",
|
||||
num_options, options)) > 0)
|
||||
{
|
||||
http_status_t status; /* Write status */
|
||||
const char *format; /* Document format */
|
||||
ssize_t bytes; /* Bytes read */
|
||||
|
||||
|
||||
if (cupsGetOption("raw", num_options, options))
|
||||
format = CUPS_FORMAT_RAW;
|
||||
else if ((format = cupsGetOption("document-format", num_options,
|
||||
options)) == NULL)
|
||||
format = CUPS_FORMAT_AUTO;
|
||||
|
||||
status = cupsStartDocument(CUPS_HTTP_DEFAULT, printer, job_id, NULL,
|
||||
format, 1);
|
||||
|
||||
while (status == HTTP_CONTINUE &&
|
||||
(bytes = read(0, buffer, sizeof(buffer))) > 0)
|
||||
status = cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, bytes);
|
||||
|
||||
if (status != HTTP_CONTINUE)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unable to queue from stdin - %s\n"),
|
||||
argv[0], httpStatus(status));
|
||||
fputs("lpr: error - no default destination available.\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
|
||||
job_id = 0;
|
||||
}
|
||||
temp = fopen(tmpnam(tempfile), "w");
|
||||
|
||||
if (job_id < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
|
||||
return (1);
|
||||
if (temp == NULL)
|
||||
{
|
||||
fputs("lpr: unable to create temporary file.\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
while ((i = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
|
||||
fwrite(buffer, 1, i, temp);
|
||||
|
||||
i = ftell(temp);
|
||||
fclose(temp);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
fputs("lpr: stdin is empty, so no job has been sent.\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (title)
|
||||
job_id = cupsPrintFile(dest, tempfile, title, num_options, options);
|
||||
else
|
||||
job_id = cupsPrintFile(dest, tempfile, "(stdin)", num_options, options);
|
||||
|
||||
if (job_id < 1)
|
||||
{
|
||||
fprintf(stderr, "lpr: unable to print file \'%s\'.\n", argv[i]);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
+103
-132
@@ -3,14 +3,23 @@
|
||||
*
|
||||
* "lprm" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
@@ -23,10 +32,10 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/string.h>
|
||||
#include <cups/language.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -37,24 +46,35 @@ int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
http_t *http; /* HTTP connection to server */
|
||||
int i; /* Looping var */
|
||||
int job_id; /* Job ID */
|
||||
const char *name; /* Destination printer */
|
||||
char *instance; /* Pointer to instance name */
|
||||
cups_dest_t *dest, /* Destination */
|
||||
*defdest; /* Default destination */
|
||||
int did_cancel; /* Did we cancel something? */
|
||||
char *dest; /* Destination printer */
|
||||
char uri[1024]; /* Printer or job URI */
|
||||
ipp_t *request; /* IPP request */
|
||||
ipp_t *response; /* IPP response */
|
||||
ipp_op_t op; /* Operation */
|
||||
cups_lang_t *language; /* Language */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
|
||||
/*
|
||||
* Setup to cancel individual print jobs...
|
||||
*/
|
||||
|
||||
did_cancel = 0;
|
||||
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
|
||||
name = defdest ? defdest->name : NULL;
|
||||
op = IPP_CANCEL_JOB;
|
||||
job_id = 0;
|
||||
dest = cupsGetDefault();
|
||||
response = NULL;
|
||||
|
||||
/*
|
||||
* Open a connection to the server...
|
||||
*/
|
||||
|
||||
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
|
||||
{
|
||||
fputs("lprm: Unable to contact server!\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process command-line arguments...
|
||||
@@ -64,90 +84,19 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (argv[i][0] == '-' && argv[i][1] != '\0')
|
||||
switch (argv[i][1])
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Sorry, no encryption support compiled in!\n"),
|
||||
argv[0]);
|
||||
#endif /* HAVE_SSL */
|
||||
break;
|
||||
|
||||
case 'P' : /* Cancel jobs on a printer */
|
||||
if (argv[i][2])
|
||||
name = argv[i] + 2;
|
||||
dest = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
name = argv[i];
|
||||
dest = argv[i];
|
||||
}
|
||||
|
||||
if ((instance = strchr(name, '/')) != NULL)
|
||||
*instance = '\0';
|
||||
|
||||
if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, name,
|
||||
NULL)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown destination \"%s\"!\n"),
|
||||
argv[0], name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
cupsFreeDests(1, dest);
|
||||
break;
|
||||
|
||||
case 'U' : /* Username */
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetUser(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected username after "
|
||||
"\'-U\' option!\n"),
|
||||
argv[0]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
cupsSetUser(argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h' : /* Connect to host */
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetServer(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected hostname after "
|
||||
"\'-h\' option!\n"),
|
||||
argv[0]);
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
cupsSetServer(argv[i]);
|
||||
}
|
||||
|
||||
if (defdest)
|
||||
cupsFreeDests(1, defdest);
|
||||
|
||||
defdest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
|
||||
name = defdest ? defdest->name : NULL;
|
||||
break;
|
||||
|
||||
default :
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown option \'%c\'!\n"),
|
||||
argv[0], argv[i][1]);
|
||||
goto error;
|
||||
fprintf(stderr, "lprm: Unknown option \'%c\'!\n", argv[i][1]);
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,70 +104,92 @@ 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]))
|
||||
{
|
||||
name = argv[i];
|
||||
job_id = 0;
|
||||
}
|
||||
else if (isdigit(argv[i][0] & 255))
|
||||
{
|
||||
name = NULL;
|
||||
dest = NULL;
|
||||
op = IPP_CANCEL_JOB;
|
||||
job_id = atoi(argv[i]);
|
||||
}
|
||||
else if (!strcmp(argv[i], "-"))
|
||||
else if (strcmp(argv[i], "-") == 0)
|
||||
{
|
||||
/*
|
||||
* Cancel all jobs
|
||||
*/
|
||||
|
||||
job_id = -1;
|
||||
op = IPP_PURGE_JOBS;
|
||||
}
|
||||
else
|
||||
job_id = 0;
|
||||
|
||||
/*
|
||||
* Build an IPP request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri + job-id *or* job-uri
|
||||
* [requesting-user-name]
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = op;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
if (dest)
|
||||
{
|
||||
sprintf(uri, "ipp://localhost/printers/%s", dest);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
|
||||
job_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown destination \"%s\"!\n"),
|
||||
argv[0], argv[i]);
|
||||
goto error;
|
||||
sprintf(uri, "ipp://localhost/jobs/%d", job_id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
|
||||
uri);
|
||||
}
|
||||
|
||||
if (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0) != IPP_OK)
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if (op == IPP_PURGE_JOBS)
|
||||
response = cupsDoRequest(http, request, "/admin/");
|
||||
else
|
||||
response = cupsDoRequest(http, request, "/jobs/");
|
||||
|
||||
if (response != NULL)
|
||||
ippDelete(response);
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
|
||||
goto error;
|
||||
fputs("lprm: Unable to cancel job(s)!\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
did_cancel = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If nothing has been canceled yet, cancel the current job on the specified
|
||||
* If nothing has been cancelled yet, cancel the current job on the specified
|
||||
* (or default) printer...
|
||||
*/
|
||||
|
||||
if (!did_cancel && cupsCancelJob2(CUPS_HTTP_DEFAULT, name, 0, 0) != IPP_OK)
|
||||
if (response == NULL)
|
||||
if (!cupsCancelJob(dest, 0))
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
|
||||
goto error;
|
||||
fputs("lprm: Unable to cancel job(s)!\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (defdest)
|
||||
cupsFreeDests(1, defdest);
|
||||
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* If we get here there was an error, so clean up...
|
||||
*/
|
||||
|
||||
error:
|
||||
|
||||
if (defdest)
|
||||
cupsFreeDests(1, defdest);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
# 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
|
||||
+30
-311
@@ -3,56 +3,29 @@
|
||||
#
|
||||
# CGI makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products.
|
||||
# Copyright 1997-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
LIBOBJS = \
|
||||
help-index.o \
|
||||
html.o \
|
||||
ipp-var.o \
|
||||
search.o \
|
||||
template.o \
|
||||
var.o
|
||||
OBJS = \
|
||||
$(LIBOBJS) \
|
||||
admin.o \
|
||||
classes.o \
|
||||
help.o \
|
||||
jobs.o \
|
||||
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)
|
||||
|
||||
TARGETS = classes.cgi jobs.cgi printers.cgi
|
||||
OBJS = classes.o jobs.o printers.o
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
@@ -60,304 +33,50 @@ 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
|
||||
|
||||
|
||||
#
|
||||
# Update dependencies (without system header dependencies...)
|
||||
#
|
||||
|
||||
depend:
|
||||
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
|
||||
|
||||
rm -f $(OBJS) $(TARGETS)
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
install-data:
|
||||
|
||||
|
||||
#
|
||||
# Install programs...
|
||||
#
|
||||
|
||||
install-exec:
|
||||
$(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
|
||||
for file in $(CGIS); do \
|
||||
$(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
|
||||
done
|
||||
if test "x$(SYMROOT)" != "x"; then \
|
||||
$(INSTALL_DIR) $(SYMROOT); \
|
||||
for file in $(TARGETS); do \
|
||||
cp $$file $(SYMROOT); \
|
||||
done \
|
||||
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...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for file in $(CGIS); do \
|
||||
$(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...
|
||||
#
|
||||
|
||||
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)
|
||||
echo Archiving $@...
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# admin.cgi
|
||||
#
|
||||
|
||||
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ admin.o -lcupscgi $(LIBS)
|
||||
|
||||
install:
|
||||
-$(MKDIR) $(SERVERROOT)/cgi-bin
|
||||
$(CP) $(TARGETS) $(SERVERROOT)/cgi-bin
|
||||
|
||||
#
|
||||
# classes.cgi
|
||||
#
|
||||
|
||||
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
classes.cgi: classes.o ../Makedefs ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ classes.o -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# help.cgi
|
||||
#
|
||||
|
||||
help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ help.o -lcupscgi $(LIBS)
|
||||
$(CC) $(LDFLAGS) -o $@ classes.o $(LIBS)
|
||||
|
||||
$(OBJS): ../Makedefs ../cups/cups.h ../cups/ipp.h ../cups/language.h
|
||||
|
||||
#
|
||||
# jobs.cgi
|
||||
#
|
||||
|
||||
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
jobs.cgi: jobs.o ../Makedefs ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
|
||||
$(CC) $(LDFLAGS) -o $@ jobs.o $(LIBS)
|
||||
|
||||
$(OBJS): ../Makedefs ../cups/cups.h ../cups/ipp.h ../cups/language.h
|
||||
|
||||
#
|
||||
# printers.cgi
|
||||
#
|
||||
|
||||
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
|
||||
printers.cgi: printers.o ../Makedefs ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# testcgi
|
||||
#
|
||||
|
||||
testcgi: testcgi.o ../Makedefs libcupscgi.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
|
||||
|
||||
|
||||
#
|
||||
# testhi
|
||||
#
|
||||
|
||||
testhi: testhi.o ../Makedefs libcupscgi.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
|
||||
|
||||
|
||||
#
|
||||
# testtemplate
|
||||
#
|
||||
|
||||
testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.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...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
$(CC) $(LDFLAGS) -o $@ printers.o $(LIBS)
|
||||
|
||||
$(OBJS): ../Makedefs ../cups/cups.h ../cups/ipp.h ../cups/language.h
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
-4180
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Private CGI definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 1997-2006 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/".
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi.h"
|
||||
#include <cups/debug.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/string.h>
|
||||
|
||||
|
||||
/*
|
||||
* Limits...
|
||||
*/
|
||||
|
||||
#define CUPS_PAGE_MAX 100 /* Maximum items per page */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI support library definitions.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 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/".
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CGI_H_
|
||||
# define _CUPS_CGI_H_
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
# ifdef WIN32
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
# else
|
||||
# include <unistd.h>
|
||||
# endif /* WIN32 */
|
||||
|
||||
# include <cups/cups.h>
|
||||
# include <cups/array.h>
|
||||
# include "help-index.h"
|
||||
|
||||
|
||||
/*
|
||||
* Types...
|
||||
*/
|
||||
|
||||
typedef struct cgi_file_s /**** Uploaded file data ****/
|
||||
{
|
||||
char tempfile[1024], /* Temporary file containing data */
|
||||
*name, /* Variable name */
|
||||
*filename, /* Original filename */
|
||||
*mimetype; /* MIME media type */
|
||||
size_t filesize; /* Size of uploaded file */
|
||||
} cgi_file_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void cgiAbort(const char *title, const char *stylesheet,
|
||||
const char *format, ...);
|
||||
extern int cgiCheckVariables(const char *names);
|
||||
extern void *cgiCompileSearch(const char *query);
|
||||
extern void cgiCopyTemplateFile(FILE *out, const char *tmpl);
|
||||
extern void cgiCopyTemplateLang(const char *tmpl);
|
||||
extern int cgiDoSearch(void *search, const char *text);
|
||||
extern void cgiEndHTML(void);
|
||||
extern void cgiEndMultipart(void);
|
||||
extern char *cgiFormEncode(char *dst, const char *src, size_t dstsize);
|
||||
extern void cgiFreeSearch(void *search);
|
||||
extern const char *cgiGetArray(const char *name, int element);
|
||||
extern void cgiGetAttributes(ipp_t *request, const char *tmpl);
|
||||
extern char *cgiGetCookie(const char *name, char *buf, int buflen);
|
||||
extern const cgi_file_t *cgiGetFile(void);
|
||||
extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search);
|
||||
extern int cgiGetSize(const char *name);
|
||||
extern char *cgiGetTemplateDir(void);
|
||||
extern const char *cgiGetVariable(const char *name);
|
||||
extern int cgiInitialize(void);
|
||||
extern int cgiIsPOST(void);
|
||||
extern void cgiMoveJobs(http_t *http, const char *dest, int job_id);
|
||||
extern void cgiPrintCommand(http_t *http, const char *dest,
|
||||
const char *command, const char *title);
|
||||
extern void cgiPrintTestPage(http_t *http, const char *dest);
|
||||
extern char *cgiRewriteURL(const char *uri, char *url, int urlsize,
|
||||
const char *newresource);
|
||||
extern void cgiSetArray(const char *name, int element,
|
||||
const char *value);
|
||||
extern void cgiSetCookie(const char *name, const char *value,
|
||||
const char *path, const char *domain,
|
||||
time_t expires, int secure);
|
||||
extern ipp_attribute_t *cgiSetIPPObjectVars(ipp_attribute_t *obj,
|
||||
const char *prefix, int element);
|
||||
extern int cgiSetIPPVars(ipp_t *response, const char *filter_name,
|
||||
const char *filter_value,
|
||||
const char *prefix, int parent_el);
|
||||
extern void cgiSetServerVersion(void);
|
||||
extern void cgiSetSize(const char *name, int size);
|
||||
extern void cgiSetVariable(const char *name, const char *value);
|
||||
extern void cgiShowIPPError(const char *message);
|
||||
extern void cgiShowJobs(http_t *http, const char *dest);
|
||||
extern void cgiStartHTML(const char *title);
|
||||
extern void cgiStartMultipart(void);
|
||||
extern const char *cgiText(const char *message);
|
||||
|
||||
#endif /* !_CUPS_CGI_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+332
-404
@@ -3,190 +3,163 @@
|
||||
*
|
||||
* Class status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
* do_class_op() - Do a class operation.
|
||||
* show_all_classes() - Show all classes...
|
||||
* show_class() - Show a single class.
|
||||
* main() - Main entry for CGI.
|
||||
* show_class_list() - Show a list of classes...
|
||||
* show_class_info() - Show class information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static 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);
|
||||
static void show_class_list(http_t *http, cups_lang_t *language);
|
||||
static void show_class_info(http_t *http, cups_lang_t *language,
|
||||
char *name);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
const char *pclass; /* Class name */
|
||||
const char *user; /* Username */
|
||||
http_t *http; /* Connection to the server */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
const char *op; /* Operation to perform, if any */
|
||||
static const char *def_attrs[] = /* Attributes for default printer */
|
||||
{
|
||||
"printer-name",
|
||||
"printer-uri-supported"
|
||||
};
|
||||
cups_lang_t *language; /* Language information */
|
||||
char *name; /* Class name */
|
||||
http_t *http; /* Connection to the server */
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
* Get the request language...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
op = cgiGetVariable("OP");
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
cgiSetVariable("SECTION", "classes");
|
||||
|
||||
/*
|
||||
* See if we are displaying a printer or all classes...
|
||||
*/
|
||||
|
||||
if ((pclass = getenv("PATH_INFO")) != NULL)
|
||||
{
|
||||
pclass ++;
|
||||
|
||||
if (!*pclass)
|
||||
pclass = NULL;
|
||||
|
||||
if (pclass)
|
||||
cgiSetVariable("PRINTER_NAME", pclass);
|
||||
}
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
user = getenv("REMOTE_USER");
|
||||
language = cupsLangDefault();
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
http = httpConnect("localhost", ippPort());
|
||||
|
||||
/*
|
||||
* Get the default printer...
|
||||
* Tell the client to expect HTML...
|
||||
*/
|
||||
|
||||
if (!op || !cgiIsPOST())
|
||||
{
|
||||
/*
|
||||
* Get the default destination...
|
||||
*/
|
||||
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEFAULT);
|
||||
/*
|
||||
* See if we need to show a list of classes or the status of a
|
||||
* single class...
|
||||
*/
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
|
||||
name = argv[0];
|
||||
if (strcmp(name, "/") == 0 || strcmp(name, "classes.cgi") == 0)
|
||||
name = NULL;
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
|
||||
/*
|
||||
* Print the standard header...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
char url[HTTP_MAX_URI]; /* New URL */
|
||||
|
||||
|
||||
cgiSetVariable("DEFAULT_URI",
|
||||
cgiRewriteURL(attr->values[0].string.text,
|
||||
url, sizeof(url), NULL));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we need to show a list of classes or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
if (!pclass)
|
||||
show_all_classes(http, user);
|
||||
else
|
||||
show_class(http, pclass);
|
||||
}
|
||||
else if (pclass)
|
||||
{
|
||||
if (!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();
|
||||
}
|
||||
}
|
||||
puts("<HTML>");
|
||||
puts("<HEAD>");
|
||||
if (name)
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10\">");
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Unknown/bad operation...
|
||||
*/
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">");
|
||||
printf("<TITLE>%s on %s - Common UNIX Printing System</TITLE>\n",
|
||||
name == NULL ? "Classes" : name, getenv("SERVER_NAME"));
|
||||
puts("<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"/cups.css\">");
|
||||
puts("<MAP NAME=\"navbar\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,85,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
|
||||
puts("</MAP>");
|
||||
puts("</HEAD>");
|
||||
puts("<BODY>");
|
||||
puts("<P ALIGN=CENTER>");
|
||||
puts("<A HREF=\"http://www.easysw.com\" ALT=\"Easy Software Products Home Page\">");
|
||||
puts("<IMG SRC=\"/images/logo.gif\" WIDTH=\"71\" HEIGHT=\"40\" BORDER=0 ALT=\"Easy Software Products Home Page\"></A>");
|
||||
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"540\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
|
||||
|
||||
cgiStartHTML(cgiText(_("Classes")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
printf("<H1>%s on %s</H1>\n", name == NULL ? "Classes" : name,
|
||||
getenv("SERVER_NAME"));
|
||||
fflush(stdout);
|
||||
|
||||
puts("<CENTER>");
|
||||
puts("<TABLE WIDTH=\"90%\" BORDER=\"1\">");
|
||||
puts("<TR>");
|
||||
puts("<TH>Name</TH>");
|
||||
puts("<TH WIDTH=\"50%\">Status</TH>");
|
||||
puts("<TH WIDTH=\"25%\">Jobs</TH>");
|
||||
puts("</TR>");
|
||||
|
||||
/*
|
||||
* Show the information...
|
||||
*/
|
||||
|
||||
if (name == NULL)
|
||||
show_class_list(http, language);
|
||||
else
|
||||
show_class_info(http, language, name);
|
||||
|
||||
/*
|
||||
* Write a standard trailer...
|
||||
*/
|
||||
|
||||
puts("</TABLE>");
|
||||
puts("</CENTER>");
|
||||
|
||||
puts("<HR>");
|
||||
|
||||
puts("<P>The Common UNIX Printing System, CUPS, and the CUPS logo are the");
|
||||
puts("trademark property of <A HREF=\"http://www.easysw.com\">Easy Software");
|
||||
puts("Products</A>. CUPS is copyright 1997-1999 by Easy Software Products,");
|
||||
puts("All Rights Reserved.");
|
||||
|
||||
puts("</BODY>");
|
||||
puts("</HTML>");
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
cupsLangFree(language);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
@@ -197,344 +170,299 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* 'do_class_op()' - Do a class operation.
|
||||
* 'show_class_list()' - Show a list of classes...
|
||||
*/
|
||||
|
||||
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 */
|
||||
show_class_list(http_t *http, /* I - HTTP connection */
|
||||
cups_lang_t *language)/* I - Client's language */
|
||||
{
|
||||
ipp_t *request; /* IPP request */
|
||||
char uri[HTTP_MAX_URI], /* Printer URI */
|
||||
resource[HTTP_MAX_URI]; /* Path for request */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
show_all_classes(http_t *http, /* I - Connection to server */
|
||||
const char *user) /* I - Username */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
cups_array_t *classes; /* Array of class objects */
|
||||
ipp_attribute_t *pclass; /* Class object */
|
||||
int ascending, /* Order of classes (0 = descending) */
|
||||
first, /* First class to show */
|
||||
count; /* Number of classes */
|
||||
const char *var; /* Form variable */
|
||||
void *search; /* Search data */
|
||||
char val[1024]; /* Form variable */
|
||||
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Classes")));
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_CLASSES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* requesting-user-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_CLASSES);
|
||||
request = ippNew();
|
||||
|
||||
if (user)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
request->request.op.operation_id = CUPS_GET_CLASSES;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
cgiGetAttributes(request, "classes.tmpl");
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
if ((response = cupsDoRequest(http, request, "/classes/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get a list of matching job objects.
|
||||
* Loop through the classes returned in the list and display
|
||||
* their devices...
|
||||
*/
|
||||
|
||||
if ((var = cgiGetVariable("QUERY")) != NULL &&
|
||||
!cgiGetVariable("CLEAR"))
|
||||
search = cgiCompileSearch(var);
|
||||
else
|
||||
search = NULL;
|
||||
|
||||
classes = cgiGetIPPObjects(response, search);
|
||||
count = cupsArrayCount(classes);
|
||||
|
||||
if (search)
|
||||
cgiFreeSearch(search);
|
||||
|
||||
/*
|
||||
* Figure out which classes to display...
|
||||
*/
|
||||
|
||||
if ((var = cgiGetVariable("FIRST")) != NULL)
|
||||
first = atoi(var);
|
||||
else
|
||||
first = 0;
|
||||
|
||||
if (first >= count)
|
||||
first = count - CUPS_PAGE_MAX;
|
||||
|
||||
first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX;
|
||||
|
||||
if (first < 0)
|
||||
first = 0;
|
||||
|
||||
sprintf(val, "%d", count);
|
||||
cgiSetVariable("TOTAL", val);
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
ascending = !strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = 1;
|
||||
|
||||
if (ascending)
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, first);
|
||||
i < CUPS_PAGE_MAX && pclass;
|
||||
i ++, pclass = (ipp_attribute_t *)cupsArrayNext(classes))
|
||||
cgiSetIPPObjectVars(pclass, NULL, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, count - first - 1);
|
||||
i < CUPS_PAGE_MAX && pclass;
|
||||
i ++, pclass = (ipp_attribute_t *)cupsArrayPrev(classes))
|
||||
cgiSetIPPObjectVars(pclass, NULL, i);
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Show the class status for each class...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
|
||||
{
|
||||
if (strcmp(attr->name, "printer-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
show_class_info(http, language, attr->values[0].string.text);
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save navigation URLs...
|
||||
*/
|
||||
|
||||
cgiSetVariable("THISURL", "/classes/");
|
||||
|
||||
if (first > 0)
|
||||
{
|
||||
sprintf(val, "%d", first - CUPS_PAGE_MAX);
|
||||
cgiSetVariable("PREV", val);
|
||||
}
|
||||
|
||||
if ((first + CUPS_PAGE_MAX) < count)
|
||||
{
|
||||
sprintf(val, "%d", first + CUPS_PAGE_MAX);
|
||||
cgiSetVariable("NEXT", val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Then show everything...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("search.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("classes-header.tmpl");
|
||||
|
||||
if (count > CUPS_PAGE_MAX)
|
||||
cgiCopyTemplateLang("pager.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("classes.tmpl");
|
||||
|
||||
if (count > CUPS_PAGE_MAX)
|
||||
cgiCopyTemplateLang("pager.tmpl");
|
||||
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
cupsArrayDelete(classes);
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show the error...
|
||||
*/
|
||||
|
||||
cgiShowIPPError(_("Unable to get class list:"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_class()' - Show a single class.
|
||||
* 'show_class_info()' - Show class information.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_class(http_t *http, /* I - Connection to server */
|
||||
const char *pclass) /* I - Name of class */
|
||||
show_class_info(http_t *http,
|
||||
cups_lang_t *language,
|
||||
char *name)
|
||||
{
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
char refresh[1024]; /* Refresh URL */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response, /* IPP response */
|
||||
*jobs; /* IPP Get Jobs response */
|
||||
int jobcount; /* Number of jobs */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char *message; /* Printer state message */
|
||||
int accepting; /* Accepting requests? */
|
||||
ipp_pstate_t pstate; /* Printer state */
|
||||
char uri[HTTP_MAX_URI];/* Printer URI */
|
||||
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* Build a IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* class-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
request = ippNew();
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/classes/%s", pclass);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
|
||||
uri);
|
||||
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
cgiGetAttributes(request, "class.tmpl");
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
sprintf(uri, "ipp://localhost/classes/%s", name);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "class-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
if ((response = cupsDoRequest(http, request, uri + 15)) == NULL)
|
||||
{
|
||||
puts("<P>Unable to communicate with CUPS server!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (response->request.status.status_code == IPP_NOT_FOUND)
|
||||
{
|
||||
puts("<P>Class does not exist.");
|
||||
ippDelete(response);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab the needed class attributes...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "class-state", IPP_TAG_ENUM)) != NULL)
|
||||
pstate = (ipp_pstate_t)attr->values[0].integer;
|
||||
else
|
||||
pstate = IPP_PRINTER_IDLE;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "class-state-message", IPP_TAG_TEXT)) != NULL)
|
||||
message = attr->values[0].string.text;
|
||||
else
|
||||
message = NULL;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "class-is-accepting-jobs",
|
||||
IPP_TAG_BOOLEAN)) != NULL)
|
||||
accepting = attr->values[0].boolean;
|
||||
else
|
||||
accepting = 1;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri", IPP_TAG_URI)) != NULL)
|
||||
strcpy(uri, attr->values[0].string.text);
|
||||
|
||||
/*
|
||||
* Display the class entry...
|
||||
*/
|
||||
|
||||
puts("<TR>");
|
||||
|
||||
printf("<TD VALIGN=TOP><A HREF=\"/classes/%s\">%s</A></TD>\n", name, name);
|
||||
|
||||
puts("<TD VALIGN=TOP><IMG SRC=\"/images/classes.gif\" ALIGN=\"LEFT\">");
|
||||
|
||||
printf("%s: %s, %s<BR>\n",
|
||||
cupsLangString(language, CUPS_MSG_PRINTER_STATE),
|
||||
cupsLangString(language, pstate == IPP_PRINTER_IDLE ? CUPS_MSG_IDLE :
|
||||
pstate == IPP_PRINTER_PROCESSING ?
|
||||
CUPS_MSG_PROCESSING : CUPS_MSG_STOPPED),
|
||||
cupsLangString(language, accepting ? CUPS_MSG_ACCEPTING_JOBS :
|
||||
CUPS_MSG_NOT_ACCEPTING_JOBS));
|
||||
|
||||
if (message)
|
||||
printf("<BR CLEAR=ALL><I>\"%s\"</I>\n", message);
|
||||
else if (!accepting || pstate == IPP_PRINTER_STOPPED)
|
||||
puts("<BR CLEAR=ALL><I>\"Reason Unknown\"</I>");
|
||||
|
||||
puts("</TD>");
|
||||
|
||||
/*
|
||||
* Show a list of jobs as needed...
|
||||
*/
|
||||
|
||||
if (pstate != IPP_PRINTER_IDLE)
|
||||
{
|
||||
/*
|
||||
* Got the result; set the CGI variables and check the status of a
|
||||
* single-queue request...
|
||||
* Build an IPP_GET_JOBS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* class-uri
|
||||
*/
|
||||
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
request = ippNew();
|
||||
|
||||
if (pclass && (attr = ippFindAttribute(response, "printer-state",
|
||||
IPP_TAG_ENUM)) != NULL &&
|
||||
attr->values[0].integer == IPP_PRINTER_PROCESSING)
|
||||
{
|
||||
/*
|
||||
* Class is processing - automatically refresh the page until we
|
||||
* are done printing...
|
||||
*/
|
||||
request->request.op.operation_id = IPP_GET_JOBS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
cgiFormEncode(uri, pclass, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "10;URL=/classes/%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL,
|
||||
cupsLangEncoding(language));
|
||||
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL,
|
||||
language->language);
|
||||
|
||||
ippDelete(response);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"class-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(pclass);
|
||||
|
||||
/*
|
||||
* Show the class status...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("class.tmpl");
|
||||
|
||||
/*
|
||||
* Show jobs for the specified class...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("class-jobs-header.tmpl");
|
||||
cgiShowJobs(http, pclass);
|
||||
jobs = cupsDoRequest(http, request, uri + 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show the IPP error...
|
||||
*/
|
||||
jobs = NULL;
|
||||
|
||||
cgiStartHTML(pclass);
|
||||
cgiShowIPPError(_("Unable to get class status:"));
|
||||
puts("<TD VALIGN=\"TOP\">");
|
||||
jobcount = 0;
|
||||
|
||||
if (jobs != NULL)
|
||||
{
|
||||
char *username; /* Pointer to job-originating-user-name */
|
||||
int jobid, /* job-id */
|
||||
size; /* job-k-octets */
|
||||
|
||||
|
||||
for (attr = jobs->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Pull the needed attributes from this job...
|
||||
*/
|
||||
|
||||
jobid = 0;
|
||||
size = 0;
|
||||
username = NULL;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
|
||||
{
|
||||
if (strcmp(attr->name, "job-id") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-k-octets") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
size = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
username = attr->values[0].string.text;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the job if it matches the current class...
|
||||
*/
|
||||
|
||||
if (username != NULL)
|
||||
{
|
||||
jobcount ++;
|
||||
printf("<A HREF=\"/jobs/%d\">%s-%d %s %dk</A><BR>\n", jobid, name,
|
||||
jobid, username, size);
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(jobs);
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
if (jobcount == 0)
|
||||
puts("None");
|
||||
puts("</TD>");
|
||||
puts("</TR>");
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Online help index definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 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/".
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_HELP_INDEX_H_
|
||||
# define _CUPS_HELP_INDEX_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <cups/array.h>
|
||||
|
||||
|
||||
/*
|
||||
* Data structures...
|
||||
*/
|
||||
|
||||
typedef struct help_word_s /**** Help word structure... ****/
|
||||
{
|
||||
int count; /* Number of occurrences */
|
||||
char *text; /* Word text */
|
||||
} help_word_t;
|
||||
|
||||
typedef struct help_node_s /**** Help node structure... ****/
|
||||
{
|
||||
char *filename; /* Filename, relative to help dir */
|
||||
char *section; /* Section name (NULL if none) */
|
||||
char *anchor; /* Anchor name (NULL if none) */
|
||||
char *text; /* Text in anchor */
|
||||
cups_array_t *words; /* Words after this node */
|
||||
time_t mtime; /* Last modification time */
|
||||
off_t offset; /* Offset in file */
|
||||
size_t length; /* Length in bytes */
|
||||
int score; /* Search score */
|
||||
} help_node_t;
|
||||
|
||||
typedef struct help_index_s /**** Help index structure ****/
|
||||
{
|
||||
int search; /* 1 = search index, 0 = normal */
|
||||
cups_array_t *nodes; /* Nodes sorted by filename */
|
||||
cups_array_t *sorted; /* Nodes sorted by score + text */
|
||||
} help_index_t;
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern void helpDeleteIndex(help_index_t *hi);
|
||||
extern help_node_t *helpFindNode(help_index_t *hi, const char *filename,
|
||||
const char *anchor);
|
||||
extern help_index_t *helpLoadIndex(const char *hifile, const char *directory);
|
||||
extern int helpSaveIndex(help_index_t *hi, const char *hifile);
|
||||
extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query,
|
||||
const char *section,
|
||||
const char *filename);
|
||||
|
||||
|
||||
#endif /* !_CUPS_HELP_INDEX_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,385 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Online help CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
help_index_t *hi, /* Help index */
|
||||
*si; /* Search index */
|
||||
help_node_t *n; /* Current help node */
|
||||
int i; /* Looping var */
|
||||
const char *query; /* Search query */
|
||||
const char *cache_dir; /* CUPS_CACHEDIR environment variable */
|
||||
const char *docroot; /* CUPS_DOCROOT environment variable */
|
||||
const char *helpfile; /* Current help file */
|
||||
const char *topic; /* Current topic */
|
||||
char topic_data[1024]; /* Topic form data */
|
||||
const char *section; /* Current section */
|
||||
char filename[1024], /* Filename */
|
||||
directory[1024]; /* Directory */
|
||||
cups_file_t *fp; /* Help file */
|
||||
char line[1024]; /* Line from file */
|
||||
int printable; /* Show printable version? */
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
printable = cgiGetVariable("PRINTABLE") != NULL;
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
cgiSetVariable("SECTION", "help");
|
||||
|
||||
/*
|
||||
* Load the help index...
|
||||
*/
|
||||
|
||||
if ((cache_dir = getenv("CUPS_CACHEDIR")) == NULL)
|
||||
cache_dir = CUPS_CACHEDIR;
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/help.index", cache_dir);
|
||||
|
||||
if ((docroot = getenv("CUPS_DOCROOT")) == NULL)
|
||||
docroot = CUPS_DOCROOT;
|
||||
|
||||
snprintf(directory, sizeof(directory), "%s/help", docroot);
|
||||
|
||||
fprintf(stderr, "DEBUG: helpLoadIndex(filename=\"%s\", directory=\"%s\")\n",
|
||||
filename, directory);
|
||||
|
||||
hi = helpLoadIndex(filename, directory);
|
||||
if (!hi)
|
||||
{
|
||||
perror(filename);
|
||||
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
cgiSetVariable("ERROR", "Unable to load help index!");
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: %d nodes in help index...\n",
|
||||
cupsArrayCount(hi->nodes));
|
||||
|
||||
/*
|
||||
* See if we are viewing a file...
|
||||
*/
|
||||
|
||||
for (i = 0; i < argc; i ++)
|
||||
fprintf(stderr, "argv[%d]=\"%s\"\n", i, argv[i]);
|
||||
|
||||
if ((helpfile = getenv("PATH_INFO")) != NULL)
|
||||
{
|
||||
helpfile ++;
|
||||
|
||||
if (!*helpfile)
|
||||
helpfile = NULL;
|
||||
}
|
||||
|
||||
if (helpfile)
|
||||
{
|
||||
/*
|
||||
* Verify that the help file exists and is part of the index...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/help/%s", docroot, helpfile);
|
||||
|
||||
fprintf(stderr, "DEBUG: helpfile=\"%s\", filename=\"%s\"\n",
|
||||
helpfile, filename);
|
||||
|
||||
if (access(filename, R_OK))
|
||||
{
|
||||
perror(filename);
|
||||
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
cgiSetVariable("ERROR", "Unable to access help file!");
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
cgiSetVariable("ERROR", "Help file not in index!");
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the page title and save the help file...
|
||||
*/
|
||||
|
||||
cgiSetVariable("HELPFILE", helpfile);
|
||||
cgiSetVariable("HELPTITLE", n->text);
|
||||
cgiSetVariable("TOPIC", n->section);
|
||||
|
||||
/*
|
||||
* Send a standard page header...
|
||||
*/
|
||||
|
||||
if (printable)
|
||||
puts("Content-Type: text/html;charset=utf-8\n");
|
||||
else
|
||||
cgiStartHTML(n->text);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Send a standard page header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Online Help")));
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a search as needed...
|
||||
*/
|
||||
|
||||
if (cgiGetVariable("CLEAR"))
|
||||
cgiSetVariable("QUERY", "");
|
||||
|
||||
query = cgiGetVariable("QUERY");
|
||||
topic = cgiGetVariable("TOPIC");
|
||||
si = helpSearchIndex(hi, query, topic, helpfile);
|
||||
|
||||
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
|
||||
query ? query : "(null)", topic ? topic : "(null)");
|
||||
|
||||
if (si)
|
||||
{
|
||||
help_node_t *nn; /* Parent node */
|
||||
|
||||
|
||||
fprintf(stderr,
|
||||
"DEBUG: si=%p, si->sorted=%p, cupsArrayCount(si->sorted)=%d\n", si,
|
||||
si->sorted, cupsArrayCount(si->sorted));
|
||||
|
||||
for (i = 0, n = (help_node_t *)cupsArrayFirst(si->sorted);
|
||||
n;
|
||||
i ++, n = (help_node_t *)cupsArrayNext(si->sorted))
|
||||
{
|
||||
if (helpfile && n->anchor)
|
||||
snprintf(line, sizeof(line), "#%s", n->anchor);
|
||||
else if (n->anchor)
|
||||
snprintf(line, sizeof(line), "/help/%s?QUERY=%s#%s", n->filename,
|
||||
query ? query : "", n->anchor);
|
||||
else
|
||||
snprintf(line, sizeof(line), "/help/%s?QUERY=%s", n->filename,
|
||||
query ? query : "");
|
||||
|
||||
cgiSetArray("QTEXT", i, n->text);
|
||||
cgiSetArray("QLINK", i, line);
|
||||
|
||||
if (!helpfile && n->anchor)
|
||||
{
|
||||
nn = helpFindNode(hi, n->filename, NULL);
|
||||
|
||||
snprintf(line, sizeof(line), "/help/%s?QUERY=%s", nn->filename,
|
||||
query ? query : "");
|
||||
|
||||
cgiSetArray("QPTEXT", i, nn->text);
|
||||
cgiSetArray("QPLINK", i, line);
|
||||
}
|
||||
else
|
||||
{
|
||||
cgiSetArray("QPTEXT", i, "");
|
||||
cgiSetArray("QPLINK", i, "");
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: [%d] = \"%s\" @ \"%s\"\n", i, n->text, line);
|
||||
}
|
||||
|
||||
helpDeleteIndex(si);
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, now list the bookmarks within the index...
|
||||
*/
|
||||
|
||||
for (i = 0, section = NULL, n = (help_node_t *)cupsArrayFirst(hi->sorted);
|
||||
n;
|
||||
n = (help_node_t *)cupsArrayNext(hi->sorted))
|
||||
{
|
||||
if (n->anchor)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Add a section link as needed...
|
||||
*/
|
||||
|
||||
if (n->section &&
|
||||
(!section || strcmp(n->section, section)))
|
||||
{
|
||||
/*
|
||||
* Add a link for this node...
|
||||
*/
|
||||
|
||||
snprintf(line, sizeof(line), "/help/?TOPIC=%s&QUERY=%s",
|
||||
cgiFormEncode(topic_data, n->section, sizeof(topic_data)),
|
||||
query ? query : "");
|
||||
cgiSetArray("BMLINK", i, line);
|
||||
cgiSetArray("BMTEXT", i, n->section);
|
||||
cgiSetArray("BMINDENT", i, "0");
|
||||
|
||||
i ++;
|
||||
section = n->section;
|
||||
}
|
||||
|
||||
if (!topic || strcmp(n->section, topic))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Add a link for this node...
|
||||
*/
|
||||
|
||||
snprintf(line, sizeof(line), "/help/%s?TOPIC=%s&QUERY=%s", n->filename,
|
||||
cgiFormEncode(topic_data, n->section, sizeof(topic_data)),
|
||||
query ? query : "");
|
||||
cgiSetArray("BMLINK", i, line);
|
||||
cgiSetArray("BMTEXT", i, n->text);
|
||||
cgiSetArray("BMINDENT", i, "1");
|
||||
|
||||
i ++;
|
||||
|
||||
if (helpfile && !strcmp(helpfile, n->filename))
|
||||
{
|
||||
help_node_t *nn; /* Pointer to sub-node */
|
||||
|
||||
|
||||
cupsArraySave(hi->sorted);
|
||||
|
||||
for (nn = (help_node_t *)cupsArrayFirst(hi->sorted);
|
||||
nn;
|
||||
nn = (help_node_t *)cupsArrayNext(hi->sorted))
|
||||
if (nn->anchor && !strcmp(helpfile, nn->filename))
|
||||
{
|
||||
/*
|
||||
* Add a link for this node...
|
||||
*/
|
||||
|
||||
snprintf(line, sizeof(line), "#%s", nn->anchor);
|
||||
cgiSetArray("BMLINK", i, line);
|
||||
cgiSetArray("BMTEXT", i, nn->text);
|
||||
cgiSetArray("BMINDENT", i, "2");
|
||||
|
||||
i ++;
|
||||
}
|
||||
|
||||
cupsArrayRestore(hi->sorted);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Show the search and bookmark content...
|
||||
*/
|
||||
|
||||
if (!helpfile || !printable)
|
||||
cgiCopyTemplateLang("help-header.tmpl");
|
||||
else
|
||||
cgiCopyTemplateLang("help-printable.tmpl");
|
||||
|
||||
/*
|
||||
* If we are viewing a file, copy it in now...
|
||||
*/
|
||||
|
||||
if (helpfile)
|
||||
{
|
||||
if ((fp = cupsFileOpen(filename, "r")) != NULL)
|
||||
{
|
||||
int inbody; /* Are we inside the body? */
|
||||
|
||||
|
||||
inbody = 0;
|
||||
|
||||
while (cupsFileGets(fp, line, sizeof(line)))
|
||||
{
|
||||
if (inbody)
|
||||
{
|
||||
if (!strncasecmp(line, "</BODY>", 7))
|
||||
break;
|
||||
|
||||
printf("%s\n", line);
|
||||
}
|
||||
else if (!strncasecmp(line, "<BODY", 5))
|
||||
inbody = 1;
|
||||
}
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
perror(filename);
|
||||
cgiSetVariable("ERROR", "Unable to open help file.");
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a standard trailer...
|
||||
*/
|
||||
|
||||
if (!printable)
|
||||
{
|
||||
cgiCopyTemplateLang("help-trailer.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
else
|
||||
puts("</BODY>\n</HTML>");
|
||||
|
||||
/*
|
||||
* Delete the index...
|
||||
*/
|
||||
|
||||
helpDeleteIndex(hi);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTML support functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 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/".
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static const char *cgi_multipart = NULL;
|
||||
/* Multipart separator, if any */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static const char *cgi_null_passwd(const char *prompt);
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiEndHTML()' - End a HTML page.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiEndHTML(void)
|
||||
{
|
||||
/*
|
||||
* Send the standard trailer...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("trailer.tmpl");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiEndMultipart()' - End the delivery of a multipart web page.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiEndMultipart(void)
|
||||
{
|
||||
if (cgi_multipart)
|
||||
printf("\n%s--\n", cgi_multipart);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiFormEncode()' - Encode a string as a form variable...
|
||||
*/
|
||||
|
||||
char * /* O - Destination string */
|
||||
cgiFormEncode(char *dst, /* I - Destination string */
|
||||
const char *src, /* I - Source string */
|
||||
size_t dstsize) /* I - Size of destination string */
|
||||
{
|
||||
char *dstptr, /* Pointer into destination */
|
||||
*dstend; /* End of destination */
|
||||
static const char *hex = /* Hexadecimal characters */
|
||||
"0123456789ABCDEF";
|
||||
|
||||
|
||||
/*
|
||||
* Mark the end of the string...
|
||||
*/
|
||||
|
||||
dstend = dst + dstsize - 1;
|
||||
|
||||
/*
|
||||
* Loop through the source string and copy...
|
||||
*/
|
||||
|
||||
for (dstptr = dst; *src && dstptr < dstend;)
|
||||
{
|
||||
switch (*src)
|
||||
{
|
||||
case ' ' :
|
||||
/*
|
||||
* Encode spaces with a "+"...
|
||||
*/
|
||||
|
||||
*dstptr++ = '+';
|
||||
src ++;
|
||||
break;
|
||||
|
||||
case '&' :
|
||||
case '%' :
|
||||
case '+' :
|
||||
/*
|
||||
* Encode special characters with %XX escape...
|
||||
*/
|
||||
|
||||
if (dstptr < (dstend - 2))
|
||||
{
|
||||
*dstptr++ = '%';
|
||||
*dstptr++ = hex[(*src & 255) >> 4];
|
||||
*dstptr++ = hex[*src & 15];
|
||||
src ++;
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
/*
|
||||
* Copy other characters literally...
|
||||
*/
|
||||
|
||||
*dstptr++ = *src++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Nul-terminate the destination string...
|
||||
*/
|
||||
|
||||
*dstptr = '\0';
|
||||
|
||||
/*
|
||||
* Return the encoded string...
|
||||
*/
|
||||
|
||||
return (dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiStartHTML()' - Start a HTML page.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiStartHTML(const char *title) /* I - Title of page */
|
||||
{
|
||||
/*
|
||||
* Disable any further authentication attempts...
|
||||
*/
|
||||
|
||||
cupsSetPasswordCB(cgi_null_passwd);
|
||||
|
||||
/*
|
||||
* Tell the client to expect UTF-8 encoded HTML...
|
||||
*/
|
||||
|
||||
if (cgi_multipart)
|
||||
puts(cgi_multipart);
|
||||
|
||||
puts("Content-Type: text/html;charset=utf-8\n");
|
||||
|
||||
/*
|
||||
* Send a standard header...
|
||||
*/
|
||||
|
||||
cgiSetVariable("TITLE", title);
|
||||
cgiSetServerVersion();
|
||||
|
||||
cgiCopyTemplateLang("header.tmpl");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiStartMultipart()' - Start a multipart delivery of a web page...
|
||||
*/
|
||||
|
||||
void
|
||||
cgiStartMultipart(void)
|
||||
{
|
||||
puts("MIME-Version: 1.0");
|
||||
puts("Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
|
||||
cgi_multipart = "--CUPS-MULTIPART";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_null_passwd()' - Return a NULL password for authentication.
|
||||
*/
|
||||
|
||||
static const char * /* O - NULL */
|
||||
cgi_null_passwd(const char *prompt) /* I - Prompt string (unused) */
|
||||
{
|
||||
(void)prompt;
|
||||
|
||||
fprintf(stderr, "DEBUG: cgi_null_passwd(prompt=\"%s\") called!\n",
|
||||
prompt ? prompt : "(null)");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1534
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+471
-107
@@ -3,123 +3,152 @@
|
||||
*
|
||||
* Job status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
* do_job_op() - Do a job operation.
|
||||
* main() - Main entry for CGI.
|
||||
* show_job_list() - Show a list of jobs...
|
||||
* show_job_info() - Show job information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void do_job_op(http_t *http, int job_id, ipp_op_t op);
|
||||
static void show_job_list(http_t *http, cups_lang_t *language);
|
||||
static void show_job_info(http_t *http, cups_lang_t *language,
|
||||
char *name);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
http_t *http; /* Connection to the server */
|
||||
const char *op; /* Operation name */
|
||||
const char *job_id_var; /* Job ID form variable */
|
||||
int job_id; /* Job ID */
|
||||
cups_lang_t *language; /* Language information */
|
||||
char *job; /* Job name */
|
||||
http_t *http; /* Connection to the server */
|
||||
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
* Get the request language...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
cgiSetVariable("SECTION", "jobs");
|
||||
language = cupsLangDefault();
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
http = httpConnect("localhost", ippPort());
|
||||
|
||||
/*
|
||||
* Get the job ID, if any...
|
||||
* Tell the client to expect HTML...
|
||||
*/
|
||||
|
||||
if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL)
|
||||
job_id = atoi(job_id_var);
|
||||
else
|
||||
job_id = 0;
|
||||
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
|
||||
|
||||
/*
|
||||
* Do the operation...
|
||||
* See if we need to show a list of jobs or the status of a
|
||||
* single job...
|
||||
*/
|
||||
|
||||
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0 && cgiIsPOST())
|
||||
{
|
||||
/*
|
||||
* Do the operation...
|
||||
*/
|
||||
job = argv[0];
|
||||
if (strcmp(job, "/") == 0 || strcmp(job, "jobs.cgi") == 0)
|
||||
job = NULL;
|
||||
|
||||
if (!strcmp(op, "cancel-job"))
|
||||
do_job_op(http, job_id, IPP_CANCEL_JOB);
|
||||
else if (!strcmp(op, "hold-job"))
|
||||
do_job_op(http, job_id, IPP_HOLD_JOB);
|
||||
else if (!strcmp(op, "move-job"))
|
||||
cgiMoveJobs(http, NULL, job_id);
|
||||
else if (!strcmp(op, "release-job"))
|
||||
do_job_op(http, job_id, IPP_RELEASE_JOB);
|
||||
else if (!strcmp(op, "restart-job"))
|
||||
do_job_op(http, job_id, IPP_RESTART_JOB);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Bad operation code... Display an error...
|
||||
*/
|
||||
/*
|
||||
* Print the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
}
|
||||
puts("<HTML>");
|
||||
puts("<HEAD>");
|
||||
if (job)
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10\">");
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show a list of jobs...
|
||||
*/
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">");
|
||||
printf("<TITLE>%s on %s - Common UNIX Printing System</TITLE>\n",
|
||||
job == NULL ? "Jobs" : job, getenv("SERVER_NAME"));
|
||||
puts("<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"/cups.css\">");
|
||||
puts("<MAP NAME=\"navbar\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,85,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
|
||||
puts("</MAP>");
|
||||
puts("</HEAD>");
|
||||
puts("<BODY>");
|
||||
puts("<P ALIGN=CENTER>");
|
||||
puts("<A HREF=\"http://www.easysw.com\" ALT=\"Easy Software Products Home Page\">");
|
||||
puts("<IMG SRC=\"/images/logo.gif\" WIDTH=\"71\" HEIGHT=\"40\" BORDER=0 ALT=\"Easy Software Products Home Page\"></A>");
|
||||
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"540\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
cgiShowJobs(http, NULL);
|
||||
cgiEndHTML();
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
/*
|
||||
* Show the information...
|
||||
*/
|
||||
|
||||
if (job == NULL)
|
||||
show_job_list(http, language);
|
||||
else
|
||||
show_job_info(http, language, job);
|
||||
|
||||
/*
|
||||
* Write a standard trailer...
|
||||
*/
|
||||
|
||||
puts("<HR>");
|
||||
|
||||
puts("<P>The Common UNIX Printing System, CUPS, and the CUPS logo are the");
|
||||
puts("trademark property of <A HREF=\"http://www.easysw.com\">Easy Software");
|
||||
puts("Products</A>. CUPS is copyright 1997-1999 by Easy Software Products,");
|
||||
puts("All Rights Reserved.");
|
||||
|
||||
puts("</BODY>");
|
||||
puts("</HTML>");
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
cupsLangFree(language);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
@@ -130,81 +159,416 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* 'do_job_op()' - Do a job operation.
|
||||
* 'show_job_list()' - Show a list of jobs...
|
||||
*/
|
||||
|
||||
static void
|
||||
do_job_op(http_t *http, /* I - HTTP connection */
|
||||
int job_id, /* I - Job ID */
|
||||
ipp_op_t op) /* I - Operation to perform */
|
||||
show_job_list(http_t *http, /* I - HTTP connection */
|
||||
cups_lang_t *language) /* I - Client's language */
|
||||
{
|
||||
ipp_t *request; /* IPP request */
|
||||
char uri[HTTP_MAX_URI]; /* Job URI */
|
||||
const char *user; /* Username */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char *job_uri, /* job-uri */
|
||||
*printer_uri, /* job-printer-uri */
|
||||
*job_name, /* job-name */
|
||||
*job_user; /* job-originating-user-name */
|
||||
int job_id, /* job-id */
|
||||
job_priority, /* job-priority */
|
||||
job_k_octets, /* job-k-octets */
|
||||
copies; /* copies */
|
||||
ipp_jstate_t job_state; /* job-state */
|
||||
|
||||
|
||||
printf("<H1>Jobs on %s</H1>\n", getenv("SERVER_NAME"));
|
||||
|
||||
/*
|
||||
* Build a job request, which requires the following
|
||||
* Build an IPP_GET_JOBS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* job-uri or printer-uri (purge-jobs)
|
||||
* requesting-user-name
|
||||
* job-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(op);
|
||||
request = ippNew();
|
||||
|
||||
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
|
||||
request->request.op.operation_id = IPP_GET_JOBS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, uri);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
NULL, "ipp://localhost/jobs/");
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/jobs"));
|
||||
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT && getenv("HTTP_REFERER"))
|
||||
if ((response = cupsDoRequest(http, request, "/jobs/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Redirect successful updates back to the parent page...
|
||||
* Do a table for the jobs...
|
||||
*/
|
||||
|
||||
char url[1024]; /* Encoded URL */
|
||||
puts("<CENTER>");
|
||||
puts("<TABLE WIDTH=\"90%\" BORDER=\"1\">");
|
||||
puts("<TR>");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_PRINT_JOBS));
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_JOB_STATE));
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_JOB_NAME));
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_USER_NAME));
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_PRIORITY));
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_COPIES));
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_FILE_SIZE));
|
||||
puts("</TR>");
|
||||
|
||||
/*
|
||||
* Loop through the jobs returned in the list and display
|
||||
* their devices...
|
||||
*/
|
||||
|
||||
strcpy(url, "5;URL=");
|
||||
cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
|
||||
cgiSetVariable("refresh_page", url);
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Show the job status for each job...
|
||||
*/
|
||||
|
||||
job_uri = NULL;
|
||||
printer_uri = NULL;
|
||||
job_name = "unknown";
|
||||
job_user = "unknown";
|
||||
job_id = 0;
|
||||
job_priority = 50;
|
||||
job_k_octets = 0;
|
||||
copies = 1;
|
||||
job_state = IPP_JOB_PENDING;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
|
||||
{
|
||||
if (strcmp(attr->name, "job-uri") == 0 &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
job_uri = attr->values[0].string.text;
|
||||
|
||||
if (strcmp(attr->name, "job-printer-uri") == 0 &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
printer_uri = attr->values[0].string.text;
|
||||
|
||||
if (strcmp(attr->name, "job-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
job_name = attr->values[0].string.text;
|
||||
|
||||
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
job_user = attr->values[0].string.text;
|
||||
|
||||
if (strcmp(attr->name, "job-id") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
job_id = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-priority") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
job_priority = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-k-octets") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
job_k_octets = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "copies") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
copies = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-state") == 0 &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
job_state = (ipp_jstate_t)attr->values[0].integer;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have everything needed...
|
||||
*/
|
||||
|
||||
if (job_id && job_uri != NULL && printer_uri != NULL)
|
||||
{
|
||||
puts("<TR>");
|
||||
printf("<TD><A HREF=\"http://%s:%s/jobs/%d\">%s-%d</A></TD>\n",
|
||||
getenv("SERVER_NAME"), getenv("SERVER_PORT"), job_id,
|
||||
strrchr(printer_uri, '/') + 1, job_id);
|
||||
printf("<TD>%s</TD>\n", job_state == IPP_JOB_PROCESSING ?
|
||||
cupsLangString(language, CUPS_MSG_PROCESSING) :
|
||||
cupsLangString(language, CUPS_MSG_PENDING));
|
||||
printf("<TD>%s</TD>\n", job_name);
|
||||
printf("<TD>%s</TD>\n", job_user);
|
||||
printf("<TD>%d</TD>\n", job_priority);
|
||||
printf("<TD>%d</TD>\n", copies);
|
||||
printf("<TD>%dk</TD>\n", job_k_octets);
|
||||
puts("</TR>");
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
puts("</TABLE>");
|
||||
puts("</CENTER>");
|
||||
}
|
||||
else if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
else
|
||||
puts("<P>No jobs found.");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_job_info()' - Show job information.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_job_info(http_t *http, /* I - Server connection */
|
||||
cups_lang_t *language, /* I - Language */
|
||||
char *name) /* I - Job "name" */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char uri[HTTP_MAX_URI];/* Real URI */
|
||||
char *job_uri, /* job-uri */
|
||||
*printer_uri, /* job-printer-uri */
|
||||
*job_name, /* job-name */
|
||||
*job_user; /* job-originating-user-name */
|
||||
int job_id, /* job-id */
|
||||
job_priority, /* job-priority */
|
||||
job_k_octets; /* job-k-octets */
|
||||
ipp_jstate_t job_state; /* job-state */
|
||||
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_JOB_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* job-uri
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = IPP_GET_JOB_ATTRIBUTES;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
sprintf(uri, "ipp://localhost/jobs/%s", name);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, uri + 15)) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
puts("<P>Unable to communicate with CUPS server!");
|
||||
return;
|
||||
}
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
if (response->request.status.status_code == IPP_NOT_FOUND)
|
||||
{
|
||||
puts("<P>Job does not exist or has completed.");
|
||||
ippDelete(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Job operation failed:"));
|
||||
else if (op == IPP_CANCEL_JOB)
|
||||
cgiCopyTemplateLang("job-cancel.tmpl");
|
||||
else if (op == IPP_HOLD_JOB)
|
||||
cgiCopyTemplateLang("job-hold.tmpl");
|
||||
else if (op == IPP_RELEASE_JOB)
|
||||
cgiCopyTemplateLang("job-release.tmpl");
|
||||
else if (op == IPP_RESTART_JOB)
|
||||
cgiCopyTemplateLang("job-restart.tmpl");
|
||||
/*
|
||||
* Get the job status for this job...
|
||||
*/
|
||||
|
||||
cgiEndHTML();
|
||||
if ((attr = ippFindAttribute(response, "job-uri", IPP_TAG_URI)) != NULL)
|
||||
job_uri = attr->values[0].string.text;
|
||||
else
|
||||
{
|
||||
puts("<P>Missing job-uri attribute!");
|
||||
ippDelete(request);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-printer-uri", IPP_TAG_URI)) != NULL)
|
||||
printer_uri = attr->values[0].string.text;
|
||||
else
|
||||
{
|
||||
puts("<P>Missing job-printer-uri attribute!");
|
||||
ippDelete(request);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-name", IPP_TAG_NAME)) != NULL)
|
||||
job_name = attr->values[0].string.text;
|
||||
else
|
||||
job_name = "unknown";
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-originating-user-name",
|
||||
IPP_TAG_NAME)) != NULL)
|
||||
job_user = attr->values[0].string.text;
|
||||
else
|
||||
job_user = "unknown";
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) != NULL)
|
||||
job_id = attr->values[0].integer;
|
||||
else
|
||||
{
|
||||
puts("<P>Missing job-id attribute!");
|
||||
ippDelete(request);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-priority", IPP_TAG_INTEGER)) != NULL)
|
||||
job_priority = attr->values[0].integer;
|
||||
else
|
||||
job_priority = 50;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-k-octets", IPP_TAG_INTEGER)) != NULL)
|
||||
job_k_octets = attr->values[0].integer;
|
||||
else
|
||||
job_k_octets = 0;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM)) != NULL)
|
||||
job_state = (ipp_jstate_t)attr->values[0].integer;
|
||||
else
|
||||
job_state = IPP_JOB_PENDING;
|
||||
|
||||
/*
|
||||
* Do a table for the job...
|
||||
*/
|
||||
|
||||
printf("<H1><A HREF=\"http://%s:%s/printers/%s\">%s-%d</A></H1>\n",
|
||||
getenv("SERVER_NAME"), getenv("SERVER_PORT"),
|
||||
strrchr(printer_uri, '/') + 1, strrchr(printer_uri, '/') + 1, job_id);
|
||||
|
||||
puts("<CENTER>");
|
||||
puts("<TABLE WIDTH=\"90%\" BORDER=\"1\">");
|
||||
|
||||
puts("<TR>");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_JOB_STATE));
|
||||
printf("<TD>%s</TD>\n", job_state == IPP_JOB_PROCESSING ?
|
||||
cupsLangString(language, CUPS_MSG_PROCESSING) :
|
||||
cupsLangString(language, CUPS_MSG_PENDING));
|
||||
puts("</TR>");
|
||||
|
||||
puts("<TR>");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_JOB_NAME));
|
||||
printf("<TD>%s</TD>\n", job_name);
|
||||
puts("</TR>");
|
||||
|
||||
puts("<TR>");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_USER_NAME));
|
||||
printf("<TD>%s</TD>\n", job_user);
|
||||
puts("</TR>");
|
||||
|
||||
puts("<TR>");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_PRIORITY));
|
||||
printf("<TD>%d</TD>\n", job_priority);
|
||||
puts("</TR>");
|
||||
|
||||
puts("<TR>");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_FILE_SIZE));
|
||||
printf("<TD>%dk</TD>\n", job_k_octets);
|
||||
puts("</TR>");
|
||||
|
||||
puts("<TR VALIGN=\"TOP\">");
|
||||
printf("<TH>%s</TH>\n", cupsLangString(language, CUPS_MSG_OPTIONS));
|
||||
puts("<TD>");
|
||||
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
if (attr->group_tag != IPP_TAG_JOB &&
|
||||
attr->group_tag != IPP_TAG_EXTENSION)
|
||||
continue;
|
||||
|
||||
if (strcmp(attr->name, "job-uri") == 0 ||
|
||||
strcmp(attr->name, "job-printer-uri") == 0 ||
|
||||
strcmp(attr->name, "job-name") == 0 ||
|
||||
strcmp(attr->name, "job-originating-user-name") == 0 ||
|
||||
strcmp(attr->name, "job-id") == 0 ||
|
||||
strcmp(attr->name, "job-priority") == 0 ||
|
||||
strcmp(attr->name, "job-k-octets") == 0 ||
|
||||
strcmp(attr->name, "job-state") == 0)
|
||||
continue;
|
||||
|
||||
if (attr->value_tag != IPP_TAG_BOOLEAN)
|
||||
printf("%s=", attr->name);
|
||||
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
{
|
||||
if (i)
|
||||
putchar(',');
|
||||
|
||||
switch (attr->value_tag)
|
||||
{
|
||||
case IPP_TAG_INTEGER :
|
||||
case IPP_TAG_ENUM :
|
||||
printf("%d", attr->values[i].integer);
|
||||
break;
|
||||
|
||||
case IPP_TAG_BOOLEAN :
|
||||
if (!attr->values[i].boolean)
|
||||
printf("no");
|
||||
|
||||
case IPP_TAG_NOVALUE :
|
||||
fputs(attr->name, stdout);
|
||||
break;
|
||||
|
||||
case IPP_TAG_RANGE :
|
||||
printf("%d-%d", attr->values[i].range.lower,
|
||||
attr->values[i].range.upper);
|
||||
break;
|
||||
|
||||
case IPP_TAG_RESOLUTION :
|
||||
printf("%dx%d%s", attr->values[i].resolution.xres,
|
||||
attr->values[i].resolution.yres,
|
||||
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
|
||||
"dpi" : "dpc");
|
||||
break;
|
||||
|
||||
case IPP_TAG_STRING :
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_CHARSET :
|
||||
case IPP_TAG_LANGUAGE :
|
||||
case IPP_TAG_MIMETYPE :
|
||||
case IPP_TAG_URI :
|
||||
printf("\"%s\"", attr->values[i].string.text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
puts("<BR>");
|
||||
}
|
||||
|
||||
puts("</TD>");
|
||||
puts("</TR>");
|
||||
puts("</TABLE></CENTER>");
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
Arquivo binário não exibido.
+331
-421
@@ -3,199 +3,163 @@
|
||||
*
|
||||
* Printer status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-1999 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/".
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE.txt" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636-3111 USA
|
||||
*
|
||||
* Voice: (301) 373-9603
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
* do_printer_op() - Do a printer operation.
|
||||
* show_all_printers() - Show all printers...
|
||||
* show_printer() - Show a single printer.
|
||||
* show_printer_list() - Show a list of printers...
|
||||
* show_printer_info() - Show printer information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/language.h>
|
||||
#include <cups/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static 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);
|
||||
static void show_printer_list(http_t *http, cups_lang_t *language);
|
||||
static void show_printer_info(http_t *http, cups_lang_t *language,
|
||||
char *name);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
const char *printer; /* Printer name */
|
||||
const char *user; /* Username */
|
||||
http_t *http; /* Connection to the server */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
const char *op; /* Operation to perform, if any */
|
||||
static const char *def_attrs[] = /* Attributes for default printer */
|
||||
{
|
||||
"printer-name",
|
||||
"printer-uri-supported"
|
||||
};
|
||||
cups_lang_t *language; /* Language information */
|
||||
char *printer; /* Printer name */
|
||||
http_t *http; /* Connection to the server */
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
* Get the request language...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
op = cgiGetVariable("OP");
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
cgiSetVariable("SECTION", "printers");
|
||||
|
||||
/*
|
||||
* See if we are displaying a printer or all printers...
|
||||
*/
|
||||
|
||||
if ((printer = getenv("PATH_INFO")) != NULL)
|
||||
{
|
||||
printer ++;
|
||||
|
||||
if (!*printer)
|
||||
printer = NULL;
|
||||
|
||||
if (printer)
|
||||
cgiSetVariable("PRINTER_NAME", printer);
|
||||
}
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
user = getenv("REMOTE_USER");
|
||||
language = cupsLangDefault();
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
http = httpConnect("localhost", ippPort());
|
||||
|
||||
/*
|
||||
* Get the default printer...
|
||||
* Tell the client to expect HTML...
|
||||
*/
|
||||
|
||||
if (!op || !cgiIsPOST())
|
||||
{
|
||||
/*
|
||||
* Get the default destination...
|
||||
*/
|
||||
printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEFAULT);
|
||||
/*
|
||||
* See if we need to show a list of printers or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
|
||||
printer = argv[0];
|
||||
if (strcmp(printer, "/") == 0 || strcmp(printer, "printers.cgi") == 0)
|
||||
printer = NULL;
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
|
||||
/*
|
||||
* Print the standard header...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
char url[HTTP_MAX_URI]; /* New URL */
|
||||
|
||||
|
||||
cgiSetVariable("DEFAULT_URI",
|
||||
cgiRewriteURL(attr->values[0].string.text,
|
||||
url, sizeof(url), NULL));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we need to show a list of printers or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
if (!printer)
|
||||
show_all_printers(http, user);
|
||||
else
|
||||
show_printer(http, printer);
|
||||
}
|
||||
else if (printer)
|
||||
{
|
||||
if (!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();
|
||||
}
|
||||
}
|
||||
puts("<HTML>");
|
||||
puts("<HEAD>");
|
||||
if (printer)
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10\">");
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Unknown/bad operation...
|
||||
*/
|
||||
puts("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">");
|
||||
printf("<TITLE>%s on %s - Common UNIX Printing System</TITLE>\n",
|
||||
printer == NULL ? "Printers" : printer, getenv("SERVER_NAME"));
|
||||
puts("<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"/cups.css\">");
|
||||
puts("<MAP NAME=\"navbar\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"10,10,85,30\" HREF=\"/printers\" ALT=\"Current Printer Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"95,10,175,30\" HREF=\"/classes\" ALT=\"Current Printer Classes Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"185,10,235,30\" HREF=\"/jobs\" ALT=\"Current Jobs Status\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"245,10,395,30\" HREF=\"/documentation.html\" ALT=\"Read CUPS Documentation On-Line\">");
|
||||
puts("<AREA SHAPE=\"RECT\" COORDS=\"405,10,490,30\" HREF=\"http://www.cups.org\" ALT=\"Download the Current CUPS Software\">");
|
||||
puts("</MAP>");
|
||||
puts("</HEAD>");
|
||||
puts("<BODY>");
|
||||
puts("<P ALIGN=CENTER>");
|
||||
puts("<A HREF=\"http://www.easysw.com\" ALT=\"Easy Software Products Home Page\">");
|
||||
puts("<IMG SRC=\"/images/logo.gif\" WIDTH=\"71\" HEIGHT=\"40\" BORDER=0 ALT=\"Easy Software Products Home Page\"></A>");
|
||||
puts("<IMG SRC=\"/images/navbar.gif\" WIDTH=\"540\" HEIGHT=\"40\" USEMAP=\"#navbar\" BORDER=0>");
|
||||
|
||||
cgiStartHTML(cgiText(_("Printers")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
printf("<H1>%s on %s</H1>\n", printer == NULL ? "Printers" : printer,
|
||||
getenv("SERVER_NAME"));
|
||||
fflush(stdout);
|
||||
|
||||
puts("<CENTER>");
|
||||
puts("<TABLE WIDTH=\"90%\" BORDER=\"1\">");
|
||||
puts("<TR>");
|
||||
puts("<TH>Name</TH>");
|
||||
puts("<TH WIDTH=\"50%\">Status</TH>");
|
||||
puts("<TH WIDTH=\"25%\">Jobs</TH>");
|
||||
puts("</TR>");
|
||||
|
||||
/*
|
||||
* Show the information...
|
||||
*/
|
||||
|
||||
if (printer == NULL)
|
||||
show_printer_list(http, language);
|
||||
else
|
||||
show_printer_info(http, language, printer);
|
||||
|
||||
/*
|
||||
* Write a standard trailer...
|
||||
*/
|
||||
|
||||
puts("</TABLE>");
|
||||
puts("</CENTER>");
|
||||
|
||||
puts("<HR>");
|
||||
|
||||
puts("<P>The Common UNIX Printing System, CUPS, and the CUPS logo are the");
|
||||
puts("trademark property of <A HREF=\"http://www.easysw.com\">Easy Software");
|
||||
puts("Products</A>. CUPS is copyright 1997-1999 by Easy Software Products,");
|
||||
puts("All Rights Reserved.");
|
||||
|
||||
puts("</BODY>");
|
||||
puts("</HTML>");
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
cupsLangFree(language);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
@@ -206,276 +170,105 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
|
||||
/*
|
||||
* 'do_printer_op()' - Do a printer operation.
|
||||
* 'show_printer_list()' - Show a list of printers...
|
||||
*/
|
||||
|
||||
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 */
|
||||
show_printer_list(http_t *http, /* I - HTTP connection */
|
||||
cups_lang_t *language)/* I - Client's language */
|
||||
{
|
||||
ipp_t *request; /* IPP request */
|
||||
char uri[HTTP_MAX_URI], /* Printer URI */
|
||||
resource[HTTP_MAX_URI]; /* Path for request */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
|
||||
|
||||
/*
|
||||
* Build a printer request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(op);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
snprintf(resource, sizeof(resource), "/printers/%s", printer);
|
||||
ippDelete(cupsDoRequest(http, request, resource));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to do maintenance command:"));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Redirect successful updates back to the printer page...
|
||||
*/
|
||||
|
||||
char url[1024], /* Printer/class URL */
|
||||
refresh[1024]; /* Refresh URL */
|
||||
|
||||
|
||||
cgiRewriteURL(uri, url, sizeof(url), NULL);
|
||||
cgiFormEncode(uri, url, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "5;URL=%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
|
||||
cgiStartHTML(title);
|
||||
|
||||
if (op == IPP_PAUSE_PRINTER)
|
||||
cgiCopyTemplateLang("printer-stop.tmpl");
|
||||
else if (op == IPP_RESUME_PRINTER)
|
||||
cgiCopyTemplateLang("printer-start.tmpl");
|
||||
else if (op == CUPS_ACCEPT_JOBS)
|
||||
cgiCopyTemplateLang("printer-accept.tmpl");
|
||||
else if (op == CUPS_REJECT_JOBS)
|
||||
cgiCopyTemplateLang("printer-reject.tmpl");
|
||||
else if (op == IPP_PURGE_JOBS)
|
||||
cgiCopyTemplateLang("printer-purge.tmpl");
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_all_printers()' - Show all printers...
|
||||
*/
|
||||
|
||||
static void
|
||||
show_all_printers(http_t *http, /* I - Connection to server */
|
||||
const char *user) /* I - Username */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
cups_array_t *printers; /* Array of printer objects */
|
||||
ipp_attribute_t *printer; /* Printer object */
|
||||
int 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 */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
|
||||
http, user ? user : "(null)");
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Printers")));
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_PRINTERS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-type
|
||||
* printer-type-mask
|
||||
* requesting-user-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_PRINTERS);
|
||||
request = ippNew();
|
||||
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
|
||||
"printer-type", 0);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
|
||||
"printer-type-mask", CUPS_PRINTER_CLASS);
|
||||
request->request.op.operation_id = CUPS_GET_PRINTERS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
if (user)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
cgiGetAttributes(request, "printers.tmpl");
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
if ((response = cupsDoRequest(http, request, "/printers/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get a list of matching job objects.
|
||||
* Loop through the printers returned in the list and display
|
||||
* their devices...
|
||||
*/
|
||||
|
||||
if ((var = cgiGetVariable("QUERY")) != NULL &&
|
||||
!cgiGetVariable("CLEAR"))
|
||||
search = cgiCompileSearch(var);
|
||||
else
|
||||
search = NULL;
|
||||
|
||||
printers = cgiGetIPPObjects(response, search);
|
||||
count = cupsArrayCount(printers);
|
||||
|
||||
if (search)
|
||||
cgiFreeSearch(search);
|
||||
|
||||
/*
|
||||
* Figure out which printers to display...
|
||||
*/
|
||||
|
||||
if ((var = cgiGetVariable("FIRST")) != NULL)
|
||||
first = atoi(var);
|
||||
else
|
||||
first = 0;
|
||||
|
||||
if (first >= count)
|
||||
first = count - CUPS_PAGE_MAX;
|
||||
|
||||
first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX;
|
||||
|
||||
if (first < 0)
|
||||
first = 0;
|
||||
|
||||
sprintf(val, "%d", count);
|
||||
cgiSetVariable("TOTAL", val);
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
ascending = !strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = 1;
|
||||
|
||||
if (ascending)
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Show the printer status for each printer...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
|
||||
{
|
||||
if (strcmp(attr->name, "printer-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
show_printer_info(http, language, attr->values[0].string.text);
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save navigation URLs...
|
||||
*/
|
||||
|
||||
cgiSetVariable("THISURL", "/printers/");
|
||||
|
||||
if (first > 0)
|
||||
{
|
||||
sprintf(val, "%d", first - CUPS_PAGE_MAX);
|
||||
cgiSetVariable("PREV", val);
|
||||
}
|
||||
|
||||
if ((first + CUPS_PAGE_MAX) < count)
|
||||
{
|
||||
sprintf(val, "%d", first + CUPS_PAGE_MAX);
|
||||
cgiSetVariable("NEXT", val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Then show everything...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("search.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("printers-header.tmpl");
|
||||
|
||||
if (count > CUPS_PAGE_MAX)
|
||||
cgiCopyTemplateLang("pager.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("printers.tmpl");
|
||||
|
||||
if (count > CUPS_PAGE_MAX)
|
||||
cgiCopyTemplateLang("pager.tmpl");
|
||||
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
cupsArrayDelete(printers);
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show the error...
|
||||
*/
|
||||
|
||||
cgiShowIPPError(_("Unable to get printer list:"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_printer()' - Show a single printer.
|
||||
* 'show_printer_info()' - Show printer information.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_printer(http_t *http, /* I - Connection to server */
|
||||
const char *printer) /* I - Name of printer */
|
||||
show_printer_info(http_t *http,
|
||||
cups_lang_t *language,
|
||||
char *name)
|
||||
{
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
char refresh[1024]; /* Refresh URL */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response, /* IPP response */
|
||||
*jobs; /* IPP Get Jobs response */
|
||||
int jobcount; /* Number of jobs */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char *message; /* Printer state message */
|
||||
int accepting; /* Accepting requests? */
|
||||
ipp_pstate_t pstate; /* Printer state */
|
||||
char uri[HTTP_MAX_URI];/* Printer URI */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: show_printer(http=%p, printer=\"%s\")\n",
|
||||
http, printer ? printer : "(null)");
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* Build a IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
@@ -483,78 +276,195 @@ show_printer(http_t *http, /* I - Connection to server */
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
request = ippNew();
|
||||
|
||||
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);
|
||||
request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
cgiGetAttributes(request, "printer.tmpl");
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
sprintf(uri, "ipp://localhost/printers/%s", name);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
if ((response = cupsDoRequest(http, request, uri + 15)) == NULL)
|
||||
{
|
||||
puts("<P>Unable to communicate with CUPS server!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (response->request.status.status_code == IPP_NOT_FOUND)
|
||||
{
|
||||
puts("<P>Printer does not exist.");
|
||||
ippDelete(response);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab the needed printer attributes...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL)
|
||||
pstate = (ipp_pstate_t)attr->values[0].integer;
|
||||
else
|
||||
pstate = IPP_PRINTER_IDLE;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-state-message", IPP_TAG_TEXT)) != NULL)
|
||||
message = attr->values[0].string.text;
|
||||
else
|
||||
message = NULL;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-is-accepting-jobs",
|
||||
IPP_TAG_BOOLEAN)) != NULL)
|
||||
accepting = attr->values[0].boolean;
|
||||
else
|
||||
accepting = 1;
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri", IPP_TAG_URI)) != NULL)
|
||||
strcpy(uri, attr->values[0].string.text);
|
||||
|
||||
/*
|
||||
* Display the printer entry...
|
||||
*/
|
||||
|
||||
puts("<TR>");
|
||||
|
||||
printf("<TD VALIGN=TOP><A HREF=\"/printers/%s\">%s</A></TD>\n", name, name);
|
||||
|
||||
printf("<TD VALIGN=TOP><IMG SRC=\"/images/printer-%s.gif\" ALIGN=\"LEFT\">\n",
|
||||
pstate == IPP_PRINTER_IDLE ? "idle" :
|
||||
pstate == IPP_PRINTER_PROCESSING ? "processing" : "stopped");
|
||||
|
||||
printf("%s: %s, %s<BR>\n",
|
||||
cupsLangString(language, CUPS_MSG_PRINTER_STATE),
|
||||
cupsLangString(language, pstate == IPP_PRINTER_IDLE ? CUPS_MSG_IDLE :
|
||||
pstate == IPP_PRINTER_PROCESSING ?
|
||||
CUPS_MSG_PROCESSING : CUPS_MSG_STOPPED),
|
||||
cupsLangString(language, accepting ? CUPS_MSG_ACCEPTING_JOBS :
|
||||
CUPS_MSG_NOT_ACCEPTING_JOBS));
|
||||
|
||||
if (message)
|
||||
printf("<BR CLEAR=ALL><I>\"%s\"</I>\n", message);
|
||||
else if (!accepting || pstate == IPP_PRINTER_STOPPED)
|
||||
puts("<BR CLEAR=ALL><I>\"Reason Unknown\"</I>");
|
||||
|
||||
puts("</TD>");
|
||||
|
||||
/*
|
||||
* Show a list of jobs as needed...
|
||||
*/
|
||||
|
||||
if (pstate != IPP_PRINTER_IDLE)
|
||||
{
|
||||
/*
|
||||
* Got the result; set the CGI variables and check the status of a
|
||||
* single-queue request...
|
||||
* Build an IPP_GET_JOBS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
request = ippNew();
|
||||
|
||||
if (printer && (attr = ippFindAttribute(response, "printer-state",
|
||||
IPP_TAG_ENUM)) != NULL &&
|
||||
attr->values[0].integer == IPP_PRINTER_PROCESSING)
|
||||
{
|
||||
/*
|
||||
* Printer is processing - automatically refresh the page until we
|
||||
* are done printing...
|
||||
*/
|
||||
request->request.op.operation_id = IPP_GET_JOBS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
cgiFormEncode(uri, printer, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "10;URL=/printers/%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL,
|
||||
cupsLangEncoding(language));
|
||||
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL,
|
||||
language->language);
|
||||
|
||||
ippDelete(response);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(printer);
|
||||
|
||||
/*
|
||||
* Show the printer status...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("printer.tmpl");
|
||||
|
||||
/*
|
||||
* Show jobs for the specified printer...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("printer-jobs-header.tmpl");
|
||||
cgiShowJobs(http, printer);
|
||||
jobs = cupsDoRequest(http, request, uri + 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show the IPP error...
|
||||
*/
|
||||
jobs = NULL;
|
||||
|
||||
cgiStartHTML(printer);
|
||||
cgiShowIPPError(_("Unable to get printer status:"));
|
||||
puts("<TD VALIGN=\"TOP\">");
|
||||
jobcount = 0;
|
||||
|
||||
if (jobs != NULL)
|
||||
{
|
||||
char *username; /* Pointer to job-originating-user-name */
|
||||
int jobid, /* job-id */
|
||||
size; /* job-k-octets */
|
||||
|
||||
|
||||
for (attr = jobs->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Pull the needed attributes from this job...
|
||||
*/
|
||||
|
||||
jobid = 0;
|
||||
size = 0;
|
||||
username = NULL;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
|
||||
{
|
||||
if (strcmp(attr->name, "job-id") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-k-octets") == 0 &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
size = attr->values[0].integer;
|
||||
|
||||
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
username = attr->values[0].string.text;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the job if it matches the current printer...
|
||||
*/
|
||||
|
||||
if (username != NULL)
|
||||
{
|
||||
jobcount ++;
|
||||
printf("<A HREF=\"/jobs/%d\">%s-%d %s %dk</A><BR>\n", jobid, name,
|
||||
jobid, username, size);
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(jobs);
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
if (jobcount == 0)
|
||||
puts("None");
|
||||
puts("</TD>");
|
||||
puts("</TR>");
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Search routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cgiCompileSearch() - Compile a search string.
|
||||
* cgiDoSearch() - Do a search of some text.
|
||||
* cgiFreeSearch() - Free a compiled search context.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <regex.h>
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiCompileSearch()' - Compile a search string.
|
||||
*/
|
||||
|
||||
void * /* O - Search context */
|
||||
cgiCompileSearch(const char *query) /* I - Query string */
|
||||
{
|
||||
regex_t *re; /* Regular expression */
|
||||
char *s, /* Regular expression string */
|
||||
*sptr, /* Pointer into RE string */
|
||||
*sword; /* Pointer to start of word */
|
||||
int slen; /* Allocated size of RE string */
|
||||
const char *qptr, /* Pointer into query string */
|
||||
*qend; /* End of current word */
|
||||
const char *prefix; /* Prefix to add to next word */
|
||||
int quoted; /* Word is quoted */
|
||||
int wlen; /* Word length */
|
||||
char *lword; /* Last word in query */
|
||||
|
||||
|
||||
DEBUG_printf(("cgiCompileSearch(query=\"%s\")\n", query));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!query)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Allocate a regular expression storage structure...
|
||||
*/
|
||||
|
||||
if ((re = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Allocate a buffer to hold the regular expression string, starting
|
||||
* at 1024 bytes or 3 times the length of the query string, whichever
|
||||
* is greater. We'll expand the string as needed...
|
||||
*/
|
||||
|
||||
slen = strlen(query) * 3;
|
||||
if (slen < 1024)
|
||||
slen = 1024;
|
||||
|
||||
if ((s = (char *)malloc(slen)) == NULL)
|
||||
{
|
||||
free(re);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the query string to the regular expression, handling basic
|
||||
* AND and OR logic...
|
||||
*/
|
||||
|
||||
prefix = ".*";
|
||||
qptr = query;
|
||||
sptr = s;
|
||||
lword = NULL;
|
||||
|
||||
while (*qptr)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*qptr & 255))
|
||||
qptr ++;
|
||||
|
||||
if (!*qptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Find the end of the current word...
|
||||
*/
|
||||
|
||||
if (*qptr == '\"' || *qptr == '\'')
|
||||
{
|
||||
/*
|
||||
* Scan quoted string...
|
||||
*/
|
||||
|
||||
quoted = *qptr ++;
|
||||
for (qend = qptr; *qend && *qend != quoted; qend ++);
|
||||
|
||||
if (!*qend)
|
||||
{
|
||||
/*
|
||||
* No closing quote, error out!
|
||||
*/
|
||||
|
||||
free(s);
|
||||
free(re);
|
||||
|
||||
if (lword)
|
||||
free(lword);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Scan whitespace-delimited string...
|
||||
*/
|
||||
|
||||
quoted = 0;
|
||||
for (qend = qptr + 1; *qend && !isspace(*qend); qend ++);
|
||||
}
|
||||
|
||||
wlen = qend - qptr;
|
||||
|
||||
/*
|
||||
* Look for logic words: AND, OR
|
||||
*/
|
||||
|
||||
if (wlen == 3 && !strncasecmp(qptr, "AND", 3))
|
||||
{
|
||||
/*
|
||||
* Logical AND with the following text...
|
||||
*/
|
||||
|
||||
if (sptr > s)
|
||||
prefix = ".*";
|
||||
|
||||
qptr = qend;
|
||||
}
|
||||
else if (wlen == 2 && !strncasecmp(qptr, "OR", 2))
|
||||
{
|
||||
/*
|
||||
* Logical OR with the following text...
|
||||
*/
|
||||
|
||||
if (sptr > s)
|
||||
prefix = ".*|.*";
|
||||
|
||||
qptr = qend;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Add a search word, making sure we have enough room for the
|
||||
* string + RE overhead...
|
||||
*/
|
||||
|
||||
wlen = (sptr - s) + 2 * 4 * wlen + 2 * strlen(prefix) + 11;
|
||||
if (lword)
|
||||
wlen += strlen(lword);
|
||||
|
||||
if (wlen > slen)
|
||||
{
|
||||
/*
|
||||
* Expand the RE string buffer...
|
||||
*/
|
||||
|
||||
char *temp; /* Temporary string pointer */
|
||||
|
||||
|
||||
slen = wlen + 128;
|
||||
temp = (char *)realloc(s, slen);
|
||||
if (!temp)
|
||||
{
|
||||
free(s);
|
||||
free(re);
|
||||
|
||||
if (lword)
|
||||
free(lword);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
sptr = temp + (sptr - s);
|
||||
s = temp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the prefix string...
|
||||
*/
|
||||
|
||||
strcpy(sptr, prefix);
|
||||
sptr += strlen(sptr);
|
||||
|
||||
/*
|
||||
* Then quote the remaining word characters as needed for the
|
||||
* RE...
|
||||
*/
|
||||
|
||||
sword = sptr;
|
||||
|
||||
while (qptr < qend)
|
||||
{
|
||||
/*
|
||||
* Quote: ^ . [ $ ( ) | * + ? { \
|
||||
*/
|
||||
|
||||
if (strchr("^.[$()|*+?{\\", *qptr))
|
||||
*sptr++ = '\\';
|
||||
|
||||
*sptr++ = *qptr++;
|
||||
}
|
||||
|
||||
*sptr = '\0';
|
||||
|
||||
/*
|
||||
* For "word1 AND word2", add reciprocal "word2 AND word1"...
|
||||
*/
|
||||
|
||||
if (!strcmp(prefix, ".*") && lword)
|
||||
{
|
||||
char *lword2; /* New "last word" */
|
||||
|
||||
|
||||
if ((lword2 = strdup(sword)) == NULL)
|
||||
{
|
||||
free(lword);
|
||||
free(s);
|
||||
free(re);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
strcpy(sptr, ".*|.*");
|
||||
sptr += 5;
|
||||
|
||||
strcpy(sptr, lword2);
|
||||
sptr += strlen(sptr);
|
||||
|
||||
strcpy(sptr, ".*");
|
||||
sptr += 2;
|
||||
|
||||
strcpy(sptr, lword);
|
||||
sptr += strlen(sptr);
|
||||
|
||||
free(lword);
|
||||
lword = lword2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lword)
|
||||
free(lword);
|
||||
|
||||
lword = strdup(sword);
|
||||
}
|
||||
|
||||
prefix = ".*|.*";
|
||||
}
|
||||
|
||||
/*
|
||||
* Advance to the next string...
|
||||
*/
|
||||
|
||||
if (quoted)
|
||||
qptr ++;
|
||||
}
|
||||
|
||||
if (lword)
|
||||
free(lword);
|
||||
|
||||
if (sptr > s)
|
||||
strcpy(sptr, ".*");
|
||||
else
|
||||
{
|
||||
/*
|
||||
* No query data, return NULL...
|
||||
*/
|
||||
|
||||
free(s);
|
||||
free(re);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compile the regular expression...
|
||||
*/
|
||||
|
||||
DEBUG_printf((" s=\"%s\"\n", s));
|
||||
|
||||
if (regcomp(re, s, REG_EXTENDED | REG_ICASE))
|
||||
{
|
||||
free(re);
|
||||
free(s);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the RE string and return the new regular expression we compiled...
|
||||
*/
|
||||
|
||||
free(s);
|
||||
|
||||
return ((void *)re);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiDoSearch()' - Do a search of some text.
|
||||
*/
|
||||
|
||||
int /* O - Number of matches */
|
||||
cgiDoSearch(void *search, /* I - Search context */
|
||||
const char *text) /* I - Text to search */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
regmatch_t matches[100]; /* RE matches */
|
||||
|
||||
|
||||
/*
|
||||
* Range check...
|
||||
*/
|
||||
|
||||
if (!search || !text)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Do a lookup...
|
||||
*/
|
||||
|
||||
if (!regexec((regex_t *)search, text, sizeof(matches) / sizeof(matches[0]),
|
||||
matches, 0))
|
||||
{
|
||||
/*
|
||||
* Figure out the number of matches in the string...
|
||||
*/
|
||||
|
||||
for (i = 0; i < (int)(sizeof(matches) / sizeof(matches[0])); i ++)
|
||||
if (matches[i].rm_so < 0)
|
||||
break;
|
||||
|
||||
return (i);
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiFreeSearch()' - Free a compiled search context.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiFreeSearch(void *search) /* I - Search context */
|
||||
{
|
||||
regfree((regex_t *)search);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,710 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI template function.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 1997-2006 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cgiCopyTemplateFile() - Copy a template file and replace all the
|
||||
* '{variable}' strings with the variable value.
|
||||
* cgiCopyTemplateLang() - Copy a template file using a language...
|
||||
* cgiGetTemplateDir() - Get the templates directory...
|
||||
* cgiSetServerVersion() - Set the server name and CUPS version...
|
||||
* cgi_copy() - Copy the template file, substituting as needed...
|
||||
* cgi_puts() - Put a string to the output file, quoting as
|
||||
* needed...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <errno.h>
|
||||
#include <regex.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void cgi_copy(FILE *out, FILE *in, int element, char term,
|
||||
int indent);
|
||||
static void cgi_puts(const char *s, FILE *out);
|
||||
static void cgi_puturi(const char *s, FILE *out);
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiCopyTemplateFile()' - Copy a template file and replace all the
|
||||
* '{variable}' strings with the variable value.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiCopyTemplateFile(FILE *out, /* I - Output file */
|
||||
const char *tmpl) /* I - Template file to read */
|
||||
{
|
||||
FILE *in; /* Input file */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
|
||||
tmpl ? tmpl : "(null)");
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!tmpl || !out)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Open the template file...
|
||||
*/
|
||||
|
||||
if ((in = fopen(tmpl, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
|
||||
tmpl ? tmpl : "(null)", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the file to the end...
|
||||
*/
|
||||
|
||||
cgi_copy(out, in, 0, 0, 0);
|
||||
|
||||
/*
|
||||
* Close the template file and return...
|
||||
*/
|
||||
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiCopyTemplateLang()' - Copy a template file using a language...
|
||||
*/
|
||||
|
||||
void
|
||||
cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
|
||||
{
|
||||
char filename[1024], /* Filename */
|
||||
locale[16], /* Locale name */
|
||||
*locptr; /* Pointer into locale name */
|
||||
const char *directory, /* Directory for templates */
|
||||
*lang; /* Language */
|
||||
FILE *in; /* Input file */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: cgiCopyTemplateLang(tmpl=\"%s\")\n",
|
||||
tmpl ? tmpl : "(null)");
|
||||
|
||||
/*
|
||||
* Convert the language to a locale name...
|
||||
*/
|
||||
|
||||
locale[0] = '\0';
|
||||
|
||||
if ((lang = getenv("LANG")) != NULL)
|
||||
{
|
||||
locale[0] = '/';
|
||||
strlcpy(locale + 1, lang, sizeof(locale) - 1);
|
||||
|
||||
if ((locptr = strchr(locale, '.')) != NULL)
|
||||
*locptr = '\0'; /* Strip charset */
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: lang=\"%s\", locale=\"%s\"...\n",
|
||||
lang ? lang : "(null)", locale);
|
||||
|
||||
/*
|
||||
* See if we have a template file for this language...
|
||||
*/
|
||||
|
||||
directory = cgiGetTemplateDir();
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
locale[3] = '\0';
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
|
||||
in = fopen(filename, "r");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: Template file is \"%s\"...\n", filename);
|
||||
|
||||
/*
|
||||
* Open the template file...
|
||||
*/
|
||||
|
||||
if (!in)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
|
||||
filename, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the file to the end...
|
||||
*/
|
||||
|
||||
cgi_copy(stdout, in, 0, 0, 0);
|
||||
|
||||
/*
|
||||
* Close the template file and return...
|
||||
*/
|
||||
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiGetTemplateDir()' - Get the templates directory...
|
||||
*/
|
||||
|
||||
char * /* O - Template directory */
|
||||
cgiGetTemplateDir(void)
|
||||
{
|
||||
const char *datadir; /* CUPS_DATADIR env var */
|
||||
static char templates[1024] = ""; /* Template directory */
|
||||
|
||||
|
||||
if (!templates[0])
|
||||
{
|
||||
/*
|
||||
* Build the template directory pathname...
|
||||
*/
|
||||
|
||||
if ((datadir = getenv("CUPS_DATADIR")) == NULL)
|
||||
datadir = CUPS_DATADIR;
|
||||
|
||||
snprintf(templates, sizeof(templates), "%s/templates", datadir);
|
||||
}
|
||||
|
||||
return (templates);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiSetServerVersion()' - Set the server name and CUPS version...
|
||||
*/
|
||||
|
||||
void
|
||||
cgiSetServerVersion(void)
|
||||
{
|
||||
cgiSetVariable("SERVER_NAME", getenv("SERVER_NAME"));
|
||||
cgiSetVariable("REMOTE_USER", getenv("REMOTE_USER"));
|
||||
cgiSetVariable("CUPS_VERSION", CUPS_SVERSION);
|
||||
|
||||
#ifdef LC_TIME
|
||||
setlocale(LC_TIME, "");
|
||||
#endif /* LC_TIME */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_copy()' - Copy the template file, substituting as needed...
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_copy(FILE *out, /* I - Output file */
|
||||
FILE *in, /* I - Input file */
|
||||
int element, /* I - Element number (0 to N) */
|
||||
char term, /* I - Terminating character */
|
||||
int indent) /* I - Debug info indentation */
|
||||
{
|
||||
int ch; /* Character from file */
|
||||
char op; /* Operation */
|
||||
char name[255], /* Name of variable */
|
||||
*nameptr, /* Pointer into name */
|
||||
innername[255], /* Inner comparison name */
|
||||
*innerptr, /* Pointer into inner name */
|
||||
*s; /* String pointer */
|
||||
const char *value; /* Value of variable */
|
||||
const char *innerval; /* Inner value */
|
||||
const char *outptr; /* Output string pointer */
|
||||
char outval[1024], /* Formatted output string */
|
||||
compare[1024]; /* Comparison string */
|
||||
int result; /* Result of comparison */
|
||||
int uriencode; /* Encode as URI */
|
||||
regex_t re; /* Regular expression to match */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sStarting at file position %ld...\n", indent, "",
|
||||
ftell(in));
|
||||
|
||||
/*
|
||||
* Parse the file to the end...
|
||||
*/
|
||||
|
||||
while ((ch = getc(in)) != EOF)
|
||||
if (ch == term)
|
||||
break;
|
||||
else if (ch == '{')
|
||||
{
|
||||
/*
|
||||
* Get a variable name...
|
||||
*/
|
||||
|
||||
uriencode = 0;
|
||||
|
||||
for (s = name; (ch = getc(in)) != EOF;)
|
||||
if (strchr("}]<>=!~ \t\n", ch))
|
||||
break;
|
||||
else if (s == name && ch == '%')
|
||||
uriencode = 1;
|
||||
else if (s > name && ch == '?')
|
||||
break;
|
||||
else if (s < (name + sizeof(name) - 1))
|
||||
*s++ = ch;
|
||||
|
||||
*s = '\0';
|
||||
|
||||
if (s == name && isspace(ch & 255))
|
||||
{
|
||||
fprintf(stderr, "DEBUG2: %*sLone { at %ld...\n", indent, "", ftell(in));
|
||||
|
||||
if (out)
|
||||
{
|
||||
putc('{', out);
|
||||
putc(ch, out);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '}')
|
||||
fprintf(stderr, "DEBUG2: %*s\"{%s}\" at %ld...\n", indent, "", name,
|
||||
ftell(in));
|
||||
|
||||
/*
|
||||
* See if it has a value...
|
||||
*/
|
||||
|
||||
if (name[0] == '?')
|
||||
{
|
||||
/*
|
||||
* Insert value only if it exists...
|
||||
*/
|
||||
|
||||
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
|
||||
{
|
||||
*nameptr++ = '\0';
|
||||
|
||||
if ((value = cgiGetArray(name + 1, atoi(nameptr) - 1)) != NULL)
|
||||
outptr = value;
|
||||
else
|
||||
{
|
||||
outval[0] = '\0';
|
||||
outptr = outval;
|
||||
}
|
||||
}
|
||||
else if ((value = cgiGetArray(name + 1, element)) != NULL)
|
||||
outptr = value;
|
||||
else
|
||||
{
|
||||
outval[0] = '\0';
|
||||
outptr = outval;
|
||||
}
|
||||
}
|
||||
else if (name[0] == '#')
|
||||
{
|
||||
/*
|
||||
* Insert count...
|
||||
*/
|
||||
|
||||
if (name[1])
|
||||
sprintf(outval, "%d", cgiGetSize(name + 1));
|
||||
else
|
||||
sprintf(outval, "%d", element + 1);
|
||||
|
||||
outptr = outval;
|
||||
}
|
||||
else if (name[0] == '[')
|
||||
{
|
||||
/*
|
||||
* Loop for # of elements...
|
||||
*/
|
||||
|
||||
int i; /* Looping var */
|
||||
long pos; /* File position */
|
||||
int count; /* Number of elements */
|
||||
|
||||
|
||||
if (isdigit(name[1] & 255))
|
||||
count = atoi(name + 1);
|
||||
else
|
||||
count = cgiGetSize(name + 1);
|
||||
|
||||
pos = ftell(in);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sLooping on \"%s\" at %ld, count=%d...\n",
|
||||
indent, "", name + 1, pos, count);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
for (i = 0; i < count; i ++)
|
||||
{
|
||||
if (i)
|
||||
fseek(in, pos, SEEK_SET);
|
||||
|
||||
cgi_copy(out, in, i, '}', indent + 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
cgi_copy(NULL, in, 0, '}', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sFinished looping on \"%s\"...\n", indent,
|
||||
"", name + 1);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Insert variable or variable name (if element is NULL)...
|
||||
*/
|
||||
|
||||
if ((nameptr = strrchr(name, '-')) != NULL && isdigit(nameptr[1] & 255))
|
||||
{
|
||||
*nameptr++ = '\0';
|
||||
if ((value = cgiGetArray(name, atoi(nameptr) - 1)) == NULL)
|
||||
{
|
||||
snprintf(outval, sizeof(outval), "{%s}", name);
|
||||
outptr = outval;
|
||||
}
|
||||
else
|
||||
outptr = value;
|
||||
}
|
||||
else if ((value = cgiGetArray(name, element)) == NULL)
|
||||
{
|
||||
snprintf(outval, sizeof(outval), "{%s}", name);
|
||||
outptr = outval;
|
||||
}
|
||||
else
|
||||
outptr = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the terminating character requires another test...
|
||||
*/
|
||||
|
||||
if (ch == '}')
|
||||
{
|
||||
/*
|
||||
* End of substitution...
|
||||
*/
|
||||
|
||||
if (out)
|
||||
{
|
||||
if (uriencode)
|
||||
cgi_puturi(outptr, out);
|
||||
else if (!strcasecmp(name, "?cupsdconf_default"))
|
||||
fputs(outptr, stdout);
|
||||
else
|
||||
cgi_puts(outptr, out);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, process one of the following checks:
|
||||
*
|
||||
* {name?exist:not-exist} Exists?
|
||||
* {name=value?true:false} Equal
|
||||
* {name<value?true:false} Less than
|
||||
* {name>value?true:false} Greater than
|
||||
* {name!value?true:false} Not equal
|
||||
* {name~refex?true:false} Regex match
|
||||
*/
|
||||
|
||||
op = ch;
|
||||
|
||||
if (ch == '?')
|
||||
{
|
||||
/*
|
||||
* Test for existance...
|
||||
*/
|
||||
|
||||
result = cgiGetArray(name, element) != NULL && outptr[0];
|
||||
compare[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Compare to a string...
|
||||
*/
|
||||
|
||||
for (s = compare; (ch = getc(in)) != EOF;)
|
||||
if (ch == '?')
|
||||
break;
|
||||
else if (s >= (compare + sizeof(compare) - 1))
|
||||
continue;
|
||||
else if (ch == '#')
|
||||
{
|
||||
sprintf(s, "%d", element + 1);
|
||||
s += strlen(s);
|
||||
}
|
||||
else if (ch == '{')
|
||||
{
|
||||
/*
|
||||
* Grab the value of a variable...
|
||||
*/
|
||||
|
||||
innerptr = innername;
|
||||
while ((ch = getc(in)) != EOF && ch != '}')
|
||||
if (innerptr < (innername + sizeof(innername) - 1))
|
||||
*innerptr++ = ch;
|
||||
*innerptr = '\0';
|
||||
|
||||
if (innername[0] == '#')
|
||||
sprintf(s, "%d", cgiGetSize(innername + 1));
|
||||
else if ((innerptr = strrchr(innername, '-')) != NULL &&
|
||||
isdigit(innerptr[1] & 255))
|
||||
{
|
||||
*innerptr++ = '\0';
|
||||
if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
|
||||
*s = '\0';
|
||||
else
|
||||
strlcpy(s, innerval, sizeof(compare) - (s - compare));
|
||||
}
|
||||
else if (innername[0] == '?')
|
||||
{
|
||||
if ((innerval = cgiGetArray(innername + 1, element)) == NULL)
|
||||
*s = '\0';
|
||||
else
|
||||
strlcpy(s, innerval, sizeof(compare) - (s - compare));
|
||||
}
|
||||
else if ((innerval = cgiGetArray(innername, element)) == NULL)
|
||||
snprintf(s, sizeof(compare) - (s - compare), "{%s}", innername);
|
||||
else
|
||||
strlcpy(s, innerval, sizeof(compare) - (s - compare));
|
||||
|
||||
s += strlen(s);
|
||||
}
|
||||
else if (ch == '\\')
|
||||
*s++ = getc(in);
|
||||
else
|
||||
*s++ = ch;
|
||||
|
||||
*s = '\0';
|
||||
|
||||
if (ch != '?')
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sBad terminator '%c' at file position %ld...\n",
|
||||
indent, "", ch, ftell(in));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the comparison...
|
||||
*/
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case '<' :
|
||||
result = strcasecmp(outptr, compare) < 0;
|
||||
break;
|
||||
case '>' :
|
||||
result = strcasecmp(outptr, compare) > 0;
|
||||
break;
|
||||
case '=' :
|
||||
result = strcasecmp(outptr, compare) == 0;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sStarting \"{%s%c%s\" at %ld, result=%d...\n",
|
||||
indent, "", name, op, compare, ftell(in), result);
|
||||
|
||||
if (result)
|
||||
{
|
||||
/*
|
||||
* Comparison true; output first part and ignore second...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sOutput first part...\n", indent, "");
|
||||
cgi_copy(out, in, element, ':', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sSkip second part...\n", indent, "");
|
||||
cgi_copy(NULL, in, element, '}', indent + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Comparison false; ignore first part and output second...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sSkip first part...\n", indent, "");
|
||||
cgi_copy(NULL, in, element, ':', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sOutput second part...\n", indent, "");
|
||||
cgi_copy(out, in, element, '}', indent + 2);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
|
||||
name, op, compare, out);
|
||||
}
|
||||
else if (ch == '\\') /* Quoted char */
|
||||
{
|
||||
if (out)
|
||||
putc(getc(in), out);
|
||||
else
|
||||
getc(in);
|
||||
}
|
||||
else if (out)
|
||||
putc(ch, out);
|
||||
|
||||
if (ch == EOF)
|
||||
fprintf(stderr, "DEBUG2: %*sReturning at file position %ld on EOF...\n",
|
||||
indent, "", ftell(in));
|
||||
else
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sReturning at file position %ld on character '%c'...\n",
|
||||
indent, "", ftell(in), ch);
|
||||
|
||||
if (ch == EOF && term)
|
||||
fprintf(stderr, "ERROR: %*sSaw EOF, expected '%c'!\n", indent, "", term);
|
||||
|
||||
/*
|
||||
* Flush any pending output...
|
||||
*/
|
||||
|
||||
if (out)
|
||||
fflush(out);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_puts()' - Put a string to the output file, quoting as needed...
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_puts(const char *s, /* I - String to output */
|
||||
FILE *out) /* I - Output file */
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
if (*s == '<')
|
||||
{
|
||||
/*
|
||||
* Pass <A HREF="url"> and </A>, otherwise quote it...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(s, "<A HREF=\"", 9))
|
||||
{
|
||||
fputs("<A HREF=\"", out);
|
||||
s += 9;
|
||||
|
||||
while (*s && *s != '\"')
|
||||
{
|
||||
if (*s == '&')
|
||||
fputs("&", out);
|
||||
else
|
||||
putc(*s, out);
|
||||
|
||||
s ++;
|
||||
}
|
||||
|
||||
if (*s)
|
||||
s ++;
|
||||
|
||||
fputs("\">", out);
|
||||
}
|
||||
else if (!strncasecmp(s, "</A>", 4))
|
||||
{
|
||||
fputs("</A>", out);
|
||||
s += 3;
|
||||
}
|
||||
else
|
||||
fputs("<", out);
|
||||
}
|
||||
else if (*s == '>')
|
||||
fputs(">", out);
|
||||
else if (*s == '\"')
|
||||
fputs(""", out);
|
||||
else if (*s == '&')
|
||||
fputs("&", out);
|
||||
else
|
||||
putc(*s, out);
|
||||
|
||||
s ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_puturi()' - Put a URI string to the output file, quoting as needed...
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_puturi(const char *s, /* I - String to output */
|
||||
FILE *out) /* I - Output file */
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
if (strchr("%&+ <>#=", *s) || *s & 128)
|
||||
fprintf(out, "%%%02X", *s & 255);
|
||||
else
|
||||
putc(*s, out);
|
||||
|
||||
s ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 1997-2005 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Test the help index code.
|
||||
* list_nodes() - List nodes in an array...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Test the CGI code.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
/*
|
||||
* Test file upload/multi-part submissions...
|
||||
*/
|
||||
|
||||
freopen("multipart.dat", "rb", stdin);
|
||||
|
||||
putenv("CONTENT_TYPE=multipart/form-data; "
|
||||
"boundary=---------------------------1977426492562745908748943111");
|
||||
putenv("REQUEST_METHOD=POST");
|
||||
|
||||
printf("cgiInitialize: ");
|
||||
if (cgiInitialize())
|
||||
{
|
||||
const cgi_file_t *file; /* Upload file */
|
||||
|
||||
if ((file = cgiGetFile()) != NULL)
|
||||
{
|
||||
puts("PASS");
|
||||
printf(" tempfile=\"%s\"\n", file->tempfile);
|
||||
printf(" name=\"%s\"\n", file->name);
|
||||
printf(" filename=\"%s\"\n", file->filename);
|
||||
printf(" mimetype=\"%s\"\n", file->mimetype);
|
||||
}
|
||||
else
|
||||
puts("FAIL (no file!)");
|
||||
}
|
||||
else
|
||||
puts("FAIL (init)");
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Help index test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Test the help index code.
|
||||
* list_nodes() - List nodes in an array...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void list_nodes(const char *title, cups_array_t *nodes);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Test the help index code.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
help_index_t *hi, /* Help index */
|
||||
*search; /* Search index */
|
||||
|
||||
|
||||
/*
|
||||
* Load the help index...
|
||||
*/
|
||||
|
||||
hi = helpLoadIndex("testhi.index", ".");
|
||||
|
||||
list_nodes("nodes", hi->nodes);
|
||||
list_nodes("sorted", hi->sorted);
|
||||
|
||||
/*
|
||||
* Do any searches...
|
||||
*/
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
search = helpSearchIndex(hi, argv[1], NULL, argv[2]);
|
||||
|
||||
if (search)
|
||||
{
|
||||
list_nodes(argv[1], search->sorted);
|
||||
helpDeleteIndex(search);
|
||||
}
|
||||
else
|
||||
printf("%s (0 nodes)\n", argv[1]);
|
||||
}
|
||||
|
||||
helpDeleteIndex(hi);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'list_nodes()' - List nodes in an array...
|
||||
*/
|
||||
|
||||
static void
|
||||
list_nodes(const char *title, /* I - Title string */
|
||||
cups_array_t *nodes) /* I - Nodes */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
help_node_t *node; /* Current node */
|
||||
|
||||
|
||||
printf("%s (%d nodes):\n", title, cupsArrayCount(nodes));
|
||||
for (i = 1, node = (help_node_t *)cupsArrayFirst(nodes);
|
||||
node;
|
||||
i ++, node = (help_node_t *)cupsArrayNext(nodes))
|
||||
{
|
||||
if (node->anchor)
|
||||
printf(" %d: %s#%s \"%s\"", i, node->filename, node->anchor,
|
||||
node->text);
|
||||
else
|
||||
printf(" %d: %s \"%s\"", i, node->filename, node->text);
|
||||
|
||||
printf(" (%d words)\n", cupsArrayCount(node->words));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,31 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Test File for Help Index Code</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<P>This is a test file for the help index code. The help index
|
||||
code reads plain HTML and indexes the title and any anchored
|
||||
text, ignoring all other markup. Anchor tags must be on a single
|
||||
line, although the text they wrap may cross multiple lines and be
|
||||
up to 1024 bytes in length.</P>
|
||||
|
||||
<H1><A NAME="FIRST">This is the First Anchor</A></H1>
|
||||
|
||||
<P>This is some text for the <em>first</em> anchor.</P>
|
||||
|
||||
|
||||
<H1><A NAME="2ND">This is the Second Anchor</A></H1>
|
||||
|
||||
<P>This is some text for the first anchor.</P>
|
||||
|
||||
<P>John asked Mary to the dance.</P>
|
||||
|
||||
|
||||
<H1><A NAME="THIRD">This is the Third Anchor</A></H1>
|
||||
|
||||
<P>This is some text for the third anchor. <A NAME="INLINE">This
|
||||
is an in-line anchor that crosses a line.</A></P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI template test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2006 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Test the template code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Test the template code.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char *value; /* Value in name=value */
|
||||
FILE *out; /* Where to send output */
|
||||
|
||||
|
||||
/*
|
||||
* Don't buffer stdout or stderr so that the mixed output is sane...
|
||||
*/
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Loop through the command-line, assigning variables for any args with
|
||||
* "name=value"...
|
||||
*/
|
||||
|
||||
out = stdout;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if (!strcmp(argv[i], "-o"))
|
||||
{
|
||||
i ++;
|
||||
if (i < argc)
|
||||
{
|
||||
out = fopen(argv[i], "w");
|
||||
if (!out)
|
||||
{
|
||||
perror(argv[i]);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "-e"))
|
||||
{
|
||||
i ++;
|
||||
|
||||
if (i < argc)
|
||||
{
|
||||
if (!freopen(argv[i], "w", stderr))
|
||||
{
|
||||
perror(argv[i]);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "-q"))
|
||||
freopen("/dev/null", "w", stderr);
|
||||
else if ((value = strchr(argv[i], '=')) != NULL)
|
||||
{
|
||||
*value++ = '\0';
|
||||
cgiSetVariable(argv[i], value);
|
||||
}
|
||||
else
|
||||
cgiCopyTemplateFile(out, argv[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1043
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -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$".
|
||||
*/
|
||||
+23
-108
@@ -3,14 +3,23 @@
|
||||
#
|
||||
# Configuration file makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1993-2006 by Easy Software Products.
|
||||
# Copyright 1993-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
@@ -19,9 +28,7 @@ include ../Makedefs
|
||||
# Config files...
|
||||
#
|
||||
|
||||
KEEP = cupsd.conf snmp.conf
|
||||
REPLACE = mime.convs mime.types
|
||||
|
||||
FILES = classes.conf cupsd.conf mime.convs mime.types printers.conf
|
||||
|
||||
#
|
||||
# Make everything...
|
||||
@@ -29,117 +36,25 @@ REPLACE = mime.convs mime.types
|
||||
|
||||
all:
|
||||
|
||||
|
||||
#
|
||||
# Make library targets...
|
||||
#
|
||||
|
||||
libs:
|
||||
|
||||
|
||||
#
|
||||
# Make unit tests...
|
||||
#
|
||||
|
||||
unittests:
|
||||
|
||||
|
||||
#
|
||||
# Clean all config and object files...
|
||||
#
|
||||
|
||||
clean:
|
||||
|
||||
|
||||
#
|
||||
# Dummy depend...
|
||||
# Install files...
|
||||
#
|
||||
|
||||
depend:
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all install-data install-headers install-libs install-exec
|
||||
|
||||
|
||||
#
|
||||
# Install data files...
|
||||
#
|
||||
|
||||
install-data:
|
||||
for file in $(KEEP); do \
|
||||
if test -r $(SERVERROOT)/$$file ; then \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file.N || true; \
|
||||
install:
|
||||
-$(MKDIR) $(SERVERROOT)/conf
|
||||
for file in $(FILES); do \
|
||||
if test -e $(SERVERROOT)/conf/$$file ; then \
|
||||
$(CP) $$file $(SERVERROOT)/conf/$$file.N ; \
|
||||
else \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
|
||||
$(CP) $$file $(SERVERROOT)/conf ; \
|
||||
fi ; \
|
||||
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 ; \
|
||||
fi ; \
|
||||
$(INSTALL_DATA) $$file $(DATADIR)/mime ; \
|
||||
done
|
||||
-if test x$(PAMDIR) != x; then \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \
|
||||
if test -r $(BUILDROOT)$(PAMDIR)/cups/$(PAMFILE) ; then \
|
||||
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \
|
||||
fi ; \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install programs...
|
||||
#
|
||||
|
||||
install-exec:
|
||||
|
||||
|
||||
#
|
||||
# Install headers...
|
||||
#
|
||||
|
||||
install-headers:
|
||||
|
||||
|
||||
#
|
||||
# Install libraries...
|
||||
#
|
||||
|
||||
install-libs:
|
||||
|
||||
|
||||
#
|
||||
# Uninstall files...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for file in $(KEEP) $(REPLACE) cupsd.conf.default; do \
|
||||
$(RM) $(SERVERROOT)/$$file; \
|
||||
done
|
||||
-$(RMDIR) $(SERVERROOT)
|
||||
for file in $(REPLACE); do \
|
||||
$(RM) $(DATADIR)/mime/$$file; \
|
||||
done
|
||||
-$(RMDIR) $(DATADIR)/mime
|
||||
-if test x$(PAMDIR) != x; then \
|
||||
$(RM) $(BUILDROOT)$(PAMDIR)/cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(PAMDIR); \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# "$Id: classes.conf 333 1999-05-17 18:03:40Z mike $"
|
||||
#
|
||||
# Sample class configuration file for the Common UNIX Printing System
|
||||
# (CUPS) scheduler.
|
||||
#
|
||||
# Copyright 1997-1999 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44145 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# This is a sample class configuration file. This file is included #
|
||||
# from the main configuration file (cups.conf) and lists all of the #
|
||||
# printer classes known to the system. #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Each class starts with a <Class name> definition. Class names
|
||||
# can be up to 128 characters in length and are *not* case sensitive.
|
||||
#
|
||||
# One <DefaultClass name> entry can appear in this file; if you don't
|
||||
# define a default destination, the first printer or class becomes
|
||||
# the default.
|
||||
#
|
||||
|
||||
#<Class sample>
|
||||
#
|
||||
# Info: the description for the class.
|
||||
#
|
||||
|
||||
#Info Acme LaserPrint 1000 Printers
|
||||
|
||||
#
|
||||
# MoreInfo: a URL for more information on the printer.
|
||||
#
|
||||
|
||||
#MoreInfo http://www.acme.com/lp1000.html
|
||||
|
||||
#
|
||||
# Location: the location of the printer.
|
||||
#
|
||||
|
||||
#Location Room 101 in the activities building
|
||||
|
||||
#
|
||||
# Printer: adds a printer to the class.
|
||||
#
|
||||
|
||||
#Printer sample
|
||||
#Printer sample@host2
|
||||
#</Class>
|
||||
|
||||
#
|
||||
# End of "$Id: classes.conf 333 1999-05-17 18:03:40Z mike $".
|
||||
#
|
||||
@@ -0,0 +1,340 @@
|
||||
#
|
||||
# "$Id: cupsd.conf 429 1999-06-21 19:43:22Z mike $"
|
||||
#
|
||||
# Sample configuration file for the Common UNIX Printing System (CUPS)
|
||||
# scheduler.
|
||||
#
|
||||
# Copyright 1997-1999 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44145 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# This is the CUPS configuration file. If you are familiar with #
|
||||
# Apache or any of the other popular web servers, we've followed the #
|
||||
# same format. Any configuration variable used here has the same #
|
||||
# semantics as the corresponding variable in Apache. If we need #
|
||||
# different functionality then a different name is used to avoid #
|
||||
# confusion... #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Ports/addresses that we listen to. The default port 631 is reserved
|
||||
# for the Internet Printing Protocol (IPP) and is what we use here.
|
||||
#
|
||||
# You can have multiple Port/Listen lines to listen to more than one
|
||||
# port or address, or to restrict access:
|
||||
#
|
||||
# Port 80
|
||||
# Port 631
|
||||
# Listen hostname
|
||||
# Listen hostname:80
|
||||
# Listen hostname:631
|
||||
# Listen 1.2.3.4
|
||||
# Listen 1.2.3.4:631
|
||||
#
|
||||
|
||||
#Port 80
|
||||
Port 631
|
||||
|
||||
#
|
||||
# User/Group: the user and group the server runs under. Normally this
|
||||
# must be lp and sys, however you can configure things for another user
|
||||
# or group as needed.
|
||||
#
|
||||
# Note: the server must be run initially as root to support the
|
||||
# default IPP port of 631. It changes users whenever an external
|
||||
# program is run...
|
||||
#
|
||||
|
||||
User lp
|
||||
Group sys
|
||||
|
||||
#
|
||||
# SystemGroup: the group name for "System" (printer administration)
|
||||
# access.
|
||||
#
|
||||
|
||||
SystemGroup sys
|
||||
|
||||
#
|
||||
# ServerName: the hostname of your server, as advertised to the world.
|
||||
# By default CUPS will use the hostname of the system.
|
||||
#
|
||||
|
||||
#ServerName myhost.domain.com
|
||||
|
||||
#
|
||||
# ServerAdmin: the email address to send all complaints/problems to.
|
||||
# By default CUPS will use "root@hostname".
|
||||
#
|
||||
|
||||
#ServerAdmin root@your.domain.com
|
||||
|
||||
#
|
||||
# ServerRoot: the root directory for the scheduler.
|
||||
# By default the compiled-in value.
|
||||
#
|
||||
|
||||
#ServerRoot /var/cups
|
||||
|
||||
#
|
||||
# AccessLog: the access log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/access_log"
|
||||
#
|
||||
|
||||
#AccessLog logs/access_log
|
||||
|
||||
#
|
||||
# ErrorLog: the error log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/error_log"
|
||||
#
|
||||
|
||||
#ErrorLog logs/error_log
|
||||
|
||||
#
|
||||
# PageLog: the page log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/page_log"
|
||||
#
|
||||
|
||||
#PageLog logs/page_log
|
||||
|
||||
#
|
||||
# LogLevel: controls the number of messages logged to the ErrorLog
|
||||
# file and can be one of the following:
|
||||
#
|
||||
# debug Log everything.
|
||||
# info Log all requests and state changes.
|
||||
# warn Log errors and warnings.
|
||||
# error Log only errors.
|
||||
# none Log nothing.
|
||||
#
|
||||
|
||||
LogLevel info
|
||||
|
||||
#
|
||||
# MaxLogSize: controls the maximum size of each log file before they are
|
||||
# rotated. Defaults to 1048576 (1MB). Set to 0 to disable log rotating.
|
||||
#
|
||||
|
||||
#MaxLogSize 0
|
||||
|
||||
#
|
||||
# MaxRequestSize: controls the maximum size of print files. Set to 0 to
|
||||
# disable this feature (defaults to 0.)
|
||||
#
|
||||
|
||||
#MaxRequestSize 0
|
||||
|
||||
#
|
||||
# HostNameLookups: whether or not to do lookups on IP addresses to get a
|
||||
# fully-qualified hostname. This defaults to Off for performance reasons...
|
||||
#
|
||||
|
||||
#HostNameLookups On
|
||||
|
||||
#
|
||||
# Timeout: the timeout before requests time out. Default is 300 seconds.
|
||||
#
|
||||
|
||||
#Timeout 300
|
||||
|
||||
#
|
||||
# KeepAlive: whether or not to support the Keep-Alive connection
|
||||
# option. Default is on.
|
||||
#
|
||||
|
||||
#KeepAlive On
|
||||
|
||||
#
|
||||
# KeepAliveTimeout: the timeout before Keep-Alive connections are
|
||||
# automatically closed. Default is 60 seconds.
|
||||
#
|
||||
|
||||
#KeepAliveTimeout 60
|
||||
|
||||
#
|
||||
# ImplicitClasses: whether or not to use implicit classes.
|
||||
#
|
||||
# Printer classes can be specified explicitly in the classes.conf
|
||||
# file, implicitly based upon the printers available on the LAN, or
|
||||
# both.
|
||||
#
|
||||
# When ImplicitClasses is On, printers on the LAN with the same name
|
||||
# (e.g. Acme-LaserPrint-1000) will be put into a class with the same
|
||||
# name. This allows you to setup multiple redundant queues on a LAN
|
||||
# without a lot of administrative difficulties. If a user sends a
|
||||
# job to Acme-LaserPrint-1000, the job will go to the first available
|
||||
# queue.
|
||||
#
|
||||
# Enabled by default.
|
||||
#
|
||||
|
||||
#ImplicitClasses On
|
||||
|
||||
#
|
||||
# Browsing: whether or not to broadcast printer information to
|
||||
# other CUPS servers. Enabled by default.
|
||||
#
|
||||
|
||||
#Browsing On
|
||||
|
||||
#
|
||||
# BrowseInterval: the time between browsing updates in seconds. Default
|
||||
# is 30 seconds.
|
||||
#
|
||||
# Note that browsing information is sent whenever a printer's state changes
|
||||
# as well, so this represents the maximum time between updates.
|
||||
#
|
||||
|
||||
#BrowseInterval 30
|
||||
|
||||
#
|
||||
# BrowseTimeout: the timeout for network printers - if we don't
|
||||
# get an update within this time the printer will be removed
|
||||
# from the printer list. This number definitely should not be
|
||||
# less the BrowseInterval value for obvious reasons. Defaults
|
||||
# to 300 seconds.
|
||||
#
|
||||
|
||||
#BrowseTimeout 300
|
||||
|
||||
#
|
||||
# BrowsePort: the port used for UDP broadcasts. By default this is
|
||||
# the IPP port; if you change this you need to do it on all servers.
|
||||
# Only one BrowsePort is recognized.
|
||||
#
|
||||
|
||||
#BrowsePort 631
|
||||
|
||||
#
|
||||
# BrowseAddress: specifies a broadcast address to be used. By
|
||||
# default browsing information is broadcast to all active interfaces.
|
||||
#
|
||||
# Note: HP-UX 10.20 and earlier do not properly handle broadcast unless
|
||||
# you have a Class A, B, C, or D netmask (i.e. no CIDR support).
|
||||
#
|
||||
|
||||
#BrowseAddress x.y.z.255
|
||||
#BrowseAddress x.y.255.255
|
||||
#BrowseAddress x.255.255.255
|
||||
|
||||
#
|
||||
# DocumentRoot: the root directory for HTTP documents that are served.
|
||||
# By default the compiled in directory.
|
||||
#
|
||||
|
||||
#DocumentRoot /usr/share/cups/doc
|
||||
|
||||
#
|
||||
# DefaultLanguage: the default language if not specified by the browser.
|
||||
# If not specified, the current locale is used.
|
||||
#
|
||||
|
||||
#DefaultLanguage en
|
||||
|
||||
#
|
||||
# DefaultCharset: the default character set to use. If not specified,
|
||||
# defaults to iso-8859-1. Note that this can also be overridden in
|
||||
# HTML documents...
|
||||
#
|
||||
|
||||
#DefaultCharset iso-8859-1
|
||||
|
||||
#
|
||||
# RIPCache: the amount of memory that each RIP should use to cache
|
||||
# bitmaps. The value can be any real number followed by "k" for
|
||||
# kilobytes, "m" for megabytes, "g" for gigabytes, or "t" for tiles
|
||||
# (1 tile = 256x256 pixels.) Defaults to "32m" (32 megabytes).
|
||||
#
|
||||
|
||||
#RIPCache: 32m
|
||||
|
||||
#
|
||||
# TempDir: the directory to put temporary files in. This directory must be
|
||||
# writable by the user defined above! Defaults to "/var/tmp" or the value
|
||||
# of the TMPDIR environment variable.
|
||||
#
|
||||
|
||||
#TempDir /var/tmp
|
||||
|
||||
#
|
||||
# Access permissions for each directory served by the scheduler.
|
||||
# Locations are relative to DocumentRoot...
|
||||
#
|
||||
# AuthType: the authorization to use; currently only "Basic" authorization is
|
||||
# supported.
|
||||
#
|
||||
# AuthClass: the authorization class; currently only "Anonymous", "User",
|
||||
# "System" (valid user belonging to group SystemGroup), and "Group"
|
||||
# (valid user belonging to the specified group) are supported.
|
||||
#
|
||||
# AuthGroupName: the group name for "Group" authorization.
|
||||
#
|
||||
# Order: the order of Allow/Deny processing.
|
||||
#
|
||||
# Allow: allows access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
# Deny: denies access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
|
||||
<Location />
|
||||
</Location>
|
||||
|
||||
<Location /printers>
|
||||
#
|
||||
# You may wish to limit access to printers and classes, either with Allow
|
||||
# and Deny lines, or by requiring a username and password.
|
||||
#
|
||||
|
||||
## Require a username and password
|
||||
#AuthType Basic
|
||||
#AuthClass User
|
||||
|
||||
## Restrict access to local domain
|
||||
#Order Deny,Allow
|
||||
#Deny From All
|
||||
#Allow From .mydomain.com
|
||||
</Location>
|
||||
|
||||
<Location /admin>
|
||||
#
|
||||
# You definitely will want to limit access to the administration tools.
|
||||
# The default configuration requires a local connection from a user who
|
||||
# is a member of group "sys" to do any admin tasks. You can change the
|
||||
# group name using the SystemGroup directive.
|
||||
#
|
||||
|
||||
AuthType Basic
|
||||
AuthClass System
|
||||
|
||||
## Restrict access to local domain
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
Allow From 127.0.0.1
|
||||
</Location>
|
||||
|
||||
#
|
||||
# End of "$Id: cupsd.conf 429 1999-06-21 19:43:22Z mike $".
|
||||
#
|
||||
@@ -0,0 +1,250 @@
|
||||
#
|
||||
# "$Id: cupsd.conf-personal 407 1999-06-17 20:02:43Z mike $"
|
||||
#
|
||||
# Scheduler configuration file for ESP Print Personal.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# This is the CUPS configuration file. If you are familiar with #
|
||||
# Apache or any of the other popular web servers, we've followed the #
|
||||
# same format. Any configuration variable used here has the same #
|
||||
# semantics as the corresponding variable in Apache. If we need #
|
||||
# different functionality then a different name is used to avoid #
|
||||
# confusion... #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Ports/addresses that we listen to. The default port 631 is reserved
|
||||
# for the Internet Printing Protocol (IPP) and is what we use here.
|
||||
#
|
||||
# You can have multiple Listen lines to listen to more than one
|
||||
# port:
|
||||
#
|
||||
# Listen 127.0.0.1:80
|
||||
# Listen 127.0.0.1:631
|
||||
#
|
||||
# For ESP Print Personal, we can only listen on the local host...
|
||||
#
|
||||
|
||||
#Listen 127.0.0.1:80
|
||||
Listen 127.0.0.1:631
|
||||
|
||||
#
|
||||
# User/Group: the user and group the server runs under. Normally this
|
||||
# must be lp and sys, however you can configure things for another user
|
||||
# or group as needed.
|
||||
#
|
||||
# Note: the server must be run initially as root to support the
|
||||
# default IPP port of 631. It changes users whenever an external
|
||||
# program is run...
|
||||
#
|
||||
|
||||
User lp
|
||||
Group sys
|
||||
|
||||
#
|
||||
# SystemGroup: the group name for "System" (printer administration)
|
||||
# access.
|
||||
#
|
||||
|
||||
SystemGroup sys
|
||||
|
||||
#
|
||||
# ServerName: the hostname of your server, as advertised to the world.
|
||||
# By default CUPS will use the hostname of the system.
|
||||
#
|
||||
|
||||
#ServerName myhost.domain.com
|
||||
|
||||
#
|
||||
# ServerAdmin: the email address to send all complaints/problems to.
|
||||
# By default CUPS will use "root@hostname".
|
||||
#
|
||||
|
||||
#ServerAdmin root@your.domain.com
|
||||
|
||||
#
|
||||
# ServerRoot: the root directory for the scheduler.
|
||||
# By default the compiled-in value.
|
||||
#
|
||||
|
||||
#ServerRoot /var/cups
|
||||
|
||||
#
|
||||
# AccessLog: the access log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/access_log"
|
||||
#
|
||||
|
||||
#AccessLog logs/access_log
|
||||
|
||||
#
|
||||
# ErrorLog: the error log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/error_log"
|
||||
#
|
||||
|
||||
#ErrorLog logs/error_log
|
||||
|
||||
#
|
||||
# PageLog: the page log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/page_log"
|
||||
#
|
||||
|
||||
#PageLog logs/page_log
|
||||
|
||||
#
|
||||
# LogLevel: controls the number of messages logged to the ErrorLog
|
||||
# file and can be one of the following:
|
||||
#
|
||||
# debug Log everything.
|
||||
# info Log all requests and state changes.
|
||||
# warn Log errors and warnings.
|
||||
# error Log only errors.
|
||||
# none Log nothing.
|
||||
#
|
||||
|
||||
LogLevel info
|
||||
|
||||
#
|
||||
# MaxLogSize: controls the maximum size of each log file before they are
|
||||
# rotated. Defaults to 1048576 (1MB). Set to 0 to disable log rotating.
|
||||
#
|
||||
|
||||
#MaxLogSize 0
|
||||
|
||||
#
|
||||
# MaxRequestSize: controls the maximum size of print files. Set to 0 to
|
||||
# disable this feature (defaults to 0.)
|
||||
#
|
||||
|
||||
#MaxRequestSize 0
|
||||
|
||||
#
|
||||
# HostNameLookups: whether or not to do lookups on IP addresses to get a
|
||||
# fully-qualified hostname. This defaults to Off for performance reasons...
|
||||
#
|
||||
|
||||
#HostNameLookups On
|
||||
|
||||
#
|
||||
# Timeout: the timeout before requests time out. Default is 300 seconds.
|
||||
#
|
||||
|
||||
#Timeout 300
|
||||
|
||||
#
|
||||
# KeepAlive: whether or not to support the Keep-Alive connection
|
||||
# option. Default is on.
|
||||
#
|
||||
|
||||
#KeepAlive On
|
||||
|
||||
#
|
||||
# KeepAliveTimeout: the timeout before Keep-Alive connections are
|
||||
# automatically closed. Default is 60 seconds.
|
||||
#
|
||||
|
||||
#KeepAliveTimeout 60
|
||||
|
||||
#
|
||||
# Browsing: not available in ESP Print Personal.
|
||||
#
|
||||
|
||||
Browsing Off
|
||||
|
||||
#
|
||||
# DocumentRoot: the root directory for HTTP documents that are served.
|
||||
# By default the compiled in directory.
|
||||
#
|
||||
|
||||
#DocumentRoot /usr/share/cups/doc
|
||||
|
||||
#
|
||||
# DefaultLanguage: the default language if not specified by the browser.
|
||||
# If not specified, the current locale is used.
|
||||
#
|
||||
|
||||
#DefaultLanguage en
|
||||
|
||||
#
|
||||
# DefaultCharset: the default character set to use. If not specified,
|
||||
# defaults to iso-8859-1. Note that this can also be overridden in
|
||||
# HTML documents...
|
||||
#
|
||||
|
||||
#DefaultCharset iso-8859-1
|
||||
|
||||
#
|
||||
# RIPCache: the amount of memory that each RIP should use to cache
|
||||
# bitmaps. The value can be any real number followed by "k" for
|
||||
# kilobytes, "m" for megabytes, "g" for gigabytes, or "t" for tiles
|
||||
# (1 tile = 256x256 pixels.) Defaults to "32m" (32 megabytes).
|
||||
#
|
||||
|
||||
#RIPCache: 32m
|
||||
|
||||
#
|
||||
# Access permissions for each directory served by the scheduler.
|
||||
# Locations are relative to DocumentRoot...
|
||||
#
|
||||
# AuthType: the authorization to use; currently only "Basic" authorization is
|
||||
# supported.
|
||||
#
|
||||
# AuthClass: the authorization class; currently only "Anonymous", "User",
|
||||
# "System" (valid user belonging to group SystemGroup), and "Group"
|
||||
# (valid user belonging to the specified group) are supported.
|
||||
#
|
||||
# AuthGroupName: the group name for "Group" authorization.
|
||||
#
|
||||
# Order: the order of Allow/Deny processing.
|
||||
#
|
||||
# Allow: allows access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
# Deny: denies access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
|
||||
<Location />
|
||||
</Location>
|
||||
|
||||
<Location /printers>
|
||||
#
|
||||
# You may wish to limit access to printers and classes, either with Allow
|
||||
# and Deny lines, or by requiring a username and password.
|
||||
#
|
||||
|
||||
## Require a username and password
|
||||
#AuthType Basic
|
||||
#AuthClass User
|
||||
|
||||
## Restrict access to local domain
|
||||
#Order Deny,Allow
|
||||
#Deny From All
|
||||
#Allow From .mydomain.com
|
||||
</Location>
|
||||
|
||||
<Location /admin>
|
||||
#
|
||||
# You definitely will want to limit access to the administration tools.
|
||||
# The default configuration requires a local connection from a user who
|
||||
# is a member of group "sys" to do any admin tasks. You can change the
|
||||
# group name using the SystemGroup directive.
|
||||
#
|
||||
|
||||
AuthType Basic
|
||||
AuthClass System
|
||||
|
||||
## Restrict access to local domain
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
Allow From 127.0.0.1
|
||||
</Location>
|
||||
|
||||
#
|
||||
# End of "$Id: cupsd.conf-personal 407 1999-06-17 20:02:43Z mike $".
|
||||
#
|
||||
@@ -0,0 +1,313 @@
|
||||
#
|
||||
# "$Id: cupsd.conf-professional 407 1999-06-17 20:02:43Z mike $"
|
||||
#
|
||||
# Scheduler configuration file for ESP Print Professional.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# This is the CUPS configuration file. If you are familiar with #
|
||||
# Apache or any of the other popular web servers, we've followed the #
|
||||
# same format. Any configuration variable used here has the same #
|
||||
# semantics as the corresponding variable in Apache. If we need #
|
||||
# different functionality then a different name is used to avoid #
|
||||
# confusion... #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Ports/addresses that we listen to. The default port 631 is reserved
|
||||
# for the Internet Printing Protocol (IPP) and is what we use here.
|
||||
#
|
||||
# You can have multiple Port/Listen lines to listen to more than one
|
||||
# port or address, or to restrict access:
|
||||
#
|
||||
# Port 80
|
||||
# Port 631
|
||||
# Listen hostname
|
||||
# Listen hostname:80
|
||||
# Listen hostname:631
|
||||
# Listen 1.2.3.4
|
||||
# Listen 1.2.3.4:631
|
||||
#
|
||||
|
||||
#Port 80
|
||||
Port 631
|
||||
|
||||
#
|
||||
# User/Group: the user and group the server runs under. Normally this
|
||||
# must be lp and sys, however you can configure things for another user
|
||||
# or group as needed.
|
||||
#
|
||||
# Note: the server must be run initially as root to support the
|
||||
# default IPP port of 631. It changes users whenever an external
|
||||
# program is run...
|
||||
#
|
||||
|
||||
User lp
|
||||
Group sys
|
||||
|
||||
#
|
||||
# SystemGroup: the group name for "System" (printer administration)
|
||||
# access.
|
||||
#
|
||||
|
||||
SystemGroup sys
|
||||
|
||||
#
|
||||
# ServerName: the hostname of your server, as advertised to the world.
|
||||
# By default CUPS will use the hostname of the system.
|
||||
#
|
||||
|
||||
#ServerName myhost.domain.com
|
||||
|
||||
#
|
||||
# ServerAdmin: the email address to send all complaints/problems to.
|
||||
# By default CUPS will use "root@hostname".
|
||||
#
|
||||
|
||||
#ServerAdmin root@your.domain.com
|
||||
|
||||
#
|
||||
# ServerRoot: the root directory for the scheduler.
|
||||
# By default the compiled-in value.
|
||||
#
|
||||
|
||||
#ServerRoot /var/cups
|
||||
|
||||
#
|
||||
# AccessLog: the access log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/access_log"
|
||||
#
|
||||
|
||||
#AccessLog logs/access_log
|
||||
|
||||
#
|
||||
# ErrorLog: the error log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/error_log"
|
||||
#
|
||||
|
||||
#ErrorLog logs/error_log
|
||||
|
||||
#
|
||||
# PageLog: the page log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/page_log"
|
||||
#
|
||||
|
||||
#PageLog logs/page_log
|
||||
|
||||
#
|
||||
# LogLevel: controls the number of messages logged to the ErrorLog
|
||||
# file and can be one of the following:
|
||||
#
|
||||
# debug Log everything.
|
||||
# info Log all requests and state changes.
|
||||
# warn Log errors and warnings.
|
||||
# error Log only errors.
|
||||
# none Log nothing.
|
||||
#
|
||||
|
||||
LogLevel info
|
||||
|
||||
#
|
||||
# MaxLogSize: controls the maximum size of each log file before they are
|
||||
# rotated. Defaults to 1048576 (1MB). Set to 0 to disable log rotating.
|
||||
#
|
||||
|
||||
#MaxLogSize 0
|
||||
|
||||
#
|
||||
# MaxRequestSize: controls the maximum size of print files. Set to 0 to
|
||||
# disable this feature (defaults to 0.)
|
||||
#
|
||||
|
||||
#MaxRequestSize 0
|
||||
|
||||
#
|
||||
# HostNameLookups: whether or not to do lookups on IP addresses to get a
|
||||
# fully-qualified hostname. This defaults to Off for performance reasons...
|
||||
#
|
||||
|
||||
#HostNameLookups On
|
||||
|
||||
#
|
||||
# Timeout: the timeout before requests time out. Default is 300 seconds.
|
||||
#
|
||||
|
||||
#Timeout 300
|
||||
|
||||
#
|
||||
# KeepAlive: whether or not to support the Keep-Alive connection
|
||||
# option. Default is on.
|
||||
#
|
||||
|
||||
#KeepAlive On
|
||||
|
||||
#
|
||||
# KeepAliveTimeout: the timeout before Keep-Alive connections are
|
||||
# automatically closed. Default is 60 seconds.
|
||||
#
|
||||
|
||||
#KeepAliveTimeout 60
|
||||
|
||||
#
|
||||
# ImplicitClasses: whether or not to use implicit classes.
|
||||
#
|
||||
# Printer classes can be specified explicitly in the classes.conf
|
||||
# file, implicitly based upon the printers available on the LAN, or
|
||||
# both.
|
||||
#
|
||||
# When ImplicitClasses is On, printers on the LAN with the same name
|
||||
# (e.g. Acme-LaserPrint-1000) will be put into a class with the same
|
||||
# name. This allows you to setup multiple redundant queues on a LAN
|
||||
# without a lot of administrative difficulties. If a user sends a
|
||||
# job to Acme-LaserPrint-1000, the job will go to the first available
|
||||
# queue.
|
||||
#
|
||||
# Enabled by default.
|
||||
#
|
||||
|
||||
#ImplicitClasses On
|
||||
|
||||
#
|
||||
# Browsing: whether or not to broadcast printer information to
|
||||
# other CUPS servers. Enabled by default.
|
||||
#
|
||||
|
||||
#Browsing On
|
||||
|
||||
#
|
||||
# BrowseInterval: the time between browsing updates in seconds. Default
|
||||
# is 30 seconds.
|
||||
#
|
||||
# Note that browsing information is sent whenever a printer's state changes
|
||||
# as well, so this represents the maximum time between updates.
|
||||
#
|
||||
|
||||
#BrowseInterval 30
|
||||
|
||||
#
|
||||
# BrowseTimeout: the timeout for network printers - if we don't
|
||||
# get an update within this time the printer will be removed
|
||||
# from the printer list. This number definitely should not be
|
||||
# less the BrowseInterval value for obvious reasons. Defaults
|
||||
# to 300 seconds.
|
||||
#
|
||||
|
||||
#BrowseTimeout 300
|
||||
|
||||
#
|
||||
# BrowsePort: the port used for UDP broadcasts. By default this is
|
||||
# the IPP port; if you change this you need to do it on all servers.
|
||||
# Only one BrowsePort is recognized.
|
||||
#
|
||||
|
||||
#BrowsePort 631
|
||||
|
||||
#
|
||||
# BrowseAddress: specifies a broadcast address to be used. By
|
||||
# default browsing information is broadcast to all active interfaces.
|
||||
#
|
||||
# Note: HP-UX 10.20 and earlier do not properly handle broadcast unless
|
||||
# you have a Class A, B, C, or D netmask (i.e. no CIDR support).
|
||||
#
|
||||
|
||||
#BrowseAddress x.y.z.255
|
||||
#BrowseAddress x.y.255.255
|
||||
#BrowseAddress x.255.255.255
|
||||
|
||||
#
|
||||
# DocumentRoot: the root directory for HTTP documents that are served.
|
||||
# By default the compiled in directory.
|
||||
#
|
||||
|
||||
#DocumentRoot /usr/share/cups/doc
|
||||
|
||||
#
|
||||
# DefaultLanguage: the default language if not specified by the browser.
|
||||
# If not specified, the current locale is used.
|
||||
#
|
||||
|
||||
#DefaultLanguage en
|
||||
|
||||
#
|
||||
# DefaultCharset: the default character set to use. If not specified,
|
||||
# defaults to iso-8859-1. Note that this can also be overridden in
|
||||
# HTML documents...
|
||||
#
|
||||
|
||||
#DefaultCharset iso-8859-1
|
||||
|
||||
#
|
||||
# RIPCache: the amount of memory that each RIP should use to cache
|
||||
# bitmaps. The value can be any real number followed by "k" for
|
||||
# kilobytes, "m" for megabytes, "g" for gigabytes, or "t" for tiles
|
||||
# (1 tile = 256x256 pixels.) Defaults to "32m" (32 megabytes).
|
||||
#
|
||||
|
||||
#RIPCache: 32m
|
||||
|
||||
#
|
||||
# Access permissions for each directory served by the scheduler.
|
||||
# Locations are relative to DocumentRoot...
|
||||
#
|
||||
# AuthType: the authorization to use; currently only "Basic" authorization is
|
||||
# supported.
|
||||
#
|
||||
# AuthClass: the authorization class; currently only "Anonymous", "User",
|
||||
# "System" (valid user belonging to group SystemGroup), and "Group"
|
||||
# (valid user belonging to the specified group) are supported.
|
||||
#
|
||||
# AuthGroupName: the group name for "Group" authorization.
|
||||
#
|
||||
# Order: the order of Allow/Deny processing.
|
||||
#
|
||||
# Allow: allows access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
# Deny: denies access from the specified hostname, domain, IP address, or
|
||||
# network.
|
||||
#
|
||||
|
||||
<Location />
|
||||
</Location>
|
||||
|
||||
<Location /printers>
|
||||
#
|
||||
# You may wish to limit access to printers and classes, either with Allow
|
||||
# and Deny lines, or by requiring a username and password.
|
||||
#
|
||||
|
||||
## Require a username and password
|
||||
#AuthType Basic
|
||||
#AuthClass User
|
||||
|
||||
## Restrict access to local domain
|
||||
#Order Deny,Allow
|
||||
#Deny From All
|
||||
#Allow From .mydomain.com
|
||||
</Location>
|
||||
|
||||
<Location /admin>
|
||||
#
|
||||
# You definitely will want to limit access to the administration tools.
|
||||
# The default configuration requires a local connection from a user who
|
||||
# is a member of group "sys" to do any admin tasks. You can change the
|
||||
# group name using the SystemGroup directive.
|
||||
#
|
||||
|
||||
AuthType Basic
|
||||
AuthClass System
|
||||
|
||||
## Restrict access to local domain
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
Allow From 127.0.0.1
|
||||
</Location>
|
||||
|
||||
#
|
||||
# End of "$Id: cupsd.conf-professional 407 1999-06-17 20:02:43Z mike $".
|
||||
#
|
||||
@@ -1,124 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Sample configuration file for the Common UNIX Printing System (CUPS)
|
||||
# scheduler. See "man cupsd.conf" for a complete description of this
|
||||
# file.
|
||||
#
|
||||
|
||||
# Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
|
||||
# for troubleshooting...
|
||||
LogLevel @CUPS_LOG_LEVEL@
|
||||
|
||||
# Administrator user group...
|
||||
SystemGroup @CUPS_SYSTEM_GROUPS@
|
||||
@CUPS_SYSTEM_AUTHKEY@
|
||||
|
||||
# Only listen for connections from the local machine.
|
||||
Listen localhost:@DEFAULT_IPP_PORT@
|
||||
@CUPS_LISTEN_DOMAINSOCKET@
|
||||
|
||||
# Show shared printers on the local network.
|
||||
Browsing On
|
||||
BrowseOrder allow,deny
|
||||
BrowseAllow all
|
||||
BrowseLocalProtocols @CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS@
|
||||
|
||||
# Default authentication type, when authentication is required...
|
||||
DefaultAuthType Basic
|
||||
|
||||
# Restrict access to the server...
|
||||
<Location />
|
||||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
# Restrict access to the admin pages...
|
||||
<Location /admin>
|
||||
@ENCRYPTION_REQUIRED@
|
||||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
# Restrict access to configuration files...
|
||||
<Location /admin/conf>
|
||||
AuthType Default
|
||||
Require user @SYSTEM
|
||||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
# Set the default printer/job policies...
|
||||
<Policy default>
|
||||
# Job-related operations must be done by the owner or an administrator...
|
||||
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job 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
|
||||
Require user @OWNER @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# All administration operations require an administrator to authenticate...
|
||||
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
|
||||
AuthType Default
|
||||
Require user @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# All printer operations require a printer operator to authenticate...
|
||||
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After 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>
|
||||
AuthType Default
|
||||
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
<Limit All>
|
||||
AuthType Default
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
</Policy>
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# "$Id: mime.convs 237 1999-04-21 19:29:35Z mike $"
|
||||
#
|
||||
# MIME converts file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-1999 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Format of Lines:
|
||||
#
|
||||
# source/type destination/type cost filter
|
||||
#
|
||||
# General Notes:
|
||||
#
|
||||
# Currently the "cost" field is not used (all filters are assumed to
|
||||
# be equally costly in terms of speed/memory). Also, a filter program
|
||||
# *must* accept the standard command-line arguments (job-id, user, title,
|
||||
# copies,options,[filename or stdin]) or this won't work.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PostScript filters
|
||||
#
|
||||
|
||||
application/msword application/postscript 50 mswordtops
|
||||
application/pdf application/postscript 50 pdftops
|
||||
application/postscript application/vnd.cups-postscript 50 pstops
|
||||
application/vnd.hp-HPGL application/postscript 50 hpgltops
|
||||
image/* application/vnd.cups-postscript 50 imagetops
|
||||
text/html application/postscript 50 htmltops
|
||||
text/plain application/postscript 50 texttops
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raster filters...
|
||||
#
|
||||
|
||||
image/* application/vnd.cups-raster 50 imagetoraster
|
||||
application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster
|
||||
|
||||
#
|
||||
# End of "$Id: mime.convs 237 1999-04-21 19:29:35Z mike $".
|
||||
#
|
||||
@@ -1,103 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
|
||||
# VERSIONS OF CUPS. Instead, create a "local.convs" file that
|
||||
# reflects your local configuration changes.
|
||||
#
|
||||
# MIME converts file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# 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/".
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Format of Lines:
|
||||
#
|
||||
# source/type destination/type cost filter
|
||||
#
|
||||
# General Notes:
|
||||
#
|
||||
# The "cost" field is used to find the least costly filters to run
|
||||
# when converting a job file to a printable format.
|
||||
#
|
||||
# All filters *must* accept the standard command-line arguments
|
||||
# (job-id, user, title, copies, options, [filename or stdin]) to
|
||||
# work with CUPS.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PostScript filters
|
||||
#
|
||||
|
||||
application/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
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# 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
|
||||
|
||||
# pstoraster is part of GPL Ghostscript...
|
||||
application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raw filter...
|
||||
#
|
||||
# Uncomment the following filter to allow printing of arbitrary files
|
||||
# without the -oraw option.
|
||||
#
|
||||
|
||||
@DEFAULT_RAW_PRINTING@application/octet-stream application/vnd.cups-raw 0 -
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
+37
-93
@@ -1,20 +1,25 @@
|
||||
#
|
||||
# "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $"
|
||||
# "$Id: mime.types 185 1999-03-24 18:38:50Z mike $"
|
||||
#
|
||||
# MIME types file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
|
||||
# VERSIONS OF CUPS. Instead, create a "local.types" file that
|
||||
# reflects your local configuration changes.
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products.
|
||||
# Copyright 1997-1999 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/".
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
########################################################################
|
||||
@@ -33,18 +38,13 @@
|
||||
# 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)
|
||||
# (CR, NL, TAB, BS, 32-126, 160-254)
|
||||
# string(offset,"string") True if bytes are identical to string
|
||||
# istring(offset,"string") True if bytes are identical to
|
||||
# case-insensitive string
|
||||
# char(offset,value) True if byte is identical
|
||||
# short(offset,value) True if 16-bit integer is identical
|
||||
# int(offset,value) True if 32-bit integer is identical
|
||||
# locale("string") True if current locale matches string
|
||||
# contains(offset,range,"string") True if the range contains the string
|
||||
#
|
||||
# General Notes:
|
||||
#
|
||||
@@ -56,10 +56,10 @@
|
||||
# type in the sorted list.
|
||||
#
|
||||
# The "printable" rule differs from the "ascii" rule in that it also
|
||||
# accepts 8-bit characters in the range 128-255.
|
||||
# accepts 8-bit characters in the range 160-254.
|
||||
#
|
||||
# String constants must be surrounded by "" if they contain whitespace.
|
||||
# To insert binary data into a string, use the <hex> notation.
|
||||
# To instead binary data into a string, use the <hex> notation.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
@@ -67,24 +67,12 @@
|
||||
# Application-generated files...
|
||||
#
|
||||
|
||||
#application/msword doc string(0,<D0CF11E0A1B11AE1>)
|
||||
application/msword doc string(0,<D0CF11E0A1B11AE1>)
|
||||
application/pdf pdf string(0,%PDF)
|
||||
application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
|
||||
contains(0,128,<1B>%-12345X) + \
|
||||
(contains(0,4096,"LANGUAGE=POSTSCRIPT") \
|
||||
contains(0,4096,"LANGUAGE = Postscript") \
|
||||
contains(0,4096,"LANGUAGE = PostScript") \
|
||||
contains(0,4096,"LANGUAGE = POSTSCRIPT") \
|
||||
(contains(0,4096,<0a>%!) + \
|
||||
!contains(0,4096,"ENTER LANGUAGE")))
|
||||
application/vnd.hp-HPGL hpgl \
|
||||
string(0,<1B>E<1B>%0B) \
|
||||
string(0,<1B>%-1B) string(0,<201B>)\
|
||||
string(0,BP;) string(0,IN;) string(0,DF;) \
|
||||
string(0,BPINPS;) \
|
||||
(contains(0,128,<1B>%-12345X) + \
|
||||
(contains(0,4096,"LANGUAGE=HPGL") \
|
||||
contains(0,4096,"LANGUAGE = HPGL")))
|
||||
application/postscript ai eps ps string(0,%!) string(0,<04>%!)
|
||||
application/vnd.hp-HPGL hpgl string(0,<1b>%) string(0,<1b>&)\
|
||||
string(0,<1b>E) string(0,<201b>)\
|
||||
string(0,BP;) string(0,IN;) string(0,DF;)
|
||||
|
||||
########################################################################
|
||||
#
|
||||
@@ -93,12 +81,8 @@ application/vnd.hp-HPGL hpgl \
|
||||
|
||||
image/gif gif string(0,GIF87a) string(0,GIF89a)
|
||||
image/png png string(0,<89>PNG)
|
||||
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
|
||||
(char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
|
||||
char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
|
||||
char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
|
||||
char(3,0xec) char(3,0xed) char(3,0xee) char(3,0xef))
|
||||
image/tiff tiff tif string(0,MM<002A>) string(0,II<2A00>)
|
||||
image/jpeg jpeg jpg jpe string(6,JFIF)
|
||||
image/tiff tiff tif string(0,MM) string(0,II)
|
||||
image/x-photocd pcd string(2048,PCD_IPI)
|
||||
image/x-portable-anymap pnm
|
||||
image/x-portable-bitmap pbm string(0,P1) string(0,P4)
|
||||
@@ -107,73 +91,33 @@ image/x-portable-pixmap ppm string(0,P3) string(0,P6)
|
||||
image/x-sgi-rgb rgb sgi bw icon short(0,474)
|
||||
image/x-xbitmap xbm
|
||||
image/x-xpixmap xpm ascii(0,1024) + string(3,"XPM")
|
||||
#image/x-xwindowdump xwd string(4,<00000007>)
|
||||
image/x-sun-raster ras string(0,<59a66a95>)
|
||||
image/x-xwindowdump xwd
|
||||
|
||||
#image/fpx fpx
|
||||
image/x-alias pix short(8,8) short(8,24)
|
||||
image/x-bitmap bmp string(0,BM) && !printable(2,14)
|
||||
image/x-icon ico
|
||||
# TODO: Add Sun Raster, Alias, SoftImage, GIMP??? files
|
||||
|
||||
image/x-sun-raster ras
|
||||
#image/x-alias pix
|
||||
#image/x-softimage
|
||||
#image/x-gimp-xcf xcf xcf.gz
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Text files...
|
||||
#
|
||||
|
||||
application/x-cshell csh printable(0,1024) + string(0,#!) +\
|
||||
(contains(2,80,/csh) contains(2,80,/tcsh))
|
||||
application/x-perl pl printable(0,1024) + string(0,#!) +\
|
||||
contains(2,80,/perl)
|
||||
application/x-shell sh printable(0,1024) + string(0,#!) +\
|
||||
(contains(2,80,/bash) contains(2,80,/ksh)\
|
||||
contains(2,80,/sh) contains(2,80,/zsh))
|
||||
application/x-csource c cxx cpp cc C h hpp \
|
||||
printable(0,1024) + \
|
||||
(string(0,/*) string(0,//)
|
||||
string(0,#include) contains(0,1024,<0a>#include) \
|
||||
string(0,#define) contains(0,1024,<0a>#define))
|
||||
text/html html htm printable(0,1024) +\
|
||||
(istring(0,"<HTML>") istring(0,"<!DOCTYPE"))
|
||||
(string(0,"<HTML>") string(0,"<!DOCTYPE"))
|
||||
text/plain txt printable(0,1024)
|
||||
text/css css
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# RSS feed type...
|
||||
#
|
||||
|
||||
application/rss+xml rss
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# CUPS-specific types...
|
||||
#
|
||||
|
||||
application/vnd.cups-banner string(0,'#CUPS-BANNER')
|
||||
application/vnd.cups-command string(0,'#CUPS-COMMAND')
|
||||
application/vnd.cups-pdf
|
||||
application/vnd.cups-postscript
|
||||
application/vnd.cups-ppd ppd string(0,"*PPD-Adobe:")
|
||||
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \
|
||||
string(0,"RaS2") string(0,"2SaR") \
|
||||
string(0,"RaS3") string(0,"3SaR")
|
||||
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
string(0,<1B>@) \
|
||||
(contains(0,128,<1B>%-12345X) + \
|
||||
(contains(0,4096,"LANGUAGE=PCL") \
|
||||
contains(0,4096,"LANGUAGE = PCL")))
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raw print file support...
|
||||
#
|
||||
# Comment the following type to prevent raw file printing.
|
||||
#
|
||||
|
||||
application/octet-stream
|
||||
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
|
||||
application/vnd.cups-raw
|
||||
|
||||
#
|
||||
# End of "$Id: mime.types 7995 2008-10-01 04:48:33Z mike $".
|
||||
# End of "$Id: mime.types 185 1999-03-24 18:38:50Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#%PAM-1.0
|
||||
auth required pam_unix.so shadow nodelay nullok
|
||||
account required pam_unix.so
|
||||
@@ -1,5 +0,0 @@
|
||||
# cups: auth account password session
|
||||
auth required pam_opendirectory.so
|
||||
account required pam_permit.so
|
||||
password required pam_deny.so
|
||||
session required pam_permit.so
|
||||
@@ -1,7 +0,0 @@
|
||||
# cups: auth account password session
|
||||
auth sufficient pam_securityserver.so
|
||||
auth sufficient pam_unix.so
|
||||
auth required pam_deny.so
|
||||
account required pam_permit.so
|
||||
password required pam_deny.so
|
||||
session required pam_permit.so
|
||||
@@ -1,2 +0,0 @@
|
||||
auth required @PAMMOD@ nullok shadow
|
||||
account required @PAMMOD@
|
||||
@@ -0,0 +1,89 @@
|
||||
#
|
||||
# "$Id: printers.conf 334 1999-05-17 18:11:26Z mike $"
|
||||
#
|
||||
# Sample printer configuration file for the Common UNIX Printing System
|
||||
# (CUPS) scheduler.
|
||||
#
|
||||
# Copyright 1997-1999 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44145 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3111 USA
|
||||
#
|
||||
# Voice: (301) 373-9603
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# This is a sample printer configuration file. This file is included #
|
||||
# from the main configuration file (cups.conf) and lists all of the #
|
||||
# printers known to the system. #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Each printer starts with a <Printer name> definition. Printer names
|
||||
# can be up to 128 characters in length and are *not* case sensitive.
|
||||
#
|
||||
# One <DefaultPrinter name> entry can appear in this file; if you don't
|
||||
# define a default destination, the first printer or class becomes the
|
||||
# default.
|
||||
#
|
||||
|
||||
#<Printer sample>
|
||||
#
|
||||
# Info: the description for the printer.
|
||||
#
|
||||
|
||||
#Info Acme LaserPrint 1000
|
||||
|
||||
#
|
||||
# MoreInfo: a URL for more information on the printer.
|
||||
#
|
||||
|
||||
#MoreInfo http://www.acme.com/lp1000.html
|
||||
|
||||
#
|
||||
# Location: the location of the printer.
|
||||
#
|
||||
|
||||
#Location Room 101 in the activities building
|
||||
|
||||
#
|
||||
# DeviceURI: the device URI for this printer.
|
||||
#
|
||||
|
||||
#DeviceURI parallel:/dev/plp
|
||||
#DeviceURI serial:/dev/ttyd1?baud=38400+size=8+parity=none+flow=soft
|
||||
#DeviceURI scsi:/dev/scsi/sc1d6l0
|
||||
#DeviceURI socket://hostname:port
|
||||
#DeviceURI tftp://hostname/path
|
||||
#DeviceURI ftp://hostname/path
|
||||
#DeviceURI http://hostname[:port]/path
|
||||
#DeviceURI ipp://hostname/path
|
||||
#DeviceURI smb://hostname/printer
|
||||
|
||||
#
|
||||
# State: sets the initial state of the printer. Can be one of the
|
||||
# following:
|
||||
#
|
||||
# Idle - Printer is available to accept new jobs.
|
||||
# Stopped - Printer is disabled but accepting new jobs.
|
||||
#
|
||||
|
||||
#State Idle
|
||||
#</Printer>
|
||||
|
||||
#
|
||||
# End of "$Id: printers.conf 334 1999-05-17 18:11:26Z mike $".
|
||||
#
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Sample SNMP configuration file for CUPS. See "man cups-smnp.conf" for a
|
||||
# complete description of this file.
|
||||
#
|
||||
|
||||
@CUPS_SNMP_ADDRESS@
|
||||
@CUPS_SNMP_COMMUNITY@
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -1,140 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl 32/64-bit library support stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
dnl Setup support for separate 32/64-bit library generation...
|
||||
AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
|
||||
|
||||
INSTALL32=""
|
||||
LIB32CUPS=""
|
||||
LIB32CUPSIMAGE=""
|
||||
LIB32DIR=""
|
||||
UNINSTALL32=""
|
||||
|
||||
AC_SUBST(INSTALL32)
|
||||
AC_SUBST(LIB32CUPS)
|
||||
AC_SUBST(LIB32CUPSIMAGE)
|
||||
AC_SUBST(LIB32DIR)
|
||||
AC_SUBST(UNINSTALL32)
|
||||
|
||||
AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
|
||||
|
||||
INSTALL64=""
|
||||
LIB64CUPS=""
|
||||
LIB64CUPSIMAGE=""
|
||||
LIB64DIR=""
|
||||
UNINSTALL64=""
|
||||
|
||||
AC_SUBST(INSTALL64)
|
||||
AC_SUBST(LIB64CUPS)
|
||||
AC_SUBST(LIB64CUPSIMAGE)
|
||||
AC_SUBST(LIB64DIR)
|
||||
AC_SUBST(UNINSTALL64)
|
||||
|
||||
case "$uname" in
|
||||
HP-UX*)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
INSTALL32="install32bit"
|
||||
LIB32CUPS="32bit/libcups.so.2"
|
||||
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
|
||||
LIB32DIR="$exec_prefix/lib"
|
||||
if test -d /usr/lib/hpux32; then
|
||||
LIB32DIR="${LIB32DIR}/hpux32"
|
||||
fi
|
||||
UNINSTALL32="uninstall32bit"
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
INSTALL64="install64bit"
|
||||
LIB64CUPS="64bit/libcups.so.2"
|
||||
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
|
||||
LIB64DIR="$exec_prefix/lib"
|
||||
if test -d /usr/lib/hpux64; then
|
||||
LIB64DIR="${LIB64DIR}/hpux64"
|
||||
fi
|
||||
UNINSTALL64="uninstall64bit"
|
||||
fi
|
||||
;;
|
||||
|
||||
IRIX)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
INSTALL32="install32bit"
|
||||
LIB32CUPS="32bit/libcups.so.2"
|
||||
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
|
||||
LIB32DIR="$prefix/lib32"
|
||||
UNINSTALL32="uninstall32bit"
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
INSTALL64="install64bit"
|
||||
LIB64CUPS="64bit/libcups.so.2"
|
||||
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
|
||||
LIB64DIR="$prefix/lib64"
|
||||
UNINSTALL64="uninstall64bit"
|
||||
fi
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
INSTALL32="install32bit"
|
||||
LIB32CUPS="32bit/libcups.so.2"
|
||||
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
|
||||
LIB32DIR="$exec_prefix/lib"
|
||||
if test -d /usr/lib32; then
|
||||
LIB32DIR="${LIB32DIR}32"
|
||||
fi
|
||||
UNINSTALL32="uninstall32bit"
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
INSTALL64="install64bit"
|
||||
LIB64CUPS="64bit/libcups.so.2"
|
||||
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
|
||||
LIB64DIR="$exec_prefix/lib"
|
||||
if test -d /usr/lib64; then
|
||||
LIB64DIR="${LIB64DIR}64"
|
||||
fi
|
||||
UNINSTALL64="uninstall64bit"
|
||||
fi
|
||||
;;
|
||||
|
||||
SunOS*)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
INSTALL32="install32bit"
|
||||
LIB32CUPS="32bit/libcups.so.2"
|
||||
LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
|
||||
LIB32DIR="$exec_prefix/lib/32"
|
||||
UNINSTALL32="uninstall32bit"
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
INSTALL64="install64bit"
|
||||
LIB64CUPS="64bit/libcups.so.2"
|
||||
LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
|
||||
LIB64DIR="$exec_prefix/lib/64"
|
||||
UNINSTALL64="uninstall64bit"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
@@ -1,358 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2008 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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
dnl We need at least autoconf 2.60...
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.4b2"
|
||||
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")
|
||||
|
||||
dnl Default compiler flags...
|
||||
CFLAGS="${CFLAGS:=}"
|
||||
CPPFLAGS="${CPPFLAGS:=}"
|
||||
CXXFLAGS="${CXXFLAGS:=}"
|
||||
LDFLAGS="${LDFLAGS:=}"
|
||||
|
||||
dnl Checks for programs...
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_CXX
|
||||
AC_PROG_RANLIB
|
||||
AC_PATH_PROG(AR,ar)
|
||||
AC_PATH_PROG(HTMLDOC,htmldoc)
|
||||
AC_PATH_PROG(LD,ld)
|
||||
AC_PATH_PROG(LN,ln)
|
||||
AC_PATH_PROG(MV,mv)
|
||||
AC_PATH_PROG(RM,rm)
|
||||
AC_PATH_PROG(RMDIR,rmdir)
|
||||
AC_PATH_PROG(SED,sed)
|
||||
AC_PATH_PROG(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)
|
||||
|
||||
if test "x$AR" = x; then
|
||||
AC_MSG_ERROR([Unable to find required library archive command.])
|
||||
fi
|
||||
if test "x$CC" = x; then
|
||||
AC_MSG_ERROR([Unable to find required C compiler command.])
|
||||
fi
|
||||
|
||||
dnl Static library option...
|
||||
INSTALLSTATIC=""
|
||||
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
|
||||
|
||||
if test x$enable_static = xyes; then
|
||||
echo Installing static libraries...
|
||||
INSTALLSTATIC="installstatic"
|
||||
fi
|
||||
|
||||
AC_SUBST(INSTALLSTATIC)
|
||||
|
||||
dnl Check for libraries...
|
||||
AC_SEARCH_LIBS(crypt, crypt)
|
||||
AC_SEARCH_LIBS(getspent, sec gen)
|
||||
|
||||
LIBMALLOC=""
|
||||
AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
|
||||
|
||||
if test x$enable_mallinfo = xyes; then
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
|
||||
LIBMALLOC="$LIBS"
|
||||
LIBS="$SAVELIBS"
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBMALLOC)
|
||||
|
||||
dnl Check for libpaper support...
|
||||
AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
|
||||
|
||||
if test x$enable_libpaper = xyes; then
|
||||
AC_CHECK_LIB(paper,systempapername,
|
||||
AC_DEFINE(HAVE_LIBPAPER)
|
||||
LIBPAPER="-lpaper",
|
||||
LIBPAPER="")
|
||||
else
|
||||
LIBPAPER=""
|
||||
fi
|
||||
AC_SUBST(LIBPAPER)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
|
||||
AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
|
||||
AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
|
||||
AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
|
||||
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
|
||||
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
|
||||
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
|
||||
AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
|
||||
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
|
||||
AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
|
||||
AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
|
||||
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
|
||||
|
||||
dnl Checks for string functions.
|
||||
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
|
||||
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
|
||||
echo Forcing snprintf emulation for HP-UX.
|
||||
else
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
||||
fi
|
||||
|
||||
dnl Check for random number functions...
|
||||
AC_CHECK_FUNCS(random mrand48 lrand48)
|
||||
|
||||
dnl Checks for mkstemp and mkstemps functions.
|
||||
AC_CHECK_FUNCS(mkstemp mkstemps)
|
||||
|
||||
dnl Check for geteuid function.
|
||||
AC_CHECK_FUNCS(geteuid)
|
||||
|
||||
dnl Check for vsyslog function.
|
||||
AC_CHECK_FUNCS(vsyslog)
|
||||
|
||||
dnl Checks for signal functions.
|
||||
case "$uname" in
|
||||
Linux | GNU)
|
||||
# Do not use sigset on Linux or GNU HURD
|
||||
;;
|
||||
*)
|
||||
# Use sigset on other platforms, if available
|
||||
AC_CHECK_FUNCS(sigset)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_CHECK_FUNCS(sigaction)
|
||||
|
||||
dnl Checks for wait functions.
|
||||
AC_CHECK_FUNCS(waitpid wait3)
|
||||
|
||||
dnl See if the tm structure has the tm_gmtoff member...
|
||||
AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
|
||||
AC_TRY_COMPILE([#include <time.h>],[struct tm t;
|
||||
int o = t.tm_gmtoff;],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_TM_GMTOFF),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
dnl 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*)
|
||||
ARFLAGS="-rcv"
|
||||
;;
|
||||
*)
|
||||
ARFLAGS="crvs"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(ARFLAGS)
|
||||
|
||||
dnl Prep libraries specifically for cupsd and backends...
|
||||
BACKLIBS=""
|
||||
CUPSDLIBS=""
|
||||
AC_SUBST(BACKLIBS)
|
||||
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
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
dnl Check for DBUS support
|
||||
if test -d /etc/dbus-1; then
|
||||
DBUSDIR="/etc/dbus-1"
|
||||
else
|
||||
DBUSDIR=""
|
||||
fi
|
||||
|
||||
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
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
|
||||
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
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(DBUSDIR)
|
||||
AC_SUBST(DBUS_NOTIFIER)
|
||||
AC_SUBST(DBUS_NOTIFIERLIBS)
|
||||
|
||||
dnl Extra platform-specific libraries...
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
|
||||
CUPS_SYSTEM_AUTHKEY=""
|
||||
FONTS="fonts"
|
||||
LEGACY_BACKENDS="parallel scsi"
|
||||
|
||||
case $uname in
|
||||
Darwin*)
|
||||
# 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"
|
||||
|
||||
dnl Check for framework headers...
|
||||
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
|
||||
|
||||
dnl Check for the new membership functions in MacOSX 10.4...
|
||||
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
|
||||
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
|
||||
AC_CHECK_FUNCS(mbr_uid_to_uuid)
|
||||
|
||||
dnl Need <dlfcn.h> header...
|
||||
AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
|
||||
|
||||
dnl Check for notify_post support
|
||||
AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
|
||||
AC_CHECK_FUNCS(notify_post)
|
||||
|
||||
dnl Check for Authorization Services support
|
||||
AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
|
||||
default_adminkey="$withval",
|
||||
default_adminkey="default")
|
||||
AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
|
||||
default_operkey="$withval",
|
||||
default_operkey="default")
|
||||
|
||||
AC_CHECK_HEADER(Security/Authorization.h, [
|
||||
AC_DEFINE(HAVE_AUTHORIZATION_H)
|
||||
|
||||
if test "x$default_adminkey" != xdefault; then
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
|
||||
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])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
|
||||
dnl Check for sandbox/Seatbelt support
|
||||
AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
|
||||
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
|
||||
AC_SUBST(FONTS)
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 8094 2008-10-31 20:51:39Z mike $".
|
||||
dnl
|
||||
@@ -1,562 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2008 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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
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=""
|
||||
else
|
||||
ARCHFLAGS="$with_archflags"
|
||||
fi
|
||||
|
||||
if test -z "$with_ldarchflags"; then
|
||||
if test "$uname" = Darwin; then
|
||||
# Only create 32-bit programs by default
|
||||
LDARCHFLAGS="`echo $ARCHFLAGS | sed -e '1,$s/-arch x86_64//' -e '1,$s/-arch ppc64//'`"
|
||||
else
|
||||
LDARCHFLAGS="$ARCHFLAGS"
|
||||
fi
|
||||
else
|
||||
LDARCHFLAGS="$with_ldarchflags"
|
||||
fi
|
||||
|
||||
AC_SUBST(ARCHFLAGS)
|
||||
AC_SUBST(LDARCHFLAGS)
|
||||
|
||||
dnl Setup support for separate 32/64-bit library generation...
|
||||
AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
|
||||
specifies 32-bit architecture flags])
|
||||
ARCH32FLAGS=""
|
||||
AC_SUBST(ARCH32FLAGS)
|
||||
|
||||
AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
|
||||
specifies 64-bit architecture flags])
|
||||
ARCH64FLAGS=""
|
||||
AC_SUBST(ARCH64FLAGS)
|
||||
|
||||
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:=}"
|
||||
AC_SUBST(CXXLIBS)
|
||||
|
||||
PIEFLAGS=""
|
||||
AC_SUBST(PIEFLAGS)
|
||||
|
||||
RELROFLAGS=""
|
||||
AC_SUBST(RELROFLAGS)
|
||||
|
||||
LIBCUPSORDER="libcups.order"
|
||||
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
|
||||
if test -f "$withval"; then
|
||||
LIBCUPSORDER="$withval"
|
||||
fi)
|
||||
AC_SUBST(LIBCUPSORDER)
|
||||
|
||||
LIBCUPSIMAGEORDER="libcupsimage.order"
|
||||
AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
|
||||
libcupsimage secorder file, default=libcupsimage.order],
|
||||
if test -f "$withval"; then
|
||||
LIBCUPSIMAGEORDER="$withval"
|
||||
fi)
|
||||
AC_SUBST(LIBCUPSIMAGEORDER)
|
||||
|
||||
PHPOPTIONS=""
|
||||
AC_SUBST(PHPOPTIONS)
|
||||
|
||||
if test -n "$GCC"; then
|
||||
# Add GCC-specific compiler options...
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
# Default to optimize-for-size and debug
|
||||
OPTIM="-Os -g"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate position-independent code as needed...
|
||||
if test $PICFLAG = 1 -a $uname != AIX; then
|
||||
OPTIM="-fPIC $OPTIM"
|
||||
fi
|
||||
|
||||
# The -fstack-protector option is available with some versions of
|
||||
# GCC and adds "stack canaries" which detect when the return address
|
||||
# has been overwritten, preventing many types of exploit attacks.
|
||||
AC_MSG_CHECKING(if GCC supports -fstack-protector)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fstack-protector"
|
||||
AC_TRY_COMPILE(,,
|
||||
OPTIM="$OPTIM -fstack-protector"
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
# The -pie option is available with some versions of GCC and adds
|
||||
# randomization of addresses, which avoids another class of exploits
|
||||
# that depend on a fixed address for common functions.
|
||||
AC_MSG_CHECKING(if GCC supports -pie)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pie -fPIE"
|
||||
AC_TRY_COMPILE(,,
|
||||
PIEFLAGS="-pie -fPIE"
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Add useful warning options for tracking down problems...
|
||||
OPTIM="-Wall -Wno-format-y2k $OPTIM"
|
||||
# Additional warning options for development testing...
|
||||
if test -d .svn; then
|
||||
OPTIM="-Wshadow -Wunused $OPTIM"
|
||||
CFLAGS="-Werror-implicit-function-declaration $CFLAGS"
|
||||
PHPOPTIONS="-Wno-shadow"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# -D_FORTIFY_SOURCE=2 adds additional object size
|
||||
# checking, basically wrapping all string functions
|
||||
# with buffer-limited ones. Not strictly needed for
|
||||
# CUPS since we already use buffer-limited calls, but
|
||||
# this will catch any additions that are broken.
|
||||
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
|
||||
|
||||
if test x$enable_pie = xyes; then
|
||||
# GCC 4 on Mac OS X needs -Wl,-pie as well
|
||||
LDFLAGS="$LDFLAGS -Wl,-pie"
|
||||
fi
|
||||
;;
|
||||
|
||||
HP-UX*)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="-milp32"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="-mlp64"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="-mlp64"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="-milp32"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
IRIX)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="-n32 -mips3"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="-64 -mips4"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="-64 -mips4"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="-n32 -mips3"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
# The -z relro option is provided by the Linux linker command to
|
||||
# make relocatable data read-only.
|
||||
if test x$enable_relro = xyes; then
|
||||
RELROFLAGS="-Wl,-z,relro"
|
||||
fi
|
||||
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="-m32"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="-m64"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="-m64"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="-m32"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
SunOS*)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="-m32"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="-m64"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="-m64"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="-m32"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# Add vendor-specific compiler options...
|
||||
case $uname in
|
||||
AIX*)
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-O2 -qmaxmem=6000"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
HP-UX*)
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="+O2"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
CFLAGS="-Ae $CFLAGS"
|
||||
|
||||
if test $PICFLAG = 1; then
|
||||
OPTIM="+z $OPTIM"
|
||||
fi
|
||||
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="+DD32"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="+DD64"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="+DD64"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="+DD32"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
IRIX)
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-O2"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
|
||||
fi
|
||||
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="-n32 -mips3"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="-64 -mips4"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="-64 -mips4"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="-n32 -mips3"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
OSF*)
|
||||
# Tru64 UNIX aka Digital UNIX aka OSF/1
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-O"
|
||||
else
|
||||
OPTIM="$with_optim"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
SunOS*)
|
||||
# Solaris
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-xO2"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $PICFLAG = 1; then
|
||||
OPTIM="-KPIC $OPTIM"
|
||||
fi
|
||||
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Compiling on a Solaris system, build 64-bit
|
||||
# binaries with separate 32-bit libraries...
|
||||
ARCH32FLAGS="-xarch=generic"
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Suppress all of Sun's questionable
|
||||
# warning messages, and default to
|
||||
# 64-bit compiles of everything else...
|
||||
OPTIM="-w $OPTIM"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="-xarch=generic64"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries...
|
||||
ARCH64FLAGS="-xarch=generic64"
|
||||
fi
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Suppress all of Sun's questionable
|
||||
# warning messages, and default to
|
||||
# 32-bit compiles of everything else...
|
||||
OPTIM="-w $OPTIM"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="-xarch=generic"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
UNIX_SVR*)
|
||||
# UnixWare
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-O"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $PICFLAG = 1; then
|
||||
OPTIM="-KPIC $OPTIM"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Running some other operating system; inform the user they
|
||||
# should contribute the necessary options to
|
||||
# cups-support@cups.org...
|
||||
echo "Building CUPS with default compiler optimizations; contact"
|
||||
echo "cups-bugs@cups.org with uname and compiler options needed"
|
||||
echo "for your platform, or set the CFLAGS and LDFLAGS environment"
|
||||
echo "variables before running configure."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Add general compiler options per platform...
|
||||
case $uname in
|
||||
HP-UX*)
|
||||
# HP-UX 10.20 (at least) needs this definition to get the
|
||||
# h_errno global...
|
||||
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
|
||||
|
||||
# HP-UX 11.00 (at least) needs this definition to get the
|
||||
# u_short type used by the IP headers...
|
||||
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
|
||||
|
||||
# HP-UX 11.23 (at least) needs this definition to get the
|
||||
# IPv6 header to work...
|
||||
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...
|
||||
OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 8139 2008-11-17 23:46:55Z mike $".
|
||||
dnl
|
||||
@@ -1,445 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 8106 2008-11-11 00:57:12Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
dnl Default languages...
|
||||
LANGUAGES="`ls -1 locale/cups_*.po | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
|
||||
|
||||
AC_ARG_WITH(languages, [ --with-languages set installed languages, default=all ],[
|
||||
case "$withval" in
|
||||
none | no) LANGUAGES="" ;;
|
||||
all) ;;
|
||||
*) LANGUAGES="$withval" ;;
|
||||
esac])
|
||||
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")
|
||||
AC_SUBST(CUPS_CONFIG_FILE_PERM)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
|
||||
|
||||
dnl Default LogFilePerm
|
||||
AC_ARG_WITH(log_file_perm, [ --with-log-file-perm set default LogFilePerm value, default=0644],
|
||||
CUPS_LOG_FILE_PERM="$withval",
|
||||
CUPS_LOG_FILE_PERM="644")
|
||||
AC_SUBST(CUPS_LOG_FILE_PERM)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_FILE_PERM, 0$CUPS_LOG_FILE_PERM)
|
||||
|
||||
dnl Default 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
|
||||
CUPS_BROWSING="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 0)
|
||||
else
|
||||
CUPS_BROWSING="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 1)
|
||||
fi
|
||||
AC_SUBST(CUPS_BROWSING)
|
||||
|
||||
dnl Default BrowseLocalProtocols
|
||||
AC_ARG_WITH(local_protocols, [ --with-local-protocols set default BrowseLocalProtocols, default="CUPS"],
|
||||
default_local_protocols="$withval",
|
||||
default_local_protocols="default")
|
||||
|
||||
if test x$with_local_protocols != xno; then
|
||||
if test "x$default_local_protocols" = "xdefault"; then
|
||||
if test "x$DNSSDLIBS" != "x"; then
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS dnssd"
|
||||
else
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS"
|
||||
fi
|
||||
else
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS="$default_local_protocols"
|
||||
fi
|
||||
else
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS=""
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS,
|
||||
"$CUPS_BROWSE_LOCAL_PROTOCOLS")
|
||||
|
||||
dnl Default BrowseRemoteProtocols
|
||||
AC_ARG_WITH(remote_protocols, [ --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
|
||||
default_remote_protocols="$withval",
|
||||
default_remote_protocols="default")
|
||||
|
||||
if test x$with_remote_protocols != xno; then
|
||||
if test "x$default_remote_protocols" = "xdefault"; then
|
||||
if test "$uname" = "Darwin" -a $uversion -ge 90; then
|
||||
CUPS_BROWSE_REMOTE_PROTOCOLS=""
|
||||
else
|
||||
CUPS_BROWSE_REMOTE_PROTOCOLS="CUPS"
|
||||
fi
|
||||
else
|
||||
CUPS_BROWSE_REMOTE_PROTOCOLS="$default_remote_protocols"
|
||||
fi
|
||||
else
|
||||
CUPS_BROWSE_REMOTE_PROTOCOLS=""
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_BROWSE_REMOTE_PROTOCOLS)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS,
|
||||
"$CUPS_BROWSE_REMOTE_PROTOCOLS")
|
||||
|
||||
dnl Default BrowseShortNames
|
||||
AC_ARG_ENABLE(browse_short, [ --enable-browse-short-names
|
||||
enable BrowseShortNames by default, default=yes])
|
||||
if test "x$enable_browse_short" = xno; then
|
||||
CUPS_BROWSE_SHORT_NAMES="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 0)
|
||||
else
|
||||
CUPS_BROWSE_SHORT_NAMES="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 1)
|
||||
fi
|
||||
AC_SUBST(CUPS_BROWSE_SHORT_NAMES)
|
||||
|
||||
dnl Default DefaultShared
|
||||
AC_ARG_ENABLE(default_shared, [ --enable-default-shared enable DefaultShared by default, default=yes])
|
||||
if test "x$enable_default_shared" = xno; then
|
||||
CUPS_DEFAULT_SHARED="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 0)
|
||||
else
|
||||
CUPS_DEFAULT_SHARED="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 1)
|
||||
fi
|
||||
AC_SUBST(CUPS_DEFAULT_SHARED)
|
||||
|
||||
dnl Default ImplicitClasses
|
||||
AC_ARG_ENABLE(implicit, [ --enable-implicit-classes
|
||||
enable ImplicitClasses by default, default=yes])
|
||||
if test "x$enable_implicit" = xno; then
|
||||
CUPS_IMPLICIT_CLASSES="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 0)
|
||||
else
|
||||
CUPS_IMPLICIT_CLASSES="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 1)
|
||||
fi
|
||||
AC_SUBST(CUPS_IMPLICIT_CLASSES)
|
||||
|
||||
dnl Default UseNetworkDefault
|
||||
AC_ARG_ENABLE(use_network_default, [ --enable-use-network-default
|
||||
enable UseNetworkDefault by default, default=auto])
|
||||
if test "x$enable_use_network_default" != xno; then
|
||||
AC_MSG_CHECKING(whether to use network default printers)
|
||||
if test "x$enable_use_network_default" = xyes -o $uname != Darwin; then
|
||||
CUPS_USE_NETWORK_DEFAULT="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
fi
|
||||
AC_SUBST(CUPS_USE_NETWORK_DEFAULT)
|
||||
|
||||
dnl Determine the correct username and group for this OS...
|
||||
AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
|
||||
CUPS_USER="$withval",
|
||||
AC_MSG_CHECKING(for default print user)
|
||||
if test x$uname = xDarwin; then
|
||||
if test x`id -u _lp 2>/dev/null` = x; then
|
||||
CUPS_USER="lp";
|
||||
else
|
||||
CUPS_USER="_lp";
|
||||
fi
|
||||
AC_MSG_RESULT($CUPS_USER)
|
||||
elif test -f /etc/passwd; then
|
||||
CUPS_USER=""
|
||||
for user in lp lpd guest daemon nobody; do
|
||||
if test "`grep \^${user}: /etc/passwd`" != ""; then
|
||||
CUPS_USER="$user"
|
||||
AC_MSG_RESULT($user)
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
if test x$CUPS_USER = x; then
|
||||
CUPS_USER="nobody"
|
||||
AC_MSG_RESULT(not found, using "$CUPS_USER")
|
||||
fi
|
||||
else
|
||||
CUPS_USER="nobody"
|
||||
AC_MSG_RESULT(no password file, using "$CUPS_USER")
|
||||
fi)
|
||||
|
||||
AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
|
||||
CUPS_GROUP="$withval",
|
||||
AC_MSG_CHECKING(for default print group)
|
||||
if test x$uname = xDarwin; then
|
||||
if test x`id -g _lp 2>/dev/null` = x; then
|
||||
CUPS_GROUP="lp";
|
||||
else
|
||||
CUPS_GROUP="_lp";
|
||||
fi
|
||||
AC_MSG_RESULT($CUPS_GROUP)
|
||||
elif test -f /etc/group; then
|
||||
GROUP_LIST="_lp lp nobody"
|
||||
CUPS_GROUP=""
|
||||
for group in $GROUP_LIST; do
|
||||
if test "`grep \^${group}: /etc/group`" != ""; then
|
||||
CUPS_GROUP="$group"
|
||||
AC_MSG_RESULT($group)
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
if test x$CUPS_GROUP = x; then
|
||||
CUPS_GROUP="nobody"
|
||||
AC_MSG_RESULT(not found, using "$CUPS_GROUP")
|
||||
fi
|
||||
else
|
||||
CUPS_GROUP="nobody"
|
||||
AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
|
||||
fi)
|
||||
|
||||
AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups for CUPS],
|
||||
CUPS_SYSTEM_GROUPS="$withval",
|
||||
if test x$uname = xDarwin; then
|
||||
CUPS_SYSTEM_GROUPS="admin"
|
||||
else
|
||||
AC_MSG_CHECKING(for default system groups)
|
||||
if test -f /etc/group; then
|
||||
CUPS_SYSTEM_GROUPS=""
|
||||
GROUP_LIST="lpadmin sys system root"
|
||||
for group in $GROUP_LIST; do
|
||||
if test "`grep \^${group}: /etc/group`" != ""; then
|
||||
if test "x$CUPS_SYSTEM_GROUPS" = x; then
|
||||
CUPS_SYSTEM_GROUPS="$group"
|
||||
else
|
||||
CUPS_SYSTEM_GROUPS="$CUPS_SYSTEM_GROUPS $group"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$CUPS_SYSTEM_GROUPS" = x; then
|
||||
CUPS_SYSTEM_GROUPS="$GROUP_LIST"
|
||||
AC_MSG_RESULT(no groups found, using "$CUPS_SYSTEM_GROUPS")
|
||||
else
|
||||
AC_MSG_RESULT("$CUPS_SYSTEM_GROUPS")
|
||||
fi
|
||||
else
|
||||
CUPS_SYSTEM_GROUPS="$GROUP_LIST"
|
||||
AC_MSG_RESULT(no group file, using "$CUPS_SYSTEM_GROUPS")
|
||||
fi
|
||||
fi)
|
||||
|
||||
|
||||
CUPS_PRIMARY_SYSTEM_GROUP="`echo $CUPS_SYSTEM_GROUPS | awk '{print $1}'`"
|
||||
|
||||
AC_SUBST(CUPS_USER)
|
||||
AC_SUBST(CUPS_GROUP)
|
||||
AC_SUBST(CUPS_SYSTEM_GROUPS)
|
||||
AC_SUBST(CUPS_PRIMARY_SYSTEM_GROUP)
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_GROUPS, "$CUPS_SYSTEM_GROUPS")
|
||||
|
||||
dnl Default printcap file...
|
||||
AC_ARG_WITH(printcap, [ --with-printcap set default printcap file],
|
||||
default_printcap="$withval",
|
||||
default_printcap="default")
|
||||
|
||||
if test x$default_printcap != xno; then
|
||||
if test "x$default_printcap" = "xdefault"; then
|
||||
case $uname in
|
||||
Darwin*)
|
||||
if test $uversion -ge 90; then
|
||||
CUPS_DEFAULT_PRINTCAP="/Library/Preferences/org.cups.printers.plist"
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
|
||||
fi
|
||||
;;
|
||||
SunOS*)
|
||||
CUPS_DEFAULT_PRINTCAP="/etc/printers.conf"
|
||||
;;
|
||||
*)
|
||||
CUPS_DEFAULT_PRINTCAP="/etc/printcap"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP="$default_printcap"
|
||||
fi
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP=""
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_PRINTCAP)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
|
||||
|
||||
dnl Default LPD config file...
|
||||
AC_ARG_WITH(lpdconfigfile, [ --with-lpdconfigfile set default LPDConfigFile URI],
|
||||
default_lpdconfigfile="$withval",
|
||||
default_lpdconfigfile="default")
|
||||
|
||||
if test x$default_lpdconfigfile != xno; then
|
||||
if test "x$default_lpdconfigfile" = "xdefault"; then
|
||||
case $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 ],
|
||||
CUPS_MAX_COPIES="$withval",
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_MAX_COPIES="9999"
|
||||
else
|
||||
CUPS_MAX_COPIES="100"
|
||||
fi)
|
||||
|
||||
AC_SUBST(CUPS_MAX_COPIES)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_MAX_COPIES, $CUPS_MAX_COPIES)
|
||||
|
||||
dnl Default raw printing state
|
||||
AC_ARG_ENABLE(raw_printing, [ --enable-raw-printing enable raw printing by default, default=auto])
|
||||
if test "x$enable_raw_printing" != xno; then
|
||||
AC_MSG_CHECKING(whether to enable raw printing)
|
||||
if test "x$enable_raw_printing" = xyes -o $uname = Darwin; then
|
||||
DEFAULT_RAW_PRINTING=""
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
DEFAULT_RAW_PRINTING="#"
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
else
|
||||
DEFAULT_RAW_PRINTING="#"
|
||||
fi
|
||||
AC_SUBST(DEFAULT_RAW_PRINTING)
|
||||
|
||||
dnl Default SNMP options...
|
||||
AC_ARG_WITH(snmp-address, [ --with-snmp-address set SNMP query address, default=auto ],
|
||||
if test "x$withval" = x; then
|
||||
CUPS_SNMP_ADDRESS=""
|
||||
else
|
||||
CUPS_SNMP_ADDRESS="Address $withval"
|
||||
fi,
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_SNMP_ADDRESS=""
|
||||
else
|
||||
CUPS_SNMP_ADDRESS="Address @LOCAL"
|
||||
fi)
|
||||
|
||||
AC_ARG_WITH(snmp-community, [ --with-snmp-community set SNMP community, default=public ],
|
||||
CUPS_SNMP_COMMUNITY="Community $withval",
|
||||
CUPS_SNMP_COMMUNITY="Community public")
|
||||
|
||||
AC_SUBST(CUPS_SNMP_ADDRESS)
|
||||
AC_SUBST(CUPS_SNMP_COMMUNITY)
|
||||
|
||||
dnl New default port definition for IPP...
|
||||
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
|
||||
DEFAULT_IPP_PORT="$withval",
|
||||
DEFAULT_IPP_PORT="631")
|
||||
|
||||
AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl 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
|
||||
@@ -1,420 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $"
|
||||
dnl
|
||||
dnl Directory stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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_PREFIX_DEFAULT(/)
|
||||
|
||||
dnl Fix "prefix" variable if it hasn't been specified...
|
||||
if test "$prefix" = "NONE"; then
|
||||
prefix="/"
|
||||
fi
|
||||
|
||||
dnl Fix "exec_prefix" variable if it hasn't been specified...
|
||||
if test "$exec_prefix" = "NONE"; then
|
||||
if test "$prefix" = "/"; then
|
||||
exec_prefix="/usr"
|
||||
else
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "bindir" variable...
|
||||
if test "$bindir" = "\${exec_prefix}/bin"; then
|
||||
bindir="$exec_prefix/bin"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_BINDIR, "$bindir")
|
||||
|
||||
dnl Fix "sbindir" variable...
|
||||
if test "$sbindir" = "\${exec_prefix}/sbin"; then
|
||||
sbindir="$exec_prefix/sbin"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_SBINDIR, "$sbindir")
|
||||
|
||||
dnl Fix "sharedstatedir" variable if it hasn't been specified...
|
||||
if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
|
||||
sharedstatedir="/usr/com"
|
||||
fi
|
||||
|
||||
dnl Fix "datarootdir" variable if it hasn't been specified...
|
||||
if test "$datarootdir" = "\${prefix}/share"; then
|
||||
if test "$prefix" = "/"; then
|
||||
datarootdir="/usr/share"
|
||||
else
|
||||
datarootdir="$prefix/share"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "datadir" variable if it hasn't been specified...
|
||||
if test "$datadir" = "\${prefix}/share"; then
|
||||
if test "$prefix" = "/"; then
|
||||
datadir="/usr/share"
|
||||
else
|
||||
datadir="$prefix/share"
|
||||
fi
|
||||
elif test "$datadir" = "\${datarootdir}"; then
|
||||
datadir="$datarootdir"
|
||||
fi
|
||||
|
||||
dnl Fix "includedir" variable if it hasn't been specified...
|
||||
if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
|
||||
includedir="/usr/include"
|
||||
fi
|
||||
|
||||
dnl Fix "localstatedir" variable if it hasn't been specified...
|
||||
if test "$localstatedir" = "\${prefix}/var"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
localstatedir="/private/var"
|
||||
else
|
||||
localstatedir="/var"
|
||||
fi
|
||||
else
|
||||
localstatedir="$prefix/var"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "sysconfdir" variable if it hasn't been specified...
|
||||
if test "$sysconfdir" = "\${prefix}/etc"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
sysconfdir="/private/etc"
|
||||
else
|
||||
sysconfdir="/etc"
|
||||
fi
|
||||
else
|
||||
sysconfdir="$prefix/etc"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "libdir" variable...
|
||||
if test "$libdir" = "\${exec_prefix}/lib"; then
|
||||
case "$uname" in
|
||||
IRIX*)
|
||||
libdir="$exec_prefix/lib32"
|
||||
;;
|
||||
Linux*)
|
||||
if test -d /usr/lib64; then
|
||||
libdir="$exec_prefix/lib64"
|
||||
fi
|
||||
;;
|
||||
HP-UX*)
|
||||
if test -d /usr/lib/hpux32; then
|
||||
libdir="$exec_prefix/lib/hpux32"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl Setup init.d locations...
|
||||
AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
|
||||
AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
|
||||
AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="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
|
||||
AIX*)
|
||||
INITDIR="/etc/rc.d"
|
||||
;;
|
||||
|
||||
Darwin*)
|
||||
# Darwin and MacOS X...
|
||||
if test -x /sbin/launchd; then
|
||||
INITDDIR="/System/Library/LaunchDaemons"
|
||||
else
|
||||
INITDDIR="/System/Library/StartupItems/PrintingServices"
|
||||
fi
|
||||
;;
|
||||
|
||||
FreeBSD* | OpenBSD* | MirBSD* | ekkoBSD*)
|
||||
# FreeBSD and OpenBSD
|
||||
;;
|
||||
|
||||
HP-UX*)
|
||||
INITDIR="/sbin"
|
||||
RCLEVELS="2"
|
||||
RCSTART="380"
|
||||
RCSTOP="620"
|
||||
;;
|
||||
|
||||
IRIX*)
|
||||
# IRIX
|
||||
INITDIR="/etc"
|
||||
RCSTART="60"
|
||||
RCSTOP="25"
|
||||
;;
|
||||
|
||||
Linux | GNU | GNU/k*BSD*)
|
||||
# Linux/HURD seems to choose an init.d directory at random...
|
||||
if test -d /sbin/init.d; then
|
||||
# SuSE
|
||||
INITDIR="/sbin/init.d"
|
||||
else
|
||||
if test -d /etc/init.d; then
|
||||
# Others
|
||||
INITDIR="/etc"
|
||||
else
|
||||
# RedHat
|
||||
INITDIR="/etc/rc.d"
|
||||
fi
|
||||
fi
|
||||
RCSTART="81"
|
||||
RCSTOP="36"
|
||||
;;
|
||||
|
||||
NetBSD*)
|
||||
# NetBSD
|
||||
INITDDIR="/etc/rc.d"
|
||||
;;
|
||||
|
||||
OSF1*)
|
||||
INITDIR="/sbin"
|
||||
;;
|
||||
|
||||
SunOS*)
|
||||
# Solaris
|
||||
if test "x$smfmanifestdir" != x; then
|
||||
SMFMANIFESTDIR=$smfmanifestdir
|
||||
else
|
||||
INITDIR="/etc"
|
||||
RCSTART="81"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
INITDIR="/etc"
|
||||
;;
|
||||
|
||||
esac
|
||||
elif test "x$rcdir" != xno; then
|
||||
if test "x$rclevels" = x; then
|
||||
INITDDIR="$rcdir"
|
||||
else
|
||||
INITDIR="$rcdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(INITDIR)
|
||||
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="")
|
||||
|
||||
if test "x$XINETD" = x -a ! -x /sbin/launchd; then
|
||||
for dir in /private/etc/xinetd.d /etc/xinetd.d /usr/local/etc/xinetd.d; do
|
||||
if test -d $dir; then
|
||||
XINETD="$dir"
|
||||
break
|
||||
fi
|
||||
done
|
||||
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="")
|
||||
|
||||
if test x$cachedir = x; then
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_CACHEDIR="$localstatedir/spool/cups/cache"
|
||||
else
|
||||
CUPS_CACHEDIR="$localstatedir/cache/cups"
|
||||
fi
|
||||
else
|
||||
CUPS_CACHEDIR="$cachedir"
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_CACHEDIR, "$CUPS_CACHEDIR")
|
||||
AC_SUBST(CUPS_CACHEDIR)
|
||||
|
||||
# Data files
|
||||
CUPS_DATADIR="$datadir/cups"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
|
||||
AC_SUBST(CUPS_DATADIR)
|
||||
|
||||
# Icon directory
|
||||
AC_ARG_WITH(icondir, [ --with-icondir set path for application icons],icondir="$withval",icondir="")
|
||||
|
||||
if test "x$icondir" = x -a -d /usr/share/icons; then
|
||||
ICONDIR="/usr/share/icons"
|
||||
else
|
||||
ICONDIR="$icondir"
|
||||
fi
|
||||
|
||||
AC_SUBST(ICONDIR)
|
||||
|
||||
# Menu directory
|
||||
AC_ARG_WITH(menudir, [ --with-menudir set path for application menus],menudir="$withval",menudir="")
|
||||
|
||||
if test "x$menudir" = x -a -d /usr/share/applications; then
|
||||
MENUDIR="/usr/share/applications"
|
||||
else
|
||||
MENUDIR="$menudir"
|
||||
fi
|
||||
|
||||
AC_SUBST(MENUDIR)
|
||||
|
||||
# Documentation files
|
||||
AC_ARG_WITH(docdir, [ --with-docdir set path for documentation],docdir="$withval",docdir="")
|
||||
|
||||
if test x$docdir = x; then
|
||||
CUPS_DOCROOT="$datadir/doc/cups"
|
||||
docdir="$datadir/doc/cups"
|
||||
else
|
||||
CUPS_DOCROOT="$docdir"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$docdir")
|
||||
AC_SUBST(CUPS_DOCROOT)
|
||||
|
||||
# Fonts
|
||||
AC_ARG_WITH(fontpath, [ --with-fontpath set font path for pstoraster],fontpath="$withval",fontpath="")
|
||||
|
||||
if test "x$fontpath" = "x"; then
|
||||
CUPS_FONTPATH="$datadir/cups/fonts"
|
||||
else
|
||||
CUPS_FONTPATH="$fontpath"
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_FONTPATH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH")
|
||||
|
||||
# Locale data
|
||||
if test "$localedir" = "\${datarootdir}/locale"; then
|
||||
case "$uname" in
|
||||
Linux | GNU | *BSD* | Darwin*)
|
||||
CUPS_LOCALEDIR="$datarootdir/locale"
|
||||
;;
|
||||
|
||||
OSF1* | AIX*)
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg"
|
||||
;;
|
||||
|
||||
*)
|
||||
# This is the standard System V location...
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/locale"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
CUPS_LOCALEDIR="$localedir"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$CUPS_LOCALEDIR")
|
||||
AC_SUBST(CUPS_LOCALEDIR)
|
||||
|
||||
# Log files...
|
||||
AC_ARG_WITH(logdir, [ --with-logdir set path for log files],logdir="$withval",logdir="")
|
||||
|
||||
if test x$logdir = x; then
|
||||
CUPS_LOGDIR="$localstatedir/log/cups"
|
||||
AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
|
||||
else
|
||||
CUPS_LOGDIR="$logdir"
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$CUPS_LOGDIR")
|
||||
AC_SUBST(CUPS_LOGDIR)
|
||||
|
||||
# Longer-term spool data
|
||||
CUPS_REQUESTS="$localstatedir/spool/cups"
|
||||
AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
|
||||
AC_SUBST(CUPS_REQUESTS)
|
||||
|
||||
# Server executables...
|
||||
case "$uname" in
|
||||
*BSD* | Darwin*)
|
||||
# *BSD and Darwin (MacOS X)
|
||||
INSTALL_SYSV=""
|
||||
CUPS_SERVERBIN="$exec_prefix/libexec/cups"
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
INSTALL_SYSV="install-sysv"
|
||||
CUPS_SERVERBIN="$exec_prefix/lib/cups"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN")
|
||||
AC_SUBST(CUPS_SERVERBIN)
|
||||
AC_SUBST(INSTALL_SYSV)
|
||||
|
||||
# Configuration files
|
||||
CUPS_SERVERROOT="$sysconfdir/cups"
|
||||
AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
|
||||
AC_SUBST(CUPS_SERVERROOT)
|
||||
|
||||
# Transient run-time state
|
||||
CUPS_STATEDIR="$localstatedir/run/cups"
|
||||
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
|
||||
AC_SUBST(CUPS_STATEDIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-directories.m4 8076 2008-10-23 15:38:43Z mike $".
|
||||
dnl
|
||||
@@ -1,56 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $"
|
||||
dnl
|
||||
dnl DNS Service Discovery (aka Bonjour) stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(dnssd, [ --enable-dnssd turn on DNS Service Discovery support, default=yes])
|
||||
AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes],
|
||||
CFLAGS="-I$withval $CFLAGS"
|
||||
CPPFLAGS="-I$withval $CPPFLAGS",)
|
||||
|
||||
DNSSDLIBS=""
|
||||
DNSSD_BACKEND=""
|
||||
|
||||
if test x$enable_dnssd != xno; then
|
||||
AC_CHECK_HEADER(dns_sd.h, [
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin and MacOS X...
|
||||
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
AC_DEFINE(HAVE_COREFOUNDATION)
|
||||
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
|
||||
DNSSD_BACKEND="dnssd"
|
||||
;;
|
||||
*)
|
||||
# All others...
|
||||
AC_CHECK_LIB(dns_sd,TXTRecordGetValuePtr,
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
DNSSDLIBS="-ldns_sd")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
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
|
||||
@@ -1,123 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl GSSAPI/Kerberos library detection.
|
||||
dnl
|
||||
dnl Copyright 2007 by Apple Inc.
|
||||
dnl Copyright 2006-2007 by Easy Software Products.
|
||||
dnl
|
||||
dnl This file contains Kerberos support code, copyright 2006 by
|
||||
dnl Jelmer Vernooij.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(gssapi, [ --enable-gssapi turn on GSSAPI support, default=yes])
|
||||
|
||||
LIBGSSAPI=""
|
||||
|
||||
if test x$enable_gssapi != xno; then
|
||||
AC_PATH_PROG(KRB5CONFIG, krb5-config)
|
||||
if test "x$KRB5CONFIG" != x; then
|
||||
case "$uname" in
|
||||
Darwin)
|
||||
# Mac OS X weak-links to the Kerberos framework...
|
||||
LIBGSSAPI="-weak_framework Kerberos"
|
||||
;;
|
||||
SunOS*)
|
||||
# Solaris has a non-standard krb5-config, don't use it!
|
||||
AC_CHECK_LIB(gss, gss_display_status,
|
||||
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
|
||||
CFLAGS="`$KRB5CONFIG --cflags` $CFLAGS"
|
||||
CPPFLAGS="`$KRB5CONFIG --cflags` $CPPFLAGS"
|
||||
LIBGSSAPI="-lgss `$KRB5CONFIG --libs`")
|
||||
;;
|
||||
*)
|
||||
# Other platforms just ask for GSSAPI
|
||||
CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS"
|
||||
CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS"
|
||||
LIBGSSAPI="`$KRB5CONFIG --libs gssapi`"
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
|
||||
else
|
||||
# Check for vendor-specific implementations...
|
||||
case "$uname" in
|
||||
HP-UX*)
|
||||
AC_CHECK_LIB(gss, gss_display_status,
|
||||
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
|
||||
LIBGSSAPI="-lgss -lgssapi_krb5")
|
||||
;;
|
||||
SunOS*)
|
||||
AC_CHECK_LIB(gss, gss_display_status,
|
||||
AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
|
||||
LIBGSSAPI="-lgss")
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "x$LIBGSSAPI" != x; then
|
||||
AC_CHECK_HEADER(krb5.h, AC_DEFINE(HAVE_KRB5_H))
|
||||
AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H))
|
||||
AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H))
|
||||
AC_CHECK_HEADER(gssapi/gssapi_generic.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_GENERIC_H))
|
||||
AC_CHECK_HEADER(gssapi/gssapi_krb5.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_KRB5_H))
|
||||
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBGSSAPI"
|
||||
|
||||
AC_CHECK_FUNC(gsskrb5_register_acceptor_identity,
|
||||
AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY))
|
||||
AC_CHECK_FUNC(krb5_cc_new_unique, AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE))
|
||||
|
||||
AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
|
||||
if test $ac_cv_header_gssapi_gssapi_h = yes; then
|
||||
AC_TRY_COMPILE([ #include <gssapi/gssapi.h> ],
|
||||
[ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ],
|
||||
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
else
|
||||
AC_TRY_COMPILE([ #include <gssapi.h> ],
|
||||
[ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ],
|
||||
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
fi
|
||||
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
AC_MSG_CHECKING(for Heimdal Kerberos)
|
||||
AC_TRY_COMPILE([ #include <krb5.h> ],
|
||||
[ char *tmp = heimdal_version; ],
|
||||
AC_DEFINE(HAVE_HEIMDAL)
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Default GSS service name...
|
||||
AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service name],
|
||||
default_gssservicename="$withval",
|
||||
default_gssservicename="default")
|
||||
|
||||
if test x$default_gssservicename != xno; then
|
||||
if test "x$default_gssservicename" = "xdefault"; then
|
||||
CUPS_DEFAULT_GSSSERVICENAME="ipp"
|
||||
else
|
||||
CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
|
||||
fi
|
||||
else
|
||||
CUPS_DEFAULT_GSSSERVICENAME=""
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBGSSAPI)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
@@ -1,109 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Image library/filter stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
dnl See if we want the image filters included at all...
|
||||
AC_ARG_ENABLE(image, [ --enable-image turn on image filters, default=auto])
|
||||
|
||||
IMGFILTERS=""
|
||||
if test "x$enable_image" != xno; then
|
||||
AC_MSG_CHECKING(whether to build image filters)
|
||||
if test "x$enable_image" = xyes -o $uname != Darwin; then
|
||||
IMGFILTERS="imagetops imagetoraster"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(IMGFILTERS)
|
||||
|
||||
dnl Check for image libraries...
|
||||
AC_ARG_ENABLE(jpeg, [ --enable-jpeg turn on JPEG support, default=yes])
|
||||
AC_ARG_ENABLE(png, [ --enable-png turn on PNG support, default=yes])
|
||||
AC_ARG_ENABLE(tiff, [ --enable-tiff turn on TIFF support, default=yes])
|
||||
|
||||
LIBJPEG=""
|
||||
LIBPNG=""
|
||||
LIBTIFF=""
|
||||
LIBZ=""
|
||||
|
||||
AC_SUBST(LIBJPEG)
|
||||
AC_SUBST(LIBPNG)
|
||||
AC_SUBST(LIBTIFF)
|
||||
AC_SUBST(LIBZ)
|
||||
|
||||
dnl Image libraries use math library functions...
|
||||
AC_SEARCH_LIBS(pow, m)
|
||||
|
||||
dnl Save the current libraries since we don't want the image libraries
|
||||
dnl included with every program...
|
||||
SAVELIBS="$LIBS"
|
||||
|
||||
dnl JPEG library...
|
||||
if test x$enable_jpeg != xno; then
|
||||
AC_CHECK_HEADER(jpeglib.h,
|
||||
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
LIBJPEG="-ljpeg"
|
||||
LIBS="$LIBS -ljpeg"))
|
||||
else
|
||||
AC_MSG_NOTICE([JPEG support disabled with --disable-jpeg.])
|
||||
fi
|
||||
|
||||
dnl ZLIB library...
|
||||
AC_CHECK_HEADER(zlib.h,
|
||||
AC_CHECK_LIB(z, gzgets,
|
||||
AC_DEFINE(HAVE_LIBZ)
|
||||
LIBZ="-lz"
|
||||
LIBS="$LIBS -lz"))
|
||||
|
||||
dnl PNG library...
|
||||
if test x$enable_png != xno; then
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_CHECK_LIB(png, png_create_read_struct,
|
||||
AC_DEFINE(HAVE_LIBPNG)
|
||||
LIBPNG="-lpng"))
|
||||
else
|
||||
AC_MSG_NOTICE([PNG support disabled with --disable-png.])
|
||||
fi
|
||||
|
||||
dnl TIFF library...
|
||||
if test x$enable_tiff != xno; then
|
||||
AC_CHECK_HEADER(tiff.h,
|
||||
AC_CHECK_LIB(tiff, TIFFReadScanline,
|
||||
AC_DEFINE(HAVE_LIBTIFF)
|
||||
LIBTIFF="-ltiff"))
|
||||
else
|
||||
AC_MSG_NOTICE([TIFF support disabled with --disable-tiff.])
|
||||
fi
|
||||
|
||||
dnl Restore original LIBS settings...
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
EXPORT_LIBJPEG="$LIBJPEG"
|
||||
EXPORT_LIBPNG="$LIBPNG"
|
||||
EXPORT_LIBTIFF="$LIBTIFF"
|
||||
EXPORT_LIBZ="$LIBZ"
|
||||
|
||||
AC_SUBST(EXPORT_LIBJPEG)
|
||||
AC_SUBST(EXPORT_LIBPNG)
|
||||
AC_SUBST(EXPORT_LIBTIFF)
|
||||
AC_SUBST(EXPORT_LIBZ)
|
||||
|
||||
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
@@ -1,52 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-largefile.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Large file support stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
dnl Check for largefile support...
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Define largefile options as needed...
|
||||
LARGEFILE=""
|
||||
if test x$enable_largefile != xno; then
|
||||
LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
|
||||
|
||||
if test x$ac_cv_sys_large_files = x1; then
|
||||
LARGEFILE="$LARGEFILE -D_LARGE_FILES"
|
||||
fi
|
||||
|
||||
if test x$ac_cv_sys_file_offset_bits = x64; then
|
||||
LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(LARGEFILE)
|
||||
|
||||
dnl Check for "long long" support...
|
||||
AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
|
||||
[if test "$GCC" = yes; then
|
||||
ac_cv_c_long_long=yes
|
||||
else
|
||||
AC_TRY_COMPILE(,[long long int i;],
|
||||
ac_cv_c_long_long=yes,
|
||||
ac_cv_c_long_long=no)
|
||||
fi])
|
||||
|
||||
if test $ac_cv_c_long_long = yes; then
|
||||
AC_DEFINE(HAVE_LONG_LONG)
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-largefile.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
@@ -1,44 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl launchd stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
|
||||
AC_ARG_ENABLE(launchd, [ --enable-launchd turn on launchd support, default=yes])
|
||||
|
||||
DEFAULT_LAUNCHD_CONF=""
|
||||
LAUNCHDLIBS=""
|
||||
|
||||
if test x$enable_launchd != xno; then
|
||||
AC_CHECK_FUNC(launch_msg, AC_DEFINE(HAVE_LAUNCHD))
|
||||
AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
|
||||
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin, MacOS X
|
||||
DEFAULT_LAUNCHD_CONF="/System/Library/LaunchDaemons/org.cups.cupsd.plist"
|
||||
# liblaunch is already part of libSystem
|
||||
;;
|
||||
*)
|
||||
# All others; this test will need to be updated
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LAUNCHD_CONF, "$DEFAULT_LAUNCHD_CONF")
|
||||
AC_SUBST(DEFAULT_LAUNCHD_CONF)
|
||||
AC_SUBST(LAUNCHDLIBS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
@@ -1,52 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $"
|
||||
dnl
|
||||
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2008 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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(ldap, [ --enable-ldap turn on LDAP support, default=yes])
|
||||
AC_ARG_WITH(ldap-libs, [ --with-ldap-libs set directory for LDAP library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
AC_ARG_WITH(ldap-includes, [ --with-ldap-includes set directory for LDAP includes],
|
||||
CFLAGS="-I$withval $CFLAGS"
|
||||
CPPFLAGS="-I$withval $CPPFLAGS",)
|
||||
|
||||
LIBLDAP=""
|
||||
|
||||
if test x$enable_ldap != xno; then
|
||||
AC_CHECK_HEADER(ldap.h, [
|
||||
AC_CHECK_LIB(ldap, ldap_initialize,
|
||||
AC_DEFINE(HAVE_LDAP)
|
||||
AC_DEFINE(HAVE_OPENLDAP)
|
||||
LIBLDAP="-lldap"
|
||||
AC_CHECK_LIB(ldap, ldap_start_tls,
|
||||
AC_DEFINE(HAVE_LDAP_SSL)),
|
||||
|
||||
AC_CHECK_LIB(ldap, ldap_init,
|
||||
AC_DEFINE(HAVE_LDAP)
|
||||
AC_DEFINE(HAVE_MOZILLA_LDAP)
|
||||
LIBLDAP="-lldap"
|
||||
AC_CHECK_HEADER(ldap_ssl.h, AC_DEFINE(HAVE_LDAP_SSL_H),,[#include <ldap.h>])
|
||||
AC_CHECK_LIB(ldap, ldapssl_init,
|
||||
AC_DEFINE(HAVE_LDAP_SSL)))
|
||||
)
|
||||
AC_CHECK_LIB(ldap, ldap_set_rebind_proc, AC_DEFINE(HAVE_LDAP_REBIND_PROC))
|
||||
])
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBLDAP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ldap.m4 7800 2008-07-25 21:01:34Z mike $".
|
||||
dnl
|
||||
@@ -1,40 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
|
||||
turn on building with libtool (UNSUPPORTED!), default=no],
|
||||
[if test x$enable_libtool_unsupported != xno; then
|
||||
LIBTOOL="$enable_libtool_unsupported"
|
||||
enable_shared=no
|
||||
echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
|
||||
echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
|
||||
echo " (even if you have a support contract)"
|
||||
else
|
||||
LIBTOOL=""
|
||||
fi])
|
||||
|
||||
AC_SUBST(LIBTOOL)
|
||||
|
||||
if test x$LIBTOOL != x; then
|
||||
LIBCUPS="libcups.la"
|
||||
LIBCUPSIMAGE="libcupsimage.la"
|
||||
LINKCUPS="../cups/\$(LIBCUPS)"
|
||||
LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
|
||||
DSO="\$(CC)"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
@@ -1,104 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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
|
||||
|
||||
dnl Fix "mandir" variable...
|
||||
if test "$mandir" = "\${datarootdir}/man" -a "$prefix" = "/"; then
|
||||
# New GNU "standards" break previous ones, so make sure we use
|
||||
# the right default location for the operating system...
|
||||
mandir="\${prefix}/man"
|
||||
fi
|
||||
|
||||
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
|
||||
case "$uname" in
|
||||
Darwin* | Linux | GNU | *BSD* | AIX*)
|
||||
# Darwin, MacOS X, Linux, GNU HURD, *BSD, and AIX
|
||||
mandir="/usr/share/man"
|
||||
AMANDIR="/usr/share/man"
|
||||
PMANDIR="/usr/share/man"
|
||||
;;
|
||||
IRIX)
|
||||
# SGI IRIX
|
||||
mandir="/usr/share/catman/u_man"
|
||||
AMANDIR="/usr/share/catman/a_man"
|
||||
PMANDIR="/usr/share/catman/p_man"
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
mandir="/usr/man"
|
||||
AMANDIR="/usr/man"
|
||||
PMANDIR="/usr/man"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
AMANDIR="$mandir"
|
||||
PMANDIR="$mandir"
|
||||
fi
|
||||
|
||||
AC_SUBST(AMANDIR)
|
||||
AC_SUBST(PMANDIR)
|
||||
|
||||
dnl Setup manpage extensions...
|
||||
case "$uname" in
|
||||
*BSD* | Darwin*)
|
||||
# *BSD
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=8
|
||||
MAN8DIR=8
|
||||
;;
|
||||
IRIX*)
|
||||
# SGI IRIX
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=1m
|
||||
MAN8DIR=1
|
||||
;;
|
||||
SunOS* | HP-UX*)
|
||||
# Solaris and HP-UX
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=1m
|
||||
MAN8DIR=1m
|
||||
;;
|
||||
Linux* | GNU*)
|
||||
# Linux and GNU Hurd
|
||||
MAN1EXT=1.gz
|
||||
MAN5EXT=5.gz
|
||||
MAN7EXT=7.gz
|
||||
MAN8EXT=8.gz
|
||||
MAN8DIR=8
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
MAN1EXT=1
|
||||
MAN5EXT=5
|
||||
MAN7EXT=7
|
||||
MAN8EXT=8
|
||||
MAN8DIR=8
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(MAN1EXT)
|
||||
AC_SUBST(MAN5EXT)
|
||||
AC_SUBST(MAN7EXT)
|
||||
AC_SUBST(MAN8EXT)
|
||||
AC_SUBST(MAN8DIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
@@ -1,74 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-network.m4 7918 2008-09-08 22:03:01Z mike $"
|
||||
dnl
|
||||
dnl Networking stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2007-2008 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Apple Inc. and are protected by Federal copyright
|
||||
dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
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...
|
||||
if test "$uname" != "OSF1"; then
|
||||
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
|
||||
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
|
||||
fi
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
|
||||
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
|
||||
|
||||
CUPS_DEFAULT_DOMAINSOCKET=""
|
||||
|
||||
dnl Domain socket support...
|
||||
AC_ARG_WITH(domainsocket, [ --with-domainsocket set unix domain socket name],
|
||||
default_domainsocket="$withval",
|
||||
default_domainsocket="")
|
||||
|
||||
if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
|
||||
if test "x$default_domainsocket" = x; then
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin and MaxOS X do their own thing...
|
||||
CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
|
||||
;;
|
||||
*)
|
||||
# All others use FHS standard...
|
||||
CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
|
||||
fi
|
||||
|
||||
CUPS_LISTEN_DOMAINSOCKET="Listen $CUPS_DEFAULT_DOMAINSOCKET"
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET")
|
||||
else
|
||||
CUPS_LISTEN_DOMAINSOCKET=""
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
|
||||
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
|
||||
|
||||
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
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário