[xorg-commit-diffs] xc/programs/Xserver/Xprint Xprint.html, NONE,
1.1.4.1 Xprint.man, NONE, 1.1.4.1 Xprint.sgml, NONE,
1.1.4.1 spooler.c, NONE, 1.1.4.1 spooler.h, NONE,
1.1.4.1 AttrValid.c, 1.1.4.2, 1.1.4.3 AttrValid.h, 1.1.4.2,
1.1.4.3 DiPrint.h, 1.1.4.2, 1.1.4.3 Imakefile, 1.1.4.5,
1.1.4.6 Init.c, 1.1.4.3, 1.1.4.4 Oid.c, 1.1.4.3, 1.1.4.4 Oid.h,
1.1.4.2, 1.1.4.3 OidDefs.h, 1.1, 1.1.4.1 OidStrs.h, 1.1.4.2,
1.1.4.3 attributes.c, 1.1.4.4, 1.1.4.5 attributes.h, 1.1.4.2,
1.1.4.3 ddxInit.c, 1.1.4.3, 1.1.4.4 mediaSizes.c, 1.1.4.2, 1.1.4.3
Roland Mainz
xorg-commit at pdx.freedesktop.org
Wed Apr 21 20:03:42 EST 2004
Committed by: gisburn
Update of /cvs/xorg/xc/programs/Xserver/Xprint
In directory pdx:/tmp/cvs-serv5532/programs/Xserver/Xprint
Modified Files:
Tag: XORG-CURRENT
AttrValid.c AttrValid.h DiPrint.h Imakefile Init.c Oid.c Oid.h
OidDefs.h OidStrs.h attributes.c attributes.h ddxInit.c
mediaSizes.c
Added Files:
Tag: XORG-CURRENT
Xprint.html Xprint.man Xprint.sgml spooler.c spooler.h
Log Message:
Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=530 - Land XPRINT branch on XORG-CURRENT
--- NEW FILE: Xprint.html ---
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Xprint</title><meta name="generator" content="DocBook XSL Stylesheets V1.62.4"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="Xprint"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>Xprint — The "X print service" - a portable, network-transparent printing system based on the X11 protocol</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p>Xprint is a very flexible, extensible, scaleable, client/server
print system based on ISO 10175 (and some other specs) and the X11
rendering protocol.
Using Xprint an application can search, query and use devices like
printers, FAX machines or create documents in formats like PDF.
In particular, an application can seek a printer, query supported
attributes (like paper size, trays, fonts etc.), configure the printer
device to match it’s needs and print on it like on any other X device
reusing parts of the code which is used for the video card Xserver.
</p></div><div xmlns:ns1="" class="refsect1" lang="en"><a name="id2802146"></a><h2>OVERVIEW</h2><p>
The "X Print Service" technology allows X rendering to devices such as
printers and fax. Most of the service is available in the X11
technology stack as Xp, with the remainder in single toolkit stacks (e.g. DtPrint for CDE).
Modifications have also been made to the LessTif/Motif/Qt technology
stacks to support Xprint.
</p><p>
The Xp portion consists of:
</p><div class="itemizedlist"><ul type="disc"><li><p>Xp Extension for the X-Server (included in the X-Server Xprt)</p></li><li><p>Xp Extension API for the client side (libXp/libXprintUtils)</p></li><li><p>PCL ddx driver that converts core X to native PCL</p></li><li><p>PDF ddx driver that converts core X to native PDF</p></li><li><p>PostScript ddx driver that converts core X to native PostScript</p></li><li><p>Raster ddx driver that generates xwd rasters which can be converted to PCL, PDF or PostScript rasters</p></li></ul></div><p>
From an X clients perspective, it can attach to one of two nearly
identical X-Servers, a "Video" X-Server, and a "Print" X-Server
which has the additional Xp capability but otherwise looks and
behaves the same.
</p></div><div xmlns:ns2="" class="refsect1" lang="en"><a name="id2804972"></a><h2>HOW THE X PRINT SERVICE WORKS</h2><p>
The X Print Service expands on the traditional X-Server and Xlib world
in four ways.
</p><div class="orderedlist"><ol type="1"><li><p>
Most obvious is the use of "print ddx drivers" instead of
"video ddx drivers". While a video ddx driver modifies pixels
in a video frame buffer, a print ddx driver generates "page
description language (PDL)" output (such as PCL, PDF or PostScript)
or sends the print rendering instructions to a platform-specific
print API (like Win32/GDI).
</p><p>
Once a print ddx driver generates PDL output, it can be sent to
a spooler such as <span class="citerefentry"><span class="refentrytitle">lp</span>(1)</span>
or retrieved by the client (to implement functionality like "print-to-file").
</p><p>
Though not currently done, a single X-Server can support both
print and video ddx drivers.
</p></li><li><p>
Since printers support "paged" output, unlike video, a portion
of the Xp Extension supports APIs to delineate printed output.
For example, <tt class="function">XpStartPage</tt> and <tt class="function">XpEndPage</tt> tell the X-Server where
a physical page starts and ends in an otherwise continuous
stream of X rendering primitives. Likewise, <tt class="function">XpStartJob</tt> and
<tt class="function">XpEndJob</tt> determine when a collection of pages starts and ends.
<tt class="function">XpEndJob</tt> typically causes the generated PDL to be submitted to
a spooler, such as <span class="citerefentry"><span class="refentrytitle">lp</span>(1)</span>.
</p></li><li><p>
Since printers have extensive capabilities, another portion of
the Xp Extension supports APIs to manipulate "print contexts".
</p><p>
Once a printer is selected using the Xp Extension API, a print
context to represent it can be created. A print context
embodies the printer selected - it contains the printer's
default capabilities, selectable range of capabilities,
printer state, and generated output. Some "attributes" within
the print context can be modified by the user, and the
X-Server and print ddx driver will react accordingly. For
example, the attribute "content-orientation" can be set to
"landscape" or "portrait" (if the printer supports these
values - which can be queried using the Xprint API as well).
</p></li><li><p>
Since printers can have "built in" fonts, the Xp Extension in
the X-Server works with the print ddx drivers to make
available (for printing only) additional fonts on a per print
context basis.
</p><p>
When a print context is created and set for a given printer,
the X font calls may be able to access additional printer
fonts. To do this (typically), the X-Server must have access
to "printer metric files" (.pmf) that describe at minimum the
metrics of the built in fonts.
</p></li></ol></div></div><div xmlns:ns3="" class="refsect1" lang="en"><a name="id2804885"></a><h2>USAGE</h2><p>
There are three tasks to start the X Print Service:
</p><div class="orderedlist"><ol type="1"><li><p>configuring the X Print Server,</p></li><li><p>starting the X Print Service</p></li><li><p>configuring the user session so that clients can find the running X Print Service</p></li></ol></div><p>
The tasks are described in detail below.
</p></div><div xmlns:ns4="" class="refsect1" lang="en"><a name="id2804911"></a><h2>SERVER CONFIGURATION</h2><p>
The X Print Server (Xprt) can read a number of configuration files which
control its behavior and support for printers. Each vendor platform has
a default location for this information. Xprt can also read the
environment variable <tt class="envar">XPCONFIGDIR</tt> to locate alternate configuration
directories. Common settings include:
</p><table class="simplelist" border="0" summary="Simple list"><tr><td>export XPCONFIGDIR=/X11/lib/X11/XpConfig/</td></tr><tr><td>export XPCONFIGDIR=/proj/x11/xc/programs/Xserver/XpConfig/</td></tr></table><p>
Xprt has many built-in defaults, and lacking any configuration files,
will immediately try to support all printers visible via <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span>.
</p><p>
In order of importance for configuration by a system administrator, the
configuration files for a "C" locale are as follows (see <span class="citerefentry"><span class="refentrytitle">Xprt</span>(1x)</span> for more
details (including support for non-"C" locales)):
</p><div class="variablelist"><dl><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/Xprinters</tt></span></dt><dd><p>
'Xprinters' is the top most configuration file. It tells
Xprt which specific printer names (e.g. mylaser) should
be supported, and whether <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> or other commands
should be used to automatically supplement the list of
printers.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/printer</tt></span></dt><dd><p>
The 'printer' file maps printer names to model
configurations (see 'model-config' below). For example,
"mylaser" could be mapped to a "HPDJ1600C", and all other
arbitrary printers could be mapped to a default, such as
"HPLJ4SI". When depending on <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> in the Xprinters
file, setting up defaults in 'printer' becomes all the
more important.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/document</tt></span></dt><dd><p>
The 'document' file specifies the initial document values
for any print jobs. For example, which paper tray to
use, what default resolution, etc.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/job</tt></span></dt><dd><p>
The 'job' file specifies the initial job values for any
print jobs. For example, "notification-profile" can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/model-config</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</tt></span></dt><dd><p>
The 'model-config' file has attributes that describe the
printer model’s capabilities and default settings.
Printer model fonts may also be present. The model-config
file also identifies the print ddx driver to be used.
For each printer model supported, a complete hierarchy of
files should exist. In most cases, these files do not
need to be modified.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</tt></span></dt><dd><p>
The print ddx drivers can have highly specific
configuration files to control their behavior. In most
cases, these files do not need to be modified.
</p></dd></dl></div><p>
More information in how to configure and customize the X print server can be found in the
<span class="citerefentry"><span class="refentrytitle">Xprt</span>(1x)</span>
manual page.
</p></div><div xmlns:ns5="" class="refsect1" lang="en"><a name="id2805644"></a><h2>STARTING UP</h2><p>
The summary checklist for starting the X Print Service is as follows:
</p><div class="orderedlist"><ol type="1"><li><p>
Choose an execution model for the X Print Service. The X
Print Service can be run on a per-user session basis, per
machine basis, or can be run on a few machines globally
available to a number of users.
</p></li><li><p>
If print jobs are to be submitted to a spooler (almost always
the case), make sure all needed printers are available to the
spooler subsystem (most often <span class="citerefentry"><span class="refentrytitle">lp</span>(1)</span>)
on the same machine running the X Print Service.
</p></li><li><p>
Configure the X Print Server. See ``X Print Server
Configuration''.
</p></li><li><p>
Depending on #1, start the X Print Server process "Xprt", and
then the toolkit-specific Print Dialog Manager Daemon process
(such as CDEnext's "dtpdmd") at the appropriate times.
Note that libXprintUtils-based applications/toolkits do not need
a Print Dialog Manager Daemon process to use Xprint.
</p></li></ol></div><p>
The details are described below.
</p><p>
Because the X Print Service is based on X, it can be easily distributed.
The most significant factors in which execution model to choose will be
driven by:
</p><div class="itemizedlist"><ul type="disc"><li><p>
how many printers will be accessable through the printer
subsystem on any given machine. A system administrator may
choose to cluster printers on a few given machines, or
scatter them across an organization and possibly make
extensive use of remote spoolers to make them globally
available.
</p></li><li><p>
how many machines will need a copy of the X Print Server
configuration files. The files have been architected so
that one super-set version of them can be maintained and
distributed (e.g. via NFS), and a per-machine or per-user
version of the `Xprinters' is all that is needed to have the
appropriate information in them utilized or ignored.
</p></li><li><p>
how many users can demand services from a given X Print
Service.
</p></li></ul></div><p>
With the above in mind, some obvious execution models include:
</p><div class="itemizedlist"><ul type="disc"><li><p>
Global - in this model, the system administrator is choosing
to run the X Print Service on a *few* select machines with
appropriate printers configured, and allow clients access to
the global resource. This can centralize the administration
of printers and configuration files, but may have to be
monitored for performance loading.
</p><p>
Startup would likely be done by boot-up scripts (such as <tt class="filename">/etc/init.d/xprint</tt>).
</p></li><li><p>
Per-machine - every machine with potential X Print Service
users would run the service. Printer and configuration file
administration is decentralized, and usage would be limited
to the users on the machine.
</p><p>
Startup would likely be done by boot-up scripts (such as <tt class="filename">/etc/init.d/xprint</tt>).
</p></li><li><p>
Per-user session - every user would run an entire X Print
Service for themselves. In the future, the Video X Server
normally started may contain Print X Server capability, so
this model becomes very natural.
</p><p>
Startup would likely be done at session login or by
launching actions or processes manually once the user
logs in. Note: Deamons like "dtpdmd" must be started after Xprt.
</p></li></ul></div><p>
Starting of the processes is straight forward. In strict order (example is for manually starting the X print server for CDEnext usage):
</p><div class="orderedlist"><ol type="1"><li><pre class="programlisting">[machineA] % Xprt [-XpFile Xprinters file] [:dispNum] </pre><p>
Note that Xprt will look for configuration files in either
a default location or where <tt class="envar">XPCONFIGDIR</tt> points.
</p><p><tt class="option">-XpFile</tt> specifies an alternate `Xprinters' file, rather
than the default one or `<tt class="filename">${XPCONFIGDIR}/C/print/Xprinters</tt>'.
</p></li><li><pre class="programlisting">[machineA] % dtpdmd -d machineA[:dispNum] [-l /tmp/dtpdmd.log] </pre><p>
The dtpdmd will maintain an X-Selection on the X-Server,
and will start dtpdm's as required to service requests.
</p></li></ol></div><p>
In all but the per-user session model, the machine running the dtpdmd
(thus dtpdm's) will need display authorization to the users video
display.
</p></div><div xmlns:ns6="" class="refsect1" lang="en"><a name="id2805858"></a><h2>CLIENT CONFIGURATION</h2><p>
Once a X Print Server and dtpdmd have been started -- many of them
in some cases -- clients will need to find and use them. There are
two mechanisms that allow clients to discover X Print Servers and
printers.
</p><div class="itemizedlist"><ul type="disc"><li><p>
"X Print Specifier" - assuming usage of the DtPrint/XprintUtils-based print
applications, the following notation is understood:
</p><pre class="programlisting">printer_name at machine[:dispNum]</pre><p>
For example:
</p><pre class="programlisting">colorlj7 at printhub:2</pre><p>
In the above example, the X Print Server running at `printhub:2'
is assumed to support the printer named `colorlj7'.
</p></li><li><p><tt class="envar">${XPSERVERLIST}</tt> - assuming usage of the DtPrint print dialogs,
the environment variable <tt class="envar">${XPSERVERLIST}</tt> can contain a list
of X Print Servers. For example:
</p><pre class="programlisting">XPSERVERLIST="printhub:2 printhub:3 otherdept:0"</pre><p>
Then in the dialogs, only a printer name needs to be entered.
The dialog will then search the X Print Servers in <tt class="envar">${XPSERVERLIST}</tt>
for a server than supports the printer, and then establish
contact.
</p></li></ul></div></div><div class="refsect1" lang="en"><a name="id2805927"></a><h2>END-USER SEQUENCE</h2><p>
From most CDEnext applications, printing is accomplished by bringing
down the File menu and selecting Print.... This will result in
the DtPrintSetupBox dialog, which will request the name of a printer,
and offer limited capability to configure print options (e.g. number
of copies). If the user wishes, they can select Setup..., which
will start a dtpdm capable of modifying additional print options.
Finally, the user should select Print.
</p></div><div class="refsect1" lang="en"><a name="id2805949"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl><dt><span class="term"><tt class="envar">${XPCONFIGDIR}</tt></span></dt><dd><p> This environment variable points to the root
of the Xprint server configuration directory hierarchy.
If the variable is not defined, the default
path is be assumed. The default path may be
<tt class="filename">/usr/X11R6/lib/X11/xserver/</tt>,
<tt class="filename">/usr/lib/X11/xserver/</tt>,
<tt class="filename">/usr/share/Xprint/xserver/</tt> or
<tt class="filename">/usr/openwin/server/etc/XpConfig</tt>, depending on the
system, and may be configured in <tt class="filename">/etc/init.d/xprint</tt>.</p></dd><dt><span class="term"><tt class="envar">${LANG}</tt></span></dt><dd><p>
This environment variable selects the locale settings used by the Xprint server.
Xprt allows language-specific settings (stored in <tt class="filename">${XPCONFIGDIR}/${LANG}/print/</tt>)
which will override the default settings (stored in <tt class="filename">${XPCONFIGDIR}/C/print/</tt>).
If <tt class="envar">${LANG}</tt> is not set "C" is assumed.
</p></dd><dt><span class="term"><tt class="envar">${XPSERVERLIST}</tt></span></dt><dd xmlns:ns7=""><p>The environment variable <tt class="envar">${XPSERVERLIST}</tt> contains a list
of display identifiers (separated by whitespace) which tell an
application where it can find the Xprint servers. Usually
<tt class="envar">${XPSERVERLIST}</tt> is set by the profile startup scripts (e.g.
<tt class="filename">/etc/profile</tt> or <tt class="filename">/etc/profile.d/xprint.sh</tt>) using the output of
<b class="userinput"><tt>/etc/init.d/xprint get_xpserverlist</tt></b>.</p><p>Example:
</p><div class="informalexample"><pre class="programlisting">
export XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"</pre></div><p>Alternatively <tt class="envar">${XPSERVERLIST}</tt> can be set
manually. Example:</p><div class="informalexample"><pre class="programlisting">
export XPSERVERLIST="littlecat:80 bitdog:72"</pre></div><p>
instructs an application to find an Xprint server at display
80 on the machine "littlecat" and at display 72 on the
machine bigdog.
</p></dd><dt><span class="term"><tt class="envar">${XPRINTER}</tt></span></dt><dd xmlns:ns8=""><p>The environment variable <tt class="envar">${XPRINTER}</tt>
defines the default printer used by print
applications. The syntax is either
<i class="replaceable"><tt>printername</tt></i> or
<i class="replaceable"><tt>printername</tt></i>@<i class="replaceable"><tt>display</tt></i>.</p><p>Examples:
</p><div class="variablelist"><dl><dt><span class="term"><b class="userinput"><tt>XPRINTER=ps003</tt></b></span></dt><dd><p>
tells an application to look for the
first printer named "ps003" on all Xprint
servers.</p></dd><dt><span class="term"><b class="userinput"><tt>XPRINTER=hplaser19 at littlecat:80</tt></b></span></dt><dd><p>
tells an application to use the printer "hplaser19"
on the Xprint server at display
"littlecat:80".</p></dd></dl></div><p>If <tt class="envar">${XPRINTER}</tt> is not set the applications
will examine the values of the <tt class="envar">${PDPRINTER}</tt>,
<tt class="envar">${LPDEST}</tt>, and
<tt class="envar">${PRINTER}</tt> environment variables (in that order).
</p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2806168"></a><h2>SEE ALSO</h2><p><span class="simplelist"><span class="citerefentry"><span class="refentrytitle">X11</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">xplsprinters</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xphelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxmhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpawhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxthelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpsimplehelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">Xprt</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">libXp</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintAppUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XmPrintShell</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XawPrintShell</span>(3x)</span>, Xprint FAQ (<a href="http://xprint.mozdev.org/docs/Xprint_FAQ.html" target="_top">http://xprint.mozdev.org/docs/Xprint_FAQ.html</a>), Xprint main site (<a href="http://xprint.mozdev.org/" target="_top">http://xprint.mozdev.org/</a>)</span></p></div><div class="refsect1" lang="en"><a name="id2806331"></a><h2>AUTHORS</h2><p>
This manual page was written by
Roland Mainz <tt class="email"><<a href="mailto:roland.mainz at nrubsig.org">roland.mainz at nrubsig.org</a>></tt> based on the original X11R6.6
<tt class="filename">xc/programs/Xserver/XpConfig/README</tt>.
</p></div></div></body></html>
--- NEW FILE: Xprint.man ---
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve at ggi-project.org>.
.TH "Xprint" "__miscmansuffix__" "13 February 2004" "" ""
.SH NAME
Xprint \- The \&"X print service\&" - a portable, network-transparent printing system based on the X11 protocol
.SH SYNOPSIS
.PP
Xprint is a very flexible, extensible, scaleable, client/server
print system based on ISO 10175 (and some other specs) and the X11
rendering protocol.
Using Xprint an application can search, query and use devices like
printers, FAX machines or create documents in formats like PDF.
In particular, an application can seek a printer, query supported
attributes (like paper size, trays, fonts etc.), configure the printer
device to match its needs and print on it like on any other X device
reusing parts of the code which is used for the video card Xserver.
.SH "OVERVIEW"
.PP
The "X Print Service" technology allows X rendering to devices such as
printers and fax. Most of the service is available in the X11
technology stack as Xp, with the remainder in single toolkit stacks (e.g. DtPrint for CDE).
Modifications have also been made to the LessTif/Motif/Qt technology
stacks to support Xprint.
.PP
The Xp portion consists of:
.TP 0.2i
\(bu
Xp Extension for the X-Server (included in the X-Server Xprt)
.TP 0.2i
\(bu
Xp Extension API for the client side (libXp/libXprintUtils)
.TP 0.2i
\(bu
PCL ddx driver that converts core X to native PCL
.TP 0.2i
\(bu
PDF ddx driver that converts core X to native PDF
.TP 0.2i
\(bu
PostScript ddx driver that converts core X to native PostScript
.TP 0.2i
\(bu
Raster ddx driver that generates xwd rasters which can be converted to PCL, PDF or PostScript rasters
.PP
>From an X clients perspective, it can attach to one of two nearly
identical X-Servers, a "Video" X-Server, and a "Print" X-Server
which has the additional Xp capability but otherwise looks and
behaves the same.
.SH "HOW THE X PRINT SERVICE WORKS"
.PP
The X Print Service expands on the traditional X-Server and Xlib world
in four ways.
.TP 1.
Most obvious is the use of "print ddx drivers" instead of
"video ddx drivers". While a video ddx driver modifies pixels
in a video frame buffer, a print ddx driver generates "page
description language (PDL)" output (such as PCL, PDF or PostScript)
or sends the print rendering instructions to a platform-specific
print API (like Win32/GDI).
Once a print ddx driver generates PDL output, it can be sent to
a spooler such as \fBlp\fR(1)
or retrieved by the client (to implement functionality like "print-to-file").
Though not currently done, a single X-Server can support both
print and video ddx drivers.
.TP 2.
Since printers support "paged" output, unlike video, a portion
of the Xp Extension supports APIs to delineate printed output.
For example, \fBXpStartPage\fR and \fBXpEndPage\fR tell the X-Server where
a physical page starts and ends in an otherwise continuous
stream of X rendering primitives. Likewise, \fBXpStartJob\fR and
\fBXpEndJob\fR determine when a collection of pages starts and ends.
\fBXpEndJob\fR typically causes the generated PDL to be submitted to
a spooler, such as \fBlp\fR(1).
.TP 3.
Since printers have extensive capabilities, another portion of
the Xp Extension supports APIs to manipulate "print contexts".
Once a printer is selected using the Xp Extension API, a print
context to represent it can be created. A print context
embodies the printer selected - it contains the printer's
default capabilities, selectable range of capabilities,
printer state, and generated output. Some "attributes" within
the print context can be modified by the user, and the
X-Server and print ddx driver will react accordingly. For
example, the attribute "content-orientation" can be set to
"landscape" or "portrait" (if the printer supports these
values - which can be queried using the Xprint API as well).
.TP 4.
Since printers can have "built in" fonts, the Xp Extension in
the X-Server works with the print ddx drivers to make
available (for printing only) additional fonts on a per print
context basis.
When a print context is created and set for a given printer,
the X font calls may be able to access additional printer
fonts. To do this (typically), the X-Server must have access
to "printer metric files" (.pmf) that describe at minimum the
metrics of the built in fonts.
.SH "USAGE"
.PP
There are three tasks to start the X Print Service:
.TP 1.
configuring the X Print Server,
.TP 2.
starting the X Print Service
.TP 3.
configuring the user session so that clients can find the running X Print Service
.PP
The tasks are described in detail below.
.SH "SERVER CONFIGURATION"
.PP
The X Print Server (Xprt) can read a number of configuration files which
control its behavior and support for printers. Each vendor platform has
a default location for this information. Xprt can also read the
environment variable \fBXPCONFIGDIR\fR to locate alternate configuration
directories. Common settings include:
export XPCONFIGDIR=/X11/lib/X11/XpConfig/
export XPCONFIGDIR=/proj/x11/xc/programs/Xserver/XpConfig/
.PP
Xprt has many built-in defaults, and lacking any configuration files,
will immediately try to support all printers visible via \fBlpstat\fR(1).
.PP
In order of importance for configuration by a system administrator, the
configuration files for a "C" locale are as follows (see \fBXprt\fR(__mansuffix__) for more
details (including support for non-"C" locales)):
.TP
\fB\fI${XPCONFIGDIR}/C/print/Xprinters\fB\fR
\&'Xprinters' is the top most configuration file. It tells
Xprt which specific printer names (e.g. mylaser) should
be supported, and whether \fBlpstat\fR(1) or other commands
should be used to automatically supplement the list of
printers.
.TP
\fB\fI${XPCONFIGDIR}/C/print/attributes/printer\fB\fR
The 'printer' file maps printer names to model
configurations (see 'model-config' below). For example,
"mylaser" could be mapped to a "HPDJ1600C", and all other
arbitrary printers could be mapped to a default, such as
"HPLJ4SI". When depending on \fBlpstat\fR(1) in the Xprinters
file, setting up defaults in 'printer' becomes all the
more important.
.TP
\fB\fI${XPCONFIGDIR}/C/print/attributes/document\fB\fR
The 'document' file specifies the initial document values
for any print jobs. For example, which paper tray to
use, what default resolution, etc.
.TP
\fB\fI${XPCONFIGDIR}/C/print/attributes/job\fB\fR
The 'job' file specifies the initial job values for any
print jobs. For example, "notification-profile" can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.
.TP
\fB\fI${XPCONFIGDIR}/C/print/models/PSdefault/model-config\fB\fR
.TP
\fB\fI${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir\fB\fR
.TP
\fB\fI${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf\fB\fR
.TP
\fB\fI${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf\fB\fR
The 'model-config' file has attributes that describe the
printer models capabilities and default settings.
Printer model fonts may also be present. The model-config
file also identifies the print ddx driver to be used.
For each printer model supported, a complete hierarchy of
files should exist. In most cases, these files do not
need to be modified.
.TP
\fB\fI${XPCONFIGDIR}/C/print/ddx-config/raster/pcl\fB\fR
.TP
\fB\fI${XPCONFIGDIR}/C/print/ddx-config/raster/pdf\fB\fR
.TP
\fB\fI${XPCONFIGDIR}/C/print/ddx-config/raster/postscript\fB\fR
The print ddx drivers can have highly specific
configuration files to control their behavior. In most
cases, these files do not need to be modified.
More information in how to configure and customize the X print server can be found in the
\fBXprt\fR(__mansuffix__)
manual page.
.SH "STARTING UP"
.PP
The summary checklist for starting the X Print Service is as follows:
.TP 1.
Choose an execution model for the X Print Service. The X
Print Service can be run on a per-user session basis, per
machine basis, or can be run on a few machines globally
available to a number of users.
.TP 2.
If print jobs are to be submitted to a spooler (almost always
the case), make sure all needed printers are available to the
spooler subsystem (most often \fBlp\fR(1))
on the same machine running the X Print Service.
.TP 3.
Configure the X Print Server. See ``X Print Server
Configuration''.
.TP 4.
Depending on #1, start the X Print Server process "Xprt", and
then the toolkit-specific Print Dialog Manager Daemon process
(such as CDEnext's "dtpdmd") at the appropriate times.
Note that libXprintUtils-based applications/toolkits do not need
a Print Dialog Manager Daemon process to use Xprint.
The details are described below.
.PP
Because the X Print Service is based on X, it can be easily distributed.
The most significant factors in which execution model to choose will be
driven by:
.TP 0.2i
\(bu
how many printers will be accessable through the printer
subsystem on any given machine. A system administrator may
choose to cluster printers on a few given machines, or
scatter them across an organization and possibly make
extensive use of remote spoolers to make them globally
available.
.TP 0.2i
\(bu
how many machines will need a copy of the X Print Server
configuration files. The files have been architected so
that one super-set version of them can be maintained and
distributed (e.g. via NFS), and a per-machine or per-user
version of the `Xprinters' is all that is needed to have the
appropriate information in them utilized or ignored.
.TP 0.2i
\(bu
how many users can demand services from a given X Print
Service.
With the above in mind, some obvious execution models include:
.TP 0.2i
\(bu
Global - in this model, the system administrator is choosing
to run the X Print Service on a *few* select machines with
appropriate printers configured, and allow clients access to
the global resource. This can centralize the administration
of printers and configuration files, but may have to be
monitored for performance loading.
Startup would likely be done by boot-up scripts (such as \fI/etc/init.d/xprint\fR).
.TP 0.2i
\(bu
Per-machine - every machine with potential X Print Service
users would run the service. Printer and configuration file
administration is decentralized, and usage would be limited
to the users on the machine.
Startup would likely be done by boot-up scripts (such as \fI/etc/init.d/xprint\fR).
.TP 0.2i
\(bu
Per-user session - every user would run an entire X Print
Service for themselves. In the future, the Video X Server
normally started may contain Print X Server capability, so
this model becomes very natural.
Startup would likely be done at session login or by
launching actions or processes manually once the user
logs in. Note: Deamons like "dtpdmd" must be started after Xprt.
.PP
Starting of the processes is straight forward. In strict order (example is for manually starting the X print server for CDEnext usage):
.TP 1.
.nf
[machineA] % Xprt [-XpFile Xprinters file] [:dispNum]
.fi
Note that Xprt will look for configuration files in either
a default location or where \fBXPCONFIGDIR\fR points.
\fB-XpFile\fR specifies an alternate `Xprinters' file, rather
than the default one or `\fI${XPCONFIGDIR}/C/print/Xprinters\fR'.
.TP 2.
.nf
[machineA] % dtpdmd -d machineA[:dispNum] [-l /tmp/dtpdmd.log]
.fi
The dtpdmd will maintain an X-Selection on the X-Server,
and will start dtpdm's as required to service requests.
.PP
In all but the per-user session model, the machine running the dtpdmd
(thus dtpdm's) will need display authorization to the users video
display.
.SH "CLIENT CONFIGURATION"
.PP
Once a X Print Server and dtpdmd have been started -- many of them
in some cases -- clients will need to find and use them. There are
two mechanisms that allow clients to discover X Print Servers and
printers.
.TP 0.2i
\(bu
"X Print Specifier" - assuming usage of the DtPrint/XprintUtils-based print
applications, the following notation is understood:
.nf
printer_name at machine[:dispNum]
.fi
For example:
.nf
colorlj7 at printhub:2
.fi
In the above example, the X Print Server running at `printhub:2'
is assumed to support the printer named `colorlj7'.
.TP 0.2i
\(bu
\fB${XPSERVERLIST}\fR - assuming usage of the DtPrint print dialogs,
the environment variable \fB${XPSERVERLIST}\fR can contain a list
of X Print Servers. For example:
.nf
XPSERVERLIST="printhub:2 printhub:3 otherdept:0"
.fi
Then in the dialogs, only a printer name needs to be entered.
The dialog will then search the X Print Servers in \fB${XPSERVERLIST}\fR
for a server than supports the printer, and then establish
contact.
.SH "END-USER SEQUENCE"
.PP
>From most CDEnext applications, printing is accomplished by bringing
down the File menu and selecting Print.... This will result in
the DtPrintSetupBox dialog, which will request the name of a printer,
and offer limited capability to configure print options (e.g. number
of copies). If the user wishes, they can select Setup..., which
will start a dtpdm capable of modifying additional print options.
Finally, the user should select Print.
.SH "ENVIRONMENT"
.TP
\fB${XPCONFIGDIR}\fR
This environment variable points to the root
of the Xprint server configuration directory hierarchy.
If the variable is not defined, the default
path is be assumed. The default path may be
\fI/usr/X11R6/lib/X11/xserver/\fR,
\fI/usr/lib/X11/xserver/\fR,
\fI/usr/share/Xprint/xserver/\fR or
\fI/usr/openwin/server/etc/XpConfig\fR, depending on the
system, and may be configured in \fI/etc/init.d/xprint\fR.
.TP
\fB${LANG}\fR
This environment variable selects the locale settings used by the Xprint server.
Xprt allows language-specific settings (stored in \fI${XPCONFIGDIR}/${LANG}/print/\fR)
which will override the default settings (stored in \fI${XPCONFIGDIR}/C/print/\fR).
If \fB${LANG}\fR is not set "C" is assumed.
.TP
\fB${XPSERVERLIST}\fR
The environment variable \fB${XPSERVERLIST}\fR contains a list
of display identifiers (separated by whitespace) which tell an
application where it can find the Xprint servers. Usually
\fB${XPSERVERLIST}\fR is set by the profile startup scripts (e.g.
\fI/etc/profile\fR or \fI/etc/profile.d/xprint.sh\fR) using the output of
\fB/etc/init.d/xprint get_xpserverlist\fR.
Example:
.PP
.nf
export XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"
.fi
Alternatively \fB${XPSERVERLIST}\fR can be set
manually. Example:
.nf
export XPSERVERLIST="littlecat:80 bitdog:72"
.fi
instructs an application to find an Xprint server at display
80 on the machine "littlecat" and at display 72 on the
machine bigdog.
.TP
\fB${XPRINTER} \fR
The environment variable \fB${XPRINTER}\fR
defines the default printer used by print
applications. The syntax is either
\fIprintername\fR or
\fIprintername\fR@\fIdisplay\fR.
Examples:
.RS
.TP
\fBXPRINTER=ps003\fR
tells an application to look for the
first printer named "ps003" on all Xprint
servers.
.TP
\fBXPRINTER=hplaser19 at littlecat:80\fR
tells an application to use the printer "hplaser19"
on the Xprint server at display
"littlecat:80".
.RE
If \fB${XPRINTER}\fR is not set the applications
will examine the values of the \fB${PDPRINTER}\fR,
\fB${LPDEST}\fR, and
\fB${PRINTER}\fR environment variables (in that order).
.SH "SEE ALSO"
.PP
\fBX11\fR(__miscmansuffix__), \fBxplsprinters\fR(__mansuffix__), \fBxphelloworld\fR(__mansuffix__), \fBxpxmhelloworld\fR(__mansuffix__), \fBxpawhelloworld\fR(__mansuffix__), \fBxpxthelloworld\fR(__mansuffix__), \fBxpsimplehelloworld\fR(__mansuffix__), \fBXserver\fR(__mansuffix__), \fBXprt\fR(__mansuffix__), \fBlibXp\fR(__libmansuffix__), \fBlibXprintUtils\fR(__libmansuffix__), \fBlibXprintAppUtils\fR(__libmansuffix__), \fBXmPrintShell\fR(__libmansuffix__), \fBXawPrintShell\fR(__libmansuffix__), Xprint FAQ (http://xprint.mozdev.org/docs/Xprint_FAQ.html <URL:http://xprint.mozdev.org/docs/Xprint_FAQ.html>), Xprint main site (http://xprint.mozdev.org/ <URL:http://xprint.mozdev.org/>)
.SH "AUTHORS"
.PP
This manual page was written by
Roland Mainz <roland.mainz at nrubsig.org> based on the original X11R6.6
\fIxc/programs/Xserver/XpConfig/README\fR.
--- NEW FILE: Xprint.sgml ---
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" '/usr/share/sgml/docbook_4.2/docbook.dtd'>
<!-- Process this file with docbook-to-man to generate an nroff manual
page: 'docbook-to-man manpage.sgml > manpage.1'. You may view
the manual page with: 'docbook-to-man manpage.sgml | nroff -man | less'.
A typical entry in a Makefile or Makefile.am is:
manpage.1: manpage.sgml
docbook-to-man $< > $@
HTML generation can be done like this:
% xsltproc ==docbook /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.60.1/html/docbook.xsl Xprint.sgml >Xprint.html
-->
<refentry id="Xprint">
<refmeta>
<refentrytitle>Xprint</refentrytitle>
<manvolnum>__miscmansuffix__</manvolnum>
</refmeta>
<refnamediv>
<refname>Xprint</refname>
<refpurpose>The "X print service" - a portable, network-transparent printing system based on the X11 protocol</refpurpose>
</refnamediv>
<refsynopsisdiv>
<para>Xprint is a very flexible, extensible, scaleable, client/server
print system based on ISO 10175 (and some other specs) and the X11
rendering protocol.
Using Xprint an application can search, query and use devices like
printers, FAX machines or create documents in formats like PDF.
In particular, an application can seek a printer, query supported
attributes (like paper size, trays, fonts etc.), configure the printer
device to match it’s needs and print on it like on any other X device
reusing parts of the code which is used for the video card Xserver.
</para>
</refsynopsisdiv>
<refsect1>
<title>OVERVIEW</title>
<para>
The "X Print Service" technology allows X rendering to devices such as
printers and fax. Most of the service is available in the X11
technology stack as Xp, with the remainder in single toolkit stacks (e.g. DtPrint for CDE).
Modifications have also been made to the LessTif/Motif/Qt technology
stacks to support Xprint.
</para>
<para>
The Xp portion consists of:
<itemizedlist>
<listitem><para>Xp Extension for the X-Server (included in the X-Server Xprt)</para></listitem>
<listitem><para>Xp Extension API for the client side (libXp/libXprintUtils)</para></listitem>
<listitem><para>PCL ddx driver that converts core X to native PCL</para></listitem>
<listitem><para>PDF ddx driver that converts core X to native PDF</para></listitem>
<listitem><para>PostScript ddx driver that converts core X to native PostScript</para></listitem>
<listitem><para>Raster ddx driver that generates xwd rasters which can be converted to PCL, PDF or PostScript rasters</para></listitem>
</itemizedlist>
</para>
<para>
From an X clients perspective, it can attach to one of two nearly
identical X-Servers, a "Video" X-Server, and a "Print" X-Server
which has the additional Xp capability but otherwise looks and
behaves the same.
</para>
</refsect1>
<refsect1>
<title>HOW THE X PRINT SERVICE WORKS</title>
<para>
The X Print Service expands on the traditional X-Server and Xlib world
in four ways.
<orderedlist>
<listitem>
<para>
Most obvious is the use of "print ddx drivers" instead of
"video ddx drivers". While a video ddx driver modifies pixels
in a video frame buffer, a print ddx driver generates "page
description language (PDL)" output (such as PCL, PDF or PostScript)
or sends the print rendering instructions to a platform-specific
print API (like Win32/GDI).
</para>
<para>
Once a print ddx driver generates PDL output, it can be sent to
a spooler such as <citerefentry><refentrytitle>lp</refentrytitle><manvolnum>1</manvolnum></citerefentry>
or retrieved by the client (to implement functionality like "print-to-file").
</para>
<para>
Though not currently done, a single X-Server can support both
print and video ddx drivers.
<!-- FIXME: IBM/AIX people have integrated Xprt into their main Xserver (currently experimental) ... -->
</para>
</listitem>
<listitem>
<para>
Since printers support "paged" output, unlike video, a portion
of the Xp Extension supports APIs to delineate printed output.
For example, <function>XpStartPage</function> and <function>XpEndPage</function> tell the X-Server where
a physical page starts and ends in an otherwise continuous
stream of X rendering primitives. Likewise, <function>XpStartJob</function> and
<function>XpEndJob</function> determine when a collection of pages starts and ends.
<function>XpEndJob</function> typically causes the generated PDL to be submitted to
a spooler, such as <citerefentry><refentrytitle>lp</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
</listitem>
<listitem>
<para>
Since printers have extensive capabilities, another portion of
the Xp Extension supports APIs to manipulate "print contexts".
</para>
<para>
Once a printer is selected using the Xp Extension API, a print
context to represent it can be created. A print context
embodies the printer selected - it contains the printer's
default capabilities, selectable range of capabilities,
printer state, and generated output. Some "attributes" within
the print context can be modified by the user, and the
X-Server and print ddx driver will react accordingly. For
example, the attribute "content-orientation" can be set to
"landscape" or "portrait" (if the printer supports these
values - which can be queried using the Xprint API as well).
</para>
</listitem>
<listitem>
<para>
Since printers can have "built in" fonts, the Xp Extension in
the X-Server works with the print ddx drivers to make
available (for printing only) additional fonts on a per print
context basis.
</para>
<para>
When a print context is created and set for a given printer,
the X font calls may be able to access additional printer
fonts. To do this (typically), the X-Server must have access
to "printer metric files" (.pmf) that describe at minimum the
metrics of the built in fonts.
</para>
</listitem>
</orderedlist>
</para>
</refsect1>
<refsect1>
<title>USAGE</title>
<para>
There are three tasks to start the X Print Service:
<orderedlist>
<listitem><para>configuring the X Print Server,</para></listitem>
<listitem><para>starting the X Print Service</para></listitem>
<listitem><para>configuring the user session so that clients can find the running X Print Service</para></listitem>
</orderedlist>
</para>
<para>
The tasks are described in detail below.
</para>
</refsect1>
<refsect1>
<title>SERVER CONFIGURATION</title>
<para>
The X Print Server (Xprt) can read a number of configuration files which
control its behavior and support for printers. Each vendor platform has
a default location for this information. Xprt can also read the
environment variable <envar>XPCONFIGDIR</envar> to locate alternate configuration
directories. Common settings include:
<simplelist type="vert">
<member>export XPCONFIGDIR=/X11/lib/X11/XpConfig/</member>
<member>export XPCONFIGDIR=/proj/x11/xc/programs/Xserver/XpConfig/</member>
</simplelist>
</para>
<para>
Xprt has many built-in defaults, and lacking any configuration files,
will immediately try to support all printers visible via <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
<para>
In order of importance for configuration by a system administrator, the
configuration files for a "C" locale are as follows (see <citerefentry><refentrytitle>Xprt</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry> for more
details (including support for non-"C" locales)):
<variablelist>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/Xprinters</filename></term>
<listitem>
<para>
'Xprinters' is the top most configuration file. It tells
Xprt which specific printer names (e.g. mylaser) should
be supported, and whether <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> or other commands
should be used to automatically supplement the list of
printers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/attributes/printer</filename></term>
<listitem>
<para>
The 'printer' file maps printer names to model
configurations (see 'model-config' below). For example,
"mylaser" could be mapped to a "HPDJ1600C", and all other
arbitrary printers could be mapped to a default, such as
"HPLJ4SI". When depending on <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> in the Xprinters
file, setting up defaults in 'printer' becomes all the
more important.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/attributes/document</filename></term>
<listitem>
<para>
The 'document' file specifies the initial document values
for any print jobs. For example, which paper tray to
use, what default resolution, etc.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/attributes/job</filename></term>
<listitem>
<para>
The 'job' file specifies the initial job values for any
print jobs. For example, "notification-profile" can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/model-config</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</filename></term>
<listitem>
<para>
The 'model-config' file has attributes that describe the
printer model’s capabilities and default settings.
Printer model fonts may also be present. The model-config
file also identifies the print ddx driver to be used.
For each printer model supported, a complete hierarchy of
files should exist. In most cases, these files do not
need to be modified.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</filename></term>
<listitem>
<para>
The print ddx drivers can have highly specific
configuration files to control their behavior. In most
cases, these files do not need to be modified.
</para>
</listitem>
</varlistentry>
</variablelist>
More information in how to configure and customize the X print server can be found in the
<citerefentry><refentrytitle>Xprt</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry>
manual page.
</para>
</refsect1>
<refsect1>
<title>STARTING UP</title>
<para>
The summary checklist for starting the X Print Service is as follows:
<orderedlist>
<listitem>
<para>
Choose an execution model for the X Print Service. The X
Print Service can be run on a per-user session basis, per
machine basis, or can be run on a few machines globally
available to a number of users.
</para>
</listitem>
<listitem>
<para>
If print jobs are to be submitted to a spooler (almost always
the case), make sure all needed printers are available to the
spooler subsystem (most often <citerefentry><refentrytitle>lp</refentrytitle><manvolnum>1</manvolnum></citerefentry>)
on the same machine running the X Print Service.
</para>
</listitem>
<listitem>
<para>
Configure the X Print Server. See ``X Print Server
Configuration''.
</para>
</listitem>
<listitem>
<para>
Depending on #1, start the X Print Server process "Xprt", and
then the toolkit-specific Print Dialog Manager Daemon process
(such as CDEnext's "dtpdmd") at the appropriate times.
Note that libXprintUtils-based applications/toolkits do not need
a Print Dialog Manager Daemon process to use Xprint.
</para>
</listitem>
</orderedlist>
The details are described below.
</para>
<para>
Because the X Print Service is based on X, it can be easily distributed.
The most significant factors in which execution model to choose will be
driven by:
<itemizedlist>
<listitem>
<para>
how many printers will be accessable through the printer
subsystem on any given machine. A system administrator may
choose to cluster printers on a few given machines, or
scatter them across an organization and possibly make
extensive use of remote spoolers to make them globally
available.
</para>
</listitem>
<listitem>
<para>
how many machines will need a copy of the X Print Server
configuration files. The files have been architected so
that one super-set version of them can be maintained and
distributed (e.g. via NFS), and a per-machine or per-user
version of the `Xprinters' is all that is needed to have the
appropriate information in them utilized or ignored.
</para>
</listitem>
<listitem>
<para>
how many users can demand services from a given X Print
Service.
</para>
</listitem>
</itemizedlist>
With the above in mind, some obvious execution models include:
<itemizedlist>
<listitem>
<para>
Global - in this model, the system administrator is choosing
to run the X Print Service on a *few* select machines with
appropriate printers configured, and allow clients access to
the global resource. This can centralize the administration
of printers and configuration files, but may have to be
monitored for performance loading.
</para>
<para>
Startup would likely be done by boot-up scripts (such as <filename>/etc/init.d/xprint</filename>).
</para>
</listitem>
<listitem>
<para>
Per-machine - every machine with potential X Print Service
users would run the service. Printer and configuration file
administration is decentralized, and usage would be limited
to the users on the machine.
</para>
<para>
Startup would likely be done by boot-up scripts (such as <filename>/etc/init.d/xprint</filename>).
</para>
</listitem>
<listitem>
<para>
Per-user session - every user would run an entire X Print
Service for themselves. In the future, the Video X Server
normally started may contain Print X Server capability, so
this model becomes very natural.
</para>
<para>
Startup would likely be done at session login or by
launching actions or processes manually once the user
logs in. Note: Deamons like "dtpdmd" must be started after Xprt.
</para>
</listitem>
</itemizedlist>
</para>
<para>
Starting of the processes is straight forward. In strict order (example is for manually starting the X print server for CDEnext usage):
<orderedlist>
<listitem>
<para>
<programlisting>[machineA] % Xprt [-XpFile <Xprinters file>] [:dispNum] &</programlisting>
</para>
<para>
Note that Xprt will look for configuration files in either
a default location or where <envar>XPCONFIGDIR</envar> points.
</para>
<para>
<option>-XpFile</option> specifies an alternate `Xprinters' file, rather
than the default one or `<filename>${XPCONFIGDIR}/C/print/Xprinters</filename>'.
</para>
</listitem>
<listitem>
<para>
<programlisting>[machineA] % dtpdmd -d machineA[:dispNum] [-l /tmp/dtpdmd.log] &</programlisting>
</para>
<para>
The dtpdmd will maintain an X-Selection on the X-Server,
and will start dtpdm's as required to service requests.
</para>
</listitem>
</orderedlist>
</para>
<para>
In all but the per-user session model, the machine running the dtpdmd
(thus dtpdm's) will need display authorization to the users video
display.
</para>
</refsect1>
<refsect1>
<title>CLIENT CONFIGURATION</title>
<para>
Once a X Print Server and dtpdmd have been started -- many of them
in some cases -- clients will need to find and use them. There are
two mechanisms that allow clients to discover X Print Servers and
printers.
<itemizedlist>
<listitem>
<para>
"X Print Specifier" - assuming usage of the DtPrint/XprintUtils-based print
applications, the following notation is understood:
</para>
<para>
<programlisting>printer_name at machine[:dispNum]</programlisting>
</para>
<para>
For example:
</para>
<para>
<programlisting>colorlj7 at printhub:2</programlisting>
</para>
<para>
In the above example, the X Print Server running at `printhub:2'
is assumed to support the printer named `colorlj7'.
</para>
</listitem>
<listitem>
<para>
<envar>${XPSERVERLIST}</envar> - assuming usage of the DtPrint print dialogs,
the environment variable <envar>${XPSERVERLIST}</envar> can contain a list
of X Print Servers. For example:
</para>
<para>
<programlisting>XPSERVERLIST="printhub:2 printhub:3 otherdept:0"</programlisting>
</para>
<para>
Then in the dialogs, only a printer name needs to be entered.
The dialog will then search the X Print Servers in <envar>${XPSERVERLIST}</envar>
for a server than supports the printer, and then establish
contact.
</para>
</listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1>
<title>END-USER SEQUENCE</title>
<para>
From most CDEnext applications, printing is accomplished by bringing
down the <File> menu and selecting <Print...>. This will result in
the DtPrintSetupBox dialog, which will request the name of a printer,
and offer limited capability to configure print options (e.g. number
of copies). If the user wishes, they can select <Setup...>, which
will start a dtpdm capable of modifying additional print options.
Finally, the user should select <Print>.
</para>
</refsect1>
<refsect1>
<title>ENVIRONMENT</title>
<variablelist>
<varlistentry>
<term><envar>${XPCONFIGDIR}</envar></term>
<listitem>
<para> This environment variable points to the root
of the Xprint server configuration directory hierarchy.
If the variable is not defined, the default
path is be assumed. The default path may be
<filename>/usr/X11R6/lib/X11/xserver/</filename>,
<filename>/usr/lib/X11/xserver/</filename>,
<filename>/usr/share/Xprint/xserver/</filename> or
<filename>/usr/openwin/server/etc/XpConfig</filename>, depending on the
system, and may be configured in <filename>/etc/init.d/xprint</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>${LANG}</envar></term>
<listitem>
<para>
This environment variable selects the locale settings used by the Xprint server.
Xprt allows language-specific settings (stored in <filename>${XPCONFIGDIR}/${LANG}/print/</filename>)
which will override the default settings (stored in <filename>${XPCONFIGDIR}/C/print/</filename>).
If <envar>${LANG}</envar> is not set "C" is assumed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>${XPSERVERLIST}</envar></term>
<listitem>
<para>The environment variable <envar>${XPSERVERLIST}</envar> contains a list
of display identifiers (separated by whitespace) which tell an
application where it can find the Xprint servers. Usually
<envar>${XPSERVERLIST}</envar> is set by the profile startup scripts (e.g.
<filename>/etc/profile</filename> or <filename>/etc/profile.d/xprint.sh</filename>) using the output of
<userinput>/etc/init.d/xprint get_xpserverlist</userinput>.</para>
<para>Example:
<informalexample>
<programlisting>
export XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"</programlisting>
</informalexample>
</para>
<para>Alternatively <envar>${XPSERVERLIST}</envar> can be set
manually. Example:</para>
<informalexample>
<programlisting>
export XPSERVERLIST="littlecat:80 bitdog:72"</programlisting>
</informalexample>
<para>
instructs an application to find an Xprint server at display
80 on the machine "littlecat" and at display 72 on the
machine bigdog.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>${XPRINTER}</envar>
</term>
<listitem>
<para>The environment variable <envar>${XPRINTER}</envar>
defines the default printer used by print
applications. The syntax is either
<replaceable>printername</replaceable> or
<replaceable>printername</replaceable>@<replaceable>display</replaceable>.</para>
<para>Examples:
<variablelist>
<varlistentry>
<term><userinput>XPRINTER=ps003</userinput></term>
<listitem><para>
tells an application to look for the
first printer named "ps003" on all Xprint
servers.</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- brain dead <term> does not permit quote marks
(in XPRINTER="hplaser19 at littlecat:80"), so omit them -->
<term><userinput>XPRINTER=hplaser19 at littlecat:80</userinput></term>
<listitem><para>
tells an application to use the printer "hplaser19"
on the Xprint server at display
"littlecat:80".</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>If <envar>${XPRINTER}</envar> is not set the applications
will examine the values of the <envar>${PDPRINTER}</envar>,
<envar>${LPDEST}</envar>, and
<envar>${PRINTER}</envar> environment variables (in that order).
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
<para>
<simplelist type="inline">
<!-- specific references -->
<!-- none -->
<!-- Xprint general references -->
<!--
<member><citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
-->
<member><citerefentry><refentrytitle>X11</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xplsprinters</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xphelloworld</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpxmhelloworld</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpawhelloworld</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpxthelloworld</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpsimplehelloworld</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>Xprt</refentrytitle><manvolnum>__mansuffix__</manvolnum></citerefentry></member>
<!-- ToDO: Add manual pages for the single Xprint DDX implementations (PostScript/PDF/PCL/PCL-MONO/Raster/etc.) -->
<member><citerefentry><refentrytitle>libXp</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>libXprintUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>libXprintAppUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>XmPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>XawPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member>Xprint FAQ (<ulink url="http://xprint.mozdev.org/docs/Xprint_FAQ.html">http://xprint.mozdev.org/docs/Xprint_FAQ.html</ulink>)</member>
<member>Xprint main site (<ulink url="http://xprint.mozdev.org/">http://xprint.mozdev.org/</ulink>)</member>
</simplelist>
</para>
</refsect1>
<refsect1>
<title>AUTHORS</title>
<para>
This manual page was written by
Roland Mainz <email>roland.mainz at nrubsig.org</email> based on the original X11R6.6
<filename>xc/programs/Xserver/XpConfig/README</filename>.
</para>
</refsect1>
</refentry>
--- NEW FILE: spooler.c ---
/* $Xorg: spooler.c,v 1.1 2003/09/14 1:19:56 gisburn Exp $ */
/*
Copyright (c) 2003-2004 Roland Mainz <roland.mainz at nrubsig.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the names of the copyright holders shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#ifdef __hpux
#include <sys/sysmacros.h>
#endif
#include "spooler.h"
/*
* The string LIST_QUEUES_* is fed to a shell to generate an ordered
* list of available printers on the system. These string definitions
* are taken from the file PrintSubSys.C within the code for the
* dtprintinfo program.
*/
#define LIST_QUEUES_AIX4 \
"lsallq | grep -v '^bsh$' | sort | uniq"
#define LIST_QUEUES_HPUX \
"LANG=C lpstat -v | " \
"awk '" \
" $2 == \"for\" " \
" { " \
" x = match($3, /:/); " \
" print substr($3, 1, x-1)" \
" }' | sort | uniq"
#define LIST_QUEUES_OSF \
"LANG=C lpstat -v | " \
"nawk '" \
" $2 == \"for\" " \
" { print $4 }' " \
" | sort | uniq"
#define LIST_QUEUES_UXP \
"LANG=C lpstat -v |" \
"nawk '" \
" $4 == \"for\" " \
" { " \
" x = match($5, /:/); " \
" print substr($5, 1, x-1)" \
" }' | sort | uniq"
/* Support both normal and LPRng output of "lpc status" */
#define LIST_QUEUES_BSD \
"PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \
"export PATH\n" \
\
"which_tool()\n" \
"{\n" \
" echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \
"}\n" \
\
"(\n" \
"WHICH_LPC=\"`which_tool lpc`\"\n" \
\
"if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \
" NAWK=\"nawk\"\n" \
"else\n" \
" NAWK=\"awk\"\n" \
"fi\n" \
\
"[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc status | ${NAWK} '/^[^ ]*:$/ && !/@/ && !/ / { print $1 }' | sed -e /:/s///)\n" \
"[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc -a status | ${NAWK} '/^[^ ]*@[^ ]/ && !/:$/ { split( $1, name, \"@\" ); print name[1]; }')\n" \
") | egrep -v -i \" |^all$\" | sort | uniq"
#define LIST_QUEUES_SYSV \
"PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \
"export PATH\n" \
\
"which_tool()\n" \
"{\n" \
" echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \
"}\n" \
\
"(\n" \
"WHICH_LPSTAT=\"`which_tool lpstat`\"\n" \
\
"if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \
" NAWK=\"nawk\"\n" \
"else\n" \
" NAWK=\"awk\"\n" \
"fi\n" \
\
"[ \"${WHICH_LPSTAT}\" != \"\" ] && (LANG=C lpstat -v | ${NAWK} ' $2 == \"for\" { x = match($3, /:/); print substr($3, 1, x-1) }')\n" \
") | egrep -v -i \" |^all$\" | sort | uniq"
#define LIST_QUEUES_OTHER \
"LANG=C lpstat -v | " \
"nawk '" \
" $2 == \"for\" " \
" { " \
" x = match($3, /:/); " \
" print substr($3, 1, x-1)" \
" }' | sort | uniq"
#define DEFAULT_SPOOL_COMMAND_HPUX "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%"
#define DEFAULT_SPOOL_COMMAND_BSD "/usr/bin/lpr -P %printer-name% -#%copy-count% -T %job-name% %options%"
#define DEFAULT_SPOOL_COMMAND_SYSV "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
#define DEFAULT_SPOOL_COMMAND_OTHER "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
/* List of spooler types and the commands used to enumerate
* print queues and submit print jobs */
XpSpoolerType xpstm[] =
{
/* OS-specific spoolers */
{ "aix", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER },
{ "aix4", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER },
{ "bsd", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD },
{ "osf", LIST_QUEUES_OSF, DEFAULT_SPOOL_COMMAND_OTHER },
{ "solaris", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
{ "sysv", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
{ "uxp", LIST_QUEUES_UXP, DEFAULT_SPOOL_COMMAND_OTHER },
/* crossplatform spoolers */
{ "cups", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
{ "lprng", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD },
/* misc */
{ "other", LIST_QUEUES_OTHER, DEFAULT_SPOOL_COMMAND_OTHER },
{ "none", NULL, NULL },
{ NULL, NULL, NULL }
};
/* Used by Init.c and attributes.c */
XpSpoolerTypePtr spooler_type = NULL;
XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name)
{
XpSpoolerTypePtr curr = xpstm;
while( curr->name != NULL )
{
if( !strcasecmp(name, curr->name) )
return curr;
curr++;
}
return NULL;
}
static char *spooler_namelist = NULL;
char *XpGetSpoolerTypeNameList(void)
{
if( spooler_namelist )
return spooler_namelist;
return XPDEFAULTSPOOLERNAMELIST;
}
void XpSetSpoolerTypeNameList(char *namelist)
{
spooler_namelist = namelist;
}
--- NEW FILE: spooler.h ---
#ifndef SPOOLER_H
#define SPOOLER_H 1
/* $Xorg: spooler.h,v 1.1 2003/09/14 1:19:56 gisburn Exp $ */
/*
Copyright (c) 2003-2004 Roland Mainz <roland.mainz at nrubsig.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the names of the copyright holders shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
/*
* Define platform-specific default spooler type
*/
#if defined(sun)
#define XPDEFAULTSPOOLERNAMELIST "solaris"
#elif defined(AIXV4)
#define XPDEFAULTSPOOLERNAMELIST "aix4"
#elif defined(hpux)
#define XPDEFAULTSPOOLERNAMELIST "hpux"
#elif defined(__osf__)
#define XPDEFAULTSPOOLERNAMELIST "osf"
#elif defined(__uxp__)
#define XPDEFAULTSPOOLERNAMELIST "uxp"
#elif defined(CSRG_BASED) || defined(linux)
/* ToDo: This should be "cups:bsd" in the future, but for now
* the search order first-bsd-then-cups is better for backwards
* compatibility.
*/
#define XPDEFAULTSPOOLERNAMELIST "bsd:cups"
#else
#define XPDEFAULTSPOOLERNAMELIST "other"
#endif
typedef struct
{
const char *name;
const char *list_queues_command;
const char *spool_command;
} XpSpoolerType, *XpSpoolerTypePtr;
/* prototypes */
extern XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name);
extern void XpSetSpoolerTypeNameList(char *namelist);
extern char *XpGetSpoolerTypeNameList(void);
/* global vars */
extern XpSpoolerTypePtr spooler_type;
extern XpSpoolerType xpstm[];
#endif /* !SPOOLER_H */
Index: AttrValid.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/AttrValid.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/AttrValid.c 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/AttrValid.c 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,8 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.4 2001/01/17 22:36:27 dawes Exp $ */
-
#include <scrnintstr.h>
#include "attributes.h"
@@ -46,7 +44,7 @@
&DefaultMediumSize, 1
};
static XpOidMediumSourceSize DefaultMediumSourceSize = {
- xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
+ xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
};
static XpOidMediumSS DefaultMediumSS = {
&DefaultMediumSourceSize, 1
@@ -298,7 +296,7 @@
}
const XpOidMediumSS*
-XpGetDefaultMediumSS(void)
+XpGetDefaultMediumSS()
{
return &DefaultMediumSS;
}
Index: AttrValid.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/AttrValid.h,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/AttrValid.h 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/AttrValid.h 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,7 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
#ifndef _Xp_AttrValid_h
#define _Xp_AttrValid_h
@@ -85,7 +84,7 @@
#define XpPutStringAttr(pContext, pool, oid, value) \
XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
-#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
+#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
/*
* XpOid-valued attribute access
@@ -179,7 +178,7 @@
XPAttributes pool,
XpOid oid,
const XpOidMediumSS* msss);
-const XpOidMediumSS* XpGetDefaultMediumSS(void);
+const XpOidMediumSS* XpGetDefaultMediumSS();
/*
* XpOidTrayMediumList-valued attribute access
@@ -193,15 +192,12 @@
XPAttributes pool,
XpOid oid,
const XpOidTrayMediumList* tm);
-BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
-
/*
* Attribute pool validation
*/
void XpValidateAttributePool(XpContextPtr pContext,
XPAttributes pool,
const XpValidatePoolsRec* vpr);
-void XpValidateNotificationProfile(XpContextPtr pContext);
void XpValidatePrinterPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidateJobPool(XpContextPtr pContext,
@@ -210,9 +206,6 @@
const XpValidatePoolsRec* vpr);
void XpValidatePagePool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
-void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
- const XpOidList* valid_trays,
- const XpOidList* valid_sizes);
#endif /* _XP_PRINT_SERVER_ */
Index: DiPrint.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/DiPrint.h,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/DiPrint.h 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/DiPrint.h 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,8 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/DiPrint.h,v 1.3 1999/12/16 02:26:24 robin Exp $ */
-
/*
* The XpDiListEntry struct is the type of each element of the array
* handed back to the extension code to handle a GetPrinterList request.
Index: Imakefile
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/Imakefile,v
retrieving revision 1.1.4.5
retrieving revision 1.1.4.6
diff -u -d -r1.1.4.5 -r1.1.4.6
--- a/Imakefile 26 Mar 2004 01:12:54 -0000 1.1.4.5
+++ b/Imakefile 21 Apr 2004 10:03:35 -0000 1.1.4.6
@@ -1,10 +1,4 @@
XCOMM $Xorg: Imakefile,v 1.4 2001/03/14 18:44:11 pookie Exp $
-
-
-
-
-XCOMM $XFree86: xc/programs/Xserver/Xprint/Imakefile,v 1.19 2002/11/11 17:55:01 alanh Exp $
-
#include <Server.tmpl>
#ifndef XpRasterDDX
@@ -20,10 +14,10 @@
#define XpPostScriptDDX YES
#endif
-SRCS1 = Init.c Quarks.c attributes.c Util.c mediaSizes.c \
+SRCS1 = Init.c Quarks.c spooler.c attributes.c Util.c mediaSizes.c \
Oid.c AttrValid.c
-OBJS1 = Init.o Quarks.o attributes.o Util.o mediaSizes.o \
+OBJS1 = Init.o Quarks.o spooler.o attributes.o Util.o mediaSizes.o \
Oid.o AttrValid.o
#ifdef OS2Architecture
@@ -34,7 +28,7 @@
#if XprtServer
#if PrintOnlyServer || defined(PrintServerExtensions)
#if PrintOnlyServer
-PO_DEFINES = -DPRINT_ONLY_SERVER
+PO_DEFINES = -DPRINT_ONLY_SERVER
#endif
#ifdef PrintServerExtensions
XPEXT_DEFINES = PrintServerExtensions
@@ -48,7 +42,7 @@
OBJS2 = ddxInit.o
#endif
-SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS_OS2)
+SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS_OS2)
OBJS = $(OBJS1) $(OBJS_OS2)
@@ -75,15 +69,15 @@
#if XpRasterDDX || XpColorPclDDX || XpMonoPclDDX || XpPostScriptDDX
-SUBDIRS = $(RASTDIR) $(PCLDIR) $(MPCLDIR) $(PSDIR)
-
+SUBDIRS = $(RASTDIR) $(PCLDIR) $(MPCLDIR) $(PSDIR) etc
#define IHaveSubdirs
#endif
INCLUDES = -I$(XINCLUDESRC) -I. -I../mfb -I../mi -I../cfb \
- -I../include -I$(TOP)/include -I$(LIBSRC) \
- -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(XLIBSRC)
+ -I../include -I$(TOP)/include -I$(LIBSRC) \
+ -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(XLIBSRC)
+
LINTLIBS = $(TOP)/server/dix/llib-ldix.ln $(TOP)/server/os/llib-los.ln \
$(TOP)/server/ddx/mfb/llib-lmfb.ln \
@@ -91,7 +85,7 @@
$(TOP)/server/ddx/cfb/llib-lcfb.ln
DEFINES = -DXPRINTDIR=\"$(XPRINTDIR)\" $(RASTDEF) $(PCLDEF) $(MPCLDEF) \
- $(PSDEF) $(MKTMP_DEFINES) -UXFree86LOADER -D_XP_PRINT_SERVER_
+ $(PSDEF) $(MKTMP_DEFINES) -UXFree86LOADER -D_XP_PRINT_SERVER_
/* Go ahead: Call me paranoid ... */
Makefiles::
@@ -131,3 +125,14 @@
#endif
DependTarget()
+
+MANDIR = $(MISCMANDIR)
+MANSUFFIX = $(MISCMANSUFFIX)
+InstallManPage(Xprint,$(MANDIR))
+
+#ifdef HasDocBookTools
+all:: Xprint.man Xprint.html
+
+ConvertDocBookToManPage(Xprint.sgml, Xprint.man)
+ConvertDocBookToHTML(Xprint.sgml, Xprint.html)
+#endif /* HasDocBookTools */
Index: Init.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/Init.c,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -d -r1.1.4.3 -r1.1.4.4
--- a/Init.c 5 Mar 2004 13:39:53 -0000 1.1.4.3
+++ b/Init.c 21 Apr 2004 10:03:35 -0000 1.1.4.4
@@ -50,7 +50,6 @@
** *********************************************************
**
********************************************************************/
-/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.14tsi Exp $ */
#include <unistd.h>
#include <stdlib.h>
@@ -91,6 +90,7 @@
#include "attributes.h"
#include "os.h"
+#include "spooler.h"
static void GenericScreenInit(
int index,
@@ -116,57 +116,6 @@
#define MODELDIRNAME "/models"
#define FONTDIRNAME "/fonts"
-/*
- * The string LIST_QUEUES is fed to a shell to generate an ordered
- * list of available printers on the system. These string definitions
- * are taken from the file PrintSubSys.C within the code for the
- * dtprintinfo program.
- */
-#ifdef AIXV4
-const char *LIST_QUEUES = "lsallq | grep -v '^bsh$' | sort";
-#else
-#ifdef hpux
-const char *LIST_QUEUES = "LANG=C lpstat -v | "
- "awk '"
- " $2 == \"for\" "
- " { "
- " x = match($3, /:/); "
- " print substr($3, 1, x-1)"
- " }' | sort";
-#else
-#ifdef __osf__
- const char *LIST_QUEUES = "LANG=C lpstat -v | "
- "nawk '"
- " $2 == \"for\" "
- " { print $4 }' "
- " | sort";
-#else
-#ifdef __uxp__
-const char *LIST_QUEUES = "LANG=C lpstat -v | "
- "nawk '"
- " $4 == \"for\" "
- " { "
- " x = match($5, /:/); "
- " print substr($5, 1, x-1)"
- " }' | sort";
-#else
-#if defined(CSRG_BASED) || defined(linux) || defined(ISC) || defined(__GNUC__)
-const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
- "sed -e /:/s/// | sort";
-#else
-const char *LIST_QUEUES = "LANG=C lpstat -v | "
- "nawk '"
- " $2 == \"for\" "
- " { "
- " x = match($3, /:/); "
- " print substr($3, 1, x-1)"
- " }' | sort";
-#endif
-#endif
-#endif
-#endif
-#endif
-
#ifdef XPRASTERDDX
static
@@ -183,9 +132,9 @@
static
PixmapFormatRec ColorPclPixmapFormats[] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 24,32, BITMAP_SCANLINE_PAD }
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD }
};
#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
@@ -211,9 +160,9 @@
static
PixmapFormatRec PSPixmapFormats[] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 24,32, BITMAP_SCANLINE_PAD }
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD }
};
#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
@@ -325,10 +274,64 @@
int screenNum;
} DriverMapEntry, *DriverMapPtr;
+static const char configFilePath[] =
+"/etc/dt/config/print:/usr/dt/config/print";
+
+static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
+
+static int printScreenPrivIndex,
+ printWindowPrivIndex,
+ printGCPrivIndex;
+static unsigned long printGeneration = 0;
static char *configFileName = (char *)NULL;
static Bool freeDefaultFontPath = FALSE;
static char *origFontPath = (char *)NULL;
+static Bool xprintInitGlobalsCalled = FALSE;
+/*
+ * This function is responsible for doing initalisation of any global
+ * variables at an very early point of server startup (even before
+ * |ProcessCommandLine()|.
+ */
+void XprintInitGlobals(void)
+{
+ xprintInitGlobalsCalled = TRUE;
+
+#ifdef SMART_SCHEDULE
+ /* Somehow the XF86 "smart scheduler" completely kills the Xprint DDX
+ * (see http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=467
+ * ("Xfree86's "smart scheduler" breaks Xprt") */
+ SmartScheduleDisable = TRUE;
+#endif /* SMART_SCHEDULE */
+}
+
+/*
+ * XprintUseMsg() prints usage for the Xprint-specific options
+ */
+void XprintUseMsg()
+{
+ XpSpoolerTypePtr curr = xpstm;
+
+ /* Option '-XpFile' */
+ ErrorF("-XpFile file specifies an alternate `Xprinters' file, rather\n");
+ ErrorF(" than the default one (e.g.\n");
+ ErrorF(" `${XPCONFIGDIR}/${LANG}/print/Xprinters') or\n");
+ ErrorF(" `${XPCONFIGDIR}/C/print/Xprinters'.\n");
+
+ /* Option '-XpSpoolerType' */
+ ErrorF("-XpSpoolerType string specifies a spooler type.\n");
+ ErrorF(" Supported values are:\n");
+
+ while( curr->name != NULL )
+ {
+ ErrorF(" - '%s'\n", curr->name);
+ curr++;
+ }
+ ErrorF(" (multiple values can be specified, seperated by ':',\n");
+ ErrorF(" the first active spooler will be chosen).\n");
+ ErrorF(" default is '%s'.\n", XPDEFAULTSPOOLERNAMELIST);
+}
+
/*
* XprintOptions checks argv[i] to see if it is our command line
* option specifying a configuration file name. It returns the index
@@ -340,6 +343,7 @@
char **argv,
int i)
{
+ extern void ddxUseMsg();
if(strcmp(argv[i], "-XpFile") == 0)
{
if ((i + 1) >= argc) {
@@ -349,8 +353,19 @@
configFileName = argv[i + 1];
return i + 2;
}
+ else if(strcmp(argv[i], "-XpSpoolerType") == 0)
+ {
+ if ((i + 1) >= argc) {
+ ddxUseMsg ();
+ return i + 2;
+ }
+ XpSetSpoolerTypeNameList(argv[i + 1]);
+ return i + 2;
+ }
else
+ {
return i;
+ }
}
/************************************************************
@@ -417,7 +432,7 @@
{
PrinterDbPtr pCurEntry, pNextEntry;
- for(pCurEntry = printerDb, pNextEntry = 0;
+ for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
{
pNextEntry = pCurEntry->next;
@@ -429,7 +444,7 @@
*/
xfree(pCurEntry);
}
- printerDb = 0;
+ printerDb = (PrinterDbPtr)NULL;
}
/*
@@ -460,11 +475,12 @@
return TRUE;
}
-static void
+static int
AugmentPrinterDb(const char *command)
{
FILE *fp;
char name[256];
+ int num_printers = 0; /* Number of printers we found */
fp = popen(command, "r");
/* XXX is a 256 character limit overly restrictive for printer names? */
@@ -472,8 +488,10 @@
{
name[strlen(name) - 1] = (char)'\0'; /* strip the \n */
AddPrinterDbName(name);
+ num_printers++;
}
pclose(fp);
+ return num_printers;
}
/*
@@ -592,7 +610,7 @@
"xp-ddx-identifier");
if(pEntry->driverName == (char *)NULL ||
strlen(pEntry->driverName) == 0 ||
- GetInitFunc(pEntry->driverName) == 0)
+ GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
{
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
ErrorF("Xp Extension: Can't load driver %s\n",
@@ -650,7 +668,7 @@
/*
* Check for a LANG-specific file.
*/
- if ((dirName = XpGetConfigDir(TRUE)) != 0)
+ if(dirName = XpGetConfigDir(TRUE))
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@@ -669,7 +687,7 @@
xfree(filePath);
}
- if ((dirName = XpGetConfigDir(FALSE)) != 0)
+ if(dirName = XpGetConfigDir(FALSE))
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@@ -701,6 +719,7 @@
static PrinterDbPtr
BuildPrinterDb(void)
{
+ char *printerList, *augmentCmd = (char *)NULL;
Bool defaultAugment = TRUE, freeConfigFileName;
if(configFileName && access(configFileName, R_OK) != 0)
@@ -727,7 +746,7 @@
{
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
{
- if ((ptr = MbStrchr(tok, '\012')) != 0)
+ if(ptr = MbStrchr(tok, '\012'))
*ptr = (char)'\0';
AddPrinterDbName(tok);
}
@@ -768,7 +787,43 @@
if(defaultAugment == TRUE)
{
- AugmentPrinterDb(LIST_QUEUES);
+ XpSpoolerTypePtr curr_spooler_type; /* spooler we are currently probing for queues */
+ int num_printers_found; /* number of printers found by |AugmentPrinterDb()| */
+ char *tok_lasts; /* strtok_r() position token */
+ char *spnamelist; /* list of spooler names, seperated by ":" */
+ char *spname; /* spooler name */
+
+ spnamelist = strdup(XpGetSpoolerTypeNameList()); /* strtok_r() modifies string so dup' it first */
+
+ for( spname = strtok_r(spnamelist, ":", &tok_lasts) ;
+ spname != NULL ;
+ spname = strtok_r(NULL, ":", &tok_lasts) )
+ {
+ curr_spooler_type = XpSpoolerNameToXpSpoolerType(spname);
+ if(!curr_spooler_type)
+ {
+ FatalError("BuildPrinterDb: No spooler type entry found for '%s'.\n", spname);
+ }
+
+ if(curr_spooler_type->list_queues_command == NULL ||
+ strlen(curr_spooler_type->list_queues_command) == 0)
+ {
+ continue;
+ }
+
+ num_printers_found = AugmentPrinterDb(curr_spooler_type->list_queues_command);
+ /* Did we found a spooler which works ? */
+ if(num_printers_found > 0)
+ {
+ spooler_type = curr_spooler_type;
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "BuildPrinterDb: using '%s'.\n", spooler_type->name);
+#endif /* DEBUG_gisburn */
+ break;
+ }
+ }
+
+ free(spnamelist);
}
MergeNameMap();
@@ -951,7 +1006,7 @@
return (char *)NULL;
configDir = XpGetConfigDir(TRUE);
- if ((fontDir = ValidateFontDir(configDir, modelName)) != 0)
+ if(fontDir = ValidateFontDir(configDir, modelName))
{
xfree(configDir);
return fontDir;
@@ -1013,8 +1068,8 @@
static void
AugmentFontPath(void)
{
- char *modelID, **allIDs = (char **)NULL;
- PrinterDbPtr pDbEntry;
+ char *newPath, *modelID, **allIDs = (char **)NULL;
+ PrinterDbPtr pDb, pDbEntry;
int numModels, i;
if(!origFontPath)
@@ -1072,7 +1127,7 @@
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
{
char *fontDir;
- if ((fontDir = FindFontDir(allIDs[i])) != 0)
+ if(fontDir = FindFontDir(allIDs[i]))
{
AddToFontPath(fontDir);
xfree(fontDir);
@@ -1162,7 +1217,7 @@
* fpe->name.
*/
if(fpe->name_length < PATH_PREFIX_LEN ||
- (strlen(fontDir) != (unsigned)(fpe->name_length - PATH_PREFIX_LEN)) ||
+ (strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) ||
strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
fpe->name_length - PATH_PREFIX_LEN))
{
@@ -1235,6 +1290,18 @@
char **driverNames;
char *configDir;
+ /* This should NEVER happen, but... */
+ if( !xprintInitGlobalsCalled )
+ {
+ FatalError("Internal error: XprintInitGlobals() not called.");
+ }
+#ifdef SMART_SCHEDULE
+ if( SmartScheduleDisable != TRUE )
+ {
+ FatalError("Internal error: XF86 smart scheduler incompatible to Xprint DDX.");
+ }
+#endif /* SMART_SCHEDULE */
+
/*
* this little test is just a warning at startup to make sure
* that the config directory exists.
@@ -1254,10 +1321,9 @@
xfree(configDir);
}
else {
- ErrorF("Xp Extension: could not find config dir %s\n",
- configDir ? configDir : XPRINTDIR);
-
- if (configDir) xfree(configDir);
+ /* Refuse to start when we do not have our config dir... */
+ FatalError("Xp Extension: could not find config dir %s\n",
+ configDir ? configDir : XPRINTDIR);
}
if(printerDb != (PrinterDbPtr)NULL)
@@ -1414,7 +1480,7 @@
}
if(callInit == TRUE)
{
- pBFunc initFunc;
+ Bool (*initFunc)();
initFunc = GetInitFunc(pDb->driverName);
if(initFunc(index, pScreen, argc, argv) == FALSE)
{
@@ -1451,9 +1517,10 @@
int argc,
char **argv)
{
+ int i;
float fWidth, fHeight, maxWidth, maxHeight;
unsigned short width, height;
- PrinterDbPtr pDb;
+ PrinterDbPtr pDb, pDb2;
int res, maxRes;
/*
@@ -1477,6 +1544,7 @@
{
if(pDb->screenNum == index)
{
+
XpValidatePoolsRec *pValRec;
pVFunc dimensionsFunc;
@@ -1506,6 +1574,57 @@
}
/*
+ * QualifyName - takes an unqualified file name such as X6printers and
+ * a colon-separated list of directory path names such as
+ * /etc/opt/dt:/opt/dt/config.
+ *
+ * Returns a fully qualified file path name such as /etc/opt/dt/X6printers.
+ * The returned value is malloc'd, and the caller is responsible for
+ * freeing the associated memory.
+ */
+static char *
+QualifyName(fileName, searchPath)
+ char *fileName;
+ char *searchPath;
+{
+ char * curPath = searchPath;
+ char * nextPath;
+ char * chance;
+ FILE *pFile;
+
+ if (fileName == NULL || searchPath == NULL)
+ return NULL;
+
+ while (1) {
+ if ((nextPath = strchr(curPath, ':')) != NULL)
+ *nextPath = 0;
+
+ chance = (char *)xalloc(strlen(curPath) + strlen(fileName) + 2);
+ sprintf(chance,"%s/%s",curPath,fileName);
+
+ /* see if we can read from the file */
+ if((pFile = fopen(chance, "r")) != (FILE *)NULL)
+ {
+ fclose(pFile);
+ /* ... restore the colon, .... */
+ if (nextPath)
+ *nextPath = ':';
+
+ return chance;
+ }
+
+ xfree(chance);
+
+ if (nextPath == NULL) /* End of path list? */
+ break;
+
+ /* try the next path */
+ curPath = nextPath + 1;
+ }
+ return NULL;
+}
+
+/*
* FillPrinterListEntry fills in a single XpDiListEntry element with data
* derived from the supplied PrinterDbPtr element.
*
@@ -1548,12 +1667,11 @@
int localeLen,
char *locale)
{
- PrinterDbPtr pDb;
+ PrinterDbPtr pDb, pDb2;
for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
{
- if (strlen(pDb->name) == (unsigned)nameLen
- && !strncmp(pDb->name, name, nameLen))
+ if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen))
{
FillPrinterListEntry(pEntry, pDb, localeLen, locale);
return TRUE;
@@ -1598,7 +1716,7 @@
if(!nameLen || name == (char *)NULL)
{
int i;
- PrinterDbPtr pDb;
+ PrinterDbPtr pDb, pDb2;
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
pDb = pDb->next, i++)
@@ -1648,11 +1766,12 @@
XpDiValidatePrinter(char *printerName, int printerNameLen)
{
PrinterDbPtr pCurEntry;
+ WindowPtr pWin;
for(pCurEntry = printerDb;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
{
- if(strlen(pCurEntry->name) == (unsigned)printerNameLen &&
+ if(strlen(pCurEntry->name) == printerNameLen &&
!strncmp(pCurEntry->name, printerName, printerNameLen))
return WindowTable[pCurEntry->screenNum];
}
@@ -1680,3 +1799,4 @@
return (char *)NULL; /* XXX Should we supply a default driverName? */
}
+
Index: Oid.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/Oid.c,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -d -r1.1.4.3 -r1.1.4.4
--- a/Oid.c 5 Mar 2004 13:39:53 -0000 1.1.4.3
+++ b/Oid.c 21 Apr 2004 10:03:35 -0000 1.1.4.4
@@ -30,7 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.5tsi Exp $ */
#include "attributes.h"
@@ -274,7 +273,7 @@
*/
if(ptr_return != (const char**)NULL)
*ptr_return = ptr+length;
- return (XpOid)i;
+ return i;
}
/*
@@ -751,7 +750,7 @@
XpOid
XpOidLinkedListNextOid(XpOidLinkedList* me)
{
- if(me->current ? (me->current = me->current->next) != 0 : xFalse)
+ if(me->current ? me->current = me->current->next : xFalse)
return me->current->oid;
else
return xpoid_none;
@@ -1652,6 +1651,8 @@
const XpOidMediumSS* msss)
{
int i_mss, i_ds, i_itm;
+ XpOidMediumDiscreteSizeList* ds_list;
+ int tray_count;
XpOid current_tray, current_medium;
XpOidMediumDiscreteSizeList* unspecified_tray_ds;
XpOidMediumDiscreteSizeList* tray_ds;
@@ -1711,7 +1712,6 @@
* list
*/
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
- {
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{
/*
@@ -1722,10 +1722,7 @@
continue;
}
else
- {
tray_ds = unspecified_tray_ds;
- }
- }
/*
* loop through the discrete sizes list, looking for a size that
* matches the medium for the current input tray
@@ -2107,13 +2104,15 @@
{
switch(notify)
{
- default:
case XPOID_NOTIFY_UNSUPPORTED:
return (const char*)NULL;
+ break;
case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR;
+ break;
case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR;
+ break;
}
}
@@ -2238,7 +2237,7 @@
const char* first_nonws_ptr;
const char* format;
const char* variant;
- const char* version = 0;
+ const char* version;
int format_len;
int variant_len;
int version_len;
@@ -2551,12 +2550,10 @@
* variants must both be NULL or match
*/
if(fmt->variant == (char*)NULL)
- {
if(list->list[i].variant == (char*)NULL)
return xTrue;
else
continue;
- }
if(list->list[i].variant == (char*)NULL)
continue;
if(strcmp(fmt->variant, list->list[i].variant) != 0)
@@ -2565,12 +2562,10 @@
* versions must both be NULL or match
*/
if(fmt->version == (char*)NULL)
- {
if(list->list[i].version == (char*)NULL)
return xTrue;
else
continue;
- }
if(list->list[i].version == (char*)NULL)
continue;
if(strcmp(fmt->version, list->list[i].version) == 0)
Index: Oid.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/Oid.h,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/Oid.h 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/Oid.h 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,7 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/Oid.h,v 1.3 1999/12/16 02:26:24 robin Exp $ */
#ifndef _Xp_Oid_h
#define _Xp_Oid_h
@@ -206,7 +205,7 @@
/*
* XpOidLinkedList public methods
*/
-XpOidLinkedList* XpOidLinkedListNew(void);
+XpOidLinkedList* XpOidLinkedListNew();
void XpOidLinkedListDelete(XpOidLinkedList*);
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
Index: OidDefs.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/OidDefs.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/OidDefs.h 14 Nov 2003 15:54:45 -0000 1.1
+++ b/OidDefs.h 21 Apr 2004 10:03:35 -0000 1.1.4.1
@@ -133,6 +133,14 @@
xpoid_val_medium_size_jis_b8,
xpoid_val_medium_size_jis_b9,
xpoid_val_medium_size_jis_b10,
+ xpoid_val_medium_size_hp_2x_postcard,
+ xpoid_val_medium_size_hp_european_edp,
+ xpoid_val_medium_size_hp_mini,
+ xpoid_val_medium_size_hp_postcard,
+ xpoid_val_medium_size_hp_tabloid,
+ xpoid_val_medium_size_hp_us_edp,
+ xpoid_val_medium_size_hp_us_government_legal,
+ xpoid_val_medium_size_hp_us_government_letter,
xpoid_val_plex_simplex,
xpoid_val_plex_duplex,
xpoid_val_plex_tumble,
Index: OidStrs.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/OidStrs.h,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/OidStrs.h 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/OidStrs.h 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,140 +30,144 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/OidStrs.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
+/* This is an automatically-generated file. Do not edit. */
static int XpOidStringMapCount = 127;
-#define OIDATA(name) { name, sizeof(name)-1, 0, 0, 0 }
-
static const XpOidStringMapEntry XpOidStringMap[] = {
- OIDATA(""),
- OIDATA(""),
- OIDATA("descriptor"),
- OIDATA("content-orientation"),
- OIDATA("copy-count"),
- OIDATA("default-printer-resolution"),
- OIDATA("default-input-tray"),
- OIDATA("default-medium"),
- OIDATA("document-format"),
- OIDATA("plex"),
- OIDATA("xp-listfonts-modes"),
- OIDATA("job-name"),
- OIDATA("job-owner"),
- OIDATA("notification-profile"),
- OIDATA("xp-setup-state"),
- OIDATA("xp-spooler-command-options"),
- OIDATA("content-orientations-supported"),
- OIDATA("document-formats-supported"),
- OIDATA("dt-pdm-command"),
- OIDATA("input-trays-medium"),
- OIDATA("medium-source-sizes-supported"),
- OIDATA("plexes-supported"),
- OIDATA("printer-model"),
- OIDATA("printer-name"),
- OIDATA("printer-resolutions-supported"),
- OIDATA("xp-embedded-formats-supported"),
- OIDATA("xp-listfonts-modes-supported"),
- OIDATA("xp-page-attributes-supported"),
- OIDATA("xp-raw-formats-supported"),
- OIDATA("xp-setup-proviso"),
- OIDATA("document-attributes-supported"),
- OIDATA("job-attributes-supported"),
- OIDATA("locale"),
- OIDATA("multiple-documents-supported"),
- OIDATA("available-compression"),
- OIDATA("available-compressions-supported"),
- OIDATA("portrait"),
- OIDATA("landscape"),
- OIDATA("reverse-portrait"),
- OIDATA("reverse-landscape"),
- OIDATA("iso-a0"),
- OIDATA("iso-a1"),
- OIDATA("iso-a2"),
- OIDATA("iso-a3"),
- OIDATA("iso-a4"),
- OIDATA("iso-a5"),
- OIDATA("iso-a6"),
- OIDATA("iso-a7"),
- OIDATA("iso-a8"),
- OIDATA("iso-a9"),
- OIDATA("iso-a10"),
- OIDATA("iso-b0"),
- OIDATA("iso-b1"),
- OIDATA("iso-b2"),
- OIDATA("iso-b3"),
- OIDATA("iso-b4"),
- OIDATA("iso-b5"),
- OIDATA("iso-b6"),
- OIDATA("iso-b7"),
- OIDATA("iso-b8"),
- OIDATA("iso-b9"),
- OIDATA("iso-b10"),
- OIDATA("na-letter"),
- OIDATA("na-legal"),
- OIDATA("executive"),
- OIDATA("folio"),
- OIDATA("invoice"),
- OIDATA("ledger"),
- OIDATA("quarto"),
- OIDATA("iso-c3"),
- OIDATA("iso-c4"),
- OIDATA("iso-c5"),
- OIDATA("iso-c6"),
- OIDATA("iso-designated-long"),
- OIDATA("na-10x13-envelope"),
- OIDATA("na-9x12-envelope"),
- OIDATA("na-number-10-envelope"),
- OIDATA("na-7x9-envelope"),
- OIDATA("na-9x11-envelope"),
- OIDATA("na-10x14-envelope"),
- OIDATA("na-number-9-envelope"),
- OIDATA("na-6x9-envelope"),
- OIDATA("na-10x15-envelope"),
- OIDATA("monarch-envelope"),
- OIDATA("a"),
- OIDATA("b"),
- OIDATA("c"),
- OIDATA("d"),
- OIDATA("e"),
- OIDATA("jis-b0"),
- OIDATA("jis-b1"),
- OIDATA("jis-b2"),
- OIDATA("jis-b3"),
- OIDATA("jis-b4"),
- OIDATA("jis-b5"),
- OIDATA("jis-b6"),
- OIDATA("jis-b7"),
- OIDATA("jis-b8"),
- OIDATA("jis-b9"),
- OIDATA("jis-b10"),
- OIDATA("simplex"),
- OIDATA("duplex"),
- OIDATA("tumble"),
- OIDATA("top"),
- OIDATA("middle"),
- OIDATA("bottom"),
- OIDATA("envelope"),
- OIDATA("manual"),
- OIDATA("large-capacity"),
- OIDATA("main"),
- OIDATA("side"),
- OIDATA("event-report-job-completed"),
- OIDATA("electronic-mail"),
- OIDATA("xp-setup-mandatory"),
- OIDATA("xp-setup-optional"),
- OIDATA("xp-setup-ok"),
- OIDATA("xp-setup-incomplete"),
- OIDATA("xp-list-glyph-fonts"),
- OIDATA("xp-list-internal-printer-fonts"),
- OIDATA("0"),
- OIDATA("01"),
- OIDATA("02"),
- OIDATA("03"),
- OIDATA("012"),
- OIDATA("013"),
- OIDATA("023"),
- OIDATA("0123")
+ { "", 0 },
+ { "", 0 },
+ { "descriptor", 10 },
+ { "content-orientation", 19 },
+ { "copy-count", 10 },
+ { "default-printer-resolution", 26 },
+ { "default-input-tray", 18 },
+ { "default-medium", 14 },
+ { "document-format", 15 },
+ { "plex", 4 },
+ { "xp-listfonts-modes", 18 },
+ { "job-name", 8 },
+ { "job-owner", 9 },
+ { "notification-profile", 20 },
+ { "xp-setup-state", 14 },
+ { "xp-spooler-command-options", 26 },
+ { "content-orientations-supported", 30 },
+ { "document-formats-supported", 26 },
+ { "dt-pdm-command", 14 },
+ { "input-trays-medium", 18 },
+ { "medium-source-sizes-supported", 29 },
+ { "plexes-supported", 16 },
+ { "printer-model", 13 },
+ { "printer-name", 12 },
+ { "printer-resolutions-supported", 29 },
+ { "xp-embedded-formats-supported", 29 },
+ { "xp-listfonts-modes-supported", 28 },
+ { "xp-page-attributes-supported", 28 },
+ { "xp-raw-formats-supported", 24 },
+ { "xp-setup-proviso", 16 },
+ { "document-attributes-supported", 29 },
+ { "job-attributes-supported", 24 },
+ { "locale", 6 },
+ { "multiple-documents-supported", 28 },
+ { "available-compression", 21 },
+ { "available-compressions-supported", 32 },
+ { "portrait", 8 },
+ { "landscape", 9 },
+ { "reverse-portrait", 16 },
+ { "reverse-landscape", 17 },
+ { "iso-a0", 6 },
+ { "iso-a1", 6 },
+ { "iso-a2", 6 },
+ { "iso-a3", 6 },
+ { "iso-a4", 6 },
+ { "iso-a5", 6 },
+ { "iso-a6", 6 },
+ { "iso-a7", 6 },
+ { "iso-a8", 6 },
+ { "iso-a9", 6 },
+ { "iso-a10", 7 },
+ { "iso-b0", 6 },
+ { "iso-b1", 6 },
+ { "iso-b2", 6 },
+ { "iso-b3", 6 },
+ { "iso-b4", 6 },
+ { "iso-b5", 6 },
+ { "iso-b6", 6 },
+ { "iso-b7", 6 },
+ { "iso-b8", 6 },
+ { "iso-b9", 6 },
+ { "iso-b10", 7 },
+ { "na-letter", 9 },
+ { "na-legal", 8 },
+ { "executive", 9 },
+ { "folio", 5 },
+ { "invoice", 7 },
+ { "ledger", 6 },
+ { "quarto", 6 },
+ { "iso-c3", 6 },
+ { "iso-c4", 6 },
+ { "iso-c5", 6 },
+ { "iso-c6", 6 },
+ { "iso-designated-long", 19 },
+ { "na-10x13-envelope", 17 },
+ { "na-9x12-envelope", 16 },
+ { "na-number-10-envelope", 21 },
+ { "na-7x9-envelope", 15 },
+ { "na-9x11-envelope", 16 },
+ { "na-10x14-envelope", 17 },
+ { "na-number-9-envelope", 20 },
+ { "na-6x9-envelope", 15 },
+ { "na-10x15-envelope", 17 },
+ { "monarch-envelope", 16 },
+ { "a", 1 },
+ { "b", 1 },
+ { "c", 1 },
+ { "d", 1 },
+ { "e", 1 },
+ { "jis-b0", 6 },
+ { "jis-b1", 6 },
+ { "jis-b2", 6 },
+ { "jis-b3", 6 },
+ { "jis-b4", 6 },
+ { "jis-b5", 6 },
+ { "jis-b6", 6 },
+ { "jis-b7", 6 },
+ { "jis-b8", 6 },
+ { "jis-b9", 6 },
+ { "jis-b10", 7 },
+ { "hp-2x-postcard", 14 },
+ { "hp-european-edp", 15 },
+ { "hp-mini", 7 },
+ { "hp-postcard", 11 },
+ { "hp-tabloid", 10 },
+ { "hp-us-edp", 9 },
+ { "hp-us-government-legal", 22 },
+ { "hp-us-government-letter", 23 },
+ { "simplex", 7 },
+ { "duplex", 6 },
+ { "tumble", 6 },
+ { "top", 3 },
+ { "middle", 6 },
+ { "bottom", 6 },
+ { "envelope", 8 },
+ { "manual", 6 },
+ { "large-capacity", 14 },
+ { "main", 4 },
+ { "side", 4 },
+ { "event-report-job-completed", 26 },
+ { "electronic-mail", 15 },
+ { "xp-setup-mandatory", 18 },
+ { "xp-setup-optional", 17 },
+ { "xp-setup-ok", 11 },
+ { "xp-setup-incomplete", 19 },
+ { "xp-list-glyph-fonts", 19 },
+ { "xp-list-internal-printer-fonts", 30 },
+ { "0", 1 },
+ { "01", 2 },
+ { "02", 2 },
+ { "03", 2 },
+ { "012", 3 },
+ { "013", 3 },
+ { "023", 3 },
+ { "0123", 4 }
};
-
-#undef OIDATA
Index: attributes.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/attributes.c,v
retrieving revision 1.1.4.4
retrieving revision 1.1.4.5
diff -u -d -r1.1.4.4 -r1.1.4.5
--- a/attributes.c 5 Mar 2004 13:39:53 -0000 1.1.4.4
+++ b/attributes.c 21 Apr 2004 10:03:35 -0000 1.1.4.5
@@ -1,4 +1,3 @@
-/* $XdotOrg$ */
/* $Xorg: attributes.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -45,18 +44,15 @@
** *********************************************************
**
********************************************************************/
-/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.20 2003/10/29 22:11:54 tsi Exp $ */
-#include <X11/Xproto.h>
+#include <Xproto.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
#if (defined(sun) && defined(SVR4)) || (defined(SCO))
#include <wchar.h>
#endif
-
#include "scrnintstr.h"
#include <X11/extensions/Printstr.h>
@@ -67,11 +63,13 @@
#include "Xresource.h"
#include "Xrm.c"
+#include "spooler.h"
+
static XrmDatabase CopyDb(XrmDatabase inDb);
extern XrmDatabase XpSpoolerGetServerAttributes(void);
-static unsigned long attrGeneration = 0;
+static int attrGeneration = 0;
typedef struct {
XrmDatabase *pDb;
@@ -138,6 +136,26 @@
static char NULL_STRING[] = "\0";
/*
+ * XpGetConfigDirBase returns a string containing the path name of the base
+ * where the print server configuration directory is localed.
+ */
+static
+char *XpGetConfigDirBase()
+{
+ char **configDir;
+
+ /*
+ * If the XPCONFIGDIR environment variable is not set, then use the
+ * compile-time constant XPRINTDIR. XPRINTDIR is passed in on the
+ * compile command line, and is defined in $(TOP)/config/cf/Project.tmpl.
+ */
+ if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL)
+ configDir = XPRINTDIR;
+
+ return configDir;
+}
+
+/*
* XpGetConfigDir returns a string containing the path name of the print
* server configuration directory. If the useLocale parameter is False
* the it returns the path to the "/C" directory. If the useLocale
@@ -165,13 +183,7 @@
}
}
- /*
- * If the XPCONFIGDIR environment variable is not set, then use the
- * compile-time constant XPRINTDIR. XPRINTDIR is passed in on the
- * compile command line, and is defined in $(TOP)/config/cf/Project.tmpl.
- */
- if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL)
- configDir = XPRINTDIR;
+ configDir = XpGetConfigDirBase();
dirName = (char *)xalloc(strlen(configDir) + strlen(XPDIR) +
strlen(langDir) + 1);
@@ -307,7 +319,7 @@
if(systemAttributes.printers != (XrmDatabase)NULL)
{
- char *fileName;
+ char *dirName, *fileName;
XrmDatabase modelDB = (XrmDatabase)NULL;
XrmName xrm_name[5], xrm_class[2];
XrmRepresentation rep_type;
@@ -607,6 +619,7 @@
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
+ char *retVal;
XrmName xrm_name[3];
XrmRepresentation rep_type;
XrmValue value;
@@ -670,10 +683,10 @@
*/
void
XpPutOneAttribute(
- XpContextPtr pContext,
- XPAttributes class,
- const char* attributeName,
- const char* value)
+ XpContextPtr pContext,
+ XPAttributes class,
+ const char* attributeName,
+ const char* value)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db;
@@ -798,7 +811,7 @@
char *s, c;
if (*type != XrmQString)
- return False;
+ return;
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
if (*bindings == XrmBindLoosely) {
@@ -857,6 +870,7 @@
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
+ char *retVal;
StringDbStruct enumStruct;
XrmQuark empty = NULLQUARK;
@@ -1065,6 +1079,34 @@
}
/*
+ * ExecuteCommand takes two pointers - the command to execute,
+ * and the "argv" style NULL-terminated vector of arguments for the command.
+ * We wait for the command to terminate before continuing to ensure that
+ * we don't delete the job file before the spooler has made a copy.
+ */
+static void
+ExecCommand(pCommand, argVector)
+ char *pCommand;
+ char **argVector;
+{
+ pid_t childPid;
+ int status;
+
+ if((childPid = fork()) == 0)
+ {
+ /* return BadAlloc? */
+ if (execv(pCommand, argVector) == -1) {
+ FatalError("unable to exec '%s'", pCommand);
+ }
+ }
+ else
+ {
+ (void) waitpid(childPid, &status, 0);
+ }
+ return;
+}
+
+/*
* SendFileToCommand takes three character pointers - the file name,
* the command to execute,
* and the "argv" style NULL-terminated vector of arguments for the command.
@@ -1120,7 +1162,9 @@
*/
if(userName)
{
- if(geteuid() == (uid_t)0)
+ uid_t myUid;
+
+ if((myUid = geteuid()) == (uid_t)0)
{
struct passwd *pPasswd;
@@ -1137,6 +1181,8 @@
}
else
{
+ int res;
+
(void) close(pipefd[0]);
outPipe = fdopen(pipefd[1], "w");
@@ -1156,6 +1202,7 @@
* store for the supplied print context. The ReplaceAnyString utility
* routine is used to perform the actual replacements.
*/
+extern char *ReplaceAnyString(char *, char *, char *);
static char *
ReplaceAllKeywords(
@@ -1197,6 +1244,10 @@
else
command = ReplaceAnyString(command, "%options%", "");
+ /* New in xprint.mozdev.org release 007 - replace "%xpconfigdir%" with
+ * location of $XPCONFIGDIR */
+ command = ReplaceAnyString(command, "%xpconfigdir%", XpGetConfigDirBase());
+
return command;
}
@@ -1367,43 +1418,58 @@
char ***pVector,
XpContextPtr pContext)
{
- char *cmdName;
+ char *cmdName, *curTok;
+ int i, numChars;
if(command == (char *)NULL)
return (char *)NULL;
- (void) GetToken(command, &cmdName);
+ numChars = GetToken(command, &cmdName);
if(cmdName == (char *)NULL)
return (char *)NULL;
- *pVector = BuildArgVector(command, pContext);
+ /* Mangle the command name, too... */
+ cmdName = ReplaceAllKeywords(pContext, cmdName);
+
+ if(cmdName == (char *)NULL)
+ return (char *)NULL;
+ *pVector = BuildArgVector(command, pContext);
+
return cmdName;
}
-#ifdef hpux
-static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%";
-#else
-static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%";
-#endif
-
int
-XpSubmitJob(
- char *fileName,
- XpContextPtr pContext)
+XpSubmitJob(fileName, pContext)
+ char *fileName;
+ XpContextPtr pContext;
{
- char **vector, *cmdNam, *command, *userName;
+ char **vector, *cmdNam, *cmdOpt, *command, *userName;
int i;
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
if(command == (char *)NULL || strlen(command) == 0)
- command = strdup(DEFAULT_SPOOL_COMMAND);
+ {
+ if( spooler_type )
+ {
+ command = strdup(spooler_type->spool_command);
+ }
+ else
+ {
+ ErrorF("XpSubmitJob: No default spool command defined.\n");
+ }
+ }
else
+ {
command = strdup(command);
+ }
if(command == (char *)NULL)
+ {
+ ErrorF("XpSubmitJob: No spooler command found, cannot submit job.\n");
return BadAlloc;
-
+ }
+
cmdNam = VectorizeCommand(command, &vector, pContext);
xfree(command);
@@ -1431,7 +1497,6 @@
FreeVector(vector);
xfree(cmdNam);
- return Success;
}
/*
@@ -1504,6 +1569,7 @@
{
char *defMedium, *defTray;
char *t, *m;
+ char *pS, *pE, *pLast;
defMedium = XpGetOneAttribute( pCon, XPPageAttr,
"default-medium" );
Index: attributes.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/attributes.h,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/attributes.h 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/attributes.h 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,7 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/attributes.h,v 1.5 2001/08/01 00:44:45 tsi Exp $ */
#ifndef _Xp_attributes_h
#define _Xp_attributes_h 1
@@ -49,11 +48,11 @@
*/
void XpInitAttributes(XpContextPtr pContext);
void XpBuildAttributeStore(char *printerName,
- char *qualifierName);
+ char *qualifierName);
void XpAddPrinterAttribute(char *printerName,
- char *printerQualifier,
- char *attributeName,
- char *attributeValue);
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue);
void XpDestroyAttributes(XpContextPtr pContext);
char *XpGetConfigDir(Bool useLocale);
char *XpGetOneAttribute(XpContextPtr pContext,
@@ -98,33 +97,33 @@
void XpGetReproductionArea(XpContextPtr pContext,
xRectangle *pRect);
void XpGetMaxWidthHeightRes(const char *printer_name,
- const XpValidatePoolsRec* vpr,
- float *width,
- float *height,
- int* resolution);
+ const XpValidatePoolsRec* vpr,
+ float *width,
+ float *height,
+ int* resolution);
/* Util.c */
-char * ReplaceAnyString(char *string,
- char *target,
- char *replacement);
-char * ReplaceFileString(char *string,
- char *inFileName,
- char *outFileName);
+char *ReplaceAnyString(char *string,
+ char *target,
+ char *replacement);
+char *ReplaceFileString(char *string,
+ char *inFileName,
+ char *outFileName);
void ExecCommand(char *pCommand,
- char **argVector);
+ char **argVector);
int TransferBytes(FILE *pSrcFile,
- FILE *pDstFile,
- int numBytes);
+ FILE *pDstFile,
+ int numBytes);
Bool CopyContentsAndDelete(FILE **ppSrcFile,
- char **pSrcFileName,
- FILE *pDstFile);
+ char **pSrcFileName,
+ FILE *pDstFile);
int XpSendDocumentData(ClientPtr client,
- FILE *fp,
- int fileLen,
- int maxBufSize);
+ FILE *fp,
+ int fileLen,
+ int maxBufSize);
int XpFinishDocData(ClientPtr client);
Bool XpOpenTmpFile(char *mode,
- char **fname,
- FILE **stream);
+ char **fname,
+ FILE **stream);
#endif /* _Xp_attributes_h */
Index: ddxInit.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ddxInit.c,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -d -r1.1.4.3 -r1.1.4.4
--- a/ddxInit.c 5 Mar 2004 13:39:53 -0000 1.1.4.3
+++ b/ddxInit.c 21 Apr 2004 10:03:35 -0000 1.1.4.4
@@ -30,13 +30,12 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.13 2001/06/11 16:59:02 dawes Exp $ */
#include "X.h"
+#include "Xos.h"
#include "Xproto.h"
#include "windowstr.h"
#include "servermd.h"
-#include "Xos.h"
#include "DiPrint.h"
/*-
@@ -68,10 +67,13 @@
void
InitOutput(
- ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+
{
+ int i;
+
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
@@ -168,10 +170,10 @@
void
InitInput(
- int argc,
+ int argc,
char **argv)
{
- DeviceIntPtr ptr, kbd;
+ DevicePtr ptr, kbd;
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
@@ -215,6 +217,7 @@
}
#endif
+
#ifdef DDXTIME
CARD32
GetTimeInMillis(void)
@@ -226,6 +229,12 @@
}
#endif
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+ XprintInitGlobals();
+}
+
/****************************************
* ddxUseMsg()
*
@@ -235,7 +244,11 @@
void ddxUseMsg(void)
{
- /* Right now, let's just do nothing */
+/* Enable |XprintUseMsg()| only if |XprintOptions()| is called
+ * by |ddxProcessArgument|, too (see below...) */
+#ifdef PRINT_ONLY_SERVER
+ XprintUseMsg();
+#endif /* PRINT_ONLY_SERVER */
}
void AbortDDX (void)
@@ -269,12 +282,12 @@
int
ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
{
- return (BadDevice);
+ return (BadDevice);
}
int
Index: mediaSizes.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/mediaSizes.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/mediaSizes.c 5 Mar 2004 13:39:53 -0000 1.1.4.2
+++ b/mediaSizes.c 21 Apr 2004 10:03:35 -0000 1.1.4.3
@@ -30,8 +30,6 @@
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* $XFree86: xc/programs/Xserver/Xprint/mediaSizes.c,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
-
/*******************************************************************
**
** *********************************************************
@@ -130,6 +128,14 @@
{xpoid_val_medium_size_jis_b8, 64, 91},
{xpoid_val_medium_size_jis_b9, 45, 64},
{xpoid_val_medium_size_jis_b10, 32, 45},
+ {xpoid_val_medium_size_hp_2x_postcard, 148, 200},
+ {xpoid_val_medium_size_hp_european_edp, 304.8, 355.6},
+ {xpoid_val_medium_size_hp_mini, 139.7, 215.9},
+ {xpoid_val_medium_size_hp_postcard, 100, 148},
+ {xpoid_val_medium_size_hp_tabloid, 279.4, 431.8},
+ {xpoid_val_medium_size_hp_us_edp, 279.4, 355.6},
+ {xpoid_val_medium_size_hp_us_government_legal, 203.2, 330.2},
+ {xpoid_val_medium_size_hp_us_government_letter, 203.2, 254},
{xpoid_val_medium_size_iso_c3, 324, 458},
{xpoid_val_medium_size_iso_c4, 229, 324},
{xpoid_val_medium_size_iso_c5, 162, 229},
@@ -145,7 +151,8 @@
* attributes pools have been validated.
*/
int
-XpGetResolution(XpContextPtr pContext)
+XpGetResolution(
+ XpContextPtr pContext)
{
unsigned long resolution;
@@ -185,7 +192,8 @@
* attributes pools have been validated.
*/
XpOid
-XpGetContentOrientation(XpContextPtr pContext)
+XpGetContentOrientation(
+ XpContextPtr pContext)
{
XpOid orientation;
@@ -415,7 +423,7 @@
float *width, /* return */
float *height) /* return */
{
- unsigned i;
+ int i;
*width = *height = 0;
for(i = 0; i < XpNumber(PageDimensions); i++)
@@ -739,7 +747,9 @@
}
FontResolutionPtr
-XpGetClientResolutions(ClientPtr client, int *num)
+XpGetClientResolutions(client, num)
+ ClientPtr client;
+ int *num;
{
static struct _FontResolution res;
int resolution = XpGetResolution(XpContextOfClient(client));
@@ -755,13 +765,15 @@
}
-void XpSetFontResFunc(ClientPtr client)
+void XpSetFontResFunc(client)
+ ClientPtr client;
{
client->fontResFunc = XpGetClientResolutions;
}
-void XpUnsetFontResFunc(ClientPtr client)
+void XpUnsetFontResFunc(client)
+ ClientPtr client;
{
client->fontResFunc = NULL;
}
More information about the xorg-commit-diffs
mailing list