ipprint

ipprint

This program loops around a queue and sends files to a printer/screen attached
to either a Spider port or a TTY.

If a TTY port is used, it may be configured using a file in
tables/stty/STTY_PRINTER_ttyx where x is the tty port name.

The parameters may be either specified as Input switches or as keyword options
in a parameter file - or both to confuse everybody.

There is no default parameter file but if one is specified, using the '-Z'
input switch, it should be in tables/print.

Note that normally the 'DF:' header field is ignored. If the '-F' input switch
is specified the DF will be looked for and used as the name of the parameter
file in tables/print. If it does not exist, the default is used; if there is no
default specified (with the '-Z' input switch), the normal default
'tables/print/FORMAT' is used.

Syntax for the parameter file are :
    ; comment
    header: FIP seq for the header of the file  default: none
    trailer: file trailer eg to force a page throw  default: none
    page:   page header within a file       default: none
        if this option is specified, the page number CRNL is added automatically.
    toppage: Used in place of the automatic CRNL after page number
                            default: CR NL
    eoln:   end-of-line sequence in place of CR, CR NL or NL.
                            default: CR NL
    nostrip: do not strip multiple CR/LF    default: strip multiple eolns
    width:  printer width               default: ignored
    depth:  printer page depth          default: ignored
    abstract: no of lines to print the abstract default: print all text
        An abstract of zero - abtract:0 - will print no text.
        In this case, only banner, page and trailer will be printed.
    ignore: ignore all text after this chr      default: print all text
        Use \032 to ignore the header of a Writer file
    wait:   wait in secs before printing the file   default: none
    endwait: wait in secs after printing the file   default: none
    disconnectwait: wait in secs before disconnecting   default: 3 secs
        from the remote host. This is on 3 for as many devices need a moment to drain
responses.
    endstring: wait for this string after printing the file.    default: none
        If this string exists, the endwait is used as a timeout if the string does
NOT return.
        The default endwait is 20 secs in this case.
        The string is case insensitive.
    speed: pace the file as though it is being printed at this speed.def: none
    offline: If Offline : wait in secs between attempts default: 60 secs
    nodelete: Do NOT delete the files once sent default: delete.
    wordwrap: wordwrap          default: do NOT wordwrap lines
    banner: print this banner in place of the normal one
        if Nothing is specified, no banner will be printed.
        ie 'banner:' on a line on its own.
            default: banner of name, category, date and time
    scan:   time between scans of directory     default: 5 secs
    network: Script to run on file after processing. In this case the file
        is processed as per width etc and then run as the
        last parameter to this script. Any TTY port or Terminal
        server is ignored.       default: TTY or spider
        eg to use a unix printer in /etc/printcap called Training :
            network:lpr -P Training
        The temp file created is NOT deleted by ipprint and so either
        the script should delete the file or some means of maintenance.
        This temp file is created in /fip/spool/printtmp.
    singleshot: run through the queue once and stop.    default: spool
        This is used when ipprint is called from a script to
        send all copy from a single queue.
    grab-first-file: Always process the first file in the queue first.
        This is for WinNT/2000 which sorts alphabetically/timewise.
    first:  Name of optional file in tables/print that is sent
        on startup and on each scan of the queue when a new file has
        been found.  The text of the file is in FipSeq. default:none
    last:   Name of optional file in tables/print that is sent when all the
        files in the queue have been sent and before we rescan the
        queue.  The text of the file is in FipSeq.  default:none
    binary: The files are already in the correct format so no page, wordwrap
        width, depth  and eoln is necessary     default: no
    alldata: Print all data - normally unprintable (for the Unixbox)
        chrs are stripped from the outbound data. default:printables
    pchr:   Precedent chr for modes.            default: none
    mode:   Mode Strings
        eg Select Univers 9 pt for HP Laserjet
        mode:0  \033(s4148t(s7v(s0p(s0S\033(s0B
    extras: Extra chrs which are not normally a-z or 0-9 or normal
        printable chrs. These are often accented chrs specific to a
        particular printer that are different from the UnixBox LOCALE
        (see man pages)              default: none
        Example if octals 221 and 342 are e acute and E acute for
        printer X : extras:\221\342
    escape: Printer Escape chr and length of escape seq (optional).
        This is used to ignore fixed length escape sequences in the
        text which play havoc with line lengths  default: none
        Example to ignore an ESC plus following chr:    escape:\033:1
    extra-fiphdr: (FipSeq)  extra FipHdr information to add to each transmission
                            default: none
    onefile: Send One file per go and then release the connection and wait
        before sending the next.  default: send all files in the queue.
    logfile: Log file name              default: none
        This should be the full path and filename of the the log file.
        The contents of the Log file are preserved and appended to.
    log-line: Fip Item Log entry        default: filename is logged only
    keep-connection: Normally if there is nothing to send, the connection
        to the output device is dropped (top allow another program to
        connect perhaps). This flag states that this copy of the program
        has full-use of the device - so keep the connection alive.
        keep-connection:    will leave the connection open
        keep-connection:no  will disconnect
        keep-connection:yes will leave the connection open
    keep-alive-timeout:(number of secs)
    keep-alive-token: (FipSeq string)
        If there is NO data after the katimeout, send out the token
        default is nothing
    balance-seqno:  Send the Sequence number to this Balance Group
        (see 'ipbalance') Use this to make sure the sequence number
        is always updated on any companion systems.
    balance-delete: Send a note for ipbalan/ipsvrd to delete the mirrored
        file on any remote server.
    pad-before: Send a number of padding chars before each file
    pad-chr: actual chr to send - default is SPACE.
    pad-count: Number of pad chrs to send if 'pad-before' has been specified
        default is pad-count:80
        maximum is 2048
    dump-data: This makes a copy in /fip/dump of all incoming raw data

    before: (fipseq)        (eoln)
            String to insert before the data (binary option only)
    after:  (fipseq)        (eoln)
            String to insert after the data (binary option only)
    filebefore: (filename)  (eoln)
            File of FipSeq to insert before the data (binary option only)
    fileafter:  (filename)  (eoln)
            File of FipSeq to insert after the data (binary option only)
    binary-filebefore: (filename)   (eoln)
            File to insert before the data (binary option only)
    binary-fileafter:  (filename)   (eoln)
            File to insert after the data (binary option only)
    lock-sleep: (millisecs)     default: 50
    lock-loops: (no of loops)   default: 20
            If an input big file (normally WINNT) is being copied over, use this to grab
the file quickly
    timing-stats: (yes/no)  Turn on/off timing statistics
    tracker-script: Optional script for tracking purposes (fullpath to script
name)
        default: none

Where sections of FipHdr fields are required or changes to the output style,
use keywords : fixed, partial, combie, optional, repeat, newdate and/or style.
(see The SysAdmin manual for more information).

    They are normally specified :
        fixed:QZ    1234543
        partial:QT  ST,3,2,U,<,>
        combie:QY   ep|na,(0000000)a
        option:QE   ep,11,7,s
        repeat:QK   XK,-,3
    or  repeat:QP   PK,,4,#X
        style:QS    XN,%.03d
        newdate:
        replace:

Input Parameters are :
    Mandatory parameters :
    -s : output device              default: none
        unless 'network' or script' parameters are stated.
either  -p : terminal server port number        default: none
or  -P : passive TCP port number            default: none
        for incoming calls
    -q : queue to scan for input            default: none
        This can be specified as a queue under /fip/spool or
        if it starts with a '/', the complete pathname. Note that in
        the second case, the queue MUST reside in the same partition
        as spool.
OR  -1 : name of file to send where we are sending a single file. def:none
        This can be specified as a queue under /fip/spool or
        if it starts with a '/', the complete pathname. Note that in
        the second case, the queue MUST reside in the same partition
        as spool. The input file is NOT deleted in this case.

Optional parameters :
    -a : abstract : no of lines to print        default: print all text
    -b : print this banner in place of the normal one
            default: banner of name, category, date and time
    -B : do not output a banner at all      default: as above
    -c : do not strip multiple CR/LF    default: strip multiple eolns
    -e : end-of-line sequence in place of CR, CR NL or NL.
                        default: print eoln as in text
    -f : page header within a file          default: none
    -F : Use the DF header field for all parameters. default: no
        This option ignores any formatting input parameters like -e,-h
    -h : file header                default: none
    -H : extra FipHdr information to add to each transmission
        eg -H '#RH:localhost#RP:9699'       default: none
    -i : ignore all text after this chr     default: print all text
        Use -i \032 to ignore the header of a Writer file
    -I : dump id - add a dump id to the dump file   default: no
        use this where multiple ipprint using the same parameter file are used.
    -k : keep the connection open           default: close after all files
        The default for -P passive port is to hold the connection open
        anyway until the REMOTE side wishes to disconnect.
        In this case to disconnect, use a parameter file with
            "keep-connection:no"
        or  "onefile:"
    -K : file should be sent binary         default: no
        This options ignores all formatting commands
        such as -h, -t, -f, -e, -w, -l etc
    -l : printer page depth             default: ignored
    -L : log each file as it is printed     default: no
    -N : log each network script as it is run   default: no
    -o : output queue for printed files     default: no
        Normally files are deleted after printing.
        unless the 'nodelete:' parameter has been selected.
    -r : wordrap                default: do NOT wordwrap lines
    -t : file trailer eg to force a page throw  default: none
    -w : printer width              default: ignored
    -W : max word size for wordwrap         default: 9
    -x : wait in secs before printing the file  default: none
    -X : If Offline : wait in secs between attempts default: 60 secs
    -z : time between scans of directory        default: 5 secs
    -Z : parameter file             default: none
    -v : print version no and exit

In all cases where not mentioned, text is printed with no modications unless
forced.

Parameters h, t, e, b and f can be any combination of fixed text, octal number
(\003), FIP hdr field (\XN or \SU) and unix escape format (\r). Pls remember to
enclose these with double quotes.

(copyright) 2017 and previous years FingerPost Ltd.