The Quoteriser, Version 2.01

Random Signature Generator

Contents:

  1. Introduction
  2. Installation
  3. Using sig.exe
    1. With NewsReader/2
    2. With Pine
    3. With Ultimail
    4. With other applications
    5. As a quote-of-the-day
  4. Introduction

    The Quoteriser's random signature generator is a powerful utility for inserting random quotes into e-mail and Usenet signatures, or, indeed, any other (plain text) file the user cares to use it for.

    (It can also be used as a text-based quote-of-the-day facility - though the PM-based qotd.exe program looks a lot better, and Unix fortune has been ported to OS/2 and is probably easier to use for this purpose.)

    The program is a command-line utility that works by taking a template file as input that describes the layout of the signature, inserting random quotes where specified and writing the output to a file.


    Installation

    After unzipping the quot201x.zip package (or compiling the source in the quot201s.zip package, for do-it-yourselfers), the sig.exe application will be present in the 'bin' sub-directory. This is the file the user will need to run to generate random signatures. As it uses the Quoteriser DLLs (quoter1.dll and quoterdb.dll), either it must be run in this directory or the Quoteriser DLLs must be in a directory on the system LIBPATH statement in CONFIG.SYS.

    To set the databases used for choosing random quotes, set the QUOTER_QDB and QUOTER_ADB environment variables. The former must be set as the name of the quote database - without extension - from which to choose random quotes. The QUOTER_ADB variable is optional; if not set, no authors will be associated with the quotes. Otherwise, it should be name of the author database - again, without extension - from which to draw author information. These variables can be set in the system's CONFIG.SYS or in a batch file that runs sig.exe with something like the following:

    SET QUOTER_QDB=D:\APPS\QUOTERISER\DATA\CYNICISM
    SET QUOTER_ADB=D:\APPS\QUOTERISER\DATA\STANDARD
    

    This will choose quotes from a database called 'cynicism' in the D:\APPS\QUOTERISER\DATA directory, and get author information from a database called 'standard' in the same directory. As usual, any changes made CONFIG.SYS will require a re-boot to take effect.

    Next, the reader will probably want to create at least one template file. See the template file section below for details on how template files are formatted.

    Finally, the reader may want to automate the running of sig.exe. There are a variety of ways in which this could be done. E.g. the reader could put it into a batch file to run every time his or her e-mail program runs, or put it in STARTUP.CMD to choose a new signature at every boot, or use a scheduling application to choose a new signature every five minutes (say). There are some examples in the Using sig.exe section below.


    Using sig.exe

    The command-line format for sig.exe is:

    sig [options] <template> [<signature>]

    where <template> is the name of the (input) template file, and <signature> is the name of the (output) signature file. If the <signature> argument is omitted, the result will be printed to standard output (i.e. on the screen, or to a pipe or re-director if present on the command line).

    Valid options are:

    -?
    Display a quick help screen
    -a
    Do not print the name of the author of the inserted quotes
    -s
    Do not print the source of the inserted quotes
    --
    There are no more options on the command line (use this if the template file starts with a hyphen).

    (The / character can also be used for specifying options - /a, /s, and so on - but this is not recommended as this may disappear in a future version of the program).

    See the template file section below for details on how to create template files.

    The following sections give some instructions for how to use sig.exe with various OS/2 applications, and some examples of using sig.exe in different ways. Unless otherwise noted, the template file is assumed to have the name C:\ETC\TEMPLATE.TXT - of course, it can be any valid file. The Quoteriser is assumed to be installed in C:\APPS\QUOTER, with quote database 'QUOTES' and author database 'AUTHORS' in the C:\APPS\QUOTER\DATA directory. The examples are not intended to be blindly copied, only to give an idea of what can be done.

    Using sig.exe with NewsReader/2

    NewsReader/2 stores its signature in a different place depending on how its connected to the news server. If it's connected via a LAN, it stores them in the <etc>\sig directory, where <etc> is the value of the ETC environment variable. If the connection is via a PPP connection, they are in <etc>\rnspool\<isp>\sig, where <isp> is the name of the connection. There are three signature files:

    MAIL.SIG
    Used on out-going e-mail if 'Use two .sig files' is set in the signature configuration.
    NEWS.SIG
    Used on both e-mail and Usenet articles if 'Use one .sig file' is set in the signature configuration.
    POST.SIG
    Used on Usenet articles if 'Use two .sig files' is set in the signature configuration.

    Therefore, use something like sig c:\etc\template.txt *.sig to generate random NewsReader/2 signatures, where * is one of MAIL, NEWS or POST, as required.

    Example: Suppose the ETC variable is 'C:\ETC', we want to generate new random signatures every time NewsReader/2 is started, and we're one of these extravagant two-signature types. The environment variables have not been set in CONFIG.SYS.

    Create a batch file, nr2.cmd, say, in the C:\TCPIP\BIN directory (or wherever NewsReader/2 is), with the following:

    @ECHO OFF
    SET QUOTER_QDB=C:\APPS\QUOTER\DATA\QUOTES
    SET QUOTER_ADB=C:\APPS\QUOTER\DATA\AUTHORS
    CD \APPS\QUOTER\BIN
    SIG C:\ETC\TEMPLATE1.TXT C:\ETC\SIG\MAIL.SIG
    SIG C:\ETC\TEMPLATE2.TXT C:\ETC\SIG\POST.SIG
    CD \TCPIP\BIN
    NR2 %1
    
    Then replace NR2.EXE in the NewsReader/2 desktop object properties with NR2.CMD.

    Using sig.exe with Pine

    Pine allows the user to define the name of his or her signature file either by entering configuration from the main screen, or by editing the signature-file field in pinerc. If our our signature file is C:\TCPIP\PINE\SIG.TXT, for example, we can use sig c:\etc\template.txt c:\tcpip\pine\sig.txt to generate a random signature.

    Example: Suppose we want to generate a new signature every five minutes, using our favourite scheduling program. The environment variables have been set in CONFIG.SYS. This author can't tell the reader how to use his or favourite scheduling program, of course, and assumes the reader knows how to get it to run a program every five minutes. Create a batch file, c:\tcpip\bin\newsig.cmd, say, containing the following:

    CD \APPS\QUOTER\BIN
    SIG C:\ETC\TEMPLATE.TXT C:\TCPIP\PINE\SIG.TXT
    

    Then put newsig.cmd into the scheduling program.

    Using sig.exe with Ultimail

    Err... don't know. Ultimail appears to store its signature in the <etc>\TCPOS2.INI file, where <etc> is the contents of the ETC environment variable. The CR/LF pairs seem to have been replaced with ASCII characters 1 (smiley faces). Don't be fooled by the \TCPIP\UMAIL\UMAIL.PRO file - it looks like a nice, text-based configuration file, but Ultimail appears to create this every time it starts it from what is in TCPOS2.INI (no, the author doesn't understand, either).

    As OS/2 .INI files are binary files, no amount of processing through sed, pipes and what-have-you, will be able to sort it out; some programming skill is necessary. As the author doesn't use Ultimail, he isn't inclined to spend a lot of time trying to figure it out. Read the .INI file section in the other applications section and have a go.

    Using sig.exe with other applications

    For other applications, the reader is on his or her own. The simplest case is for applications like Pine and NewsReader/2, where the signature is just a text file somewhere; quite a few applications use this method. In this case, once the signature file has been identified, it should be easy to set up sig.exe to write its output to this file.

    Some applications might store the signature in a text-based file with some other things (like a Windows .INI); in this case, some clever use of pipes, re-direction and possibly REXX should suffice.

    Some applications (like Ultimail) store the signature in an .INI file. This requires some programming skill. Use IniMaint or something to examine the .INI file and determine the application name and key for the signature. Then write a program to put the output from sig.exe into the .INI file. In C, something along the lines of the following fragment:

    hini = PrfOpenProfile(hab, "PROFILE.INI");            // or whatever the .INI is called
    pszString = strfromf(stdin);                          // strfromf() is from quoter1.dll
    PrfWriteProfileString(hini, "App", "Key", pszString); // or whatever IniMaint found
    free(pszString);
    

    ... then pipe the output from sig.exe c:\etc\template.txt into this program.

    Similarly, in REXX:

    /* don't forget the comment at the top */
    call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni'
    sig = ''
    do while lines()
      sig = sig || linein() || x2c('0d 0a')
    end
    SysIni('PROFILE.INI', 'App', 'Key', sig)
    

    ... and pipe the output from sig.exe c:\etc\template.txt into it, as before.

    Finally, some applications might keep the signature in a binary file of their own format (though the author has never seen such a thing, and there's no need with the Prf...() API). This requires real tenacity - the reader will have to decode the binary file and write a program to insert the signature.

    If the reader has developed a solution for any applications not listed here - even if it's just the name of the file to overwrite - or knows the solution to Ultimail, he or she is more than welcome to submit the solution to the author at nps@zeta.org.au. For the reader's effort, he or she will receive a mention in the credits and the usual warm, fuzzy feeling that he or she gets from helping the world out.

    Using sig.exe as a quote-of-the-day

    In case the reader didn't read the introduction, the author will repeat here that

    1. The Quoteriser's PM-based Quote-of-the-day looks a lot better than the output from sig.exe.
    2. The 'fortune' program from Unix systems has been ported to OS/2, is easier to use and probably looks better.
    Still, maybe the reader managed to compile sig.exe for a non-OS/2 system, doesn't like the quotes in 'fortune', doesn't want to download 1.3 Mb worth of 'fortune' or something.

    Create a template file that just prints a quote across the whole screen, e.g.

    <tr>
    <quote colspan=79>
    

    Then running sig c:\etc\template.txt will show a quote of the day. If sig.exe is in the path, and quoter1.dll and quoterdb.dll are in the LIBPATH, it won't even be necessary to change to the Quoteriser directory before running.


    Template Files

    The format for template files is based on HTML tables, taking some liberty with the meaning of tag attributes. The control elements are:
    <tr> Start a new row
    <td colspan=n> Put the following block of text into a cell n characters wide.
    <quote colspan=n> Insert a random quote, typeset into a cell n characters wide.

    No other HTML tags are supported; text inside <td> is treated as if it were in a <pre> tag. Only <br> and <p> tags are interpreted in the quote; others are ignored.

    Each row will have enough lines in it to accomodate the longest of the cells in it, and be of a width equal to the sum of the colspan attributes of the <td> and <quote> items in that row. There is no limit to the number of rows, or the width of each row (though one supposes that the reader will eventually run our of disk space and/or memory). There is a limit of eighty cells per row, however.

    There can be as many random quotes in the signature as the user wishes; each quote will be chosen separately (but there is no safeguard against choosing the same one twice, which looks a bit silly).

    E.g. at the time this document was written, the author's template file was

    <tr>
    <td colspan=40>-- Location: Sydney, Australia        |
     / Email: nps@zeta.org.au             |
    /  WWW: http://www.zeta.org.au/~nps   |
    -- ----> Cynicism & Negativity        |
    <quote colspan=39>
    

    which will produce an output something like

    -- Location: Sydney, Australia        | HAMLET: To be or not to be: that is
     / E-mail: nps@zeta.org.au            | the question
    /  WWW: http://www.zeta.org.au/~nps   |
    -- ----> Cynicism & Negativity        | - William Shakespeare, Hamlet
    

    Maybe the reader prefers to the quote to be appended to his or her details. In this case, he or she might try something like:

    <tr>
    <td colspan=79>James Hacker (jhacker@yoyodyne.com) - author of Gnomovision
    Make a pass at your compiler today! - http://www.yoyodyne.com/gnomovision
    
    <tr>
    <quote colspan=79>
    
    which will give an output something like
    James Hacker (jhacker@yoyodyne.com) - author of Gnomovision
    Make a pass at your compiler today! - http://www.yoyodyne.com/gnomovision
    
    Ask not what your country can do for you, but what you can do for your
    country.
    
    - John F. Kennedy
    

    We could put our quote inside a box:

    <tr>
    <td colspan=79>+-----------------------------------------------------------------------------+
    <tr>
    <td colspan=2>|
    |
    |
    |
    <quote colspan=75>
    <td colspan=2>|
    |
    |
    |
    <tr>
    <td colspan=79>+-----------------------------------------------------------------------------+
    

    (Making sure that the two side cells are high enough to make the box join up for any quote in our database). The output will be something like:

    +-----------------------------------------------------------------------------+
    | Well may we sing 'God Save the Queen', because nothing will save the        |
    | Governor-General.                                                           |
    |                                                                             |
    | - Gough Whitlam                                                             |
    +-----------------------------------------------------------------------------+
    

    We can increase our wit/wisdom-per-mail rate by having two (or more) random quotes:

    <tr>
    <td colspan=11>He said:
    <quote colspan=68>
    <tr>
    <td colspan=11>So I said:
    <quote colspan=68>
    
    Which gives us (using -a -s to keep it brief):
    He said:   I have nothing to declare but my genius.
    So I said: And therefore never send to know for whom the bell tolls; It tolls
               for thee.