summaryrefslogtreecommitdiff
blob: f9620e666f12eb205d6a843bd5d09195c3e0c1c9 (plain)
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
#!/bin/sh
# Based on fax-pnh-filter from lexmark scripts
# Copyright 2013 Robin H. Johnson <robbat2@gentoo.org>
# Licensed under BSD-3

PRINT_CMD="echo"
SED_CMD="/bin/sed"
HOSTNAME="/bin/hostname"
AWK_CMD=`which awk`

myhost=`${HOSTNAME}`
myuser=$2
myjob=`echo "$3" | sed -e 's|&|\\\&|g' -e "s|\"|'|g"`
mycopies=$4

#-- Uncomment line below for debugging purposes.  If fax-pnh-filter.debug is created in /tmp, 
#-- then that means that this fax-pnh-filter was successfully called.
#${PRINT_CMD} user=$myuser job=$myjob >> /tmp/fax-pnh-filter.debug

# Notice the corrected typo in USERNAME, the original script had GEYMYUSERNAME
${SED_CMD} -r \
	-e "/STATIONID =/s/GETMYHOST/\"${myhost}\"/g" \
	-e "/PJL SET USERNAME =/s/GE[TY]MYUSERNAME/\"${myuser}\"/g" \
	-e "/PJL SET JOBNAME =/s/GETMYJOBNAME/\"${myjob}\"/g" \
	-e "/PJL SET QTY =/s/GETMYCOPIES/${mycopies}/g"