Signature Engine
sigeng [ -s ] [ -x ] [ -t template-file ] quote-file ...
Signature Engine is another signature randomizer with arbitrary output formatting capabilities.
Treat the quote-file as a collection of single-line quotes. The default is to have a fortune-like formatting (multi-line quotes separated by ``%%'' on an empty line.
Translate the quote to another language. Currently the translation used is hard-coded in the source and translates from Finnish to English but this may change in the future.
Note that actually the quote is just mangled through a web page, and the functionality could be used for other purposes than translation also.
Template file. See below for discussion of the format of the template file.
If the parameter is not given, default value of ~/.sig/template is used instead.
Quote files are the files containing all those snappy texts you want to share with the rest of the world. The files can either be formatted as a collection of single-line quotes (each line is a quote of its own) or as a fortune-like text file with double percentage signs on an empty line separating the quotes (see -s).
The template file is actually a Perl format (see perlform(1)). The following examples should cover the most common signature use.
John Doe - www.john.doe @* $quote
The string "@*" is a place-holder for the whole quote text.
John Doe - www.john.doe - @*
$date_iso8601
@*
$quote
The first "@*" is replaced with date and time, the second with the whole quote.
John Doe - john.doe@foo.bar - www.john.doe
"@"
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
$quote
The quote text begins at the first caret and fills the space allotted by the lesser-than signs. The double tilde indicates that the line formatting will be repeated as long as there is input. The at-sign in the e-mail address requires a dirty hack.
John Doe ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$quote
john.doe@foo.bar ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"@", $quote
www.john.doe ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$quote
~~ ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$quote
The quote text fills the space allotted for them, even on multiple rows. If the double tilde is removed, a four-line limit is imposed. Still better, if it is replaced with a single tilde, the last line will be removed if empty.
John Doe ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$quote
john.doe@foo.bar ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"@", $quote
www.john.doe/@jdoe ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"~", $quote
~ ^>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$quote
--------------------------------------------------------
^<<<<<<<<<<<<<<<<<<<
$date
The quote text fills the space allotted for them, even on multiple rows, the last line will be removed if empty. On the bottom there is a line of dashes and below that, date and time in the customary Finnish format. The tilde (~) in the url is a kludge.
John Doe @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$quote[0]
john.doe@foo.bar @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"@", $quote[1]
www.john.doe @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$quote[2]
~ @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$quote[3]
You can pick a specific line of the quote by using an array subscript.
John Doe @>>>>>>>>@@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$ENV{USER}, "@", $ENV{HOSTNAME}
Written: @|||||||||||||||||||||||||||||||||||||||||||||
scalar localtime
Uptime: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`uptime`
@*
$quote
You can easily access any perl code through the template. The quote is not even required, if you get away with other information!
^<<<<<<<<<<<<<<<<<<<<<<<<< ^>>>>>>>>>>>>>>>>>>>>>>>>> ~~ $quote_orig, $quote_xlated
Both fields are filled and wrapped automatically.
See TEMPLATE FILE FORMAT for template examples.
sigenv quote_file
Get template from ~/.sig/template, read the quote from quote_file (fortune format).
sigenv -s -t template quote_file1 quote_file2
Get template from file ``template'', read the quotes from either of the quote_filen (single-line format).
sigenv -x quote_file
Get the quote from quote_file, and translate it from Finnish to English.
fortune | sigenv
Read the quote from fortune output and use the default template file.
sigenv currently requires the perl modules LWP::UserAgent,
HTTP::Request::Common, HTTP::Date and HTML::Entities
to be installed.
Fortunately, they can be installed automatically by issuing the following commands as root:
perl -MCPAN -e shell install LWP::UserAgent install HTTP::Request::Common install HTTP::Date install HTML::Entities
Additional variables $date and $date_iso8601 for
easily adding date and time in either customary Finnish style or ISO 8601
format.
2000-03-07 Martti Rahkila
Support for simultaneous output in two languages. Use variables $quote (for default language),
$quote_orig (for original version) and
$quote_xlated (for translated version). Identical array
variables exist also.
Initial release.
Matti Airas mairas@iki.fi http://www.iki.fi/mairas/