1#!/bin/sh
2# $Id: atalkprint,v 1.1.1.1 2008/10/15 03:28:26 james26_jang Exp $
3# This is a template file for hooking up printing to a remote
4#  printer that needs a communication program
5#
6#  Modified by Patrick Powell <papowell@astart.com> for the LPRngTool
7#   Note 1: the general.config file is assumed to be in the current directory
8#   Note 2: entries can be in any order in the file
9#
10# This script is an input filter for printcap printing on a unix machine. It
11# uses the smbclient program to print the file to the specified smb-based 
12# server and service.
13# For example you could have a printcap entry like this
14#
15# atalk:lp=/dev/null:sd=/usr/spool/lpd/atalk:if=/usr/local/filters/atalkprint
16# 
17# which would create a unix printer called "atalk" that will print via this 
18# script.
19#
20# The script gets its information from the general.config file
21# file in the printer spool directory or the atalk_options line
22# or from the printcap 'atalk_options' line
23# The options used are:
24#   host=host           host for printing
25#   printer=printer     printer
26#   username=printer     printer
27# example: general.config file -
28#    host="host"
29#    printer="lp"
30#
31# :atalk_options= host="host" printer="lp"
32#
33# Should read the following variables set in the auth file:
34#   username=username       for authentication
35#   password=password   for authentication
36
37if [ -f ./general.cfg ] ; then
38	. ./general.cfg
39fi
40options=`echo "${PRINTCAP_ENTRY}" | sed -n 's/:atalk_options=//p' `
41if [ -n "$options" ] ; then
42	eval export $options
43fi
44
45# now you simply use the paramters you have extracted
46#
47/usr/bin/pap -p "$username:$printer@$host"
48