File: ncpprint

package info (click to toggle)
lprng 3.8.B-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,344 kB
  • sloc: ansic: 35,071; sh: 3,040; perl: 1,896; makefile: 380
file content (69 lines) | stat: -rwxr-xr-x 1,925 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
# $Id: ncpprint,v 1.74 2004/09/24 20:19:56 papowell Exp $
# This script is an input filter for printcap printing on a unix machine. It
# uses the nprint program to print the file to the specified ncp-based 
# server and queue.
# For example you could have a printcap entry like this
#
# ncp:lp=/dev/null:sd=/usr/spool/ncp:sh:if=/usr/local/bin/ncpprint
#
# which would create a unix printer called "ncp" that will print via this 
# script. You will need to create the spool directory /usr/spool/ncp with
# appropriate permissions and ownerships for your system.

#
# This version reads from a ${SPOOLDIR}/general.cfg
#  file or uses the PRINTCAP_ENTRY environment variable
#  passed by LPRng,  and the 'ncp_options' value in it.
#  The username and password information are in an 'authfile'
#
#
# If you use the ${SPOOLDIR}/general.cfg file, it should contain:
#   server=PC_SERVER
#   printer=PRINTER_QUEUE
#   authfile=auth
#
#
# Example:
#   server=NWSERVER
#   printer=P_QUEUE1
#   authfile=auth
# authfile has:
#   username=fred
#   password=
#
# You can also  put options into the printcap ncp_options entry
# ncp:lp=/dev/null:sd=/usr/spool/ncp:sh:if=/usr/local/bin/ncpprint
#   ncp_options= server=NWSERVER printer=P_QUEUE1 authfile=authfile
#

if [ -f ./general.cfg ] ; then
	. ./general.cfg
fi
options=`echo "${PRINTCAP_ENTRY}" | sed -n -e 's/:ncp_options=//' `
if [ -n "$options" ] ; then
	eval export $options
fi

# get username and password values
if [ -n "$authfile' -a -f "$authfile" ] ; then
	. $authfile
fi

usercmd=""
if [ "$username" != "" ]; then
   if [ "$password" != "" ]; then
		usercmd="-U $username -P $password"
   else
        usercmd="-U $username -n"
   fi
fi

#cat > /tmp/printout
#x_command=""
#case $translate in
#  yes) x_command="translate" ;;
#esac
#echo $server $password $translate $x_command > /tmp/ncpprint.log

/usr/bin/nprint -S $server -q $printer $usercmd -N - 2>/dev/null