IPSELECT filters messages for specific destinations according to criteria set
out in various parameter files.

These selections can be made on any combination of FIP header fields and/or
text strings in the data.

In order to make its selection, whole wire service feeds are sent to the select
input queue where this program receives them.

Only a single copy will be sent to a destination even though several criteria
lines may be met.

The selection criteria files are held in tables/select and have the format :

 1. Main file : tables/select/MAIN_SELECTION
    This file detects the source of the incoming message and gets the relevant
Selection file.

    Syntax :
    ; comment
    source: (SU) (tab) file: (selection file) [opt (tab) ; comment ] (nl)
    source:RNS  file:RNS_BIGCUSTOMER    ; single complicated client
    source:RNS  file:RNS_SMALLNO2   ; single simple client
    source:XTA  file:XTA_EVERYONE   ; all clients for a single src

    extra-fiphdr: (extra FipHdr info to add to each output file)
        Note there is an internal FipHdr field (Z9) which has the filename in for
tracking purposes.
        ; add Z9 field at the end of the HK fiphdr.
        eg extra-fiphdr:HK:\HK (\Z9)

 2. Selection Files : (also in /tables/select)

    There can be either :
        one selection file for all selections/all sources
        or a selection file per source
        or a selection file per client
        or a selection file per client per source
        or a mixture of these depending on the size and complexity of
            all the selections.

   The format of the selection file is :
    ; comment
    (hdr field) = string [opt (tab) & (hdr) = string ...] (tab) >dest (nl)
    (hdr field) = string [opt (tab) | (hdr) = string ...] (tab) >dest (nl)
    Each selection is on a single line. If necessary, multiple conditions
    can be specified with the '&' to AND them or '|' to OR them.
    The operation equal, '=', can also be NOT equal '!='.
    Source Header fields (in SH) are preceeded by X, ie XC for category.
    A '*' is used a wild card string; a '?' is single wild card chr. To
    search for a string/chr embedded somewhere in a field, uses a '*' before
    and after.
    If embedded spaces are needed in the string-to-be-searched, use an '*'.
    Note that the search string is case_insensitive.
    Dest must be a valid destination in the tables/sys/USERS file.
    Both the selection file and the main file are scanned completely, so
    that one file may be sent to none, one or several destinations
    according to the same or different criteriae.
    ; Sports copy to Tranmere Rovers FC.
    XC=S*   &   XK=*Football*   >tranmere
    EP=TAR.             >tarmac
    RD=*Broken_Hill*        >bhp
    $$=*Cariba* | $$=*Kataga*   >fubble

    For Free text search - use '$$' as the pseudo header string.  No embedded
spaces are allowed for free text. Note that this version will only scan the
first 64k of text.

The maximun number of new destinations from a single input file is 100.
Duplicate files are NOT sent to a single destination from a single file - so if
it matches any number of times, only one copy is sent.

Input parameters are (all optional) :
    -t : scan time for directory            default: 5 secs
    -i/-q : queue to scan               default: spool/select
    -o : output queue               default: spool/2go
    -O : output queue for delayed items     default: spool/delay
    -D : done queue for storing input files     default: deleted
    -l : do NOT log every incoming file     default: log each found item
    -m : main selection file in tables/select   default: MAIN_SELECTION
    -d : delay selection file in tables/select  default: none
    -n : nice number there              default: reduce by 5
    -S : send ALL copies                default: send once
        Normally only one copy is sent per destination; use this to
        send as many times as there are selections
    -v : display version number and exit.

Version Control
;008j1  17jul98 added -o/-O and logging by default..
    .. first go at WINNT
    .. maximum number of destinations is now 100
    ;a 29jul98 zap FipHdr fields to zap XZ etc
    ;b 13dec02 added -D done queue
    ;c-d 23jan03 bugette in search only 2 items checked
    ;e-f 11aug03 bug -m not working - does now
    ;g 04sep03 added extraFipHdr and widgets
    ;h-i 24sep04 speedy
    ;j1 16aug06 added timing-stats

(copyright) 2017 and previous years FingerPost Ltd.