(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



Printing to Windows Printers

March 1999



I've had several people write to me not understanding that they need to PASTE THE CODE FROM THIS ARTICLE into "/usr/spool/lp/model/visionp"

NOTE: The 3.1 version of Visionfs ( latest version is always available from Sco's Vision Site) has a new method for installing printers. You can still use the method shown here, but the following command adds a new Unix printer called "winprint" and prints to a Windows share called "HP5" on the machine "Win98_17":


/usr/vision/bin/visionfs print --install winprint Win98_17 HP5

 
THIS ONLY WORKS BEGINNING WITH VERSION 3.1

You may still want to use this article (or J.P. Radley's version for the purpose of having more direct control. -Tony

Copyright © 1999 UniTech Informatica Ltda

Publishing Here

This is a little contribution to the sco users community. With this script, is possible send print jobs to printers attached to Windows, via lp(C) command using SCO VisionFS.

The script, by default, converts CR to CR+LF to avoid overprinting but, with the -oraw option this feature can be disabled.

I have many clients using this resource with success.

Instructions for installation and configuration are in the beginning of script.

Jose Fernando Scheid Mascarenhas
UniTech Informatica Ltda

==========================================================================>>>
CUT HERE
:
#       @(#) VisionFSp 1.1 99/01/26 
#
#       Copyright (C) 1999 UniTech Informatica Ltda
#                          Jose Fernando Scheid Mascarenhas
#                          SCO Premier Reseller - Brasil
#                          Todos direitos reservados.
#
#       The information in this file is provided for the exclusive use of
#       the licensees of The Santa Cruz Operation, Inc.  Such users have the
#       right to use, modify, and incorporate this code into other products
#       for purposes authorized by the license agreement provided they include
#       this notice and the associated copyright notice with any such product.
#       The information in this file is provided "AS IS" without warranty.
#
#!      VisionFS Printers
#
#       Options: lp -oraw  file-name ...  Send without CR to CR+LF convertion
#
#       This script will redirect the print job to the shared printer
#       specified in the Description field of mkdev lp.
#
#       Ex.:
#
#       mkdev lp
#       
#       Printer ---> Add Local
#       Name: winptr
#       Description:  SHARE=//winstation1/epson
#       Model: visionp
#       Device: /dev/null
#
#       ATTENTION: Change the permission of vfscinfo and vfsprint.
#
#       cd /usr/vision/visionfs/bin/i3sc0325
#       chown root vfscinfo vfsprint
#       chmod u+s vfscinfo vfsprint
#


       

###########
## Check arguments
###########

parse () {
        echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
}


#Set up some global variables.
: ${SPOOLDIR:=/usr/spool/lp}
: ${LOCALPATH:=${SPOOLDIR}/bin}
: ${COMMENT:=${SPOOLDIR}/admins/lp/printers}

#Set up printer share name in comment file

PNAME=`basename $0`
PDEST=`lpstat -p${PNAME} -l | grep "Description"`
PDEST=`expr "${PDEST}" : '.*=\(.*\)'`

#Set up VisionFS location
if [ -x "/usr/vision/bin/visionfs" ]
   then
   VISIONFS="/usr/vision/bin/visionfs"
else
  if [ -x "/usr/local/vision/bin/visionfs" ]
     then
     VISIONFS="/usr/local/vision/bin/visionfs"
  else
     VISIONFS="visionfs"
  fi
fi


#Set up the default filter.
if [  -x "${LOCALPATH}/lp.cat" ]
then
        LPCAT="${LOCALPATH}/lp.cat 0"
else
        LPCAT="cat"
fi

#If we are not using a filter, use the default one.
if [ -z "${FILTER}" ]
then
        FILTER="${LPCAT}"
fi

if [ -x "${LOCALPATH}/drain.output" ]
then
        DRAIN="${LOCALPATH}/drain.output 1"
else
        DRAIN=
fi

printer=`basename $0`
request=$1
name=$2
title=$3
copies=$4
options=$5
shift; shift; shift; shift; shift

# border around the banner
x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

banner=no
raw=no

if [ -z "${BANNERS}" ]
then
        nhead=1
else
        nhead=${BANNERS}
fi

for i in $options; do
        case $i in
        b|nobanner)     banner=no
                        ;;

        r|raw)          raw=yes
                        ;;

        esac
done


[ "$banner" = yes ] && {
        # get the local system id
        if test -r /etc/systemid; then
                sysid=`sed 1q /etc/systemid`
        else
                sysid=`uname -n`
        fi

        # user = fifth field of /etc/passwd
        user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`

        # nhead gets the value of BANNERS or 1 by default
#       nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
#       [ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1

        # print the banner $nhead times
        while   [ "$nhead" -gt 0 ]
        do
                echo "$x\n"
                banner "$name"
                echo "$x\n"
                [ "$user" ] && echo "User: $user\n"
                echo "Request id: $request\n"
                echo "Printer: $printer\n"
                date
                echo "\nMachine: $sysid\n"
                [ "$title" ] && banner $title
                echo "\f\c"
                nhead=`expr $nhead - 1`
        done
}

# send the file(s) to the standard out $copies times
while   [ "$copies" -gt 0 ]
do
   for file
   do
    if [ "${raw}" = "yes" ]
       then
       $VISIONFS print $PDEST ${file}
    else
       awk -e '{printf("%s\r\n",$0);}' < $file | $VISIONFS print $PDEST -
    fi
   done
   copies=`expr $copies - 1`
done

exit 0
==========================================================================>>>
CUT HERE
 

Note: this script needs to be installed as /usr/spool/lp/model/visionp before you can use it. To do this, cut and paste the lines betwwen the "=======>>" lines into that file name (it won't currently exist; you need to create it).





See also /Unixart/jprdiff.html for an HPLaserJet version of this.




More Articles by UniTech Informatica Ltda




Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



/Unixart/visprint.html copyright March 1999 UniTech Informatica Ltda All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server






More:
       - Microsoft
       - Printing
       - OSR5


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress