From owner-freebsd-hackers Wed May 17 20:27:21 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from io.dreamscape.com (io.dreamscape.com [206.64.128.6]) by hub.freebsd.org (Postfix) with ESMTP id F366137B540 for ; Wed, 17 May 2000 20:27:14 -0700 (PDT) (envelope-from halstead@dreamscape.com) Received: from halste07 (sA17-p51.dreamscape.com [209.217.195.242]) by io.dreamscape.com (8.9.3/8.8.4) with SMTP id XAA02147; Wed, 17 May 2000 23:26:08 -0400 (EDT) X-Dreamscape-Track-A: sA17-p51.dreamscape.com [209.217.195.242] X-Dreamscape-Track-B: Wed, 17 May 2000 23:26:08 -0400 (EDT) Message-ID: <002f01bfc079$1d0e1060$f2c3d9d1@halste07> From: "James Halstead" To: "Koster, K.J." Cc: References: <59063B5B4D98D311BC0D0001FA7E4522026D753C@l04.research.kpn.com> Subject: Re: smb printer trouble Date: Wed, 17 May 2000 23:28:18 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I know it is happening because of the ``read firstline'' command. It is using the standard shell way of continuing a line using the '\' char and applying that to the input. That explains why only the first line is effected. Actually, if there is a way that I can read only the first two chars from the standard input that would solve the problem for nearly all the cases. I only need the first two chars to do my test, then I can leave the rest up to cat. It would be even better if sombody could tell me a way to push chars back on to the stdin stream that way I can completly avoid making a temporary file. Thanks, James (root@jestocost.cosc.morrisville.edu) ----- Original Message ----- From: "Koster, K.J." To: "'Charlie Root'" Cc: "'FreeBSD Hackers mailing list'" Sent: Wednesday, May 17, 2000 4:40 AM Subject: RE: smb printer trouble > 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 > > > > **** 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