From owner-freebsd-hackers Wed May 17 0:41: 7 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from hermes.research.kpn.com (hermes.research.kpn.com [139.63.192.8]) by hub.freebsd.org (Postfix) with ESMTP id 7F4D837B9BC for ; Wed, 17 May 2000 00:41:03 -0700 (PDT) (envelope-from K.J.Koster@kpn.com) Received: from l04.research.kpn.com (l04.research.kpn.com [139.63.192.204]) by research.kpn.com (PMDF V5.2-31 #42699) with ESMTP id <01JPI33KDYW80003FH@research.kpn.com> for freebsd-hackers@freebsd.org; Wed, 17 May 2000 09:40:54 +0200 Received: by l04.research.kpn.com with Internet Mail Service (5.5.2650.21) id ; Wed, 17 May 2000 09:40:49 +0100 Content-return: allowed Date: Wed, 17 May 2000 09:40:42 +0100 From: "Koster, K.J." Subject: RE: smb printer trouble To: 'Charlie Root' Cc: 'FreeBSD Hackers mailing list' Message-id: <59063B5B4D98D311BC0D0001FA7E4522026D753C@l04.research.kpn.com> MIME-version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Perhaps there are some invisible spaces after some of the backslashes? Kees Jan ============================================== You are only young once, but you can stay immature all your life > -----Original Message----- > From: Charlie Root [mailto:root@jestocost.cosc.morrisville.edu] > Sent: dinsdag 16 mei 2000 20:39 > To: freebsd-hackers@FreeBSD.ORG > Subject: smb printer trouble > > > I wrote a simple filter to print to an nt print queue through > the smbclinet. It tests to see if the file is postscript or > text, and if it is text it sends a control code to tell the > printer to do the lf->crlf conversion. > > My problem is that the '\' escapes in the first line get clobbered. > for example, if I print this printcap: > > **** begin printcap **** > lp:\ > :sh:\ > :lp=/dev/lpt0:\ > :sd=/var/spool/output/lpd/lp:\ > :lf=/var/log/lpd/lpd.log: > > lplaser:\ > :sh:\ > :lp=/dev/null:\ > :if=/root/filters/smb-filter:\ > :sd=/var/spool/output/lpd/lplaser:\ > :lf=/var/log/lpd/lpd.log: > **** end printap **** > > the entire entry for "lp" will be on one line, but the "lplaser" > entry will print out like it is supposed to. > > I know why it is doing it, however I don't know how to fix it. Any > help will be appreciated (script is below). > > Thanks, > James > > **** begin smb-filter **** > #!/bin/sh > #### > # Input filter to print to a NT print queue, requires smbclient. > # > # Author: James Halstead, e-mail: JAHalstead@hotmail.com > # > # Read stdin to a temp, make sure to determine the print > type, then use > # smbclient to print to the nt queue. > #### > > SERVER= > PRINTER=cw > TEMP=/tmp/smbprint > > TEMP=`mktemp -q $TEMP.XXXXXX` > > read firstline > first_two=`expr "$firstline" : '\(..\)'` > > if [ "$first_two" != "%!" ]; then > printf "\033&k3G" > $TEMP > fi > > #lets see, copy the firstline to temp, cat the rest to the temp, > # make one ugly command to print the file to the smb printer then > # rm the temp file. > > echo "$firstline" >> $TEMP && cat >> $TEMP &&\ > /usr/local/bin/smbclient \\\\$SERVER\\$PRINTER -UGUEST -N\ > -c"print $TEMP" &&\ > rm -f $TEMP >/dev/null && exit 0 > > exit 1 > **** end smb-filter **** > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message