From 6d7e38c02a1910cf2e471fb960453259d05c0503 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Wed, 21 Oct 1998 22:00:19 +0000 Subject: [PATCH] As previous commit, now to up to line 11490. --- en/handbook/README | 3 + en/handbook/handbook.sgml | 1293 +++++++++++---------- en_US.ISO8859-1/books/handbook/book.sgml | 1293 +++++++++++---------- en_US.ISO_8859-1/books/handbook/book.sgml | 1293 +++++++++++---------- 4 files changed, 2037 insertions(+), 1845 deletions(-) diff --git a/en/handbook/README b/en/handbook/README index ef5cfb8861..435b7183d9 100644 --- a/en/handbook/README +++ b/en/handbook/README @@ -453,3 +453,6 @@ for example, There are very few whitespace changes, although a few have probably cropped up. The vast majority of the whitespace changes will happen in one megacommit, hopefully some time next week. + +38. As above, to line 11490. + diff --git a/en/handbook/handbook.sgml b/en/handbook/handbook.sgml index 5330554136..0f867a0926 100644 --- a/en/handbook/handbook.sgml +++ b/en/handbook/handbook.sgml @@ -1701,8 +1701,8 @@ ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent For a proxy FTP server, you should usually give name of the server you really want as a part of the username, after an @-sign. The proxy server then 'fakes' the real server. An - example: Say you want to install from ftp.freebsd.org, using the - proxy FTP server foo.bar.com, listening on port 1234. + example: Say you want to install from ftp.freebsd.org, using the + proxy FTP server foo.bar.com, listening on port 1234. In this case, you go to the options menu, set the FTP username to ftp@ftp.freebsd.org, and the password to your e-mail @@ -1711,9 +1711,10 @@ ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent ftp://foo.bar.com:1234/pub/FreeBSD - /pub/FreeBSD from ftp.freebsd.org is proxied - under foo.bar.com, allowing you to install from _that_ machine - (which fetch the files from ftp.freebsd.org as your installation + /pub/FreeBSD from + ftp.freebsd.org is proxied + under foo.bar.com, allowing you to install from _that_ machine + (which fetch the files from ftp.freebsd.org as your installation requests them). @@ -2831,7 +2832,7 @@ do-install: tell the port to fetch them from servers other than ones listed in the MASTER_SITES? - A. Yes. If you know, for example, ftp.FreeBSD.ORG is much + A. Yes. If you know, for example, ftp.FreeBSD.ORG is much closer than sites listed in MASTER_SITES, do as following example. @@ -5047,7 +5048,7 @@ HULL NAY YANG TREE TOUT VETO Before explaining how to generate one-time passwords, we should go over an S/Key login prompt: - + &prompt.user; telnet himalia Trying 18.26.0.186... @@ -5056,7 +5057,7 @@ Escape character is '^]'. s/key 92 hi52030 Password: - + Note that, before prompting for a password, the login program prints out the iteration number and seed which you will need in @@ -5069,8 +5070,8 @@ s/key 92 hi52030 If this machine were configured to disallow UNIX passwords over a connection from my machine, the prompt would have also - included the annotation (s/key - required), indicating that only S/Key one-time + included the annotation (s/key + required), indicating that only S/Key one-time passwords will be accepted. @@ -5084,21 +5085,21 @@ s/key 92 hi52030 machines, and there is an S/Key desk accessory for Macintosh computers as well.) The command-line key program takes as its parameters the iteration count and seed; you can cut-and-paste right from the - login prompt starting at key to + login prompt starting at key to the end of the line. Thus: - + &prompt.user; key 92 hi52030 ) pasted from previous section Reminder - Do not use this program while logged in via telnet or rlogin. Enter secret password: ) I typed my secret password ADEN BED WOLF HAW HOT STUN - + And in the other window: - + s/key 92 hi52030 ) from previous section Password: @@ -5107,7 +5108,7 @@ ADEN BED WOLF HAW HOT STUN Last login: Wed Jun 28 15:31:00 from halloran-eldar.l [etc.] - + This is the easiest mechanism if you have a trusted machine. There is a Java S/Key key applet, - + &prompt.user; key -n 25 57 zz99999 Reminder - Do not use this program while logged in via telnet or rlogin. @@ -5137,7 +5138,7 @@ Reminder - Do not use this program while logged in via telnet or rlogin. 56: AMOS BOWL LUG FAT CAIN INCH 57: GROW HAYS TUN DISH CAR BALM - + The requests twenty-five keys in sequence; the indicates the @@ -5158,7 +5159,7 @@ Reminder - Do not use this program while logged in via telnet or rlogin. can be used to configure restrictions on the use of UNIX passwords based on the host name, user name, terminal port, or IP address of a login session. The complete format of the file is documented in - the skey.access(5) manual page; there are + the skey.access5 manual page; there are also some security cautions there which should be read before depending on this file for security. @@ -5225,10 +5226,10 @@ permit port ttyd0 countries. For those needing to get a legal foreign distribution of this - software, please DO NOT get it from a USA or + software, please do not get it from a USA or Canada site. You will get that site in big trouble! A legal copy of this is available from - skeleton.mikom.csir.co.za, which is in South + skeleton.mikom.csir.co.za, which is in South Africa. @@ -5240,20 +5241,19 @@ permit port ttyd0 change to the directory /etc/kerberosIV and check that only the following files are present: - + &prompt.root; cd /etc/kerberosIV &prompt.root; ls README krb.conf krb.realms - + If any additional files (such as principal.* or master_key) exist, then use the kdb_destroy command to destroy the old Kerberos database, of if Kerberos is not running, - simply delete the extra files with rm. + simply delete the extra files with rm. You should now edit the krb.conf and krb.realms files to define your Kerberos @@ -5284,14 +5284,14 @@ ARC.NASA.GOV trident.arc.nasa.gov The first line names the realm in which this system works. The other lines contain realm/host entries. The first item on a line is a realm, and the second is a host in that realm that is acting - as a key distribution centre. The words admin server + as a key distribution centre. The words admin server following a hosts name means that host also provides an administrative database server. For further explanation of these terms, please consult the Kerberos man pages. - Now we have to add grunt.grondar.za to + Now we have to add grunt.grondar.za to the GRONDAR.ZA realm and also add an entry to - put all hosts in the .grondar.za domain in + put all hosts in the .grondar.za domain in the GRONDAR.ZA realm. The krb.realms file would be updated as follows: @@ -5315,7 +5315,7 @@ grunt.grondar.za GRONDAR.ZA Now we are ready to create the database. This only needs to run on the Kerberos server (or Key Distribution Centre). Issue the - kdb_init command to do this: + kdb_init command to do this: &prompt.root; kdb_init @@ -5348,8 +5348,8 @@ Master key entered. BEWARE! Making it all run Two principals need to be added to the database for each system that will be secured with - Kerberos. Their names are kpasswd - and rcmd These two principals are + Kerberos. Their names are kpasswd + and rcmd These two principals are made for each system, with the instance being the name of the individual system. @@ -5360,7 +5360,7 @@ Master key entered. BEWARE! Now let's add these entries: - + &prompt.root; kdb_edit Opening database... @@ -5411,7 +5411,7 @@ Principal's new key version = 1 Edit O.K. Principal name: <---- null entry here will cause an exit - + @@ -5566,8 +5566,7 @@ Password changed. Adding <command>su</command> privileges Kerberos allows us to give each - user who needs root privileges their own separate supassword. We could now add an id which is + user who needs root privileges their own separate supassword. We could now add an id which is authorized to su to root. This is controlled by having an instance of root associated with a principal. Using kdb_edit we can create the @@ -5644,16 +5643,13 @@ May 2 20:43:12 May 3 04:43:12 krbtgt.GRONDAR.ZA@GRONDAR.ZA Using other commands - In an earlier example, we created a principal called jane with an instance root. This was based on a user with the same + In an earlier example, we created a principal called + jane with an instance root. This was based on a user with the same name as the principal, and this is a Kerberos default; that a - <principal>.<instance> of the - form <username>.root will allow that - <username> to su to root if the necessary entries are in - the .klogin file in root's home directory: + <principal>.<instance> of the + form <username>.root will allow that + <username> to su to root if the necessary entries are in + the .klogin file in root's home directory: &prompt.root; cat /root/.klogin @@ -5671,10 +5667,10 @@ jack@GRONDAR.ZA This allows anyone in the GRONDAR.ZA realm who has authenticated themselves to - jane or jack (via + jane or jack (via kinit, see above) access to rlogin to - jane's account or files on this system + jane's account or files on this system (grunt) via rlogin, rsh or rcp. @@ -5745,16 +5741,16 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are currently two distinct types of firewalls in common use on the Internet today. The first type is more properly called - a packet filtering router, where the + a packet filtering router, where the kernel on a multi-homed machine chooses whether to forward or block packets based on a set of rules. The second type, known as - proxy servers, rely on daemons to + proxy servers, rely on daemons to provide authentication and to forward packets, possibly on a multi-homed machine which has kernel packet forwarding disabled. Sometimes sites combine the two types of firewalls, so that - only a certain machine (known as a bastion + only a certain machine (known as a bastion host) is allowed to send packets through a packet filtering router onto an internal network. Proxy services are run on the bastion host, which are generally more secure than normal @@ -5806,7 +5802,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Proxy servers are machines which have had the normal system daemons (telnetd, ftpd, etc) replaced with special servers. - These servers are called proxy + These servers are called proxy servers as they normally only allow onward connections to be made. This enables you to run (for example) a proxy telnet server on your firewall host, and people can telnet @@ -5874,7 +5870,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are currently three kernel configuration options relevant to IPFW: - + options IPFIREWALL @@ -5918,10 +5914,10 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Previous versions of FreeBSD contained an - IPFIREWALL_ACCT option. This is now obsolete as + IPFIREWALL_ACCT option. This is now obsolete as the firewall code automatically includes accounting facilities. @@ -5964,7 +5960,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There is one valid flag when using this form of the command: - + -N @@ -5974,13 +5970,13 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + The command given can be shortened to the shortest unique form. The valid commands are: - + add @@ -5997,25 +5993,25 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Previous versions of IPFW used separate firewall and accounting entries. The present version provides packet accounting with each firewall entry. - If an index value is supplied, + If an index value is supplied, it used to place the entry at a specific point in the chain. Otherwise, the entry is placed at the end of the chain at an index 100 greater than the last chain entry (this does not include the default policy, rule 65535, deny). - The log option causes matching + The log option causes matching rules to be output to the system console if the kernel was - compiled with IPFIREWALL_VERBOSE. + compiled with IPFIREWALL_VERBOSE. Valid actions are: - + reject @@ -6028,9 +6024,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 allow - Pass the packet on as normal. (aliases: pass and accept) + Pass the packet on as normal. (aliases: + pass and accept) @@ -6052,7 +6047,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Each action will be recognized by the shortest unambiguous prefix. @@ -6060,7 +6055,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The protocols which can be specified are: - + all @@ -6089,7 +6084,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + The address specification is: @@ -6105,41 +6100,41 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 conjunction with protocols which support ports (UDP and TCP). - The via is optional and may + The is optional and may specify the IP address or domain name of a local IP interface, - or an interface name (e.g. ed0) to + or an interface name (e.g. ed0) to match only packets coming through this interface. Interface unit numbers can be specified with an optional wildcard. For example, - ppp* would match all kernel PPP + ppp* would match all kernel PPP interfaces. The syntax used to specify an address/mask is: - address + address or - address/mask-bits + address/mask-bits or - address:mask-pattern + address:mask-pattern A valid hostname may be specified in place of the IP - address. mask-bits is a decimal + address. is a decimal number representing how many bits in the address mask should be - set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any + set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any address in a class C subnet (in this case, 192.216.222) to be - matched. mask-pattern is an IP + matched. is an IP address which will be logically AND'ed with the address given. - The keyword any may be used to + The keyword any may be used to specify any IP address. The port numbers to be blocked are specified as: @@ -6157,7 +6152,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The options available are: - + frag @@ -6180,18 +6175,18 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - ipoptions spec + ipoptions spec Matches if the IP header contains the comma separated list of options specified in - spec. The supported list of IP - options are: ssrr (strict - source route), lsrr (loose - source route), rr (record - packet route), and ts + spec. The supported list of IP + options are: ssrr (strict + source route), lsrr (loose + source route), rr (record + packet route), and ts (timestamp). The absence of a particular option may be - denoted with a leading '!'. + denoted with a leading !. @@ -6215,39 +6210,35 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - tcpflags flags + tcpflags flags Matches if the TCP header contains the comma - separated list of flags. The - supported flags are fin, - syn, rst, psh, ack, and urg. The absence of a particular - flag may be indicated by a leading '!'. + separated list of flags. The + supported flags are fin, + syn, rst, + psh, ack, and + urg. The absence of a particular + flag may be indicated by a leading !. - icmptypes - types + icmptypes types Matches if the ICMP type is present in the list - types. The list may be specified + types. The list may be specified as any combination of ranges and/or individual types separated by commas. Commonly used ICMP types are: - 0 echo reply (ping reply), - 5 redirect, 8 echo request (ping request), and - 11 time exceeded (used to + 0 echo reply (ping reply), + 5 redirect, 8 echo request (ping request), and + 11 time exceeded (used to indicate TTL expiration as with traceroute8). - + @@ -6266,7 +6257,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are three valid flags when using this form of the command: - + -a @@ -6292,7 +6283,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6320,7 +6311,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 ipfw zero - index + index When used without an index argument, @@ -6335,8 +6326,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Example commands for ipfw This command will deny all packets from the host - evil.hacker.org to the telnet port of the - host nice.people.org by being forwarded by + evil.hacker.org to the telnet port of the + host nice.people.org by being forwarded by the router: @@ -6344,8 +6335,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The next example denies and logs any TCP traffic from the - entire hacker.org network (a class C) to the - nice.people.org machine (any port). + entire hacker.org network (a class C) to the + nice.people.org machine (any port). &prompt.root; ipfw add deny log tcp from evil.hacker.org/24 to nice.people.org @@ -6360,13 +6351,16 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 To see the accounting records: + &prompt.root; ipfw -a list or in the short form + &prompt.root; ipfw -a l You can also see the last time a chain entry was matched with + &prompt.root; ipfw -at l @@ -6394,8 +6388,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 rules if your requirements alter. - If you use the logging versions of the accept command, it can generate + If you use the logging versions of the accept command, it can generate large amounts of log data as one log line will be generated for every packet that passes through the firewall, so large ftp/http transfers, etc, will really slow the @@ -6424,18 +6417,18 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 to write a list of the current rules out to a file, and then - use a text editor to prepend `ipfw - ' before all the lines. This will allow the script to + use a text editor to prepend ipfw + before all the lines. This will allow the script to be fed into /bin/sh and reload the rules into the kernel. Perhaps not the most efficient way, but it works. The next problem is what your firewall should actually - DO! This is largely dependent on what access to + do! This is largely dependent on what access to your network you want to allow from the outside, and how much access to the outside world you want to allow from the inside. Some general rules are: - + @@ -6445,7 +6438,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - Block all incoming UDP + Block all incoming UDP traffic. There are very few useful services that travel over UDP, and what useful traffic there is is normally a security threat (e.g. Suns RPC and NFS protocols). This has its @@ -6478,7 +6471,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Another checklist for firewall configuration is available from CERT at LPD controls everything about a host's printers. It is responsible for a number of things: - + @@ -6566,7 +6559,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Through a configuration file, and by providing the special filter programs, you can enable the LPD system to do all or some @@ -6584,7 +6577,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 to enable direct access to a printer, you should use the spooler anyway since - + @@ -6608,7 +6601,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6620,7 +6613,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 set up both your printer hardware and the LPD software. This document describes two levels of setup: - + @@ -6639,7 +6632,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6702,7 +6695,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Nearly all printers you can get for a PC today support one or both of the following interfaces: - + @@ -6729,7 +6722,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + In general, serial interfaces are slower than parallel interfaces. Parallel interfaces usually offer just one-way @@ -6756,7 +6749,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 So, which interface should you use? - + @@ -6778,7 +6771,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6792,8 +6785,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 should give you complete guidance. Remember which parallel port you used on the computer. The - first parallel port is /dev/lpt0 to FreeBSD; the second is - /dev/lpt1, and so on. + first parallel port is /dev/lpt0 to FreeBSD; the second is + /dev/lpt1, and so on. @@ -6814,7 +6807,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 A modem cable connects each pin of the connector on one end of the cable straight through to its corresponding pin of the connector on the other - end. This type of cable is also known as a DTE-to-DCE + end. This type of cable is also known as a DTE-to-DCE cable. @@ -6823,7 +6816,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 pins straight through, swaps others (send data to receive data, for example), and shorts some internally in each connector hood. This type of cable is also known as a - DTE-to-DTE cable. + DTE-to-DTE cable. @@ -6843,7 +6836,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 the printer can support. Choose 7 or 8 data bits; none, even, or odd parity; and 1 or 2 stop bits. Also choose a flow control protocol: either none, or XON/XOFF (also known as - in-band or software) + in-band or software) flow control. Remember these settings for the software configuration that follows. @@ -6857,40 +6850,39 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 This section describes the software setup necessary to print with the LPD spooling system in FreeBSD. - Here is an outline of the steps involved: - + Here is an outline of the steps involved: + + - + Configure your kernel, if necessary, for the port you are using for the printer; section tells you what you need to do. - + - + Set the communications mode for the parallel port, if you are using a parallel port; section gives details. - + - + Test if the operating system can send data to the printer. Section gives some suggestions on how to do this. - + - + Set up LPD for the printer by modifying the file /etc/printcap. Section shows you how. - + - - - + @@ -6904,11 +6896,13 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 To find out if the kernel you are currently using supports a serial interface, type + &prompt.root; dmesg | grep sioN where N is the number of the serial port, starting from zero. If you see output similar to the following + sio2 at 0x3e8-0x3ef irq 5 on isa sio2: type 16550A @@ -6916,11 +6910,13 @@ sio2: type 16550A To find out if the kernel supports a parallel interface, type + &prompt.root; dmesg | grep lptN where N is the number of the parallel port, starting from zero. If you see output similar to the following + lpt0 at 0x378-0x37f on isa then the kernel supports the port. @@ -6946,25 +6942,28 @@ sio2: type 16550A send and receive data. That is what entries in the /dev directory are for. - To add a /dev - entry for a port: - + To add a /dev + entry for a port: + + - + Become root with the su command. Enter the root password when prompted. - + - + Change to the /dev directory: + &prompt.root; cd /dev - + - + Type + &prompt.root; ./MAKEDEV port where port is the device entry for the @@ -6973,18 +6972,18 @@ sio2: type 16550A so on; use ttyd0 for the first serial port, ttyd1 for the second, and so on. - + - + Type + &prompt.root; ls -l port to make sure the device entry got created. - + - - + @@ -6997,7 +6996,7 @@ sio2: type 16550A whether FreeBSD should use interrupt-driven or polled communication with the printer. - + @@ -7015,7 +7014,7 @@ sio2: type 16550A - + The interrupt-driven method is somewhat faster but uses up a precious IRQ line. You should use whichever one @@ -7027,11 +7026,12 @@ sio2: type 16550A program. - To set the communications mode by - configuring the kernel: - + To set the communications mode by + configuring the kernel: + + - + Edit your kernel configuration file. Look for or add an lpt0 entry. If you are setting up the second parallel port, use lpt1 instead. Use lpt2 for the third port, and so @@ -7041,6 +7041,7 @@ sio2: type 16550A If you want interrupt-driven mode, add the irq specifier: + device lpt0 at isa? port? tty irq N vector lptintr where N is the IRQ number for your @@ -7050,6 +7051,7 @@ device lpt0 at isa? port? tty irq N vector lptintr If you want polled mode, do not add the irq specifier: + device lpt0 at isa? port? tty vector lptintr @@ -7057,39 +7059,43 @@ device lpt0 at isa? port? tty vector lptintr - + - + Save the file. Then configure, build, and install the kernel, then reboot. See for more details. - + - - + - To set the communications mode + To set the communications mode with - lptcontrol: - + lptcontrol: + + - + Type + &prompt.root; lptcontrol -i -u N to set interrupt-driven mode for lptN. - + - + Type + &prompt.root; lptcontrol -p -u N to set polled-mode for lptN. - + - You could put these commands in your + + + You could put these commands in your /etc/rc.local file to set the mode each time your system boots. See lptcontrol8 for more information. @@ -7140,16 +7146,17 @@ showpage communicate with a printer connected to a parallel port. - To test a printer on a parallel - port: - + To test a printer on a parallel + port: + + - + Become root with su. - + - + Send data to the printer. @@ -7157,6 +7164,7 @@ showpage If the printer can print plain text, then use lptest. Type: + &prompt.root; lptest > /dev/lptN where N is the number of the @@ -7167,6 +7175,7 @@ showpage If the printer understands PostScript or other printer language, then send a small program to the printer. Type + &prompt.root; cat > /dev/lptN Then, line by line, type the @@ -7178,6 +7187,7 @@ showpage Alternatively, you can put the program in a file and type + &prompt.root; cat file > /dev/lptN where file is the name of the @@ -7187,10 +7197,9 @@ showpage - + - - + You should see something print. Do not worry if the text does not look right; we will fix such things @@ -7205,18 +7214,20 @@ showpage This section tells you how to check if FreeBSD can communicate with a printer on a serial port. - To test a printer on a serial - port: - + To test a printer on a serial + port: + + - + Become root with su. - + - + Edit the file /etc/remote. Add the following entry: + printer:dv=/dev/port:br#bps-rate:pa=parity where port is the device entry for the @@ -7229,12 +7240,13 @@ printer:dv=/dev/port:br#bps-rateHere is a sample entry for a printer connected via a serial line to the third serial port at 19200 bps with no parity: + printer:dv=/dev/ttyd2:br#19200:pa=none - + - + Connect to the printer with tip. Type: @@ -7243,9 +7255,9 @@ printer:dv=/dev/ttyd2:br#19200:pa=none the file /etc/remote again and try using /dev/cuaaN instead of /dev/ttydN. - + - + Send data to the printer. @@ -7253,6 +7265,7 @@ printer:dv=/dev/ttyd2:br#19200:pa=none If the printer can print plain text, then use lptest. Type: + ~$lptest @@ -7271,6 +7284,7 @@ printer:dv=/dev/ttyd2:br#19200:pa=none Alternatively, you can put the program in a file and type + ~>file where file is the name of the @@ -7281,10 +7295,9 @@ printer:dv=/dev/ttyd2:br#19200:pa=none - + - - + You should see something print. Do not worry if the text does not look right; we will fix that later. @@ -7314,63 +7327,61 @@ printer:dv=/dev/ttyd2:br#19200:pa=none printcap file is straightforward. Use your favorite text editor to make changes to /etc/printcap. The format is identical to other capability files like /usr/share/misc/termcap and /etc/remote. For complete information about the format, see the cgetent3. The simple spooler configuration consists of the following - steps: - + steps: + + - + Pick a name (and a few convenient aliases) for the printer, and put them in the /etc/printcap file; see . - + - + Turn off header pages (which are on by default) by - inserting the sh capability; + inserting the sh capability; see . - + - + Make a spooling directory, and specify its location - with the sd capability; see + with the sd capability; see . - + - + Set the /dev entry to use for the printer, and note it in /etc/printcap - with the lp capability; see + with the lp capability; see . Also, if the printer is on a serial port, set - up the communication parameters with the fs, fc, xs, and xc capabilities; see fs, fc, + xs, and xc capabilities; see . - + - + Install a plain text input filter; see - + - + Test the setup by printing something with the lpr command; see and . - + - - + Language-based printers, such as PostScript printers, @@ -7435,18 +7446,15 @@ rattan|line|diablo|lp|Diablo 630 Line Printer: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: In this example, the first printer is named - rattan and has as aliases - line, diablo, lp, and Diablo 630 - Line Printer. Since it has the alias lp, it is also the default printer. The - second is named bamboo, and has - as aliases ps, - , S, - panasonic, and Panasonic KX-P4455 PostScript - v51.4. + rattan and has as aliases + line, diablo, + lp, and Diablo 630 + Line Printer. Since it has the alias lp, it is also the default printer. The + second is named bamboo, and has + as aliases ps, + PS, S, + panasonic, and Panasonic KX-P4455 PostScript + v51.4. @@ -7462,11 +7470,9 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: way of debugging the simple printer setup, so we will suppress header pages. - To suppress header pages, add the sh capability to the entry for the + To suppress header pages, add the sh capability to the entry for the printer in /etc/printcap. Here is the - example /etc/printcap with sh added: + example /etc/printcap with sh added: # @@ -7478,7 +7484,8 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh: - Note how we used the correct format: the + + Note how we used the correct format: the first line starts in the leftmost column, and subsequent lines are indented with a single TAB. Every line in an entry except the last ends in a backslash character. @@ -7503,13 +7510,15 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ It is also customary to make the directory with a name that is identical to the name of the printer, as shown below: + &prompt.root; mkdir /var/spool/printer-name However, if you have a lot of printers on your network, you might want to put the spooling directories under a single directory that you reserve just for printing with LPD. We will do this for our two example printers - rattan and bamboo: + rattan and bamboo: + &prompt.root; mkdir /var/spool/lpd &prompt.root; mkdir /var/spool/lpd/rattan @@ -7524,19 +7533,19 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ searchable by user daemon and group daemon, and no one else. We will do this for our example printers: - + &prompt.root; chown daemon.daemon /var/spool/lpd/rattan &prompt.root; chown daemon.daemon /var/spool/lpd/bamboo &prompt.root; chmod 770 /var/spool/lpd/rattan &prompt.root; chmod 770 /var/spool/lpd/bamboo - + Finally, you need to tell LPD about these directories using the /etc/printcap file. You specify the pathname of the spooling directory with the - sd capability: + sd capability: # @@ -7548,13 +7557,13 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo: - Note that the name of the printer starts in + + Note that the name of the printer starts in the first column but all other entries describing the printer should be indented with a tab and each line escaped with a backslash. - If you do not specify a spooling directory with sd, the spooling system will use + If you do not specify a spooling directory with sd, the spooling system will use /var/spool/lpd as a default. @@ -7573,13 +7582,12 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ printer). List the /dev entry pathname in the - /etc/printcap file using the lp capability. + /etc/printcap file using the lp capability. In our running example, let us assume that rattan is on the first parallel port, and bamboo is on a sixth serial port; here are the additions to - /etc/printcap: + /etc/printcap: # @@ -7592,7 +7600,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5: - + If you do not specify the lp capability for a printer in your @@ -7617,6 +7625,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ rate, parity, and other serial communication parameters on behalf of the filter program that sends data to the printer. This is advantageous since + @@ -7638,70 +7647,62 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ capabilities control serial communication parameters of the device listed in the lp capability: + - br#bps-rate + br#bps-rate Sets the communications speed of the device to - bps-rate, where - bps-rate can be 50, 75, + bps-rate, where + bps-rate can be 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, or 38400 bits-per-second. - fc#clear-bits + fc#clear-bits - Clears the flag bits clear-bits in the sgttyb structure after opening + Clears the flag bits + clear-bits in the + sgttyb structure after opening the device. - fs#set-bits + fs#set-bits - Sets the flag bits set-bits in the sgttyb structure. + Sets the flag bits + set-bits in the + sgttyb structure. - xc#clear-bits + xc#clear-bits - Clears local mode bits clear-bits after opening the + Clears local mode bits clear-bits after opening the device. - xs#set-bits + xs#set-bits - Sets local mode bits set-bits. + Sets local mode bits set-bits. For more information on the bits for the - fc, fs, xc, - and xs capabilities, see the + fc, fs, xc, + and xs capabilities, see the file /usr/include/sys/ioctl_compat.h. - When LPD opens the device specified by the lp capability, it reads the flag bits in + When LPD opens the device specified by the lp capability, it reads the flag bits in the sgttyb structure; it clears - any bits in the fc capability, - then sets bits in the fs + any bits in the fc capability, + then sets bits in the fs capability, then applies the resultant setting. It does the same for the local mode bits as well. @@ -7729,8 +7730,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ program that LPD runs when it has a job to print. When LPD runs the text filter for a printer, it sets the filter's standard input to the job to print, and its standard output to - the printer device specified with the lp capability. The filter is expected + the printer device specified with the lp capability. The filter is expected to read the job from standard input, perform any necessary translation for the printer, and write the results to standard output, which will get printed. For more information on the @@ -7740,9 +7740,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ For our simple printer setup, the text filter can be a small shell script that just executes - /bin/cat to send the job to the printer. - FreeBSD comes with another filter called lpf that handles backspacing and + /bin/cat to send the job to the printer. + FreeBSD comes with another filter called lpf that handles backspacing and underlining for printers that might not deal with such character streams well. And, of course, you can use any other filter program you want. The filter lpf is described in detail in section @@ -7766,15 +7765,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ exit 2 Make the file executable: + &prompt.root; chmod 555 /usr/local/libexec/if-simple And then tell LPD to use it by specifying it with the - if capability in + if capability in /etc/printcap. We will add it to the two printers we have so far in the example - /etc/printcap: + /etc/printcap: # @@ -7788,7 +7788,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:\ :if=/usr/local/libexec/if-simple: - + @@ -7811,10 +7811,11 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ remap="Checking Printer Communications"> to generate some test text. - To test the simple LPD + To test the simple LPD setup: Type: + &prompt.root; lptest 20 5 | lpr -Pprinter-name where -P argument. Again, if you are testing a printer that expects PostScript, send a PostScript program in that language instead of using - lptest. You can do so by putting the program in a file and typing lpr file. + lptest. You + can do so by putting the program in a file and typing lpr file. For a PostScript printer, you should get the results of the program. If you are using @@ -7856,7 +7858,10 @@ $%&'()*+,-./01234567 Troubleshooting After performing the simple test with - lptest, you might have gotten one of the following results instead of the correct printout: + lptest, you + might have gotten one of the following results instead of the + correct printout: + It worked, after awhile; or, it did not eject a full sheet. @@ -8037,12 +8042,30 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ Use the printer's configuration switches or control panel to enforce the following interpretation - of LF and CR characters: - - Printer received CR Printer prints - CR Printer received LF Printer prints - CR + LF - + of LF and CR characters: + + + + + + Printer receives + Printer prints + + + + + + CR + CR + + + + LF + CR + LF + + + + @@ -8064,14 +8087,12 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If the printer supports XON/XOFF flow control, have FreeBSD use it by specifying the - TANDEM bit in the fs capability. + TANDEM bit in the fs capability. If the printer supports carrier flow - control, specify the MDMBUF bit in the fs capability. Make sure + control, specify the MDMBUF bit in the fs capability. Make sure the cable connecting the printer to the computer is correctly wired for carrier flow control. @@ -8080,7 +8101,7 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If the printer does not support any flow control, use some combination of the NLDELAY, TBDELAY, CRDELAY, VTDELAY, and BSDELAY bits in - the fs capability + the fs capability to add appropriate delays to the stream of data sent to the printer. @@ -8098,10 +8119,9 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ This is usually another symptom of incorrect communications parameters with a serial printer. - Double-check the bps rate in the br capability, and the parity - bits in the fs and - fc capabilities; make + Double-check the bps rate in the br capability, and the parity + bits in the fs and + fc capabilities; make sure the printer is using the same settings as specified in the /etc/printcap file. @@ -8113,11 +8133,11 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If nothing happened, the problem is probably within FreeBSD and not the hardware. Add the log file - (lf) capability to the + (lf) capability to the entry for the printer you are debugging in the /etc/printcap file. For example, - here is the entry for rattan, with the lf capability: + here is the entry for rattan, with + the lf capability: rattan|line|diablo|lp|Diablo 630 Line Printer:\ @@ -8131,14 +8151,12 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ error messages that might appear. Based on the messages you see, try to correct the problem. - If you do not specify a lf capability, LPD uses + If you do not specify a lf capability, LPD uses /dev/console as a default. - @@ -8150,7 +8168,8 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ Using Printers This section tells you how to use printers you have setup with - FreeBSD. Here is an overview of the user-level commands: + FreeBSD. Here is an overview of the user-level commands: + lpr @@ -8175,8 +8194,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ - - + There is also an administrative command, lpc, described in the section lprm, and lpq - accept an option printer-name to specify on which + accept an option to specify on which printer/queue to operate, as listed in the /etc/printcap file. This enables you to submit, remove, and check on jobs for various printers. If you do not use the option, then these commands use the - printer specified in the PRINTER environment variable. Finally, if - you do not have a PRINTER environment variable, these commands + printer specified in the PRINTER environment variable. Finally, if + you do not have a PRINTER environment variable, these commands default to the printer named lp. Hereafter, the terminology default printer - means the printer named in the PRINTER environment variable, or the - printer named lp when there is no - PRINTER environment variable. + means the printer named in the PRINTER environment variable, or the + printer named lp when there is no + PRINTER environment variable. Printing Jobs To print files, type + &prompt.user; lpr filename ... This prints each of the listed files to the @@ -8217,13 +8235,16 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ lpr reads data to print from standard input. For example, this command prints some important system files: + &prompt.user; lpr /etc/host.conf /etc/hosts.equiv To select a specific printer, type + &prompt.user; lpr -P printer-name filename ... This example prints a long listing of the - current directory to the printer named rattan: + current directory to the printer named rattan: + &prompt.user; ls -l | lpr -P rattan Because no files were listed for the @@ -8250,7 +8271,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ When you print with lpr, the data you wish to print is put together in a package called a - print job, which is sent to the LPD spooling + print job, which is sent to the LPD spooling system. Each printer has a queue of jobs, and your job waits in that queue along with other jobs from yourself and from other users. The printer prints those jobs in a first-come, first-served @@ -8261,10 +8282,12 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ lpq. For a specific printer, use the option. For example, the command + &prompt.user; lpq -P bamboo shows the queue for the printer named bamboo. Here is an example of the output of the lpq command: + bamboo is ready and printing Rank Owner Job Files Total Size @@ -8272,8 +8295,8 @@ active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes 2nd kelly 10 (standard input) 1635 bytes 3rd mary 11 ... 78519 bytes This shows three jobs in the queue for - bamboo. The first job, submitted by - user kelly, got assigned job number 9. Every + bamboo. The first job, submitted by + user kelly, got assigned job number 9. Every job for a printer gets a unique job number. Most of the time you can ignore the job number, but you will need it if you want to cancel the job; see section @@ -8305,7 +8328,8 @@ active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes The lpq command also support a option to generate a detailed - long listing. Here is an example of lpq -l: + long listing. Here is an example of lpq -l: + waiting for bamboo to become ready (offline ?) kelly: 1st [job 009rose] @@ -8317,7 +8341,7 @@ kelly: 2nd [job 010rose] mary: 3rd [job 011rose] /home/orchid/mary/research/venus/alpha-regio/mapping 78519 bytes - + @@ -8339,14 +8363,21 @@ mary: 3rd [job 011rose] the job number. Then type &prompt.user; lprm job-number - To remove the job from a specific printer, add + + + To remove the job from a specific printer, add the option. The following command removes job - number 10 from the queue for the printer bamboo: + number 10 from the queue for the printer + bamboo: + &prompt.user; lprm -P bamboo 10 - The + + + The lprm - command has a few shortcuts: + command has a few shortcuts: + lprm - @@ -8355,12 +8386,11 @@ mary: 3rd [job 011rose] - lprm user + lprm user Removes all jobs (for the default printer) belonging - to user. The superuser can + to user. The superuser can remove other users' jobs; you can remove only your own jobs. @@ -8377,12 +8407,11 @@ mary: 3rd [job 011rose] - Just use the option with the above shortcuts to operate on a specific printer instead of the default. For example, the following command removes all jobs for the - current user in the queue for the printer named rattan: + current user in the queue for the printer named rattan: &prompt.user; lprm -P rattan - @@ -8390,13 +8419,12 @@ mary: 3rd [job 011rose] If you are working in a networked - environment, - - + environment, lprm will let you remove jobs only from the host from which the jobs were submitted, even if the same printer is available from other - hosts. The following command sequence demonstrates this: + hosts. The following command sequence demonstrates this: + &prompt.user; lpr -P rattan myfile &prompt.user; rlogin orchid @@ -8411,7 +8439,7 @@ rose: Permission denied dfA013rose dequeued cfA013rose dequeued - + @@ -8442,10 +8470,12 @@ cfA013rose dequeued For example, the following command prints a DVI file (from the TeX typesetting system) named fish-report.dvi to the printer named - bamboo: + bamboo: &prompt.user; lpr -P bamboo -d fish-report.dvi - These options apply to every file in the job, + + + These options apply to every file in the job, so you cannot mix (say) DVI and ditroff files together in a job. Instead, submit the files as separate jobs, using a different conversion option for each job. @@ -8459,7 +8489,7 @@ cfA013rose dequeued Filters"> gives details. - + @@ -8492,9 +8522,8 @@ cfA013rose dequeued number - Indent the output by number columns; if you omit - number, indent by 8 + Indent the output by number columns; if you omit + number, indent by 8 columns. This option works only with certain conversion filters. @@ -8534,7 +8563,7 @@ cfA013rose dequeued title - Use title on the + Use title on the pr header instead of the file name. This option has effect @@ -8557,15 +8586,18 @@ cfA013rose dequeued - + Here is an example: this command prints a nicely formatted version of the ls manual - page on the default printer: + page on the default printer: + &prompt.user; zcat /usr/share/man/man1/ls.1.gz | troff -t -man | lpr -t - The + + + The zcat command uncompresses the source of the @@ -8596,11 +8628,9 @@ cfA013rose dequeued - -# copies + -# copies - Produce a number of copies of each file in the job + Produce a number of copies of each file in the job instead of just one copy. An administrator may disable this option to reduce printer wear-and-tear and encourage photocopier usage. See section This example prints three copies of parser.c followed by three copies - of parser.h to the default printer: + of parser.h to the default + printer: + &prompt.user; lpr -#3 parser.c parser.h - + @@ -8682,24 +8714,22 @@ cfA013rose dequeued linkend="printing-advanced-header-pages" remap="Header Pages"> for information about setting up header pages. - + - -C text + -C text Replace the hostname on the header page with - text. The hostname is + text. The hostname is normally the name of the host from which the job was submitted. - -J text + -J text Replace the job name on the header page with - text. The job name is + text. The job name is normally the name of the first file of the job, or stdin if you are printing standard input. @@ -8719,7 +8749,7 @@ cfA013rose dequeued - + @@ -8779,24 +8809,23 @@ cfA013rose dequeued Here is a summary of the lpc - commands. Most of the commands takes a printer-name argument to tell on which + commands. Most of the commands takes a printer-name argument to tell on which printer to operate. You can use all - for the printer-name to mean all + for the printer-name to mean all printers listed in /etc/printcap. - + - abort - printer-name + abort + printer-name Cancel the current job and stop the printer. Users can still submit jobs if the queue's enabled. - clean - printer-name + clean + printer-name Remove old files from the printer's spooling @@ -8808,8 +8837,8 @@ cfA013rose dequeued - disable - printer-name + disable + printer-name Disable queuing of new jobs. If the printer's @@ -8821,18 +8850,19 @@ cfA013rose dequeued printer or filter installation: disable the queue and submit jobs as root. Other users will not be able to submit jobs until you complete your testing and re-enable - the queue with the enable + the queue with the enable command. - down + down printer-name - message... + message - Take a printer down. Equivalent to disable followed by stop. The message appears as the printer's + Take a printer down. Equivalent to + disable followed by + stop. The message appears as the printer's status whenever a user checks the printer's queue with lpq @@ -8841,8 +8871,8 @@ cfA013rose dequeued - enable - printer-name + enable + printer-name Enable the queue for a printer. Users can submit jobs @@ -8851,19 +8881,19 @@ cfA013rose dequeued - help - command-name + help + command-name - Print help on the command command-name. With no command-name, print a summary of the + Print help on the command + command-name. With no + command-name, print a summary of the commands available. - restart - printer-name + restart + printer-name Start the printer. Ordinary users can use this @@ -8875,8 +8905,8 @@ cfA013rose dequeued - start - printer-name + start + printer-name Start the printer. The printer will print jobs in its @@ -8884,8 +8914,8 @@ cfA013rose dequeued - stop - printer-name + stop + printer-name Stop the printer. The printer will finish the current @@ -8895,23 +8925,21 @@ cfA013rose dequeued - topq + topq printer-name - job-or-username... + job-or-username - Rearrange the queue for printer-name by placing the jobs - with the listed job numbers - or the jobs belonging to username at the top of the queue. - For this command, you cannot use all as the printer-name. + Rearrange the queue for printer-name by placing the jobs + with the listed job numbers + or the jobs belonging to username at the top of the queue. + For this command, you cannot use all as + the printer-name. - up - printer-name + up + printer-name Bring a printer up; the opposite of the down command. Equivalent to @@ -8919,7 +8947,7 @@ cfA013rose dequeued - + lpc accepts @@ -8973,7 +9001,7 @@ cfA013rose dequeued Here is what you will find in this section: - + @@ -9045,7 +9073,6 @@ cfA013rose dequeued - When LPD wants to print a file in a job, it starts a filter program. It sets the filter's standard input to the file to print, its standard output to the printer, and its standard - error to the error logging file (specified in the lf capability in + error to the error logging file (specified in the lf capability in /etc/printcap, or /dev/console by default). @@ -9072,15 +9098,16 @@ cfA013rose dequeued lpr command line. For example, if the user typed lpr -t, LPD would start the troff filter, listed in the - tf capability for the destination + tf capability for the destination printer. If the user wanted to print plain text, it would start - the if filter (this is mostly + the if filter (this is mostly true: see for details). There are three kinds of filters you can specify in - /etc/printcap: + /etc/printcap: + @@ -9097,6 +9124,7 @@ cfA013rose dequeued and comparing that to the number of lines per page the printer supports. The text filter is started with the following argument list: + filter-name -c @@ -9107,6 +9135,7 @@ cfA013rose dequeued -h host acct-file where + @@ -9115,29 +9144,24 @@ cfA013rose dequeued - width + width - is the value from the pw (page width) capability + is the value from the pw (page width) capability specified in /etc/printcap, default 132 - length + length - is the value from the pl (page length) capability, + is the value from the pl (page length) capability, default 66 - indent + indent is the amount of the indentation from @@ -9145,8 +9169,7 @@ cfA013rose dequeued - login + login is the account name of the user printing the @@ -9154,8 +9177,7 @@ cfA013rose dequeued - host + host is the host name from which the job was @@ -9163,12 +9185,11 @@ cfA013rose dequeued - acct-file + acct-file is the name of the accounting file from the - af + af capability. @@ -9189,6 +9210,7 @@ cfA013rose dequeued Conversion filters also need to do accounting, if you need printer accounting. Conversion filters are started with the following arguments: + filter-name -h host acct-file where pixel-width is the value from the - px capability (default 0) + px capability (default 0) and pixel-height is the - value from the py capability + value from the py capability (default 0). @@ -9211,6 +9233,7 @@ cfA013rose dequeued describe them. There are only two arguments to an output filter: + filter-name -wwidth @@ -9222,10 +9245,10 @@ cfA013rose dequeued - Filters should also exit with the - following exit status: + following exit status: + exit 0 @@ -9252,7 +9275,6 @@ cfA013rose dequeued - The text filter that comes with the FreeBSD release, /usr/libexec/lpr/lpf, takes advantage of @@ -9314,17 +9336,19 @@ cfA013rose dequeued is part of lprps. If you installed lprps from the ports collection, use the following in the serial PostScript printer's - entry in /etc/printcap: + entry in /etc/printcap: + :if=/usr/local/libexec/psif: - You should also specify the rw capability; that tells LPD to open the + + + You should also specify the rw capability; that tells LPD to open the printer in read-write mode. If you have a parallel PostScript printer (and therefore cannot use two-way communication with the printer, which lprps needs), you can use the - following shell script as the text filter: + following shell script as the text filter: #!/bin/sh @@ -9351,7 +9375,8 @@ else exit 2 fi - In the above script, textps is a program we installed + + In the above script, textps is a program we installed separately to convert plain text to PostScript. You can use any text-to-PostScript program you wish. The FreeBSD ports collection (see if capability: :if=/usr/local/libexec/hpif: That is it. You can type lpr plain.text and lpr @@ -9457,17 +9483,23 @@ exit 2 typesetting system, and we have a PostScript printer. Every time we generate a DVI file from TeX, we cannot print it directly until we convert the DVI file into PostScript. The - command sequence goes like this: + command sequence goes like this: + &prompt.user; dvips seaweed-analysis.dvi &prompt.user; lpr seaweed-analysis.ps - By installing a conversion filter for DVI + + + By installing a conversion filter for DVI files, we can skip the hand conversion step each time by having LPD do it for us. Now, each time we get a DVI file, we - are just one step away from printing it: + are just one step away from printing it: + &prompt.user; lpr -d seaweed-analysis.dvi - We got LPD to do the DVI file conversion + + + We got LPD to do the DVI file conversion for us by specifying the option. Section @@ -9558,10 +9590,10 @@ exit 2 - + In our example, using lpr -d means the - printer needs a df capability in + printer needs a df capability in its entry in /etc/printcap. Despite what others might contend, formats like FORTRAN @@ -9571,7 +9603,7 @@ exit 2 would like to directly print Printerleaf files (files from the Interleaf desktop publishing program), but will never print plot files. You could install a Printerleaf conversion filter - under the gf capability and then + under the gf capability and then educate your users that lpr -g mean print Printerleaf files. @@ -9592,10 +9624,10 @@ exit 2 /etc/printcap. In our example, we will add the DVI conversion filter to - the entry for the printer named bamboo. Here is the example + the entry for the printer named bamboo. Here is the example /etc/printcap file again, with the new - df capability for the printer - bamboo + df capability for the printer + bamboo. # @@ -9612,9 +9644,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - The DVI filter is a shell script named + + The DVI filter is a shell script named /usr/local/libexec/psdf. Here is that - script: + script: #!bin/sh @@ -9626,7 +9659,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ # exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" - This script runs + + This script runs dvips in filter mode (the argument) on standard input, which is the job to print. It then starts the PostScript printer filter lprps (see section ) with the arguments LPD passed to this script. @@ -9645,7 +9679,7 @@ exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" This example script is a raster (well, GIF file, actually) conversion filter for a Hewlett Packard LaserJet III-Si - printer: + printer: #!/bin/sh @@ -9657,13 +9691,14 @@ PATH=/usr/X11R6/bin:$PATH; export PATH giftopnm | ppmtopgm | pgmtopbm | pbmtolj && exit 0 \ || exit 2 - It works by converting the GIF file into a + + It works by converting the GIF file into a portable anymap, converting that into a portable graymap, converting that into a portable bitmap, and converting that into LaserJet/PCL-compatible data. Here is the /etc/printcap file with - an entry for a printer using the above filter: + an entry for a printer using the above filter: # @@ -9673,11 +9708,11 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sh:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/hpif:\ :vf=/usr/local/libexec/hpvf: - + The following script is a conversion filter for troff data from the groff typesetting system for the PostScript printer - named bamboo: + named bamboo: #!/bin/sh @@ -9687,9 +9722,10 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ # exec grops | /usr/local/libexec/lprps "$@" - The above script makes use of lprps again to handle the communication + + The above script makes use of lprps again to handle the communication with the printer. If the printer were on a parallel port, we - would use this script instead: + would use this script instead: #!/bin/sh @@ -9699,17 +9735,19 @@ exec grops | /usr/local/libexec/lprps "$@" # exec grops - That is it. Here is the entry we need to + + That is it. Here is the entry we need to add to /etc/printcap to enable the - filter: + filter: + :tf=/usr/local/libexec/pstf: - + Here is an example that might make old hands at FORTRAN blush. It is a FORTRAN-text filter for any printer that can directly print plain text. We will install it for the printer - teak: + teak: #!/bin/sh @@ -9721,19 +9759,23 @@ exec grops printf "\033&k2G" && fpr && printf "\f" && exit 0 exit 2 - And we will add this line to the - /etc/printcap for the printer teak to enable this filter: + + And we will add this line to the + /etc/printcap for the printer + teak to enable this filter: + :rf=/usr/local/libexec/hprf: - + Here is one final, somewhat complex example. We will add - a DVI filter to the LaserJet printer teak introduced earlier. First, the + a DVI filter to the LaserJet printer teak introduced earlier. First, the easy part: updating /etc/printcap with - the location of the DVI filter: + the location of the DVI filter: + :df=/usr/local/libexec/hpdf: - + Now, for the hard part: making the filter. For that, we need a DVI-to-LaserJet/PCL conversion program. The FreeBSD @@ -9761,9 +9803,8 @@ exit 2 The only other fly in the ointment is the fact that we cannot use /tmp for the temporary link. - Symbolic links are owned by user and group bin. The filter runs as user daemon. And the + Symbolic links are owned by user and group + bin. The filter runs as user daemon. And the /tmp directory has the sticky bit set. The filter can create the link, but it will not be able clean up when done and remove it since the link will belong to a @@ -9771,13 +9812,13 @@ exit 2 Instead, the filter will make the symbolic link in the current working directory, which is the spooling directory - (specified by the sd capability + (specified by the sd capability in /etc/printcap). This is a perfect place for filters to do their work, especially since there is (sometimes) more free disk space in the spooling directory than under /tmp. - Here, finally, is the filter: + Here, finally, is the filter: #!/bin/sh @@ -9839,7 +9880,7 @@ dvilj2p -M1 -q -e- dfhp$$.dvi # cleanup exit 0 - + @@ -9901,13 +9942,14 @@ exit 0 LPD does not pass the user's login or host to the filter, so it is not intended to do accounting. In fact, it gets only two arguments: + filter-name -wwidth -llength - where width is from the pw capability and length is from the pl capability for the printer in + where width is + from the pw capability and + length is from the pl capability for the printer in question. @@ -9980,8 +10022,7 @@ exit 0 In order for lpf to do page accounting correctly, it needs correct values filled in for the - pw and pl capabilities in the + pw and pl capabilities in the /etc/printcap file. It uses these values to determine how much text can fit on a page and how many pages were in a user's job. For more information on printer @@ -10029,15 +10070,14 @@ exit 0 Printer Setup">, we turned off header pages by specifying sh (meaning suppress header) in the /etc/printcap file. To - enable header pages for a printer, just remove the sh capability. + enable header pages for a printer, just remove the sh capability. Sounds too easy, right? You are right. You might have to provide an output filter to send initialization strings to the printer. Here is an example output filter for Hewlett Packard - PCL-compatible printers: + PCL-compatible printers: #!/bin/sh @@ -10048,15 +10088,16 @@ exit 0 printf "\033&k2G" || exit 2 exec /usr/libexec/lpr/lpf - Specify the path to the output filter in the - of capability. See Specify the path to the output filter in the + of capability. See for more information. Here is an example /etc/printcap file - for the printer teak that we + for the printer teak that we introduced earlier; we enabled header pages and added the above - output filter: + output filter: # @@ -10068,7 +10109,8 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :vf=/usr/local/libexec/hpvf:\ :of=/usr/local/libexec/hpof: - Now, when users print jobs to teak, they get a header page with each + + Now, when users print jobs to teak, they get a header page with each job. If users want to spend time searching for their printouts, they can suppress header pages by submitting the job with lpr -h; see LPD prints a form feed character after the header page. If your printer uses a different character or sequence of - characters to eject a page, specify them with the ff capability in + characters to eject a page, specify them with the ff capability in /etc/printcap. @@ -10094,7 +10135,8 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ By enabling header pages, LPD will produce a long header, a full page of large letters identifying the user, host, and job. Here is an example (kelly printed the - job named outline from host rose): + job named outline from host rose): + k ll ll k l l @@ -10143,19 +10185,23 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ Job: outline Date: Sun Sep 17 11:04:58 1995 - LPD appends a form feed after this text so - the job starts on a new page (unless you have sf (suppress form feeds) in the + + + LPD appends a form feed after this text so + the job starts on a new page (unless you have sf (suppress form feeds) in the destination printer's entry in /etc/printcap). If you prefer, LPD can make a short header; specify sb (short banner) in the /etc/printcap file. - The header page will look like this: + The header page will look like this: + rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 - Also by default, LPD prints the header page + + + Also by default, LPD prints the header page first, then the job. To reverse that, specify hl (header last) in /etc/printcap. @@ -10222,11 +10268,10 @@ rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 the header page. The only other problem with this method is that the output filter still does not know what accounting file to use (it is not passed the name of the - file from the af + file from the af capability), but if you have a well-known accounting file, you can hard-code that into the output filter. To - facilitate the parsing step, use the sh (short header) capability in + facilitate the parsing step, use the sh (short header) capability in /etc/printcap. Then again, all that might be too much trouble, and users will certainly appreciate the more generous system administrator who @@ -10256,7 +10301,7 @@ rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 Let us explore this method. The following script takes three arguments (user login name, host name, and job name) and - makes a simple PostScript header page: + makes a simple PostScript header page: #!/bin/sh @@ -10339,11 +10384,12 @@ restore showpage EOF - Now, each of the conversion filters and the + + Now, each of the conversion filters and the text filter can call this script to first generate the header page, and then print the user's job. Here is the DVI conversion filter from earlier in this document, modified to make a header - page: + page: #!/bin/sh @@ -10378,7 +10424,8 @@ done ( /usr/local/libexec/make-ps-header $login $host "DVI File" /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args - Notice how the filter has to parse the + + Notice how the filter has to parse the argument list in order to determine the user and host name. The parsing for the other conversion filters is identical. The text filter takes a slightly different set of arguments, though (see @@ -10508,24 +10555,23 @@ done - Leave the lp capability + Leave the lp capability blank, explicitly (:lp=:). Make a spooling directory and specify its location in - the sd capability. LPD will + the sd capability. LPD will store jobs here before they get sent to the printer host. - Place the name of the printer host in the rm capability. + Place the name of the printer host in the rm capability. Place the printer name on the printer - host in the rp + host in the rp capability. @@ -10533,15 +10579,15 @@ done filters, page dimensions, or anything else in the /etc/printcap file. - Here is an example. The host rose has two printers, - bamboo and rattan. We will enable users on the host + Here is an example. The host rose has two printers, + bamboo and rattan. We will enable users on the host orchid to print to those printers. Here is the - /etc/printcap file for orchid (back from + /etc/printcap file for orchid (back from section ). It already had the entry for - the printer teak; we have added - entries for the two printers on the host rose: + the printer teak; we have added + entries for the two printers on the host rose: # @@ -10569,17 +10615,20 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo: - Then, we just need to make spooling - directories on orchid: + + Then, we just need to make spooling + directories on orchid: &prompt.root; mkdir -p /var/spool/lpd/rattan /var/spool/lpd/bamboo &prompt.root; chmod 770 /var/spool/lpd/rattan /var/spool/lpd/bamboo &prompt.root; chown daemon.daemon /var/spool/lpd/rattan /var/spool/lpd/bamboo - + - Now, users on orchid can print to rattan and bamboo. If, for example, a user on orchid + Now, users on orchid can print to + rattan and bamboo. If, for example, a user on orchid typed + &prompt.user; lpr -P bamboo -d sushi-review.dvi the LPD system on orchid would copy the job @@ -10625,7 +10674,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ one-way communication only (FreeBSD to printer); many network printers support two-way communication, and you might want to take advantage of that (to get printer status, perform - accounting, etc.). + accounting, etc.). #!/usr/bin/perl @@ -10652,11 +10701,12 @@ connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!"; while (<STDIN>) { print PRINTER; } exit 0; - We can then use this script in various + + We can then use this script in various filters. Suppose we had a Diablo 750-N line printer connected to the network. The printer accepts data to print on port number 5100. The host name of the printer is scrivener. Here - is the text filter for the printer: + is the text filter for the printer: #!/bin/sh @@ -10664,7 +10714,7 @@ exit 0; # diablo-if-net - Text filter for Diablo printer `scrivener' listening # on port 5100. Installed in /usr/local/libexec/diablo-if-net # exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint scrivener 5100 - + @@ -10693,9 +10743,10 @@ exit 0; on your printers, you can disable the option to lpr by - adding the sc capability to the + adding the sc capability to the /etc/printcap file. When users submit jobs with the option, they will see + lpr: multiple copies are not allowed @@ -10703,17 +10754,16 @@ exit 0; Note that if you have set up access to a printer remotely (see section ), you need - the sc capability on the remote + the sc capability on the remote /etc/printcap files as well, or else users will still be able to submit multiple-copy jobs by using another host. Here is an example. This is the - /etc/printcap file for the host rose. The - printer rattan is quite hearty, so - we will allow multiple copies, but the laser printer bamboo's a bit more delicate, so we will - disable multiple copies by adding the sc capability: + /etc/printcap file for the host rose. The + printer rattan is quite hearty, so + we will allow multiple copies, but the laser printer bamboo's a bit more delicate, so we will + disable multiple copies by adding the sc capability: # @@ -10730,10 +10780,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Now, we also need to add the sc capability on the host orchid's + + Now, we also need to add the sc capability on the host orchid's /etc/printcap (and while we are at it, let - us disable multiple copies for the printer teak): + us disable multiple copies for the printer teak): # @@ -10751,15 +10801,19 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo:sc: - By using the sc + + By using the sc capability, we prevent the use of lpr -#, but that still does not prevent users from running lpr multiple times, or from submitting the same file multiple times - in one job like this: + in one job like this: + &prompt.user; lpr forsale.sign forsale.sign forsale.sign forsale.sign forsale.sign - There are many ways to prevent this abuse + + + There are many ways to prevent this abuse (including ignoring it) which you are free to explore. @@ -10769,29 +10823,31 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ Restricting Access To Printers You can control who can print to what printers by using the - UNIX group mechanism and the rg + UNIX group mechanism and the rg capability in /etc/printcap. Just place the users you want to have access to a printer in a certain - group, and then name that group in the rg capability. + group, and then name that group in the rg capability. Users outside the group (including root) will be greeted with + lpr: Not a member of the restricted group - if they try to print to the controlled + + + if they try to print to the controlled printer. - As with the sc (suppress - multiple copies) capability, you need to specify rg on remote hosts that also have access + As with the sc (suppress + multiple copies) capability, you need to specify rg on remote hosts that also have access to your printers, if you feel it is appropriate (see section ). - For example, we will let anyone access the printer rattan, but only those in group artists can use bamboo. Here is the familiar - /etc/printcap for host rose: + For example, we will let anyone access the printer + rattan, but only those in group + artists can use bamboo. Here is the familiar + /etc/printcap for host rose: # @@ -10808,10 +10864,12 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Let us leave the other example - /etc/printcap file (for the host orchid) - alone. Of course, anyone on orchid can print to bamboo. It might be the case that we only - allow certain logins on orchid anyway, and want them to have + + Let us leave the other example + /etc/printcap file (for the host orchid) + alone. Of course, anyone on orchid can print to + bamboo. It might be the case that we only + allow certain logins on orchid anyway, and want them to have access to the printer. Or not. @@ -10831,7 +10889,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ users. LPD enables you to limit the maximum byte size a file in a - job can be with the mx capability. + job can be with the mx capability. The units are in BUFSIZ blocks, which are 1024 bytes. If you put a zero for this capability, there will be no limit on file size. @@ -10847,9 +10905,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ discarded. Whether this is correct behavior is up for debate. - Let us add limits to our example printers rattan and bamboo. Since those artists' PostScript + Let us add limits to our example printers + rattan and bamboo. Since those artists' PostScript files tend to be large, we will limit them to five megabytes. - We will put no limit on the plain text line printer: + We will put no limit on the plain text line printer: # @@ -10873,10 +10932,11 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Again, the limits apply to the local users + + Again, the limits apply to the local users only. If you have set up access to your printers remotely, remote users will not get those limits. You will need to - specify the mx capability in the + specify the mx capability in the remote /etc/printcap files as well. See section madrigal.fishbaum.de. + If any other host tries to access rose's LPD, LPD will refuse them. @@ -10957,7 +11019,9 @@ madrigal.fishbaum.de minfree file for the printer bamboo. We examine /etc/printcap to find the spooling - directory for this printer; here is bamboo's entry: + directory for this printer; here is + bamboo's entry: + bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:rg=artists:mx#5000:\ @@ -10965,14 +11029,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - The spooling directory is the given - in the sd capability. We + + The spooling directory is the given + in the sd capability. We will make three megabytes (which is 6144 disk blocks) the amount of free disk space that must exist on the - filesystem for LPD to accept remote jobs: + filesystem for LPD to accept remote jobs: + &prompt.root; echo 6144 > /var/spool/lpd/bamboo/minfree - + @@ -10981,10 +11047,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ You can control which remote users can print to - local printers by specifying the rs capability in - /etc/printcap. When rs appears in the entry for a + local printers by specifying the rs capability in + /etc/printcap. When rs appears in the entry for a locally-attached printer, LPD will accept jobs from remote hosts if the user submitting the job also has an account of the same login name on @@ -11004,7 +11068,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ - + @@ -11095,17 +11159,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ starts the text and the conversion filters with the name of the accounting file to use on the filter command line. The filters can use this argument to know where to write an accounting file - entry. The name of this file comes from the af capability in + entry. The name of this file comes from the af capability in /etc/printcap, and if not specified as an absolute path, is relative to the spooling directory. LPD starts lpf with page width - and length arguments (from the pw - and pl capabilities). lpf uses these arguments to determine how + and length arguments (from the pw + and pl capabilities). lpf uses these arguments to determine how much paper will be used. After sending the file to the printer, it then writes an accounting entry in the accounting file. The - entries look like this: + entries look like this: 2.00 rose:andy @@ -11113,7 +11176,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ 3.00 orchid:mary 5.00 orchid:mary 2.00 orchid:zhang - You should use a separate accounting file for + + You should use a separate accounting file for each printer, as lpf has no file locking logic built into it, and two lpfs might corrupt each other's entries if they were to write to the same file at the same time. A easy way @@ -11121,17 +11185,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ af=acct in /etc/printcap. Then, each accounting file will be in the spooling directory for a printer, in a file named - acct. + acct. When you are ready to charge users for printouts, run - the - - + the pac program. Just change to the spooling directory for the printer you want to collect on and type pac. You - will get a dollar-centric summary like the following: + will get a dollar-centric summary like the following: + Login pages/feet runs price orchid:kelly 5.00 1 $ 0.10 @@ -11143,15 +11206,18 @@ rose:mary 87.00 32 $ 1.74 rose:root 26.00 12 $ 0.52 total 337.00 154 $ 6.74 - These are the arguments + + + These are the arguments pac - expects: + expects: + - Which printer to + Which printer to summarize. This option works only if there is an - absolute path in the af + absolute path in the af capability in /etc/printcap. @@ -11168,8 +11234,8 @@ total 337.00 154 $ 6.74 Ignore host name in the accounting files. With this - option, user smith on host alpha is the same user smith - on host gamma. Without, they are different + option, user smith on host alpha is the same user smith + on host gamma. Without, they are different users. @@ -11177,13 +11243,10 @@ total 337.00 154 $ 6.74 - Compute charges with price dollars per page or per foot - instead of the price from the pc capability in + Compute charges with price dollars per page or per foot + instead of the price from the pc capability in /etc/printcap, or two cents (the - default). You can specify price as a floating point + default). You can specify price as a floating point number. @@ -11203,24 +11266,23 @@ total 337.00 154 $ 6.74 - names... + name Print accounting information for the given user - names only. + names only. - In the default summary that pac produces, you see the number of pages printed by each user from various hosts. If, at your site, host does not matter (because users can use any host), run pac -m, to - produce the following summary: + produce the following summary: + Login pages/feet runs price andy 2.00 1 $ 0.04 @@ -11230,10 +11292,12 @@ root 26.00 12 $ 0.52 zhang 9.00 1 $ 0.18 total 337.00 154 $ 6.74 - To compute the dollar amount due, + + + To compute the dollar amount due, pac uses - the pc capability in the + the pc capability in the /etc/printcap file (default of 200, or 2 cents per page). Specify, in hundredths of cents, the price per page or per foot you want to charge for printouts in this @@ -11243,16 +11307,19 @@ total 337.00 154 $ 6.74 the option. The units for the option are in dollars, though, not hundredths of cents. For example, + &prompt.root; pac -p1.50 - makes each page cost one dollar and fifty + + + makes each page cost one dollar and fifty cents. You can really rake in the profits by using this option. Finally, running pac -s will save the summary information in a summary accounting file, which is named the same as the printer's accounting file, but with - _sum appended to the name. It then truncates + _sum appended to the name. It then truncates the accounting file. When you run pac again, it rereads the summary file to get starting totals, then @@ -11328,7 +11395,8 @@ total 337.00 154 $ 6.74 Unfortunately, I have located only two alternatives---and they are almost identical to each other! They - are: + are: + PLP, the Portable Line Printer Spooler System @@ -11384,7 +11452,6 @@ total 337.00 154 $ 6.74 - @@ -11394,7 +11461,7 @@ total 337.00 154 $ 6.74 I would like to thank the following people who have assisted in the development of this document: - + Daniel Eischen deischen@iworks.interworks.org @@ -11421,10 +11488,6 @@ total 337.00 154 $ 6.74 - - - - @@ -28004,7 +28067,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Date created: 5 December 1994 # Whom: asami # -# $Id: handbook.sgml,v 1.37 1998-10-21 21:58:40 nik Exp $ +# $Id: handbook.sgml,v 1.38 1998-10-21 22:00:19 nik Exp $ # DISTNAME= oneko-1.1b diff --git a/en_US.ISO8859-1/books/handbook/book.sgml b/en_US.ISO8859-1/books/handbook/book.sgml index cc090db9d5..9cd3e0354f 100644 --- a/en_US.ISO8859-1/books/handbook/book.sgml +++ b/en_US.ISO8859-1/books/handbook/book.sgml @@ -1701,8 +1701,8 @@ ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent For a proxy FTP server, you should usually give name of the server you really want as a part of the username, after an @-sign. The proxy server then 'fakes' the real server. An - example: Say you want to install from ftp.freebsd.org, using the - proxy FTP server foo.bar.com, listening on port 1234. + example: Say you want to install from ftp.freebsd.org, using the + proxy FTP server foo.bar.com, listening on port 1234. In this case, you go to the options menu, set the FTP username to ftp@ftp.freebsd.org, and the password to your e-mail @@ -1711,9 +1711,10 @@ ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent ftp://foo.bar.com:1234/pub/FreeBSD - /pub/FreeBSD from ftp.freebsd.org is proxied - under foo.bar.com, allowing you to install from _that_ machine - (which fetch the files from ftp.freebsd.org as your installation + /pub/FreeBSD from + ftp.freebsd.org is proxied + under foo.bar.com, allowing you to install from _that_ machine + (which fetch the files from ftp.freebsd.org as your installation requests them). @@ -2831,7 +2832,7 @@ do-install: tell the port to fetch them from servers other than ones listed in the MASTER_SITES? - A. Yes. If you know, for example, ftp.FreeBSD.ORG is much + A. Yes. If you know, for example, ftp.FreeBSD.ORG is much closer than sites listed in MASTER_SITES, do as following example. @@ -5047,7 +5048,7 @@ HULL NAY YANG TREE TOUT VETO Before explaining how to generate one-time passwords, we should go over an S/Key login prompt: - + &prompt.user; telnet himalia Trying 18.26.0.186... @@ -5056,7 +5057,7 @@ Escape character is '^]'. s/key 92 hi52030 Password: - + Note that, before prompting for a password, the login program prints out the iteration number and seed which you will need in @@ -5069,8 +5070,8 @@ s/key 92 hi52030 If this machine were configured to disallow UNIX passwords over a connection from my machine, the prompt would have also - included the annotation (s/key - required), indicating that only S/Key one-time + included the annotation (s/key + required), indicating that only S/Key one-time passwords will be accepted. @@ -5084,21 +5085,21 @@ s/key 92 hi52030 machines, and there is an S/Key desk accessory for Macintosh computers as well.) The command-line key program takes as its parameters the iteration count and seed; you can cut-and-paste right from the - login prompt starting at key to + login prompt starting at key to the end of the line. Thus: - + &prompt.user; key 92 hi52030 ) pasted from previous section Reminder - Do not use this program while logged in via telnet or rlogin. Enter secret password: ) I typed my secret password ADEN BED WOLF HAW HOT STUN - + And in the other window: - + s/key 92 hi52030 ) from previous section Password: @@ -5107,7 +5108,7 @@ ADEN BED WOLF HAW HOT STUN Last login: Wed Jun 28 15:31:00 from halloran-eldar.l [etc.] - + This is the easiest mechanism if you have a trusted machine. There is a Java S/Key key applet, - + &prompt.user; key -n 25 57 zz99999 Reminder - Do not use this program while logged in via telnet or rlogin. @@ -5137,7 +5138,7 @@ Reminder - Do not use this program while logged in via telnet or rlogin. 56: AMOS BOWL LUG FAT CAIN INCH 57: GROW HAYS TUN DISH CAR BALM - + The requests twenty-five keys in sequence; the indicates the @@ -5158,7 +5159,7 @@ Reminder - Do not use this program while logged in via telnet or rlogin. can be used to configure restrictions on the use of UNIX passwords based on the host name, user name, terminal port, or IP address of a login session. The complete format of the file is documented in - the skey.access(5) manual page; there are + the skey.access5 manual page; there are also some security cautions there which should be read before depending on this file for security. @@ -5225,10 +5226,10 @@ permit port ttyd0 countries. For those needing to get a legal foreign distribution of this - software, please DO NOT get it from a USA or + software, please do not get it from a USA or Canada site. You will get that site in big trouble! A legal copy of this is available from - skeleton.mikom.csir.co.za, which is in South + skeleton.mikom.csir.co.za, which is in South Africa. @@ -5240,20 +5241,19 @@ permit port ttyd0 change to the directory /etc/kerberosIV and check that only the following files are present: - + &prompt.root; cd /etc/kerberosIV &prompt.root; ls README krb.conf krb.realms - + If any additional files (such as principal.* or master_key) exist, then use the kdb_destroy command to destroy the old Kerberos database, of if Kerberos is not running, - simply delete the extra files with rm. + simply delete the extra files with rm. You should now edit the krb.conf and krb.realms files to define your Kerberos @@ -5284,14 +5284,14 @@ ARC.NASA.GOV trident.arc.nasa.gov The first line names the realm in which this system works. The other lines contain realm/host entries. The first item on a line is a realm, and the second is a host in that realm that is acting - as a key distribution centre. The words admin server + as a key distribution centre. The words admin server following a hosts name means that host also provides an administrative database server. For further explanation of these terms, please consult the Kerberos man pages. - Now we have to add grunt.grondar.za to + Now we have to add grunt.grondar.za to the GRONDAR.ZA realm and also add an entry to - put all hosts in the .grondar.za domain in + put all hosts in the .grondar.za domain in the GRONDAR.ZA realm. The krb.realms file would be updated as follows: @@ -5315,7 +5315,7 @@ grunt.grondar.za GRONDAR.ZA Now we are ready to create the database. This only needs to run on the Kerberos server (or Key Distribution Centre). Issue the - kdb_init command to do this: + kdb_init command to do this: &prompt.root; kdb_init @@ -5348,8 +5348,8 @@ Master key entered. BEWARE! Making it all run Two principals need to be added to the database for each system that will be secured with - Kerberos. Their names are kpasswd - and rcmd These two principals are + Kerberos. Their names are kpasswd + and rcmd These two principals are made for each system, with the instance being the name of the individual system. @@ -5360,7 +5360,7 @@ Master key entered. BEWARE! Now let's add these entries: - + &prompt.root; kdb_edit Opening database... @@ -5411,7 +5411,7 @@ Principal's new key version = 1 Edit O.K. Principal name: <---- null entry here will cause an exit - + @@ -5566,8 +5566,7 @@ Password changed. Adding <command>su</command> privileges Kerberos allows us to give each - user who needs root privileges their own separate supassword. We could now add an id which is + user who needs root privileges their own separate supassword. We could now add an id which is authorized to su to root. This is controlled by having an instance of root associated with a principal. Using kdb_edit we can create the @@ -5644,16 +5643,13 @@ May 2 20:43:12 May 3 04:43:12 krbtgt.GRONDAR.ZA@GRONDAR.ZA Using other commands - In an earlier example, we created a principal called jane with an instance root. This was based on a user with the same + In an earlier example, we created a principal called + jane with an instance root. This was based on a user with the same name as the principal, and this is a Kerberos default; that a - <principal>.<instance> of the - form <username>.root will allow that - <username> to su to root if the necessary entries are in - the .klogin file in root's home directory: + <principal>.<instance> of the + form <username>.root will allow that + <username> to su to root if the necessary entries are in + the .klogin file in root's home directory: &prompt.root; cat /root/.klogin @@ -5671,10 +5667,10 @@ jack@GRONDAR.ZA This allows anyone in the GRONDAR.ZA realm who has authenticated themselves to - jane or jack (via + jane or jack (via kinit, see above) access to rlogin to - jane's account or files on this system + jane's account or files on this system (grunt) via rlogin, rsh or rcp. @@ -5745,16 +5741,16 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are currently two distinct types of firewalls in common use on the Internet today. The first type is more properly called - a packet filtering router, where the + a packet filtering router, where the kernel on a multi-homed machine chooses whether to forward or block packets based on a set of rules. The second type, known as - proxy servers, rely on daemons to + proxy servers, rely on daemons to provide authentication and to forward packets, possibly on a multi-homed machine which has kernel packet forwarding disabled. Sometimes sites combine the two types of firewalls, so that - only a certain machine (known as a bastion + only a certain machine (known as a bastion host) is allowed to send packets through a packet filtering router onto an internal network. Proxy services are run on the bastion host, which are generally more secure than normal @@ -5806,7 +5802,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Proxy servers are machines which have had the normal system daemons (telnetd, ftpd, etc) replaced with special servers. - These servers are called proxy + These servers are called proxy servers as they normally only allow onward connections to be made. This enables you to run (for example) a proxy telnet server on your firewall host, and people can telnet @@ -5874,7 +5870,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are currently three kernel configuration options relevant to IPFW: - + options IPFIREWALL @@ -5918,10 +5914,10 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Previous versions of FreeBSD contained an - IPFIREWALL_ACCT option. This is now obsolete as + IPFIREWALL_ACCT option. This is now obsolete as the firewall code automatically includes accounting facilities. @@ -5964,7 +5960,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There is one valid flag when using this form of the command: - + -N @@ -5974,13 +5970,13 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + The command given can be shortened to the shortest unique form. The valid commands are: - + add @@ -5997,25 +5993,25 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Previous versions of IPFW used separate firewall and accounting entries. The present version provides packet accounting with each firewall entry. - If an index value is supplied, + If an index value is supplied, it used to place the entry at a specific point in the chain. Otherwise, the entry is placed at the end of the chain at an index 100 greater than the last chain entry (this does not include the default policy, rule 65535, deny). - The log option causes matching + The log option causes matching rules to be output to the system console if the kernel was - compiled with IPFIREWALL_VERBOSE. + compiled with IPFIREWALL_VERBOSE. Valid actions are: - + reject @@ -6028,9 +6024,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 allow - Pass the packet on as normal. (aliases: pass and accept) + Pass the packet on as normal. (aliases: + pass and accept) @@ -6052,7 +6047,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Each action will be recognized by the shortest unambiguous prefix. @@ -6060,7 +6055,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The protocols which can be specified are: - + all @@ -6089,7 +6084,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + The address specification is: @@ -6105,41 +6100,41 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 conjunction with protocols which support ports (UDP and TCP). - The via is optional and may + The is optional and may specify the IP address or domain name of a local IP interface, - or an interface name (e.g. ed0) to + or an interface name (e.g. ed0) to match only packets coming through this interface. Interface unit numbers can be specified with an optional wildcard. For example, - ppp* would match all kernel PPP + ppp* would match all kernel PPP interfaces. The syntax used to specify an address/mask is: - address + address or - address/mask-bits + address/mask-bits or - address:mask-pattern + address:mask-pattern A valid hostname may be specified in place of the IP - address. mask-bits is a decimal + address. is a decimal number representing how many bits in the address mask should be - set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any + set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any address in a class C subnet (in this case, 192.216.222) to be - matched. mask-pattern is an IP + matched. is an IP address which will be logically AND'ed with the address given. - The keyword any may be used to + The keyword any may be used to specify any IP address. The port numbers to be blocked are specified as: @@ -6157,7 +6152,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The options available are: - + frag @@ -6180,18 +6175,18 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - ipoptions spec + ipoptions spec Matches if the IP header contains the comma separated list of options specified in - spec. The supported list of IP - options are: ssrr (strict - source route), lsrr (loose - source route), rr (record - packet route), and ts + spec. The supported list of IP + options are: ssrr (strict + source route), lsrr (loose + source route), rr (record + packet route), and ts (timestamp). The absence of a particular option may be - denoted with a leading '!'. + denoted with a leading !. @@ -6215,39 +6210,35 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - tcpflags flags + tcpflags flags Matches if the TCP header contains the comma - separated list of flags. The - supported flags are fin, - syn, rst, psh, ack, and urg. The absence of a particular - flag may be indicated by a leading '!'. + separated list of flags. The + supported flags are fin, + syn, rst, + psh, ack, and + urg. The absence of a particular + flag may be indicated by a leading !. - icmptypes - types + icmptypes types Matches if the ICMP type is present in the list - types. The list may be specified + types. The list may be specified as any combination of ranges and/or individual types separated by commas. Commonly used ICMP types are: - 0 echo reply (ping reply), - 5 redirect, 8 echo request (ping request), and - 11 time exceeded (used to + 0 echo reply (ping reply), + 5 redirect, 8 echo request (ping request), and + 11 time exceeded (used to indicate TTL expiration as with traceroute8). - + @@ -6266,7 +6257,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are three valid flags when using this form of the command: - + -a @@ -6292,7 +6283,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6320,7 +6311,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 ipfw zero - index + index When used without an index argument, @@ -6335,8 +6326,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Example commands for ipfw This command will deny all packets from the host - evil.hacker.org to the telnet port of the - host nice.people.org by being forwarded by + evil.hacker.org to the telnet port of the + host nice.people.org by being forwarded by the router: @@ -6344,8 +6335,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The next example denies and logs any TCP traffic from the - entire hacker.org network (a class C) to the - nice.people.org machine (any port). + entire hacker.org network (a class C) to the + nice.people.org machine (any port). &prompt.root; ipfw add deny log tcp from evil.hacker.org/24 to nice.people.org @@ -6360,13 +6351,16 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 To see the accounting records: + &prompt.root; ipfw -a list or in the short form + &prompt.root; ipfw -a l You can also see the last time a chain entry was matched with + &prompt.root; ipfw -at l @@ -6394,8 +6388,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 rules if your requirements alter. - If you use the logging versions of the accept command, it can generate + If you use the logging versions of the accept command, it can generate large amounts of log data as one log line will be generated for every packet that passes through the firewall, so large ftp/http transfers, etc, will really slow the @@ -6424,18 +6417,18 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 to write a list of the current rules out to a file, and then - use a text editor to prepend `ipfw - ' before all the lines. This will allow the script to + use a text editor to prepend ipfw + before all the lines. This will allow the script to be fed into /bin/sh and reload the rules into the kernel. Perhaps not the most efficient way, but it works. The next problem is what your firewall should actually - DO! This is largely dependent on what access to + do! This is largely dependent on what access to your network you want to allow from the outside, and how much access to the outside world you want to allow from the inside. Some general rules are: - + @@ -6445,7 +6438,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - Block all incoming UDP + Block all incoming UDP traffic. There are very few useful services that travel over UDP, and what useful traffic there is is normally a security threat (e.g. Suns RPC and NFS protocols). This has its @@ -6478,7 +6471,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Another checklist for firewall configuration is available from CERT at LPD controls everything about a host's printers. It is responsible for a number of things: - + @@ -6566,7 +6559,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Through a configuration file, and by providing the special filter programs, you can enable the LPD system to do all or some @@ -6584,7 +6577,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 to enable direct access to a printer, you should use the spooler anyway since - + @@ -6608,7 +6601,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6620,7 +6613,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 set up both your printer hardware and the LPD software. This document describes two levels of setup: - + @@ -6639,7 +6632,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6702,7 +6695,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Nearly all printers you can get for a PC today support one or both of the following interfaces: - + @@ -6729,7 +6722,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + In general, serial interfaces are slower than parallel interfaces. Parallel interfaces usually offer just one-way @@ -6756,7 +6749,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 So, which interface should you use? - + @@ -6778,7 +6771,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6792,8 +6785,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 should give you complete guidance. Remember which parallel port you used on the computer. The - first parallel port is /dev/lpt0 to FreeBSD; the second is - /dev/lpt1, and so on. + first parallel port is /dev/lpt0 to FreeBSD; the second is + /dev/lpt1, and so on. @@ -6814,7 +6807,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 A modem cable connects each pin of the connector on one end of the cable straight through to its corresponding pin of the connector on the other - end. This type of cable is also known as a DTE-to-DCE + end. This type of cable is also known as a DTE-to-DCE cable. @@ -6823,7 +6816,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 pins straight through, swaps others (send data to receive data, for example), and shorts some internally in each connector hood. This type of cable is also known as a - DTE-to-DTE cable. + DTE-to-DTE cable. @@ -6843,7 +6836,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 the printer can support. Choose 7 or 8 data bits; none, even, or odd parity; and 1 or 2 stop bits. Also choose a flow control protocol: either none, or XON/XOFF (also known as - in-band or software) + in-band or software) flow control. Remember these settings for the software configuration that follows. @@ -6857,40 +6850,39 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 This section describes the software setup necessary to print with the LPD spooling system in FreeBSD. - Here is an outline of the steps involved: - + Here is an outline of the steps involved: + + - + Configure your kernel, if necessary, for the port you are using for the printer; section tells you what you need to do. - + - + Set the communications mode for the parallel port, if you are using a parallel port; section gives details. - + - + Test if the operating system can send data to the printer. Section gives some suggestions on how to do this. - + - + Set up LPD for the printer by modifying the file /etc/printcap. Section shows you how. - + - - - + @@ -6904,11 +6896,13 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 To find out if the kernel you are currently using supports a serial interface, type + &prompt.root; dmesg | grep sioN where N is the number of the serial port, starting from zero. If you see output similar to the following + sio2 at 0x3e8-0x3ef irq 5 on isa sio2: type 16550A @@ -6916,11 +6910,13 @@ sio2: type 16550A To find out if the kernel supports a parallel interface, type + &prompt.root; dmesg | grep lptN where N is the number of the parallel port, starting from zero. If you see output similar to the following + lpt0 at 0x378-0x37f on isa then the kernel supports the port. @@ -6946,25 +6942,28 @@ sio2: type 16550A send and receive data. That is what entries in the /dev directory are for. - To add a /dev - entry for a port: - + To add a /dev + entry for a port: + + - + Become root with the su command. Enter the root password when prompted. - + - + Change to the /dev directory: + &prompt.root; cd /dev - + - + Type + &prompt.root; ./MAKEDEV port where port is the device entry for the @@ -6973,18 +6972,18 @@ sio2: type 16550A so on; use ttyd0 for the first serial port, ttyd1 for the second, and so on. - + - + Type + &prompt.root; ls -l port to make sure the device entry got created. - + - - + @@ -6997,7 +6996,7 @@ sio2: type 16550A whether FreeBSD should use interrupt-driven or polled communication with the printer. - + @@ -7015,7 +7014,7 @@ sio2: type 16550A - + The interrupt-driven method is somewhat faster but uses up a precious IRQ line. You should use whichever one @@ -7027,11 +7026,12 @@ sio2: type 16550A program. - To set the communications mode by - configuring the kernel: - + To set the communications mode by + configuring the kernel: + + - + Edit your kernel configuration file. Look for or add an lpt0 entry. If you are setting up the second parallel port, use lpt1 instead. Use lpt2 for the third port, and so @@ -7041,6 +7041,7 @@ sio2: type 16550A If you want interrupt-driven mode, add the irq specifier: + device lpt0 at isa? port? tty irq N vector lptintr where N is the IRQ number for your @@ -7050,6 +7051,7 @@ device lpt0 at isa? port? tty irq N vector lptintr If you want polled mode, do not add the irq specifier: + device lpt0 at isa? port? tty vector lptintr @@ -7057,39 +7059,43 @@ device lpt0 at isa? port? tty vector lptintr - + - + Save the file. Then configure, build, and install the kernel, then reboot. See for more details. - + - - + - To set the communications mode + To set the communications mode with - lptcontrol: - + lptcontrol: + + - + Type + &prompt.root; lptcontrol -i -u N to set interrupt-driven mode for lptN. - + - + Type + &prompt.root; lptcontrol -p -u N to set polled-mode for lptN. - + - You could put these commands in your + + + You could put these commands in your /etc/rc.local file to set the mode each time your system boots. See lptcontrol8 for more information. @@ -7140,16 +7146,17 @@ showpage communicate with a printer connected to a parallel port. - To test a printer on a parallel - port: - + To test a printer on a parallel + port: + + - + Become root with su. - + - + Send data to the printer. @@ -7157,6 +7164,7 @@ showpage If the printer can print plain text, then use lptest. Type: + &prompt.root; lptest > /dev/lptN where N is the number of the @@ -7167,6 +7175,7 @@ showpage If the printer understands PostScript or other printer language, then send a small program to the printer. Type + &prompt.root; cat > /dev/lptN Then, line by line, type the @@ -7178,6 +7187,7 @@ showpage Alternatively, you can put the program in a file and type + &prompt.root; cat file > /dev/lptN where file is the name of the @@ -7187,10 +7197,9 @@ showpage - + - - + You should see something print. Do not worry if the text does not look right; we will fix such things @@ -7205,18 +7214,20 @@ showpage This section tells you how to check if FreeBSD can communicate with a printer on a serial port. - To test a printer on a serial - port: - + To test a printer on a serial + port: + + - + Become root with su. - + - + Edit the file /etc/remote. Add the following entry: + printer:dv=/dev/port:br#bps-rate:pa=parity where port is the device entry for the @@ -7229,12 +7240,13 @@ printer:dv=/dev/port:br#bps-rateHere is a sample entry for a printer connected via a serial line to the third serial port at 19200 bps with no parity: + printer:dv=/dev/ttyd2:br#19200:pa=none - + - + Connect to the printer with tip. Type: @@ -7243,9 +7255,9 @@ printer:dv=/dev/ttyd2:br#19200:pa=none the file /etc/remote again and try using /dev/cuaaN instead of /dev/ttydN. - + - + Send data to the printer. @@ -7253,6 +7265,7 @@ printer:dv=/dev/ttyd2:br#19200:pa=none If the printer can print plain text, then use lptest. Type: + ~$lptest @@ -7271,6 +7284,7 @@ printer:dv=/dev/ttyd2:br#19200:pa=none Alternatively, you can put the program in a file and type + ~>file where file is the name of the @@ -7281,10 +7295,9 @@ printer:dv=/dev/ttyd2:br#19200:pa=none - + - - + You should see something print. Do not worry if the text does not look right; we will fix that later. @@ -7314,63 +7327,61 @@ printer:dv=/dev/ttyd2:br#19200:pa=none printcap file is straightforward. Use your favorite text editor to make changes to /etc/printcap. The format is identical to other capability files like /usr/share/misc/termcap and /etc/remote. For complete information about the format, see the cgetent3. The simple spooler configuration consists of the following - steps: - + steps: + + - + Pick a name (and a few convenient aliases) for the printer, and put them in the /etc/printcap file; see . - + - + Turn off header pages (which are on by default) by - inserting the sh capability; + inserting the sh capability; see . - + - + Make a spooling directory, and specify its location - with the sd capability; see + with the sd capability; see . - + - + Set the /dev entry to use for the printer, and note it in /etc/printcap - with the lp capability; see + with the lp capability; see . Also, if the printer is on a serial port, set - up the communication parameters with the fs, fc, xs, and xc capabilities; see fs, fc, + xs, and xc capabilities; see . - + - + Install a plain text input filter; see - + - + Test the setup by printing something with the lpr command; see and . - + - - + Language-based printers, such as PostScript printers, @@ -7435,18 +7446,15 @@ rattan|line|diablo|lp|Diablo 630 Line Printer: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: In this example, the first printer is named - rattan and has as aliases - line, diablo, lp, and Diablo 630 - Line Printer. Since it has the alias lp, it is also the default printer. The - second is named bamboo, and has - as aliases ps, - , S, - panasonic, and Panasonic KX-P4455 PostScript - v51.4. + rattan and has as aliases + line, diablo, + lp, and Diablo 630 + Line Printer. Since it has the alias lp, it is also the default printer. The + second is named bamboo, and has + as aliases ps, + PS, S, + panasonic, and Panasonic KX-P4455 PostScript + v51.4. @@ -7462,11 +7470,9 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: way of debugging the simple printer setup, so we will suppress header pages. - To suppress header pages, add the sh capability to the entry for the + To suppress header pages, add the sh capability to the entry for the printer in /etc/printcap. Here is the - example /etc/printcap with sh added: + example /etc/printcap with sh added: # @@ -7478,7 +7484,8 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh: - Note how we used the correct format: the + + Note how we used the correct format: the first line starts in the leftmost column, and subsequent lines are indented with a single TAB. Every line in an entry except the last ends in a backslash character. @@ -7503,13 +7510,15 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ It is also customary to make the directory with a name that is identical to the name of the printer, as shown below: + &prompt.root; mkdir /var/spool/printer-name However, if you have a lot of printers on your network, you might want to put the spooling directories under a single directory that you reserve just for printing with LPD. We will do this for our two example printers - rattan and bamboo: + rattan and bamboo: + &prompt.root; mkdir /var/spool/lpd &prompt.root; mkdir /var/spool/lpd/rattan @@ -7524,19 +7533,19 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ searchable by user daemon and group daemon, and no one else. We will do this for our example printers: - + &prompt.root; chown daemon.daemon /var/spool/lpd/rattan &prompt.root; chown daemon.daemon /var/spool/lpd/bamboo &prompt.root; chmod 770 /var/spool/lpd/rattan &prompt.root; chmod 770 /var/spool/lpd/bamboo - + Finally, you need to tell LPD about these directories using the /etc/printcap file. You specify the pathname of the spooling directory with the - sd capability: + sd capability: # @@ -7548,13 +7557,13 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo: - Note that the name of the printer starts in + + Note that the name of the printer starts in the first column but all other entries describing the printer should be indented with a tab and each line escaped with a backslash. - If you do not specify a spooling directory with sd, the spooling system will use + If you do not specify a spooling directory with sd, the spooling system will use /var/spool/lpd as a default. @@ -7573,13 +7582,12 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ printer). List the /dev entry pathname in the - /etc/printcap file using the lp capability. + /etc/printcap file using the lp capability. In our running example, let us assume that rattan is on the first parallel port, and bamboo is on a sixth serial port; here are the additions to - /etc/printcap: + /etc/printcap: # @@ -7592,7 +7600,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5: - + If you do not specify the lp capability for a printer in your @@ -7617,6 +7625,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ rate, parity, and other serial communication parameters on behalf of the filter program that sends data to the printer. This is advantageous since + @@ -7638,70 +7647,62 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ capabilities control serial communication parameters of the device listed in the lp capability: + - br#bps-rate + br#bps-rate Sets the communications speed of the device to - bps-rate, where - bps-rate can be 50, 75, + bps-rate, where + bps-rate can be 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, or 38400 bits-per-second. - fc#clear-bits + fc#clear-bits - Clears the flag bits clear-bits in the sgttyb structure after opening + Clears the flag bits + clear-bits in the + sgttyb structure after opening the device. - fs#set-bits + fs#set-bits - Sets the flag bits set-bits in the sgttyb structure. + Sets the flag bits + set-bits in the + sgttyb structure. - xc#clear-bits + xc#clear-bits - Clears local mode bits clear-bits after opening the + Clears local mode bits clear-bits after opening the device. - xs#set-bits + xs#set-bits - Sets local mode bits set-bits. + Sets local mode bits set-bits. For more information on the bits for the - fc, fs, xc, - and xs capabilities, see the + fc, fs, xc, + and xs capabilities, see the file /usr/include/sys/ioctl_compat.h. - When LPD opens the device specified by the lp capability, it reads the flag bits in + When LPD opens the device specified by the lp capability, it reads the flag bits in the sgttyb structure; it clears - any bits in the fc capability, - then sets bits in the fs + any bits in the fc capability, + then sets bits in the fs capability, then applies the resultant setting. It does the same for the local mode bits as well. @@ -7729,8 +7730,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ program that LPD runs when it has a job to print. When LPD runs the text filter for a printer, it sets the filter's standard input to the job to print, and its standard output to - the printer device specified with the lp capability. The filter is expected + the printer device specified with the lp capability. The filter is expected to read the job from standard input, perform any necessary translation for the printer, and write the results to standard output, which will get printed. For more information on the @@ -7740,9 +7740,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ For our simple printer setup, the text filter can be a small shell script that just executes - /bin/cat to send the job to the printer. - FreeBSD comes with another filter called lpf that handles backspacing and + /bin/cat to send the job to the printer. + FreeBSD comes with another filter called lpf that handles backspacing and underlining for printers that might not deal with such character streams well. And, of course, you can use any other filter program you want. The filter lpf is described in detail in section @@ -7766,15 +7765,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ exit 2 Make the file executable: + &prompt.root; chmod 555 /usr/local/libexec/if-simple And then tell LPD to use it by specifying it with the - if capability in + if capability in /etc/printcap. We will add it to the two printers we have so far in the example - /etc/printcap: + /etc/printcap: # @@ -7788,7 +7788,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:\ :if=/usr/local/libexec/if-simple: - + @@ -7811,10 +7811,11 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ remap="Checking Printer Communications"> to generate some test text. - To test the simple LPD + To test the simple LPD setup: Type: + &prompt.root; lptest 20 5 | lpr -Pprinter-name where -P argument. Again, if you are testing a printer that expects PostScript, send a PostScript program in that language instead of using - lptest. You can do so by putting the program in a file and typing lpr file. + lptest. You + can do so by putting the program in a file and typing lpr file. For a PostScript printer, you should get the results of the program. If you are using @@ -7856,7 +7858,10 @@ $%&'()*+,-./01234567 Troubleshooting After performing the simple test with - lptest, you might have gotten one of the following results instead of the correct printout: + lptest, you + might have gotten one of the following results instead of the + correct printout: + It worked, after awhile; or, it did not eject a full sheet. @@ -8037,12 +8042,30 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ Use the printer's configuration switches or control panel to enforce the following interpretation - of LF and CR characters: - - Printer received CR Printer prints - CR Printer received LF Printer prints - CR + LF - + of LF and CR characters: + + + + + + Printer receives + Printer prints + + + + + + CR + CR + + + + LF + CR + LF + + + + @@ -8064,14 +8087,12 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If the printer supports XON/XOFF flow control, have FreeBSD use it by specifying the - TANDEM bit in the fs capability. + TANDEM bit in the fs capability. If the printer supports carrier flow - control, specify the MDMBUF bit in the fs capability. Make sure + control, specify the MDMBUF bit in the fs capability. Make sure the cable connecting the printer to the computer is correctly wired for carrier flow control. @@ -8080,7 +8101,7 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If the printer does not support any flow control, use some combination of the NLDELAY, TBDELAY, CRDELAY, VTDELAY, and BSDELAY bits in - the fs capability + the fs capability to add appropriate delays to the stream of data sent to the printer. @@ -8098,10 +8119,9 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ This is usually another symptom of incorrect communications parameters with a serial printer. - Double-check the bps rate in the br capability, and the parity - bits in the fs and - fc capabilities; make + Double-check the bps rate in the br capability, and the parity + bits in the fs and + fc capabilities; make sure the printer is using the same settings as specified in the /etc/printcap file. @@ -8113,11 +8133,11 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If nothing happened, the problem is probably within FreeBSD and not the hardware. Add the log file - (lf) capability to the + (lf) capability to the entry for the printer you are debugging in the /etc/printcap file. For example, - here is the entry for rattan, with the lf capability: + here is the entry for rattan, with + the lf capability: rattan|line|diablo|lp|Diablo 630 Line Printer:\ @@ -8131,14 +8151,12 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ error messages that might appear. Based on the messages you see, try to correct the problem. - If you do not specify a lf capability, LPD uses + If you do not specify a lf capability, LPD uses /dev/console as a default. - @@ -8150,7 +8168,8 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ Using Printers This section tells you how to use printers you have setup with - FreeBSD. Here is an overview of the user-level commands: + FreeBSD. Here is an overview of the user-level commands: + lpr @@ -8175,8 +8194,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ - - + There is also an administrative command, lpc, described in the section lprm, and lpq - accept an option printer-name to specify on which + accept an option to specify on which printer/queue to operate, as listed in the /etc/printcap file. This enables you to submit, remove, and check on jobs for various printers. If you do not use the option, then these commands use the - printer specified in the PRINTER environment variable. Finally, if - you do not have a PRINTER environment variable, these commands + printer specified in the PRINTER environment variable. Finally, if + you do not have a PRINTER environment variable, these commands default to the printer named lp. Hereafter, the terminology default printer - means the printer named in the PRINTER environment variable, or the - printer named lp when there is no - PRINTER environment variable. + means the printer named in the PRINTER environment variable, or the + printer named lp when there is no + PRINTER environment variable. Printing Jobs To print files, type + &prompt.user; lpr filename ... This prints each of the listed files to the @@ -8217,13 +8235,16 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ lpr reads data to print from standard input. For example, this command prints some important system files: + &prompt.user; lpr /etc/host.conf /etc/hosts.equiv To select a specific printer, type + &prompt.user; lpr -P printer-name filename ... This example prints a long listing of the - current directory to the printer named rattan: + current directory to the printer named rattan: + &prompt.user; ls -l | lpr -P rattan Because no files were listed for the @@ -8250,7 +8271,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ When you print with lpr, the data you wish to print is put together in a package called a - print job, which is sent to the LPD spooling + print job, which is sent to the LPD spooling system. Each printer has a queue of jobs, and your job waits in that queue along with other jobs from yourself and from other users. The printer prints those jobs in a first-come, first-served @@ -8261,10 +8282,12 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ lpq. For a specific printer, use the option. For example, the command + &prompt.user; lpq -P bamboo shows the queue for the printer named bamboo. Here is an example of the output of the lpq command: + bamboo is ready and printing Rank Owner Job Files Total Size @@ -8272,8 +8295,8 @@ active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes 2nd kelly 10 (standard input) 1635 bytes 3rd mary 11 ... 78519 bytes This shows three jobs in the queue for - bamboo. The first job, submitted by - user kelly, got assigned job number 9. Every + bamboo. The first job, submitted by + user kelly, got assigned job number 9. Every job for a printer gets a unique job number. Most of the time you can ignore the job number, but you will need it if you want to cancel the job; see section @@ -8305,7 +8328,8 @@ active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes The lpq command also support a option to generate a detailed - long listing. Here is an example of lpq -l: + long listing. Here is an example of lpq -l: + waiting for bamboo to become ready (offline ?) kelly: 1st [job 009rose] @@ -8317,7 +8341,7 @@ kelly: 2nd [job 010rose] mary: 3rd [job 011rose] /home/orchid/mary/research/venus/alpha-regio/mapping 78519 bytes - + @@ -8339,14 +8363,21 @@ mary: 3rd [job 011rose] the job number. Then type &prompt.user; lprm job-number - To remove the job from a specific printer, add + + + To remove the job from a specific printer, add the option. The following command removes job - number 10 from the queue for the printer bamboo: + number 10 from the queue for the printer + bamboo: + &prompt.user; lprm -P bamboo 10 - The + + + The lprm - command has a few shortcuts: + command has a few shortcuts: + lprm - @@ -8355,12 +8386,11 @@ mary: 3rd [job 011rose] - lprm user + lprm user Removes all jobs (for the default printer) belonging - to user. The superuser can + to user. The superuser can remove other users' jobs; you can remove only your own jobs. @@ -8377,12 +8407,11 @@ mary: 3rd [job 011rose] - Just use the option with the above shortcuts to operate on a specific printer instead of the default. For example, the following command removes all jobs for the - current user in the queue for the printer named rattan: + current user in the queue for the printer named rattan: &prompt.user; lprm -P rattan - @@ -8390,13 +8419,12 @@ mary: 3rd [job 011rose] If you are working in a networked - environment, - - + environment, lprm will let you remove jobs only from the host from which the jobs were submitted, even if the same printer is available from other - hosts. The following command sequence demonstrates this: + hosts. The following command sequence demonstrates this: + &prompt.user; lpr -P rattan myfile &prompt.user; rlogin orchid @@ -8411,7 +8439,7 @@ rose: Permission denied dfA013rose dequeued cfA013rose dequeued - + @@ -8442,10 +8470,12 @@ cfA013rose dequeued For example, the following command prints a DVI file (from the TeX typesetting system) named fish-report.dvi to the printer named - bamboo: + bamboo: &prompt.user; lpr -P bamboo -d fish-report.dvi - These options apply to every file in the job, + + + These options apply to every file in the job, so you cannot mix (say) DVI and ditroff files together in a job. Instead, submit the files as separate jobs, using a different conversion option for each job. @@ -8459,7 +8489,7 @@ cfA013rose dequeued Filters"> gives details. - + @@ -8492,9 +8522,8 @@ cfA013rose dequeued number - Indent the output by number columns; if you omit - number, indent by 8 + Indent the output by number columns; if you omit + number, indent by 8 columns. This option works only with certain conversion filters. @@ -8534,7 +8563,7 @@ cfA013rose dequeued title - Use title on the + Use title on the pr header instead of the file name. This option has effect @@ -8557,15 +8586,18 @@ cfA013rose dequeued - + Here is an example: this command prints a nicely formatted version of the ls manual - page on the default printer: + page on the default printer: + &prompt.user; zcat /usr/share/man/man1/ls.1.gz | troff -t -man | lpr -t - The + + + The zcat command uncompresses the source of the @@ -8596,11 +8628,9 @@ cfA013rose dequeued - -# copies + -# copies - Produce a number of copies of each file in the job + Produce a number of copies of each file in the job instead of just one copy. An administrator may disable this option to reduce printer wear-and-tear and encourage photocopier usage. See section This example prints three copies of parser.c followed by three copies - of parser.h to the default printer: + of parser.h to the default + printer: + &prompt.user; lpr -#3 parser.c parser.h - + @@ -8682,24 +8714,22 @@ cfA013rose dequeued linkend="printing-advanced-header-pages" remap="Header Pages"> for information about setting up header pages. - + - -C text + -C text Replace the hostname on the header page with - text. The hostname is + text. The hostname is normally the name of the host from which the job was submitted. - -J text + -J text Replace the job name on the header page with - text. The job name is + text. The job name is normally the name of the first file of the job, or stdin if you are printing standard input. @@ -8719,7 +8749,7 @@ cfA013rose dequeued - + @@ -8779,24 +8809,23 @@ cfA013rose dequeued Here is a summary of the lpc - commands. Most of the commands takes a printer-name argument to tell on which + commands. Most of the commands takes a printer-name argument to tell on which printer to operate. You can use all - for the printer-name to mean all + for the printer-name to mean all printers listed in /etc/printcap. - + - abort - printer-name + abort + printer-name Cancel the current job and stop the printer. Users can still submit jobs if the queue's enabled. - clean - printer-name + clean + printer-name Remove old files from the printer's spooling @@ -8808,8 +8837,8 @@ cfA013rose dequeued - disable - printer-name + disable + printer-name Disable queuing of new jobs. If the printer's @@ -8821,18 +8850,19 @@ cfA013rose dequeued printer or filter installation: disable the queue and submit jobs as root. Other users will not be able to submit jobs until you complete your testing and re-enable - the queue with the enable + the queue with the enable command. - down + down printer-name - message... + message - Take a printer down. Equivalent to disable followed by stop. The message appears as the printer's + Take a printer down. Equivalent to + disable followed by + stop. The message appears as the printer's status whenever a user checks the printer's queue with lpq @@ -8841,8 +8871,8 @@ cfA013rose dequeued - enable - printer-name + enable + printer-name Enable the queue for a printer. Users can submit jobs @@ -8851,19 +8881,19 @@ cfA013rose dequeued - help - command-name + help + command-name - Print help on the command command-name. With no command-name, print a summary of the + Print help on the command + command-name. With no + command-name, print a summary of the commands available. - restart - printer-name + restart + printer-name Start the printer. Ordinary users can use this @@ -8875,8 +8905,8 @@ cfA013rose dequeued - start - printer-name + start + printer-name Start the printer. The printer will print jobs in its @@ -8884,8 +8914,8 @@ cfA013rose dequeued - stop - printer-name + stop + printer-name Stop the printer. The printer will finish the current @@ -8895,23 +8925,21 @@ cfA013rose dequeued - topq + topq printer-name - job-or-username... + job-or-username - Rearrange the queue for printer-name by placing the jobs - with the listed job numbers - or the jobs belonging to username at the top of the queue. - For this command, you cannot use all as the printer-name. + Rearrange the queue for printer-name by placing the jobs + with the listed job numbers + or the jobs belonging to username at the top of the queue. + For this command, you cannot use all as + the printer-name. - up - printer-name + up + printer-name Bring a printer up; the opposite of the down command. Equivalent to @@ -8919,7 +8947,7 @@ cfA013rose dequeued - + lpc accepts @@ -8973,7 +9001,7 @@ cfA013rose dequeued Here is what you will find in this section: - + @@ -9045,7 +9073,6 @@ cfA013rose dequeued - When LPD wants to print a file in a job, it starts a filter program. It sets the filter's standard input to the file to print, its standard output to the printer, and its standard - error to the error logging file (specified in the lf capability in + error to the error logging file (specified in the lf capability in /etc/printcap, or /dev/console by default). @@ -9072,15 +9098,16 @@ cfA013rose dequeued lpr command line. For example, if the user typed lpr -t, LPD would start the troff filter, listed in the - tf capability for the destination + tf capability for the destination printer. If the user wanted to print plain text, it would start - the if filter (this is mostly + the if filter (this is mostly true: see for details). There are three kinds of filters you can specify in - /etc/printcap: + /etc/printcap: + @@ -9097,6 +9124,7 @@ cfA013rose dequeued and comparing that to the number of lines per page the printer supports. The text filter is started with the following argument list: + filter-name -c @@ -9107,6 +9135,7 @@ cfA013rose dequeued -h host acct-file where + @@ -9115,29 +9144,24 @@ cfA013rose dequeued - width + width - is the value from the pw (page width) capability + is the value from the pw (page width) capability specified in /etc/printcap, default 132 - length + length - is the value from the pl (page length) capability, + is the value from the pl (page length) capability, default 66 - indent + indent is the amount of the indentation from @@ -9145,8 +9169,7 @@ cfA013rose dequeued - login + login is the account name of the user printing the @@ -9154,8 +9177,7 @@ cfA013rose dequeued - host + host is the host name from which the job was @@ -9163,12 +9185,11 @@ cfA013rose dequeued - acct-file + acct-file is the name of the accounting file from the - af + af capability. @@ -9189,6 +9210,7 @@ cfA013rose dequeued Conversion filters also need to do accounting, if you need printer accounting. Conversion filters are started with the following arguments: + filter-name -h host acct-file where pixel-width is the value from the - px capability (default 0) + px capability (default 0) and pixel-height is the - value from the py capability + value from the py capability (default 0). @@ -9211,6 +9233,7 @@ cfA013rose dequeued describe them. There are only two arguments to an output filter: + filter-name -wwidth @@ -9222,10 +9245,10 @@ cfA013rose dequeued - Filters should also exit with the - following exit status: + following exit status: + exit 0 @@ -9252,7 +9275,6 @@ cfA013rose dequeued - The text filter that comes with the FreeBSD release, /usr/libexec/lpr/lpf, takes advantage of @@ -9314,17 +9336,19 @@ cfA013rose dequeued is part of lprps. If you installed lprps from the ports collection, use the following in the serial PostScript printer's - entry in /etc/printcap: + entry in /etc/printcap: + :if=/usr/local/libexec/psif: - You should also specify the rw capability; that tells LPD to open the + + + You should also specify the rw capability; that tells LPD to open the printer in read-write mode. If you have a parallel PostScript printer (and therefore cannot use two-way communication with the printer, which lprps needs), you can use the - following shell script as the text filter: + following shell script as the text filter: #!/bin/sh @@ -9351,7 +9375,8 @@ else exit 2 fi - In the above script, textps is a program we installed + + In the above script, textps is a program we installed separately to convert plain text to PostScript. You can use any text-to-PostScript program you wish. The FreeBSD ports collection (see if capability: :if=/usr/local/libexec/hpif: That is it. You can type lpr plain.text and lpr @@ -9457,17 +9483,23 @@ exit 2 typesetting system, and we have a PostScript printer. Every time we generate a DVI file from TeX, we cannot print it directly until we convert the DVI file into PostScript. The - command sequence goes like this: + command sequence goes like this: + &prompt.user; dvips seaweed-analysis.dvi &prompt.user; lpr seaweed-analysis.ps - By installing a conversion filter for DVI + + + By installing a conversion filter for DVI files, we can skip the hand conversion step each time by having LPD do it for us. Now, each time we get a DVI file, we - are just one step away from printing it: + are just one step away from printing it: + &prompt.user; lpr -d seaweed-analysis.dvi - We got LPD to do the DVI file conversion + + + We got LPD to do the DVI file conversion for us by specifying the option. Section @@ -9558,10 +9590,10 @@ exit 2 - + In our example, using lpr -d means the - printer needs a df capability in + printer needs a df capability in its entry in /etc/printcap. Despite what others might contend, formats like FORTRAN @@ -9571,7 +9603,7 @@ exit 2 would like to directly print Printerleaf files (files from the Interleaf desktop publishing program), but will never print plot files. You could install a Printerleaf conversion filter - under the gf capability and then + under the gf capability and then educate your users that lpr -g mean print Printerleaf files. @@ -9592,10 +9624,10 @@ exit 2 /etc/printcap. In our example, we will add the DVI conversion filter to - the entry for the printer named bamboo. Here is the example + the entry for the printer named bamboo. Here is the example /etc/printcap file again, with the new - df capability for the printer - bamboo + df capability for the printer + bamboo. # @@ -9612,9 +9644,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - The DVI filter is a shell script named + + The DVI filter is a shell script named /usr/local/libexec/psdf. Here is that - script: + script: #!bin/sh @@ -9626,7 +9659,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ # exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" - This script runs + + This script runs dvips in filter mode (the argument) on standard input, which is the job to print. It then starts the PostScript printer filter lprps (see section ) with the arguments LPD passed to this script. @@ -9645,7 +9679,7 @@ exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" This example script is a raster (well, GIF file, actually) conversion filter for a Hewlett Packard LaserJet III-Si - printer: + printer: #!/bin/sh @@ -9657,13 +9691,14 @@ PATH=/usr/X11R6/bin:$PATH; export PATH giftopnm | ppmtopgm | pgmtopbm | pbmtolj && exit 0 \ || exit 2 - It works by converting the GIF file into a + + It works by converting the GIF file into a portable anymap, converting that into a portable graymap, converting that into a portable bitmap, and converting that into LaserJet/PCL-compatible data. Here is the /etc/printcap file with - an entry for a printer using the above filter: + an entry for a printer using the above filter: # @@ -9673,11 +9708,11 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sh:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/hpif:\ :vf=/usr/local/libexec/hpvf: - + The following script is a conversion filter for troff data from the groff typesetting system for the PostScript printer - named bamboo: + named bamboo: #!/bin/sh @@ -9687,9 +9722,10 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ # exec grops | /usr/local/libexec/lprps "$@" - The above script makes use of lprps again to handle the communication + + The above script makes use of lprps again to handle the communication with the printer. If the printer were on a parallel port, we - would use this script instead: + would use this script instead: #!/bin/sh @@ -9699,17 +9735,19 @@ exec grops | /usr/local/libexec/lprps "$@" # exec grops - That is it. Here is the entry we need to + + That is it. Here is the entry we need to add to /etc/printcap to enable the - filter: + filter: + :tf=/usr/local/libexec/pstf: - + Here is an example that might make old hands at FORTRAN blush. It is a FORTRAN-text filter for any printer that can directly print plain text. We will install it for the printer - teak: + teak: #!/bin/sh @@ -9721,19 +9759,23 @@ exec grops printf "\033&k2G" && fpr && printf "\f" && exit 0 exit 2 - And we will add this line to the - /etc/printcap for the printer teak to enable this filter: + + And we will add this line to the + /etc/printcap for the printer + teak to enable this filter: + :rf=/usr/local/libexec/hprf: - + Here is one final, somewhat complex example. We will add - a DVI filter to the LaserJet printer teak introduced earlier. First, the + a DVI filter to the LaserJet printer teak introduced earlier. First, the easy part: updating /etc/printcap with - the location of the DVI filter: + the location of the DVI filter: + :df=/usr/local/libexec/hpdf: - + Now, for the hard part: making the filter. For that, we need a DVI-to-LaserJet/PCL conversion program. The FreeBSD @@ -9761,9 +9803,8 @@ exit 2 The only other fly in the ointment is the fact that we cannot use /tmp for the temporary link. - Symbolic links are owned by user and group bin. The filter runs as user daemon. And the + Symbolic links are owned by user and group + bin. The filter runs as user daemon. And the /tmp directory has the sticky bit set. The filter can create the link, but it will not be able clean up when done and remove it since the link will belong to a @@ -9771,13 +9812,13 @@ exit 2 Instead, the filter will make the symbolic link in the current working directory, which is the spooling directory - (specified by the sd capability + (specified by the sd capability in /etc/printcap). This is a perfect place for filters to do their work, especially since there is (sometimes) more free disk space in the spooling directory than under /tmp. - Here, finally, is the filter: + Here, finally, is the filter: #!/bin/sh @@ -9839,7 +9880,7 @@ dvilj2p -M1 -q -e- dfhp$$.dvi # cleanup exit 0 - + @@ -9901,13 +9942,14 @@ exit 0 LPD does not pass the user's login or host to the filter, so it is not intended to do accounting. In fact, it gets only two arguments: + filter-name -wwidth -llength - where width is from the pw capability and length is from the pl capability for the printer in + where width is + from the pw capability and + length is from the pl capability for the printer in question. @@ -9980,8 +10022,7 @@ exit 0 In order for lpf to do page accounting correctly, it needs correct values filled in for the - pw and pl capabilities in the + pw and pl capabilities in the /etc/printcap file. It uses these values to determine how much text can fit on a page and how many pages were in a user's job. For more information on printer @@ -10029,15 +10070,14 @@ exit 0 Printer Setup">, we turned off header pages by specifying sh (meaning suppress header) in the /etc/printcap file. To - enable header pages for a printer, just remove the sh capability. + enable header pages for a printer, just remove the sh capability. Sounds too easy, right? You are right. You might have to provide an output filter to send initialization strings to the printer. Here is an example output filter for Hewlett Packard - PCL-compatible printers: + PCL-compatible printers: #!/bin/sh @@ -10048,15 +10088,16 @@ exit 0 printf "\033&k2G" || exit 2 exec /usr/libexec/lpr/lpf - Specify the path to the output filter in the - of capability. See Specify the path to the output filter in the + of capability. See for more information. Here is an example /etc/printcap file - for the printer teak that we + for the printer teak that we introduced earlier; we enabled header pages and added the above - output filter: + output filter: # @@ -10068,7 +10109,8 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :vf=/usr/local/libexec/hpvf:\ :of=/usr/local/libexec/hpof: - Now, when users print jobs to teak, they get a header page with each + + Now, when users print jobs to teak, they get a header page with each job. If users want to spend time searching for their printouts, they can suppress header pages by submitting the job with lpr -h; see LPD prints a form feed character after the header page. If your printer uses a different character or sequence of - characters to eject a page, specify them with the ff capability in + characters to eject a page, specify them with the ff capability in /etc/printcap. @@ -10094,7 +10135,8 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ By enabling header pages, LPD will produce a long header, a full page of large letters identifying the user, host, and job. Here is an example (kelly printed the - job named outline from host rose): + job named outline from host rose): + k ll ll k l l @@ -10143,19 +10185,23 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ Job: outline Date: Sun Sep 17 11:04:58 1995 - LPD appends a form feed after this text so - the job starts on a new page (unless you have sf (suppress form feeds) in the + + + LPD appends a form feed after this text so + the job starts on a new page (unless you have sf (suppress form feeds) in the destination printer's entry in /etc/printcap). If you prefer, LPD can make a short header; specify sb (short banner) in the /etc/printcap file. - The header page will look like this: + The header page will look like this: + rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 - Also by default, LPD prints the header page + + + Also by default, LPD prints the header page first, then the job. To reverse that, specify hl (header last) in /etc/printcap. @@ -10222,11 +10268,10 @@ rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 the header page. The only other problem with this method is that the output filter still does not know what accounting file to use (it is not passed the name of the - file from the af + file from the af capability), but if you have a well-known accounting file, you can hard-code that into the output filter. To - facilitate the parsing step, use the sh (short header) capability in + facilitate the parsing step, use the sh (short header) capability in /etc/printcap. Then again, all that might be too much trouble, and users will certainly appreciate the more generous system administrator who @@ -10256,7 +10301,7 @@ rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 Let us explore this method. The following script takes three arguments (user login name, host name, and job name) and - makes a simple PostScript header page: + makes a simple PostScript header page: #!/bin/sh @@ -10339,11 +10384,12 @@ restore showpage EOF - Now, each of the conversion filters and the + + Now, each of the conversion filters and the text filter can call this script to first generate the header page, and then print the user's job. Here is the DVI conversion filter from earlier in this document, modified to make a header - page: + page: #!/bin/sh @@ -10378,7 +10424,8 @@ done ( /usr/local/libexec/make-ps-header $login $host "DVI File" /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args - Notice how the filter has to parse the + + Notice how the filter has to parse the argument list in order to determine the user and host name. The parsing for the other conversion filters is identical. The text filter takes a slightly different set of arguments, though (see @@ -10508,24 +10555,23 @@ done - Leave the lp capability + Leave the lp capability blank, explicitly (:lp=:). Make a spooling directory and specify its location in - the sd capability. LPD will + the sd capability. LPD will store jobs here before they get sent to the printer host. - Place the name of the printer host in the rm capability. + Place the name of the printer host in the rm capability. Place the printer name on the printer - host in the rp + host in the rp capability. @@ -10533,15 +10579,15 @@ done filters, page dimensions, or anything else in the /etc/printcap file. - Here is an example. The host rose has two printers, - bamboo and rattan. We will enable users on the host + Here is an example. The host rose has two printers, + bamboo and rattan. We will enable users on the host orchid to print to those printers. Here is the - /etc/printcap file for orchid (back from + /etc/printcap file for orchid (back from section ). It already had the entry for - the printer teak; we have added - entries for the two printers on the host rose: + the printer teak; we have added + entries for the two printers on the host rose: # @@ -10569,17 +10615,20 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo: - Then, we just need to make spooling - directories on orchid: + + Then, we just need to make spooling + directories on orchid: &prompt.root; mkdir -p /var/spool/lpd/rattan /var/spool/lpd/bamboo &prompt.root; chmod 770 /var/spool/lpd/rattan /var/spool/lpd/bamboo &prompt.root; chown daemon.daemon /var/spool/lpd/rattan /var/spool/lpd/bamboo - + - Now, users on orchid can print to rattan and bamboo. If, for example, a user on orchid + Now, users on orchid can print to + rattan and bamboo. If, for example, a user on orchid typed + &prompt.user; lpr -P bamboo -d sushi-review.dvi the LPD system on orchid would copy the job @@ -10625,7 +10674,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ one-way communication only (FreeBSD to printer); many network printers support two-way communication, and you might want to take advantage of that (to get printer status, perform - accounting, etc.). + accounting, etc.). #!/usr/bin/perl @@ -10652,11 +10701,12 @@ connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!"; while (<STDIN>) { print PRINTER; } exit 0; - We can then use this script in various + + We can then use this script in various filters. Suppose we had a Diablo 750-N line printer connected to the network. The printer accepts data to print on port number 5100. The host name of the printer is scrivener. Here - is the text filter for the printer: + is the text filter for the printer: #!/bin/sh @@ -10664,7 +10714,7 @@ exit 0; # diablo-if-net - Text filter for Diablo printer `scrivener' listening # on port 5100. Installed in /usr/local/libexec/diablo-if-net # exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint scrivener 5100 - + @@ -10693,9 +10743,10 @@ exit 0; on your printers, you can disable the option to lpr by - adding the sc capability to the + adding the sc capability to the /etc/printcap file. When users submit jobs with the option, they will see + lpr: multiple copies are not allowed @@ -10703,17 +10754,16 @@ exit 0; Note that if you have set up access to a printer remotely (see section ), you need - the sc capability on the remote + the sc capability on the remote /etc/printcap files as well, or else users will still be able to submit multiple-copy jobs by using another host. Here is an example. This is the - /etc/printcap file for the host rose. The - printer rattan is quite hearty, so - we will allow multiple copies, but the laser printer bamboo's a bit more delicate, so we will - disable multiple copies by adding the sc capability: + /etc/printcap file for the host rose. The + printer rattan is quite hearty, so + we will allow multiple copies, but the laser printer bamboo's a bit more delicate, so we will + disable multiple copies by adding the sc capability: # @@ -10730,10 +10780,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Now, we also need to add the sc capability on the host orchid's + + Now, we also need to add the sc capability on the host orchid's /etc/printcap (and while we are at it, let - us disable multiple copies for the printer teak): + us disable multiple copies for the printer teak): # @@ -10751,15 +10801,19 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo:sc: - By using the sc + + By using the sc capability, we prevent the use of lpr -#, but that still does not prevent users from running lpr multiple times, or from submitting the same file multiple times - in one job like this: + in one job like this: + &prompt.user; lpr forsale.sign forsale.sign forsale.sign forsale.sign forsale.sign - There are many ways to prevent this abuse + + + There are many ways to prevent this abuse (including ignoring it) which you are free to explore. @@ -10769,29 +10823,31 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ Restricting Access To Printers You can control who can print to what printers by using the - UNIX group mechanism and the rg + UNIX group mechanism and the rg capability in /etc/printcap. Just place the users you want to have access to a printer in a certain - group, and then name that group in the rg capability. + group, and then name that group in the rg capability. Users outside the group (including root) will be greeted with + lpr: Not a member of the restricted group - if they try to print to the controlled + + + if they try to print to the controlled printer. - As with the sc (suppress - multiple copies) capability, you need to specify rg on remote hosts that also have access + As with the sc (suppress + multiple copies) capability, you need to specify rg on remote hosts that also have access to your printers, if you feel it is appropriate (see section ). - For example, we will let anyone access the printer rattan, but only those in group artists can use bamboo. Here is the familiar - /etc/printcap for host rose: + For example, we will let anyone access the printer + rattan, but only those in group + artists can use bamboo. Here is the familiar + /etc/printcap for host rose: # @@ -10808,10 +10864,12 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Let us leave the other example - /etc/printcap file (for the host orchid) - alone. Of course, anyone on orchid can print to bamboo. It might be the case that we only - allow certain logins on orchid anyway, and want them to have + + Let us leave the other example + /etc/printcap file (for the host orchid) + alone. Of course, anyone on orchid can print to + bamboo. It might be the case that we only + allow certain logins on orchid anyway, and want them to have access to the printer. Or not. @@ -10831,7 +10889,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ users. LPD enables you to limit the maximum byte size a file in a - job can be with the mx capability. + job can be with the mx capability. The units are in BUFSIZ blocks, which are 1024 bytes. If you put a zero for this capability, there will be no limit on file size. @@ -10847,9 +10905,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ discarded. Whether this is correct behavior is up for debate. - Let us add limits to our example printers rattan and bamboo. Since those artists' PostScript + Let us add limits to our example printers + rattan and bamboo. Since those artists' PostScript files tend to be large, we will limit them to five megabytes. - We will put no limit on the plain text line printer: + We will put no limit on the plain text line printer: # @@ -10873,10 +10932,11 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Again, the limits apply to the local users + + Again, the limits apply to the local users only. If you have set up access to your printers remotely, remote users will not get those limits. You will need to - specify the mx capability in the + specify the mx capability in the remote /etc/printcap files as well. See section madrigal.fishbaum.de. + If any other host tries to access rose's LPD, LPD will refuse them. @@ -10957,7 +11019,9 @@ madrigal.fishbaum.de minfree file for the printer bamboo. We examine /etc/printcap to find the spooling - directory for this printer; here is bamboo's entry: + directory for this printer; here is + bamboo's entry: + bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:rg=artists:mx#5000:\ @@ -10965,14 +11029,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - The spooling directory is the given - in the sd capability. We + + The spooling directory is the given + in the sd capability. We will make three megabytes (which is 6144 disk blocks) the amount of free disk space that must exist on the - filesystem for LPD to accept remote jobs: + filesystem for LPD to accept remote jobs: + &prompt.root; echo 6144 > /var/spool/lpd/bamboo/minfree - + @@ -10981,10 +11047,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ You can control which remote users can print to - local printers by specifying the rs capability in - /etc/printcap. When rs appears in the entry for a + local printers by specifying the rs capability in + /etc/printcap. When rs appears in the entry for a locally-attached printer, LPD will accept jobs from remote hosts if the user submitting the job also has an account of the same login name on @@ -11004,7 +11068,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ - + @@ -11095,17 +11159,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ starts the text and the conversion filters with the name of the accounting file to use on the filter command line. The filters can use this argument to know where to write an accounting file - entry. The name of this file comes from the af capability in + entry. The name of this file comes from the af capability in /etc/printcap, and if not specified as an absolute path, is relative to the spooling directory. LPD starts lpf with page width - and length arguments (from the pw - and pl capabilities). lpf uses these arguments to determine how + and length arguments (from the pw + and pl capabilities). lpf uses these arguments to determine how much paper will be used. After sending the file to the printer, it then writes an accounting entry in the accounting file. The - entries look like this: + entries look like this: 2.00 rose:andy @@ -11113,7 +11176,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ 3.00 orchid:mary 5.00 orchid:mary 2.00 orchid:zhang - You should use a separate accounting file for + + You should use a separate accounting file for each printer, as lpf has no file locking logic built into it, and two lpfs might corrupt each other's entries if they were to write to the same file at the same time. A easy way @@ -11121,17 +11185,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ af=acct in /etc/printcap. Then, each accounting file will be in the spooling directory for a printer, in a file named - acct. + acct. When you are ready to charge users for printouts, run - the - - + the pac program. Just change to the spooling directory for the printer you want to collect on and type pac. You - will get a dollar-centric summary like the following: + will get a dollar-centric summary like the following: + Login pages/feet runs price orchid:kelly 5.00 1 $ 0.10 @@ -11143,15 +11206,18 @@ rose:mary 87.00 32 $ 1.74 rose:root 26.00 12 $ 0.52 total 337.00 154 $ 6.74 - These are the arguments + + + These are the arguments pac - expects: + expects: + - Which printer to + Which printer to summarize. This option works only if there is an - absolute path in the af + absolute path in the af capability in /etc/printcap. @@ -11168,8 +11234,8 @@ total 337.00 154 $ 6.74 Ignore host name in the accounting files. With this - option, user smith on host alpha is the same user smith - on host gamma. Without, they are different + option, user smith on host alpha is the same user smith + on host gamma. Without, they are different users. @@ -11177,13 +11243,10 @@ total 337.00 154 $ 6.74 - Compute charges with price dollars per page or per foot - instead of the price from the pc capability in + Compute charges with price dollars per page or per foot + instead of the price from the pc capability in /etc/printcap, or two cents (the - default). You can specify price as a floating point + default). You can specify price as a floating point number. @@ -11203,24 +11266,23 @@ total 337.00 154 $ 6.74 - names... + name Print accounting information for the given user - names only. + names only. - In the default summary that pac produces, you see the number of pages printed by each user from various hosts. If, at your site, host does not matter (because users can use any host), run pac -m, to - produce the following summary: + produce the following summary: + Login pages/feet runs price andy 2.00 1 $ 0.04 @@ -11230,10 +11292,12 @@ root 26.00 12 $ 0.52 zhang 9.00 1 $ 0.18 total 337.00 154 $ 6.74 - To compute the dollar amount due, + + + To compute the dollar amount due, pac uses - the pc capability in the + the pc capability in the /etc/printcap file (default of 200, or 2 cents per page). Specify, in hundredths of cents, the price per page or per foot you want to charge for printouts in this @@ -11243,16 +11307,19 @@ total 337.00 154 $ 6.74 the option. The units for the option are in dollars, though, not hundredths of cents. For example, + &prompt.root; pac -p1.50 - makes each page cost one dollar and fifty + + + makes each page cost one dollar and fifty cents. You can really rake in the profits by using this option. Finally, running pac -s will save the summary information in a summary accounting file, which is named the same as the printer's accounting file, but with - _sum appended to the name. It then truncates + _sum appended to the name. It then truncates the accounting file. When you run pac again, it rereads the summary file to get starting totals, then @@ -11328,7 +11395,8 @@ total 337.00 154 $ 6.74 Unfortunately, I have located only two alternatives---and they are almost identical to each other! They - are: + are: + PLP, the Portable Line Printer Spooler System @@ -11384,7 +11452,6 @@ total 337.00 154 $ 6.74 - @@ -11394,7 +11461,7 @@ total 337.00 154 $ 6.74 I would like to thank the following people who have assisted in the development of this document: - + Daniel Eischen deischen@iworks.interworks.org @@ -11421,10 +11488,6 @@ total 337.00 154 $ 6.74 - - - - @@ -28004,7 +28067,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Date created: 5 December 1994 # Whom: asami # -# $Id: book.sgml,v 1.37 1998-10-21 21:58:40 nik Exp $ +# $Id: book.sgml,v 1.38 1998-10-21 22:00:19 nik Exp $ # DISTNAME= oneko-1.1b diff --git a/en_US.ISO_8859-1/books/handbook/book.sgml b/en_US.ISO_8859-1/books/handbook/book.sgml index cc090db9d5..9cd3e0354f 100644 --- a/en_US.ISO_8859-1/books/handbook/book.sgml +++ b/en_US.ISO_8859-1/books/handbook/book.sgml @@ -1701,8 +1701,8 @@ ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent For a proxy FTP server, you should usually give name of the server you really want as a part of the username, after an @-sign. The proxy server then 'fakes' the real server. An - example: Say you want to install from ftp.freebsd.org, using the - proxy FTP server foo.bar.com, listening on port 1234. + example: Say you want to install from ftp.freebsd.org, using the + proxy FTP server foo.bar.com, listening on port 1234. In this case, you go to the options menu, set the FTP username to ftp@ftp.freebsd.org, and the password to your e-mail @@ -1711,9 +1711,10 @@ ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent ftp://foo.bar.com:1234/pub/FreeBSD - /pub/FreeBSD from ftp.freebsd.org is proxied - under foo.bar.com, allowing you to install from _that_ machine - (which fetch the files from ftp.freebsd.org as your installation + /pub/FreeBSD from + ftp.freebsd.org is proxied + under foo.bar.com, allowing you to install from _that_ machine + (which fetch the files from ftp.freebsd.org as your installation requests them). @@ -2831,7 +2832,7 @@ do-install: tell the port to fetch them from servers other than ones listed in the MASTER_SITES? - A. Yes. If you know, for example, ftp.FreeBSD.ORG is much + A. Yes. If you know, for example, ftp.FreeBSD.ORG is much closer than sites listed in MASTER_SITES, do as following example. @@ -5047,7 +5048,7 @@ HULL NAY YANG TREE TOUT VETO Before explaining how to generate one-time passwords, we should go over an S/Key login prompt: - + &prompt.user; telnet himalia Trying 18.26.0.186... @@ -5056,7 +5057,7 @@ Escape character is '^]'. s/key 92 hi52030 Password: - + Note that, before prompting for a password, the login program prints out the iteration number and seed which you will need in @@ -5069,8 +5070,8 @@ s/key 92 hi52030 If this machine were configured to disallow UNIX passwords over a connection from my machine, the prompt would have also - included the annotation (s/key - required), indicating that only S/Key one-time + included the annotation (s/key + required), indicating that only S/Key one-time passwords will be accepted. @@ -5084,21 +5085,21 @@ s/key 92 hi52030 machines, and there is an S/Key desk accessory for Macintosh computers as well.) The command-line key program takes as its parameters the iteration count and seed; you can cut-and-paste right from the - login prompt starting at key to + login prompt starting at key to the end of the line. Thus: - + &prompt.user; key 92 hi52030 ) pasted from previous section Reminder - Do not use this program while logged in via telnet or rlogin. Enter secret password: ) I typed my secret password ADEN BED WOLF HAW HOT STUN - + And in the other window: - + s/key 92 hi52030 ) from previous section Password: @@ -5107,7 +5108,7 @@ ADEN BED WOLF HAW HOT STUN Last login: Wed Jun 28 15:31:00 from halloran-eldar.l [etc.] - + This is the easiest mechanism if you have a trusted machine. There is a Java S/Key key applet, - + &prompt.user; key -n 25 57 zz99999 Reminder - Do not use this program while logged in via telnet or rlogin. @@ -5137,7 +5138,7 @@ Reminder - Do not use this program while logged in via telnet or rlogin. 56: AMOS BOWL LUG FAT CAIN INCH 57: GROW HAYS TUN DISH CAR BALM - + The requests twenty-five keys in sequence; the indicates the @@ -5158,7 +5159,7 @@ Reminder - Do not use this program while logged in via telnet or rlogin. can be used to configure restrictions on the use of UNIX passwords based on the host name, user name, terminal port, or IP address of a login session. The complete format of the file is documented in - the skey.access(5) manual page; there are + the skey.access5 manual page; there are also some security cautions there which should be read before depending on this file for security. @@ -5225,10 +5226,10 @@ permit port ttyd0 countries. For those needing to get a legal foreign distribution of this - software, please DO NOT get it from a USA or + software, please do not get it from a USA or Canada site. You will get that site in big trouble! A legal copy of this is available from - skeleton.mikom.csir.co.za, which is in South + skeleton.mikom.csir.co.za, which is in South Africa. @@ -5240,20 +5241,19 @@ permit port ttyd0 change to the directory /etc/kerberosIV and check that only the following files are present: - + &prompt.root; cd /etc/kerberosIV &prompt.root; ls README krb.conf krb.realms - + If any additional files (such as principal.* or master_key) exist, then use the kdb_destroy command to destroy the old Kerberos database, of if Kerberos is not running, - simply delete the extra files with rm. + simply delete the extra files with rm. You should now edit the krb.conf and krb.realms files to define your Kerberos @@ -5284,14 +5284,14 @@ ARC.NASA.GOV trident.arc.nasa.gov The first line names the realm in which this system works. The other lines contain realm/host entries. The first item on a line is a realm, and the second is a host in that realm that is acting - as a key distribution centre. The words admin server + as a key distribution centre. The words admin server following a hosts name means that host also provides an administrative database server. For further explanation of these terms, please consult the Kerberos man pages. - Now we have to add grunt.grondar.za to + Now we have to add grunt.grondar.za to the GRONDAR.ZA realm and also add an entry to - put all hosts in the .grondar.za domain in + put all hosts in the .grondar.za domain in the GRONDAR.ZA realm. The krb.realms file would be updated as follows: @@ -5315,7 +5315,7 @@ grunt.grondar.za GRONDAR.ZA Now we are ready to create the database. This only needs to run on the Kerberos server (or Key Distribution Centre). Issue the - kdb_init command to do this: + kdb_init command to do this: &prompt.root; kdb_init @@ -5348,8 +5348,8 @@ Master key entered. BEWARE! Making it all run Two principals need to be added to the database for each system that will be secured with - Kerberos. Their names are kpasswd - and rcmd These two principals are + Kerberos. Their names are kpasswd + and rcmd These two principals are made for each system, with the instance being the name of the individual system. @@ -5360,7 +5360,7 @@ Master key entered. BEWARE! Now let's add these entries: - + &prompt.root; kdb_edit Opening database... @@ -5411,7 +5411,7 @@ Principal's new key version = 1 Edit O.K. Principal name: <---- null entry here will cause an exit - + @@ -5566,8 +5566,7 @@ Password changed. Adding <command>su</command> privileges Kerberos allows us to give each - user who needs root privileges their own separate supassword. We could now add an id which is + user who needs root privileges their own separate supassword. We could now add an id which is authorized to su to root. This is controlled by having an instance of root associated with a principal. Using kdb_edit we can create the @@ -5644,16 +5643,13 @@ May 2 20:43:12 May 3 04:43:12 krbtgt.GRONDAR.ZA@GRONDAR.ZA Using other commands - In an earlier example, we created a principal called jane with an instance root. This was based on a user with the same + In an earlier example, we created a principal called + jane with an instance root. This was based on a user with the same name as the principal, and this is a Kerberos default; that a - <principal>.<instance> of the - form <username>.root will allow that - <username> to su to root if the necessary entries are in - the .klogin file in root's home directory: + <principal>.<instance> of the + form <username>.root will allow that + <username> to su to root if the necessary entries are in + the .klogin file in root's home directory: &prompt.root; cat /root/.klogin @@ -5671,10 +5667,10 @@ jack@GRONDAR.ZA This allows anyone in the GRONDAR.ZA realm who has authenticated themselves to - jane or jack (via + jane or jack (via kinit, see above) access to rlogin to - jane's account or files on this system + jane's account or files on this system (grunt) via rlogin, rsh or rcp. @@ -5745,16 +5741,16 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are currently two distinct types of firewalls in common use on the Internet today. The first type is more properly called - a packet filtering router, where the + a packet filtering router, where the kernel on a multi-homed machine chooses whether to forward or block packets based on a set of rules. The second type, known as - proxy servers, rely on daemons to + proxy servers, rely on daemons to provide authentication and to forward packets, possibly on a multi-homed machine which has kernel packet forwarding disabled. Sometimes sites combine the two types of firewalls, so that - only a certain machine (known as a bastion + only a certain machine (known as a bastion host) is allowed to send packets through a packet filtering router onto an internal network. Proxy services are run on the bastion host, which are generally more secure than normal @@ -5806,7 +5802,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Proxy servers are machines which have had the normal system daemons (telnetd, ftpd, etc) replaced with special servers. - These servers are called proxy + These servers are called proxy servers as they normally only allow onward connections to be made. This enables you to run (for example) a proxy telnet server on your firewall host, and people can telnet @@ -5874,7 +5870,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are currently three kernel configuration options relevant to IPFW: - + options IPFIREWALL @@ -5918,10 +5914,10 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Previous versions of FreeBSD contained an - IPFIREWALL_ACCT option. This is now obsolete as + IPFIREWALL_ACCT option. This is now obsolete as the firewall code automatically includes accounting facilities. @@ -5964,7 +5960,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There is one valid flag when using this form of the command: - + -N @@ -5974,13 +5970,13 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + The command given can be shortened to the shortest unique form. The valid commands are: - + add @@ -5997,25 +5993,25 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Previous versions of IPFW used separate firewall and accounting entries. The present version provides packet accounting with each firewall entry. - If an index value is supplied, + If an index value is supplied, it used to place the entry at a specific point in the chain. Otherwise, the entry is placed at the end of the chain at an index 100 greater than the last chain entry (this does not include the default policy, rule 65535, deny). - The log option causes matching + The log option causes matching rules to be output to the system console if the kernel was - compiled with IPFIREWALL_VERBOSE. + compiled with IPFIREWALL_VERBOSE. Valid actions are: - + reject @@ -6028,9 +6024,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 allow - Pass the packet on as normal. (aliases: pass and accept) + Pass the packet on as normal. (aliases: + pass and accept) @@ -6052,7 +6047,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Each action will be recognized by the shortest unambiguous prefix. @@ -6060,7 +6055,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The protocols which can be specified are: - + all @@ -6089,7 +6084,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + The address specification is: @@ -6105,41 +6100,41 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 conjunction with protocols which support ports (UDP and TCP). - The via is optional and may + The is optional and may specify the IP address or domain name of a local IP interface, - or an interface name (e.g. ed0) to + or an interface name (e.g. ed0) to match only packets coming through this interface. Interface unit numbers can be specified with an optional wildcard. For example, - ppp* would match all kernel PPP + ppp* would match all kernel PPP interfaces. The syntax used to specify an address/mask is: - address + address or - address/mask-bits + address/mask-bits or - address:mask-pattern + address:mask-pattern A valid hostname may be specified in place of the IP - address. mask-bits is a decimal + address. is a decimal number representing how many bits in the address mask should be - set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any + set. e.g. specifying 192.216.222.1/24 will create a mask which will allow any address in a class C subnet (in this case, 192.216.222) to be - matched. mask-pattern is an IP + matched. is an IP address which will be logically AND'ed with the address given. - The keyword any may be used to + The keyword any may be used to specify any IP address. The port numbers to be blocked are specified as: @@ -6157,7 +6152,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The options available are: - + frag @@ -6180,18 +6175,18 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - ipoptions spec + ipoptions spec Matches if the IP header contains the comma separated list of options specified in - spec. The supported list of IP - options are: ssrr (strict - source route), lsrr (loose - source route), rr (record - packet route), and ts + spec. The supported list of IP + options are: ssrr (strict + source route), lsrr (loose + source route), rr (record + packet route), and ts (timestamp). The absence of a particular option may be - denoted with a leading '!'. + denoted with a leading !. @@ -6215,39 +6210,35 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - tcpflags flags + tcpflags flags Matches if the TCP header contains the comma - separated list of flags. The - supported flags are fin, - syn, rst, psh, ack, and urg. The absence of a particular - flag may be indicated by a leading '!'. + separated list of flags. The + supported flags are fin, + syn, rst, + psh, ack, and + urg. The absence of a particular + flag may be indicated by a leading !. - icmptypes - types + icmptypes types Matches if the ICMP type is present in the list - types. The list may be specified + types. The list may be specified as any combination of ranges and/or individual types separated by commas. Commonly used ICMP types are: - 0 echo reply (ping reply), - 5 redirect, 8 echo request (ping request), and - 11 time exceeded (used to + 0 echo reply (ping reply), + 5 redirect, 8 echo request (ping request), and + 11 time exceeded (used to indicate TTL expiration as with traceroute8). - + @@ -6266,7 +6257,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 There are three valid flags when using this form of the command: - + -a @@ -6292,7 +6283,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6320,7 +6311,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 ipfw zero - index + index When used without an index argument, @@ -6335,8 +6326,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Example commands for ipfw This command will deny all packets from the host - evil.hacker.org to the telnet port of the - host nice.people.org by being forwarded by + evil.hacker.org to the telnet port of the + host nice.people.org by being forwarded by the router: @@ -6344,8 +6335,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 The next example denies and logs any TCP traffic from the - entire hacker.org network (a class C) to the - nice.people.org machine (any port). + entire hacker.org network (a class C) to the + nice.people.org machine (any port). &prompt.root; ipfw add deny log tcp from evil.hacker.org/24 to nice.people.org @@ -6360,13 +6351,16 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 To see the accounting records: + &prompt.root; ipfw -a list or in the short form + &prompt.root; ipfw -a l You can also see the last time a chain entry was matched with + &prompt.root; ipfw -at l @@ -6394,8 +6388,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 rules if your requirements alter. - If you use the logging versions of the accept command, it can generate + If you use the logging versions of the accept command, it can generate large amounts of log data as one log line will be generated for every packet that passes through the firewall, so large ftp/http transfers, etc, will really slow the @@ -6424,18 +6417,18 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 to write a list of the current rules out to a file, and then - use a text editor to prepend `ipfw - ' before all the lines. This will allow the script to + use a text editor to prepend ipfw + before all the lines. This will allow the script to be fed into /bin/sh and reload the rules into the kernel. Perhaps not the most efficient way, but it works. The next problem is what your firewall should actually - DO! This is largely dependent on what access to + do! This is largely dependent on what access to your network you want to allow from the outside, and how much access to the outside world you want to allow from the inside. Some general rules are: - + @@ -6445,7 +6438,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - Block all incoming UDP + Block all incoming UDP traffic. There are very few useful services that travel over UDP, and what useful traffic there is is normally a security threat (e.g. Suns RPC and NFS protocols). This has its @@ -6478,7 +6471,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Another checklist for firewall configuration is available from CERT at LPD controls everything about a host's printers. It is responsible for a number of things: - + @@ -6566,7 +6559,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + Through a configuration file, and by providing the special filter programs, you can enable the LPD system to do all or some @@ -6584,7 +6577,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 to enable direct access to a printer, you should use the spooler anyway since - + @@ -6608,7 +6601,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6620,7 +6613,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 set up both your printer hardware and the LPD software. This document describes two levels of setup: - + @@ -6639,7 +6632,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6702,7 +6695,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 Nearly all printers you can get for a PC today support one or both of the following interfaces: - + @@ -6729,7 +6722,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + In general, serial interfaces are slower than parallel interfaces. Parallel interfaces usually offer just one-way @@ -6756,7 +6749,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 So, which interface should you use? - + @@ -6778,7 +6771,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 - + @@ -6792,8 +6785,8 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 should give you complete guidance. Remember which parallel port you used on the computer. The - first parallel port is /dev/lpt0 to FreeBSD; the second is - /dev/lpt1, and so on. + first parallel port is /dev/lpt0 to FreeBSD; the second is + /dev/lpt1, and so on. @@ -6814,7 +6807,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 A modem cable connects each pin of the connector on one end of the cable straight through to its corresponding pin of the connector on the other - end. This type of cable is also known as a DTE-to-DCE + end. This type of cable is also known as a DTE-to-DCE cable. @@ -6823,7 +6816,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 pins straight through, swaps others (send data to receive data, for example), and shorts some internally in each connector hood. This type of cable is also known as a - DTE-to-DTE cable. + DTE-to-DTE cable. @@ -6843,7 +6836,7 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 the printer can support. Choose 7 or 8 data bits; none, even, or odd parity; and 1 or 2 stop bits. Also choose a flow control protocol: either none, or XON/XOFF (also known as - in-band or software) + in-band or software) flow control. Remember these settings for the software configuration that follows. @@ -6857,40 +6850,39 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 This section describes the software setup necessary to print with the LPD spooling system in FreeBSD. - Here is an outline of the steps involved: - + Here is an outline of the steps involved: + + - + Configure your kernel, if necessary, for the port you are using for the printer; section tells you what you need to do. - + - + Set the communications mode for the parallel port, if you are using a parallel port; section gives details. - + - + Test if the operating system can send data to the printer. Section gives some suggestions on how to do this. - + - + Set up LPD for the printer by modifying the file /etc/printcap. Section shows you how. - + - - - + @@ -6904,11 +6896,13 @@ FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995 To find out if the kernel you are currently using supports a serial interface, type + &prompt.root; dmesg | grep sioN where N is the number of the serial port, starting from zero. If you see output similar to the following + sio2 at 0x3e8-0x3ef irq 5 on isa sio2: type 16550A @@ -6916,11 +6910,13 @@ sio2: type 16550A To find out if the kernel supports a parallel interface, type + &prompt.root; dmesg | grep lptN where N is the number of the parallel port, starting from zero. If you see output similar to the following + lpt0 at 0x378-0x37f on isa then the kernel supports the port. @@ -6946,25 +6942,28 @@ sio2: type 16550A send and receive data. That is what entries in the /dev directory are for. - To add a /dev - entry for a port: - + To add a /dev + entry for a port: + + - + Become root with the su command. Enter the root password when prompted. - + - + Change to the /dev directory: + &prompt.root; cd /dev - + - + Type + &prompt.root; ./MAKEDEV port where port is the device entry for the @@ -6973,18 +6972,18 @@ sio2: type 16550A so on; use ttyd0 for the first serial port, ttyd1 for the second, and so on. - + - + Type + &prompt.root; ls -l port to make sure the device entry got created. - + - - + @@ -6997,7 +6996,7 @@ sio2: type 16550A whether FreeBSD should use interrupt-driven or polled communication with the printer. - + @@ -7015,7 +7014,7 @@ sio2: type 16550A - + The interrupt-driven method is somewhat faster but uses up a precious IRQ line. You should use whichever one @@ -7027,11 +7026,12 @@ sio2: type 16550A program. - To set the communications mode by - configuring the kernel: - + To set the communications mode by + configuring the kernel: + + - + Edit your kernel configuration file. Look for or add an lpt0 entry. If you are setting up the second parallel port, use lpt1 instead. Use lpt2 for the third port, and so @@ -7041,6 +7041,7 @@ sio2: type 16550A If you want interrupt-driven mode, add the irq specifier: + device lpt0 at isa? port? tty irq N vector lptintr where N is the IRQ number for your @@ -7050,6 +7051,7 @@ device lpt0 at isa? port? tty irq N vector lptintr If you want polled mode, do not add the irq specifier: + device lpt0 at isa? port? tty vector lptintr @@ -7057,39 +7059,43 @@ device lpt0 at isa? port? tty vector lptintr - + - + Save the file. Then configure, build, and install the kernel, then reboot. See for more details. - + - - + - To set the communications mode + To set the communications mode with - lptcontrol: - + lptcontrol: + + - + Type + &prompt.root; lptcontrol -i -u N to set interrupt-driven mode for lptN. - + - + Type + &prompt.root; lptcontrol -p -u N to set polled-mode for lptN. - + - You could put these commands in your + + + You could put these commands in your /etc/rc.local file to set the mode each time your system boots. See lptcontrol8 for more information. @@ -7140,16 +7146,17 @@ showpage communicate with a printer connected to a parallel port. - To test a printer on a parallel - port: - + To test a printer on a parallel + port: + + - + Become root with su. - + - + Send data to the printer. @@ -7157,6 +7164,7 @@ showpage If the printer can print plain text, then use lptest. Type: + &prompt.root; lptest > /dev/lptN where N is the number of the @@ -7167,6 +7175,7 @@ showpage If the printer understands PostScript or other printer language, then send a small program to the printer. Type + &prompt.root; cat > /dev/lptN Then, line by line, type the @@ -7178,6 +7187,7 @@ showpage Alternatively, you can put the program in a file and type + &prompt.root; cat file > /dev/lptN where file is the name of the @@ -7187,10 +7197,9 @@ showpage - + - - + You should see something print. Do not worry if the text does not look right; we will fix such things @@ -7205,18 +7214,20 @@ showpage This section tells you how to check if FreeBSD can communicate with a printer on a serial port. - To test a printer on a serial - port: - + To test a printer on a serial + port: + + - + Become root with su. - + - + Edit the file /etc/remote. Add the following entry: + printer:dv=/dev/port:br#bps-rate:pa=parity where port is the device entry for the @@ -7229,12 +7240,13 @@ printer:dv=/dev/port:br#bps-rateHere is a sample entry for a printer connected via a serial line to the third serial port at 19200 bps with no parity: + printer:dv=/dev/ttyd2:br#19200:pa=none - + - + Connect to the printer with tip. Type: @@ -7243,9 +7255,9 @@ printer:dv=/dev/ttyd2:br#19200:pa=none the file /etc/remote again and try using /dev/cuaaN instead of /dev/ttydN. - + - + Send data to the printer. @@ -7253,6 +7265,7 @@ printer:dv=/dev/ttyd2:br#19200:pa=none If the printer can print plain text, then use lptest. Type: + ~$lptest @@ -7271,6 +7284,7 @@ printer:dv=/dev/ttyd2:br#19200:pa=none Alternatively, you can put the program in a file and type + ~>file where file is the name of the @@ -7281,10 +7295,9 @@ printer:dv=/dev/ttyd2:br#19200:pa=none - + - - + You should see something print. Do not worry if the text does not look right; we will fix that later. @@ -7314,63 +7327,61 @@ printer:dv=/dev/ttyd2:br#19200:pa=none printcap file is straightforward. Use your favorite text editor to make changes to /etc/printcap. The format is identical to other capability files like /usr/share/misc/termcap and /etc/remote. For complete information about the format, see the cgetent3. The simple spooler configuration consists of the following - steps: - + steps: + + - + Pick a name (and a few convenient aliases) for the printer, and put them in the /etc/printcap file; see . - + - + Turn off header pages (which are on by default) by - inserting the sh capability; + inserting the sh capability; see . - + - + Make a spooling directory, and specify its location - with the sd capability; see + with the sd capability; see . - + - + Set the /dev entry to use for the printer, and note it in /etc/printcap - with the lp capability; see + with the lp capability; see . Also, if the printer is on a serial port, set - up the communication parameters with the fs, fc, xs, and xc capabilities; see fs, fc, + xs, and xc capabilities; see . - + - + Install a plain text input filter; see - + - + Test the setup by printing something with the lpr command; see and . - + - - + Language-based printers, such as PostScript printers, @@ -7435,18 +7446,15 @@ rattan|line|diablo|lp|Diablo 630 Line Printer: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: In this example, the first printer is named - rattan and has as aliases - line, diablo, lp, and Diablo 630 - Line Printer. Since it has the alias lp, it is also the default printer. The - second is named bamboo, and has - as aliases ps, - , S, - panasonic, and Panasonic KX-P4455 PostScript - v51.4. + rattan and has as aliases + line, diablo, + lp, and Diablo 630 + Line Printer. Since it has the alias lp, it is also the default printer. The + second is named bamboo, and has + as aliases ps, + PS, S, + panasonic, and Panasonic KX-P4455 PostScript + v51.4. @@ -7462,11 +7470,9 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4: way of debugging the simple printer setup, so we will suppress header pages. - To suppress header pages, add the sh capability to the entry for the + To suppress header pages, add the sh capability to the entry for the printer in /etc/printcap. Here is the - example /etc/printcap with sh added: + example /etc/printcap with sh added: # @@ -7478,7 +7484,8 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh: - Note how we used the correct format: the + + Note how we used the correct format: the first line starts in the leftmost column, and subsequent lines are indented with a single TAB. Every line in an entry except the last ends in a backslash character. @@ -7503,13 +7510,15 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ It is also customary to make the directory with a name that is identical to the name of the printer, as shown below: + &prompt.root; mkdir /var/spool/printer-name However, if you have a lot of printers on your network, you might want to put the spooling directories under a single directory that you reserve just for printing with LPD. We will do this for our two example printers - rattan and bamboo: + rattan and bamboo: + &prompt.root; mkdir /var/spool/lpd &prompt.root; mkdir /var/spool/lpd/rattan @@ -7524,19 +7533,19 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ searchable by user daemon and group daemon, and no one else. We will do this for our example printers: - + &prompt.root; chown daemon.daemon /var/spool/lpd/rattan &prompt.root; chown daemon.daemon /var/spool/lpd/bamboo &prompt.root; chmod 770 /var/spool/lpd/rattan &prompt.root; chmod 770 /var/spool/lpd/bamboo - + Finally, you need to tell LPD about these directories using the /etc/printcap file. You specify the pathname of the spooling directory with the - sd capability: + sd capability: # @@ -7548,13 +7557,13 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo: - Note that the name of the printer starts in + + Note that the name of the printer starts in the first column but all other entries describing the printer should be indented with a tab and each line escaped with a backslash. - If you do not specify a spooling directory with sd, the spooling system will use + If you do not specify a spooling directory with sd, the spooling system will use /var/spool/lpd as a default. @@ -7573,13 +7582,12 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ printer). List the /dev entry pathname in the - /etc/printcap file using the lp capability. + /etc/printcap file using the lp capability. In our running example, let us assume that rattan is on the first parallel port, and bamboo is on a sixth serial port; here are the additions to - /etc/printcap: + /etc/printcap: # @@ -7592,7 +7600,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5: - + If you do not specify the lp capability for a printer in your @@ -7617,6 +7625,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ rate, parity, and other serial communication parameters on behalf of the filter program that sends data to the printer. This is advantageous since + @@ -7638,70 +7647,62 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ capabilities control serial communication parameters of the device listed in the lp capability: + - br#bps-rate + br#bps-rate Sets the communications speed of the device to - bps-rate, where - bps-rate can be 50, 75, + bps-rate, where + bps-rate can be 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, or 38400 bits-per-second. - fc#clear-bits + fc#clear-bits - Clears the flag bits clear-bits in the sgttyb structure after opening + Clears the flag bits + clear-bits in the + sgttyb structure after opening the device. - fs#set-bits + fs#set-bits - Sets the flag bits set-bits in the sgttyb structure. + Sets the flag bits + set-bits in the + sgttyb structure. - xc#clear-bits + xc#clear-bits - Clears local mode bits clear-bits after opening the + Clears local mode bits clear-bits after opening the device. - xs#set-bits + xs#set-bits - Sets local mode bits set-bits. + Sets local mode bits set-bits. For more information on the bits for the - fc, fs, xc, - and xs capabilities, see the + fc, fs, xc, + and xs capabilities, see the file /usr/include/sys/ioctl_compat.h. - When LPD opens the device specified by the lp capability, it reads the flag bits in + When LPD opens the device specified by the lp capability, it reads the flag bits in the sgttyb structure; it clears - any bits in the fc capability, - then sets bits in the fs + any bits in the fc capability, + then sets bits in the fs capability, then applies the resultant setting. It does the same for the local mode bits as well. @@ -7729,8 +7730,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ program that LPD runs when it has a job to print. When LPD runs the text filter for a printer, it sets the filter's standard input to the job to print, and its standard output to - the printer device specified with the lp capability. The filter is expected + the printer device specified with the lp capability. The filter is expected to read the job from standard input, perform any necessary translation for the printer, and write the results to standard output, which will get printed. For more information on the @@ -7740,9 +7740,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ For our simple printer setup, the text filter can be a small shell script that just executes - /bin/cat to send the job to the printer. - FreeBSD comes with another filter called lpf that handles backspacing and + /bin/cat to send the job to the printer. + FreeBSD comes with another filter called lpf that handles backspacing and underlining for printers that might not deal with such character streams well. And, of course, you can use any other filter program you want. The filter lpf is described in detail in section @@ -7766,15 +7765,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ exit 2 Make the file executable: + &prompt.root; chmod 555 /usr/local/libexec/if-simple And then tell LPD to use it by specifying it with the - if capability in + if capability in /etc/printcap. We will add it to the two printers we have so far in the example - /etc/printcap: + /etc/printcap: # @@ -7788,7 +7788,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:\ :if=/usr/local/libexec/if-simple: - + @@ -7811,10 +7811,11 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ remap="Checking Printer Communications"> to generate some test text. - To test the simple LPD + To test the simple LPD setup: Type: + &prompt.root; lptest 20 5 | lpr -Pprinter-name where -P argument. Again, if you are testing a printer that expects PostScript, send a PostScript program in that language instead of using - lptest. You can do so by putting the program in a file and typing lpr file. + lptest. You + can do so by putting the program in a file and typing lpr file. For a PostScript printer, you should get the results of the program. If you are using @@ -7856,7 +7858,10 @@ $%&'()*+,-./01234567 Troubleshooting After performing the simple test with - lptest, you might have gotten one of the following results instead of the correct printout: + lptest, you + might have gotten one of the following results instead of the + correct printout: + It worked, after awhile; or, it did not eject a full sheet. @@ -8037,12 +8042,30 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ Use the printer's configuration switches or control panel to enforce the following interpretation - of LF and CR characters: - - Printer received CR Printer prints - CR Printer received LF Printer prints - CR + LF - + of LF and CR characters: + + + + + + Printer receives + Printer prints + + + + + + CR + CR + + + + LF + CR + LF + + + + @@ -8064,14 +8087,12 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If the printer supports XON/XOFF flow control, have FreeBSD use it by specifying the - TANDEM bit in the fs capability. + TANDEM bit in the fs capability. If the printer supports carrier flow - control, specify the MDMBUF bit in the fs capability. Make sure + control, specify the MDMBUF bit in the fs capability. Make sure the cable connecting the printer to the computer is correctly wired for carrier flow control. @@ -8080,7 +8101,7 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If the printer does not support any flow control, use some combination of the NLDELAY, TBDELAY, CRDELAY, VTDELAY, and BSDELAY bits in - the fs capability + the fs capability to add appropriate delays to the stream of data sent to the printer. @@ -8098,10 +8119,9 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ This is usually another symptom of incorrect communications parameters with a serial printer. - Double-check the bps rate in the br capability, and the parity - bits in the fs and - fc capabilities; make + Double-check the bps rate in the br capability, and the parity + bits in the fs and + fc capabilities; make sure the printer is using the same settings as specified in the /etc/printcap file. @@ -8113,11 +8133,11 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ If nothing happened, the problem is probably within FreeBSD and not the hardware. Add the log file - (lf) capability to the + (lf) capability to the entry for the printer you are debugging in the /etc/printcap file. For example, - here is the entry for rattan, with the lf capability: + here is the entry for rattan, with + the lf capability: rattan|line|diablo|lp|Diablo 630 Line Printer:\ @@ -8131,14 +8151,12 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ error messages that might appear. Based on the messages you see, try to correct the problem. - If you do not specify a lf capability, LPD uses + If you do not specify a lf capability, LPD uses /dev/console as a default. - @@ -8150,7 +8168,8 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ Using Printers This section tells you how to use printers you have setup with - FreeBSD. Here is an overview of the user-level commands: + FreeBSD. Here is an overview of the user-level commands: + lpr @@ -8175,8 +8194,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ - - + There is also an administrative command, lpc, described in the section lprm, and lpq - accept an option printer-name to specify on which + accept an option to specify on which printer/queue to operate, as listed in the /etc/printcap file. This enables you to submit, remove, and check on jobs for various printers. If you do not use the option, then these commands use the - printer specified in the PRINTER environment variable. Finally, if - you do not have a PRINTER environment variable, these commands + printer specified in the PRINTER environment variable. Finally, if + you do not have a PRINTER environment variable, these commands default to the printer named lp. Hereafter, the terminology default printer - means the printer named in the PRINTER environment variable, or the - printer named lp when there is no - PRINTER environment variable. + means the printer named in the PRINTER environment variable, or the + printer named lp when there is no + PRINTER environment variable. Printing Jobs To print files, type + &prompt.user; lpr filename ... This prints each of the listed files to the @@ -8217,13 +8235,16 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ lpr reads data to print from standard input. For example, this command prints some important system files: + &prompt.user; lpr /etc/host.conf /etc/hosts.equiv To select a specific printer, type + &prompt.user; lpr -P printer-name filename ... This example prints a long listing of the - current directory to the printer named rattan: + current directory to the printer named rattan: + &prompt.user; ls -l | lpr -P rattan Because no files were listed for the @@ -8250,7 +8271,7 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ When you print with lpr, the data you wish to print is put together in a package called a - print job, which is sent to the LPD spooling + print job, which is sent to the LPD spooling system. Each printer has a queue of jobs, and your job waits in that queue along with other jobs from yourself and from other users. The printer prints those jobs in a first-come, first-served @@ -8261,10 +8282,12 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ lpq. For a specific printer, use the option. For example, the command + &prompt.user; lpq -P bamboo shows the queue for the printer named bamboo. Here is an example of the output of the lpq command: + bamboo is ready and printing Rank Owner Job Files Total Size @@ -8272,8 +8295,8 @@ active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes 2nd kelly 10 (standard input) 1635 bytes 3rd mary 11 ... 78519 bytes This shows three jobs in the queue for - bamboo. The first job, submitted by - user kelly, got assigned job number 9. Every + bamboo. The first job, submitted by + user kelly, got assigned job number 9. Every job for a printer gets a unique job number. Most of the time you can ignore the job number, but you will need it if you want to cancel the job; see section @@ -8305,7 +8328,8 @@ active kelly 9 /etc/host.conf, /etc/hosts.equiv 88 bytes The lpq command also support a option to generate a detailed - long listing. Here is an example of lpq -l: + long listing. Here is an example of lpq -l: + waiting for bamboo to become ready (offline ?) kelly: 1st [job 009rose] @@ -8317,7 +8341,7 @@ kelly: 2nd [job 010rose] mary: 3rd [job 011rose] /home/orchid/mary/research/venus/alpha-regio/mapping 78519 bytes - + @@ -8339,14 +8363,21 @@ mary: 3rd [job 011rose] the job number. Then type &prompt.user; lprm job-number - To remove the job from a specific printer, add + + + To remove the job from a specific printer, add the option. The following command removes job - number 10 from the queue for the printer bamboo: + number 10 from the queue for the printer + bamboo: + &prompt.user; lprm -P bamboo 10 - The + + + The lprm - command has a few shortcuts: + command has a few shortcuts: + lprm - @@ -8355,12 +8386,11 @@ mary: 3rd [job 011rose] - lprm user + lprm user Removes all jobs (for the default printer) belonging - to user. The superuser can + to user. The superuser can remove other users' jobs; you can remove only your own jobs. @@ -8377,12 +8407,11 @@ mary: 3rd [job 011rose] - Just use the option with the above shortcuts to operate on a specific printer instead of the default. For example, the following command removes all jobs for the - current user in the queue for the printer named rattan: + current user in the queue for the printer named rattan: &prompt.user; lprm -P rattan - @@ -8390,13 +8419,12 @@ mary: 3rd [job 011rose] If you are working in a networked - environment, - - + environment, lprm will let you remove jobs only from the host from which the jobs were submitted, even if the same printer is available from other - hosts. The following command sequence demonstrates this: + hosts. The following command sequence demonstrates this: + &prompt.user; lpr -P rattan myfile &prompt.user; rlogin orchid @@ -8411,7 +8439,7 @@ rose: Permission denied dfA013rose dequeued cfA013rose dequeued - + @@ -8442,10 +8470,12 @@ cfA013rose dequeued For example, the following command prints a DVI file (from the TeX typesetting system) named fish-report.dvi to the printer named - bamboo: + bamboo: &prompt.user; lpr -P bamboo -d fish-report.dvi - These options apply to every file in the job, + + + These options apply to every file in the job, so you cannot mix (say) DVI and ditroff files together in a job. Instead, submit the files as separate jobs, using a different conversion option for each job. @@ -8459,7 +8489,7 @@ cfA013rose dequeued Filters"> gives details. - + @@ -8492,9 +8522,8 @@ cfA013rose dequeued number - Indent the output by number columns; if you omit - number, indent by 8 + Indent the output by number columns; if you omit + number, indent by 8 columns. This option works only with certain conversion filters. @@ -8534,7 +8563,7 @@ cfA013rose dequeued title - Use title on the + Use title on the pr header instead of the file name. This option has effect @@ -8557,15 +8586,18 @@ cfA013rose dequeued - + Here is an example: this command prints a nicely formatted version of the ls manual - page on the default printer: + page on the default printer: + &prompt.user; zcat /usr/share/man/man1/ls.1.gz | troff -t -man | lpr -t - The + + + The zcat command uncompresses the source of the @@ -8596,11 +8628,9 @@ cfA013rose dequeued - -# copies + -# copies - Produce a number of copies of each file in the job + Produce a number of copies of each file in the job instead of just one copy. An administrator may disable this option to reduce printer wear-and-tear and encourage photocopier usage. See section This example prints three copies of parser.c followed by three copies - of parser.h to the default printer: + of parser.h to the default + printer: + &prompt.user; lpr -#3 parser.c parser.h - + @@ -8682,24 +8714,22 @@ cfA013rose dequeued linkend="printing-advanced-header-pages" remap="Header Pages"> for information about setting up header pages. - + - -C text + -C text Replace the hostname on the header page with - text. The hostname is + text. The hostname is normally the name of the host from which the job was submitted. - -J text + -J text Replace the job name on the header page with - text. The job name is + text. The job name is normally the name of the first file of the job, or stdin if you are printing standard input. @@ -8719,7 +8749,7 @@ cfA013rose dequeued - + @@ -8779,24 +8809,23 @@ cfA013rose dequeued Here is a summary of the lpc - commands. Most of the commands takes a printer-name argument to tell on which + commands. Most of the commands takes a printer-name argument to tell on which printer to operate. You can use all - for the printer-name to mean all + for the printer-name to mean all printers listed in /etc/printcap. - + - abort - printer-name + abort + printer-name Cancel the current job and stop the printer. Users can still submit jobs if the queue's enabled. - clean - printer-name + clean + printer-name Remove old files from the printer's spooling @@ -8808,8 +8837,8 @@ cfA013rose dequeued - disable - printer-name + disable + printer-name Disable queuing of new jobs. If the printer's @@ -8821,18 +8850,19 @@ cfA013rose dequeued printer or filter installation: disable the queue and submit jobs as root. Other users will not be able to submit jobs until you complete your testing and re-enable - the queue with the enable + the queue with the enable command. - down + down printer-name - message... + message - Take a printer down. Equivalent to disable followed by stop. The message appears as the printer's + Take a printer down. Equivalent to + disable followed by + stop. The message appears as the printer's status whenever a user checks the printer's queue with lpq @@ -8841,8 +8871,8 @@ cfA013rose dequeued - enable - printer-name + enable + printer-name Enable the queue for a printer. Users can submit jobs @@ -8851,19 +8881,19 @@ cfA013rose dequeued - help - command-name + help + command-name - Print help on the command command-name. With no command-name, print a summary of the + Print help on the command + command-name. With no + command-name, print a summary of the commands available. - restart - printer-name + restart + printer-name Start the printer. Ordinary users can use this @@ -8875,8 +8905,8 @@ cfA013rose dequeued - start - printer-name + start + printer-name Start the printer. The printer will print jobs in its @@ -8884,8 +8914,8 @@ cfA013rose dequeued - stop - printer-name + stop + printer-name Stop the printer. The printer will finish the current @@ -8895,23 +8925,21 @@ cfA013rose dequeued - topq + topq printer-name - job-or-username... + job-or-username - Rearrange the queue for printer-name by placing the jobs - with the listed job numbers - or the jobs belonging to username at the top of the queue. - For this command, you cannot use all as the printer-name. + Rearrange the queue for printer-name by placing the jobs + with the listed job numbers + or the jobs belonging to username at the top of the queue. + For this command, you cannot use all as + the printer-name. - up - printer-name + up + printer-name Bring a printer up; the opposite of the down command. Equivalent to @@ -8919,7 +8947,7 @@ cfA013rose dequeued - + lpc accepts @@ -8973,7 +9001,7 @@ cfA013rose dequeued Here is what you will find in this section: - + @@ -9045,7 +9073,6 @@ cfA013rose dequeued - When LPD wants to print a file in a job, it starts a filter program. It sets the filter's standard input to the file to print, its standard output to the printer, and its standard - error to the error logging file (specified in the lf capability in + error to the error logging file (specified in the lf capability in /etc/printcap, or /dev/console by default). @@ -9072,15 +9098,16 @@ cfA013rose dequeued lpr command line. For example, if the user typed lpr -t, LPD would start the troff filter, listed in the - tf capability for the destination + tf capability for the destination printer. If the user wanted to print plain text, it would start - the if filter (this is mostly + the if filter (this is mostly true: see for details). There are three kinds of filters you can specify in - /etc/printcap: + /etc/printcap: + @@ -9097,6 +9124,7 @@ cfA013rose dequeued and comparing that to the number of lines per page the printer supports. The text filter is started with the following argument list: + filter-name -c @@ -9107,6 +9135,7 @@ cfA013rose dequeued -h host acct-file where + @@ -9115,29 +9144,24 @@ cfA013rose dequeued - width + width - is the value from the pw (page width) capability + is the value from the pw (page width) capability specified in /etc/printcap, default 132 - length + length - is the value from the pl (page length) capability, + is the value from the pl (page length) capability, default 66 - indent + indent is the amount of the indentation from @@ -9145,8 +9169,7 @@ cfA013rose dequeued - login + login is the account name of the user printing the @@ -9154,8 +9177,7 @@ cfA013rose dequeued - host + host is the host name from which the job was @@ -9163,12 +9185,11 @@ cfA013rose dequeued - acct-file + acct-file is the name of the accounting file from the - af + af capability. @@ -9189,6 +9210,7 @@ cfA013rose dequeued Conversion filters also need to do accounting, if you need printer accounting. Conversion filters are started with the following arguments: + filter-name -h host acct-file where pixel-width is the value from the - px capability (default 0) + px capability (default 0) and pixel-height is the - value from the py capability + value from the py capability (default 0). @@ -9211,6 +9233,7 @@ cfA013rose dequeued describe them. There are only two arguments to an output filter: + filter-name -wwidth @@ -9222,10 +9245,10 @@ cfA013rose dequeued - Filters should also exit with the - following exit status: + following exit status: + exit 0 @@ -9252,7 +9275,6 @@ cfA013rose dequeued - The text filter that comes with the FreeBSD release, /usr/libexec/lpr/lpf, takes advantage of @@ -9314,17 +9336,19 @@ cfA013rose dequeued is part of lprps. If you installed lprps from the ports collection, use the following in the serial PostScript printer's - entry in /etc/printcap: + entry in /etc/printcap: + :if=/usr/local/libexec/psif: - You should also specify the rw capability; that tells LPD to open the + + + You should also specify the rw capability; that tells LPD to open the printer in read-write mode. If you have a parallel PostScript printer (and therefore cannot use two-way communication with the printer, which lprps needs), you can use the - following shell script as the text filter: + following shell script as the text filter: #!/bin/sh @@ -9351,7 +9375,8 @@ else exit 2 fi - In the above script, textps is a program we installed + + In the above script, textps is a program we installed separately to convert plain text to PostScript. You can use any text-to-PostScript program you wish. The FreeBSD ports collection (see if capability: :if=/usr/local/libexec/hpif: That is it. You can type lpr plain.text and lpr @@ -9457,17 +9483,23 @@ exit 2 typesetting system, and we have a PostScript printer. Every time we generate a DVI file from TeX, we cannot print it directly until we convert the DVI file into PostScript. The - command sequence goes like this: + command sequence goes like this: + &prompt.user; dvips seaweed-analysis.dvi &prompt.user; lpr seaweed-analysis.ps - By installing a conversion filter for DVI + + + By installing a conversion filter for DVI files, we can skip the hand conversion step each time by having LPD do it for us. Now, each time we get a DVI file, we - are just one step away from printing it: + are just one step away from printing it: + &prompt.user; lpr -d seaweed-analysis.dvi - We got LPD to do the DVI file conversion + + + We got LPD to do the DVI file conversion for us by specifying the option. Section @@ -9558,10 +9590,10 @@ exit 2 - + In our example, using lpr -d means the - printer needs a df capability in + printer needs a df capability in its entry in /etc/printcap. Despite what others might contend, formats like FORTRAN @@ -9571,7 +9603,7 @@ exit 2 would like to directly print Printerleaf files (files from the Interleaf desktop publishing program), but will never print plot files. You could install a Printerleaf conversion filter - under the gf capability and then + under the gf capability and then educate your users that lpr -g mean print Printerleaf files. @@ -9592,10 +9624,10 @@ exit 2 /etc/printcap. In our example, we will add the DVI conversion filter to - the entry for the printer named bamboo. Here is the example + the entry for the printer named bamboo. Here is the example /etc/printcap file again, with the new - df capability for the printer - bamboo + df capability for the printer + bamboo. # @@ -9612,9 +9644,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - The DVI filter is a shell script named + + The DVI filter is a shell script named /usr/local/libexec/psdf. Here is that - script: + script: #!bin/sh @@ -9626,7 +9659,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ # exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" - This script runs + + This script runs dvips in filter mode (the argument) on standard input, which is the job to print. It then starts the PostScript printer filter lprps (see section ) with the arguments LPD passed to this script. @@ -9645,7 +9679,7 @@ exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@" This example script is a raster (well, GIF file, actually) conversion filter for a Hewlett Packard LaserJet III-Si - printer: + printer: #!/bin/sh @@ -9657,13 +9691,14 @@ PATH=/usr/X11R6/bin:$PATH; export PATH giftopnm | ppmtopgm | pgmtopbm | pbmtolj && exit 0 \ || exit 2 - It works by converting the GIF file into a + + It works by converting the GIF file into a portable anymap, converting that into a portable graymap, converting that into a portable bitmap, and converting that into LaserJet/PCL-compatible data. Here is the /etc/printcap file with - an entry for a printer using the above filter: + an entry for a printer using the above filter: # @@ -9673,11 +9708,11 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :lp=/dev/lpt0:sh:sd=/var/spool/lpd/teak:mx#0:\ :if=/usr/local/libexec/hpif:\ :vf=/usr/local/libexec/hpvf: - + The following script is a conversion filter for troff data from the groff typesetting system for the PostScript printer - named bamboo: + named bamboo: #!/bin/sh @@ -9687,9 +9722,10 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ # exec grops | /usr/local/libexec/lprps "$@" - The above script makes use of lprps again to handle the communication + + The above script makes use of lprps again to handle the communication with the printer. If the printer were on a parallel port, we - would use this script instead: + would use this script instead: #!/bin/sh @@ -9699,17 +9735,19 @@ exec grops | /usr/local/libexec/lprps "$@" # exec grops - That is it. Here is the entry we need to + + That is it. Here is the entry we need to add to /etc/printcap to enable the - filter: + filter: + :tf=/usr/local/libexec/pstf: - + Here is an example that might make old hands at FORTRAN blush. It is a FORTRAN-text filter for any printer that can directly print plain text. We will install it for the printer - teak: + teak: #!/bin/sh @@ -9721,19 +9759,23 @@ exec grops printf "\033&k2G" && fpr && printf "\f" && exit 0 exit 2 - And we will add this line to the - /etc/printcap for the printer teak to enable this filter: + + And we will add this line to the + /etc/printcap for the printer + teak to enable this filter: + :rf=/usr/local/libexec/hprf: - + Here is one final, somewhat complex example. We will add - a DVI filter to the LaserJet printer teak introduced earlier. First, the + a DVI filter to the LaserJet printer teak introduced earlier. First, the easy part: updating /etc/printcap with - the location of the DVI filter: + the location of the DVI filter: + :df=/usr/local/libexec/hpdf: - + Now, for the hard part: making the filter. For that, we need a DVI-to-LaserJet/PCL conversion program. The FreeBSD @@ -9761,9 +9803,8 @@ exit 2 The only other fly in the ointment is the fact that we cannot use /tmp for the temporary link. - Symbolic links are owned by user and group bin. The filter runs as user daemon. And the + Symbolic links are owned by user and group + bin. The filter runs as user daemon. And the /tmp directory has the sticky bit set. The filter can create the link, but it will not be able clean up when done and remove it since the link will belong to a @@ -9771,13 +9812,13 @@ exit 2 Instead, the filter will make the symbolic link in the current working directory, which is the spooling directory - (specified by the sd capability + (specified by the sd capability in /etc/printcap). This is a perfect place for filters to do their work, especially since there is (sometimes) more free disk space in the spooling directory than under /tmp. - Here, finally, is the filter: + Here, finally, is the filter: #!/bin/sh @@ -9839,7 +9880,7 @@ dvilj2p -M1 -q -e- dfhp$$.dvi # cleanup exit 0 - + @@ -9901,13 +9942,14 @@ exit 0 LPD does not pass the user's login or host to the filter, so it is not intended to do accounting. In fact, it gets only two arguments: + filter-name -wwidth -llength - where width is from the pw capability and length is from the pl capability for the printer in + where width is + from the pw capability and + length is from the pl capability for the printer in question. @@ -9980,8 +10022,7 @@ exit 0 In order for lpf to do page accounting correctly, it needs correct values filled in for the - pw and pl capabilities in the + pw and pl capabilities in the /etc/printcap file. It uses these values to determine how much text can fit on a page and how many pages were in a user's job. For more information on printer @@ -10029,15 +10070,14 @@ exit 0 Printer Setup">, we turned off header pages by specifying sh (meaning suppress header) in the /etc/printcap file. To - enable header pages for a printer, just remove the sh capability. + enable header pages for a printer, just remove the sh capability. Sounds too easy, right? You are right. You might have to provide an output filter to send initialization strings to the printer. Here is an example output filter for Hewlett Packard - PCL-compatible printers: + PCL-compatible printers: #!/bin/sh @@ -10048,15 +10088,16 @@ exit 0 printf "\033&k2G" || exit 2 exec /usr/libexec/lpr/lpf - Specify the path to the output filter in the - of capability. See Specify the path to the output filter in the + of capability. See for more information. Here is an example /etc/printcap file - for the printer teak that we + for the printer teak that we introduced earlier; we enabled header pages and added the above - output filter: + output filter: # @@ -10068,7 +10109,8 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ :vf=/usr/local/libexec/hpvf:\ :of=/usr/local/libexec/hpof: - Now, when users print jobs to teak, they get a header page with each + + Now, when users print jobs to teak, they get a header page with each job. If users want to spend time searching for their printouts, they can suppress header pages by submitting the job with lpr -h; see LPD prints a form feed character after the header page. If your printer uses a different character or sequence of - characters to eject a page, specify them with the ff capability in + characters to eject a page, specify them with the ff capability in /etc/printcap. @@ -10094,7 +10135,8 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ By enabling header pages, LPD will produce a long header, a full page of large letters identifying the user, host, and job. Here is an example (kelly printed the - job named outline from host rose): + job named outline from host rose): + k ll ll k l l @@ -10143,19 +10185,23 @@ teak|hp|laserjet|Hewlett Packard LaserJet 3Si:\ Job: outline Date: Sun Sep 17 11:04:58 1995 - LPD appends a form feed after this text so - the job starts on a new page (unless you have sf (suppress form feeds) in the + + + LPD appends a form feed after this text so + the job starts on a new page (unless you have sf (suppress form feeds) in the destination printer's entry in /etc/printcap). If you prefer, LPD can make a short header; specify sb (short banner) in the /etc/printcap file. - The header page will look like this: + The header page will look like this: + rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 - Also by default, LPD prints the header page + + + Also by default, LPD prints the header page first, then the job. To reverse that, specify hl (header last) in /etc/printcap. @@ -10222,11 +10268,10 @@ rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 the header page. The only other problem with this method is that the output filter still does not know what accounting file to use (it is not passed the name of the - file from the af + file from the af capability), but if you have a well-known accounting file, you can hard-code that into the output filter. To - facilitate the parsing step, use the sh (short header) capability in + facilitate the parsing step, use the sh (short header) capability in /etc/printcap. Then again, all that might be too much trouble, and users will certainly appreciate the more generous system administrator who @@ -10256,7 +10301,7 @@ rose:kelly Job: outline Date: Sun Sep 17 11:07:51 1995 Let us explore this method. The following script takes three arguments (user login name, host name, and job name) and - makes a simple PostScript header page: + makes a simple PostScript header page: #!/bin/sh @@ -10339,11 +10384,12 @@ restore showpage EOF - Now, each of the conversion filters and the + + Now, each of the conversion filters and the text filter can call this script to first generate the header page, and then print the user's job. Here is the DVI conversion filter from earlier in this document, modified to make a header - page: + page: #!/bin/sh @@ -10378,7 +10424,8 @@ done ( /usr/local/libexec/make-ps-header $login $host "DVI File" /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args - Notice how the filter has to parse the + + Notice how the filter has to parse the argument list in order to determine the user and host name. The parsing for the other conversion filters is identical. The text filter takes a slightly different set of arguments, though (see @@ -10508,24 +10555,23 @@ done - Leave the lp capability + Leave the lp capability blank, explicitly (:lp=:). Make a spooling directory and specify its location in - the sd capability. LPD will + the sd capability. LPD will store jobs here before they get sent to the printer host. - Place the name of the printer host in the rm capability. + Place the name of the printer host in the rm capability. Place the printer name on the printer - host in the rp + host in the rp capability. @@ -10533,15 +10579,15 @@ done filters, page dimensions, or anything else in the /etc/printcap file. - Here is an example. The host rose has two printers, - bamboo and rattan. We will enable users on the host + Here is an example. The host rose has two printers, + bamboo and rattan. We will enable users on the host orchid to print to those printers. Here is the - /etc/printcap file for orchid (back from + /etc/printcap file for orchid (back from section ). It already had the entry for - the printer teak; we have added - entries for the two printers on the host rose: + the printer teak; we have added + entries for the two printers on the host rose: # @@ -10569,17 +10615,20 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo: - Then, we just need to make spooling - directories on orchid: + + Then, we just need to make spooling + directories on orchid: &prompt.root; mkdir -p /var/spool/lpd/rattan /var/spool/lpd/bamboo &prompt.root; chmod 770 /var/spool/lpd/rattan /var/spool/lpd/bamboo &prompt.root; chown daemon.daemon /var/spool/lpd/rattan /var/spool/lpd/bamboo - + - Now, users on orchid can print to rattan and bamboo. If, for example, a user on orchid + Now, users on orchid can print to + rattan and bamboo. If, for example, a user on orchid typed + &prompt.user; lpr -P bamboo -d sushi-review.dvi the LPD system on orchid would copy the job @@ -10625,7 +10674,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ one-way communication only (FreeBSD to printer); many network printers support two-way communication, and you might want to take advantage of that (to get printer status, perform - accounting, etc.). + accounting, etc.). #!/usr/bin/perl @@ -10652,11 +10701,12 @@ connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!"; while (<STDIN>) { print PRINTER; } exit 0; - We can then use this script in various + + We can then use this script in various filters. Suppose we had a Diablo 750-N line printer connected to the network. The printer accepts data to print on port number 5100. The host name of the printer is scrivener. Here - is the text filter for the printer: + is the text filter for the printer: #!/bin/sh @@ -10664,7 +10714,7 @@ exit 0; # diablo-if-net - Text filter for Diablo printer `scrivener' listening # on port 5100. Installed in /usr/local/libexec/diablo-if-net # exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint scrivener 5100 - + @@ -10693,9 +10743,10 @@ exit 0; on your printers, you can disable the option to lpr by - adding the sc capability to the + adding the sc capability to the /etc/printcap file. When users submit jobs with the option, they will see + lpr: multiple copies are not allowed @@ -10703,17 +10754,16 @@ exit 0; Note that if you have set up access to a printer remotely (see section ), you need - the sc capability on the remote + the sc capability on the remote /etc/printcap files as well, or else users will still be able to submit multiple-copy jobs by using another host. Here is an example. This is the - /etc/printcap file for the host rose. The - printer rattan is quite hearty, so - we will allow multiple copies, but the laser printer bamboo's a bit more delicate, so we will - disable multiple copies by adding the sc capability: + /etc/printcap file for the host rose. The + printer rattan is quite hearty, so + we will allow multiple copies, but the laser printer bamboo's a bit more delicate, so we will + disable multiple copies by adding the sc capability: # @@ -10730,10 +10780,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Now, we also need to add the sc capability on the host orchid's + + Now, we also need to add the sc capability on the host orchid's /etc/printcap (and while we are at it, let - us disable multiple copies for the printer teak): + us disable multiple copies for the printer teak): # @@ -10751,15 +10801,19 @@ rattan|line|diablo|lp|Diablo 630 Line Printer:\ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :lp=:rm=rose:rp=bamboo:sd=/var/spool/lpd/bamboo:sc: - By using the sc + + By using the sc capability, we prevent the use of lpr -#, but that still does not prevent users from running lpr multiple times, or from submitting the same file multiple times - in one job like this: + in one job like this: + &prompt.user; lpr forsale.sign forsale.sign forsale.sign forsale.sign forsale.sign - There are many ways to prevent this abuse + + + There are many ways to prevent this abuse (including ignoring it) which you are free to explore. @@ -10769,29 +10823,31 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ Restricting Access To Printers You can control who can print to what printers by using the - UNIX group mechanism and the rg + UNIX group mechanism and the rg capability in /etc/printcap. Just place the users you want to have access to a printer in a certain - group, and then name that group in the rg capability. + group, and then name that group in the rg capability. Users outside the group (including root) will be greeted with + lpr: Not a member of the restricted group - if they try to print to the controlled + + + if they try to print to the controlled printer. - As with the sc (suppress - multiple copies) capability, you need to specify rg on remote hosts that also have access + As with the sc (suppress + multiple copies) capability, you need to specify rg on remote hosts that also have access to your printers, if you feel it is appropriate (see section ). - For example, we will let anyone access the printer rattan, but only those in group artists can use bamboo. Here is the familiar - /etc/printcap for host rose: + For example, we will let anyone access the printer + rattan, but only those in group + artists can use bamboo. Here is the familiar + /etc/printcap for host rose: # @@ -10808,10 +10864,12 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Let us leave the other example - /etc/printcap file (for the host orchid) - alone. Of course, anyone on orchid can print to bamboo. It might be the case that we only - allow certain logins on orchid anyway, and want them to have + + Let us leave the other example + /etc/printcap file (for the host orchid) + alone. Of course, anyone on orchid can print to + bamboo. It might be the case that we only + allow certain logins on orchid anyway, and want them to have access to the printer. Or not. @@ -10831,7 +10889,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ users. LPD enables you to limit the maximum byte size a file in a - job can be with the mx capability. + job can be with the mx capability. The units are in BUFSIZ blocks, which are 1024 bytes. If you put a zero for this capability, there will be no limit on file size. @@ -10847,9 +10905,10 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ discarded. Whether this is correct behavior is up for debate. - Let us add limits to our example printers rattan and bamboo. Since those artists' PostScript + Let us add limits to our example printers + rattan and bamboo. Since those artists' PostScript files tend to be large, we will limit them to five megabytes. - We will put no limit on the plain text line printer: + We will put no limit on the plain text line printer: # @@ -10873,10 +10932,11 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - Again, the limits apply to the local users + + Again, the limits apply to the local users only. If you have set up access to your printers remotely, remote users will not get those limits. You will need to - specify the mx capability in the + specify the mx capability in the remote /etc/printcap files as well. See section madrigal.fishbaum.de. + If any other host tries to access rose's LPD, LPD will refuse them. @@ -10957,7 +11019,9 @@ madrigal.fishbaum.de minfree file for the printer bamboo. We examine /etc/printcap to find the spooling - directory for this printer; here is bamboo's entry: + directory for this printer; here is + bamboo's entry: + bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:sc:rg=artists:mx#5000:\ @@ -10965,14 +11029,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :if=/usr/local/libexec/psif:\ :df=/usr/local/libexec/psdf: - The spooling directory is the given - in the sd capability. We + + The spooling directory is the given + in the sd capability. We will make three megabytes (which is 6144 disk blocks) the amount of free disk space that must exist on the - filesystem for LPD to accept remote jobs: + filesystem for LPD to accept remote jobs: + &prompt.root; echo 6144 > /var/spool/lpd/bamboo/minfree - + @@ -10981,10 +11047,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ You can control which remote users can print to - local printers by specifying the rs capability in - /etc/printcap. When rs appears in the entry for a + local printers by specifying the rs capability in + /etc/printcap. When rs appears in the entry for a locally-attached printer, LPD will accept jobs from remote hosts if the user submitting the job also has an account of the same login name on @@ -11004,7 +11068,7 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ - + @@ -11095,17 +11159,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ starts the text and the conversion filters with the name of the accounting file to use on the filter command line. The filters can use this argument to know where to write an accounting file - entry. The name of this file comes from the af capability in + entry. The name of this file comes from the af capability in /etc/printcap, and if not specified as an absolute path, is relative to the spooling directory. LPD starts lpf with page width - and length arguments (from the pw - and pl capabilities). lpf uses these arguments to determine how + and length arguments (from the pw + and pl capabilities). lpf uses these arguments to determine how much paper will be used. After sending the file to the printer, it then writes an accounting entry in the accounting file. The - entries look like this: + entries look like this: 2.00 rose:andy @@ -11113,7 +11176,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ 3.00 orchid:mary 5.00 orchid:mary 2.00 orchid:zhang - You should use a separate accounting file for + + You should use a separate accounting file for each printer, as lpf has no file locking logic built into it, and two lpfs might corrupt each other's entries if they were to write to the same file at the same time. A easy way @@ -11121,17 +11185,16 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ af=acct in /etc/printcap. Then, each accounting file will be in the spooling directory for a printer, in a file named - acct. + acct. When you are ready to charge users for printouts, run - the - - + the pac program. Just change to the spooling directory for the printer you want to collect on and type pac. You - will get a dollar-centric summary like the following: + will get a dollar-centric summary like the following: + Login pages/feet runs price orchid:kelly 5.00 1 $ 0.10 @@ -11143,15 +11206,18 @@ rose:mary 87.00 32 $ 1.74 rose:root 26.00 12 $ 0.52 total 337.00 154 $ 6.74 - These are the arguments + + + These are the arguments pac - expects: + expects: + - Which printer to + Which printer to summarize. This option works only if there is an - absolute path in the af + absolute path in the af capability in /etc/printcap. @@ -11168,8 +11234,8 @@ total 337.00 154 $ 6.74 Ignore host name in the accounting files. With this - option, user smith on host alpha is the same user smith - on host gamma. Without, they are different + option, user smith on host alpha is the same user smith + on host gamma. Without, they are different users. @@ -11177,13 +11243,10 @@ total 337.00 154 $ 6.74 - Compute charges with price dollars per page or per foot - instead of the price from the pc capability in + Compute charges with price dollars per page or per foot + instead of the price from the pc capability in /etc/printcap, or two cents (the - default). You can specify price as a floating point + default). You can specify price as a floating point number. @@ -11203,24 +11266,23 @@ total 337.00 154 $ 6.74 - names... + name Print accounting information for the given user - names only. + names only. - In the default summary that pac produces, you see the number of pages printed by each user from various hosts. If, at your site, host does not matter (because users can use any host), run pac -m, to - produce the following summary: + produce the following summary: + Login pages/feet runs price andy 2.00 1 $ 0.04 @@ -11230,10 +11292,12 @@ root 26.00 12 $ 0.52 zhang 9.00 1 $ 0.18 total 337.00 154 $ 6.74 - To compute the dollar amount due, + + + To compute the dollar amount due, pac uses - the pc capability in the + the pc capability in the /etc/printcap file (default of 200, or 2 cents per page). Specify, in hundredths of cents, the price per page or per foot you want to charge for printouts in this @@ -11243,16 +11307,19 @@ total 337.00 154 $ 6.74 the option. The units for the option are in dollars, though, not hundredths of cents. For example, + &prompt.root; pac -p1.50 - makes each page cost one dollar and fifty + + + makes each page cost one dollar and fifty cents. You can really rake in the profits by using this option. Finally, running pac -s will save the summary information in a summary accounting file, which is named the same as the printer's accounting file, but with - _sum appended to the name. It then truncates + _sum appended to the name. It then truncates the accounting file. When you run pac again, it rereads the summary file to get starting totals, then @@ -11328,7 +11395,8 @@ total 337.00 154 $ 6.74 Unfortunately, I have located only two alternatives---and they are almost identical to each other! They - are: + are: + PLP, the Portable Line Printer Spooler System @@ -11384,7 +11452,6 @@ total 337.00 154 $ 6.74 - @@ -11394,7 +11461,7 @@ total 337.00 154 $ 6.74 I would like to thank the following people who have assisted in the development of this document: - + Daniel Eischen deischen@iworks.interworks.org @@ -11421,10 +11488,6 @@ total 337.00 154 $ 6.74 - - - - @@ -28004,7 +28067,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Date created: 5 December 1994 # Whom: asami # -# $Id: book.sgml,v 1.37 1998-10-21 21:58:40 nik Exp $ +# $Id: book.sgml,v 1.38 1998-10-21 22:00:19 nik Exp $ # DISTNAME= oneko-1.1b