The Section A Better xmh Printer: xmhprint gives an overview of this script. Here is the xmhprint script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.
The errsubj shell variable holds a subject line for an emailed error message; the program sends some errors in the mail to you. The printcmd variable holds the printer command and any options that should always be used. If you take the comment characters off the errfile and exec lines, they'll set up a file to hold printer and script error messages instead of emailing them to you.
The rest of the script is straightforward. Remember that you can hack it to change the way options work, or to add options that you want. You can also pass options from your X resource entry as part of the "$@" shell parameter list. That's because the Bourne shell shift command removes the option like -p1 (in $1) from the command-line parameters. The "$@" list will have any leftover options plus the absolute pathnames of the messages to print. That is, if you had the following resource entry set:
xmh*PrintCommand: xmhprint -p1 -fand if the xmh program was printing the messages /yourMHdir/inbox/3 and /yourMHdir/inbox/4, the pr command run would be:
pr -f /yourMHdir/inbox/3 /yourMHdir/inbox/4 | $printcmd 1>&2The 1>&2 after $printcmd redirects any standard output from the printer command to the standard error so that you'll see it.
If none of the case options match, the script just passes all the command-line parameters to the printer command.
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. It is freely available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see COPYING.
Copyright © 1991, 1992, 1995 O'Reilly Media, Inc.
Last modified: 2006-05-31 15:13:43 -0700