Comparar commits
10 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| d996e1ac50 | |||
| ce6379738a | |||
| 6f2911b5b2 | |||
| 443cd51633 | |||
| b4dea4d7c6 | |||
| 608728d8a4 | |||
| 3dd728977a | |||
| 5b8f8fee67 | |||
| a6d5d8328d | |||
| 89c7a9d178 |
@@ -0,0 +1,10 @@
|
||||
*.o
|
||||
.buildrev
|
||||
buildtest.env
|
||||
build.log
|
||||
temp
|
||||
tools/.buildrev
|
||||
tools/Makefile
|
||||
tools/config.log
|
||||
tools/config.status
|
||||
tools/sendbuildlog
|
||||
@@ -0,0 +1,7 @@
|
||||
[submodule "stable"]
|
||||
path = stable
|
||||
url = https://github.com/apple/cups.git
|
||||
branch = branch-2.1
|
||||
[submodule "development"]
|
||||
path = development
|
||||
url = https://github.com/apple/cups.git
|
||||
@@ -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
-325
@@ -1,325 +0,0 @@
|
||||
CHANGES.txt - 02/25/2006
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.2.0b1
|
||||
|
||||
- The serial backend now supports Equinox 8-port serial
|
||||
hubs (STR #526)
|
||||
- The IPP backend now supports a compression option to
|
||||
compress print files as they are sent to the remote
|
||||
server (STR #956)
|
||||
- The CUPS browse protocol now supports passing of
|
||||
default options and browse timeout values from the
|
||||
server to the clients (STR #800)
|
||||
- Implicit classes that timed out could cause the
|
||||
scheduler to crash (STR #1439)
|
||||
- Added DragonFly support in local device backends (STR
|
||||
#1362)
|
||||
- Added LDAP printer browsing support (STR #338)
|
||||
- Added official support for printer maintenance commands
|
||||
via the CUPS Command file format and hooks in the
|
||||
printer-type and web interfaces (STR #932)
|
||||
- The HP-GL/2 filter could get in an infinite loop trying
|
||||
to convert HP-PCL files (STR #1415)
|
||||
- CUPS now implements the HTTP/1.1 Expect header (STR
|
||||
#1407)
|
||||
- Options in PPD files are no longer automatically put in
|
||||
an "Extra" group; rather, all options that are not
|
||||
inside an Open/CloseGroup will be placed in the
|
||||
"General" group (STR #1385)
|
||||
- The scheduler now creates a job-uuid attribute that
|
||||
uniquely identifies a job on a network (STR #1410)
|
||||
- The init script now unsets the TMPDIR environment
|
||||
variable to prevent user temporary directories from
|
||||
being used by cupsd accidentally (STR #1424)
|
||||
- Added support for launchd on MacOS X.
|
||||
- Added support for notify_post on MacOS X.
|
||||
- Added support for DBUS on Linux.
|
||||
- All of the Berkeley (except for lpc) and System V
|
||||
commands now support specification of user, host, and
|
||||
port (STR #1028, STR #1029, STR #1087)
|
||||
- The lpmove command now allows you to move all jobs for
|
||||
a given queue (STR #56)
|
||||
- The web interface now supports moving of a job or jobs
|
||||
to another queue (STR #56)
|
||||
- The web interface now provides searching, paging, and
|
||||
changing of the sort/display order of classes, jobs,
|
||||
and printers.
|
||||
- cupsaddsmb now accepts a password on the command-line
|
||||
and supports passwords with special characters (STR
|
||||
#822, STR #1236)
|
||||
- ppdLoad*() no longer tries to "fix" bad characters in
|
||||
UI text (STR #1101)
|
||||
- Printer names can now (reliably) contain Unicode
|
||||
characters (STR #896)
|
||||
- The lpstat command now shows the time and date of the
|
||||
last printer state change instead of the hardcoded "Jan
|
||||
01 00:00" (STR #659)
|
||||
- The scheduler now adds a job-actual-printer-uri
|
||||
attribute to job objects when printing to a class (STR
|
||||
#116)
|
||||
- The scheduler now logs log file open errors to the
|
||||
system log (STR #1289)
|
||||
- The scheduler now sets the job-originating-user-name to
|
||||
the authenticated username, if available (STR #1318)
|
||||
- The scheduler now only updates the permissions of SSL
|
||||
keys and certificates when they are under the
|
||||
ServerRoot directory (STR #1324)
|
||||
- The rastertodymo driver has been renamed to
|
||||
rastertolabel (a symlink is installed so that existing
|
||||
queues continue to work) and now also supports Zebra's
|
||||
CPCL language.
|
||||
- The lpstat command could show the wrong active job for
|
||||
a printer (STR #1301)
|
||||
- Fixed a potential crash problem in the scheduler when
|
||||
aborting a CGI program (STR #1290)
|
||||
- Added a "cancel all jobs" button to the class and
|
||||
printer web interfaces (STR #1140)
|
||||
- The add-printer web page now shows the
|
||||
set-printer-options page after the printer has been
|
||||
added (STR #690)
|
||||
- The classes web page now provides links to each of the
|
||||
member printers (STR #307)
|
||||
- CUPS now handles HTTP request/response lines up to 32k
|
||||
in length; this is mainly for better cookie support
|
||||
(STR #1274)
|
||||
- Added support for the Apache PassEnv and SetEnv
|
||||
directives to cupsd.conf (STR #853)
|
||||
- Added large file (64-bit) support (STR #541)
|
||||
- Fixed a performance issue with the ippReadIO()
|
||||
implementation (STR #1284)
|
||||
- Fixed a performance issue with the scheduler's implicit
|
||||
class implementation (STR #1283)
|
||||
- The pdftops filter now adds the Title and Creator
|
||||
fields from the PDF file to the PostScript document
|
||||
comments section (STR #539, STR #830)
|
||||
- Added a new cups_array_t and cupsArray*() functions to
|
||||
the CUPS API to support sorted lists of data.
|
||||
- Made the CUPS API library thread-safe (STR #1276)
|
||||
- Added "media" option support for EFI EFMediaType option
|
||||
(STR #902)
|
||||
- Added write buffering to the HTTP code to improve
|
||||
performance (STR #547)
|
||||
- The scheduler now uses the attributes-natural-language
|
||||
attribute to localize banner pages (STR #386)
|
||||
- The scheduler now returns the address that was used to
|
||||
connect to it (STR #1076)
|
||||
- Fixed a problem with N-up printing and OpenOffice (STR
|
||||
#576)
|
||||
- Added support for the GCC position independent
|
||||
executable options (STR #1209)
|
||||
- Added new BrowseLocalProtocols and
|
||||
BrowseRemoteProtocols directives to cupsd.conf,
|
||||
allowing for different browse protocols for local and
|
||||
remote printers (STR #877)
|
||||
- PPD files can now contain strings up to 256k in length
|
||||
(STR #1215)
|
||||
- The pstops filter now supports the IncludeFeature DSC
|
||||
comment (STR #1212)
|
||||
- The pstops filter now disables the setpagedevice
|
||||
procedure when doing N-up printing (STR #1161)
|
||||
- The serial backend now supports "stop=1", "stop=2",
|
||||
"parity=space", and "parity=mark" options (STR #1155)
|
||||
- "make install" no longer overwrites an existing PAM
|
||||
configuration file (STR #1064)
|
||||
- The scheduler now closes all files on startup when run
|
||||
in daemon mode (STR #1009)
|
||||
- Added a new RGBW colorspace to the CUPS raster format
|
||||
(STR #1071)
|
||||
- The pdftops filter now sets the page size based on the
|
||||
media box when not scaling the output (STR #912)
|
||||
- The pdftops filter now supports masked images (STR
|
||||
#281)
|
||||
- The pdftops filter produced large output when rendering
|
||||
PDF files containing lot of repeated images (STR #327)
|
||||
- The pdftops filter now minimizes print processing of
|
||||
PDF files when using the page-ranges option (STR #273)
|
||||
- Updated pdftops filter to Xpdf 3.01.
|
||||
- Added new cupsBackchannelRead() and
|
||||
cupsBackchannelWrite() functions, as well as
|
||||
backchannel support to the parallel, serial, socket,
|
||||
and USB backends (STR #1252)
|
||||
- The parallel and USB backends now treat a "no space
|
||||
available" error as an out-of-paper condition (STR
|
||||
#1225)
|
||||
- The "lpc" command now supports the "status all" command
|
||||
(STR #1004)
|
||||
- ippReadIO() did not read collections properly (STR
|
||||
#1249)
|
||||
- The "make test" script now creates the test files in
|
||||
"/tmp/cups-$USER" instead of "/tmp/$USER" (STR #981)
|
||||
- All backends now abort on error when printing a job to
|
||||
a class - this allows the next printer in the class to
|
||||
print the job (STR #1084)
|
||||
- The scheduler now verifies that a printer supports
|
||||
Letter or A4 media sizes before setting them as the
|
||||
initial default (STR #1250)
|
||||
- The cupstestppd program now flags bad Resolution
|
||||
options (STR #1269)
|
||||
- The USB backend now retries printing when the printer
|
||||
is disconnected or turned off (STR #1267)
|
||||
- Added new httpGetHostname() function to CUPS API, and
|
||||
use it instead of gethostname() so that the web
|
||||
interface will work correctly on systems whose hostname
|
||||
is not the FQDN (STR #1266)
|
||||
- The scheduler now stops printers if the backend for the
|
||||
queue is missing on startup (STR #1265)
|
||||
- The configure script now supports "--disable-library"
|
||||
to disable particular image file format support
|
||||
libraries, even if they are available on the build
|
||||
system (STR #1248)
|
||||
- The IPP backend did not always report on the total
|
||||
number of pages that were printed (STR #1251)
|
||||
- The lpstat program could display garbage date and time
|
||||
values for locales whose date format exceeded 31
|
||||
characters (STR #1263)
|
||||
- The cupstestppd program would segfault when testing
|
||||
certain broken PPD files (STR #1268)
|
||||
- Dramatically reduced the overhead of implicit classes.
|
||||
- Added new cupsDir*() functions to CUPS API.
|
||||
- Printers can now be published individually for sharing.
|
||||
- Fixed a bug in the scheduler's startup signalling code
|
||||
which caused cupsd to send the SIGUSR1 signal to the
|
||||
init process instead of the original parent process
|
||||
(STR #1258)
|
||||
- Added new on-line help CGI to web interface to provide
|
||||
searchable help.
|
||||
- Devices are now tracked dynamically, with each query
|
||||
doing a new device scan. This eliminates a previous
|
||||
startup delay caused by slow backends and allows new
|
||||
printers to be seen without restarting the server,
|
||||
however it limits the amount of device URI checking
|
||||
that can be done (basically now the scheduler only
|
||||
requires a URI with a method that is a listed backend)
|
||||
- Added new printer auto-detection, server configuration,
|
||||
and log file viewing to the administration web page.
|
||||
- Added new "set allowed users" web interface to set the
|
||||
list of allowed users for a printer or class.
|
||||
- The scheduler, command-line, and web interfaces now
|
||||
limit the list of printers and classes to those
|
||||
accessible by a user.
|
||||
- cupsMarkOptions() now handles more non-standard
|
||||
duplexing options and choices (STR #915)
|
||||
- cups-lpd now honors remote banner requests with the
|
||||
"standard" banner whenever a printer does not have one
|
||||
defined (STR #1220)
|
||||
- The scheduler's denial-of-service checks did not work
|
||||
properly with IPv6 addresses (STR #1134)
|
||||
- The lp and lpr commands did not error out properly when
|
||||
they were unable to write to a temporary file (STR
|
||||
#1129)
|
||||
- The pstops filter did not handle Adobe-specific
|
||||
comments in Windows NT driver output (STR #1085)
|
||||
- "lpstat -l -p" incorrectly reported the printer
|
||||
interface (STR #936)
|
||||
- The web interface now operates exclusively with the
|
||||
UTF-8 encoding, and sends the appropriate character set
|
||||
and header information to the web browser (STR #919,
|
||||
STR #1007)
|
||||
- Added a "set allowed users" interface to the web
|
||||
interface so that you can set the list of allowed or
|
||||
denied users/groups for a printer or class.
|
||||
- Disallow the "#" character in printer names, since it
|
||||
has special meaning in the shell, config files, and in
|
||||
URIs (STR #917, STR #1202)
|
||||
- Added a new application/x-csource MIME type, and
|
||||
support for it to the texttops filter so that you can
|
||||
pretty print plain text files without the C/C++
|
||||
keywords being highlighted.
|
||||
- The pdftops filter did not compile with GCC 4.0 (STR
|
||||
#1226)
|
||||
- The texttops filter did not highlight preprocessor
|
||||
directives followed by a tab properly.
|
||||
- HP PJL output now uses both JOB DISPLAY and RDYMSG
|
||||
commands to show the current job on the printer's
|
||||
display (STR #1218)
|
||||
- Local authentication certificates are now stored in
|
||||
/var/run/cups/certs by default instead of
|
||||
/etc/cups/certs (STR #1211)
|
||||
- Backends now use "&" to separate options in device
|
||||
URIs; "+" is still recognized but is deprecated (STR
|
||||
#842)
|
||||
- The USB backend no longer supports the usb:/dev/foo
|
||||
format on systems that support device ID queries.
|
||||
- Forced classification markings did not work when the
|
||||
job-sheets parameters were "none,none".
|
||||
- "lpstat -l -p" incorrectly showed all users as allowed,
|
||||
even if the queue was restricted to certain users (STR
|
||||
#801)
|
||||
- The scheduler now automatically detects SSL/TLS clients
|
||||
without using the SSLPort/SSLListen directives.
|
||||
- The CUPS API and scheduler no longer support SSLv2-
|
||||
encrypted connections.
|
||||
- Updated the cupsaddsmb utility to correctly export the
|
||||
CUPS driver for Windows.
|
||||
- Fixed a signal-handling bug in httpRead() which
|
||||
ultimately caused the server to print multiple copies
|
||||
when it was busy (STR #1184)
|
||||
- The cupsFile API now uses the O_APPEND option when
|
||||
opening files in append mode (STR #990)
|
||||
- The md5.h header and md5_* functions are now officially
|
||||
private and have been renamed to avoid conflicts with
|
||||
other implementations with the same name.
|
||||
- The pdftops filter incorrectly embedded some Type1
|
||||
fonts (STR #1093)
|
||||
- The scheduler didn't detect a closed connection in the
|
||||
middle of an IPP request (STR #1153)
|
||||
- The scheduler could block trying to read the job status
|
||||
if there was input pending and the job was cancelled in
|
||||
the same input cycle (STR #1157)
|
||||
- The scheduler could crash when deleting a class due to
|
||||
infinite recursion.
|
||||
- Updated the Zebra ZPL label printer driver to use the
|
||||
run-length encoding and support more options.
|
||||
- Updated serial backend to scan for /dev/ttyC* as well
|
||||
as /dev/ttyc* for Cyclades serial ports (STR #1049)
|
||||
- The scheduler could hang reading the job status under
|
||||
certain circumstances (STR #1068)
|
||||
- The USB backend termination signal code was inverted
|
||||
(STR #1046)
|
||||
- Moved enable and disable commands to sbindir to be
|
||||
consistent.
|
||||
- Added new cupsRasterInterpretPPD() function for RIP
|
||||
filters to setup the raster page header from
|
||||
PostScript commands in a PPD file.
|
||||
- The CUPS browsing protocol now offers a "delete" bit
|
||||
to remove printers as soon as they are deleted on the
|
||||
server or as soon as the server shuts down gracefully
|
||||
(STR #793)
|
||||
- The CUPS_SERVER and ServerName directives (client.conf
|
||||
and ~/.cupsrc) may now contain names of the form
|
||||
"server:port" and "/path/to/domain/socket".
|
||||
- The "cancel -u user" command now works for ordinary
|
||||
users (STR #751)
|
||||
- Added test run support to "make test" target (STR #64)
|
||||
- Added domain socket support (STR #656)
|
||||
- Added BrowseLocalOptions directive to allow the
|
||||
administrator to add printer URI options to the browse
|
||||
URI, e.g. "encryption=required" (STR #732)
|
||||
- Added BrowseRemoteOptions directive to allow the
|
||||
administrator to add standard URI options to the
|
||||
remote printer URI, e.g. "encryption=required" (STR
|
||||
#732)
|
||||
- Now put "-I.." compiler option in front of all others
|
||||
to ensure that local CUPS headers are used before
|
||||
installed headers (STR #437)
|
||||
- New cupsLangPrintf() and cupsLangPuts() for localized
|
||||
interfaces.
|
||||
- Now support custom attributes and extended options in
|
||||
PPD files.
|
||||
- Now provide functions to save PPD files.
|
||||
- New policy mechanism allows per-operation and
|
||||
per-printer control over what users and groups are
|
||||
allowed to do various IPP operations.
|
||||
- New error policy mechanism to control how aborted
|
||||
backend errors are handled by the scheduler
|
||||
(abort-job, retry-job, requeue-job, stop-printer)
|
||||
- Updated the printer test page with a better color
|
||||
wheel and a separate grayscale ramp.
|
||||
- A single backend process is now run to send all print
|
||||
data for a job.
|
||||
- Backends and filters can now send and receive
|
||||
backchannel data over file descriptor 3.
|
||||
- Updated the raster stream format to support more
|
||||
user-defined attributes and to do compression of the
|
||||
page data.
|
||||
@@ -1,37 +0,0 @@
|
||||
CREDITS.txt - 02/23/2006
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
like to thank the following individuals for their contributions:
|
||||
|
||||
Nathaniel Barbour - Lots of testing and feedback.
|
||||
N. Becker - setsid().
|
||||
Jean-Eric Cuendet - GhostScript filters for CUPS.
|
||||
Van Dang - HTTP and IPP policeman.
|
||||
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.
|
||||
Kiko - Bug fixes.
|
||||
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
|
||||
Mark Lawrence - Microsoft interoperability testing.
|
||||
Jeff Licquia - Bug fixes, beta testing, evangelism.
|
||||
Jason McMullan - Original CUPS RPM distributions.
|
||||
Wes Morgan - *BSD fixes.
|
||||
Ulrich Oldendorf - German locale.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Gilles QUERRET - French man pages.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
Andrea Suatoni - IRIX desktop integration and testing.
|
||||
Tomohiro Kato - Japanese 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
|
||||
"mike@easysw.com".
|
||||
-174
@@ -1,174 +0,0 @@
|
||||
INSTALL - CUPS v1.2b1 - 2006-03-03
|
||||
----------------------------------
|
||||
|
||||
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, YOU WILL ALSO ****
|
||||
**** NEED TO INSTALL ESP GHOSTSCRIPT AFTER YOU INSTALL CUPS ****
|
||||
|
||||
|
||||
BEFORE YOU BEGIN
|
||||
|
||||
You'll need ANSI-compliant C and C++ compilers, plus a make
|
||||
program and Bourne shell. The GNU compiler tools work well -
|
||||
we've tested the current CUPS code against several versions
|
||||
of GCC with excellent results.
|
||||
|
||||
The makefiles used by the project should work with all
|
||||
versions of make. We've tested them with GNU make as well as
|
||||
the make programs shipped by Compaq, HP, SGI, and Sun.
|
||||
FreeBSD users should use GNU make (gmake).
|
||||
|
||||
Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB
|
||||
libraries for image support, the CDSA, GNU TLS, or OpenSSL
|
||||
libraries for encryption support, and the OpenLDAP and
|
||||
OpenSLP libraries for directory services support. CUPS will
|
||||
compile and run without these, however you'll miss out on
|
||||
many of the features provided by CUPS.
|
||||
|
||||
Also, please note that CUPS no longer includes the
|
||||
Ghostscript- based pstoraster filter. You *must* download
|
||||
ESP Ghostscript separately from the CUPS web site if you want
|
||||
to print PostScript files to non-PostScript printers.
|
||||
|
||||
|
||||
COMPILING FROM SUBVERSION
|
||||
|
||||
The CUPS Subversion repository doesn't hold a copy of the
|
||||
pre-built configure script. You'll need to run the GNU
|
||||
autoconf software (2.52 or higher) before compiling the
|
||||
software from Subversion:
|
||||
|
||||
autoconf -f
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
|
||||
CUPS uses GNU autoconf, so you should find the usual
|
||||
"configure" script in the main CUPS source directory. To
|
||||
configure CUPS for your system, type:
|
||||
|
||||
./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 ...
|
||||
|
||||
Once you have configured things, just type:
|
||||
|
||||
make ENTER
|
||||
|
||||
or if you have FreeBSD, NetBSD, or OpenBSD type:
|
||||
|
||||
gmake ENTER
|
||||
|
||||
to build the software.
|
||||
|
||||
|
||||
INSTALLING THE SOFTWARE
|
||||
|
||||
Once you have built the software you need to install it. The
|
||||
"install" target provides a quick way to install the software
|
||||
on your local system:
|
||||
|
||||
make install ENTER
|
||||
|
||||
or for FreeBSD, 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 - we use
|
||||
EPM to build all of our binary distributions.
|
||||
|
||||
You can find the RPM software at:
|
||||
|
||||
http://www.rpm.org/
|
||||
|
||||
The EPM software is available at:
|
||||
|
||||
http://www.easysw.com/epm/
|
||||
|
||||
|
||||
CREATING BINARY DISTRIBUTIONS WITH EPM
|
||||
|
||||
The top level makefile supports generation of many types of binary
|
||||
distributions using EPM. To build a binary distribution type:
|
||||
|
||||
make <format> ENTER
|
||||
|
||||
or
|
||||
|
||||
gmake <format> ENTER
|
||||
|
||||
for FreeBSD, 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)
|
||||
|
||||
|
||||
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.
|
||||
+65
-61
@@ -1,12 +1,10 @@
|
||||
Common UNIX Printing System License Agreement
|
||||
|
||||
Copyright 1997-2006 by Easy Software Products
|
||||
44141 AIRPORT VIEW DR STE 204
|
||||
HOLLYWOOD, MARYLAND 20636 USA
|
||||
Copyright 2007 by Apple Inc.
|
||||
1 Infinite Loop
|
||||
Cupertino, CA 95014 USA
|
||||
|
||||
Voice: +1.301.373.9600
|
||||
Email: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
WWW: http://www.cups.org/
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
@@ -17,12 +15,12 @@ General Public License ("LGPL"), Version 2, with exceptions for
|
||||
Apple operating systems and the OpenSSL toolkit. A copy of the
|
||||
exceptions and licenses follow this introduction.
|
||||
|
||||
The GNU LGPL applies to the CUPS API library, located in the
|
||||
"cups" subdirectory of the CUPS source distribution and in the
|
||||
"cups" include directory and library files in the binary
|
||||
distributions. The GNU GPL applies to the remainder of the CUPS
|
||||
distribution, including the "pdftops" filter which is based upon
|
||||
Xpdf and the CUPS imaging library.
|
||||
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
|
||||
located in the "cups" and "filter" subdirectories of the CUPS
|
||||
source distribution and in the "cups" include directory and
|
||||
library files in the binary distributions. The GNU GPL applies to
|
||||
the remainder of the CUPS distribution, including the "pdftops"
|
||||
filter which is based upon Xpdf.
|
||||
|
||||
For those not familiar with the GNU GPL, the license basically
|
||||
allows you to:
|
||||
@@ -32,28 +30,25 @@ allows you to:
|
||||
binary form.
|
||||
- Sell verbatim copies of the software for a media fee, or
|
||||
sell support for the software.
|
||||
- Distribute or sell printer drivers and filters that use
|
||||
CUPS so long as source code is made available under the
|
||||
GPL.
|
||||
|
||||
What this license *does not* allow you to do is make changes or
|
||||
add features to CUPS and then sell a binary distribution without
|
||||
source code. You must provide source for any new drivers,
|
||||
changes, or additions to the software, and all code must be
|
||||
provided under the GPL or LGPL as appropriate. The only
|
||||
exceptions to this are the portions of the CUPS software covered
|
||||
by the Apple operating system license exceptions outlined later
|
||||
in this license agreement.
|
||||
source code. You must provide source for any changes or additions
|
||||
to the software, and all code must be provided under the GPL or
|
||||
LGPL as appropriate. The only exceptions to this are the portions
|
||||
of the CUPS software covered by the Apple operating system
|
||||
license exceptions outlined later in this license agreement.
|
||||
|
||||
The GNU LGPL relaxes the "link-to" restriction, allowing you to
|
||||
develop applications that use the CUPS API library under other
|
||||
licenses and/or conditions as appropriate for your application.
|
||||
develop applications that use the CUPS and CUPS Imaging libraries
|
||||
under other licenses and/or conditions as appropriate for your
|
||||
application, driver, or filter.
|
||||
|
||||
|
||||
LICENSE EXCEPTIONS
|
||||
|
||||
In addition, as the copyright holder of CUPS, Easy Software
|
||||
Products grants the following special exceptions:
|
||||
In addition, as the copyright holder of CUPS, Apple Inc. grants
|
||||
the following special exceptions:
|
||||
|
||||
1. Apple Operating System Development License Exception;
|
||||
|
||||
@@ -96,49 +91,58 @@ Products grants the following special exceptions:
|
||||
|
||||
2. OpenSSL Toolkit License Exception;
|
||||
|
||||
a. Easy Software Products explicitly allows the
|
||||
compilation and distribution of the CUPS software
|
||||
with the OpenSSL Toolkit.
|
||||
a. Apple Inc. explicitly allows the compilation and
|
||||
distribution of the CUPS software with the OpenSSL
|
||||
Toolkit.
|
||||
|
||||
No developer is required to provide these exceptions in a
|
||||
derived work.
|
||||
|
||||
|
||||
KERBEROS SUPPORT CODE
|
||||
|
||||
The Kerberos support code ("KSC") is copyright 2006 by Jelmer
|
||||
Vernooij and is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author or Apple Inc. be held
|
||||
liable for any damages arising from the use of the KSC.
|
||||
|
||||
Sources files containing KSC have the following text at the top
|
||||
of each source file:
|
||||
|
||||
This file contains Kerberos support code, copyright 2006 by
|
||||
Jelmer Vernooij.
|
||||
|
||||
The KSC copyright and license apply only to Kerberos-related
|
||||
feature code in CUPS. Such code is typically conditionally
|
||||
compiled based on the present of the HAVE_GSSAPI preprocessor
|
||||
definition.
|
||||
|
||||
Permission is granted to anyone to use the KSC for any purpose,
|
||||
including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of the KSC must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If
|
||||
you use the KSC in a product, an acknowledgment in the
|
||||
product documentation would be appreciated but is not
|
||||
required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such,
|
||||
and must not be misrepresented as being the original
|
||||
software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
|
||||
TRADEMARKS
|
||||
|
||||
Easy Software Products has trademarked the Common UNIX Printing
|
||||
System, CUPS, and CUPS logo. You may use these names and logos
|
||||
in any direct port or binary distribution of CUPS. Please
|
||||
contact Easy Software Products for written permission to use
|
||||
them in derivative products. Our intention is to protect the
|
||||
value of these trademarks and ensure that any derivative product
|
||||
meets the same high-quality standards as the original.
|
||||
|
||||
|
||||
BINARY DISTRIBUTION RIGHTS
|
||||
|
||||
Easy Software Products also sells rights to the CUPS source code
|
||||
under a binary distribution license for vendors that are unable
|
||||
to release source code for their drivers, additions, and
|
||||
modifications to CUPS under the GNU GPL and LGPL. For
|
||||
information please contact us at the address shown above.
|
||||
|
||||
The Common UNIX Printing System provides a "pdftops" filter that
|
||||
is based on the Xpdf software. For binary distribution licensing
|
||||
of this software, please contact:
|
||||
|
||||
Derek B. Noonburg
|
||||
Email: derekn@glyphandcog.com
|
||||
WWW: http://www.glyphandcog.com/
|
||||
|
||||
|
||||
SUPPORT
|
||||
|
||||
Easy Software Products sells software support for CUPS as well
|
||||
as a commercial printing product based on CUPS called ESP Print
|
||||
Pro. You can find out more at our web site:
|
||||
|
||||
http://www.easysw.com/
|
||||
Apple Inc. has trademarked the Common UNIX Printing System, CUPS,
|
||||
and CUPS logo. You may use these names and logos in any direct port
|
||||
or binary distribution of CUPS. Please contact Apple Inc. for written
|
||||
permission to use them in derivative products. Our intention is to
|
||||
protect the value of these trademarks and ensure that any derivative
|
||||
product meets the same high-quality standards as the original.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
-220
@@ -1,220 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Common makefile definitions for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
#
|
||||
# Programs...
|
||||
#
|
||||
|
||||
AR = @AR@
|
||||
AWK = @AWK@
|
||||
CC = @LIBTOOL@ @CC@
|
||||
CXX = @LIBTOOL@ @CXX@
|
||||
DSO = @DSO@
|
||||
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
|
||||
STRIP = @STRIP@
|
||||
|
||||
#
|
||||
# Installation programs...
|
||||
#
|
||||
|
||||
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755
|
||||
INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
INSTALL_DIR = $(INSTALL) -d
|
||||
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755
|
||||
INSTALL_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@
|
||||
|
||||
#
|
||||
# Libraries...
|
||||
#
|
||||
|
||||
LIBCUPS = @LIBCUPS@
|
||||
LIBCUPSIMAGE = @LIBCUPSIMAGE@
|
||||
LIBJPEG = @LIBJPEG@
|
||||
LIBLDAP = @LIBLDAP@
|
||||
LIBMALLOC = @LIBMALLOC@
|
||||
LIBPAPER = @LIBPAPER@
|
||||
LIBPNG = @LIBPNG@
|
||||
LIBSLP = @LIBSLP@
|
||||
LIBTIFF = @LIBTIFF@
|
||||
LIBZ = @LIBZ@
|
||||
|
||||
#
|
||||
# Install static libraries?
|
||||
#
|
||||
|
||||
INSTALLSTATIC = @INSTALLSTATIC@
|
||||
|
||||
#
|
||||
# Program options...
|
||||
#
|
||||
# OPTIM defines the common compiler optimization/debugging options.
|
||||
# OPTIONS defines other compile-time options (currently only -dDEBUG for
|
||||
# extra debug info)
|
||||
#
|
||||
|
||||
ARFLAGS = @ARFLAGS@
|
||||
BACKLIBS = @BACKLIBS@
|
||||
CFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
COMMONLIBS = @LIBS@
|
||||
CUPSDLIBS = @CUPSDLIBS@
|
||||
CXXFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
CXXLIBS = @CXXLIBS@
|
||||
DSOFLAGS = @DSOFLAGS@
|
||||
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
|
||||
IMGLIBS = @IMGLIBS@ -lm
|
||||
LDFLAGS = -L../cups -L../filter $(RC_CFLAGS) @LDFLAGS@ $(OPTIM)
|
||||
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
OPTIM = @OPTIM@
|
||||
OPTIONS =
|
||||
PAMLIBS = @PAMLIBS@
|
||||
PHPDIR = @PHPDIR@
|
||||
SSLFLAGS = @SSLFLAGS@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
LAUNCHDLIBS = @LAUNCHDLIBS@
|
||||
|
||||
#
|
||||
# Directories...
|
||||
#
|
||||
# The first section uses the GNU names (which are *extremely*
|
||||
# difficult to find in a makefile because they are lowercase...)
|
||||
# We have to define these first because autoconf uses ${prefix}
|
||||
# and ${exec_prefix} for most of the other directories...
|
||||
#
|
||||
# This is immediately followed by definition in ALL CAPS for the
|
||||
# needed directories...
|
||||
#
|
||||
|
||||
bindir = @bindir@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
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@
|
||||
INCLUDEDIR = $(BUILDROOT)$(includedir)
|
||||
INITDIR = @INITDIR@
|
||||
INITDDIR = @INITDDIR@
|
||||
LIBDIR = $(BUILDROOT)$(libdir)
|
||||
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
|
||||
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
|
||||
MANDIR = $(BUILDROOT)@mandir@
|
||||
PMANDIR = $(BUILDROOT)@PMANDIR@
|
||||
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
|
||||
SBINDIR = $(BUILDROOT)@sbindir@
|
||||
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
|
||||
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
|
||||
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
|
||||
|
||||
MAN1EXT = @MAN1EXT@
|
||||
MAN5EXT = @MAN5EXT@
|
||||
MAN7EXT = @MAN7EXT@
|
||||
MAN8EXT = @MAN8EXT@
|
||||
MAN8DIR = @MAN8DIR@
|
||||
|
||||
PAMDIR = @PAMDIR@
|
||||
PAMFILE = @PAMFILE@
|
||||
|
||||
DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
|
||||
DBUSDIR = @DBUSDIR@
|
||||
|
||||
|
||||
#
|
||||
# Rules...
|
||||
#
|
||||
|
||||
.SILENT:
|
||||
.SUFFIXES: .1 .1.gz .1m .1m.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .gz
|
||||
|
||||
.c.o:
|
||||
echo Compiling $<...
|
||||
$(CC) $(OPTIM) $(CFLAGS) -c $<
|
||||
|
||||
.cxx.o:
|
||||
echo Compiling $<...
|
||||
$(CXX) $(OPTIM) $(CXXFLAGS) -c $<
|
||||
|
||||
.man.1 .man.1m .man.5 .man.7 .man.8:
|
||||
echo Linking $<...
|
||||
$(RM) $@
|
||||
$(LN) $< $@
|
||||
|
||||
.man.1.gz .man.1m.gz .man.5.gz .man.7.gz .man.8.gz .man.gz:
|
||||
echo -n Compressing $<...
|
||||
$(RM) $@
|
||||
gzip -v9 <$< >$@
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$"
|
||||
#
|
||||
-197
@@ -1,197 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Top-level Makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636-3142 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include Makedefs
|
||||
|
||||
#
|
||||
# Directories to make...
|
||||
#
|
||||
|
||||
DIRS = cups backend berkeley cgi-bin filter locale man monitor \
|
||||
notifier pdftops scheduler systemv test \
|
||||
$(PHPDIR) \
|
||||
conf data doc fonts ppd templates
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all:
|
||||
chmod +x cups-config
|
||||
for dir in $(DIRS); do\
|
||||
echo Making all in $$dir... ;\
|
||||
(cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Remove object and target files...
|
||||
#
|
||||
|
||||
clean:
|
||||
for dir in $(DIRS); do\
|
||||
echo Cleaning in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Make dependencies
|
||||
#
|
||||
|
||||
depend:
|
||||
for dir in $(DIRS); do\
|
||||
echo Making dependencies in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Install object and target files...
|
||||
#
|
||||
|
||||
install: installhdrs
|
||||
for dir in $(DIRS); do\
|
||||
echo Installing in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) install) || exit 1;\
|
||||
done
|
||||
echo Installing cups-config script...
|
||||
$(INSTALL_DIR) -m 755 $(BINDIR)
|
||||
$(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
|
||||
echo Installing startup script...
|
||||
if test "x$(INITDIR)" != "x"; then \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d; \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc3.d; \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc5.d; \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
|
||||
fi
|
||||
if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \
|
||||
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \
|
||||
if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
|
||||
$(INSTALL_SCRIPT) init/PrintingServices $(BUILDROOT)$(INITDDIR)/PrintingServices; \
|
||||
$(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
|
||||
$(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
|
||||
elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
|
||||
$(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
|
||||
else \
|
||||
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
|
||||
fi \
|
||||
fi
|
||||
if test "x$(DBUSDIR)" != "x"; then \
|
||||
echo Installing cups.conf in $(DBUSDIR)...;\
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR); \
|
||||
$(INSTALL_DATA) packaging/cups-dbus.conf $(BUILDROOT)$(DBUSDIR)/cups.conf; \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install source and header files...
|
||||
#
|
||||
|
||||
installsrc:
|
||||
gnutar --dereference --exclude=.svn -cf - . | gnutar -C $(SRCROOT) -xf -
|
||||
|
||||
installhdrs:
|
||||
(cd cups ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;\
|
||||
(cd filter ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;
|
||||
|
||||
|
||||
#
|
||||
# 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)$(DEFAULT_LAUNCHD_CONF); \
|
||||
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
|
||||
|
||||
|
||||
#
|
||||
# Run the test suite...
|
||||
#
|
||||
|
||||
check test: all
|
||||
echo Running CUPS test suite...
|
||||
cd test; ./run-stp-tests.sh
|
||||
|
||||
|
||||
#
|
||||
# Make software distributions using EPM (http://www.easysw.com/epm/)...
|
||||
#
|
||||
|
||||
EPMFLAGS = -v
|
||||
|
||||
aix bsd deb depot inst osx pkg rpm setld slackware swinstall tardist:
|
||||
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
|
||||
|
||||
epm:
|
||||
epm $(EPMFLAGS) cups packaging/cups.list
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
+25
-192
@@ -1,204 +1,37 @@
|
||||
README - CUPS v1.2b1 - 2006-03-03
|
||||
---------------------------------
|
||||
README.txt - 2016-03-15
|
||||
-----------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
instead...
|
||||
This directory contains an automated build and test environment for CUPS.
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
ENVIRONMENT
|
||||
|
||||
CUPS provides a portable printing layer for UNIX(r)-based
|
||||
operating systems. It has been developed by Easy Software
|
||||
Products to promote a standard printing solution for all UNIX
|
||||
vendors and users. CUPS provides the System V and Berkeley
|
||||
command-line interfaces.
|
||||
If present, the buildtest.env file sets additional shell variables for the
|
||||
build and test scripts described below. The following variables are
|
||||
currently supported:
|
||||
|
||||
CUPS uses the Internet Printing Protocol ("IPP") as the basis
|
||||
for managing print jobs and queues. The Line Printer Daemon
|
||||
("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
|
||||
JetDirect) protocols are also supported with reduced
|
||||
functionality. CUPS adds network printer browsing and
|
||||
PostScript Printer Description ("PPD") based printing options
|
||||
to support real-world printing under UNIX.
|
||||
|
||||
CUPS includes an image file RIP that supports printing of
|
||||
image files to non-PostScript printers. A customized version
|
||||
of GPL Ghostscript for CUPS called ESP Ghostscript is
|
||||
available separately to support printing of PostScript files
|
||||
within the CUPS driver framework. Sample drivers for Dymo,
|
||||
EPSON, HP, and OKIDATA printers are included that use these
|
||||
filters.
|
||||
|
||||
Drivers for thousands of printers are provided with our ESP
|
||||
Print Pro software, available at:
|
||||
|
||||
http://www.easysw.com/printpro/
|
||||
|
||||
CUPS is licensed under the GNU General Public License and GNU
|
||||
Library General Public License. Please contact Easy Software
|
||||
Products for commercial support and "binary distribution"
|
||||
rights.
|
||||
BUILDOPTIONS - Configure options that are passed to each target
|
||||
BUILDNOTIFY - An email address or URL that specifies where the
|
||||
build log should be sent.
|
||||
BUILDSUBJECT - A string to include in the subject (default is empty
|
||||
string)
|
||||
|
||||
|
||||
READING THE DOCUMENTATION
|
||||
SCRIPTS
|
||||
|
||||
Once you have installed the software you can access the
|
||||
documentation (and a bunch of other stuff) on-line at:
|
||||
The build.sh script builds the current stable branch of CUPS along with
|
||||
master ("latest"), running "make check" in each. Normally you will run the
|
||||
script via a cron job:
|
||||
|
||||
http://localhost:631/
|
||||
0 0 * * 0 /path/to/build.sh --update --quiet clean all
|
||||
0 0 * * 1-6 /path/to/build.sh --update --quiet
|
||||
|
||||
If you're having trouble getting that far, the documentation
|
||||
is located under the "doc/help" directory.
|
||||
The "--update" option tells build.sh to do an "git pull" prior to building.
|
||||
|
||||
Please read the documentation before asking questions.
|
||||
The "--quiet" option tells build.sh to work quietly and optionally send the
|
||||
build log via email or HTTP POST for recording, automated processing, etc.
|
||||
|
||||
|
||||
GETTING SUPPORT AND OTHER RESOURCES
|
||||
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! We also
|
||||
provide many discussion forums which are available at:
|
||||
|
||||
http://www.cups.org/newsgroups.php
|
||||
|
||||
Commercial support (with a guaranteed response time) is
|
||||
available from Easy Software Products. For more information
|
||||
see:
|
||||
|
||||
http://www.easysw.com/cups/
|
||||
|
||||
See the CUPS web site at "http://www.cups.org/" for other
|
||||
site links.
|
||||
|
||||
|
||||
SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
|
||||
|
||||
CUPS 1.2 includes a web-based administration tool that allows
|
||||
you to manage printers, classes, and jobs on your server.
|
||||
Open the following URL in your browser to access the printer
|
||||
administration tools:
|
||||
|
||||
http://localhost:631/admin/
|
||||
|
||||
DO NOT use the hostname for your machine - it will not work
|
||||
with the default CUPS configuration. To enable
|
||||
administration access on other addresses, check the "Allow
|
||||
Remote Administration" box and click on the "Change Settings"
|
||||
button.
|
||||
|
||||
You will be asked for the administration password (root or
|
||||
any other user in the sys/system/root group on your system)
|
||||
when performing any administrative function.
|
||||
|
||||
|
||||
SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
|
||||
|
||||
CUPS works best with PPD (PostScript Printer Description)
|
||||
files. In a pinch you can also use System V style printer
|
||||
interface scripts.
|
||||
|
||||
CUPS includes several sample PPD files you can use:
|
||||
|
||||
Driver PPD File
|
||||
----------------------------- ------------
|
||||
Dymo Label Printers dymo.ppd
|
||||
EPSON Stylus Color Series stcolor.ppd
|
||||
EPSON Stylus Photo Series stphoto.ppd
|
||||
EPSON Stylus New Color Series stcolor2.ppd
|
||||
EPSON Stylus New Photo Series stphoto2.ppd
|
||||
EPSON 9-pin Series epson9.ppd
|
||||
EPSON 24-pin Series epson24.ppd
|
||||
HP DeskJet Series deskjet.ppd
|
||||
HP LaserJet Series laserjet.ppd
|
||||
OKIDATA 9-Pin Series okidata9.ppd
|
||||
OKIDATA 24-Pin Series okidat24.ppd
|
||||
Zebra EPL1 Label Printer zebraep1.ppd
|
||||
Zebra EPL2 Label Printer zebraep2.ppd
|
||||
Zebra ZPL Label Printer zebra.ppd
|
||||
|
||||
Run the "lpinfo" 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 URI -m filename.ppd
|
||||
|
||||
Network printers typically use "socket" or "lpd" URIs:
|
||||
|
||||
lpadmin -p printername -E -v socket://11.22.33.44 -m filename.ppd
|
||||
lpadmin -p printername -E -v lpd://11.22.33.44/ -m filename.ppd
|
||||
|
||||
The sample drivers provide basic printing capabilities, but
|
||||
generally do not exercise the full potential of the printers
|
||||
or CUPS. For fully-functional commercial printer drivers
|
||||
check out our ESP Print Pro software at:
|
||||
|
||||
http://www.easysw.com/printpro/
|
||||
|
||||
|
||||
PRINTING FILES
|
||||
|
||||
CUPS provides both the System V "lp" and Berkeley "lpr"
|
||||
commands for printing:
|
||||
|
||||
lp filename
|
||||
lpr filename
|
||||
|
||||
Both the "lp" and "lpr" commands support printing options for
|
||||
the driver:
|
||||
|
||||
lp -omedia=A4 -oresolution=600dpi filename
|
||||
lpr -omedia=A4 -oresolution=600dpi filename
|
||||
|
||||
CUPS recognizes many types of images files as well as PDF,
|
||||
PostScript, HP-GL/2, and text files, so you can print those
|
||||
files directly rather than through an application.
|
||||
|
||||
If you have an application that generates output specifically
|
||||
for your printer then you need to use the "-oraw" or "-l"
|
||||
options:
|
||||
|
||||
lp -oraw filename
|
||||
lpr -l filename
|
||||
|
||||
This will prevent the filters from misinterpreting your print
|
||||
file.
|
||||
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 1993-2006 by Easy Software Products. CUPS,
|
||||
the CUPS logo, and the Common UNIX Printing System are the
|
||||
trademark property of Easy Software Products.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
The PDF filter (pdftops) is based on the Xpdf software,
|
||||
Copyright 1996-2005 by Derek B. Noonburg.
|
||||
|
||||
This software is based in part on the work of the Independent
|
||||
JPEG Group.
|
||||
|
||||
CUPS is provided under the terms of the GNU General Public
|
||||
License and GNU Library General Public License. This program
|
||||
is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
"doc/help/license.html" or "LICENSE.txt" files for more
|
||||
information.
|
||||
|
||||
For commercial licensing information, please contact:
|
||||
|
||||
Attn: CUPS Licensing Information
|
||||
Easy Software Products
|
||||
44141 Airport View Drive, Suite 204
|
||||
Hollywood, Maryland 20636 USA
|
||||
|
||||
Voice: +1.301.373.9600
|
||||
Email: cups-info@cups.org
|
||||
WWW: http://www.cups.org/
|
||||
|
||||
Note that commercial licensors may also require a license from
|
||||
Derek B. Noonburg who developed the Xpdf software used to print
|
||||
PDF files.
|
||||
The "clean" and "all" options specify build targets; the default target is
|
||||
"all". In the example above, the first line tells cron to run the script at
|
||||
midnight each day; Sunday (day 0) also does a clean build, while every other
|
||||
day only builds files that have changed.
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
betest.o: ../cups/string.h ../config.h
|
||||
ipp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
|
||||
ipp.o: ../cups/ipp-private.h ../cups/ipp.h ../cups/backend.h ../cups/cups.h
|
||||
ipp.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
ipp.o: ../cups/language.h ../cups/string.h
|
||||
lpd.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
|
||||
lpd.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
|
||||
lpd.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
lpd.o: ../cups/string.h
|
||||
parallel.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
parallel.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
parallel.o: ../cups/language.h ../cups/string.h ../config.h ieee1284.c
|
||||
parallel.o: ../cups/debug.h
|
||||
scsi.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
scsi.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
scsi.o: ../cups/language.h ../cups/string.h ../config.h
|
||||
serial.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
serial.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
serial.o: ../cups/language.h ../cups/string.h ../config.h
|
||||
socket.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
|
||||
socket.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
|
||||
socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
socket.o: ../cups/string.h
|
||||
test1284.o: ../cups/string.h ../config.h ieee1284.c ../cups/debug.h
|
||||
usb.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
usb.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
usb.o: ../cups/language.h ../cups/string.h ../config.h
|
||||
@@ -1,196 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Backend makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
# This file is subject to the Apple OS-Developed Software exception.
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
RBACKENDS = ipp lpd
|
||||
UBACKENDS = parallel scsi serial socket usb
|
||||
TARGETS = betest test1284 $(RBACKENDS) $(UBACKENDS)
|
||||
OBJS = betest.o ipp.o lpd.o parallel.o scsi.o \
|
||||
serial.o socket.o test1284.o usb.o
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
||||
#
|
||||
# Clean all object files...
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS) http
|
||||
|
||||
|
||||
#
|
||||
# Update dependencies (without system header dependencies...)
|
||||
#
|
||||
|
||||
depend:
|
||||
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all
|
||||
$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
|
||||
for file in $(RBACKENDS); do \
|
||||
$(LIBTOOL) $(INSTALL) -m 700 $$file $(SERVERBIN)/backend; \
|
||||
done
|
||||
for file in $(UBACKENDS); do \
|
||||
$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
|
||||
done
|
||||
$(RM) $(SERVERBIN)/backend/http
|
||||
$(LN) ipp $(SERVERBIN)/backend/http
|
||||
|
||||
|
||||
#
|
||||
# Uninstall all targets...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for file in $(RBACKENDS) $(UBACKENDS); do \
|
||||
$(RM) $(SERVERBIN)/backend/$$file; \
|
||||
done
|
||||
$(RM) $(SERVERBIN)/backend/http
|
||||
-$(RMDIR) $(SERVERBIN)/backend
|
||||
-$(RMDIR) $(SERVERBIN)
|
||||
|
||||
|
||||
#
|
||||
# betest
|
||||
#
|
||||
|
||||
betest: betest.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o betest betest.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# test1284
|
||||
#
|
||||
|
||||
test1284: test1284.o ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# ieee1394
|
||||
#
|
||||
|
||||
ieee1394: ieee1394.o ieee1394-linux.o
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o ieee1394 ieee1394.o ieee1394-linux.o -lraw1394 $(LIBS)
|
||||
|
||||
ieee1394.o: ieee1394.h
|
||||
ieee1394-linux.o: ieee1394.h
|
||||
|
||||
|
||||
#
|
||||
# ipp
|
||||
#
|
||||
|
||||
ipp: ipp.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o ipp ipp.o $(LIBS)
|
||||
$(RM) http
|
||||
$(LN) ipp http
|
||||
|
||||
|
||||
#
|
||||
# lpd
|
||||
#
|
||||
|
||||
lpd: lpd.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# parallel
|
||||
#
|
||||
|
||||
parallel: parallel.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o parallel parallel.o $(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
|
||||
|
||||
|
||||
#
|
||||
# serial
|
||||
#
|
||||
|
||||
serial: serial.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# socket
|
||||
#
|
||||
|
||||
socket: socket.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o socket socket.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# usb
|
||||
#
|
||||
|
||||
usb: usb.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
|
||||
usb.o: usb.c usb-darwin.c usb-unix.c ieee1284.c
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Backend test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Run the named backend.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Run the named backend.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* betest device-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (7 or 8) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
char backend[255]; /* Method in URI */
|
||||
|
||||
|
||||
if (argc < 7 || argc > 8)
|
||||
{
|
||||
fputs("Usage: betest device-uri job-id user title copies options [file]\n",
|
||||
stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the method from the device-uri - that's the program we want to
|
||||
* execute.
|
||||
*/
|
||||
|
||||
if (sscanf(argv[1], "%254[^:]", backend) != 1)
|
||||
{
|
||||
fputs("betest: Bad device-uri - no colon!\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute and return
|
||||
*/
|
||||
|
||||
execl(backend, argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7],
|
||||
NULL);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -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,373 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* get_device_id() - Get the IEEE-1284 device ID string and corresponding
|
||||
* URI.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/debug.h>
|
||||
#ifdef __linux
|
||||
# include <sys/ioctl.h>
|
||||
# include <linux/lp.h>
|
||||
# define IOCNR_GET_DEVICE_ID 1
|
||||
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
|
||||
#endif /* __linux */
|
||||
|
||||
#ifdef __sun
|
||||
# ifdef __sparc
|
||||
# include <sys/ecppio.h>
|
||||
# else
|
||||
# include <sys/ioccom.h>
|
||||
# include <sys/ecppsys.h>
|
||||
# endif /* __sparc */
|
||||
#endif /* __sun */
|
||||
|
||||
|
||||
/*
|
||||
* 'get_device_id()' - Get the IEEE-1284 device ID string and
|
||||
* corresponding URI.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
get_device_id(
|
||||
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 */
|
||||
{
|
||||
char *attr, /* 1284 attribute */
|
||||
*delim, /* 1284 delimiter */
|
||||
*uriptr, /* Pointer into URI */
|
||||
*mfg, /* Manufacturer string */
|
||||
*mdl, /* Model string */
|
||||
serial_number[1024]; /* Serial number string */
|
||||
#ifdef __linux
|
||||
int length; /* Length of device ID info */
|
||||
#endif /* __linux */
|
||||
#if defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
struct ecpp_device_id did; /* Device ID buffer */
|
||||
#endif /* __sun && ECPPIOC_GETDEVID */
|
||||
|
||||
DEBUG_printf(("get_device_id(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 (fd < 0 ||
|
||||
!device_id || device_id_size < 32 ||
|
||||
!make_model || make_model_size < 32)
|
||||
{
|
||||
DEBUG_puts("get_device_id: Bad args!");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
*device_id = '\0';
|
||||
*make_model = '\0';
|
||||
|
||||
if (uri)
|
||||
*uri = '\0';
|
||||
|
||||
/*
|
||||
* Get the device ID string...
|
||||
*/
|
||||
|
||||
#ifdef __linux
|
||||
if (!ioctl(fd, LPIOC_GET_DEVICE_ID(device_id_size), device_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
|
||||
printf("get_device_id: 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
|
||||
printf("get_device_id: ioctl failed - %s\n", strerror(errno));
|
||||
# endif /* DEBUG */
|
||||
#endif /* __sun && ECPPIOC_GETDEVID */
|
||||
|
||||
DEBUG_printf(("get_device_id: device_id=\"%s\"\n", device_id));
|
||||
|
||||
if (!*device_id)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Look for the description field...
|
||||
*/
|
||||
|
||||
if ((attr = strstr(device_id, "DES:")) != NULL)
|
||||
attr += 4;
|
||||
else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
|
||||
attr += 12;
|
||||
|
||||
if (attr)
|
||||
{
|
||||
/*
|
||||
* 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 ((delim = strchr(attr, ';')) == NULL)
|
||||
delim = attr + strlen(attr);
|
||||
|
||||
if ((delim - attr) < 8)
|
||||
attr = NULL;
|
||||
else
|
||||
{
|
||||
char *ptr; /* Pointer into description */
|
||||
int letters, /* Number of letters seen */
|
||||
spaces; /* Number of spaces seen */
|
||||
|
||||
|
||||
for (ptr = attr, letters = 0, spaces = 0; ptr < delim; ptr ++)
|
||||
{
|
||||
if (isspace(*ptr & 255))
|
||||
spaces ++;
|
||||
else if (isalpha(*ptr & 255))
|
||||
letters ++;
|
||||
|
||||
if (spaces && letters)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!spaces || !letters)
|
||||
attr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
|
||||
mfg += 13;
|
||||
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
|
||||
mfg += 4;
|
||||
|
||||
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
|
||||
mdl += 6;
|
||||
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
|
||||
mdl += 4;
|
||||
|
||||
if (attr)
|
||||
{
|
||||
/*
|
||||
* Use description...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(attr, "Hewlett-Packard hp ", 19))
|
||||
{
|
||||
/*
|
||||
* Check for a common HP bug...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, "HP ", make_model_size);
|
||||
strlcpy(make_model + 3, attr + 19, make_model_size - 3);
|
||||
}
|
||||
else if (!strncasecmp(attr, "Hewlett-Packard ", 16))
|
||||
{
|
||||
strlcpy(make_model, "HP ", make_model_size);
|
||||
strlcpy(make_model + 3, attr + 16, make_model_size - 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(make_model, attr, make_model_size);
|
||||
}
|
||||
}
|
||||
else if (mfg && mdl)
|
||||
{
|
||||
/*
|
||||
* Build a make-model string from the manufacturer and model attributes...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
|
||||
strlcpy(make_model, "HP", make_model_size);
|
||||
else
|
||||
strlcpy(make_model, mfg, make_model_size);
|
||||
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
if (!strncasecmp(make_model, mdl, strlen(make_model)))
|
||||
{
|
||||
/*
|
||||
* Just copy model string, since it has the manufacturer...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, mdl, make_model_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Concatenate the make and model...
|
||||
*/
|
||||
|
||||
strlcat(make_model, " ", make_model_size);
|
||||
strlcat(make_model, mdl, make_model_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use "Unknown" as the printer make and model...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, "Unknown", make_model_size);
|
||||
}
|
||||
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
if (scheme && uri && uri_size > 32)
|
||||
{
|
||||
/*
|
||||
* Look for the serial number field...
|
||||
*/
|
||||
|
||||
if ((attr = strstr(device_id, "SERN:")) != NULL)
|
||||
attr += 5;
|
||||
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
|
||||
attr += 13;
|
||||
else if ((attr = strstr(device_id, ";SN:")) != NULL)
|
||||
attr += 4;
|
||||
|
||||
if (attr)
|
||||
{
|
||||
strlcpy(serial_number, attr, sizeof(serial_number));
|
||||
|
||||
if ((delim = strchr(serial_number, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
}
|
||||
else
|
||||
serial_number[0] = '\0';
|
||||
|
||||
/*
|
||||
* Generate the device URI from the make_model and serial number strings.
|
||||
*/
|
||||
|
||||
snprintf(uri, uri_size, "%s://", scheme);
|
||||
for (uriptr = uri + strlen(uri), delim = make_model;
|
||||
*delim && uriptr < (uri + uri_size - 1);
|
||||
delim ++)
|
||||
if (*delim == ' ')
|
||||
{
|
||||
delim ++;
|
||||
*uriptr++ = '/';
|
||||
break;
|
||||
}
|
||||
else
|
||||
*uriptr++ = *delim;
|
||||
|
||||
for (; *delim && uriptr < (uri + uri_size - 3); delim ++)
|
||||
if (*delim == ' ')
|
||||
{
|
||||
*uriptr++ = '%';
|
||||
*uriptr++ = '2';
|
||||
*uriptr++ = '0';
|
||||
}
|
||||
else
|
||||
*uriptr++ = *delim;
|
||||
|
||||
*uriptr = '\0';
|
||||
|
||||
if (serial_number[0])
|
||||
{
|
||||
/*
|
||||
* Add the serial number to the URI...
|
||||
*/
|
||||
|
||||
strlcat(uri, "?serial=", uri_size);
|
||||
strlcat(uri, serial_number, uri_size);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,877 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Linux IEEE-1394 glue for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2002 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the
|
||||
* above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use
|
||||
* of this software must display the following
|
||||
* acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Easy
|
||||
* Software Products.
|
||||
*
|
||||
* 4. The name of Easy Software Products may not be used to
|
||||
* endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* get_device_id() - Get the IEEE-1284 device ID for a node...
|
||||
* get_unit_type() - Get the unit type for a node...
|
||||
* show_data() - Show a data node...
|
||||
* show_dir() - Show a directory list...
|
||||
* ieee1394_list() - List the available printer devices.
|
||||
* ieee1394_open() - Open a printer device.
|
||||
* ieee1394_close() - Close a printer device.
|
||||
* ieee1394_read() - Read from a printer device.
|
||||
* ieee1394_write() - Write data to a printer device.
|
||||
* ieee1394_error() - Return the last error.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "ieee1394.h"
|
||||
#include <cups/debug.h>
|
||||
#include <libraw1394/raw1394.h>
|
||||
#include <libraw1394/csr.h>
|
||||
|
||||
|
||||
/*
|
||||
* Limits...
|
||||
*/
|
||||
|
||||
#define MAX_NODES 100
|
||||
|
||||
|
||||
/*
|
||||
* Structures...
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char uri[HTTP_MAX_URI],/* URI for this node... */
|
||||
description[128],/* Description of port */
|
||||
make_model[128];/* Make and model */
|
||||
int port, /* Port where this node is found */
|
||||
node; /* Node number */
|
||||
unsigned long long addr; /* Management address */
|
||||
} linux1394_node_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
raw1394handle_t handle; /* Handle for printer device */
|
||||
int node; /* Node number for printer device */
|
||||
unsigned long long addr; /* Management address */
|
||||
} linux1394_dev_t;
|
||||
|
||||
|
||||
/*
|
||||
* ORB messages for communication with the device...
|
||||
*/
|
||||
|
||||
typedef struct /**** Login ORB Message */
|
||||
{
|
||||
unsigned char passwd_addr[8]; /* Password address */
|
||||
unsigned char resp_addr[8]; /* Login response address */
|
||||
unsigned char notify_excl; /* Notify and exclusive bits */
|
||||
unsigned char recon_func; /* Reconnect time and function */
|
||||
unsigned char lun[2]; /* Logical unit number */
|
||||
unsigned char passwd_len[2]; /* Length of password */
|
||||
unsigned char resp_len[2]; /* Length of login response */
|
||||
unsigned char fifo_addr[8]; /* Local status FIFO address */
|
||||
} login_orb_t;
|
||||
|
||||
typedef struct /**** Login Response Message ****/
|
||||
{
|
||||
unsigned char length[2]; /* Length of response */
|
||||
unsigned char login_id[2]; /* Login ID */
|
||||
unsigned char cmd_addr[8]; /* Command block agent address */
|
||||
unsigned char reserved[2]; /* Reserved (0) */
|
||||
unsigned char recon_hold[2]; /* Number of seconds to hold login */
|
||||
} login_resp_t;
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static char error_string[1024] = "";
|
||||
static int num_nodes;
|
||||
static linux1394_node_t nodes[MAX_NODES];
|
||||
|
||||
|
||||
/*
|
||||
* 'get_device_id()' - Get the IEEE-1284 device ID for a node...
|
||||
*/
|
||||
|
||||
static char * /* O - Device ID */
|
||||
get_device_id(raw1394handle_t handle,/* I - Handle for device */
|
||||
int node, /* I - Node number */
|
||||
unsigned long long offset,/* I - Offset to directory */
|
||||
char *id, /* O - ID string */
|
||||
int idlen) /* I - Size of ID string */
|
||||
{
|
||||
unsigned char data[1024], /* Data from ROM */
|
||||
*dataptr; /* Pointer into data */
|
||||
int length; /* Length of directory */
|
||||
int datalen; /* Length of data */
|
||||
unsigned long long dataoff; /* Offset of data */
|
||||
|
||||
|
||||
DEBUG_printf(("get_device_id(handle = %p, node = %d, offset = %llx, id = %p, idlen = %d)\n",
|
||||
handle, node, offset, id, idlen));
|
||||
|
||||
*id = '\0';
|
||||
|
||||
/*
|
||||
* Read the directory length from the first quadlet...
|
||||
*/
|
||||
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return (NULL);
|
||||
|
||||
offset += 4;
|
||||
|
||||
/*
|
||||
* The length is in the upper 16 bits...
|
||||
*/
|
||||
|
||||
length = (data[0] << 8) | data[1];
|
||||
|
||||
DEBUG_printf((" length = %d\n", length));
|
||||
|
||||
/*
|
||||
* Then read the directory, looking for unit directory or device tags...
|
||||
*/
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return (NULL);
|
||||
|
||||
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
|
||||
data[2], data[3]));
|
||||
|
||||
if (data[0] == 0xd1)
|
||||
{
|
||||
/*
|
||||
* Found the unit directory...
|
||||
*/
|
||||
|
||||
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
|
||||
|
||||
return (get_device_id(handle, node, offset, id, idlen));
|
||||
}
|
||||
else if (data[0] == 0x81)
|
||||
{
|
||||
/*
|
||||
* Found potential IEEE-1284 device ID...
|
||||
*/
|
||||
|
||||
dataoff = offset + (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
|
||||
|
||||
if (raw1394_read(handle, 0xffc0 | node, dataoff, 4, (quadlet_t *)data) < 0)
|
||||
return (NULL);
|
||||
|
||||
dataoff += 4;
|
||||
|
||||
/*
|
||||
* Read the leaf value...
|
||||
*/
|
||||
|
||||
datalen = (data[0] << 8) | data[1];
|
||||
|
||||
if (datalen > (sizeof(data) / 4))
|
||||
datalen = sizeof(data) / 4;
|
||||
|
||||
for (dataptr = data; datalen > 0; datalen --, dataptr += 4, dataoff += 4)
|
||||
if (raw1394_read(handle, 0xffc0 | node, dataoff, 4,
|
||||
(quadlet_t *)dataptr) < 0)
|
||||
return (NULL);
|
||||
|
||||
if (data[0] == 0 && memcmp(data + 8, "MFG:", 4) == 0)
|
||||
{
|
||||
/*
|
||||
* Found the device ID...
|
||||
*/
|
||||
|
||||
datalen = dataptr - data - 8;
|
||||
if (datalen >= idlen)
|
||||
datalen --;
|
||||
|
||||
memcpy(id, data + 8, datalen);
|
||||
id[datalen] = '\0';
|
||||
|
||||
return (id);
|
||||
}
|
||||
}
|
||||
|
||||
offset += 4;
|
||||
length --;
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_man_addr()' - Get the management address for a node...
|
||||
*/
|
||||
|
||||
static int /* O - Unit type */
|
||||
get_man_addr(raw1394handle_t handle, /* I - Handle for device */
|
||||
int node, /* I - Node number */
|
||||
unsigned long long offset) /* I - Offset to directory */
|
||||
{
|
||||
unsigned char data[4]; /* Data from ROM */
|
||||
int length; /* Length of directory */
|
||||
|
||||
|
||||
DEBUG_printf(("get_man_addr(handle = %p, node = %d, offset = %llx)\n",
|
||||
handle, node, offset));
|
||||
|
||||
/*
|
||||
* Read the directory length from the first quadlet...
|
||||
*/
|
||||
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return (-1);
|
||||
|
||||
offset += 4;
|
||||
|
||||
/*
|
||||
* The length is in the upper 16 bits...
|
||||
*/
|
||||
|
||||
length = (data[0] << 8) | data[1];
|
||||
|
||||
DEBUG_printf((" length = %d\n", length));
|
||||
|
||||
/*
|
||||
* Then read the directory, looking for unit directory or type tags...
|
||||
*/
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return (-1);
|
||||
|
||||
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
|
||||
data[2], data[3]));
|
||||
|
||||
if (data[0] == 0xd1)
|
||||
{
|
||||
/*
|
||||
* Found the unit directory...
|
||||
*/
|
||||
|
||||
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
|
||||
|
||||
return (get_man_addr(handle, node, offset));
|
||||
}
|
||||
else if (data[0] == 0x54)
|
||||
{
|
||||
/*
|
||||
* Found the management address...
|
||||
*/
|
||||
|
||||
return (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
|
||||
}
|
||||
|
||||
offset += 4;
|
||||
length --;
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_unit_type()' - Get the unit type for a node...
|
||||
*/
|
||||
|
||||
static int /* O - Unit type */
|
||||
get_unit_type(raw1394handle_t handle,/* I - Handle for device */
|
||||
int node, /* I - Node number */
|
||||
unsigned long long offset)/* I - Offset to directory */
|
||||
{
|
||||
unsigned char data[4]; /* Data from ROM */
|
||||
int length; /* Length of directory */
|
||||
|
||||
|
||||
DEBUG_printf(("get_unit_type(handle = %p, node = %d, offset = %llx)\n",
|
||||
handle, node, offset));
|
||||
|
||||
/*
|
||||
* Read the directory length from the first quadlet...
|
||||
*/
|
||||
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return (-1);
|
||||
|
||||
offset += 4;
|
||||
|
||||
/*
|
||||
* The length is in the upper 16 bits...
|
||||
*/
|
||||
|
||||
length = (data[0] << 8) | data[1];
|
||||
|
||||
DEBUG_printf((" length = %d\n", length));
|
||||
|
||||
/*
|
||||
* Then read the directory, looking for unit directory or type tags...
|
||||
*/
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return (-1);
|
||||
|
||||
DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
|
||||
data[2], data[3]));
|
||||
|
||||
if (data[0] == 0xd1)
|
||||
{
|
||||
/*
|
||||
* Found the unit directory...
|
||||
*/
|
||||
|
||||
offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
|
||||
|
||||
return (get_unit_type(handle, node, offset));
|
||||
}
|
||||
else if (data[0] == 0x14)
|
||||
{
|
||||
/*
|
||||
* Found the unit type...
|
||||
*/
|
||||
|
||||
return (data[1] & 0x1f);
|
||||
}
|
||||
|
||||
offset += 4;
|
||||
length --;
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* 'show_data()' - Show a data node...
|
||||
*/
|
||||
|
||||
static void
|
||||
show_data(raw1394handle_t handle, /* I - Handle for device */
|
||||
int node, /* I - Node number */
|
||||
unsigned long long offset, /* I - Offset to directory */
|
||||
int indent) /* Amount to indent */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
unsigned char data[4]; /* Data from ROM */
|
||||
int length; /* Length of data */
|
||||
|
||||
|
||||
/*
|
||||
* Read the data length from the first quadlet...
|
||||
*/
|
||||
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return;
|
||||
|
||||
offset += 4;
|
||||
|
||||
/*
|
||||
* The length is in the upper 16 bits...
|
||||
*/
|
||||
|
||||
length = (data[0] << 8) | data[1];
|
||||
|
||||
/*
|
||||
* Then read the data...
|
||||
*/
|
||||
|
||||
for (i = 0; i < indent; i ++)
|
||||
putchar(' ');
|
||||
|
||||
printf("LEAF (%d quadlets)\n", length);
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < indent; i ++)
|
||||
putchar(' ');
|
||||
|
||||
printf("%02X %02X %02X %02X '%c%c%c%c'\n",
|
||||
data[0], data[1], data[2], data[3],
|
||||
(data[0] < ' ' || data[0] >= 0x7f) ? '.' : data[0],
|
||||
(data[1] < ' ' || data[1] >= 0x7f) ? '.' : data[1],
|
||||
(data[2] < ' ' || data[2] >= 0x7f) ? '.' : data[2],
|
||||
(data[3] < ' ' || data[3] >= 0x7f) ? '.' : data[3]);
|
||||
|
||||
offset += 4;
|
||||
length --;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_dir()' - Show a directory list...
|
||||
*/
|
||||
|
||||
static void
|
||||
show_dir(raw1394handle_t handle, /* I - Handle for device */
|
||||
int node, /* I - Node number */
|
||||
unsigned long long offset, /* I - Offset to directory */
|
||||
int indent) /* Amount to indent */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
unsigned char data[4]; /* Data from ROM */
|
||||
int length; /* Length of directory */
|
||||
int value; /* Value in directory */
|
||||
|
||||
|
||||
/*
|
||||
* Read the directory length from the first quadlet...
|
||||
*/
|
||||
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return;
|
||||
|
||||
offset += 4;
|
||||
|
||||
/*
|
||||
* The length is in the upper 16 bits...
|
||||
*/
|
||||
|
||||
length = (data[0] << 8) | data[1];
|
||||
|
||||
/*
|
||||
* Then read the directory...
|
||||
*/
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < indent; i ++)
|
||||
putchar(' ');
|
||||
|
||||
printf("%02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
|
||||
|
||||
value = (((data[1] << 8) | data[2]) << 8) | data[3];
|
||||
|
||||
switch (data[0] & 0xc0)
|
||||
{
|
||||
case 0x00 :
|
||||
for (i = -4; i < indent; i ++)
|
||||
putchar(' ');
|
||||
|
||||
printf("IMMEDIATE %d\n", value);
|
||||
break;
|
||||
|
||||
case 0x40 :
|
||||
for (i = -4; i < indent; i ++)
|
||||
putchar(' ');
|
||||
|
||||
printf("CSR OFFSET +%06X\n", value);
|
||||
break;
|
||||
|
||||
case 0x80 :
|
||||
show_data(handle, node, offset + value * 4, indent + 4);
|
||||
break;
|
||||
|
||||
case 0xc0 :
|
||||
show_dir(handle, node, offset + value * 4, indent + 4);
|
||||
break;
|
||||
}
|
||||
|
||||
offset += 4;
|
||||
length --;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* 'ieee1394_list()' - List the available printer devices.
|
||||
*/
|
||||
|
||||
ieee1394_info_t * /* O - Printer information */
|
||||
ieee1394_list(int *num_devices) /* O - Number of printers */
|
||||
{
|
||||
int i, j; /* Looping vars */
|
||||
raw1394handle_t handle; /* 1394 handle */
|
||||
int num_ports; /* Number of ports */
|
||||
struct raw1394_portinfo ports[100]; /* Port data... */
|
||||
unsigned char guid[8]; /* Global unique ID */
|
||||
int vendor; /* Vendor portion of GUID */
|
||||
int unit_type; /* Unit type */
|
||||
int addr; /* Management address offset */
|
||||
char id[1024], /* Device ID string */
|
||||
*idptr, /* Pointer into ID string */
|
||||
*idsep; /* Pointer to separator */
|
||||
ieee1394_info_t *devices; /* Device list */
|
||||
|
||||
|
||||
/*
|
||||
* Connect to the user-mode driver interface...
|
||||
*/
|
||||
|
||||
handle = raw1394_new_handle();
|
||||
num_ports = raw1394_get_port_info(handle, ports,
|
||||
sizeof(ports) / sizeof(ports[0]));
|
||||
|
||||
DEBUG_printf(("num_ports = %d\n", num_ports));
|
||||
|
||||
/*
|
||||
* Loop through the ports to discover what nodes are available.
|
||||
*/
|
||||
|
||||
num_nodes = 0;
|
||||
|
||||
for (i = 0; i < num_ports; i ++)
|
||||
{
|
||||
DEBUG_printf(("ports[%d] = { nodes = %d, name = \"%s\" }\n", i,
|
||||
ports[i].nodes, ports[i].name));
|
||||
|
||||
raw1394_set_port(handle, i);
|
||||
|
||||
for (j = 0; j < ports[i].nodes; j ++)
|
||||
{
|
||||
if (raw1394_read(handle, 0xffc0 | j,
|
||||
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 12, 4,
|
||||
(quadlet_t *)guid) < 0)
|
||||
{
|
||||
DEBUG_printf((" Node #%d: Unable to contact (%s)!\n", j,
|
||||
strerror(errno)));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
raw1394_read(handle, 0xffc0 | j,
|
||||
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 16, 4,
|
||||
(quadlet_t *)(guid + 4));
|
||||
|
||||
DEBUG_printf((" Node #%d: GUID = %02X%02X%02X%02X%02X%02X%02X%02X\n",
|
||||
j, guid[0], guid[1], guid[2], guid[3], guid[4],
|
||||
guid[5], guid[6], guid[7]));
|
||||
|
||||
vendor = (((guid[0] << 8) | guid[1]) << 8) | guid[2];
|
||||
unit_type = get_unit_type(handle, j,
|
||||
CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
|
||||
|
||||
DEBUG_printf(("vendor = %x, unit_type = %d\n", vendor, unit_type));
|
||||
|
||||
if (unit_type == 2 && num_nodes < MAX_NODES)
|
||||
{
|
||||
/*
|
||||
* Found a printer device; add it to the nodes list...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
show_dir(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20, 0);
|
||||
#endif /* DEBUG */
|
||||
|
||||
memset(nodes + num_nodes, 0, sizeof(linux1394_node_t));
|
||||
|
||||
sprintf(nodes[num_nodes].uri, "ieee1394://%02X%02X%02X%02X%02X%02X%02X%02X",
|
||||
guid[0], guid[1], guid[2], guid[3], guid[4],
|
||||
guid[5], guid[6], guid[7]);
|
||||
|
||||
nodes[num_nodes].port = i;
|
||||
nodes[num_nodes].node = j;
|
||||
|
||||
addr = get_man_addr(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
|
||||
|
||||
if (addr < 0)
|
||||
continue;
|
||||
|
||||
nodes[num_nodes].addr = CSR_REGISTER_BASE + addr;
|
||||
|
||||
DEBUG_printf(("Node address = %llx\n", nodes[num_nodes].addr));
|
||||
|
||||
get_device_id(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20,
|
||||
id, sizeof(id));
|
||||
|
||||
if (id[0])
|
||||
{
|
||||
/*
|
||||
* Grab the manufacturer and model name from the device ID
|
||||
* string...
|
||||
*/
|
||||
|
||||
idptr = id + 4;
|
||||
idsep = strchr(id, ';');
|
||||
if (idsep)
|
||||
*idsep++ = '\0';
|
||||
else
|
||||
idsep = idptr;
|
||||
|
||||
snprintf(nodes[num_nodes].description,
|
||||
sizeof(nodes[num_nodes].description),
|
||||
"%s Firewire Printer", idptr);
|
||||
|
||||
if ((idptr = strstr(idsep, "DES:")) == NULL)
|
||||
idptr = strstr(idsep, "MDL:");
|
||||
|
||||
if (idptr == NULL)
|
||||
strcpy(nodes[num_nodes].make_model, "Unknown");
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Grab the DES or MDL code...
|
||||
*/
|
||||
|
||||
idptr += 4;
|
||||
idsep = strchr(idptr, ';');
|
||||
if (idsep)
|
||||
*idsep = '\0';
|
||||
|
||||
if (strncmp(id + 4, idptr, strlen(id + 4)) == 0)
|
||||
{
|
||||
/*
|
||||
* Use the description directly...
|
||||
*/
|
||||
|
||||
strlcpy(nodes[num_nodes].make_model, idptr,
|
||||
sizeof(nodes[num_nodes].make_model));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Add the manufacturer to the front of the name...
|
||||
*/
|
||||
|
||||
snprintf(nodes[num_nodes].make_model,
|
||||
sizeof(nodes[num_nodes].make_model),
|
||||
"%s %s", id + 4, idptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Flag it as an unknown printer...
|
||||
*/
|
||||
|
||||
sprintf(nodes[num_nodes].description,
|
||||
"Unknown%06X Firewire Printer", vendor);
|
||||
strcpy(nodes[num_nodes].make_model, "Unknown");
|
||||
}
|
||||
|
||||
num_nodes ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Done querying the Firewire bus...
|
||||
*/
|
||||
|
||||
raw1394_destroy_handle(handle);
|
||||
|
||||
/*
|
||||
* Build an array of device info structures as needed...
|
||||
*/
|
||||
|
||||
if (num_devices == NULL)
|
||||
return (NULL);
|
||||
|
||||
*num_devices = num_nodes;
|
||||
|
||||
if (num_nodes)
|
||||
{
|
||||
if ((devices = calloc(sizeof(ieee1394_info_t), num_nodes)) != NULL)
|
||||
{
|
||||
for (i = 0; i < num_nodes; i ++)
|
||||
{
|
||||
strcpy(devices[i].uri, nodes[i].uri);
|
||||
strcpy(devices[i].description, nodes[i].description);
|
||||
strcpy(devices[i].make_model, nodes[i].make_model);
|
||||
}
|
||||
}
|
||||
|
||||
return (devices);
|
||||
}
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ieee1394_open()' - Open a printer device.
|
||||
*/
|
||||
|
||||
ieee1394_dev_t /* O - Printer device or NULL */
|
||||
ieee1394_open(const char *uri) /* I - Device URI */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
linux1394_dev_t *ldev; /* Linux device */
|
||||
|
||||
|
||||
/*
|
||||
* Return early if we can't see any printers...
|
||||
*/
|
||||
|
||||
if (num_nodes == 0)
|
||||
ieee1394_list(NULL);
|
||||
|
||||
if (num_nodes == 0)
|
||||
{
|
||||
strcpy(error_string, "No IEEE-1394 printers found!");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for the URI...
|
||||
*/
|
||||
|
||||
for (i = 0; i < num_nodes; i ++)
|
||||
if (strcmp(nodes[i].uri, uri) == 0)
|
||||
break;
|
||||
|
||||
if (i >= num_nodes)
|
||||
{
|
||||
snprintf(error_string, sizeof(error_string), "Device %s not found!", uri);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now create a new device structure...
|
||||
*/
|
||||
|
||||
if ((ldev = calloc(sizeof(linux1394_dev_t), 1)) == NULL)
|
||||
{
|
||||
strcpy(error_string, "Out of memory!");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ldev->handle = raw1394_new_handle();
|
||||
ldev->node = nodes[i].node;
|
||||
ldev->addr = nodes[i].addr;
|
||||
|
||||
raw1394_set_port(ldev->handle, nodes[i].port);
|
||||
|
||||
error_string[0] = '\0';
|
||||
|
||||
return ((ieee1394_dev_t)ldev);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ieee1394_close()' - Close a printer device.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
ieee1394_close(ieee1394_dev_t dev) /* I - Printer device */
|
||||
{
|
||||
linux1394_dev_t *ldev; /* Linux device */
|
||||
|
||||
|
||||
ldev = (linux1394_dev_t *)dev;
|
||||
|
||||
raw1394_destroy_handle(ldev->handle);
|
||||
|
||||
free(ldev);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ieee1394_read()' - Read from a printer device.
|
||||
*/
|
||||
|
||||
int /* O - Number of bytes read or -1 */
|
||||
ieee1394_read(ieee1394_dev_t dev, /* I - Printer device */
|
||||
char *buffer, /* I - Read buffer */
|
||||
int len) /* I - Max bytes to read */
|
||||
{
|
||||
linux1394_dev_t *ldev; /* Linux device */
|
||||
|
||||
|
||||
ldev = (linux1394_dev_t *)dev;
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ieee1394_write()' - Write data to a printer device.
|
||||
*/
|
||||
|
||||
int /* O - Number of bytes written or -1 */
|
||||
ieee1394_write(ieee1394_dev_t dev, /* I - Printer device */
|
||||
char *buffer, /* I - Buffer to write */
|
||||
int len) /* I - Number of bytes to write */
|
||||
{
|
||||
linux1394_dev_t *ldev; /* Linux device */
|
||||
|
||||
|
||||
ldev = (linux1394_dev_t *)dev;
|
||||
|
||||
|
||||
/* if (raw1394_write(handle, 0xffc0 | j, 0, ,
|
||||
(quadlet_t *)guid) < 0)*/
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ieee1394_error()' - Return the last error.
|
||||
*/
|
||||
|
||||
const char * /* O - Error string or NULL */
|
||||
ieee1394_error(void)
|
||||
{
|
||||
if (error_string[0])
|
||||
return (error_string);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,267 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IEEE-1394 backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2002 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the
|
||||
* above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use
|
||||
* of this software must display the following
|
||||
* acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Easy
|
||||
* Software Products.
|
||||
*
|
||||
* 4. The name of Easy Software Products may not be used to
|
||||
* endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the printer.
|
||||
* list_devices() - List all known printer devices...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "ieee1394.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
void list_devices(void);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Send a file to the printer.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
ieee1394_dev_t dev; /* Printer device */
|
||||
int fp; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
int rbytes; /* Number of bytes read from device */
|
||||
size_t nbytes, /* Number of bytes read from file */
|
||||
tbytes; /* Total number of bytes written */
|
||||
char buffer[8192]; /* Input/output buffer */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure status messages are not buffered...
|
||||
*/
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/*
|
||||
* Check command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
list_devices();
|
||||
|
||||
return (0);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have 7 arguments, print the file named on the command-line.
|
||||
* Otherwise, send stdin instead...
|
||||
*/
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
fp = 0;
|
||||
copies = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((fp = open(argv[6], O_RDONLY)) < 0)
|
||||
{
|
||||
perror("ERROR: unable to open print file");
|
||||
return (1);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to open the printer device...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
{
|
||||
if ((dev = ieee1394_open(argv[0])) == NULL)
|
||||
{
|
||||
fputs("INFO: Firewire printer busy; will retry in 30 seconds...\n", stderr);
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
while (dev == NULL);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Now that we are "connected" to the port, ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
* current page... Only ignore SIGTERM if we are printing data from
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (argc < 7)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
#else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
while (copies > 0)
|
||||
{
|
||||
copies --;
|
||||
|
||||
if (fp != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(fp, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
tbytes = 0;
|
||||
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
/*
|
||||
* Write the print data to the printer...
|
||||
*/
|
||||
|
||||
tbytes += nbytes;
|
||||
|
||||
if (ieee1394_write(dev, buffer, nbytes) < 0)
|
||||
{
|
||||
perror("ERROR: Unable to send print file to printer");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((rbytes = ieee1394_read(dev, buffer, sizeof(buffer))) > 0)
|
||||
fprintf(stderr, "INFO: Read %d bytes from printer...\n", rbytes);
|
||||
|
||||
if (argc > 6)
|
||||
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
|
||||
(unsigned long)tbytes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the printer device and input file and return...
|
||||
*/
|
||||
|
||||
ieee1394_close(dev);
|
||||
|
||||
if (fp != 0)
|
||||
close(fp);
|
||||
|
||||
fputs("INFO: Ready to print.\n", stderr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List all known devices...
|
||||
*/
|
||||
|
||||
void
|
||||
list_devices(void)
|
||||
{
|
||||
int i, /* Looping var */
|
||||
num_info; /* Number of devices */
|
||||
ieee1394_info_t *info; /* Devices... */
|
||||
|
||||
|
||||
/*
|
||||
* Get the available devices...
|
||||
*/
|
||||
|
||||
info = ieee1394_list(&num_info);
|
||||
|
||||
/*
|
||||
* List them as needed...
|
||||
*/
|
||||
|
||||
if (num_info > 0)
|
||||
{
|
||||
for (i = 0; i < num_info; i ++)
|
||||
printf("direct %s \"%s\" \"%s\"\n", info[i].uri,
|
||||
info[i].make_model, info[i].description);
|
||||
|
||||
free(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IEEE-1394 header for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2002 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the
|
||||
* above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use
|
||||
* of this software must display the following
|
||||
* acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Easy
|
||||
* Software Products.
|
||||
*
|
||||
* 4. The name of Easy Software Products may not be used to
|
||||
* endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <cups/string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Device information structure...
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char uri[HTTP_MAX_URI], /* Device URI */
|
||||
description[128], /* Description of port */
|
||||
make_model[128]; /* Make and model */
|
||||
} ieee1394_info_t;
|
||||
|
||||
|
||||
/*
|
||||
* Private device connection information...
|
||||
*/
|
||||
|
||||
typedef void *ieee1394_dev_t;
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for standard IEEE-1394 interface...
|
||||
*/
|
||||
|
||||
extern ieee1394_info_t *ieee1394_list(int *num_devices);
|
||||
extern ieee1394_dev_t ieee1394_open(const char *uri);
|
||||
extern int ieee1394_close(ieee1394_dev_t dev);
|
||||
extern int ieee1394_read(ieee1394_dev_t dev, char *buffer, int len);
|
||||
extern int ieee1394_write(ieee1394_dev_t dev, char *buffer, int len);
|
||||
extern const char *ieee1394_error(void);
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1622
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-1234
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,741 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Parallel port backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the specified parallel port.
|
||||
* list_devices() - List all parallel devices.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/backend.h>
|
||||
#include <cups/cups.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <cups/string.h>
|
||||
#include <signal.h>
|
||||
#include "ieee1284.c"
|
||||
|
||||
#ifdef __hpux
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <sys/select.h>
|
||||
#endif /* __hpux */
|
||||
|
||||
#ifdef WIN32
|
||||
# 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...
|
||||
*/
|
||||
|
||||
void list_devices(void);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Send a file to the specified parallel port.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options; /* Pointer to options */
|
||||
int port; /* Port number (not used) */
|
||||
int fp; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
int fd; /* Parallel device */
|
||||
int rbytes; /* Number of bytes read */
|
||||
int wbytes; /* Number of bytes written */
|
||||
size_t nbytes, /* Number of bytes read */
|
||||
tbytes; /* Total number of bytes written */
|
||||
char buffer[8192], /* Output buffer */
|
||||
*bufptr; /* Pointer into buffer */
|
||||
struct termios opts; /* Parallel port options */
|
||||
fd_set input, /* Input set for select() */
|
||||
output; /* Output set for select() */
|
||||
int paperout; /* Paper out? */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
#ifdef __linux
|
||||
unsigned int status; /* Port status (off-line, out-of-paper, etc.) */
|
||||
#endif /* __linux */
|
||||
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
fputs("Usage: parallel job-id user title copies options [file]\n", stderr);
|
||||
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)
|
||||
{
|
||||
perror("ERROR: unable to open print file");
|
||||
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';
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the parallel port device...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
{
|
||||
if ((fd = open(resource, O_WRONLY | 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.
|
||||
*/
|
||||
|
||||
fputs("INFO: Unable to open parallel port, queuing on next printer in class...\n",
|
||||
stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
|
||||
{
|
||||
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open parallel port device file \"%s\": %s\n",
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (fd < 0);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Set any options provided...
|
||||
*/
|
||||
|
||||
tcgetattr(fd, &opts);
|
||||
|
||||
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
|
||||
|
||||
/**** No options supported yet ****/
|
||||
|
||||
tcsetattr(fd, TCSANOW, &opts);
|
||||
|
||||
/*
|
||||
* Check printer status...
|
||||
*/
|
||||
|
||||
paperout = 0;
|
||||
|
||||
#if defined(__linux) && defined(LP_POUTPA)
|
||||
/*
|
||||
* Show the printer status before we send the file...
|
||||
*/
|
||||
|
||||
while (!ioctl(fd, LPGETSTATUS, &status))
|
||||
{
|
||||
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
|
||||
|
||||
if (status & LP_POUTPA)
|
||||
{
|
||||
fputs("WARNING: Media tray empty!\n", stderr);
|
||||
fputs("STATUS: +media-tray-empty-error\n", stderr);
|
||||
|
||||
paperout = 1;
|
||||
}
|
||||
|
||||
if (!(status & LP_PERRORP))
|
||||
fputs("WARNING: Printer fault!\n", stderr);
|
||||
else if (!(status & LP_PSELECD))
|
||||
fputs("WARNING: Printer off-line.\n", stderr);
|
||||
else
|
||||
break;
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
#endif /* __linux && LP_POUTPA */
|
||||
|
||||
/*
|
||||
* Now that we are "connected" to the port, ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
* current page... Only ignore SIGTERM if we are printing data from
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (argc < 7)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
#else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
wbytes = 0;
|
||||
|
||||
while (copies > 0)
|
||||
{
|
||||
copies --;
|
||||
|
||||
if (fp != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(fp, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
tbytes = 0;
|
||||
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
/*
|
||||
* Write the print data to the printer...
|
||||
*/
|
||||
|
||||
tbytes += nbytes;
|
||||
bufptr = buffer;
|
||||
|
||||
while (nbytes > 0)
|
||||
{
|
||||
/*
|
||||
* See if we are ready to read or write...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
FD_ZERO(&input);
|
||||
FD_SET(fd, &input);
|
||||
FD_ZERO(&output);
|
||||
FD_SET(fd, &output);
|
||||
}
|
||||
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
|
||||
|
||||
if (FD_ISSET(fd, &input))
|
||||
{
|
||||
/*
|
||||
* Read backchannel data...
|
||||
*/
|
||||
|
||||
if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
|
||||
rbytes);
|
||||
cupsBackChannelWrite(resource, rbytes, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(fd, &output))
|
||||
{
|
||||
/*
|
||||
* Write print data...
|
||||
*/
|
||||
|
||||
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
|
||||
if (errno == ENOTTY)
|
||||
wbytes = write(fd, bufptr, nbytes);
|
||||
|
||||
if (wbytes < 0)
|
||||
{
|
||||
/*
|
||||
* Check for retryable errors...
|
||||
*/
|
||||
|
||||
if (errno == ENOSPC)
|
||||
{
|
||||
paperout = 1;
|
||||
fputs("ERROR: Out of paper!\n", stderr);
|
||||
fputs("STATUS: +media-tray-empty-error\n", stderr);
|
||||
}
|
||||
else if (errno != EAGAIN && errno != EINTR)
|
||||
{
|
||||
perror("ERROR: Unable to send print file to printer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Update count and pointer...
|
||||
*/
|
||||
|
||||
if (paperout)
|
||||
{
|
||||
fputs("STATUS: -media-tray-empty-error\n", stderr);
|
||||
paperout = 0;
|
||||
}
|
||||
|
||||
nbytes -= wbytes;
|
||||
bufptr += wbytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wbytes < 0)
|
||||
break;
|
||||
|
||||
if (argc > 6)
|
||||
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
|
||||
(unsigned long)tbytes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the socket connection and input file and return...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
if (fp != 0)
|
||||
close(fp);
|
||||
|
||||
return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'list_devices()' - List all parallel devices.
|
||||
*/
|
||||
|
||||
void
|
||||
list_devices(void)
|
||||
{
|
||||
#if defined(__hpux) || defined(__sgi) || defined(__sun)
|
||||
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
/* Funky hex numbering used for some devices */
|
||||
#endif /* __hpux || __sgi || __sun */
|
||||
|
||||
#ifdef __linux
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255], /* Device filename */
|
||||
basedevice[255], /* Base device filename for ports */
|
||||
device_id[1024], /* Device ID string */
|
||||
make_model[1024]; /* Make and model */
|
||||
|
||||
|
||||
if (!access("/dev/parallel/", 0))
|
||||
strcpy(basedevice, "/dev/parallel/");
|
||||
else if (!access("/dev/printers/", 0))
|
||||
strcpy(basedevice, "/dev/printers/");
|
||||
else if (!access("/dev/par0", 0))
|
||||
strcpy(basedevice, "/dev/par");
|
||||
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...
|
||||
*/
|
||||
|
||||
if (!get_device_id(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
NULL, NULL, 0))
|
||||
printf("direct parallel:%s \"%s\" \"%s LPT #%d\" \"%s\"\n", device,
|
||||
make_model, make_model, i + 1, device_id);
|
||||
else
|
||||
printf("direct parallel:%s \"Unknown\" \"LPT #%d\"\n", device, i + 1);
|
||||
|
||||
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__)
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IRIX SCSI printer support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
puts("direct scsi \"Unknown\" \"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)
|
||||
{
|
||||
fprintf(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.
|
||||
*/
|
||||
|
||||
fputs("INFO: Unable to open SCSI device, queuing on next printer in class...\n",
|
||||
stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (errno != EAGAIN && errno != EBUSY)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open SCSI device \"%s\" - %s\n",
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "INFO: SCSI device \"%s\" busy; retrying...\n",
|
||||
resource);
|
||||
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)
|
||||
{
|
||||
fprintf(stderr, "WARNING: SCSI command timed out (%d); retrying...\n",
|
||||
scsi_req.ds_status);
|
||||
sleep(try + 1);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
if (try >= 10)
|
||||
{
|
||||
fprintf(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,253 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Linux SCSI printer support for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* 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>
|
||||
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
puts("direct scsi \"Unknown\" \"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)
|
||||
{
|
||||
fprintf(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.
|
||||
*/
|
||||
|
||||
fputs("INFO: Unable to open SCSI device, queuing on next printer in class...\n",
|
||||
stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (errno != EAGAIN && errno != EBUSY)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open SCSI device \"%s\" - %s\n",
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "INFO: SCSI device \"%s\" busy; retrying...\n",
|
||||
resource);
|
||||
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)
|
||||
{
|
||||
fprintf(stderr, "WARNING: SCSI command timed out (%d); retrying...\n",
|
||||
scsi_req.status);
|
||||
sleep(try + 1);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
if (try >= 10)
|
||||
{
|
||||
fprintf(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,224 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* SCSI printer backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <cups/string.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);
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
# 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 */
|
||||
|
||||
|
||||
/*
|
||||
* '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)
|
||||
{
|
||||
fputs("Usage: scsi:/dev/file job-id user title copies options [file]\n", stderr);
|
||||
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)
|
||||
{
|
||||
perror("ERROR: unable to open print file");
|
||||
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$".
|
||||
*/
|
||||
-1138
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,496 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* AppSocket backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the printer or server.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include <cups/backend.h>
|
||||
#include <cups/http-private.h>
|
||||
#include <cups/cups.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <cups/string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef WIN32
|
||||
# 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 */
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Send a file to the printer or server.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* printer-uri job-id user title copies options [file]
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
char method[255], /* Method in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (not used) */
|
||||
*options, /* Pointer to options */
|
||||
name[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr; /* Pointer into name or value */
|
||||
int fp; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
int waiteof; /* Wait for end-of-file? */
|
||||
int port; /* Port number */
|
||||
char portname[255]; /* Port name */
|
||||
int delay; /* Delay for retries... */
|
||||
int fd; /* AppSocket */
|
||||
int error; /* Error code (if any) */
|
||||
http_addrlist_t *addrlist; /* Address list */
|
||||
int rbytes; /* Number of bytes read */
|
||||
int wbytes; /* Number of bytes written */
|
||||
int nbytes; /* Number of bytes read */
|
||||
size_t 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() */
|
||||
output; /* Output set for select() */
|
||||
#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)
|
||||
{
|
||||
puts("network socket \"Unknown\" \"AppSocket/HP JetDirect\"");
|
||||
return (CUPS_BACKEND_OK);
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
fprintf(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)
|
||||
{
|
||||
perror("ERROR: unable to open print file");
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
copies = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the hostname and port number from the URI...
|
||||
*/
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
|
||||
method, sizeof(method), username, sizeof(username),
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource));
|
||||
|
||||
if (port == 0)
|
||||
port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */
|
||||
|
||||
/*
|
||||
* Get options, if any...
|
||||
*/
|
||||
|
||||
waiteof = 1;
|
||||
|
||||
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...
|
||||
*/
|
||||
|
||||
for (ptr = name; *options && *options != '=';)
|
||||
if (ptr < (name + sizeof(name) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (*options == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
|
||||
options ++;
|
||||
|
||||
for (ptr = value; *options && *options != '+' && *options != '&';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (*options == '+' || *options == '&')
|
||||
options ++;
|
||||
}
|
||||
else
|
||||
value[0] = '\0';
|
||||
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Then try to connect to the remote host...
|
||||
*/
|
||||
|
||||
sprintf(portname, "%d", port);
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to locate printer \'%s\'!\n", hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
|
||||
hostname, port);
|
||||
|
||||
wbytes = 0;
|
||||
|
||||
while (copies > 0)
|
||||
{
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
for (delay = 5;;)
|
||||
{
|
||||
if (!httpAddrConnect(addrlist, &fd))
|
||||
{
|
||||
error = errno;
|
||||
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.
|
||||
*/
|
||||
|
||||
fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
|
||||
hostname);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (error == ECONNREFUSED || error == EHOSTDOWN ||
|
||||
error == EHOSTUNREACH)
|
||||
{
|
||||
fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
|
||||
hostname, delay);
|
||||
sleep(delay);
|
||||
|
||||
if (delay < 30)
|
||||
delay += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Now that we are "connected" to the port, ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
* current page... Only ignore SIGTERM if we are printing data from
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (argc < 7)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
#else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
copies --;
|
||||
|
||||
if (fp != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(fp, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
fputs("INFO: Connected to host, sending print job...\n", stderr);
|
||||
|
||||
tbytes = 0;
|
||||
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
/*
|
||||
* Write the print data to the printer...
|
||||
*/
|
||||
|
||||
tbytes += nbytes;
|
||||
bufptr = buffer;
|
||||
|
||||
while (nbytes > 0)
|
||||
{
|
||||
/*
|
||||
* See if we are ready to read or write...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
FD_ZERO(&input);
|
||||
FD_SET(fd, &input);
|
||||
FD_ZERO(&output);
|
||||
FD_SET(fd, &output);
|
||||
}
|
||||
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
|
||||
|
||||
if (FD_ISSET(fd, &input))
|
||||
{
|
||||
/*
|
||||
* Read backchannel data...
|
||||
*/
|
||||
|
||||
if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
|
||||
rbytes);
|
||||
cupsBackChannelWrite(resource, rbytes, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(fd, &output))
|
||||
{
|
||||
/*
|
||||
* Write print data...
|
||||
*/
|
||||
|
||||
if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
|
||||
{
|
||||
/*
|
||||
* Check for retryable errors...
|
||||
*/
|
||||
|
||||
if (errno != EAGAIN && errno != EINTR)
|
||||
{
|
||||
perror("ERROR: Unable to send print file to printer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Update count and pointer...
|
||||
*/
|
||||
|
||||
nbytes -= wbytes;
|
||||
bufptr += wbytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wbytes < 0)
|
||||
break;
|
||||
|
||||
if (argc > 6)
|
||||
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
|
||||
(unsigned long)tbytes);
|
||||
}
|
||||
|
||||
if (waiteof)
|
||||
{
|
||||
/*
|
||||
* Shutdown the socket and wait for the other end to finish...
|
||||
*/
|
||||
|
||||
fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
|
||||
|
||||
shutdown(fd, 1);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/*
|
||||
* Wait a maximum of 90 seconds for backchannel data or a closed
|
||||
* connection...
|
||||
*/
|
||||
|
||||
timeout.tv_sec = 90;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
FD_ZERO(&input);
|
||||
FD_SET(fd, &input);
|
||||
|
||||
#ifdef __hpux
|
||||
if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
|
||||
#else
|
||||
if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
|
||||
#endif /* __hpux */
|
||||
{
|
||||
/*
|
||||
* Grab the data coming back and spit it out to stderr...
|
||||
*/
|
||||
|
||||
if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
|
||||
rbytes);
|
||||
cupsBackChannelWrite(resource, rbytes, 1.0);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the socket connection...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
*/
|
||||
|
||||
if (fp != 0)
|
||||
close(fp);
|
||||
|
||||
if (wbytes >= 0)
|
||||
fputs("INFO: Ready to print.\n", stderr);
|
||||
|
||||
return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IEEE-1284 support functions test program for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
#define DEBUG
|
||||
#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]);
|
||||
|
||||
get_device_id(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$".
|
||||
*/
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,624 +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 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the specified USB port.
|
||||
* list_devices() - List all USB devices.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "ieee1284.c"
|
||||
#include <sys/select.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
int open_device(const char *uri);
|
||||
|
||||
|
||||
/*
|
||||
* '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 */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int fp, /* I - File descriptor to print */
|
||||
int copies) /* I - Copies to print */
|
||||
{
|
||||
int fd; /* USB device */
|
||||
int rbytes; /* Number of bytes read */
|
||||
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 */
|
||||
backbuf[1024]; /* Backchannel buffer */
|
||||
struct termios opts; /* Parallel port options */
|
||||
fd_set input, /* Input set for select() */
|
||||
output; /* Output set for select() */
|
||||
int paperout; /* Paper out? */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
#ifdef __linux
|
||||
unsigned int status; /* Port status (off-line, out-of-paper, etc.) */
|
||||
#endif /* __linux */
|
||||
|
||||
|
||||
/*
|
||||
* Open the USB port device...
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
do
|
||||
{
|
||||
if ((fd = open_device(uri)) == -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.
|
||||
*/
|
||||
|
||||
fputs("INFO: Unable to open USB device, queuing on next printer in class...\n",
|
||||
stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT || errno == ENODEV)
|
||||
{
|
||||
fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open USB device \"%s\": %s\n",
|
||||
uri, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (fd < 0);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
|
||||
/*
|
||||
* Set any options provided...
|
||||
*/
|
||||
|
||||
tcgetattr(fd, &opts);
|
||||
|
||||
opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
|
||||
|
||||
/**** No options supported yet ****/
|
||||
|
||||
tcsetattr(fd, TCSANOW, &opts);
|
||||
|
||||
/*
|
||||
* Check printer status...
|
||||
*/
|
||||
|
||||
paperout = 0;
|
||||
|
||||
#if defined(__linux) && defined(LP_POUTPA)
|
||||
/*
|
||||
* Show the printer status before we send the file...
|
||||
*/
|
||||
|
||||
while (!ioctl(fd, LPGETSTATUS, &status))
|
||||
{
|
||||
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
|
||||
|
||||
if (status & LP_POUTPA)
|
||||
{
|
||||
fputs("WARNING: Media tray empty!\n", stderr);
|
||||
fputs("STATUS: +media-tray-empty-error\n", stderr);
|
||||
|
||||
paperout = 1;
|
||||
}
|
||||
|
||||
if (!(status & LP_PERRORP))
|
||||
fputs("WARNING: Printer fault!\n", stderr);
|
||||
else if (!(status & LP_PSELECD))
|
||||
fputs("WARNING: Printer off-line.\n", stderr);
|
||||
else
|
||||
break;
|
||||
|
||||
sleep(5);
|
||||
}
|
||||
#endif /* __linux && LP_POUTPA */
|
||||
|
||||
/*
|
||||
* 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 (!fp)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
#elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
#else
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
#endif /* HAVE_SIGSET */
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
wbytes = 0;
|
||||
|
||||
while (copies > 0)
|
||||
{
|
||||
copies --;
|
||||
|
||||
if (fp != 0)
|
||||
{
|
||||
fputs("PAGE: 1 1\n", stderr);
|
||||
lseek(fp, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
tbytes = 0;
|
||||
while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
/*
|
||||
* Write the print data to the printer...
|
||||
*/
|
||||
|
||||
tbytes += nbytes;
|
||||
bufptr = buffer;
|
||||
|
||||
while (nbytes > 0)
|
||||
{
|
||||
/*
|
||||
* See if we are ready to read or write...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
FD_ZERO(&input);
|
||||
FD_SET(fd, &input);
|
||||
FD_ZERO(&output);
|
||||
FD_SET(fd, &output);
|
||||
}
|
||||
while (select(fd + 1, &input, &output, NULL, NULL) < 0);
|
||||
|
||||
if (FD_ISSET(fd, &input))
|
||||
{
|
||||
/*
|
||||
* Read backchannel data...
|
||||
*/
|
||||
|
||||
if ((rbytes = read(fd, backbuf, sizeof(backbuf))) > 0)
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
|
||||
rbytes);
|
||||
cupsBackChannelWrite(backbuf, rbytes, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(fd, &output))
|
||||
{
|
||||
/*
|
||||
* Write print data...
|
||||
*/
|
||||
|
||||
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
|
||||
if (errno == ENOTTY)
|
||||
wbytes = write(fd, bufptr, nbytes);
|
||||
|
||||
if (wbytes < 0)
|
||||
{
|
||||
/*
|
||||
* Check for retryable errors...
|
||||
*/
|
||||
|
||||
if (errno == ENOSPC)
|
||||
{
|
||||
paperout = 1;
|
||||
fputs("ERROR: Out of paper!\n", stderr);
|
||||
fputs("STATUS: +media-tray-empty-error\n", stderr);
|
||||
}
|
||||
else if (errno != EAGAIN && errno != EINTR)
|
||||
{
|
||||
perror("ERROR: Unable to send print file to printer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Update count and pointer...
|
||||
*/
|
||||
|
||||
if (paperout)
|
||||
{
|
||||
fputs("STATUS: -media-tray-empty-error\n", stderr);
|
||||
paperout = 0;
|
||||
}
|
||||
|
||||
nbytes -= wbytes;
|
||||
bufptr += wbytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wbytes < 0)
|
||||
break;
|
||||
|
||||
if (fp)
|
||||
fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
|
||||
(unsigned long)tbytes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the USB port and return...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
|
||||
return (wbytes < 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 format[255], /* Format for device filename */
|
||||
device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
device_uri[1024], /* Device URI string */
|
||||
make_model[1024]; /* Make and model */
|
||||
|
||||
|
||||
/*
|
||||
* First figure out which USB printer filename to use...
|
||||
*/
|
||||
|
||||
if (!access("/dev/usblp0", 0))
|
||||
strcpy(format, "/dev/usblp%d");
|
||||
else if (!access("/dev/usb/usblp0", 0))
|
||||
strcpy(format, "/dev/usb/usblp%d");
|
||||
else
|
||||
strcpy(format, "/dev/usb/lp%d");
|
||||
|
||||
/*
|
||||
* Then open each USB device...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 16; i ++)
|
||||
{
|
||||
sprintf(device, format, i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
|
||||
{
|
||||
if (!get_device_id(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri)))
|
||||
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
|
||||
make_model, make_model, i + 1, device_id);
|
||||
|
||||
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 */
|
||||
struct ecpp_device_id did; /* Device ID buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Open each USB device...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 8; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/usb/printer%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
|
||||
{
|
||||
if (!get_device_id(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri)))
|
||||
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
|
||||
make_model, make_model, i + 1, device_id);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#elif defined(__hpux)
|
||||
#elif defined(__osf)
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
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...
|
||||
*/
|
||||
|
||||
int /* O - File descriptor or -1 on error */
|
||||
open_device(const char *uri) /* I - Device URI */
|
||||
{
|
||||
/*
|
||||
* 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
|
||||
return (-1); /* Do not allow direct devices anymore */
|
||||
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? */
|
||||
int fd; /* File descriptor */
|
||||
char format[255], /* Format for device filename */
|
||||
device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
make_model[1024], /* Make and model */
|
||||
device_uri[1024]; /* Device URI string */
|
||||
|
||||
|
||||
/*
|
||||
* First figure out which USB printer filename to use...
|
||||
*/
|
||||
|
||||
if (!access("/dev/usblp0", 0))
|
||||
strcpy(format, "/dev/usblp%d");
|
||||
else if (!access("/dev/usb/usblp0", 0))
|
||||
strcpy(format, "/dev/usb/usblp%d");
|
||||
else
|
||||
strcpy(format, "/dev/usb/lp%d");
|
||||
|
||||
/*
|
||||
* Then find the correct USB device...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
for (busy = 0, i = 0; i < 16; i ++)
|
||||
{
|
||||
sprintf(device, format, i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
|
||||
{
|
||||
get_device_id(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)
|
||||
{
|
||||
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
|
||||
stderr);
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
while (busy);
|
||||
|
||||
/*
|
||||
* Couldn't find the printer, return "no such device or address"...
|
||||
*/
|
||||
|
||||
errno = ENODEV;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
return (-1); /* Do not allow direct devices anymore */
|
||||
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? */
|
||||
int fd; /* File descriptor */
|
||||
char device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
make_model[1024], /* Make and model */
|
||||
device_uri[1024]; /* Device URI string */
|
||||
struct ecpp_device_id did; /* Device ID buffer */
|
||||
|
||||
|
||||
/*
|
||||
* 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_RDWR | O_EXCL)) >= 0)
|
||||
get_device_id(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))
|
||||
return (fd); /* Yes, return this file descriptor... */
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
fputs("INFO: USB printer is busy; will retry in 5 seconds...\n",
|
||||
stderr);
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
while (busy);
|
||||
|
||||
/*
|
||||
* Couldn't find the printer, return "no such device or address"...
|
||||
*/
|
||||
|
||||
errno = ENODEV;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
#else
|
||||
return (open(uri + 4, O_RDWR | O_EXCL));
|
||||
#endif /* __linux */
|
||||
else
|
||||
{
|
||||
errno = ENODEV;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-269
@@ -1,269 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* USB port backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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 <cups/backend.h>
|
||||
#include <cups/cups.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <cups/string.h>
|
||||
#include <signal.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, const char *options,
|
||||
int fp, int copies);
|
||||
|
||||
|
||||
/*
|
||||
* Include the vendor-specific USB implementation...
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "usb-darwin.c"
|
||||
#elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
# 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 */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int fp, /* I - File descriptor to print */
|
||||
int copies) /* I - Copies to print */
|
||||
{
|
||||
/*
|
||||
* 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)fp;
|
||||
(void)copies;
|
||||
|
||||
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 fp; /* 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)
|
||||
{
|
||||
fputs("Usage: usb job-id user title copies options [file]\n", stderr);
|
||||
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)
|
||||
{
|
||||
fputs("ERROR: No device URI found in argv[0] or in DEVICE_URI environment variable!\n", stderr);
|
||||
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)
|
||||
{
|
||||
fp = 0;
|
||||
copies = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Try to open the print file...
|
||||
*/
|
||||
|
||||
if ((fp = open(argv[6], O_RDONLY)) < 0)
|
||||
{
|
||||
fprintf(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, fp, copies);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
*/
|
||||
|
||||
if (fp != 0)
|
||||
close(fp);
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,14 +0,0 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
lpc.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
|
||||
lpc.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
lpc.o: ../cups/i18n.h ../cups/debug.h ../cups/string.h ../config.h
|
||||
lpq.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
|
||||
lpq.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
|
||||
lpq.o: ../cups/file.h ../cups/language.h ../cups/i18n.h ../cups/debug.h
|
||||
lpr.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
|
||||
lpr.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
|
||||
lpr.o: ../cups/file.h ../cups/language.h ../cups/i18n.h
|
||||
lprm.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
|
||||
lprm.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
lprm.o: ../cups/i18n.h ../cups/string.h ../config.h
|
||||
@@ -1,125 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Berkeley commands makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# 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)
|
||||
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all
|
||||
$(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)
|
||||
|
||||
|
||||
#
|
||||
# Uninstall all targets...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BINDIR)/lpq
|
||||
$(RM) $(BINDIR)/lpr
|
||||
$(RM) $(BINDIR)/lprm
|
||||
$(RM) $(SBINDIR)/lpc
|
||||
-$(RMDIR) $(SBINDIR)
|
||||
-$(RMDIR) $(BINDIR)
|
||||
|
||||
|
||||
#
|
||||
# lpc
|
||||
#
|
||||
|
||||
lpc: lpc.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpc lpc.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# lpq
|
||||
#
|
||||
|
||||
lpq: lpq.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpq lpq.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# lpr
|
||||
#
|
||||
|
||||
lpr: lpr.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lpr lpr.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# lprm
|
||||
#
|
||||
|
||||
lprm: lprm.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o lprm lprm.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -1,522 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* "lpc" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Parse options and commands.
|
||||
* compare_strings() - Compare two command-line strings.
|
||||
* do_command() - Do an lpc command...
|
||||
* show_help() - Show help messages.
|
||||
* show_status() - Show printers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.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 *);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and commands.
|
||||
*/
|
||||
|
||||
int
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
http_t *http; /* Connection to server */
|
||||
char line[1024], /* Input line from user */
|
||||
*params; /* Pointer to parameters */
|
||||
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
/*
|
||||
* Process a single command on the command-line...
|
||||
*/
|
||||
|
||||
do_command(http, argv[1], argv[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Do the command prompt thing...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> "));
|
||||
while (fgets(line, sizeof(line), stdin) != NULL)
|
||||
{
|
||||
/*
|
||||
* Strip trailing whitespace...
|
||||
*/
|
||||
|
||||
for (params = line + strlen(line) - 1; params >= line;)
|
||||
if (!isspace(*params & 255))
|
||||
break;
|
||||
else
|
||||
*params-- = '\0';
|
||||
|
||||
/*
|
||||
* Strip leading whitespace...
|
||||
*/
|
||||
|
||||
for (params = line; isspace(*params & 255); params ++);
|
||||
|
||||
if (params > line)
|
||||
_cups_strcpy(line, params);
|
||||
|
||||
if (!line[0])
|
||||
{
|
||||
/*
|
||||
* Nothing left, just show a prompt...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> "));
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find any options in the string...
|
||||
*/
|
||||
|
||||
for (params = line; *params != '\0'; params ++)
|
||||
if (isspace(*params & 255))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Remove whitespace between the command and parameters...
|
||||
*/
|
||||
|
||||
while (isspace(*params & 255))
|
||||
*params++ = '\0';
|
||||
|
||||
/*
|
||||
* The "quit" and "exit" commands exit; otherwise, process as needed...
|
||||
*/
|
||||
|
||||
if (!compare_strings(line, "quit", 1) ||
|
||||
!compare_strings(line, "exit", 2))
|
||||
break;
|
||||
|
||||
if (*params == '\0')
|
||||
do_command(http, line, NULL);
|
||||
else
|
||||
do_command(http, line, params);
|
||||
|
||||
/*
|
||||
* Put another prompt out to the user...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stdout, _("lpc> "));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the connection to the server and return...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare_strings()' - Compare two command-line strings.
|
||||
*/
|
||||
|
||||
static int /* O - -1 or 1 = no match, 0 = match */
|
||||
compare_strings(const char *s, /* I - Command-line string */
|
||||
const char *t, /* I - Option string */
|
||||
int tmin) /* I - Minimum number of unique chars in option */
|
||||
{
|
||||
int slen; /* Length of command-line string */
|
||||
|
||||
|
||||
slen = strlen(s);
|
||||
if (slen < tmin)
|
||||
return (-1);
|
||||
else
|
||||
return (strncmp(s, t, slen));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'do_command()' - Do an lpc command...
|
||||
*/
|
||||
|
||||
static void
|
||||
do_command(http_t *http, /* I - HTTP connection to server */
|
||||
const char *command, /* I - Command string */
|
||||
const char *params) /* I - Parameters for command */
|
||||
{
|
||||
if (!compare_strings(command, "status", 4))
|
||||
show_status(http, params);
|
||||
else if (!compare_strings(command, "help", 1) || !strcmp(command, "?"))
|
||||
show_help(params);
|
||||
else
|
||||
_cupsLangPrintf(stdout,
|
||||
_("%s is not implemented by the CUPS version of lpc.\n"),
|
||||
command);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_help()' - Show help messages.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_help(const char *command) /* I - Command to describe or NULL */
|
||||
{
|
||||
if (!command)
|
||||
{
|
||||
_cupsLangPrintf(stdout,
|
||||
_("Commands may be abbreviated. Commands are:\n"
|
||||
"\n"
|
||||
"exit help quit status ?\n"));
|
||||
}
|
||||
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
|
||||
_cupsLangPrintf(stdout, _("?Invalid help command unknown\n"));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_status()' - Show printers.
|
||||
*/
|
||||
|
||||
static void
|
||||
show_status(http_t *http, /* I - HTTP connection to server */
|
||||
const char *dests) /* I - Destinations */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response, /* IPP Response */
|
||||
*jobs; /* IPP Get Jobs response */
|
||||
ipp_attribute_t *attr, /* Current attribute */
|
||||
*jattr; /* Current job attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
char *printer, /* Printer name */
|
||||
*device, /* Device URI */
|
||||
*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 */
|
||||
char printer_uri[HTTP_MAX_URI];
|
||||
/* Printer URI */
|
||||
static const char *requested[] = /* Requested attributes */
|
||||
{
|
||||
"printer-name",
|
||||
"device-uri",
|
||||
"printer-state",
|
||||
"printer-is-accepting-jobs"
|
||||
};
|
||||
|
||||
|
||||
DEBUG_printf(("show_status(http=%p, dests=\"%s\")\n", http, dests));
|
||||
|
||||
if (http == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_PRINTERS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = CUPS_GET_PRINTERS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL, language->language);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", sizeof(requested) / sizeof(requested[0]),
|
||||
NULL, requested);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
DEBUG_puts("show_status: request succeeded...");
|
||||
|
||||
/*
|
||||
* Loop through the printers returned in the list and display
|
||||
* their status...
|
||||
*/
|
||||
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Pull the needed attributes from this job...
|
||||
*/
|
||||
|
||||
printer = NULL;
|
||||
device = "file:/dev/null";
|
||||
pstate = IPP_PRINTER_IDLE;
|
||||
jobcount = 0;
|
||||
accepting = 1;
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
|
||||
{
|
||||
if (!strcmp(attr->name, "printer-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
printer = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "device-uri") &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
device = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "printer-state") &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
pstate = (ipp_pstate_t)attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
|
||||
attr->value_tag == IPP_TAG_BOOLEAN)
|
||||
accepting = attr->values[0].boolean;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have everything needed...
|
||||
*/
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
if (attr == NULL)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* A single 'all' printer name is special, meaning all printers.
|
||||
*/
|
||||
|
||||
if (dests != NULL && !strcmp(dests, "all"))
|
||||
dests = NULL;
|
||||
|
||||
/*
|
||||
* See if this is a printer we're interested in...
|
||||
*/
|
||||
|
||||
match = dests == NULL;
|
||||
|
||||
if (dests != NULL)
|
||||
{
|
||||
for (dptr = dests; *dptr != '\0';)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace and commas...
|
||||
*/
|
||||
|
||||
while (isspace(*dptr & 255) || *dptr == ',')
|
||||
dptr ++;
|
||||
|
||||
if (*dptr == '\0')
|
||||
break;
|
||||
|
||||
/*
|
||||
* Compare names...
|
||||
*/
|
||||
|
||||
for (ptr = printer;
|
||||
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
|
||||
ptr ++, dptr ++);
|
||||
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr & 255)))
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip trailing junk...
|
||||
*/
|
||||
|
||||
while (!isspace(*dptr & 255) && *dptr != '\0')
|
||||
dptr ++;
|
||||
while (isspace(*dptr & 255) || *dptr == ',')
|
||||
dptr ++;
|
||||
|
||||
if (*dptr == '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the printer entry if needed...
|
||||
*/
|
||||
|
||||
if (match)
|
||||
{
|
||||
/*
|
||||
* 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);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
|
||||
"ipp", NULL, "localhost", 631, "/printers/%s",
|
||||
printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, printer_uri);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", NULL, "job-id");
|
||||
|
||||
if ((jobs = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Grab the number of jobs for the printer.
|
||||
*/
|
||||
|
||||
for (jattr = jobs->attrs; jattr != NULL; jattr = jattr->next)
|
||||
if (jattr->name && !strcmp(jattr->name, "job-id"))
|
||||
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);
|
||||
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"));
|
||||
|
||||
if (jobcount == 0)
|
||||
_cupsLangPuts(stdout, _("\tno entries\n"));
|
||||
else
|
||||
_cupsLangPrintf(stdout, _("\t%d entries\n"), jobcount);
|
||||
|
||||
_cupsLangPuts(stdout, _("\tdaemon present\n"));
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,655 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* "lpq" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/string.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and commands.
|
||||
*/
|
||||
|
||||
int
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
http_t *http; /* Connection to server */
|
||||
const char *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 */
|
||||
cups_lang_t *language; /* Language */
|
||||
#ifdef HAVE_SSL
|
||||
http_encryption_t encryption; /* Encryption? */
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption())) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for command-line options...
|
||||
*/
|
||||
|
||||
dest = NULL;
|
||||
user = NULL;
|
||||
id = 0;
|
||||
interval = 0;
|
||||
longstatus = 0;
|
||||
all = 0;
|
||||
num_dests = cupsGetDests(&dests);
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '+')
|
||||
interval = atoi(argv[i] + 1);
|
||||
else if (argv[i][0] == '-')
|
||||
{
|
||||
switch (argv[i][1])
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
encryption = HTTP_ENCRYPT_REQUIRED;
|
||||
|
||||
if (http)
|
||||
httpEncryption(http, encryption);
|
||||
#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';
|
||||
|
||||
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 != NULL)
|
||||
httpClose(http);
|
||||
|
||||
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 */
|
||||
longstatus = 1;
|
||||
break;
|
||||
|
||||
default :
|
||||
httpClose(http);
|
||||
cupsFreeDests(num_dests, dests);
|
||||
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (isdigit(argv[i][0] & 255))
|
||||
id = atoi(argv[i]);
|
||||
else
|
||||
user = argv[i];
|
||||
|
||||
if (dest == NULL && !all)
|
||||
{
|
||||
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);
|
||||
|
||||
if (i && interval)
|
||||
{
|
||||
fflush(stdout);
|
||||
sleep(interval);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the connection to the server and return...
|
||||
*/
|
||||
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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 */
|
||||
{
|
||||
"th",
|
||||
"st",
|
||||
"nd",
|
||||
"rd",
|
||||
"th",
|
||||
"th",
|
||||
"th",
|
||||
"th",
|
||||
"th",
|
||||
"th"
|
||||
};
|
||||
|
||||
|
||||
DEBUG_printf(("show_jobs(%08x, %08x, %08x, %d, %d)\n", http, dest, user, id,
|
||||
longstatus));
|
||||
|
||||
if (http == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_JOBS or IPP_GET_JOB_ATTRIBUTES request, which requires
|
||||
* the following attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* job-uri or printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
|
||||
|
||||
if (dest == NULL)
|
||||
{
|
||||
if (id)
|
||||
sprintf(resource, "ipp://localhost/jobs/%d", id);
|
||||
else
|
||||
strcpy(resource, "ipp://localhost/jobs");
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
else
|
||||
{
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
|
||||
NULL, "localhost", 0, "/printers/%s", dest);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, resource);
|
||||
}
|
||||
|
||||
if (user)
|
||||
{
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
jobcount = 0;
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
|
||||
ippDelete(response);
|
||||
return (0);
|
||||
}
|
||||
|
||||
rank = 1;
|
||||
|
||||
/*
|
||||
* Loop through the job list and display them...
|
||||
*/
|
||||
|
||||
for (attr = response->attrs; attr != NULL; attr = attr->next)
|
||||
{
|
||||
/*
|
||||
* Skip leading attributes until we hit a job...
|
||||
*/
|
||||
|
||||
while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
|
||||
attr = attr->next;
|
||||
|
||||
if (attr == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Pull the needed attributes from this job...
|
||||
*/
|
||||
|
||||
jobid = 0;
|
||||
jobsize = 0;
|
||||
#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") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-k-octets") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobsize = attr->values[0].integer;
|
||||
|
||||
#ifdef __osf__
|
||||
if (!strcmp(attr->name, "job-priority") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobpriority = attr->values[0].integer;
|
||||
#endif /* __osf__ */
|
||||
|
||||
if (!strcmp(attr->name, "job-state") &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
jobstate = (ipp_jstate_t)attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "job-printer-uri") &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL)
|
||||
jobdest ++;
|
||||
|
||||
if (!strcmp(attr->name, "job-originating-user-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
jobuser = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "job-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
jobname = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "copies") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobcopies = attr->values[0].integer;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have everything needed...
|
||||
*/
|
||||
|
||||
if (jobdest == NULL || jobid == 0)
|
||||
{
|
||||
if (attr == NULL)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!longstatus && jobcount == 0)
|
||||
#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");
|
||||
|
||||
if (jobcopies > 1)
|
||||
snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
|
||||
jobname);
|
||||
else
|
||||
strlcpy(namestr, jobname, sizeof(namestr));
|
||||
|
||||
_cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]\n"),
|
||||
jobuser, rankstr, jobid);
|
||||
_cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes\n"),
|
||||
namestr, 1024.0 * 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 (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$".
|
||||
*/
|
||||
@@ -1,533 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* "lpr" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Parse options and send files for printing.
|
||||
* sighandler() - Signal catcher for when we print from stdin...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <cups/string.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
# include <signal.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions.
|
||||
*/
|
||||
|
||||
void sighandler(int);
|
||||
#endif /* !WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Globals...
|
||||
*/
|
||||
|
||||
char tempfile[1024]; /* Temporary file for printing from stdin */
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and send files for printing.
|
||||
*/
|
||||
|
||||
int
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i, j; /* Looping var */
|
||||
int job_id; /* Job ID */
|
||||
char ch; /* Option character */
|
||||
char *printer, /* Destination printer or class */
|
||||
*instance; /* Instance */
|
||||
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 */
|
||||
int num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests, /* Destinations */
|
||||
*dest; /* Selected destination */
|
||||
int num_options; /* Number of options */
|
||||
cups_option_t *options; /* Options */
|
||||
int deletefile; /* Delete file after print? */
|
||||
char buffer[8192]; /* Copy buffer */
|
||||
ssize_t bytes; /* Bytes copied */
|
||||
off_t filesize; /* Size of temp file */
|
||||
int temp; /* Temporary file descriptor */
|
||||
cups_lang_t *language; /* Language information */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Signal action */
|
||||
struct sigaction oldaction; /* Old signal action */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
|
||||
deletefile = 0;
|
||||
printer = NULL;
|
||||
num_dests = 0;
|
||||
dests = NULL;
|
||||
num_options = 0;
|
||||
options = NULL;
|
||||
num_files = 0;
|
||||
title = NULL;
|
||||
language = cupsLangDefault();
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '-')
|
||||
switch (ch = 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 */
|
||||
case 'g' : /* plot */
|
||||
case 'n' : /* Ditroff */
|
||||
case 't' : /* Troff */
|
||||
case 'v' : /* Raster image */
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Warning - \'%c\' format modifier not "
|
||||
"supported - output may not be correct!\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);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'l' : /* Literal/raw */
|
||||
num_options = cupsAddOption("raw", "", num_options, &options);
|
||||
break;
|
||||
|
||||
case 'p' : /* Prettyprint */
|
||||
num_options = cupsAddOption("prettyprint", "", num_options,
|
||||
&options);
|
||||
break;
|
||||
|
||||
case 'h' : /* Suppress burst page */
|
||||
num_options = cupsAddOption("job-sheets", "none", num_options,
|
||||
&options);
|
||||
break;
|
||||
|
||||
case 's' : /* Don't use symlinks */
|
||||
break;
|
||||
|
||||
case 'm' : /* Mail on completion */
|
||||
{
|
||||
char email[1024]; /* EMail address */
|
||||
|
||||
|
||||
snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(),
|
||||
httpGetHostname(NULL, buffer, sizeof(buffer)));
|
||||
num_options = cupsAddOption("notify-recipient", email,
|
||||
num_options, &options);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q' : /* Queue file but don't print */
|
||||
num_options = cupsAddOption("job-hold-until", "indefinite",
|
||||
num_options, &options);
|
||||
break;
|
||||
|
||||
case 'r' : /* Remove file after printing */
|
||||
deletefile = 1;
|
||||
break;
|
||||
|
||||
case 'P' : /* Destination printer or class */
|
||||
if (argv[i][2] != '\0')
|
||||
printer = 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 (num_dests == 0)
|
||||
num_dests = cupsGetDests(&dests);
|
||||
|
||||
if ((dest = cupsGetDest(printer, instance, num_dests, dests)) != NULL)
|
||||
{
|
||||
for (j = 0; j < dest->num_options; j ++)
|
||||
if (cupsGetOption(dest->options[j].name, num_options,
|
||||
options) == NULL)
|
||||
num_options = cupsAddOption(dest->options[j].name,
|
||||
dest->options[j].value,
|
||||
num_options, &options);
|
||||
}
|
||||
break;
|
||||
|
||||
case '#' : /* Number of copies */
|
||||
if (argv[i][2] != '\0')
|
||||
num_copies = atoi(argv[i] + 2);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - expected copy count after "
|
||||
"\'-#\' option!\n"),
|
||||
argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
num_copies = atoi(argv[i]);
|
||||
}
|
||||
|
||||
sprintf(buffer, "%d", num_copies);
|
||||
num_options = cupsAddOption("copies", buffer, num_options, &options);
|
||||
break;
|
||||
|
||||
case 'C' : /* Class */
|
||||
case 'J' : /* Job name */
|
||||
case 'T' : /* Title */
|
||||
if (argv[i][2] != '\0')
|
||||
title = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
if (i >= argc)
|
||||
{
|
||||
_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]);
|
||||
return (1);
|
||||
}
|
||||
else if (num_files < 1000)
|
||||
{
|
||||
/*
|
||||
* Print a file...
|
||||
*/
|
||||
|
||||
if (access(argv[i], R_OK) != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unable to access \"%s\" - %s\n"),
|
||||
argv[0], argv[i], strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
files[num_files] = argv[i];
|
||||
num_files ++;
|
||||
|
||||
if (title == NULL)
|
||||
{
|
||||
if ((title = strrchr(argv[i], '/')) != NULL)
|
||||
title ++;
|
||||
else
|
||||
title = argv[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - too many files - \"%s\"\n"),
|
||||
argv[0], argv[i]);
|
||||
/*
|
||||
* See if we have any files to print; if not, print from stdin...
|
||||
*/
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests(&dests);
|
||||
|
||||
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != 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 && !cupsGetDest(printer, NULL, num_dests, dests))
|
||||
_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
|
||||
{
|
||||
num_files = 1;
|
||||
|
||||
#ifndef WIN32
|
||||
# if defined(HAVE_SIGSET)
|
||||
sigset(SIGHUP, sighandler);
|
||||
if (sigset(SIGINT, sighandler) == SIG_IGN)
|
||||
sigset(SIGINT, SIG_IGN);
|
||||
sigset(SIGTERM, sighandler);
|
||||
# elif defined(HAVE_SIGACTION)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = sighandler;
|
||||
|
||||
sigaction(SIGHUP, &action, NULL);
|
||||
sigaction(SIGINT, NULL, &oldaction);
|
||||
if (oldaction.sa_handler != SIG_IGN)
|
||||
sigaction(SIGINT, &action, NULL);
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
# else
|
||||
signal(SIGHUP, sighandler);
|
||||
if (signal(SIGINT, sighandler) == SIG_IGN)
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGTERM, sighandler);
|
||||
# endif
|
||||
#endif /* !WIN32 */
|
||||
|
||||
if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unable to create temporary file "
|
||||
"\"%s\" - %s\n"),
|
||||
argv[0], tempfile, strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
while ((bytes = read(0, buffer, sizeof(buffer))) > 0)
|
||||
if (write(temp, buffer, bytes) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unable to write to temporary file "
|
||||
"\"%s\" - %s\n"),
|
||||
argv[0], tempfile, strerror(errno));
|
||||
close(temp);
|
||||
unlink(tempfile);
|
||||
return (1);
|
||||
}
|
||||
|
||||
filesize = lseek(temp, 0, SEEK_CUR);
|
||||
close(temp);
|
||||
|
||||
if (filesize <= 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - stdin is empty, so no job has been sent.\n"),
|
||||
argv[0]);
|
||||
unlink(tempfile);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (title)
|
||||
job_id = cupsPrintFile(printer, tempfile, title, num_options, options);
|
||||
else
|
||||
job_id = cupsPrintFile(printer, tempfile, "(stdin)", num_options, options);
|
||||
|
||||
unlink(tempfile);
|
||||
}
|
||||
|
||||
if (job_id < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
/*
|
||||
* 'sighandler()' - Signal catcher for when we print from stdin...
|
||||
*/
|
||||
|
||||
void
|
||||
sighandler(int s) /* I - Signal number */
|
||||
{
|
||||
/*
|
||||
* Remove the temporary file we're using to print from stdin...
|
||||
*/
|
||||
|
||||
unlink(tempfile);
|
||||
|
||||
/*
|
||||
* Exit...
|
||||
*/
|
||||
|
||||
exit(s);
|
||||
}
|
||||
#endif /* !WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* "lprm" command for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Parse options and cancel jobs.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/string.h>
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Parse options and cancel jobs.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
http_t *http; /* HTTP connection to server */
|
||||
int i; /* Looping var */
|
||||
int job_id; /* Job ID */
|
||||
const char *dest; /* Destination printer */
|
||||
char *instance; /* Pointer to instance name */
|
||||
char uri[1024]; /* Printer or job URI */
|
||||
ipp_t *request; /* IPP request */
|
||||
ipp_t *response; /* IPP response */
|
||||
ipp_op_t op; /* Operation */
|
||||
cups_lang_t *language; /* Language */
|
||||
int num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests; /* Destinations */
|
||||
http_encryption_t encryption; /* Encryption? */
|
||||
|
||||
|
||||
/*
|
||||
* Setup to cancel individual print jobs...
|
||||
*/
|
||||
|
||||
op = IPP_CANCEL_JOB;
|
||||
job_id = 0;
|
||||
dest = NULL;
|
||||
response = NULL;
|
||||
http = NULL;
|
||||
encryption = cupsEncryption();
|
||||
language = cupsLangDefault();
|
||||
num_dests = cupsGetDests(&dests);
|
||||
|
||||
for (i = 0; i < num_dests; i ++)
|
||||
if (dests[i].is_default)
|
||||
dest = dests[i].name;
|
||||
|
||||
/*
|
||||
* Open a connection to the server...
|
||||
*/
|
||||
|
||||
if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
|
||||
cupsFreeDests(num_dests, dests);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process command-line arguments...
|
||||
*/
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '-' && argv[i][1] != '\0')
|
||||
switch (argv[i][1])
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
encryption = HTTP_ENCRYPT_REQUIRED;
|
||||
|
||||
httpEncryption(http, encryption);
|
||||
#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])
|
||||
dest = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
dest = argv[i];
|
||||
}
|
||||
|
||||
if ((instance = strchr(dest, '/')) != NULL)
|
||||
*instance = '\0';
|
||||
|
||||
if (cupsGetDest(dest, NULL, num_dests, dests) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown destination \"%s\"!\n"),
|
||||
argv[0], dest);
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
return(1);
|
||||
}
|
||||
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 (http != NULL)
|
||||
httpClose(http);
|
||||
|
||||
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;
|
||||
|
||||
default :
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Error - unknown option \'%c\'!\n"),
|
||||
argv[0], argv[i][1]);
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Cancel a job or printer...
|
||||
*/
|
||||
|
||||
if (isdigit(argv[i][0] & 255) &&
|
||||
cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
|
||||
{
|
||||
dest = NULL;
|
||||
op = IPP_CANCEL_JOB;
|
||||
job_id = atoi(argv[i]);
|
||||
}
|
||||
else if (!strcmp(argv[i], "-"))
|
||||
{
|
||||
/*
|
||||
* Cancel all jobs
|
||||
*/
|
||||
|
||||
op = IPP_PURGE_JOBS;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest = argv[i];
|
||||
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 = ippNewRequest(op);
|
||||
|
||||
if (dest)
|
||||
{
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", dest);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
|
||||
job_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(uri, "ipp://localhost/jobs/%d", job_id);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL,
|
||||
uri);
|
||||
}
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, cupsUser());
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if (op == IPP_PURGE_JOBS)
|
||||
response = cupsDoRequest(http, request, "/admin/");
|
||||
else
|
||||
response = cupsDoRequest(http, request, "/jobs/");
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
|
||||
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If nothing has been cancelled yet, cancel the current job on the specified
|
||||
* (or default) printer...
|
||||
*/
|
||||
|
||||
if (response == NULL)
|
||||
if (!cupsCancelJob(dest, 0))
|
||||
{
|
||||
_cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
return (1);
|
||||
}
|
||||
|
||||
cupsFreeDests(num_dests, dests);
|
||||
httpClose(http);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
#
|
||||
# Makefile for CUPS build and test repository.
|
||||
#
|
||||
# This makefile MUST be used from the build.sh script, otherwise the
|
||||
# environment will not be configured properly...
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
|
||||
# Subdirectories to be built...
|
||||
DIRS = \
|
||||
stable/.all \
|
||||
development/.all \
|
||||
|
||||
|
||||
# Make everything...
|
||||
all: tools/.all $(DIRS)
|
||||
|
||||
|
||||
# Clean everything...
|
||||
clean: tools/.clean $(DIRS:.all=.clean)
|
||||
@echo Removing \"temp\" directory...
|
||||
rm -rf temp
|
||||
@echo Removing old failed test reports...
|
||||
find . -name 'cups-str*.html' -mtime +7 -print -exec rm -f '{}' \;
|
||||
find . -name 'error_log-*' -mtime +7 -print -exec rm -f '{}' \;
|
||||
|
||||
|
||||
# Make CUPS stable
|
||||
stable/.all: stable/Makedefs
|
||||
@echo Making all in CUPS stable...
|
||||
cd stable && $(MAKE) all check
|
||||
|
||||
stable/.clean:
|
||||
@cd stable; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS stable...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
|
||||
stable/Makedefs: stable/Makedefs.in stable/configure \
|
||||
stable/packaging/cups.list.in \
|
||||
stable/config.h.in
|
||||
@cd stable; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS stable...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
@echo Configuring CUPS stable...
|
||||
cd stable && ./configure $(BUILDOPTIONS) \
|
||||
--enable-static \
|
||||
--enable-unit-tests --enable-debug-printfs
|
||||
|
||||
stable/configure: stable/configure.ac \
|
||||
stable/config-scripts/cups-common.m4 \
|
||||
stable/config-scripts/cups-compiler.m4 \
|
||||
stable/config-scripts/cups-defaults.m4 \
|
||||
stable/config-scripts/cups-directories.m4 \
|
||||
stable/config-scripts/cups-dnssd.m4 \
|
||||
stable/config-scripts/cups-gssapi.m4 \
|
||||
stable/config-scripts/cups-largefile.m4 \
|
||||
stable/config-scripts/cups-libtool.m4 \
|
||||
stable/config-scripts/cups-manpages.m4 \
|
||||
stable/config-scripts/cups-network.m4 \
|
||||
stable/config-scripts/cups-opsys.m4 \
|
||||
stable/config-scripts/cups-pam.m4 \
|
||||
stable/config-scripts/cups-poll.m4 \
|
||||
stable/config-scripts/cups-scripting.m4 \
|
||||
stable/config-scripts/cups-sharedlibs.m4 \
|
||||
stable/config-scripts/cups-ssl.m4 \
|
||||
stable/config-scripts/cups-startup.m4 \
|
||||
stable/config-scripts/cups-threads.m4
|
||||
@echo Updating CUPS stable configure script...
|
||||
cd stable; rm -rf autom4te.cache configure; autoconf
|
||||
|
||||
|
||||
# Make CUPS master (bleeding edge development)
|
||||
development/.all: development/Makedefs
|
||||
@echo Making all in CUPS development...
|
||||
cd development && $(MAKE) all check
|
||||
|
||||
development/.clean:
|
||||
@cd development; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS development...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
|
||||
development/Makedefs: development/Makedefs.in development/configure \
|
||||
development/packaging/cups.list.in \
|
||||
development/config.h.in
|
||||
@cd development; if test -f Makedefs; then \
|
||||
echo Cleaning CUPS development...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
@echo Configuring CUPS development...
|
||||
cd development && ./configure $(BUILDOPTIONS) \
|
||||
--enable-static \
|
||||
--enable-unit-tests --enable-debug-printfs
|
||||
|
||||
development/configure: development/configure.ac \
|
||||
development/config-scripts/cups-common.m4 \
|
||||
development/config-scripts/cups-compiler.m4 \
|
||||
development/config-scripts/cups-defaults.m4 \
|
||||
development/config-scripts/cups-directories.m4 \
|
||||
development/config-scripts/cups-dnssd.m4 \
|
||||
development/config-scripts/cups-gssapi.m4 \
|
||||
development/config-scripts/cups-largefile.m4 \
|
||||
development/config-scripts/cups-libtool.m4 \
|
||||
development/config-scripts/cups-manpages.m4 \
|
||||
development/config-scripts/cups-network.m4 \
|
||||
development/config-scripts/cups-opsys.m4 \
|
||||
development/config-scripts/cups-pam.m4 \
|
||||
development/config-scripts/cups-poll.m4 \
|
||||
development/config-scripts/cups-scripting.m4 \
|
||||
development/config-scripts/cups-sharedlibs.m4 \
|
||||
development/config-scripts/cups-ssl.m4 \
|
||||
development/config-scripts/cups-startup.m4 \
|
||||
development/config-scripts/cups-threads.m4
|
||||
@echo Updating CUPS development configure script...
|
||||
cd development; rm -rf autom4te.cache configure; autoconf
|
||||
|
||||
# Make the build tools
|
||||
tools/.all: tools/Makefile
|
||||
@echo Making all in tools...
|
||||
cd tools && $(MAKE) install
|
||||
|
||||
tools/.clean:
|
||||
@cd tools; if test -f Makefile; then \
|
||||
echo Cleaning tools...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
|
||||
tools/Makefile: tools/Makefile.in tools/configure
|
||||
@cd tools; if test -f Makefile; then \
|
||||
echo Cleaning tools...; \
|
||||
$(MAKE) distclean || exit 1; \
|
||||
fi
|
||||
@echo Configuring Tools...
|
||||
cd tools && ./configure $(BUILDOPTIONS) --prefix=$(BASEDIR)/temp
|
||||
Arquivo executável
+233
@@ -0,0 +1,233 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Common script for building the current stable and development (master)
|
||||
# branches of CUPS.
|
||||
#
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# build.sh [--if-changed] [--quiet] [--update] [target(s)]
|
||||
#
|
||||
|
||||
# Copy any build/test environment variables...
|
||||
BUILDOPTIONS=""
|
||||
BUILDNOTIFY=""
|
||||
BUILDSUBJECT="[`hostname`]"
|
||||
if test -f buildtest.env; then
|
||||
. ./buildtest.env
|
||||
fi
|
||||
|
||||
# Get the path to this script...
|
||||
BASEDIR=`dirname $0`
|
||||
if test $BASEDIR = .; then
|
||||
BASEDIR=`pwd`
|
||||
fi
|
||||
|
||||
# Make sure the temporary directory is there...
|
||||
if test ! -d $BASEDIR/temp; then
|
||||
mkdir -p $BASEDIR/temp
|
||||
fi
|
||||
|
||||
# Setup common path stuff...
|
||||
PATH=""
|
||||
for dir in /usr/xpg4/bin /usr/ccs/bin /opt/SUNWspro/bin /opt/sfw/bin \
|
||||
/usr/sfw/bin /usr/bsd /usr/freeware/bin /opt/aCC/bin /usr/contrib/bin \
|
||||
/usr/local/bin $HOME/oss/bin; do
|
||||
if test -d $dir; then
|
||||
PATH="$PATH:$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$PATH" = x; then
|
||||
PATH="$BASEDIR/temp/bin:/usr/bin:/bin"
|
||||
else
|
||||
PATH="$BASEDIR/temp/bin$PATH:/usr/bin:/bin"
|
||||
fi
|
||||
|
||||
export PATH
|
||||
|
||||
if test -x /usr/xpg4/bin/grep; then
|
||||
grep=/usr/xpg4/bin/grep
|
||||
else
|
||||
grep=grep
|
||||
fi
|
||||
|
||||
if test -x /usr/local/bin/gmake; then
|
||||
make=/usr/local/bin/gmake
|
||||
else
|
||||
make=make
|
||||
fi
|
||||
|
||||
# Parse command-line arguments:
|
||||
ifchanged=no
|
||||
quiet=no
|
||||
update=no
|
||||
targets=""
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
--ifchanged | --if-changed) ifchanged=yes;;
|
||||
--quiet) quiet=yes;;
|
||||
--update | update) update=yes;;
|
||||
*) targets="$targets $1";;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# Start the build...
|
||||
if test $quiet = yes; then
|
||||
if test $update = yes; then
|
||||
exec >/dev/null 2>&1
|
||||
else
|
||||
if test -f build.log; then
|
||||
mv build.log build.log.O
|
||||
fi
|
||||
|
||||
exec >build.log 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$targets" = x; then
|
||||
targets="all"
|
||||
fi
|
||||
|
||||
echo "Starting build of '$targets' on `date`"
|
||||
|
||||
if test -f git.log; then
|
||||
# Show Subversion updates...
|
||||
echo git pull --recurse-submodules; git submodule update --recursive
|
||||
cat git.log
|
||||
git status | $grep modified: >git.log
|
||||
if test -s git.log; then
|
||||
echo ""
|
||||
echo ERROR: Local files have modifications:
|
||||
echo ""
|
||||
cat git.log
|
||||
echo ""
|
||||
fi
|
||||
rm -f git.log
|
||||
fi
|
||||
|
||||
# Update and then build safely...
|
||||
if test $update = yes; then
|
||||
cd $BASEDIR
|
||||
(git pull --recurse-submodules; git submodule update --recursive) 2>&1 >git.log
|
||||
|
||||
# Need to exec since this script might change...
|
||||
options=""
|
||||
if test $quiet = yes; then
|
||||
options="--quiet $options"
|
||||
fi
|
||||
if test $ifchanged = yes; then
|
||||
options="--ifchanged $options"
|
||||
fi
|
||||
|
||||
exec ./build.sh $options $targets
|
||||
fi
|
||||
|
||||
# Make sure submodules are initialized...
|
||||
if test ! -f stable/Makedefs.in; then
|
||||
echo Initializing submodules...
|
||||
git submodule init
|
||||
git submodule update
|
||||
fi
|
||||
|
||||
# Look for changes to the dependent projects
|
||||
changed=0
|
||||
|
||||
for dir in . tools stable development; do
|
||||
rev=`git rev-parse HEAD $dir`
|
||||
if test -f $dir/.buildrev; then
|
||||
oldrev=`cat $dir/.buildrev`
|
||||
else
|
||||
oldrev=""
|
||||
fi
|
||||
|
||||
if test "x$rev" != "x$oldrev"; then
|
||||
changed=1
|
||||
fi
|
||||
|
||||
echo $rev >$dir/.buildrev
|
||||
done
|
||||
|
||||
if test $ifchanged = yes -a $changed = 0; then
|
||||
echo No changes to build.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Setup the compiler flags to point to all of the dependent libraries...
|
||||
#CFLAGS="-I$BASEDIR/temp/include"
|
||||
#CPPFLAGS="-I$BASEDIR/temp/include"
|
||||
#CXXFLAGS="-I$BASEDIR/temp/include"
|
||||
#DSOFLAGS="-L$BASEDIR/temp/lib"
|
||||
#LDFLAGS="-L$BASEDIR/temp/lib"
|
||||
|
||||
CFLAGS="${CFLAGS:=}"
|
||||
CPPFLAGS="${CPPFLAGS:=}"
|
||||
CXXFLAGS="${CXXFLAGS:=}"
|
||||
DSOFLAGS="${DSOFLAGS:=}"
|
||||
LDFLAGS="${LDFLAGS:=}"
|
||||
|
||||
export CFLAGS
|
||||
export CPPFLAGS
|
||||
export CXXFLAGS
|
||||
export DSOFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
case `uname` in
|
||||
Linux*)
|
||||
if test "`uname -m`" = x86_64; then
|
||||
# 64-bit Linux needs this, at least for now...
|
||||
X_LIBS="-L/usr/X11R6/lib64"
|
||||
export X_LIBS
|
||||
fi
|
||||
;;
|
||||
*BSD*)
|
||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
DSOFLAGS="$DSOFLAGS -L/usr/local/lib"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Show the environment...
|
||||
echo Environment:
|
||||
env
|
||||
|
||||
# Do the build using the top-level makefile...
|
||||
echo $make -f build.mak BASEDIR=$BASEDIR BUILDOPTIONS="$BUILDOPTIONS" $targets
|
||||
$make -f build.mak BASEDIR=$BASEDIR BUILDOPTIONS="$BUILDOPTIONS" $targets </dev/null
|
||||
status=$?
|
||||
|
||||
if test $status = 0; then
|
||||
echo Build succeeded on `date`
|
||||
else
|
||||
echo Build failed on `date`
|
||||
fi
|
||||
|
||||
# If configured, send the build log to a central server for processing...
|
||||
if test "x$BUILDNOTIFY" != x -a -x temp/bin/sendbuildlog -a $quiet = yes; then
|
||||
attachments=""
|
||||
|
||||
date=`date "+%Y-%m-%d"`
|
||||
|
||||
if test -f stable/test/cups-str-2.1-$date-$USER.html; then
|
||||
attachments="$attachments -a stable/test/cups-str-2.1-$date-$USER.html"
|
||||
fi
|
||||
|
||||
if test -f developent/test/cups-str-2.2-$date-$USER.html; then
|
||||
attachments="$attachments -a developent/test/cups-str-2.2-$date-$USER.html"
|
||||
fi
|
||||
|
||||
temp/bin/sendbuildlog -b $status -s "$BUILDSUBJECT r$rev" $attachments "$BUILDNOTIFY" build.log
|
||||
fi
|
||||
@@ -1,55 +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/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
help-index.o: ../cups/language.h ../cups/array.h help-index.h ../cups/debug.h
|
||||
help-index.o: ../cups/i18n.h ../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/md5.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/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/md5.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/string.h ../config.h
|
||||
search.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
search.o: ../cups/md5.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/string.h ../config.h
|
||||
template.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
template.o: ../cups/md5.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/string.h ../config.h
|
||||
var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
var.o: ../cups/md5.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/string.h ../config.h
|
||||
admin.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
admin.o: ../cups/md5.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/string.h ../config.h ../cups/file.h
|
||||
classes.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
classes.o: ../cups/md5.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/string.h ../config.h
|
||||
help.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
help.o: ../cups/md5.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/string.h ../config.h
|
||||
jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
jobs.o: ../cups/md5.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/string.h ../config.h
|
||||
printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
printers.o: ../cups/md5.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/string.h ../config.h
|
||||
testcgi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
|
||||
testcgi.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
testcgi.o: ../cups/array.h help-index.h
|
||||
testhi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h
|
||||
testhi.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
testhi.o: ../cups/array.h help-index.h
|
||||
testtemplate.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
testtemplate.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
testtemplate.o: ../cups/language.h ../cups/array.h help-index.h
|
||||
@@ -1,174 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# CGI makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2006 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 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
CGIS = admin.cgi classes.cgi help.cgi jobs.cgi printers.cgi
|
||||
TARGETS = libcgi.a $(CGIS) testcgi testhi testtemplate
|
||||
LIBOBJS = help-index.o html.o ipp-var.o search.o template.o var.o
|
||||
OBJS = $(LIBOBJS) admin.o classes.o help.o \
|
||||
jobs.o printers.o testcgi.o testhi.o testtemplate.o
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
#
|
||||
# Install all targets...
|
||||
#
|
||||
|
||||
install: all
|
||||
$(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
|
||||
for file in $(CGIS); do \
|
||||
$(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Uninstall all targets...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for file in $(CGIS); do \
|
||||
$(RM) $(SERVERBIN)/cgi-bin/$$file; \
|
||||
done
|
||||
-$(RMDIR) $(SERVERBIN)/cgi-bin
|
||||
|
||||
|
||||
#
|
||||
# libcgi.a
|
||||
#
|
||||
|
||||
libcgi.a: $(LIBOBJS)
|
||||
echo Archiving $@...
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# admin.cgi
|
||||
#
|
||||
|
||||
admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ admin.o libcgi.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# classes.cgi
|
||||
#
|
||||
|
||||
classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ classes.o libcgi.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# help.cgi
|
||||
#
|
||||
|
||||
help.cgi: help.o ../Makedefs libcgi.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ help.o libcgi.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# jobs.cgi
|
||||
#
|
||||
|
||||
jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ jobs.o libcgi.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# printers.cgi
|
||||
#
|
||||
|
||||
printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) libcgi.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ printers.o libcgi.a $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# testcgi
|
||||
#
|
||||
|
||||
testcgi: testcgi.o ../Makedefs libcgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testcgi.o libcgi.a ../cups/libcups.a \
|
||||
$(COMMONLIBS) $(SSLLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testhi
|
||||
#
|
||||
|
||||
testhi: testhi.o ../Makedefs libcgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testhi.o libcgi.a ../cups/libcups.a \
|
||||
$(COMMONLIBS) $(SSLLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testtemplate
|
||||
#
|
||||
|
||||
testtemplate: testtemplate.o ../Makedefs libcgi.a ../cups/libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testtemplate.o libcgi.a ../cups/libcups.a \
|
||||
$(COMMONLIBS) $(SSLLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
-2863
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Private CGI definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2005 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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 10 /* Maximum items per page */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI support library definitions.
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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 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 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 const char *cgiText(const char *message);
|
||||
|
||||
#endif /* !_CUPS_CGI_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,467 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Class status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
* show_all_classes() - Show all classes...
|
||||
* show_class() - Show a single class.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
void show_all_classes(http_t *http, const char *username);
|
||||
void show_class(http_t *http, const char *printer);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
/*
|
||||
* Get the default printer...
|
||||
*/
|
||||
|
||||
if (!op)
|
||||
{
|
||||
/*
|
||||
* Get the default destination...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEFAULT);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
char url[HTTP_MAX_URI]; /* New URL */
|
||||
|
||||
|
||||
cgiSetVariable("DEFAULT_URI",
|
||||
cgiRewriteURL(attr->values[0].string.text,
|
||||
url, sizeof(url), NULL));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we need to show a list of classes or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
if (!pclass)
|
||||
show_all_classes(http, user);
|
||||
else
|
||||
show_class(http, pclass);
|
||||
}
|
||||
else if (!strcasecmp(op, "print-test-page") && pclass)
|
||||
cgiPrintTestPage(http, pclass);
|
||||
else if (!strcasecmp(op, "move-jobs") && pclass)
|
||||
cgiMoveJobs(http, pclass, 0);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Unknown/bad operation...
|
||||
*/
|
||||
|
||||
if (pclass)
|
||||
cgiStartHTML(pclass);
|
||||
else
|
||||
cgiStartHTML(cgiText(_("Classes")));
|
||||
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_all_classes()' - Show all classes...
|
||||
*/
|
||||
|
||||
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 url[1024], /* URL for prev/next/this */
|
||||
*urlptr, /* Position in URL */
|
||||
*urlend; /* End of URL */
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
cgiGetAttributes(request, "classes.tmpl");
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get a list of matching job objects.
|
||||
*/
|
||||
|
||||
if ((var = cgiGetVariable("QUERY")) != NULL)
|
||||
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(url, "%d", count);
|
||||
cgiSetVariable("TOTAL", url);
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
ascending = !strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = 1;
|
||||
|
||||
if (ascending)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Save navigation URLs...
|
||||
*/
|
||||
|
||||
urlend = url + sizeof(url);
|
||||
|
||||
if ((var = cgiGetVariable("QUERY")) != NULL)
|
||||
{
|
||||
strlcpy(url, "/classes/?QUERY=", sizeof(url));
|
||||
urlptr = url + strlen(url);
|
||||
|
||||
cgiFormEncode(urlptr, var, urlend - urlptr);
|
||||
urlptr += strlen(urlptr);
|
||||
|
||||
strlcpy(urlptr, "&", urlend - urlptr);
|
||||
urlptr += strlen(urlptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(url, "/classes/?", sizeof(url));
|
||||
urlptr = url + strlen(url);
|
||||
}
|
||||
|
||||
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
|
||||
cgiSetVariable("THISURL", url);
|
||||
|
||||
if (first > 0)
|
||||
{
|
||||
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
|
||||
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
|
||||
cgiSetVariable("PREVURL", url);
|
||||
}
|
||||
|
||||
if ((first + CUPS_PAGE_MAX) < count)
|
||||
{
|
||||
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
|
||||
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
|
||||
cgiSetVariable("NEXTURL", url);
|
||||
}
|
||||
|
||||
/*
|
||||
* Then show everything...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("search.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("classes-header.tmpl");
|
||||
|
||||
if (count > 0)
|
||||
cgiCopyTemplateLang("pager.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("classes.tmpl");
|
||||
|
||||
if (count > 0)
|
||||
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.
|
||||
*/
|
||||
|
||||
void
|
||||
show_class(http_t *http, /* I - Connection to server */
|
||||
const char *pclass) /* I - Name of class */
|
||||
{
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
char refresh[1024]; /* Refresh URL */
|
||||
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/classes/%s", pclass);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
|
||||
uri);
|
||||
|
||||
cgiGetAttributes(request, "classes.tmpl");
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got the result; set the CGI variables and check the status of a
|
||||
* single-queue request...
|
||||
*/
|
||||
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
if (pclass && (attr = ippFindAttribute(response, "printer-state",
|
||||
IPP_TAG_ENUM)) != NULL &&
|
||||
attr->values[0].integer == IPP_PRINTER_PROCESSING)
|
||||
{
|
||||
/*
|
||||
* Class is processing - automatically refresh the page until we
|
||||
* are done printing...
|
||||
*/
|
||||
|
||||
cgiFormEncode(uri, pclass, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "10;/classes/%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(pclass);
|
||||
|
||||
/*
|
||||
* Show the class status...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("classes.tmpl");
|
||||
|
||||
/*
|
||||
* Show jobs for the specified class...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("class-jobs-header.tmpl");
|
||||
cgiShowJobs(http, pclass);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show the IPP error...
|
||||
*/
|
||||
|
||||
cgiStartHTML(pclass);
|
||||
cgiShowIPPError(_("Unable to get class status:"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,983 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* On-line help index routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* helpDeleteIndex() - Delete an index, freeing all memory used.
|
||||
* helpFindNode() - Find a node in an index.
|
||||
* helpLoadIndex() - Load a help index from disk.
|
||||
* helpSaveIndex() - Save a help index to disk.
|
||||
* helpSearchIndex() - Search an index.
|
||||
* help_compile_search() - Convert a search string into a regular expression.
|
||||
* help_delete_node() - Free all memory used by a node.
|
||||
* help_load_directory() - Load a directory of files into an index.
|
||||
* help_load_file() - Load a HTML files into an index.
|
||||
* help_new_node() - Create a new node and add it to an index.
|
||||
* help_sort_nodes_by_name() - Sort nodes by section, filename, and anchor.
|
||||
* help_sort_nodes_by_score() - Sort nodes by score and text.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <cups/dir.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void help_delete_node(help_node_t *n);
|
||||
static int help_load_directory(help_index_t *hi,
|
||||
const char *directory,
|
||||
const char *relative);
|
||||
static int help_load_file(help_index_t *hi,
|
||||
const char *filename,
|
||||
const char *relative,
|
||||
time_t mtime);
|
||||
static help_node_t *help_new_node(const char *filename, const char *anchor,
|
||||
const char *section, const char *text,
|
||||
time_t mtime, off_t offset,
|
||||
size_t length);
|
||||
static int help_sort_by_name(help_node_t *p1, help_node_t *p2);
|
||||
static int help_sort_by_score(help_node_t *p1, help_node_t *p2);
|
||||
|
||||
|
||||
/*
|
||||
* 'helpDeleteIndex()' - Delete an index, freeing all memory used.
|
||||
*/
|
||||
|
||||
void
|
||||
helpDeleteIndex(help_index_t *hi) /* I - Help index */
|
||||
{
|
||||
help_node_t *node; /* Current node */
|
||||
|
||||
|
||||
DEBUG_printf(("helpDeleteIndex(hi=%p)\n", hi));
|
||||
|
||||
if (!hi)
|
||||
return;
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
{
|
||||
cupsArrayRemove(hi->nodes, node);
|
||||
cupsArrayRemove(hi->sorted, node);
|
||||
|
||||
if (!hi->search)
|
||||
help_delete_node(node);
|
||||
}
|
||||
|
||||
cupsArrayDelete(hi->nodes);
|
||||
cupsArrayDelete(hi->sorted);
|
||||
|
||||
free(hi);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'helpFindNode()' - Find a node in an index.
|
||||
*/
|
||||
|
||||
help_node_t * /* O - Node pointer or NULL */
|
||||
helpFindNode(help_index_t *hi, /* I - Index */
|
||||
const char *filename, /* I - Filename */
|
||||
const char *anchor) /* I - Anchor */
|
||||
{
|
||||
help_node_t key; /* Search key */
|
||||
|
||||
|
||||
DEBUG_printf(("helpFindNode(hi=%p, filename=\"%s\", anchor=\"%s\")\n",
|
||||
hi, filename ? filename : "(nil)", anchor ? anchor : "(nil)"));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!hi || !filename)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Initialize the search key...
|
||||
*/
|
||||
|
||||
key.filename = (char *)filename;
|
||||
key.anchor = (char *)anchor;
|
||||
|
||||
/*
|
||||
* Return any match...
|
||||
*/
|
||||
|
||||
return ((help_node_t *)cupsArrayFind(hi->nodes, &key));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'helpLoadIndex()' - Load a help index from disk.
|
||||
*/
|
||||
|
||||
help_index_t * /* O - Index pointer or NULL */
|
||||
helpLoadIndex(const char *hifile, /* I - Index filename */
|
||||
const char *directory) /* I - Directory that is indexed */
|
||||
{
|
||||
help_index_t *hi; /* Help index */
|
||||
cups_file_t *fp; /* Current file */
|
||||
char line[2048], /* Line from file */
|
||||
*ptr, /* Pointer into line */
|
||||
*filename, /* Filename in line */
|
||||
*anchor, /* Anchor in line */
|
||||
*sectptr, /* Section pointer in line */
|
||||
section[1024], /* Section name */
|
||||
*text; /* Text in line */
|
||||
time_t mtime; /* Modification time */
|
||||
off_t offset; /* Offset into file */
|
||||
size_t length; /* Length in bytes */
|
||||
int update; /* Update? */
|
||||
help_node_t *node; /* Current node */
|
||||
|
||||
|
||||
DEBUG_printf(("helpLoadIndex(hifile=\"%s\", directory=\"%s\")\n",
|
||||
hifile, directory));
|
||||
|
||||
/*
|
||||
* Create a new, empty index.
|
||||
*/
|
||||
|
||||
if ((hi = (help_index_t *)calloc(1, sizeof(help_index_t))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
hi->nodes = cupsArrayNew((cups_array_func_t)help_sort_by_name, NULL);
|
||||
hi->sorted = cupsArrayNew((cups_array_func_t)help_sort_by_score, NULL);
|
||||
|
||||
if (!hi->nodes || !hi->sorted)
|
||||
{
|
||||
cupsArrayDelete(hi->nodes);
|
||||
cupsArrayDelete(hi->sorted);
|
||||
free(hi);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try loading the existing index file...
|
||||
*/
|
||||
|
||||
if ((fp = cupsFileOpen(hifile, "r")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Lock the file and then read the first line...
|
||||
*/
|
||||
|
||||
cupsFileLock(fp, 1);
|
||||
|
||||
if (cupsFileGets(fp, line, sizeof(line)) && !strcmp(line, "HELPV1"))
|
||||
{
|
||||
/*
|
||||
* Got a valid header line, now read the data lines...
|
||||
*/
|
||||
|
||||
while (cupsFileGets(fp, line, sizeof(line)))
|
||||
{
|
||||
/*
|
||||
* Each line looks like one of the following:
|
||||
*
|
||||
* filename mtime offset length "section" "text"
|
||||
* filename#anchor offset length "text"
|
||||
*/
|
||||
|
||||
filename = line;
|
||||
|
||||
if ((ptr = strchr(line, ' ')) == NULL)
|
||||
break;
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
*ptr++ = '\0';
|
||||
|
||||
if ((anchor = strrchr(filename, '#')) != NULL)
|
||||
{
|
||||
*anchor++ = '\0';
|
||||
mtime = 0;
|
||||
}
|
||||
else
|
||||
mtime = strtol(ptr, &ptr, 10);
|
||||
|
||||
offset = strtoll(ptr, &ptr, 10);
|
||||
length = strtoll(ptr, &ptr, 10);
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
ptr ++;
|
||||
|
||||
if (!anchor)
|
||||
{
|
||||
/*
|
||||
* Get section...
|
||||
*/
|
||||
|
||||
if (*ptr != '\"')
|
||||
break;
|
||||
|
||||
ptr ++;
|
||||
sectptr = ptr;
|
||||
|
||||
while (*ptr && *ptr != '\"')
|
||||
ptr ++;
|
||||
|
||||
if (*ptr != '\"')
|
||||
break;
|
||||
|
||||
*ptr++ = '\0';
|
||||
|
||||
strlcpy(section, sectptr, sizeof(section));
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
ptr ++;
|
||||
}
|
||||
|
||||
if (*ptr != '\"')
|
||||
break;
|
||||
|
||||
ptr ++;
|
||||
text = ptr;
|
||||
|
||||
while (*ptr && *ptr != '\"')
|
||||
ptr ++;
|
||||
|
||||
if (*ptr != '\"')
|
||||
break;
|
||||
|
||||
*ptr++ = '\0';
|
||||
|
||||
if ((node = help_new_node(filename, anchor, section, text,
|
||||
mtime, offset, length)) == NULL)
|
||||
break;
|
||||
|
||||
node->score = -1;
|
||||
|
||||
cupsArrayAdd(hi->nodes, node);
|
||||
}
|
||||
}
|
||||
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan for new/updated files...
|
||||
*/
|
||||
|
||||
update = help_load_directory(hi, directory, NULL);
|
||||
|
||||
/*
|
||||
* Remove any files that are no longer installed...
|
||||
*/
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
if (node->score < 0)
|
||||
{
|
||||
/*
|
||||
* Delete this node...
|
||||
*/
|
||||
|
||||
cupsArrayRemove(hi->nodes, node);
|
||||
help_delete_node(node);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add nodes to the sorted array...
|
||||
*/
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
cupsArrayAdd(hi->sorted, node);
|
||||
|
||||
/*
|
||||
* Save the index if we updated it...
|
||||
*/
|
||||
|
||||
if (update)
|
||||
helpSaveIndex(hi, hifile);
|
||||
|
||||
/*
|
||||
* Return the index...
|
||||
*/
|
||||
|
||||
return (hi);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'helpSaveIndex()' - Save a help index to disk.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
helpSaveIndex(help_index_t *hi, /* I - Index */
|
||||
const char *hifile) /* I - Index filename */
|
||||
{
|
||||
cups_file_t *fp; /* Index file */
|
||||
help_node_t *node; /* Current node */
|
||||
|
||||
|
||||
DEBUG_printf(("helpSaveIndex(hi=%p, hifile=\"%s\")\n", hi, hifile));
|
||||
|
||||
/*
|
||||
* Try creating a new index file...
|
||||
*/
|
||||
|
||||
if ((fp = cupsFileOpen(hifile, "w9")) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Lock the file while we write it...
|
||||
*/
|
||||
|
||||
cupsFileLock(fp, 1);
|
||||
|
||||
cupsFilePuts(fp, "HELPV1\n");
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
{
|
||||
/*
|
||||
* Write the current node with/without the anchor...
|
||||
*/
|
||||
|
||||
if (node->anchor)
|
||||
{
|
||||
if (cupsFilePrintf(fp, "%s#%s " CUPS_LLFMT " " CUPS_LLFMT " \"%s\"\n",
|
||||
node->filename, node->anchor,
|
||||
CUPS_LLCAST node->offset, CUPS_LLCAST node->length,
|
||||
node->text) < 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cupsFilePrintf(fp, "%s %d " CUPS_LLFMT " " CUPS_LLFMT " \"%s\" \"%s\"\n",
|
||||
node->filename, node->mtime,
|
||||
CUPS_LLCAST node->offset, CUPS_LLCAST node->length,
|
||||
node->section ? node->section : "", node->text) < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cupsFileFlush(fp);
|
||||
|
||||
if (cupsFileClose(fp) < 0)
|
||||
return (-1);
|
||||
else if (node)
|
||||
return (-1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'helpSearchIndex()' - Search an index.
|
||||
*/
|
||||
|
||||
help_index_t * /* O - Search index */
|
||||
helpSearchIndex(help_index_t *hi, /* I - Index */
|
||||
const char *query, /* I - Query string */
|
||||
const char *section, /* I - Limit search to this section */
|
||||
const char *filename) /* I - Limit search to this file */
|
||||
{
|
||||
help_index_t *search; /* Search index */
|
||||
help_node_t *node; /* Current node */
|
||||
void *sc; /* Search context */
|
||||
int matches; /* Number of matches */
|
||||
|
||||
|
||||
DEBUG_printf(("helpSearchIndex(hi=%p, query=\"%s\", filename=\"%s\")\n",
|
||||
hi, query ? query : "(nil)",
|
||||
filename ? filename : "(nil)"));
|
||||
|
||||
/*
|
||||
* Range check...
|
||||
*/
|
||||
|
||||
if (!hi || !query)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Reset the scores of all nodes to 0...
|
||||
*/
|
||||
|
||||
for (node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
node;
|
||||
node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
node->score = 0;
|
||||
|
||||
/*
|
||||
* Find the first node to search in...
|
||||
*/
|
||||
|
||||
if (filename)
|
||||
{
|
||||
node = helpFindNode(hi, filename, NULL);
|
||||
if (!node)
|
||||
return (NULL);
|
||||
}
|
||||
else
|
||||
node = (help_node_t *)cupsArrayFirst(hi->nodes);
|
||||
|
||||
/*
|
||||
* Convert the query into a regular expression...
|
||||
*/
|
||||
|
||||
sc = cgiCompileSearch(query);
|
||||
if (!sc)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Allocate a search index...
|
||||
*/
|
||||
|
||||
search = calloc(1, sizeof(help_index_t));
|
||||
if (!search)
|
||||
{
|
||||
cgiFreeSearch(sc);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
search->nodes = cupsArrayNew((cups_array_func_t)help_sort_by_name, NULL);
|
||||
search->sorted = cupsArrayNew((cups_array_func_t)help_sort_by_score, NULL);
|
||||
|
||||
if (!search->nodes || !search->sorted)
|
||||
{
|
||||
cupsArrayDelete(search->nodes);
|
||||
cupsArrayDelete(search->sorted);
|
||||
free(search);
|
||||
cgiFreeSearch(sc);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
search->search = 1;
|
||||
|
||||
/*
|
||||
* Check each node in the index, adding matching nodes to the
|
||||
* search index...
|
||||
*/
|
||||
|
||||
for (; node; node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
if (section && strcmp(node->section, section))
|
||||
continue;
|
||||
else if (filename && strcmp(node->filename, filename))
|
||||
continue;
|
||||
else if ((matches = cgiDoSearch(sc, node->text)) > 0)
|
||||
{
|
||||
/*
|
||||
* Found a match, add the node to the search index...
|
||||
*/
|
||||
|
||||
node->score = matches;
|
||||
|
||||
cupsArrayAdd(search->nodes, node);
|
||||
cupsArrayAdd(search->sorted, node);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the search context...
|
||||
*/
|
||||
|
||||
cgiFreeSearch(sc);
|
||||
|
||||
/*
|
||||
* Return the results...
|
||||
*/
|
||||
|
||||
return (search);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'help_delete_node()' - Free all memory used by a node.
|
||||
*/
|
||||
|
||||
static void
|
||||
help_delete_node(help_node_t *n) /* I - Node */
|
||||
{
|
||||
DEBUG_printf(("help_delete_node(n=%p)\n", n));
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (n->filename)
|
||||
free(n->filename);
|
||||
|
||||
if (n->anchor)
|
||||
free(n->anchor);
|
||||
|
||||
if (n->section)
|
||||
free(n->section);
|
||||
|
||||
if (n->text)
|
||||
free(n->text);
|
||||
|
||||
free(n);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'help_load_directory()' - Load a directory of files into an index.
|
||||
*/
|
||||
|
||||
static int /* O - 0 = success, -1 = error, 1 = updated */
|
||||
help_load_directory(
|
||||
help_index_t *hi, /* I - Index */
|
||||
const char *directory, /* I - Directory */
|
||||
const char *relative) /* I - Relative path */
|
||||
{
|
||||
cups_dir_t *dir; /* Directory file */
|
||||
cups_dentry_t *dent; /* Directory entry */
|
||||
char *ext, /* Pointer to extension */
|
||||
filename[1024], /* Full filename */
|
||||
relname[1024]; /* Relative filename */
|
||||
int update; /* Updated? */
|
||||
help_node_t *node; /* Current node */
|
||||
|
||||
|
||||
DEBUG_printf(("help_load_directory(hi=%p, directory=\"%s\", relative=\"%s\")\n",
|
||||
hi, directory ? directory : "(nil)", relative ? relative : "(nil)"));
|
||||
|
||||
/*
|
||||
* Open the directory and scan it...
|
||||
*/
|
||||
|
||||
if ((dir = cupsDirOpen(directory)) == NULL)
|
||||
return (0);
|
||||
|
||||
update = 0;
|
||||
|
||||
while ((dent = cupsDirRead(dir)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Skip "." files...
|
||||
*/
|
||||
|
||||
if (dent->filename[0] == '.')
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Get absolute and relative filenames...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s", directory, dent->filename);
|
||||
if (relative)
|
||||
snprintf(relname, sizeof(relname), "%s/%s", relative, dent->filename);
|
||||
else
|
||||
strlcpy(relname, dent->filename, sizeof(relname));
|
||||
|
||||
/*
|
||||
* Check if we have a HTML file...
|
||||
*/
|
||||
|
||||
if ((ext = strstr(dent->filename, ".html")) != NULL &&
|
||||
(!ext[5] || !strcmp(ext + 5, ".gz")))
|
||||
{
|
||||
/*
|
||||
* HTML file, see if we have already indexed the file...
|
||||
*/
|
||||
|
||||
if ((node = helpFindNode(hi, relname, NULL)) != NULL)
|
||||
{
|
||||
/*
|
||||
* File already indexed - check dates to confirm that the
|
||||
* index is up-to-date...
|
||||
*/
|
||||
|
||||
if (node->mtime == dent->fileinfo.st_mtime)
|
||||
{
|
||||
/*
|
||||
* Same modification time, so mark all of the nodes
|
||||
* for this file as up-to-date...
|
||||
*/
|
||||
|
||||
for (; node; node = (help_node_t *)cupsArrayNext(hi->nodes))
|
||||
if (!strcmp(node->filename, relname))
|
||||
node->score = 0;
|
||||
else
|
||||
break;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
update = 1;
|
||||
|
||||
help_load_file(hi, filename, relname, dent->fileinfo.st_mtime);
|
||||
}
|
||||
else if (S_ISDIR(dent->fileinfo.st_mode))
|
||||
{
|
||||
/*
|
||||
* Process sub-directory...
|
||||
*/
|
||||
|
||||
if (help_load_directory(hi, filename, relname) == 1)
|
||||
update = 1;
|
||||
}
|
||||
}
|
||||
|
||||
cupsDirClose(dir);
|
||||
|
||||
return (update);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'help_load_file()' - Load a HTML files into an index.
|
||||
*/
|
||||
|
||||
static int /* O - 0 = success, -1 = error */
|
||||
help_load_file(
|
||||
help_index_t *hi, /* I - Index */
|
||||
const char *filename, /* I - Filename */
|
||||
const char *relative, /* I - Relative path */
|
||||
time_t mtime) /* I - Modification time */
|
||||
{
|
||||
cups_file_t *fp; /* HTML file */
|
||||
help_node_t *node; /* Current node */
|
||||
char line[1024], /* Line from file */
|
||||
section[1024], /* Section */
|
||||
*ptr, /* Pointer into line */
|
||||
*anchor, /* Anchor name */
|
||||
*text; /* Text for anchor */
|
||||
off_t offset; /* File offset */
|
||||
char quote; /* Quote character */
|
||||
|
||||
|
||||
DEBUG_printf(("help_load_file(hi=%p, filename=\"%s\", relative=\"%s\", mtime=%ld)\n",
|
||||
hi, filename ? filename : "(nil)",
|
||||
relative ? relative : "(nil)", mtime));
|
||||
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
return (-1);
|
||||
|
||||
node = NULL;
|
||||
offset = 0;
|
||||
|
||||
strcpy(section, "Other");
|
||||
|
||||
while (cupsFileGets(fp, line, sizeof(line)))
|
||||
{
|
||||
/*
|
||||
* Look for "<TITLE>", "<A NAME", or "<!-- SECTION:" prefix...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(line, "<!-- SECTION:", 13))
|
||||
{
|
||||
/*
|
||||
* Got section line, copy it!
|
||||
*/
|
||||
|
||||
for (ptr = line + 13; isspace(*ptr & 255); ptr ++);
|
||||
|
||||
strlcpy(section, ptr, sizeof(section));
|
||||
if ((ptr = strstr(section, "-->")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Strip comment stuff from end of line...
|
||||
*/
|
||||
|
||||
for (*ptr-- = '\0'; ptr > line && isspace(*ptr & 255); *ptr-- = '\0');
|
||||
|
||||
if (isspace(*ptr & 255))
|
||||
*ptr = '\0';
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ptr = line; (ptr = strchr(ptr, '<')) != NULL;)
|
||||
{
|
||||
ptr ++;
|
||||
|
||||
if (!strncasecmp(ptr, "TITLE>", 6))
|
||||
{
|
||||
/*
|
||||
* Found the title...
|
||||
*/
|
||||
|
||||
anchor = NULL;
|
||||
ptr += 6;
|
||||
}
|
||||
else if (!strncasecmp(ptr, "A NAME=", 7))
|
||||
{
|
||||
/*
|
||||
* Found an anchor...
|
||||
*/
|
||||
|
||||
ptr += 7;
|
||||
|
||||
if (*ptr == '\"' || *ptr == '\'')
|
||||
{
|
||||
/*
|
||||
* Get quoted anchor...
|
||||
*/
|
||||
|
||||
quote = *ptr;
|
||||
anchor = ptr + 1;
|
||||
if ((ptr = strchr(anchor, quote)) != NULL)
|
||||
*ptr++ = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Get unquoted anchor...
|
||||
*/
|
||||
|
||||
anchor = ptr + 1;
|
||||
|
||||
for (ptr = anchor; *ptr && *ptr != '>' && !isspace(*ptr & 255); ptr ++);
|
||||
|
||||
if (*ptr)
|
||||
*ptr++ = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Got the anchor, now lets find the end...
|
||||
*/
|
||||
|
||||
while (*ptr && *ptr != '>')
|
||||
ptr ++;
|
||||
|
||||
if (*ptr != '>')
|
||||
break;
|
||||
|
||||
ptr ++;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Now collect text for the link...
|
||||
*/
|
||||
|
||||
text = ptr;
|
||||
while ((ptr = strchr(text, '<')) == NULL)
|
||||
{
|
||||
ptr = text + strlen(text);
|
||||
if (ptr >= (line + sizeof(line) - 2))
|
||||
break;
|
||||
|
||||
*ptr++ = ' ';
|
||||
|
||||
if (!cupsFileGets(fp, ptr, sizeof(line) - (ptr - line) - 1))
|
||||
break;
|
||||
}
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
if (node)
|
||||
node->length = offset - node->offset;
|
||||
|
||||
if (!*text)
|
||||
{
|
||||
node = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((node = helpFindNode(hi, relative, anchor)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Node already in the index, so replace the text and other
|
||||
* data...
|
||||
*/
|
||||
|
||||
cupsArrayRemove(hi->nodes, node);
|
||||
|
||||
if (node->section)
|
||||
free(node->section);
|
||||
|
||||
if (node->text)
|
||||
free(node->text);
|
||||
|
||||
node->section = section[0] ? strdup(section) : NULL;
|
||||
node->text = strdup(text);
|
||||
node->mtime = mtime;
|
||||
node->offset = offset;
|
||||
node->score = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* New node...
|
||||
*/
|
||||
|
||||
node = help_new_node(relative, anchor, section, text, mtime, offset, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Go through the text value and replace tabs and newlines with
|
||||
* whitespace and eliminate extra whitespace...
|
||||
*/
|
||||
|
||||
for (ptr = node->text, text = node->text; *ptr;)
|
||||
if (isspace(*ptr & 255))
|
||||
{
|
||||
while (isspace(*ptr & 255))
|
||||
*ptr ++;
|
||||
|
||||
*text++ = ' ';
|
||||
}
|
||||
else if (text != ptr)
|
||||
*text++ = *ptr++;
|
||||
else
|
||||
{
|
||||
text ++;
|
||||
ptr ++;
|
||||
}
|
||||
|
||||
*text = '\0';
|
||||
|
||||
/*
|
||||
* (Re)add the node to the array...
|
||||
*/
|
||||
|
||||
cupsArrayAdd(hi->nodes, node);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the offset of the next line...
|
||||
*/
|
||||
|
||||
offset = cupsFileTell(fp);
|
||||
}
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
if (node)
|
||||
node->length = offset - node->offset;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'help_new_node()' - Create a new node and add it to an index.
|
||||
*/
|
||||
|
||||
static help_node_t * /* O - Node pointer or NULL on error */
|
||||
help_new_node(const char *filename, /* I - Filename */
|
||||
const char *anchor, /* I - Anchor */
|
||||
const char *section, /* I - Section */
|
||||
const char *text, /* I - Text */
|
||||
time_t mtime, /* I - Modification time */
|
||||
off_t offset, /* I - Offset in file */
|
||||
size_t length) /* I - Length in bytes */
|
||||
{
|
||||
help_node_t *n; /* Node */
|
||||
|
||||
|
||||
DEBUG_printf(("help_new_node(filename=\"%s\", anchor=\"%s\", text=\"%s\", "
|
||||
"mtime=%ld, offset=%ld, length=%ld)\n",
|
||||
filename ? filename : "(nil)", anchor ? anchor : "(nil)",
|
||||
text ? text : "(nil)", (long)mtime, (long)offset,
|
||||
(long)length));
|
||||
|
||||
n = (help_node_t *)calloc(1, sizeof(help_node_t));
|
||||
if (!n)
|
||||
return (NULL);
|
||||
|
||||
n->filename = strdup(filename);
|
||||
n->anchor = anchor ? strdup(anchor) : NULL;
|
||||
n->section = (section && *section) ? strdup(section) : NULL;
|
||||
n->text = strdup(text);
|
||||
n->mtime = mtime;
|
||||
n->offset = offset;
|
||||
n->length = length;
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'help_sort_nodes_by_name()' - Sort nodes by section, filename, and anchor.
|
||||
*/
|
||||
|
||||
static int /* O - Difference */
|
||||
help_sort_by_name(help_node_t *n1, /* I - First node */
|
||||
help_node_t *n2) /* I - Second node */
|
||||
{
|
||||
int diff; /* Difference */
|
||||
|
||||
|
||||
DEBUG_printf(("help_sort_by_name(n1=%p(%s#%s), n2=%p(%s#%s)\n",
|
||||
n1, n1->filename, n1->anchor ? n1->anchor : "",
|
||||
n2, n2->filename, n2->anchor ? n2->anchor : ""));
|
||||
|
||||
if ((diff = strcmp(n1->filename, n2->filename)) != 0)
|
||||
return (diff);
|
||||
|
||||
if (!n1->anchor && !n2->anchor)
|
||||
return (0);
|
||||
else if (!n1->anchor)
|
||||
return (-1);
|
||||
else if (!n2->anchor)
|
||||
return (1);
|
||||
else
|
||||
return (strcmp(n1->anchor, n2->anchor));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'help_sort_nodes_by_score()' - Sort nodes by score and text.
|
||||
*/
|
||||
|
||||
static int /* O - Difference */
|
||||
help_sort_by_score(help_node_t *n1, /* I - First node */
|
||||
help_node_t *n2) /* I - Second node */
|
||||
{
|
||||
int diff; /* Difference */
|
||||
|
||||
|
||||
DEBUG_printf(("help_sort_by_score(n1=%p(%d \"%s\" \"%s\"), "
|
||||
"n2=%p(%d \"%s\" \"%s\")\n",
|
||||
n1, n1->score, n1->section ? n1->section : "", n1->text,
|
||||
n2, n2->score, n2->section ? n2->section : "", n2->text));
|
||||
|
||||
if (n1->score != n2->score)
|
||||
return (n1->score - n2->score);
|
||||
|
||||
if (n1->section && !n2->section)
|
||||
return (1);
|
||||
else if (!n1->section && n2->section)
|
||||
return (-1);
|
||||
else if (n1->section && n2->section &&
|
||||
(diff = strcmp(n1->section, n2->section)) != 0)
|
||||
return (diff);
|
||||
|
||||
return (strcasecmp(n1->text, n2->text));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* On-line help index definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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 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 */
|
||||
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 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,386 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* On-line help CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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(_("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(_("Help")));
|
||||
cgiSetVariable("ERROR", "Unable to access help file!");
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("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);
|
||||
|
||||
/*
|
||||
* 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(_("Help")));
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a search as needed...
|
||||
*/
|
||||
|
||||
query = cgiGetVariable("QUERY");
|
||||
topic = cgiGetVariable("TOPIC");
|
||||
si = helpSearchIndex(hi, query, topic, helpfile);
|
||||
|
||||
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n", query, topic);
|
||||
|
||||
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)
|
||||
cgiEndHTML();
|
||||
else
|
||||
puts("</BODY>\n</HTML>");
|
||||
|
||||
/*
|
||||
* Delete the index...
|
||||
*/
|
||||
|
||||
helpDeleteIndex(hi);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTML support functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cgiEndHTML() - End a HTML page.
|
||||
* cgiFormEncode() - Encode a string as a form variable...
|
||||
* cgiStartHTML() - Start a HTML page.
|
||||
* cgi_null_passwd() - Return a NULL password for authentication.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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...
|
||||
*/
|
||||
|
||||
puts("Content-Type: text/html;charset=utf-8\n");
|
||||
|
||||
/*
|
||||
* Send a standard header...
|
||||
*/
|
||||
|
||||
cgiSetVariable("TITLE", title);
|
||||
cgiSetServerVersion();
|
||||
|
||||
cgiCopyTemplateLang("header.tmpl");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
-1281
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Job status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
* do_job_op() - Do a job operation.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void do_job_op(http_t *http, int job_id, ipp_op_t op);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(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 */
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
cgiInitialize();
|
||||
|
||||
/*
|
||||
* Set the web interface section...
|
||||
*/
|
||||
|
||||
cgiSetVariable("SECTION", "jobs");
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
/*
|
||||
* Get the job ID, if any...
|
||||
*/
|
||||
|
||||
if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL)
|
||||
job_id = atoi(job_id_var);
|
||||
else
|
||||
job_id = 0;
|
||||
|
||||
/*
|
||||
* Do the operation...
|
||||
*/
|
||||
|
||||
if ((op = cgiGetVariable("OP")) != NULL && job_id > 0)
|
||||
{
|
||||
/*
|
||||
* Do the operation...
|
||||
*/
|
||||
|
||||
if (!strcmp(op, "cancel-job"))
|
||||
do_job_op(http, job_id, IPP_CANCEL_JOB);
|
||||
else if (!strcmp(op, "hold-job"))
|
||||
do_job_op(http, job_id, IPP_HOLD_JOB);
|
||||
else if (!strcmp(op, "move-job"))
|
||||
cgiMoveJobs(http, NULL, job_id);
|
||||
else if (!strcmp(op, "release-job"))
|
||||
do_job_op(http, job_id, IPP_RELEASE_JOB);
|
||||
else if (!strcmp(op, "restart-job"))
|
||||
do_job_op(http, job_id, IPP_RESTART_JOB);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Bad operation code... Display an error...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show a list of jobs...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
cgiShowJobs(http, NULL);
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'do_job_op()' - Do a job operation.
|
||||
*/
|
||||
|
||||
static void
|
||||
do_job_op(http_t *http, /* I - HTTP connection */
|
||||
int job_id, /* I - Job ID */
|
||||
ipp_op_t op) /* I - Operation to perform */
|
||||
{
|
||||
ipp_t *request; /* IPP request */
|
||||
char uri[HTTP_MAX_URI]; /* Job URI */
|
||||
const char *user; /* Username */
|
||||
|
||||
|
||||
/*
|
||||
* Build a job request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* job-uri or printer-uri (purge-jobs)
|
||||
* requesting-user-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(op);
|
||||
|
||||
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
|
||||
NULL, uri);
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/jobs"));
|
||||
|
||||
cgiStartHTML(cgiText(_("Jobs")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Job operation failed:"));
|
||||
else if (op == IPP_CANCEL_JOB)
|
||||
cgiCopyTemplateLang("job-cancel.tmpl");
|
||||
else if (op == IPP_HOLD_JOB)
|
||||
cgiCopyTemplateLang("job-hold.tmpl");
|
||||
else if (op == IPP_RELEASE_JOB)
|
||||
cgiCopyTemplateLang("job-release.tmpl");
|
||||
else if (op == IPP_RESTART_JOB)
|
||||
cgiCopyTemplateLang("job-restart.tmpl");
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
Arquivo binário não exibido.
@@ -1,642 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Printer status CGI for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for CGI.
|
||||
* print_command() - Send a print command to the printer.
|
||||
* show_all_printers() - Show all printers...
|
||||
* show_printer() - Show a single printer.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cgi-private.h"
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
void print_command(http_t *http, const char *printer, const char *command);
|
||||
void show_all_printers(http_t *http, const char *username);
|
||||
void show_printer(http_t *http, const char *printer);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for CGI.
|
||||
*/
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Get any form variables...
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
/*
|
||||
* Connect to the HTTP server...
|
||||
*/
|
||||
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
|
||||
|
||||
/*
|
||||
* Get the default printer...
|
||||
*/
|
||||
|
||||
if (!op)
|
||||
{
|
||||
/*
|
||||
* Get the default destination...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEFAULT);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes",
|
||||
sizeof(def_attrs) / sizeof(def_attrs[0]), NULL, def_attrs);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(response, "printer-name", IPP_TAG_NAME)) != NULL)
|
||||
cgiSetVariable("DEFAULT_NAME", attr->values[0].string.text);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
char url[HTTP_MAX_URI]; /* New URL */
|
||||
|
||||
|
||||
cgiSetVariable("DEFAULT_URI",
|
||||
cgiRewriteURL(attr->values[0].string.text,
|
||||
url, sizeof(url), NULL));
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we need to show a list of printers or the status of a
|
||||
* single printer...
|
||||
*/
|
||||
|
||||
if (!printer)
|
||||
show_all_printers(http, user);
|
||||
else
|
||||
show_printer(http, printer);
|
||||
}
|
||||
else if (!strcasecmp(op, "print-self-test-page") && printer)
|
||||
print_command(http, printer, "PrintSelfTestPage");
|
||||
else if (!strcasecmp(op, "clean-print-heads") && printer)
|
||||
print_command(http, printer, "Clean all");
|
||||
else if (!strcasecmp(op, "print-test-page") && printer)
|
||||
cgiPrintTestPage(http, printer);
|
||||
else if (!strcasecmp(op, "move-jobs") && printer)
|
||||
cgiMoveJobs(http, printer, 0);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Unknown/bad operation...
|
||||
*/
|
||||
|
||||
if (printer)
|
||||
cgiStartHTML(printer);
|
||||
else
|
||||
cgiStartHTML(cgiText(_("Printers")));
|
||||
|
||||
cgiCopyTemplateLang("error-op.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the HTTP server connection...
|
||||
*/
|
||||
|
||||
httpClose(http);
|
||||
|
||||
/*
|
||||
* Return with no errors...
|
||||
*/
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'print_command()' - Send a print command to the printer.
|
||||
*/
|
||||
|
||||
void
|
||||
print_command(http_t *http, /* I - Connection to server */
|
||||
const char *printer, /* I - Printer */
|
||||
const char *command) /* I - Command to send */
|
||||
{
|
||||
cups_file_t *fp; /* File pointer */
|
||||
char filename[1024]; /* Temporary file */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
char uri[HTTP_MAX_URI], /* Printer URI */
|
||||
resource[1024], /* POST resource path */
|
||||
refresh[1024]; /* Refresh URL */
|
||||
const char *user; /* Username */
|
||||
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
*/
|
||||
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
user = "guest";
|
||||
|
||||
/*
|
||||
* Create the CUPS command file to print...
|
||||
*/
|
||||
|
||||
if ((fp = cupsTempFile2(filename, sizeof(filename))) == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Printer Maintenance")));
|
||||
cgiSetVariable("MESSAGE", _("Unable to create temporary file:"));
|
||||
cgiSetVariable("ERROR", strerror(errno));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
return;
|
||||
}
|
||||
|
||||
cupsFilePuts(fp, "#CUPS-COMMAND\n");
|
||||
cupsFilePrintf(fp, "%s\n", command);
|
||||
cupsFileClose(fp);
|
||||
|
||||
/*
|
||||
* Point to the printer...
|
||||
*/
|
||||
|
||||
snprintf(resource, sizeof(resource), "/printers/%s", printer);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", ippPort(), "/printers/%s", printer);
|
||||
|
||||
/*
|
||||
* Build an IPP_PRINT_JOB request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* requesting-user-name
|
||||
* document-format
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_PRINT_JOB);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, uri);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
|
||||
NULL, "Printer Maintenance");
|
||||
|
||||
ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
|
||||
NULL, "application/postscript");
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoFileRequest(http, request, resource,
|
||||
filename)) != NULL)
|
||||
{
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
unlink(filename);
|
||||
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
{
|
||||
/*
|
||||
* Automatically reload the printer status page...
|
||||
*/
|
||||
|
||||
cgiFormEncode(uri, resource, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "2;%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
|
||||
cgiStartHTML(cgiText(_("Printer Maintenance")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to send maintenance job:"));
|
||||
else
|
||||
{
|
||||
cgiSetVariable("PRINTER_NAME", printer);
|
||||
|
||||
cgiCopyTemplateLang("maintenance.tmpl");
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_all_printers()' - Show all printers...
|
||||
*/
|
||||
|
||||
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 */
|
||||
*attr; /* Current attribute */
|
||||
int ascending, /* Order of printers (0 = descending) */
|
||||
first, /* First printer to show */
|
||||
count; /* Number of printers */
|
||||
const char *var; /* Form variable */
|
||||
void *search; /* Search data */
|
||||
char url[1024], /* URL for prev/next/this */
|
||||
*urlptr, /* Position in URL */
|
||||
*urlend; /* End of URL */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
|
||||
http, user);
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Printers")));
|
||||
|
||||
/*
|
||||
* Build a CUPS_GET_PRINTERS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-type
|
||||
* printer-type-mask
|
||||
* requesting-user-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_PRINTERS);
|
||||
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
|
||||
"printer-type", 0);
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
|
||||
"printer-type-mask", CUPS_PRINTER_CLASS);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, user);
|
||||
|
||||
cgiGetAttributes(request, "printers.tmpl");
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get a list of matching job objects.
|
||||
*/
|
||||
|
||||
if ((var = cgiGetVariable("QUERY")) != NULL)
|
||||
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(url, "%d", count);
|
||||
cgiSetVariable("TOTAL", url);
|
||||
|
||||
if ((var = cgiGetVariable("ORDER")) != NULL)
|
||||
ascending = !strcasecmp(var, "asc");
|
||||
else
|
||||
ascending = 1;
|
||||
|
||||
if (ascending)
|
||||
{
|
||||
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, first);
|
||||
i < CUPS_PAGE_MAX && printer;
|
||||
i ++, printer = (ipp_attribute_t *)cupsArrayNext(printers))
|
||||
{
|
||||
cgiSetIPPObjectVars(printer, NULL, i);
|
||||
|
||||
cgiSetArray("cupscommand", i, "0");
|
||||
|
||||
for (attr = printer; attr; attr = attr->next)
|
||||
if (attr->group_tag != IPP_TAG_PRINTER || !attr->name)
|
||||
break;
|
||||
else if (!strcmp(attr->name, "printer-type"))
|
||||
{
|
||||
if (attr->values[0].integer & CUPS_PRINTER_COMMANDS)
|
||||
cgiSetArray("cupscommand", i, "1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, count - first - 1);
|
||||
i < CUPS_PAGE_MAX && printer;
|
||||
i ++, printer = (ipp_attribute_t *)cupsArrayPrev(printers))
|
||||
{
|
||||
cgiSetIPPObjectVars(printer, NULL, i);
|
||||
|
||||
cgiSetArray("cupscommand", i, "0");
|
||||
|
||||
for (attr = printer; attr; attr = attr->next)
|
||||
if (attr->group_tag == IPP_TAG_ZERO || !attr->name)
|
||||
break;
|
||||
else if (!strcmp(attr->name, "printer-type"))
|
||||
{
|
||||
if (attr->values[0].integer & CUPS_PRINTER_COMMANDS)
|
||||
cgiSetArray("cupscommand", i, "1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Save navigation URLs...
|
||||
*/
|
||||
|
||||
urlend = url + sizeof(url);
|
||||
|
||||
if ((var = cgiGetVariable("QUERY")) != NULL)
|
||||
{
|
||||
strlcpy(url, "/printers/?QUERY=", sizeof(url));
|
||||
urlptr = url + strlen(url);
|
||||
|
||||
cgiFormEncode(urlptr, var, urlend - urlptr);
|
||||
urlptr += strlen(urlptr);
|
||||
|
||||
strlcpy(urlptr, "&", urlend - urlptr);
|
||||
urlptr += strlen(urlptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(url, "/printers/?", sizeof(url));
|
||||
urlptr = url + strlen(url);
|
||||
}
|
||||
|
||||
snprintf(urlptr, urlend - urlptr, "FIRST=%d", first);
|
||||
cgiSetVariable("THISURL", url);
|
||||
|
||||
if (first > 0)
|
||||
{
|
||||
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
|
||||
first - CUPS_PAGE_MAX, ascending ? "asc" : "dec");
|
||||
cgiSetVariable("PREVURL", url);
|
||||
}
|
||||
|
||||
if ((first + CUPS_PAGE_MAX) < count)
|
||||
{
|
||||
snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s",
|
||||
first + CUPS_PAGE_MAX, ascending ? "asc" : "dec");
|
||||
cgiSetVariable("NEXTURL", url);
|
||||
}
|
||||
|
||||
/*
|
||||
* Then show everything...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("search.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("printers-header.tmpl");
|
||||
|
||||
if (count > 0)
|
||||
cgiCopyTemplateLang("pager.tmpl");
|
||||
|
||||
cgiCopyTemplateLang("printers.tmpl");
|
||||
|
||||
if (count > 0)
|
||||
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.
|
||||
*/
|
||||
|
||||
void
|
||||
show_printer(http_t *http, /* I - Connection to server */
|
||||
const char *printer) /* I - Name of printer */
|
||||
{
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
char uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
char refresh[1024]; /* Refresh URL */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: show_printer(http=%p, printer=\"%s\")\n",
|
||||
http, printer);
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
|
||||
uri);
|
||||
|
||||
cgiGetAttributes(request, "printers.tmpl");
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got the result; set the CGI variables and check the status of a
|
||||
* single-queue request...
|
||||
*/
|
||||
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
if ((attr = ippFindAttribute(response, "printer-type",
|
||||
IPP_TAG_ENUM)) != NULL)
|
||||
{
|
||||
cgiSetVariable("cupscommand",
|
||||
(attr->values[0].integer & CUPS_PRINTER_COMMANDS) ?
|
||||
"1" : "0");
|
||||
}
|
||||
|
||||
if (printer && (attr = ippFindAttribute(response, "printer-state",
|
||||
IPP_TAG_ENUM)) != NULL &&
|
||||
attr->values[0].integer == IPP_PRINTER_PROCESSING)
|
||||
{
|
||||
/*
|
||||
* Printer is processing - automatically refresh the page until we
|
||||
* are done printing...
|
||||
*/
|
||||
|
||||
cgiFormEncode(uri, printer, sizeof(uri));
|
||||
snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri);
|
||||
cgiSetVariable("refresh_page", refresh);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
/*
|
||||
* Show the standard header...
|
||||
*/
|
||||
|
||||
cgiStartHTML(printer);
|
||||
|
||||
/*
|
||||
* Show the printer status...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("printers.tmpl");
|
||||
|
||||
/*
|
||||
* Show jobs for the specified printer...
|
||||
*/
|
||||
|
||||
cgiCopyTemplateLang("printer-jobs-header.tmpl");
|
||||
cgiShowJobs(http, printer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Show the IPP error...
|
||||
*/
|
||||
|
||||
cgiStartHTML(printer);
|
||||
cgiShowIPPError(_("Unable to get printer status:"));
|
||||
}
|
||||
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,368 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Search routines for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2005 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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(("help_compile_search(query=\"%s\")\n", query ? query : "(nil)"));
|
||||
|
||||
/*
|
||||
* Allocate a regular expression storage structure...
|
||||
*/
|
||||
|
||||
re = (regex_t *)calloc(1, sizeof(regex_t));
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
s = (char *)malloc(slen);
|
||||
|
||||
/*
|
||||
* 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) + 4 * wlen + 2 * strlen(prefix) + 4;
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
/*
|
||||
* For "word1 AND word2", add reciprocal "word2 AND word1"...
|
||||
*/
|
||||
|
||||
if (!strcmp(prefix, ".*") && lword)
|
||||
{
|
||||
char *lword2; /* New "last word" */
|
||||
|
||||
|
||||
lword2 = strdup(sword);
|
||||
|
||||
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,642 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI template function.
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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>
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
/*
|
||||
* '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, "DEBUG: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
|
||||
tmpl);
|
||||
|
||||
/*
|
||||
* Open the template file...
|
||||
*/
|
||||
|
||||
if ((in = fopen(tmpl, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
|
||||
tmpl, 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 */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char filename[1024], /* Filename */
|
||||
locale[16]; /* Locale name */
|
||||
const char *directory, /* Directory for templates */
|
||||
*lang; /* Language */
|
||||
FILE *in; /* Input file */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: cgiCopyTemplateLang(tmpl=\"%s\")\n", tmpl);
|
||||
|
||||
/*
|
||||
* Convert the language to a locale name...
|
||||
*/
|
||||
|
||||
if ((lang = getenv("LANG")) != NULL)
|
||||
{
|
||||
for (i = 0; lang[i] && i < 15; i ++)
|
||||
if (isalnum(lang[i] & 255))
|
||||
locale[i] = tolower(lang[i]);
|
||||
else if (lang[i] == '-')
|
||||
locale[i] = '_';
|
||||
else
|
||||
break;
|
||||
|
||||
locale[i] = '\0';
|
||||
}
|
||||
else
|
||||
locale[0] = '\0';
|
||||
|
||||
fprintf(stderr, "DEBUG: locale=\"%s\"...\n", locale);
|
||||
|
||||
/*
|
||||
* See if we have a template file for this language...
|
||||
*/
|
||||
|
||||
directory = cgiGetTemplateDir();
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
|
||||
if (access(filename, 0))
|
||||
{
|
||||
locale[2] = '\0';
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
|
||||
if (access(filename, 0))
|
||||
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Template file is \"%s\"...\n", filename);
|
||||
|
||||
/*
|
||||
* Open the template file...
|
||||
*/
|
||||
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
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 */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: %*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...
|
||||
*/
|
||||
|
||||
for (s = name; (ch = getc(in)) != EOF;)
|
||||
if (strchr("}]<>=! \t\n", ch))
|
||||
break;
|
||||
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, "DEBUG: %*sLone { at %ld...\n", indent, "", ftell(in));
|
||||
|
||||
if (out)
|
||||
{
|
||||
putc('{', out);
|
||||
putc(ch, out);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '}')
|
||||
fprintf(stderr, "DEBUG: %*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, "DEBUG: %*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, "DEBUG: %*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)
|
||||
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
|
||||
*/
|
||||
|
||||
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,
|
||||
"DEBUG: %*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;
|
||||
default :
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"DEBUG: %*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, "DEBUG: %*sOutput first part...\n", indent, "");
|
||||
cgi_copy(out, in, element, ':', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG: %*sSkip second part...\n", indent, "");
|
||||
cgi_copy(NULL, in, element, '}', indent + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Comparison false; ignore first part and output second...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG: %*sSkip first part...\n", indent, "");
|
||||
cgi_copy(NULL, in, element, ':', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG: %*sOutput second part...\n", indent, "");
|
||||
cgi_copy(out, in, element, '}', indent + 2);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: %*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, "DEBUG: %*sReturning at file position %ld on EOF...\n",
|
||||
indent, "", ftell(in));
|
||||
else
|
||||
fprintf(stderr,
|
||||
"DEBUG: %*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 ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2005 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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,118 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Help index test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2005 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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\"\n", i, node->filename, node->anchor,
|
||||
node->text);
|
||||
else
|
||||
printf(" %d: %s \"%s\"\n", i, node->filename, node->text);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,29 +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 first anchor.</P>
|
||||
|
||||
|
||||
<H1><A NAME="2ND">This is the Second Anchor</A></H1>
|
||||
|
||||
<P>This is some text for the first anchor.</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,112 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI template test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: 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$".
|
||||
*/
|
||||
-1024
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
-107
@@ -1,107 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Configuration file makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1993-2006 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 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
#
|
||||
# Config files...
|
||||
#
|
||||
|
||||
KEEP = cupsd.conf
|
||||
REPLACE = mime.convs mime.types
|
||||
|
||||
|
||||
#
|
||||
# Make everything...
|
||||
#
|
||||
|
||||
all:
|
||||
|
||||
|
||||
#
|
||||
# Clean all config and object files...
|
||||
#
|
||||
|
||||
clean:
|
||||
|
||||
|
||||
#
|
||||
# Dummy depend...
|
||||
#
|
||||
|
||||
depend:
|
||||
|
||||
|
||||
#
|
||||
# Install files...
|
||||
#
|
||||
|
||||
install: all
|
||||
$(INSTALL_DIR) -m 755 $(SERVERROOT)
|
||||
for file in $(KEEP); do \
|
||||
if test -r $(SERVERROOT)/$$file ; then \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file.N || true; \
|
||||
else \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
|
||||
fi ; \
|
||||
done
|
||||
$(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
|
||||
-chgrp $(CUPS_GROUP) $(SERVERROOT)/cupsd.conf.default
|
||||
for file in $(REPLACE); do \
|
||||
if test -r $(SERVERROOT)/$$file ; then \
|
||||
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
|
||||
fi ; \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
|
||||
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
|
||||
|
||||
|
||||
#
|
||||
# Uninstall files...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
for file in $(KEEP) $(REPLACE) cupsd.conf.default; do \
|
||||
$(RM) $(SERVERROOT)/$$file; \
|
||||
done
|
||||
-$(RMDIR) $(SERVERROOT)
|
||||
-if test x$(PAMDIR) != x; then \
|
||||
$(RM) $(BUILDROOT)$(PAMDIR)/cups; \
|
||||
$(RMDIR) $(BUILDROOT)$(PAMDIR); \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -1,76 +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 "info" to "debug" for
|
||||
# troubleshooting...
|
||||
LogLevel info
|
||||
|
||||
# Administrator user group...
|
||||
SystemGroup @CUPS_SYSTEM_GROUPS@
|
||||
|
||||
# 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 @LOCAL
|
||||
|
||||
# Default authentication type, when authentication is required...
|
||||
DefaultAuthType Basic
|
||||
|
||||
# Restrict access to the server...
|
||||
<Location />
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
# Restrict access to the admin pages...
|
||||
<Location /admin>
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
# Restrict access to configuration files...
|
||||
<Location /admin/conf>
|
||||
AuthType Basic
|
||||
Require user @SYSTEM
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
# Set the default printer/job policies...
|
||||
<Policy default>
|
||||
# Job-related operations must be done by the owner or an adminstrator...
|
||||
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
|
||||
Require user @OWNER @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# All administration operations require an adminstrator to authenticate...
|
||||
<Limit Pause-Printer Resume-Printer Set-Printer-Attributes 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-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
|
||||
AuthType Basic
|
||||
Require user @SYSTEM
|
||||
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 @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
<Limit All>
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
</Policy>
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -1,119 +0,0 @@
|
||||
#
|
||||
# "$Id: mime.convs 4559 2005-08-04 18:40:13Z mike $"
|
||||
#
|
||||
# MIME converts file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2005 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 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: 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
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Form filter...
|
||||
#
|
||||
# This filter does not currently exist, but the file format is defined
|
||||
# in the IDD and registered with the IANA for future use...
|
||||
#
|
||||
|
||||
#application/vnd.cups-form application/vnd.cups-postscript 33 formtops
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raster filters...
|
||||
#
|
||||
|
||||
image/gif application/vnd.cups-raster 100 imagetoraster
|
||||
image/png application/vnd.cups-raster 100 imagetoraster
|
||||
image/jpeg application/vnd.cups-raster 100 imagetoraster
|
||||
image/tiff application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-bitmap application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-photocd application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
|
||||
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
|
||||
|
||||
# pstoraster is now part of ESP Ghostscript...
|
||||
#application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raw filter...
|
||||
#
|
||||
# Uncomment the following filter and the application/octet-stream type
|
||||
# in mime.types to allow printing of arbitrary files without the -oraw
|
||||
# option.
|
||||
#
|
||||
|
||||
#application/octet-stream application/vnd.cups-raw 0 -
|
||||
|
||||
#
|
||||
# End of "$Id: mime.convs 4559 2005-08-04 18:40:13Z mike $".
|
||||
#
|
||||
@@ -1,169 +0,0 @@
|
||||
#
|
||||
# "$Id: mime.types 4590 2005-08-24 19:25:49Z mike $"
|
||||
#
|
||||
# MIME types file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2005 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 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Format of Lines:
|
||||
#
|
||||
# super/type rules
|
||||
#
|
||||
# "rules" can be any combination of:
|
||||
#
|
||||
# ( expr ) Parenthesis for expression grouping
|
||||
# + Logical AND
|
||||
# , or whitespace Logical OR
|
||||
# ! Logical NOT
|
||||
# match("pattern") Pattern match on filename
|
||||
# extension Pattern match on "*.extension"
|
||||
# ascii(offset,length) True if bytes are valid printable ASCII
|
||||
# (CR, NL, TAB, BS, 32-126)
|
||||
# printable(offset,length) True if bytes are printable 8-bit chars
|
||||
# (CR, NL, TAB, BS, 32-126, 128-254)
|
||||
# string(offset,"string") True if bytes are identical to string
|
||||
# istring(offset,"string") True if bytes are identical to
|
||||
# case-insensitive string
|
||||
# char(offset,value) True if byte is identical
|
||||
# short(offset,value) True if 16-bit integer is identical
|
||||
# int(offset,value) True if 32-bit integer is identical
|
||||
# locale("string") True if current locale matches string
|
||||
# contains(offset,range,"string") True if the range contains the string
|
||||
#
|
||||
# General Notes:
|
||||
#
|
||||
# MIME type names are case-insensitive. Internally they are converted
|
||||
# to lowercase. Multiple occurrences of a type will cause the provided
|
||||
# rules to be appended to the existing definition. Type names are sorted
|
||||
# in ascending order, so if two types use the same rules to resolve a type
|
||||
# (e.g. doc extension for two types), the returned type will be the first
|
||||
# type in the sorted list.
|
||||
#
|
||||
# The "printable" rule differs from the "ascii" rule in that it also
|
||||
# accepts 8-bit characters in the range 128-255.
|
||||
#
|
||||
# String constants must be surrounded by "" if they contain whitespace.
|
||||
# To insert binary data into a string, use the <hex> notation.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Application-generated files...
|
||||
#
|
||||
|
||||
#application/msword doc string(0,<D0CF11E0A1B11AE1>)
|
||||
application/pdf pdf string(0,%PDF)
|
||||
application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
|
||||
contains(0,128,<1B>%-12345X) + \
|
||||
(contains(0,1024,"LANGUAGE=POSTSCRIPT") \
|
||||
contains(0,1024,"LANGUAGE = Postscript") \
|
||||
contains(0,1024,"LANGUAGE = PostScript") \
|
||||
contains(0,1024,"LANGUAGE = POSTSCRIPT"))
|
||||
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
|
||||
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,1024,"LANGUAGE=HPGL") \
|
||||
contains(0,1024,"LANGUAGE = HPGL")))
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Image files...
|
||||
#
|
||||
|
||||
image/gif gif string(0,GIF87a) string(0,GIF89a)
|
||||
image/png png string(0,<89>PNG)
|
||||
image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
|
||||
(char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
|
||||
char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
|
||||
char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
|
||||
char(3,0xec) char(3,0xed) char(3,0xee) char(3,0xef))
|
||||
image/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)
|
||||
image/x-portable-graymap pgm string(0,P2) string(0,P5)
|
||||
image/x-portable-pixmap ppm string(0,P3) string(0,P6)
|
||||
image/x-sgi-rgb rgb sgi bw icon short(0,474)
|
||||
image/x-xbitmap xbm
|
||||
image/x-xpixmap xpm ascii(0,1024) + string(3,"XPM")
|
||||
#image/x-xwindowdump xwd string(4,<00000007>)
|
||||
image/x-sun-raster ras string(0,<59a66a95>)
|
||||
|
||||
#image/fpx fpx
|
||||
image/x-alias pix short(8,8) short(8,24)
|
||||
image/x-bitmap bmp string(0,BM) && !printable(2,14)
|
||||
image/x-icon ico
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Text files...
|
||||
#
|
||||
|
||||
application/x-cshell csh printable(0,1024) + string(0,#!) +\
|
||||
(contains(2,80,/csh) contains(2,80,/tcsh))
|
||||
application/x-perl pl printable(0,1024) + string(0,#!) +\
|
||||
contains(2,80,/perl)
|
||||
application/x-shell sh printable(0,1024) + string(0,#!) +\
|
||||
(contains(2,80,/bash) contains(2,80,/ksh)\
|
||||
contains(2,80,/sh) contains(2,80,/zsh))
|
||||
application/x-csource c cxx cpp cc C h hpp \
|
||||
printable(0,1024) + \
|
||||
(string(0,/*) string(0,//)
|
||||
string(0,#include) contains(0,1024,<0a>#include) \
|
||||
string(0,#define) contains(0,1024,<0a>#define))
|
||||
text/html html htm printable(0,1024) +\
|
||||
(istring(0,"<HTML>") istring(0,"<!DOCTYPE"))
|
||||
text/plain txt printable(0,1024)
|
||||
text/css css
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# CUPS-specific types...
|
||||
#
|
||||
|
||||
application/vnd.cups-command string(0,'#CUPS-COMMAND')
|
||||
application/vnd.cups-form string(0,"<CUPSFORM>")
|
||||
application/vnd.cups-postscript
|
||||
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
|
||||
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
string(0,<1B>@) \
|
||||
(contains(0,128,<1B>%-12345X) + \
|
||||
(contains(0,1024,"LANGUAGE=PCL") \
|
||||
contains(0,1024,"LANGUAGE = PCL")))
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Raw print file support...
|
||||
#
|
||||
# Uncomment the following type and the application/octet-stream
|
||||
# filter line in mime.convs to allow raw file printing without the
|
||||
# -oraw option.
|
||||
#
|
||||
|
||||
#application/octet-stream
|
||||
|
||||
#
|
||||
# End of "$Id: mime.types 4590 2005-08-24 19:25:49Z mike $".
|
||||
#
|
||||
@@ -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,3 +0,0 @@
|
||||
#%PAM-1.0
|
||||
auth required pam_unix.so shadow nodelay nullok
|
||||
account required pam_unix.so
|
||||
@@ -1,2 +0,0 @@
|
||||
auth required @PAMMOD@ nullok shadow
|
||||
account required @PAMMOD@
|
||||
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# "$Id: compiler.m4 142 2006-08-17 14:50:46Z mike $"
|
||||
#
|
||||
# Common compiler stuff for autoconf...
|
||||
#
|
||||
|
||||
CFLAGS="${CFLAGS:=}"
|
||||
LDFLAGS="${LDFLAGS:=}"
|
||||
LIBS="${LIBS:=}"
|
||||
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
|
||||
[if test x$enable_debug = xyes; then
|
||||
CFLAGS="-g $CFLAGS"
|
||||
LDFLAGS="-g $LDFLAGS"
|
||||
fi])
|
||||
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PATH_PROG(RM,rm)
|
||||
|
||||
dnl Support large files.
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Add -Wall for GCC...
|
||||
if test -n "$GCC"; then
|
||||
dnl Extended warnings...
|
||||
CFLAGS="-Wshadow -Winline $CFLAGS"
|
||||
dnl Standard warnings...
|
||||
CFLAGS="-Wall -Wunused -Wno-char-subscripts -Wno-format-y2k $CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: compiler.m4 142 2006-08-17 14:50:46Z mike $".
|
||||
#
|
||||
@@ -1,268 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 5229 2006-03-05 16:48:12Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl We need at least autoconf 2.50...
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Versio number information...
|
||||
CUPS_VERSION="1.2svn"
|
||||
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
|
||||
|
||||
AC_SUBST(CUPS_VERSION)
|
||||
AC_SUBST(CUPS_REVISION)
|
||||
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_CXX
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
if test "$INSTALL" = "$ac_install_sh"; then
|
||||
# Use full path to install-sh script...
|
||||
INSTALL="`pwd`/install-sh -c"
|
||||
fi
|
||||
AC_PROG_RANLIB
|
||||
AC_PATH_PROG(AR,ar)
|
||||
AC_PATH_PROG(HTMLDOC,htmldoc)
|
||||
AC_PATH_PROG(LD,ld)
|
||||
AC_PATH_PROG(LN,ln)
|
||||
AC_PATH_PROG(MV,mv)
|
||||
AC_PATH_PROG(RM,rm)
|
||||
AC_PATH_PROG(RM,rmdir)
|
||||
AC_PATH_PROG(SED,sed)
|
||||
AC_PATH_PROG(STRIP,strip)
|
||||
|
||||
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
|
||||
if test "x$CXX" = x; then
|
||||
AC_MSG_ERROR([Unable to find required C++ compiler command.])
|
||||
fi
|
||||
|
||||
dnl Static library option...
|
||||
INSTALLSTATIC=""
|
||||
AC_ARG_ENABLE(install_static, [ --enable-static install static libraries, default=no])
|
||||
|
||||
if test x$enable_install_static = xyes; then
|
||||
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
|
||||
AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
|
||||
if test "$ac_cv_lib_c_mallinfo" = "no"; then
|
||||
AC_CHECK_LIB(malloc,mallinfo,
|
||||
LIBS="$LIBS"
|
||||
LIBMALLOC="-lmalloc"
|
||||
AC_DEFINE(HAVE_MALLINFO),
|
||||
LIBS="$LIBS")
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBMALLOC)
|
||||
|
||||
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))
|
||||
|
||||
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 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)
|
||||
AC_CHECK_FUNCS(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 Flags for "ar" command...
|
||||
case $uname in
|
||||
Darwin* | *BSD*)
|
||||
ARFLAGS="-rcv"
|
||||
;;
|
||||
*)
|
||||
ARFLAGS="crvs"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(ARFLAGS)
|
||||
|
||||
dnl Extra platform-specific libraries...
|
||||
BACKLIBS=""
|
||||
CUPSDLIBS=""
|
||||
DBUSDIR=""
|
||||
|
||||
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
|
||||
|
||||
case $uname in
|
||||
Darwin*)
|
||||
BACKLIBS="-framework IOKit"
|
||||
CUPSDLIBS="-framework IOKit -framework SystemConfiguration"
|
||||
LIBS="-framework CoreFoundation $LIBS"
|
||||
|
||||
dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
|
||||
AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
|
||||
if test "$uname" = "Darwin" -a $uversion -ge 70; then
|
||||
AC_DEFINE(HAVE_CF_LOCALE_ID)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
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 (Tiger)...
|
||||
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
|
||||
AC_CHECK_FUNCS(mbr_uid_to_uuid)
|
||||
|
||||
dnl Check for notify_post support
|
||||
AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
|
||||
AC_CHECK_FUNCS(notify_post)
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
dnl Check for DBUS support
|
||||
if test "x$enable_dbus" != xno; then
|
||||
AC_PATH_PROG(PKGCONFIG, pkg-config)
|
||||
if test "x$PKGCONFIG" != x; then
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_CHECK_LIB(dbus-1,
|
||||
dbus_message_iter_init_append,
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
|
||||
DBUSDIR="/etc/dbus-1/system.d")
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl See if we have POSIX ACL support...
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
|
||||
CUPSDLIBS="$CUPSDLIBS $LIBS"
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
AC_SUBST(BACKLIBS)
|
||||
AC_SUBST(CUPSDLIBS)
|
||||
AC_SUBST(DBUSDIR)
|
||||
|
||||
dnl New default port definition for IPP...
|
||||
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
|
||||
DEFAULT_IPP_PORT="$withval",
|
||||
DEFAULT_IPP_PORT="631")
|
||||
|
||||
AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 5229 2006-03-05 16:48:12Z mike $".
|
||||
dnl
|
||||
@@ -1,196 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl Clear the debugging and non-shared library options unless the user asks
|
||||
dnl for them...
|
||||
OPTIM=""
|
||||
AC_SUBST(OPTIM)
|
||||
|
||||
AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
|
||||
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
|
||||
[if test x$enable_debug = xyes; then
|
||||
OPTIM="-g"
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no])
|
||||
|
||||
dnl Update compiler options...
|
||||
CXXLIBS=""
|
||||
AC_SUBST(CXXLIBS)
|
||||
|
||||
if test -n "$GCC"; then
|
||||
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
|
||||
|
||||
if test $PICFLAG = 1 -a $uname != AIX; then
|
||||
OPTIM="-fPIC $OPTIM"
|
||||
fi
|
||||
|
||||
case $uname in
|
||||
Darwin*)
|
||||
if test "x$with_optim" = x; then
|
||||
if test "x`uname -m`" = xi386; then
|
||||
# Build universal binaries for OSX on Intel...
|
||||
OPTIM="-arch i386 -arch ppc $OPTIM"
|
||||
DSOFLAGS="-arch i386 -arch ppc $DSOFLAGS"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
Linux*)
|
||||
if test x$enable_pie = xyes; then
|
||||
OPTIM="$OPTIM -fpie"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Add useful warning options for tracking down problems...
|
||||
OPTIM="-Wall -Wno-format-y2k $OPTIM"
|
||||
# Additional warning options for alpha testing...
|
||||
OPTIM="-Wshadow -Wunused $OPTIM"
|
||||
fi
|
||||
else
|
||||
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 "x$with_optim" = x; then
|
||||
OPTIM="+DAportable $OPTIM"
|
||||
fi
|
||||
|
||||
if test $PICFLAG = 1; then
|
||||
OPTIM="+z $OPTIM"
|
||||
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 $uversion -ge 62 -a "x$with_optim" = x; then
|
||||
OPTIM="$OPTIM -n32 -mips3"
|
||||
fi
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Show most warnings, but suppress the
|
||||
# ones about arguments not being used,
|
||||
# string constants assigned to const
|
||||
# char *'s, etc. We only set the warning
|
||||
# options on IRIX 6.2 and higher because
|
||||
# of limitations in the older SGI compiler
|
||||
# tools.
|
||||
if test $uversion -ge 62; then
|
||||
OPTIM="-fullwarn -woff 1183,1209,1349,3201 $OPTIM"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
SunOS*)
|
||||
# Solaris
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-xO4"
|
||||
else
|
||||
OPTIM="$with_optim $OPTIM"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_optim" = x; then
|
||||
# Specify "generic" SPARC output and suppress
|
||||
# all of Sun's questionable warning messages...
|
||||
OPTIM="-w $OPTIM -xarch=generic"
|
||||
fi
|
||||
|
||||
if test $PICFLAG = 1; then
|
||||
OPTIM="-KPIC $OPTIM"
|
||||
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 CXXFLAGS"
|
||||
echo "environment variable before running configure."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test $uname = HP-UX; then
|
||||
# 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"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $".
|
||||
dnl
|
||||
@@ -1,215 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
dnl
|
||||
dnl Copyright 2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl Default ConfigFilePerm
|
||||
AC_ARG_WITH(config_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
|
||||
CUPS_CONFIG_FILE_PERM="$withval",
|
||||
if test "x$uname" = xDarwin; then
|
||||
CUPS_CONFIG_FILE_PERM="644"
|
||||
else
|
||||
CUPS_CONFIG_FILE_PERM="640"
|
||||
fi)
|
||||
AC_SUBST(CUPS_CONFIG_FILE_PERM)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
|
||||
|
||||
dnl Default LogFilePerm
|
||||
AC_ARG_WITH(log_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 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(browse_local, [ --with-local-protocols set default BrowseLocalProtocols, default="CUPS"],
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS="$withval",
|
||||
CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS")
|
||||
AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS,
|
||||
"$CUPS_BROWSE_LOCAL_PROTOCOLS")
|
||||
|
||||
dnl Default BrowseRemoteProtocols
|
||||
AC_ARG_WITH(browse_remote, [ --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
|
||||
CUPS_BROWSE_REMOTE_PROTOCOLS="$withval",
|
||||
CUPS_BROWSE_REMOTE_PROTOCOLS="CUPS")
|
||||
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(network_default, [ --enable-use-network-default
|
||||
enable UseNetworkDefault by default, default=yes])
|
||||
if test "x$enable_network_default" = xno; then
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
|
||||
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 -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 -f /etc/group; then
|
||||
if test x$uname = xDarwin; then
|
||||
GROUP_LIST="nobody"
|
||||
else
|
||||
GROUP_LIST="lp nobody"
|
||||
fi
|
||||
|
||||
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
|
||||
GROUP_LIST="admin"
|
||||
else
|
||||
GROUP_LIST="lpadmin sys system root"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for default system groups)
|
||||
if test -f /etc/group; then
|
||||
CUPS_SYSTEM_GROUPS=""
|
||||
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)
|
||||
|
||||
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
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
@@ -1,289 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-directories.m4 5023 2006-01-29 14:39:44Z mike $"
|
||||
dnl
|
||||
dnl Directory stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: 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 "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
|
||||
fi
|
||||
|
||||
dnl Fix "includedir" variable if it hasn't been specified...
|
||||
if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
|
||||
includedir="/usr/include"
|
||||
fi
|
||||
|
||||
dnl Fix "localstatedir" variable if it hasn't been specified...
|
||||
if test "$localstatedir" = "\${prefix}/var"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
localstatedir="/private/var"
|
||||
else
|
||||
localstatedir="/var"
|
||||
fi
|
||||
else
|
||||
localstatedir="$prefix/var"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "sysconfdir" variable if it hasn't been specified...
|
||||
if test "$sysconfdir" = "\${prefix}/etc"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
sysconfdir="/private/etc"
|
||||
else
|
||||
sysconfdir="/etc"
|
||||
fi
|
||||
else
|
||||
sysconfdir="$prefix/etc"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "libdir" variable for IRIX 6.x...
|
||||
if test "$libdir" = "\${exec_prefix}/lib"; then
|
||||
if test "$uname" = "IRIX" -a $uversion -ge 62; then
|
||||
libdir="$exec_prefix/lib32"
|
||||
else
|
||||
libdir="$exec_prefix/lib"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Setup init.d locations...
|
||||
AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
|
||||
|
||||
if test x$rcdir = x; then
|
||||
case "$uname" in
|
||||
FreeBSD* | OpenBSD*)
|
||||
# FreeBSD and OpenBSD
|
||||
INITDIR=""
|
||||
INITDDIR=""
|
||||
;;
|
||||
|
||||
NetBSD*)
|
||||
# NetBSD
|
||||
INITDIR=""
|
||||
INITDDIR="/etc/rc.d"
|
||||
;;
|
||||
|
||||
Darwin*)
|
||||
# Darwin and MacOS X...
|
||||
INITDIR=""
|
||||
AC_CHECK_PROG(INITDDIR, launchd,
|
||||
"/System/Library/LaunchDaemons",
|
||||
"/System/Library/StartupItems/PrintingServices")
|
||||
;;
|
||||
|
||||
Linux | GNU)
|
||||
# Linux/HURD seems to choose an init.d directory at random...
|
||||
if test -d /sbin/init.d; then
|
||||
# SuSE
|
||||
INITDIR="/sbin/init.d"
|
||||
INITDDIR=".."
|
||||
else
|
||||
if test -d /etc/init.d; then
|
||||
# Others
|
||||
INITDIR="/etc"
|
||||
INITDDIR="../init.d"
|
||||
else
|
||||
# RedHat
|
||||
INITDIR="/etc/rc.d"
|
||||
INITDDIR="../init.d"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
OSF1* | HP-UX*)
|
||||
INITDIR="/sbin"
|
||||
INITDDIR="../init.d"
|
||||
;;
|
||||
|
||||
AIX*)
|
||||
INITDIR="/etc/rc.d"
|
||||
INITDDIR=".."
|
||||
;;
|
||||
|
||||
*)
|
||||
INITDIR="/etc"
|
||||
INITDDIR="../init.d"
|
||||
;;
|
||||
|
||||
esac
|
||||
else
|
||||
INITDIR=""
|
||||
INITDDIR="$rcdir"
|
||||
fi
|
||||
|
||||
AC_SUBST(INITDIR)
|
||||
AC_SUBST(INITDDIR)
|
||||
|
||||
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/tmp/cups"
|
||||
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)
|
||||
|
||||
# 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
|
||||
case "$uname" in
|
||||
Linux | GNU | *BSD* | Darwin*)
|
||||
CUPS_LOCALEDIR="$datadir/locale"
|
||||
;;
|
||||
|
||||
OSF1* | AIX*)
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg"
|
||||
;;
|
||||
|
||||
*)
|
||||
# This is the standard System V location...
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/locale"
|
||||
;;
|
||||
esac
|
||||
|
||||
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="$libdir/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 5023 2006-01-29 14:39:44Z mike $".
|
||||
dnl
|
||||
@@ -1,98 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-image.m4 4644 2005-09-15 18:43:06Z mike $"
|
||||
dnl
|
||||
dnl Image library stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl Save the current libraries since we don't want the image libraries
|
||||
dnl included with every program...
|
||||
SAVELIBS="$LIBS"
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
AC_CHECK_HEADER(zlib.h,
|
||||
AC_CHECK_LIB(z, gzgets,
|
||||
AC_DEFINE(HAVE_LIBZ)
|
||||
LIBZ="-lz"
|
||||
LIBS="$LIBS -lz"))
|
||||
|
||||
dnl PNG library uses math library functions...
|
||||
AC_CHECK_LIB(m, pow)
|
||||
|
||||
if test x$enable_png != xno; then
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
|
||||
AC_DEFINE(HAVE_LIBPNG)
|
||||
LIBPNG="-lpng -lm"))
|
||||
else
|
||||
AC_MSG_NOTICE([PNG support disabled with --disable-png.])
|
||||
fi
|
||||
|
||||
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 4644 2005-09-15 18:43:06Z mike $".
|
||||
dnl
|
||||
@@ -1,61 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-largefile.m4 4732 2005-09-30 23:23:25Z mike $"
|
||||
dnl
|
||||
dnl Large file support stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: 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 $ac_cv_sys_large_files = 1; then
|
||||
LARGEFILE="$LARGEFILE -D_LARGE_FILES"
|
||||
fi
|
||||
|
||||
if test $ac_cv_sys_file_offset_bits = 64; 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 4732 2005-09-30 23:23:25Z mike $".
|
||||
dnl
|
||||
@@ -1,53 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl launchd stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: 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$".
|
||||
dnl
|
||||
@@ -1,50 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org/
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(ldap, [ --enable-ldap turn on LDAP support, default=yes])
|
||||
AC_ARG_WITH(openldap-libs, [ --with-openldap-libs set directory for OpenLDAP library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
AC_ARG_WITH(openldap-includes, [ --with-openldap-includes
|
||||
set directory for OpenLDAP includes],
|
||||
CFLAGS="-I$withval $CFLAGS"
|
||||
CXXFLAGS="-I$withval $CXXFLAGS"
|
||||
CPPFLAGS="-I$withval $CPPFLAGS",)
|
||||
|
||||
LIBLDAP=""
|
||||
|
||||
if test x$enable_ldap != xno; then
|
||||
AC_CHECK_HEADER(ldap.h,
|
||||
AC_CHECK_LIB(ldap, ldap_value_free,
|
||||
AC_DEFINE(HAVE_LDAP)
|
||||
AC_DEFINE(HAVE_OPENLDAP)
|
||||
LIBLDAP="-lldap"))
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBLDAP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
@@ -1,49 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-libtool.m4 4494 2005-02-18 02:18:11Z mike $"
|
||||
dnl
|
||||
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: 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 4494 2005-02-18 02:18:11Z mike $".
|
||||
dnl
|
||||
@@ -1,107 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-manpages.m4 5099 2006-02-13 02:46:10Z mike $"
|
||||
dnl
|
||||
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl Fix "mandir" variable...
|
||||
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 5099 2006-02-13 02:46:10Z mike $".
|
||||
dnl
|
||||
@@ -1,89 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-network.m4 4873 2005-12-07 01:46:54Z mike $"
|
||||
dnl
|
||||
dnl Networking stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
AC_SEARCH_LIBS(socket, socket)
|
||||
AC_SEARCH_LIBS(gethostbyaddr, nsl)
|
||||
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
|
||||
AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
|
||||
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
|
||||
AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
|
||||
AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
|
||||
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
|
||||
|
||||
if test "$uname" = "SunOS"; then
|
||||
case "$uversion" in
|
||||
55* | 56*)
|
||||
maxfiles=1024
|
||||
;;
|
||||
*)
|
||||
maxfiles=4096
|
||||
;;
|
||||
esac
|
||||
else
|
||||
maxfiles=4096
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(maxfiles, [ --with-maxfiles=N set maximum number of file descriptors for scheduler ],
|
||||
maxfiles=$withval)
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
|
||||
|
||||
CUPS_DEFAULT_DOMAINSOCKET=""
|
||||
|
||||
dnl Domain socket support...
|
||||
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)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-network.m4 4873 2005-12-07 01:46:54Z mike $".
|
||||
dnl
|
||||
@@ -1,43 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-opsys.m4 5075 2006-02-05 01:00:29Z mike $"
|
||||
dnl
|
||||
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl Get the operating system and version number...
|
||||
uname=`uname`
|
||||
uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'`
|
||||
|
||||
case "$uname" in
|
||||
GNU* | GNU/*)
|
||||
uname="GNU"
|
||||
;;
|
||||
IRIX*)
|
||||
uname="IRIX"
|
||||
;;
|
||||
Linux*)
|
||||
uname="Linux"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl "$Id: cups-opsys.m4 5075 2006-02-05 01:00:29Z mike $"
|
||||
dnl
|
||||
@@ -1,98 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-pam.m4 4913 2006-01-11 01:42:04Z mike $"
|
||||
dnl
|
||||
dnl PAM stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support, default=yes])
|
||||
|
||||
dnl Don't use PAM with AIX...
|
||||
if test $uname = AIX; then
|
||||
enable_pam=no
|
||||
fi
|
||||
|
||||
PAMDIR=""
|
||||
PAMFILE=""
|
||||
PAMLIBS=""
|
||||
PAMMOD="pam_unknown.so"
|
||||
|
||||
if test x$enable_pam != xno; then
|
||||
SAVELIBS="$LIBS"
|
||||
|
||||
AC_CHECK_LIB(dl,dlopen)
|
||||
AC_CHECK_LIB(pam,pam_start)
|
||||
AC_CHECK_HEADER(security/pam_appl.h)
|
||||
if test x$ac_cv_header_security_pam_appl_h != xyes; then
|
||||
AC_CHECK_HEADER(pam/pam_appl.h,
|
||||
AC_DEFINE(HAVE_PAM_PAM_APPL_H))
|
||||
fi
|
||||
|
||||
if test x$ac_cv_lib_pam_pam_start != xno; then
|
||||
# Set the necessary libraries for PAM...
|
||||
if test x$ac_cv_lib_dl_dlopen != xno; then
|
||||
PAMLIBS="-lpam -ldl"
|
||||
else
|
||||
PAMLIBS="-lpam"
|
||||
fi
|
||||
|
||||
# Find the PAM configuration directory, if any...
|
||||
for dir in /private/etc/pam.d /etc/pam.d; do
|
||||
if test -d $dir; then
|
||||
PAMDIR=$dir
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
LIBS="$SAVELIBS"
|
||||
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin, MacOS X
|
||||
PAMFILE="pam.darwin"
|
||||
;;
|
||||
IRIX)
|
||||
# SGI IRIX
|
||||
PAMFILE="pam.irix"
|
||||
;;
|
||||
*)
|
||||
# All others; this test might need to be updated
|
||||
# as Linux distributors move things around...
|
||||
for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
|
||||
if test -f /lib/security/$mod; then
|
||||
PAMMOD="$mod"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
PAMFILE="pam.std"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST(PAMDIR)
|
||||
AC_SUBST(PAMFILE)
|
||||
AC_SUBST(PAMLIBS)
|
||||
AC_SUBST(PAMMOD)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pam.m4 4913 2006-01-11 01:42:04Z mike $".
|
||||
dnl
|
||||
@@ -1,104 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-scripting.m4 5176 2006-02-25 18:14:10Z mike $"
|
||||
dnl
|
||||
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
dnl Do we have Java?
|
||||
AC_ARG_WITH(java, [ --with-java set Java interpreter for web interfaces ],
|
||||
CUPS_JAVA="$withval",
|
||||
CUPS_JAVA="")
|
||||
|
||||
if test "x$CUPS_JAVA" = x; then
|
||||
AC_PATH_PROG(JAVA,java)
|
||||
CUPS_JAVA="$JAVA"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_JAVA, "$CUPS_JAVA")
|
||||
|
||||
if test "x$CUPS_JAVA" != x; then
|
||||
AC_DEFINE(HAVE_JAVA)
|
||||
fi
|
||||
|
||||
dnl Do we have Perl?
|
||||
AC_ARG_WITH(perl, [ --with-perl set Perl interpreter for web interfaces ],
|
||||
CUPS_PERL="$withval",
|
||||
CUPS_PERL="")
|
||||
|
||||
if test "x$CUPS_PERL" = x; then
|
||||
AC_PATH_PROG(PERL,perl)
|
||||
CUPS_PERL="$PERL"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PERL, "$CUPS_PERL")
|
||||
|
||||
if test "x$CUPS_PERL" != x; then
|
||||
AC_DEFINE(HAVE_PERL)
|
||||
fi
|
||||
|
||||
dnl Do we have PHP?
|
||||
AC_ARG_WITH(php, [ --with-php set PHP interpreter for web interfaces ],
|
||||
CUPS_PHP="$withval",
|
||||
CUPS_PHP="")
|
||||
|
||||
if test "x$CUPS_PHP" = x; then
|
||||
AC_PATH_PROG(PHP,php)
|
||||
CUPS_PHP="$PHP"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
|
||||
|
||||
if test "x$CUPS_PHP" = x; then
|
||||
CUPS_PHP="no"
|
||||
else
|
||||
AC_DEFINE(HAVE_PHP)
|
||||
fi
|
||||
|
||||
PHPDIR=""
|
||||
if test "x$CUPS_PHP" != xno; then
|
||||
AC_PATH_PROG(PHPCONFIG, php-config)
|
||||
|
||||
if test "x$PHPCONFIG" != x; then
|
||||
PHPDIR="scripting/php"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(PHPDIR)
|
||||
|
||||
dnl Do we have Python?
|
||||
AC_ARG_WITH(python, [ --with-python set Python interpreter for web interfaces ],
|
||||
CUPS_PYTHON="$withval",
|
||||
CUPS_PYTHON="")
|
||||
|
||||
if test "x$CUPS_PYTHON" = x; then
|
||||
AC_PATH_PROG(PYTHON,python)
|
||||
CUPS_PYTHON="$PYTHON"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_PYTHON, "$CUPS_PYTHON")
|
||||
|
||||
if test "x$CUPS_PYTHON" != x; then
|
||||
AC_DEFINE(HAVE_PYTHON)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-scripting.m4 5176 2006-02-25 18:14:10Z mike $".
|
||||
dnl
|
||||
@@ -1,156 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-sharedlibs.m4 5112 2006-02-16 04:41:59Z mike $"
|
||||
dnl
|
||||
dnl Shared library support for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
PICFLAG=1
|
||||
DSOFLAGS="${DSOFLAGS:=}"
|
||||
|
||||
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=yes])
|
||||
|
||||
if test x$enable_shared != xno; then
|
||||
case "$uname" in
|
||||
SunOS* | UNIX_S*)
|
||||
LIBCUPS="libcups.so.2"
|
||||
LIBCUPSIMAGE="libcupsimage.so.2"
|
||||
DSO="\$(CC)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-h,\$@ -G \$(OPTIM)"
|
||||
;;
|
||||
HP-UX*)
|
||||
LIBCUPS="libcups.sl.2"
|
||||
LIBCUPSIMAGE="libcupsimage.sl.2"
|
||||
DSO="\$(LD)"
|
||||
DSOFLAGS="$DSOFLAGS -b -z +h \$@"
|
||||
;;
|
||||
IRIX)
|
||||
LIBCUPS="libcups.so.2"
|
||||
LIBCUPSIMAGE="libcupsimage.so.2"
|
||||
DSO="\$(CC)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi2.6,-soname,\$@ -shared \$(OPTIM)"
|
||||
;;
|
||||
OSF1* | Linux | GNU | *BSD*)
|
||||
LIBCUPS="libcups.so.2"
|
||||
LIBCUPSIMAGE="libcupsimage.so.2"
|
||||
DSO="\$(CC)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
|
||||
;;
|
||||
Darwin*)
|
||||
LIBCUPS="libcups.2.dylib"
|
||||
LIBCUPSIMAGE="libcupsimage.2.dylib"
|
||||
DSO="\$(CC)"
|
||||
DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -single_module -lc"
|
||||
;;
|
||||
AIX*)
|
||||
LIBCUPS="libcups_s.a"
|
||||
LIBCUPSIMAGE="libcupsimage_s.a"
|
||||
DSO="\$(CC)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-bexpall,-bM:SRE,-bnoentry,-blibpath:\$(libdir)"
|
||||
;;
|
||||
*)
|
||||
echo "Warning: shared libraries may not be supported. Trying -shared"
|
||||
echo " option with compiler."
|
||||
LIBCUPS="libcups.so.2"
|
||||
LIBCUPSIMAGE="libcupsimage.so.2"
|
||||
DSO="\$(CC)"
|
||||
DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
PICFLAG=0
|
||||
LIBCUPS="libcups.a"
|
||||
LIBCUPSIMAGE="libcupsimage.a"
|
||||
DSO=":"
|
||||
fi
|
||||
|
||||
AC_SUBST(DSO)
|
||||
AC_SUBST(DSOFLAGS)
|
||||
AC_SUBST(LIBCUPS)
|
||||
AC_SUBST(LIBCUPSIMAGE)
|
||||
|
||||
if test x$enable_shared = xno; then
|
||||
LINKCUPS="../cups/libcups.a"
|
||||
LINKCUPSIMAGE="../filter/libcupsimage.a"
|
||||
else
|
||||
if test $uname = AIX; then
|
||||
LINKCUPS="-lcups_s"
|
||||
LINKCUPSIMAGE="-lcupsimage_s"
|
||||
else
|
||||
LINKCUPS="-lcups"
|
||||
LINKCUPSIMAGE="-lcupsimage"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(LINKCUPS)
|
||||
AC_SUBST(LINKCUPSIMAGE)
|
||||
|
||||
dnl Update libraries for DSOs...
|
||||
EXPORT_LDFLAGS=""
|
||||
|
||||
if test "$DSO" != ":"; then
|
||||
# When using DSOs the image libraries are linked to libcupsimage.so
|
||||
# rather than to the executables. This makes things smaller if you
|
||||
# are using any static libraries, and it also allows us to distribute
|
||||
# a single DSO rather than a bunch...
|
||||
DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
|
||||
IMGLIBS=""
|
||||
|
||||
# The *BSD, HP-UX, and Solaris run-time linkers need help when
|
||||
# deciding where to find a DSO. Add linker options to tell them
|
||||
# where to find the DSO (usually in /usr/lib... duh!)
|
||||
case $uname in
|
||||
HP-UX*)
|
||||
# HP-UX
|
||||
DSOFLAGS="+s +b $libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,+s,+b,$libdir"
|
||||
EXPORT_LDFLAGS="-Wl,+s,+b,$libdir"
|
||||
;;
|
||||
SunOS*)
|
||||
# Solaris
|
||||
DSOFLAGS="-R$libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -R$libdir"
|
||||
EXPORT_LDFLAGS="-R$libdir"
|
||||
;;
|
||||
*BSD*)
|
||||
# *BSD
|
||||
DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,-R$libdir"
|
||||
EXPORT_LDFLAGS="-Wl,-R$libdir"
|
||||
;;
|
||||
Linux | GNU)
|
||||
# Linux and HURD
|
||||
DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
|
||||
EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
DSOLIBS=""
|
||||
IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
|
||||
fi
|
||||
|
||||
AC_SUBST(DSOLIBS)
|
||||
AC_SUBST(IMGLIBS)
|
||||
AC_SUBST(EXPORT_LDFLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-sharedlibs.m4 5112 2006-02-16 04:41:59Z mike $".
|
||||
dnl
|
||||
@@ -1,48 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-openslp.m4 4494 2005-02-18 02:18:11Z mike $"
|
||||
dnl
|
||||
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(slp, [ --enable-slp turn on SLP support, default=yes])
|
||||
AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
AC_ARG_WITH(openslp-includes, [ --with-openslp-includes set directory for OpenSLP includes],
|
||||
CFLAGS="-I$withval $CFLAGS"
|
||||
CXXFLAGS="-I$withval $CXXFLAGS"
|
||||
CPPFLAGS="-I$withval $CPPFLAGS",)
|
||||
|
||||
LIBSLP=""
|
||||
|
||||
if test x$enable_slp != xno; then
|
||||
AC_CHECK_HEADER(slp.h,
|
||||
AC_CHECK_LIB(slp, SLPOpen,
|
||||
AC_DEFINE(HAVE_LIBSLP)
|
||||
LIBSLP="-lslp"))
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBSLP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-openslp.m4 4494 2005-02-18 02:18:11Z mike $".
|
||||
dnl
|
||||
@@ -1,109 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ssl.m4 4800 2005-10-18 18:06:20Z mike $"
|
||||
dnl
|
||||
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
|
||||
AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
|
||||
AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
|
||||
AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
|
||||
AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
|
||||
LDFLAGS="-L$withval $LDFLAGS"
|
||||
DSOFLAGS="-L$withval $DSOFLAGS",)
|
||||
AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes],
|
||||
CFLAGS="-I$withval $CFLAGS"
|
||||
CXXFLAGS="-I$withval $CXXFLAGS"
|
||||
CPPFLAGS="-I$withval $CPPFLAGS",)
|
||||
|
||||
SSLFLAGS=""
|
||||
SSLLIBS=""
|
||||
|
||||
if test x$enable_ssl != xno; then
|
||||
dnl Look for CDSA...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
|
||||
if test $uname = Darwin; then
|
||||
AC_CHECK_HEADER(Security/SecureTransport.h,
|
||||
[SSLLIBS="-framework CoreFoundation -framework Security"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_CDSASSL)])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Then look for GNU TLS...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
|
||||
AC_CHECK_HEADER(gnutls/gnutls.h,
|
||||
dnl Save the current libraries so the crypto stuff isn't always
|
||||
dnl included...
|
||||
SAVELIBS="$LIBS"
|
||||
|
||||
AC_CHECK_LIB(gnutls, gnutls_init,
|
||||
[SSLLIBS="-lgnutls"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)])
|
||||
|
||||
LIBS="$SAVELIBS")
|
||||
fi
|
||||
|
||||
dnl Check for the OpenSSL library last...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
|
||||
AC_CHECK_HEADER(openssl/ssl.h,
|
||||
dnl Save the current libraries so the crypto stuff isn't always
|
||||
dnl included...
|
||||
SAVELIBS="$LIBS"
|
||||
|
||||
dnl Some ELF systems can't resolve all the symbols in libcrypto
|
||||
dnl if libcrypto was linked against RSAREF, and fail to link the
|
||||
dnl test program correctly, even though a correct installation
|
||||
dnl of OpenSSL exists. So we test the linking three times in
|
||||
dnl case the RSAREF libraries are needed.
|
||||
|
||||
for libcrypto in \
|
||||
"-lcrypto" \
|
||||
"-lcrypto -lrsaref" \
|
||||
"-lcrypto -lRSAglue -lrsaref"
|
||||
do
|
||||
AC_CHECK_LIB(ssl,SSL_new,
|
||||
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
|
||||
SSLLIBS="-lssl $libcrypto"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_LIBSSL)],,
|
||||
$libcrypto)
|
||||
|
||||
if test "x${SSLLIBS}" != "x"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
LIBS="$SAVELIBS")
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(SSLFLAGS)
|
||||
AC_SUBST(SSLLIBS)
|
||||
|
||||
EXPORT_SSLLIBS="$SSLLIBS"
|
||||
AC_SUBST(EXPORT_SSLLIBS)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ssl.m4 4800 2005-10-18 18:06:20Z mike $".
|
||||
dnl
|
||||
@@ -1,57 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl Threading stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
|
||||
|
||||
have_pthread=no
|
||||
PTHREAD_FLAGS=""
|
||||
|
||||
if test "x$enable_threads" != xno; then
|
||||
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
|
||||
|
||||
if test x$ac_cv_header_pthread_h = xyes; then
|
||||
dnl Check various threading options for the platforms we support
|
||||
for flag in -lpthreads -lpthread -pthread; do
|
||||
AC_MSG_CHECKING([for pthread_create using $flag])
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$flag $LIBS"
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_create(0, 0, 0, 0);],
|
||||
have_pthread=yes,
|
||||
LIBS="$SAVELIBS")
|
||||
AC_MSG_RESULT([$have_pthread])
|
||||
|
||||
if test $have_pthread = yes; then
|
||||
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_FLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Common C++ compiler stuff for autoconf...
|
||||
#
|
||||
|
||||
CXXFLAGS="${CXXFLAGS:=}"
|
||||
|
||||
if test x$enable_debug = xyes; then
|
||||
CXXFLAGS="-g $CXXFLAGS"
|
||||
fi
|
||||
|
||||
AC_PROG_CXX
|
||||
|
||||
dnl Add -Wall for GCC...
|
||||
if test -n "$GCC"; then
|
||||
dnl Extended warnings...
|
||||
CXXFLAGS="-Wshadow -Wconversion -Winline $CXXFLAGS"
|
||||
dnl Standard warnings...
|
||||
CXXFLAGS="-Wall -Wunused -Wno-char-subscripts -Wno-format-y2k $CXXFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -0,0 +1,119 @@
|
||||
#
|
||||
# "$Id: library.m4 44 2006-05-08 19:33:22Z mike $"
|
||||
#
|
||||
# Common directory stuff for autoconf...
|
||||
#
|
||||
|
||||
dnl Get the operating system, version number, and architecture...
|
||||
uname=`uname`
|
||||
uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'`
|
||||
uarch=`uname -m`
|
||||
|
||||
case "$uname" in
|
||||
GNU* | GNU/*)
|
||||
uname="GNU"
|
||||
;;
|
||||
IRIX*)
|
||||
uname="IRIX"
|
||||
;;
|
||||
Linux*)
|
||||
uname="Linux"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Fix "prefix" variable if it hasn't been specified...
|
||||
if test "$prefix" = "NONE"; then
|
||||
prefix="/"
|
||||
fi
|
||||
|
||||
dnl Fix "exec_prefix" variable if it hasn't been specified...
|
||||
if test "$exec_prefix" = "NONE"; then
|
||||
if test "$prefix" = "/"; then
|
||||
exec_prefix="/usr"
|
||||
else
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "bindir" variable...
|
||||
if test "$bindir" = "\${exec_prefix}/bin"; then
|
||||
bindir="$exec_prefix/bin"
|
||||
fi
|
||||
|
||||
dnl Fix "sbindir" variable...
|
||||
if test "$sbindir" = "\${exec_prefix}/sbin"; then
|
||||
sbindir="$exec_prefix/sbin"
|
||||
fi
|
||||
|
||||
dnl Fix "sharedstatedir" variable if it hasn't been specified...
|
||||
if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
|
||||
sharedstatedir="/usr/com"
|
||||
fi
|
||||
|
||||
dnl Fix "datarootdir" variable if it hasn't been specified...
|
||||
if test "$datarootdir" = "\${prefix}/share"; then
|
||||
if test "$prefix" = "/"; then
|
||||
datarootdir="/usr/share"
|
||||
else
|
||||
datarootdir="$prefix/share"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "datadir" variable if it hasn't been specified...
|
||||
if test "$datadir" = "\${prefix}/share"; then
|
||||
if test "$prefix" = "/"; then
|
||||
datadir="/usr/share"
|
||||
else
|
||||
datadir="$prefix/share"
|
||||
fi
|
||||
elif test "$datadir" = "\${datarootdir}"; then
|
||||
datadir="$datarootdir"
|
||||
fi
|
||||
|
||||
dnl Fix "includedir" variable if it hasn't been specified...
|
||||
if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
|
||||
includedir="/usr/include"
|
||||
fi
|
||||
|
||||
dnl Fix "localstatedir" variable if it hasn't been specified...
|
||||
if test "$localstatedir" = "\${prefix}/var"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
localstatedir="/private/var"
|
||||
else
|
||||
localstatedir="/var"
|
||||
fi
|
||||
else
|
||||
localstatedir="$prefix/var"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "sysconfdir" variable if it hasn't been specified...
|
||||
if test "$sysconfdir" = "\${prefix}/etc"; then
|
||||
if test "$prefix" = "/"; then
|
||||
if test "$uname" = Darwin; then
|
||||
sysconfdir="/private/etc"
|
||||
else
|
||||
sysconfdir="/etc"
|
||||
fi
|
||||
else
|
||||
sysconfdir="$prefix/etc"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "libdir" variable for IRIX 6.x...
|
||||
if test "$libdir" = "\${exec_prefix}/lib"; then
|
||||
if test "$uname" = "IRIX"; then
|
||||
libdir="$exec_prefix/lib32"
|
||||
else
|
||||
if test "$uname" = Linux -a -d /usr/lib64; then
|
||||
libdir="$exec_prefix/lib64"
|
||||
else
|
||||
libdir="$exec_prefix/lib"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# End of "$Id: library.m4 44 2006-05-08 19:33:22Z mike $".
|
||||
#
|
||||
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# "$Id: library.m4 44 2006-05-08 19:33:22Z mike $"
|
||||
#
|
||||
# Common library stuff for autoconf...
|
||||
#
|
||||
|
||||
dnl Library commands and flags...
|
||||
AC_PROG_RANLIB
|
||||
AC_PATH_PROG(AR,ar)
|
||||
|
||||
case "$uname" in
|
||||
Darwin* | *BSD*)
|
||||
ARFLAGS="-rcv"
|
||||
;;
|
||||
*)
|
||||
ARFLAGS="crvs"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(ARFLAGS)
|
||||
|
||||
dnl PIC support...
|
||||
if test -n "$GCC"; then
|
||||
CFLAGS="-fPIC $CFLAGS"
|
||||
else
|
||||
case `uname` in
|
||||
HP-UX*)
|
||||
# HP-UX
|
||||
CFLAGS="+z $CFLAGS"
|
||||
;;
|
||||
|
||||
SunOS*)
|
||||
# Solaris
|
||||
CFLAGS="-KPIC $CFLAGS"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: library.m4 44 2006-05-08 19:33:22Z mike $".
|
||||
#
|
||||
-429
@@ -1,429 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Configuration file for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CONFIG_H_
|
||||
#define _CUPS_CONFIG_H_
|
||||
|
||||
/*
|
||||
* Version of software...
|
||||
*/
|
||||
|
||||
#define CUPS_SVERSION ""
|
||||
#define CUPS_MINIMAL ""
|
||||
|
||||
|
||||
/*
|
||||
* Default user and groups...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_USER "lp"
|
||||
#define CUPS_DEFAULT_GROUP "sys"
|
||||
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
|
||||
|
||||
|
||||
/*
|
||||
* Default file permissions...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_CONFIG_FILE_PERM 0640
|
||||
#define CUPS_DEFAULT_LOG_FILE_PERM 0644
|
||||
|
||||
|
||||
/*
|
||||
* Default browsing settings...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_BROWSING 1
|
||||
#define CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS "CUPS"
|
||||
#define CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS "CUPS"
|
||||
#define CUPS_DEFAULT_BROWSE_SHORT_NAMES 1
|
||||
#define CUPS_DEFAULT_DEFAULT_SHARED 1
|
||||
#define CUPS_DEFAULT_IMPLICIT_CLASSES 1
|
||||
#define CUPS_DEFAULT_USE_NETWORK_DEFAULT 1
|
||||
|
||||
|
||||
/*
|
||||
* Default IPP port...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_IPP_PORT 631
|
||||
|
||||
|
||||
/*
|
||||
* Maximum number of file descriptors to support.
|
||||
*/
|
||||
|
||||
#define CUPS_MAX_FDS 4096
|
||||
|
||||
|
||||
/*
|
||||
* Do we have domain socket support?
|
||||
*/
|
||||
|
||||
#undef CUPS_DEFAULT_DOMAINSOCKET
|
||||
|
||||
|
||||
/*
|
||||
* Where are files stored?
|
||||
*
|
||||
* Note: These are defaults, which can be overridden by environment
|
||||
* variables at run-time...
|
||||
*/
|
||||
|
||||
#define CUPS_BINDIR "/usr/bin"
|
||||
#define CUPS_CACHEDIR "/var/cache/cups"
|
||||
#define CUPS_DATADIR "/usr/share/cups"
|
||||
#define CUPS_DOCROOT "/usr/share/doc/cups"
|
||||
#define CUPS_FONTPATH "/usr/share/cups/fonts"
|
||||
#define CUPS_LOCALEDIR "/usr/share/locale"
|
||||
#define CUPS_LOGDIR "/var/logs/cups"
|
||||
#define CUPS_REQUESTS "/var/spool/cups"
|
||||
#define CUPS_SBINDIR "/usr/sbin"
|
||||
#define CUPS_SERVERBIN "/usr/lib/cups"
|
||||
#define CUPS_SERVERROOT "/etc/cups"
|
||||
#define CUPS_STATEDIR "/var/run/cups"
|
||||
|
||||
|
||||
/*
|
||||
* Do we have various image libraries?
|
||||
*/
|
||||
|
||||
#undef HAVE_LIBPNG
|
||||
#undef HAVE_LIBZ
|
||||
#undef HAVE_LIBJPEG
|
||||
#undef HAVE_LIBTIFF
|
||||
|
||||
|
||||
/*
|
||||
* Do we have PAM stuff?
|
||||
*/
|
||||
|
||||
#ifndef HAVE_LIBPAM
|
||||
#define HAVE_LIBPAM 0
|
||||
#endif /* !HAVE_LIBPAM */
|
||||
|
||||
#undef HAVE_PAM_PAM_APPL_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <shadow.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_SHADOW_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <crypt.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
|
||||
/*
|
||||
* Use <string.h>, <strings.h>, and/or <bstring.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_STRING_H
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_BSTRING_H
|
||||
|
||||
/*
|
||||
* Do we have the long long type?
|
||||
*/
|
||||
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
# define CUPS_LLFMT "%lld"
|
||||
# define CUPS_LLCAST (long long)
|
||||
#else
|
||||
# define CUPS_LLFMT "%ld"
|
||||
# define CUPS_LLCAST (long)
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
|
||||
/*
|
||||
* Do we have the strtoll() function?
|
||||
*/
|
||||
|
||||
#undef HAVE_STRTOLL
|
||||
|
||||
#ifndef HAVE_STRTOLL
|
||||
# define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
|
||||
#endif /* !HAVE_STRTOLL */
|
||||
|
||||
/*
|
||||
* Do we have the strXXX() functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_STRDUP
|
||||
#undef HAVE_STRCASECMP
|
||||
#undef HAVE_STRNCASECMP
|
||||
#undef HAVE_STRLCAT
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the geteuid() function?
|
||||
*/
|
||||
|
||||
#undef HAVE_GETEUID
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the vsyslog() function?
|
||||
*/
|
||||
|
||||
#undef HAVE_VSYSLOG
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the (v)snprintf() functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_SNPRINTF
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
|
||||
/*
|
||||
* What signal functions to use?
|
||||
*/
|
||||
|
||||
#undef HAVE_SIGSET
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
|
||||
/*
|
||||
* What wait functions to use?
|
||||
*/
|
||||
|
||||
#undef HAVE_WAITPID
|
||||
#undef HAVE_WAIT3
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the mallinfo function and malloc.h?
|
||||
*/
|
||||
|
||||
#undef HAVE_MALLINFO
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the POSIX ACL functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_ACL_INIT
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the langinfo.h header file?
|
||||
*/
|
||||
|
||||
#undef HAVE_LANGINFO_H
|
||||
|
||||
|
||||
/*
|
||||
* Which encryption libraries do we have?
|
||||
*/
|
||||
|
||||
#undef HAVE_CDSASSL
|
||||
#undef HAVE_GNUTLS
|
||||
#undef HAVE_LIBSSL
|
||||
#undef HAVE_SSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SLP library?
|
||||
*/
|
||||
|
||||
#undef HAVE_LIBSLP
|
||||
|
||||
|
||||
/*
|
||||
* Do we have an LDAP library?
|
||||
*/
|
||||
|
||||
#undef HAVE_LDAP
|
||||
#undef HAVE_OPENLDAP
|
||||
|
||||
|
||||
/*
|
||||
* Do we have libpaper?
|
||||
*/
|
||||
|
||||
#undef HAVE_LIBPAPER
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <sys/ioctl.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have mkstemp() and/or mkstemps()?
|
||||
*/
|
||||
|
||||
#undef HAVE_MKSTEMP
|
||||
#undef HAVE_MKSTEMPS
|
||||
|
||||
|
||||
/*
|
||||
* Does the "tm" structure contain the "tm_gmtoff" member?
|
||||
*/
|
||||
|
||||
#undef HAVE_TM_GMTOFF
|
||||
|
||||
|
||||
/*
|
||||
* Do we have rresvport_af()?
|
||||
*/
|
||||
|
||||
#undef HAVE_RRESVPORT_AF
|
||||
|
||||
|
||||
/*
|
||||
* Do we have getaddrinfo()?
|
||||
*/
|
||||
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
|
||||
/*
|
||||
* Do we have getnameinfo()?
|
||||
*/
|
||||
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
|
||||
/*
|
||||
* Do we have getifaddrs()?
|
||||
*/
|
||||
|
||||
#undef HAVE_GETIFADDRS
|
||||
|
||||
|
||||
/*
|
||||
* Do we have hstrerror()?
|
||||
*/
|
||||
|
||||
#undef HAVE_HSTRERROR
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the <sys/sockio.h> header file?
|
||||
*/
|
||||
|
||||
#undef HAVE_SYS_SOCKIO_H
|
||||
|
||||
|
||||
/*
|
||||
* Does the sockaddr structure contain an sa_len parameter?
|
||||
*/
|
||||
|
||||
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the AIX usersec.h header file?
|
||||
*/
|
||||
|
||||
#undef HAVE_USERSEC_H
|
||||
|
||||
/*
|
||||
* Do we have pthread support?
|
||||
*/
|
||||
|
||||
#undef HAVE_PTHREAD_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have launchd support?
|
||||
*/
|
||||
|
||||
#undef HAVE_LAUNCH_H
|
||||
#undef HAVE_LAUNCHD
|
||||
#define CUPS_DEFAULT_LAUNCHD_CONF ""
|
||||
|
||||
|
||||
/*
|
||||
* Various scripting languages...
|
||||
*/
|
||||
|
||||
#undef HAVE_JAVA
|
||||
#define CUPS_JAVA "/usr/bin/java"
|
||||
#undef HAVE_PERL
|
||||
#define CUPS_PERL "/usr/bin/perl"
|
||||
#undef HAVE_PHP
|
||||
#define CUPS_PHP "/usr/bin/php"
|
||||
#undef HAVE_PYTHON
|
||||
#define CUPS_PYTHON "/usr/bin/python"
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
|
||||
*/
|
||||
|
||||
#undef HAVE_COREFOUNDATION
|
||||
#undef HAVE_SYSTEMCONFIGURATION
|
||||
|
||||
|
||||
/*
|
||||
* Do we have CoreFoundation public and private headers?
|
||||
*/
|
||||
|
||||
#undef HAVE_COREFOUNDATION_H
|
||||
#undef HAVE_CFPRIV_H
|
||||
#undef HAVE_CFBUNDLEPRIV_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have MacOSX 10.4's mbr_XXX functions()?
|
||||
*/
|
||||
|
||||
#undef HAVE_MEMBERSHIP_H
|
||||
#undef HAVE_MBR_UID_TO_UUID
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Darwin's notify_post() header and function?
|
||||
*/
|
||||
|
||||
#undef HAVE_NOTIFY_H
|
||||
#undef HAVE_NOTIFY_POST
|
||||
|
||||
|
||||
/*
|
||||
* Do we have DBUS?
|
||||
*/
|
||||
|
||||
#undef HAVE_DBUS
|
||||
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,64 +0,0 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl
|
||||
dnl Configuration script for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
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 Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
AC_INIT(cups/cups.h)
|
||||
|
||||
sinclude(config-scripts/cups-opsys.m4)
|
||||
sinclude(config-scripts/cups-common.m4)
|
||||
sinclude(config-scripts/cups-defaults.m4)
|
||||
sinclude(config-scripts/cups-directories.m4)
|
||||
sinclude(config-scripts/cups-manpages.m4)
|
||||
|
||||
sinclude(config-scripts/cups-sharedlibs.m4)
|
||||
sinclude(config-scripts/cups-libtool.m4)
|
||||
sinclude(config-scripts/cups-compiler.m4)
|
||||
|
||||
sinclude(config-scripts/cups-image.m4)
|
||||
sinclude(config-scripts/cups-network.m4)
|
||||
sinclude(config-scripts/cups-slp.m4)
|
||||
sinclude(config-scripts/cups-ldap.m4)
|
||||
sinclude(config-scripts/cups-ssl.m4)
|
||||
sinclude(config-scripts/cups-pam.m4)
|
||||
sinclude(config-scripts/cups-threads.m4)
|
||||
sinclude(config-scripts/cups-largefile.m4)
|
||||
sinclude(config-scripts/cups-launchd.m4)
|
||||
|
||||
MAKEDEFS="../Makedefs"
|
||||
AC_SUBST(MAKEDEFS)
|
||||
|
||||
sinclude(config-scripts/cups-scripting.m4)
|
||||
|
||||
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh cups-config
|
||||
conf/cupsd.conf conf/pam.std doc/index.html doc/ja/index.html
|
||||
doc/help/standard.html man/client.conf.man man/cups-deviced.man
|
||||
man/cups-driverd.man man/cups-lpd.man man/cupsaddsmb.man
|
||||
man/cupsd.man man/cupsd.conf.man man/lpoptions.man
|
||||
templates/edit-config.tmpl templates/header.tmpl
|
||||
templates/ja/header.tmpl)
|
||||
|
||||
chmod +x cups-config
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl
|
||||
@@ -1,139 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# CUPS configuration utility.
|
||||
#
|
||||
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
|
||||
VERSION="@CUPS_VERSION@"
|
||||
APIVERSION="1.2"
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
includedir=@includedir@
|
||||
libdir=@libdir@
|
||||
datadir=@datadir@
|
||||
sysconfdir=@sysconfdir@
|
||||
cups_datadir=@CUPS_DATADIR@
|
||||
cups_serverbin=@CUPS_SERVERBIN@
|
||||
cups_serverroot=@CUPS_SERVERROOT@
|
||||
INSTALLSTATIC=@INSTALLSTATIC@
|
||||
|
||||
# flags for C++ compiler:
|
||||
CFLAGS=""
|
||||
LDFLAGS="@EXPORT_LDFLAGS@"
|
||||
LIBS="@EXPORT_SSLLIBS@ @LIBS@"
|
||||
IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@ @EXPORT_LIBZ@"
|
||||
|
||||
if test $includedir != /usr/include; then
|
||||
CFLAGS="$CFLAGS -I$includedir"
|
||||
fi
|
||||
|
||||
if test $libdir != /usr/lib -a $libdir != /usr/lib32; then
|
||||
LDFLAGS="$LDFLAGS -L$libdir"
|
||||
fi
|
||||
|
||||
usage ()
|
||||
{
|
||||
echo "Usage: cups-config --api-version"
|
||||
echo " cups-config --cflags"
|
||||
echo " cups-config --datadir"
|
||||
echo " cups-config --help"
|
||||
echo " cups-config --ldflags"
|
||||
echo " cups-config [--image] [--static] --libs"
|
||||
echo " cups-config --serverbin"
|
||||
echo " cups-config --serverroot"
|
||||
echo " cups-config --version"
|
||||
|
||||
exit $1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
# Parse command line options
|
||||
static=no
|
||||
image=no
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--api-version)
|
||||
echo $APIVERSION
|
||||
;;
|
||||
--cflags)
|
||||
echo $CFLAGS
|
||||
;;
|
||||
--datadir)
|
||||
echo $cups_datadir
|
||||
;;
|
||||
--help)
|
||||
usage 0
|
||||
;;
|
||||
--image)
|
||||
image=yes
|
||||
;;
|
||||
--ldflags)
|
||||
echo $LDFLAGS
|
||||
;;
|
||||
--libs)
|
||||
if test $static = no; then
|
||||
if test $image = no; then
|
||||
echo -lcups $LIBS
|
||||
else
|
||||
echo -lcupsimage $IMGLIBS -lcups $LIBS
|
||||
fi
|
||||
else
|
||||
if test $image = no; then
|
||||
echo $libdir/libcups.a $LIBS
|
||||
else
|
||||
echo $libdir/libcupsimage.a $IMGLIBS $libdir/libcups.a $LIBS
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
--serverbin)
|
||||
echo $cups_serverbin
|
||||
;;
|
||||
--serverroot)
|
||||
echo $cups_serverroot
|
||||
;;
|
||||
--static)
|
||||
if test -z "$INSTALLSTATIC"; then
|
||||
echo "WARNING: Static libraries not installed!" >&2
|
||||
else
|
||||
static=yes
|
||||
fi
|
||||
;;
|
||||
--version)
|
||||
echo $VERSION
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
@@ -1,85 +0,0 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
adminutil.o: adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
|
||||
adminutil.o: language.h globals.h string.h ../config.h i18n.h normalize.h
|
||||
adminutil.o: transcode.h debug.h
|
||||
array.o: array.h string.h ../config.h debug.h
|
||||
attr.o: ppd.h array.h file.h debug.h string.h ../config.h
|
||||
auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
auth.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
backchannel.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
|
||||
backend.o: backend.h string.h ../config.h
|
||||
custom.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
custom.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
dest.o: array.h file.h language.h i18n.h normalize.h transcode.h
|
||||
dir.o: dir.h string.h ../config.h debug.h
|
||||
emit.o: ppd.h array.h file.h string.h ../config.h
|
||||
encode.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
|
||||
encode.o: ipp-private.h string.h ../config.h debug.h
|
||||
file.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h string.h
|
||||
file.o: ../cups/debug.h file.h
|
||||
getputfile.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
|
||||
getputfile.o: string.h ../config.h debug.h
|
||||
globals.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
globals.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
globals.o: normalize.h transcode.h
|
||||
http.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
http.o: string.h cups.h ppd.h array.h file.h language.h i18n.h normalize.h
|
||||
http.o: transcode.h debug.h
|
||||
http-addr.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
http-addr.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
http-addrlist.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
http-addrlist.o: globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
http-addrlist.o: i18n.h normalize.h transcode.h debug.h
|
||||
http-support.o: debug.h globals.h string.h ../config.h cups.h ipp.h http.h
|
||||
http-support.o: md5.h ppd.h array.h file.h language.h i18n.h normalize.h
|
||||
http-support.o: transcode.h
|
||||
ipp.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
ipp.o: string.h cups.h ppd.h array.h file.h language.h i18n.h normalize.h
|
||||
ipp.o: transcode.h debug.h
|
||||
ipp-support.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
ipp-support.o: array.h file.h language.h i18n.h normalize.h transcode.h
|
||||
ipp-support.o: debug.h
|
||||
langprintf.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
langprintf.o: array.h file.h language.h i18n.h normalize.h transcode.h
|
||||
language.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
language.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
localize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
localize.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
mark.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
|
||||
mark.o: ../config.h debug.h
|
||||
md5.o: md5.h string.h ../config.h
|
||||
md5passwd.o: http.h md5.h string.h ../config.h
|
||||
normalize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
normalize.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
notify.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
notify.o: array.h file.h language.h i18n.h normalize.h transcode.h
|
||||
options.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
|
||||
options.o: ../config.h debug.h
|
||||
page.o: ppd.h array.h file.h string.h ../config.h
|
||||
ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h
|
||||
ppd.o: file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
request.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
request.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
snprintf.o: string.h ../config.h
|
||||
string.o: debug.h string.h ../config.h globals.h cups.h ipp.h http.h md5.h
|
||||
string.o: ppd.h array.h file.h language.h i18n.h normalize.h transcode.h
|
||||
tempfile.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
tempfile.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
transcode.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
transcode.o: array.h file.h language.h i18n.h normalize.h transcode.h
|
||||
usersys.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
usersys.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
usersys.o: normalize.h transcode.h
|
||||
util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
util.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
|
||||
testadmin.o: adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
|
||||
testadmin.o: language.h string.h ../config.h
|
||||
testarray.o: ../cups/string.h ../config.h string.h array.h dir.h debug.h
|
||||
testfile.o: string.h ../config.h file.h debug.h
|
||||
testhttp.o: http.h md5.h string.h ../config.h
|
||||
testi18n.o: language.h array.h string.h ../config.h transcode.h normalize.h
|
||||
testipp.o: ../cups/string.h ../config.h string.h ipp.h http.h md5.h
|
||||
testlang.o: i18n.h language.h array.h
|
||||
testppd.o: ../cups/string.h ../config.h string.h ppd.h array.h file.h
|
||||
-398
@@ -1,398 +0,0 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# API library Makefile for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Easy Software Products and are protected by Federal
|
||||
# copyright law. Distribution and use rights are outlined in the file
|
||||
# "LICENSE.txt" which should have been included with this file. If this
|
||||
# file is missing or damaged please contact Easy Software Products
|
||||
# at:
|
||||
#
|
||||
# Attn: CUPS Licensing Information
|
||||
# Easy Software Products
|
||||
# 44141 Airport View Drive, Suite 204
|
||||
# Hollywood, Maryland 20636 USA
|
||||
#
|
||||
# Voice: (301) 373-9600
|
||||
# EMail: cups-info@cups.org
|
||||
# WWW: http://www.cups.org
|
||||
#
|
||||
# This file is subject to the Apple OS-Developed Software exception.
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
#
|
||||
# Object files...
|
||||
#
|
||||
|
||||
LIBOBJS = \
|
||||
adminutil.o \
|
||||
array.o \
|
||||
attr.o \
|
||||
auth.o \
|
||||
backchannel.o \
|
||||
backend.o \
|
||||
custom.o \
|
||||
dest.o \
|
||||
dir.o \
|
||||
emit.o \
|
||||
encode.o \
|
||||
file.o \
|
||||
getputfile.o \
|
||||
globals.o \
|
||||
http.o \
|
||||
http-addr.o \
|
||||
http-addrlist.o \
|
||||
http-support.o \
|
||||
ipp.o \
|
||||
ipp-support.o \
|
||||
langprintf.o \
|
||||
language.o \
|
||||
localize.o \
|
||||
mark.o \
|
||||
md5.o \
|
||||
md5passwd.o \
|
||||
normalize.o \
|
||||
notify.o \
|
||||
options.o \
|
||||
page.o \
|
||||
ppd.o \
|
||||
request.o \
|
||||
snprintf.o \
|
||||
string.o \
|
||||
tempfile.o \
|
||||
transcode.o \
|
||||
usersys.o \
|
||||
util.o
|
||||
OBJS = \
|
||||
$(LIBOBJS) \
|
||||
testadmin.o \
|
||||
testarray.o \
|
||||
testfile.o \
|
||||
testhttp.o \
|
||||
testi18n.o \
|
||||
testipp.o \
|
||||
testlang.o \
|
||||
testppd.o \
|
||||
php_cups_wrap.o
|
||||
|
||||
|
||||
#
|
||||
# Header files to install...
|
||||
#
|
||||
|
||||
HEADERS = \
|
||||
adminutil.h \
|
||||
array.h \
|
||||
cups.h \
|
||||
dir.h \
|
||||
file.h \
|
||||
http.h \
|
||||
i18n.h \
|
||||
ipp.h \
|
||||
language.h \
|
||||
md5.h \
|
||||
normalize.h \
|
||||
ppd.h \
|
||||
transcode.h
|
||||
|
||||
|
||||
#
|
||||
# Targets in this directory...
|
||||
#
|
||||
|
||||
TARGETS = \
|
||||
$(LIBCUPS) \
|
||||
libcups.a \
|
||||
testadmin \
|
||||
testarray \
|
||||
testfile \
|
||||
testhttp \
|
||||
testi18n \
|
||||
testipp \
|
||||
testlang \
|
||||
testppd
|
||||
|
||||
|
||||
#
|
||||
# Make all targets...
|
||||
#
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
||||
#
|
||||
# Remove object and target files...
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS) `basename $(LIBCUPS) .2` libcups.dylib
|
||||
|
||||
|
||||
#
|
||||
# Update dependencies (without system header dependencies...)
|
||||
#
|
||||
|
||||
depend:
|
||||
makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
|
||||
|
||||
|
||||
#
|
||||
# Install object and target files...
|
||||
#
|
||||
|
||||
install: all installhdrs $(INSTALLSTATIC)
|
||||
$(INSTALL_DIR) -m 755 $(LIBDIR)
|
||||
$(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
|
||||
if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
|
||||
$(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
|
||||
$(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
|
||||
fi
|
||||
if test $(LIBCUPS) = "libcups.2.dylib"; then \
|
||||
$(STRIP) -x $(LIBDIR)/$(LIBCUPS); \
|
||||
$(RM) $(LIBDIR)/libcups.dylib; \
|
||||
$(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \
|
||||
fi
|
||||
|
||||
installstatic:
|
||||
$(INSTALL_DIR) -m 755 $(LIBDIR)
|
||||
if test $(LIBCUPS) != "libcups.a"; then \
|
||||
$(INSTALL_LIB) libcups.a $(LIBDIR); \
|
||||
$(RANLIB) $(LIBDIR)/libcups.a; \
|
||||
fi
|
||||
|
||||
installhdrs:
|
||||
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
|
||||
for file in $(HEADERS); do \
|
||||
$(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Uninstall object and target files...
|
||||
#
|
||||
|
||||
uninstall:
|
||||
$(RM) $(LIBDIR)/libcups.2.dylib
|
||||
$(RM) $(LIBDIR)/libcups.a
|
||||
$(RM) $(LIBDIR)/libcups.dylib
|
||||
$(RM) $(LIBDIR)/libcups_s.a
|
||||
$(RM) $(LIBDIR)/libcups.sl
|
||||
$(RM) $(LIBDIR)/libcups.sl.2
|
||||
$(RM) $(LIBDIR)/libcups.so
|
||||
$(RM) $(LIBDIR)/libcups.so.2
|
||||
-$(RMDIR) $(LIBDIR)
|
||||
for file in $(HEADERS); do \
|
||||
$(RM) $(INCLUDEDIR)/cups/$$file; \
|
||||
done
|
||||
-$(RMDIR) $(INCLUDEDIR)/cups
|
||||
|
||||
|
||||
#
|
||||
# libcups.so.2, libcups.sl.2
|
||||
#
|
||||
|
||||
libcups.so.2 libcups.sl.2: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(RM) `basename $@ .2`
|
||||
$(LN) $@ `basename $@ .2`
|
||||
|
||||
|
||||
#
|
||||
# libcups.2.dylib
|
||||
#
|
||||
|
||||
libcups.2.dylib: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(DSO) $(DSOFLAGS) -o $@ \
|
||||
-install_name $(libdir)/$@ \
|
||||
-current_version 2.7.0 \
|
||||
-compatibility_version 2.0.0 \
|
||||
$(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
$(RM) libcups.dylib
|
||||
$(LN) $@ libcups.dylib
|
||||
|
||||
|
||||
#
|
||||
# libcups_s.a
|
||||
#
|
||||
|
||||
libcups_s.a: $(LIBOBJS)
|
||||
echo Creating $@...
|
||||
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ libcups_s.o
|
||||
|
||||
|
||||
#
|
||||
# libcups.la
|
||||
#
|
||||
|
||||
libcups.la: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(CC) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
|
||||
-version-info 2:7 $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# libcups.a
|
||||
#
|
||||
|
||||
libcups.a: $(LIBOBJS)
|
||||
echo Archiving $@...
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# CUPS language bindings for various scripting languages...
|
||||
#
|
||||
# NOTE: Not currently used or functional - see the scripting/php directory
|
||||
# for the hand-written bindings...
|
||||
#
|
||||
|
||||
phpcups.so: $(LIBCUPS) php_cups_wrap.o
|
||||
echo Linking $@...
|
||||
if test `uname` = Darwin; then \
|
||||
DSOFLAGS="-bundle -flat_namespace -undefined suppress"; \
|
||||
else \
|
||||
DSOFLAGS="$(DSOFLAGS)"; \
|
||||
fi; \
|
||||
$(DSO) $$DSOFLAGS -o $@ php_cups_wrap.o $(LIBS) `php-config --ldflags --libs`
|
||||
|
||||
php_cups_wrap.o: php_cups_wrap.c
|
||||
echo Compiling $<...
|
||||
$(CC) $(CFLAGS) `php-config --includes` -c $<
|
||||
php_cups_wrap.c: cups.h
|
||||
echo Creating $< using SWIG...
|
||||
swig -php -o $@ -module cups cups.h
|
||||
|
||||
|
||||
#
|
||||
# testadmin (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testadmin: testadmin.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testadmin.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testarray (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testarray: testarray.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testarray.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testfile (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testfile: testfile.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testfile.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testhttp (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testhttp: testhttp.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testipp (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testipp: testipp.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testipp.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testi18n (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testi18n: testi18n.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testi18n.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testlang (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testlang: testlang.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testlang.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testppd (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testppd: testppd.o libcups.a
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \
|
||||
$(SSLLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# Automatic API help files...
|
||||
#
|
||||
|
||||
apihelp:
|
||||
echo Generating CUPS API help files...
|
||||
mxmldoc --section "Programming" --title "Array API" \
|
||||
--intro api-array.shtml \
|
||||
array.h array.c >../doc/help/api-array.html
|
||||
mxmldoc --section "Programming" --title "CUPS API" \
|
||||
--intro api-cups.shtml \
|
||||
cups.h dest.c getputfile.c language.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
util.c >../doc/help/api-cups.html
|
||||
mxmldoc --section "Programming" --title "File and Directory APIs" \
|
||||
--intro api-filedir.shtml \
|
||||
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
|
||||
mxmldoc --section "Programming" --title "PPD API" \
|
||||
--intro api-ppd.shtml \
|
||||
ppd.h attr.c emit.c mark.c page.c \
|
||||
ppd.c >../doc/help/api-ppd.html
|
||||
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
|
||||
--intro api-httpipp.shtml \
|
||||
http.h ipp.h auth.c encode.c http.c http-addr.c \
|
||||
http-support.c ipp.c ipp-support.c md5passwd.c \
|
||||
request.c >../doc/help/api-httpipp.html
|
||||
mxmldoc --section "Programming" --title "Filter and Backend APIs" \
|
||||
--intro api-filter.shtml \
|
||||
backchannel.c >../doc/help/api-filter.html
|
||||
|
||||
|
||||
#
|
||||
# Dependencies...
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
-1931
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Administration utility API definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
|
||||
* CHANGE AT ANY TIME. USE AT YOUR OWN RISK.
|
||||
*
|
||||
* Copyright 2001-2006 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 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_ADMINUTIL_H_
|
||||
# define _CUPS_ADMINUTIL_H_
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include "cups.h"
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_SERVER_DEBUG_LOGGING "_debug_logging"
|
||||
# define CUPS_SERVER_REMOTE_ADMIN "_remote_admin"
|
||||
# define CUPS_SERVER_REMOTE_PRINTERS "_remote_printers"
|
||||
# define CUPS_SERVER_SHARE_PRINTERS "_share_printers"
|
||||
# define CUPS_SERVER_USER_CANCEL_ANY "_user_cancel_any"
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern int cupsAdminExportSamba(const char *dest, const char *ppd,
|
||||
const char *samba_server,
|
||||
const char *samba_user,
|
||||
const char *samba_password,
|
||||
FILE *logfile);
|
||||
extern char *cupsAdminCreateWindowsPPD(http_t *http, const char *dest,
|
||||
char *buffer, int bufsize);
|
||||
|
||||
extern int _cupsAdminGetServerSettings(http_t *http,
|
||||
int *num_settings,
|
||||
cups_option_t **settings);
|
||||
extern int _cupsAdminSetServerSettings(http_t *http,
|
||||
int num_settings,
|
||||
cups_option_t *settings);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_ADMINUTIL_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,54 +0,0 @@
|
||||
<!--
|
||||
"$Id: api-array.shtml 5138 2006-02-21 10:49:06Z mike $"
|
||||
|
||||
Array API introduction for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 1997-2006 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 USA
|
||||
|
||||
Voice: (301) 373-9600
|
||||
EMail: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
-->
|
||||
|
||||
<h2 class='title'>Introduction</h2>
|
||||
|
||||
<p>The CUPS array API provides a high-performance generic array
|
||||
container. The contents of the array container can be sorted and
|
||||
the container itself is designed for optimal speed and memory
|
||||
usage under a wide variety of conditions.</p>
|
||||
|
||||
<p>The CUPS scheduler (<tt>cupsd</tt>) and many of the CUPS API
|
||||
functions use the array API to efficiently manage large lists of
|
||||
data.</p>
|
||||
|
||||
<h2 class='title'>General Usage</h2>
|
||||
|
||||
<p>The <var><cups/array.h></var> header file must be
|
||||
included to use the <tt>cupsArray</tt> functions.</p>
|
||||
|
||||
<p>Programs using these functions must be linked to the CUPS
|
||||
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
|
||||
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
|
||||
<var>libcups2.lib</var> depending on the platform. The following
|
||||
command compiles <var>myprogram.c</var> using GCC and the CUPS
|
||||
library:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
|
||||
</pre>
|
||||
|
||||
<h2 class='title'>Compatibility</h2>
|
||||
|
||||
<p>All of these functions require CUPS 1.2 or higher.</p>
|
||||
@@ -1,56 +0,0 @@
|
||||
<!--
|
||||
"$Id: api-cups.shtml 5138 2006-02-21 10:49:06Z mike $"
|
||||
|
||||
CUPS API introduction for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 1997-2006 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 USA
|
||||
|
||||
Voice: (301) 373-9600
|
||||
EMail: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
-->
|
||||
|
||||
<h2 class='title'>Introduction</h2>
|
||||
|
||||
<p>The CUPS library provides a whole collection of interfaces
|
||||
needed to support the internal needs of the CUPS software as well
|
||||
as the needs of applications, filters, printer drivers, and
|
||||
backends.</p>
|
||||
|
||||
<p>Unlike the rest of CUPS, the CUPS API library is provided
|
||||
under the GNU Library General Public License. This means that you
|
||||
can use the CUPS API library in both proprietary and open-source
|
||||
programs.</p>
|
||||
|
||||
<h2 class='title'>General Usage</h2>
|
||||
|
||||
<p>The <var><cups/cups.h></var> header file must be included to
|
||||
use the CUPS functions.</p>
|
||||
|
||||
<p>Programs using these functions must be linked to the CUPS
|
||||
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
|
||||
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
|
||||
<var>libcups2.lib</var> depending on the platform. The following
|
||||
command compiles <var>myprogram.c</var> using GCC and the CUPS
|
||||
library:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
|
||||
</pre>
|
||||
|
||||
<h2 class='title'>Compatibility</h2>
|
||||
|
||||
<p>Unless otherwise specified, the CUPS API functions require
|
||||
CUPS 1.1 or higher.</p>
|
||||
@@ -1,66 +0,0 @@
|
||||
<!--
|
||||
"$Id: api-filedir.shtml 5138 2006-02-21 10:49:06Z mike $"
|
||||
|
||||
File and directory API introduction for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 1997-2005 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 USA
|
||||
|
||||
Voice: (301) 373-9600
|
||||
EMail: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
-->
|
||||
|
||||
<h2 class='title'>Introduction</h2>
|
||||
|
||||
<p>The CUPS file and directory APIs provide portable interfaces
|
||||
for manipulating files and listing files and directories. Unlike
|
||||
stdio <tt>FILE</tt> streams, the <tt>cupsFile</tt> functions
|
||||
allow you to open more than 256 files at any given time. They
|
||||
also manage the platform-specific details of locking, large file
|
||||
support, line endings (CR, LF, or CR LF), and reading and writing
|
||||
files using Flate ("gzip") compression. Finally, you can also
|
||||
connect, read from, and write to network connections using the
|
||||
<tt>cupsFile</tt> functions.</p>
|
||||
|
||||
<p>The <tt>cupsDir</tt> functions manage the platform-specific
|
||||
details of directory access/listing and provide a convenient way
|
||||
to get both a list of files and the information (permissions,
|
||||
size, timestamp, etc.) for each of those files.</p>
|
||||
|
||||
<p>The CUPS scheduler (<tt>cupsd</tt>), <tt>mailto</tt> notifier,
|
||||
and many of the CUPS API functions use these functions for
|
||||
everything except console (stdin, stdout, stderr) I/O.</p>
|
||||
|
||||
<h2 class='title'>General Usage</h2>
|
||||
|
||||
<p>The <var><cups/dir.h></var> and
|
||||
<var><cups/file.h></var> header files must be included to
|
||||
use the <tt>cupsDir</tt> and <tt>cupsFile</tt> functions,
|
||||
respectively.</p>
|
||||
|
||||
<p>Programs using these functions must be linked to the CUPS
|
||||
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
|
||||
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
|
||||
<var>libcups2.lib</var> depending on the platform. The following
|
||||
command compiles <var>myprogram.c</var> using GCC and the CUPS
|
||||
library:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
|
||||
</pre>
|
||||
|
||||
<h2 class='title'>Compatibility</h2>
|
||||
|
||||
<p>All of these functions require CUPS 1.2 or higher.</p>
|
||||
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