signify/0000755010210200017510000000000010046154256013122 5ustar bcwhitehome00000000000000signify/CVS/0000755010210200017510000000000010034772204013551 5ustar bcwhitehome00000000000000signify/CVS/Entries0000644010210200017510000000044110034772204015104 0ustar bcwhitehome00000000000000/COPYING/1.1.1.1/Mon Apr 14 22:26:36 2003// /README/1.1.1.1/Mon Apr 14 22:26:35 2003// /signify.1/1.1.1.1/Mon Apr 14 22:26:36 2003// D/debian//// D/examples//// /Makefile/1.2/Sun Jan 18 04:52:20 2004// /signify.pl/1.3/Wed Apr 7 12:04:44 2004// /signify.lsm/1.2/Wed Apr 7 12:30:24 2004// signify/CVS/Repository0000644010210200017510000000001007646632772015666 0ustar bcwhitehome00000000000000signify signify/CVS/Root0000644010210200017510000000006207646632772014441 0ustar bcwhitehome00000000000000:ext:cvs.signify.sourceforge.net:/cvsroot/signify signify/debian/0000755010210200017510000000000010046154256014344 5ustar bcwhitehome00000000000000signify/debian/CVS/0000755010210200017510000000000010034771241014773 5ustar bcwhitehome00000000000000signify/debian/CVS/Repository0000644010210200017510000000001707646632773017120 0ustar bcwhitehome00000000000000signify/debian signify/debian/CVS/Entries0000644010210200017510000000024510034771241016330 0ustar bcwhitehome00000000000000/README/1.1.1.1/Mon Apr 14 22:26:36 2003// /rules/1.2/Sun Jan 18 04:56:26 2004// /changelog/1.3/Wed Apr 7 12:07:30 2004// /control/1.2/Wed Apr 7 12:20:21 2004// D signify/debian/CVS/Root0000644010210200017510000000006207646632773015664 0ustar bcwhitehome00000000000000:ext:cvs.signify.sourceforge.net:/cvsroot/signify signify/debian/changelog0000644010210200017510000000765210046154050016220 0ustar bcwhitehome00000000000000signify (1.14-1) unstable; urgency=low * improved handling of existing signify process -- Brian White Wed, 5 May 2004 08:03:51 -0400 signify (1.13-1) unstable; urgency=low * fix spurious "." occurring on stderr (closes: #242359) -- Brian White Wed, 7 Apr 2004 08:07:27 -0400 signify (1.12-1) unstable; urgency=low * make NMU fixes official (closes: #190526, #211555) -- Brian White Sun, 23 Feb 2003 12:42:07 -0500 signify (1.11-1.2) unstable; urgency=low * NMU. * Added support for UTF-8 (Closes: #211555) * Dropped csh requirement by using "which" from debianutils. -- Erich Schubert Sat, 27 Sep 2003 22:38:08 +0200 signify (1.11-1) unstable; urgency=low * don't remove fifo upon exit (may be in use across multiple machines) -- Brian White Sun, 23 Feb 2003 12:42:07 -0500 signify (1.10-1) unstable; urgency=low * remove fifo and lockfile upon exit (closes: #96754) * use perl's Sys::Hostname to get host name (closes: #164045) -- Brian White Mon, 4 Nov 2002 23:24:02 -0500 signify (1.09-1) unstable; urgency=low * Added "BLANK" internal variable for creating empty lines -- Brian White Wed, 23 Jan 2002 08:15:21 -0500 signify (1.08-2) unstable; urgency=low * Get HOME directory from password file if not available in env (closes: 96570) * Added documentation about separating options with commas (closes: 90209) -- Brian White Thu, 9 Aug 2001 23:15:50 -0400 signify (1.07-2) unstable; urgency=low * Added documentation about separating options with commas (closes: 90209) -- Brian White Sun, 22 Apr 2001 11:48:00 -0400 signify (1.07-1) unstable; urgency=low * Update standards-version (closes: 81479) * Fixed MakeFifo to support ~ at start of fifo name * Fixed fifo lockfile to handle simultaneous logins and multiple machines -- Brian White Sat, 13 Jan 2001 22:54:30 -0500 signify (1.06-1) unstable; urgency=low * Made $$ return a single dollar sign * Added 'include' funection * Updated perl dependency -- Brian White Tue, 27 Jul 1999 10:04:41 -0400 signify (1.05-1) unstable; urgency=low * Added ability to process perl code fragments in-line. -- Brian White Sun, 17 Jan 1999 23:15:59 -0500 signify (1.04-1) unstable; urgency=low * Now ignores SIGPIPE -- Brian White Sat, 28 Feb 1998 00:29:22 -0500 signify (1.03-2) unstable; urgency=low * Added changelog.Debian file (Bug#16266) * Compressed examples -- Brian White Wed, 7 Jan 1998 15:27:19 -0500 signify (1.03-1) unstable; urgency=low * New 'exec' section option for inserting the output of programs * Support --debug command-line option * (above added by Dennis Clark ) * Don't strip trailing space from "--" line (#13041,#13042) * Added binary-indep and binary-arch targets (#13525) -- Brian White Sat, 11 Oct 1997 17:01:10 -0400 signify (1.02-3) frozen unstable; urgency=low * Fixed typo in package description -- Brian White Wed, 9 Apr 1997 14:35:05 -0400 signify (1.02-2) frozen unstable; urgency=low * Forgot to change internal version number (oops!) -- Brian White Wed, 9 Apr 1997 14:17:08 -0400 signify (1.02-1) unstable; urgency=LOW * Strip trailing spaces from generated lines -- Brian White Sun, 2 Mar 1997 23:06:58 -0500 signify (1.01-1) unstable; urgency=LOW * Fixed install rule for less intelligent systems -- Brian White Web, 9 Oct 1996 23:26:22 +0400 signify (1.00-1) unstable; urgency=LOW * First release -- Brian White Mon, 26 Aug 1996 23:26:22 +0400 Local variables: mode: debian-changelog End: signify/debian/README0000644010210200017510000000020107646632634015232 0ustar bcwhitehome00000000000000This is the Debian GNU/Linux prepackaged version of Signify This package was put together by Brian White . signify/debian/changelog.orig0000644010210200017510000000630607646632635017200 0ustar bcwhitehome00000000000000signify (1.11-1) unstable; urgency=low * don't remove fifo upon exit (may be in use across multiple machines) -- Brian White Sun, 23 Feb 2003 12:42:07 -0500 signify (1.10-1) unstable; urgency=low * remove fifo and lockfile upon exit (closes: #96754) * use perl's Sys::Hostname to get host name (closes: #164045) -- Brian White Mon, 4 Nov 2002 23:24:02 -0500 signify (1.09-1) unstable; urgency=low * Added "BLANK" internal variable for creating empty lines -- Brian White Wed, 23 Jan 2002 08:15:21 -0500 signify (1.08-2) unstable; urgency=low * Get HOME directory from password file if not available in env (closes: 96570) * Added documentation about separating options with commas (closes: 90209) -- Brian White Thu, 9 Aug 2001 23:15:50 -0400 signify (1.07-2) unstable; urgency=low * Added documentation about separating options with commas (closes: 90209) -- Brian White Sun, 22 Apr 2001 11:48:00 -0400 signify (1.07-1) unstable; urgency=low * Update standards-version (closes: 81479) * Fixed MakeFifo to support ~ at start of fifo name * Fixed fifo lockfile to handle simultaneous logins and multiple machines -- Brian White Sat, 13 Jan 2001 22:54:30 -0500 signify (1.06-1) unstable; urgency=low * Made $$ return a single dollar sign * Added 'include' funection * Updated perl dependency -- Brian White Tue, 27 Jul 1999 10:04:41 -0400 signify (1.05-1) unstable; urgency=low * Added ability to process perl code fragments in-line. -- Brian White Sun, 17 Jan 1999 23:15:59 -0500 signify (1.04-1) unstable; urgency=low * Now ignores SIGPIPE -- Brian White Sat, 28 Feb 1998 00:29:22 -0500 signify (1.03-2) unstable; urgency=low * Added changelog.Debian file (Bug#16266) * Compressed examples -- Brian White Wed, 7 Jan 1998 15:27:19 -0500 signify (1.03-1) unstable; urgency=low * New 'exec' section option for inserting the output of programs * Support --debug command-line option * (above added by Dennis Clark ) * Don't strip trailing space from "--" line (#13041,#13042) * Added binary-indep and binary-arch targets (#13525) -- Brian White Sat, 11 Oct 1997 17:01:10 -0400 signify (1.02-3) frozen unstable; urgency=low * Fixed typo in package description -- Brian White Wed, 9 Apr 1997 14:35:05 -0400 signify (1.02-2) frozen unstable; urgency=low * Forgot to change internal version number (oops!) -- Brian White Wed, 9 Apr 1997 14:17:08 -0400 signify (1.02-1) unstable; urgency=LOW * Strip trailing spaces from generated lines -- Brian White Sun, 2 Mar 1997 23:06:58 -0500 signify (1.01-1) unstable; urgency=LOW * Fixed install rule for less intelligent systems -- Brian White Web, 9 Oct 1996 23:26:22 +0400 signify (1.00-1) unstable; urgency=LOW * First release -- Brian White Mon, 26 Aug 1996 23:26:22 +0400 Local variables: mode: debian-changelog End: signify/debian/control0000644010210200017510000000132110034771005015736 0ustar bcwhitehome00000000000000Source: signify Section: mail Priority: optional Maintainer: Brian White Standards-Version: 3.6.1 Package: signify Depends: perl5 Architecture: all Description: Automatic, semi-random ".signature" rotator/generator Signify is a neat little program that allows a random signature to be generated from a set of rules. Each "section" can be one of an unlimited number of possibilities, each with its own weighting so those really cool quotes can appear more often than others. Sections can also be placed next to each other vertically to create columns. Each section can be formatted independently as left/right/center and top/bottom/vcenter. See http://signify.sf.net/ for more information. signify/debian/rules0000755010210200017510000000326310002410772015416 0ustar bcwhitehome00000000000000#! /usr/bin/make -f # # Debian rules for building "signify" package package := signify default: @echo "What to do?" @echo " - binary or source" @echo " " build: $(checkdir) touch stamp-build clean: $(checkdir) -rm -f stamp-build -rm -f debian/files -rm -rf debian/tmp find . \( -name "#*" -o -name "*~" \) -print | xargs rm -f make clean binary: binary-arch binary-indep binary-arch: build binary-indep: build -rm -rf debian/tmp mkdir -p debian/tmp debian/tmp/DEBIAN debian/tmp/usr/share/doc/$(package)/examples # cp debian/conffiles debian/tmp/DEBIAN/conffiles make install PREFIX=debian/tmp/usr MANDIR=debian/tmp/usr/share/man cp README debian/tmp/usr/share/doc/$(package)/README cp debian/README debian/tmp/usr/share/doc/$(package)/copyright cp debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian cat COPYING >>debian/tmp/usr/share/doc/$(package)/copyright cp -a examples/* debian/tmp/usr/share/doc/$(package)/examples find debian/tmp/ -name CVS | xargs -r rm -rf cd debian/tmp/usr/share/doc/$(package); gzip -9fv README changelog.Debian examples/* cd debian/tmp/usr/share/man; gzip -9fv */* chown -R root.root debian/tmp chmod -R go=rX debian/tmp dpkg-gencontrol -is -ip dpkg --build debian/tmp dpkg-name -o -s .. debian/tmp.deb define checkdir test -e $(package).pl endef dist: source binary @echo " " ls -l ../$(package)*_$(version)-$(debian)* @echo " " source: clean chmod +x debian/rules cd .. && \ tar cfh $(package)_$(version)-$(debian).tar $(package)-$(version) && \ gzip -9vf $(package)_$(version)-$(debian).tar checkroot: $(checkdir) test root = "`whoami`" .PHONY: binary source diff clean clean checkroot distfiles signify/debian/changelog.rej0000644010210200017510000000062610002410364016764 0ustar bcwhitehome00000000000000*************** *** 1,3 **** signify (1.11-1.1) unstable; urgency=low * NMU. --- 1,11 ---- + signify (1.11-1.2) unstable; urgency=low + + * NMU. + * Added support for UTF-8 (Closes: #211555) + * Dropped csh requirement by using "which" from debianutils. + + -- Erich Schubert Sat, 27 Sep 2003 22:38:08 +0200 + signify (1.11-1.1) unstable; urgency=low * NMU. signify/debian/control.rej0000644010210200017510000000053310002410404016505 0ustar bcwhitehome00000000000000*************** *** 2,8 **** Section: mail Priority: optional Maintainer: Brian White - Build-Depends-Indep: csh | c-shell Standards-Version: 3.1.1.1 Package: signify --- 2,7 ---- Section: mail Priority: optional Maintainer: Brian White Standards-Version: 3.1.1.1 Package: signify signify/examples/0000755010210200017510000000000007646632773014761 5ustar bcwhitehome00000000000000signify/examples/CVS/0000755010210200017510000000000007646632773015414 5ustar bcwhitehome00000000000000signify/examples/CVS/Repository0000644010210200017510000000002107646632773017507 0ustar bcwhitehome00000000000000signify/examples signify/examples/CVS/Entries0000644010210200017510000000027307646632773016752 0ustar bcwhitehome00000000000000/Columned/1.1.1.1/Mon Apr 14 22:26:37 2003// /Complex/1.1.1.1/Mon Apr 14 22:26:37 2003// /Simple/1.1.1.1/Mon Apr 14 22:26:37 2003// /SimpleOrColumned/1.1.1.1/Mon Apr 14 22:26:37 2003// D signify/examples/CVS/Root0000644010210200017510000000006207646632773016260 0ustar bcwhitehome00000000000000:ext:cvs.signify.sourceforge.net:/cvsroot/signify signify/examples/SimpleOrColumned0000644010210200017510000000615507646632635020131 0ustar bcwhitehome00000000000000############################################################################### # # Cool signatures for Signify (will choose either 'simple' or 'columned') # ############################################################################### % $name=My Name % $email=myid@mycompany.com ############################################################################### # # Here starts the simple version # % { left # # Sign my name. I want these centered, so they must be in a section. # Note that the two "blank" lines actually have a single space. Empty # lines are ignored by Signify. # % { center=50 $name $email % } # # Put a separator line between name and quote # ------------------------------------------------------------------------------- # # Here is my collection of quotes... # % { center If it doesn't work, force it. If it breaks, it needed replacing anyway. % | center Friends are relatives you make for yourself. % | center, weight=2 The squeaky wheel doesn't always get the grease. Sometimes it gets replaced. # # And, to help out the developers of Signify, a little plug for them... # (A little free advertising for them gives them additional reason to # generate more free software for me!) # % | center,weight=0.5 Generated by $PROGRAM. For this and more, visit $WEBSITE # # And thus ends my quotes definition and columns definition # % } # # Here ends the simple version. # ############################################################################### ############################################################################### # # Here starts the columned version # % | # # Put a separator line at the top # ,-----------------------------------------------------------------------------. # # I want columns in my signature! (first col is left, minimum size & repeats) # % ( left,minwidth,repeat > # # Put my name and userid in the second column (centered horz & vert) # % | center,vcenter $LOGNAME $email # # Third column is a simple seperator (left, minimum size, & repeats) # % | left,minwidth,repeat | # # Fourth column has a choice of cool quotes (center horz & vert) # % | center,vcenter # # Here is my collection of quotes... # % { If it doesn't work, force it. If it breaks, it needed replacing anyway. % | Friends are relatives you make for yourself. % | weight=2 The squeaky wheel doesn't always get the grease. Sometimes it gets replaced. % | If you're passed on the right... you're in the wrong lane. # # And, to help out the developers of Signify, a little plug for them... # (A little free advertising for them gives them additional reason to # generate more free software for me!) # % | weight=0.1 This signature was automatically generated with $PROGRAM. For this and other cool products, check out $WEBSITE # # And thus ends my quotes definition # % } # # The last column just finishes up the right-hand side # % | right,minwidth,repeat < % ) # # Put a separator line at the bottom # `-----------------------------------------------------------------------------' # # Here ends the columned version. # ############################################################################### % } signify/examples/Columned0000644010210200017510000000320507646632635016447 0ustar bcwhitehome00000000000000############################################################################### # # Cool signatures for Signify # ############################################################################### % $name=My Name % $email=$LOGNAME@$HOST # # Put a separator line at the top # ,-----------------------------------------------------------------------------. # # I want columns in my signature! (first col is left, minimum size & repeats) # % ( left,minwidth,repeat > # # Put my name and userid in the second column (centered horz & vert) # % | center,vcenter $name $email # # Third column is a simple seperator (left, minimum size, & repeats) # % | left,minwidth,repeat | # # Fourth column has a choice of cool quotes (center horz & vert) # % | center,vcenter # # Here is my collection of quotes... # % { If it doesn't work, force it. If it breaks, it needed replacing anyway. % | Friends are relatives you make for yourself. % | weight=2 The squeaky wheel doesn't always get the grease. Sometimes it gets replaced. % | If you're passed on the right... you're in the wrong lane. # # And, to help out the developers of Signify, a little plug for them... # (A little free advertising for them gives them additional reason to # generate more free software for me!) # % | weight=0.1 This signature was automatically generated with $PROGRAM. For this and other cool products, check out $WEBSITE # # And thus ends my quotes definition # % } # # The last column just finishes up the right-hand side # % | right,minwidth,repeat < % ) # # Put a separator line at the bottom # `-----------------------------------------------------------------------------' signify/examples/Complex0000644010210200017510000000364707646632635016322 0ustar bcwhitehome00000000000000############################################################################### # # Cool signatures for Signify # ############################################################################### % $name=My Name % $email=$LOGNAME@$HOST # # Put a separator line at the top # ,-----------------------------------------------------------------------------. # # I want columns in my signature! (first col is left, minimum size & repeats) # % ( left,minwidth,repeat > # # Put my name and userid in the second column (centered horz & vert) # % | center,vcenter $name $email # # Third column is a simple seperator (left, minimum size, & repeats) # % | left,minwidth,repeat | # # Fourth column has an embedded section with its own columns # % | center,vcenter # # The nested columns we want to point to a couple of sites plus give a quote # % ( minwidth % { Look at me go! www.mysite.com % | Look at you go! www.yoursite.com % } % | minwidth,repeat % | minwidth % { Look at him go! www.hissite.com % | Look at her go! www.hersite.com % } % ) # # Here is my collection of quotes... # % { If it doesn't work, force it. If it breaks, it needed replacing anyway. % | Friends are relatives you make for yourself. % | weight=2 The squeaky wheel doesn't always get the grease. Sometimes it gets replaced. % | If you're passed on the right... you're in the wrong lane. # # And, to help out the developers of Signify, a little plug for them... # (A little free advertising for them gives them additional reason to # generate more free software for me!) # % | weight=0.1 This signature was automatically generated with $PROGRAM. For this and other cool products, check out $WEBSITE # # And thus ends my quotes definition # % } # # The last column just finishes up the right-hand side # % | right,minwidth,repeat < % ) # # Put a separator line at the bottom # `-----------------------------------------------------------------------------' signify/examples/Simple0000644010210200017510000000236407646632635016137 0ustar bcwhitehome00000000000000############################################################################### # # Cool signatures for Signify # ############################################################################### % $name=My Name % $email=myid@mycompany.com # # Sign my name. I want these centered, so they must be in a section. # Note that the two "blank" lines actually have a single space. Empty # lines are ignored by Signify. # % { center=50 $name $email % } # # Put a separator line between name and quote # ------------------------------------------------------------------------------- # # Here is my collection of quotes... # % { center If it doesn't work, force it. If it breaks, it needed replacing anyway. % | center Friends are relatives you make for yourself. % | center, weight=2 The squeaky wheel doesn't always get the grease. Sometimes it gets replaced. % | If you're passed on the right, you're in the wrong lane. # # And, to help out the developers of Signify, a little plug for them... # (A little free advertising for them gives them additional reason to # generate more free software for me!) # % | center, weight=0.1 Generated by $PROGRAM. For this and more, visit $WEBSITE # # And thus ends my quotes definition and columns definition # % } signify/signify.10000644010210200017510000002446307646632634014702 0ustar bcwhitehome00000000000000.\" Hey, Emacs! This is an -*- nroff -*- source file. .\" Signify and this man-page were written by Brian White and .\" are in the public domain (the only true "free"). .\" .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .TH SIGNIFY 1 "Public domain by Brian White" "96.08.24" "Generate Semi-Random Signatures" .SH NAME signify - Program to generate semi-random signatures .SH SYNOPSIS .B signify [--fifo=$HOME/.signature] [--input=file] [--debug] .SH DESCRIPTION .PP .B Signify will take a signature description file ( .I ~/.signify or whatever file is specified by the .I --input= option ) and create a random signature based on the information contained therein. This allows the ability to do such things as pick a random quote for each message sent. .B Signify, by default, will write the generated signature to standard output from where it can be redirected to overwrite the .I .signature file. Alternatively, .B Signify can pipe it's output to a given 'fifo'. Each read from that file will return a different signature. To use the FIFO feature, delete the current "$HOME/.signature" file and start .B Signify in the background like "signify --fifo=$HOME/.signature &". With this running, try "cat $HOME/.signature" a few times. A different signature will be returned each time. (Note: This feature will probably work only on unix systems.) The .B --debug switch causes .B Signify to generate messages on what it is doing to .IR stderr . This switch is only meant to be useful to the program's maintainers. .SH CONFIGURATION The definition for the generated signatures is contained entirely within the .I .signify file contained in the user's home directory. Any completely empty lines (lines with even a single space are considered part of the signature data) and those lines starting with a hash character (#) are completely ignored. Those lines starting with a percent sign (%) are considered commands and affect the way .B Signify behaves. .Sh "Perl Command Substitution" .B Signify can execute an arbitrary perl code fragment during the initial reading of the configuration file. This can be used, for example, to choose values or text depending on the environment in which .B Signify is being run. To use this feature, simply enclose the desired perl code in back-tics (i.e. `perl code`). Whatever the perl code evaluates to will be substituted in that spot. No further variable substitutions are made on the resulting text. .B Signify is intelligent enough to recognize two back-tics together (often used as a better looking quotation mark) as not being a code fragment. Thus, writting something like "``Stop,'' she said." will appear as expected. .I Note: The entire code fragment must be contained on a single line of the input file. .Sh "Defining Variables" .B Signify will substitute variables within each line of the signature in much the same way as the shell would. Any sequence of .I $WORD; will be replaced by the value corresponding to the name "WORD". Case is significant but the trailing semicolon may be omitted if the next character is not a letter, digit, or underscore. By default, these variables look up values inside the environment variables, but can also be defined or redefined within the .I .signify file itself with a command such as: .Vb 1 \& % $email=myid@mycompany.com .Ve Everything after the equal sign (=) is considered part of the value. Variables can be used in the definition of other variables. As a special case, .I $$ will evaluate to a single dollar sign ($). The special variable .I SIGWIDTH can be used to set the desired output width of the generated signature. By default, this variable has the value "79". There is also a .I BLANK variable you can place on a line to create a totally empty line when the signature is output. .Sh "Including Other Files" You can tell .B Signify to read another file in place of the current line with a command like: .Vb 8 \& % include $HOME/.signify-quotes .Ve For convienence, you can use a tilde (~) instead of .I $HOME to read a file relative to your home directory. .Sh "Creating Alternates" An unlimited number of "alternates" can be specified by using the "{", "|", and "}" commands. When the signature is generated, only one of all the possible alternates will be output. For example: .Vb 8 \& % { \& This is the first possibility. \& % | \& This is the second possibility. \& % | \& This is the third (and last) possibility. \& Note that alternatives can span multiple lines. \& % } .Ve .Sh "Creating Columns" .B Signify will automatically create side-by-side columns with nice, even spacing by using the "(", "|", and ")" commands. When output, everything will be padded out with spaces to fit nicely on the line. For example: .Vb 9 \& % ( \& This is the \& first column. \& % | \& This is the second. \& % | \& This is the third \& (and last) column. \& % ) .Ve .Sh "Nesting Sections" Alternates and columns can be nested to any depth, though this can quickly become unwieldy and may not work exactly as expected, especially with columns. As a general rule, only supply alignment options (eg. "center", "right") at the most outside level to do any text formatting. For example, if supplying multiple "alternates" within a column, put the alignment options on the column and not on the alternates. .Sh "Section Command Options" The "alternates" and "columns" commands can take options to alter how they behave. The following is a list of supported options and what they do, though not all have meaning for both types of section. Multiple options can be specified by separating them with a comma (,). .Ip "\fBbottom\fR" push the following lines of text to the bottom of a column should it have fewer lines than the longest column. This option has no meaning to "alternates" sections. .Ip "\fBcenter\fR" adjust the following lines to be centered on the page or in the column. When used in an "alternates" section, an additional "=" can be used to specify what column to center around instead of the middle of the page. .Ip "\fBexec\fR" treat the following lines not as text to be included in the column or alternate, but as commands to be executed by the shell. For each command executed, if its return status is 0 then the output it produced is included at that point, otherwise the output is discarded. Any included text is then aligned, etc. as usual. This command is most useful for inserting random quotes generated by programs such as .BR fortune (6). .Ip "\fBleft\fR" adjust the following lines so they sit at the left margin. This is the default horizontal alignment and most closely reflects how the lines are entered into the .I .signify file itself. Note that pad spaces will still be placed on both sides of a column with this type of alignment unless the .I minwidth option is also specified. .Ip "\fBminwidth\fR" do not pad the left and right sides of this column when placing next to other columns. This is useful for building column separator lines and the like that are not really part of the content. This option has no meaning to "alternates" sections. .Ip "\fBrepeat\fR" output the following lines multiple times to fill all lines in the column. This is useful for building column separator lines and the like that are just a repeated sequence. A multi-line sequence can be specified and only those lines necessary to fill the column will be output. The entire sequence will be output in its entirety at least once, however. This option has no meaning to "alternates" sections. .Ip "\fBright\fR" adjust the following lines so they sit at the right margin. Note that pad spaces will still be placed on both sides of a column with this type of alignment unless the .I minwidth option is also specified. .Ip "\fBtop\fR" push the following lines of text to the top of a column should it have fewer lines than the longest column. This is the default action if no vertical centering is specified. This option has no meaning to "alternates" sections. .Ip "\fBvcenter\fR" push the following lines of text in the vertical center of a column should it have fewer lines than the longest column. This option has no meaning to "alternates" sections. .Ip "\fBweight=\fR" change the likelihood a given alternate will be chosen. The chance of any specific alternate being chosen is the given .I divided by the total of all weights. If not specified, the weight defaults to 1.0. Decimal numbers and numbers less that 1.0 are allowed. This option has no meaning to "columns" sections. .SH "THE COST OF FREE SOFTWARE" Let's face it: Somebody has to pay for all software that gets written. Whether it is the time donated by the programmer or the salary donated by the company, everything has its cost. .B Signify has been made available to the general public in the hope that it will be useful and thus help raise the visibility of the people that sponsored its creation. In this way, the cost of creating .B Signify is offset by the publicity gained. If you use this program and would like to further the development of such software, it is asked (but by no means required) that you put something like the following in the quotes section of your .I .signify file. .Vb 2 \& % | center, weight=0.1 \& Generated by $PROGRAM. For this and more, visit $WEBSITE .Ve (for single-line quote) or (for multi-line in a column) .Vb 4 \& % | weight=0.1 \& This signature was automatically generated with \& $PROGRAM. For this and other cool products, \& check out $WEBSITE .Ve These are weighted very low (though you are more than welcome to increase these weightings :-) and will thus show up in your signature only occasionally. The variables are defined internal to .B Signify and provide the program name (including version number) and the web site where it can be found. We thank you for your support! .SH BUGS Please report any bugs to: .B bcwhite@pobox.com .SH AUTHOR .B Signify was written and documented by Brian White on August 24th, 1996. .SH COPYRIGHT .B Signify has been placed in the public domain, the only true "free". It would be apprecated if copies of any improvements or bug-fixes would be sent to the author in order to be incorporated into the main upstream code and propogated to all users of this software. signify/COPYING0000644010210200017510000000052207646632634014171 0ustar bcwhitehome00000000000000Signify was written by Brian White of Verisim, Inc. and has been released into the public domain (the only true "free"). It would be apprecated if copies of any improvements of bug-fixes would be sent to the author in order to be incorporated into the main upstream code and propogated to all users of this software. signify/Makefile0000644010210200017510000000201110002410404014532 0ustar bcwhitehome00000000000000 PREFIX = /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/man MAN1DIR= $(MANDIR)/man1 default: @echo "Make what? (install, clean, source)" perlcheck: @test -x "`which perl`" || (echo; echo "*** Can't find Perl! ***"; echo; exit 1) @p=`which perl`; test "`head -1 $$p | grep \#\!`" = "" || (echo; \ echo "*** '$$p' is a shell script!"; \ echo " edit 'signify' by hand to call perl binary"; \ echo; ) install: perlcheck umask 022; mkdir -p $(MAN1DIR) $(BINDIR) perl=`which perl`; sed -e "1s|.*|#! $$perl|" signify.pl >$(BINDIR)/signify cp signify.1 $(MAN1DIR) chmod 755 $(BINDIR)/signify chmod 644 $(MAN1DIR)/signify.1 clean: -rm -f stamp-build -rm -f debian/files -rm -rf debian/tmp -rm -f signify.txt find . \( -name "#*" -o -name "*~" \) -print | xargs rm -f source: clean umask 022; nroff -man signify.1 | col -b >signify.txt DIR=`basename $$PWD`; cd ..; rm -f $$DIR.tar.gz; tar cf - $$DIR | gzip -9 >$$DIR.tar.gz DIR=`basename $$PWD`; cd ..; rm -f $$DIR.zip; zip -r9lq $$DIR.zip $$DIR signify/README0000644010210200017510000000155607646632633014025 0ustar bcwhitehome00000000000000Signify is a neat little program that allows a random signature to be generated from a set of rules. Each section can be one of an unlimited number of possibilities, each with its own weighting so those really cool quotes can appear more often than others. Sections can also be placed next to each other vertically to create columns. Each section can be formatted independently as left/right/center and top/bottom/vcenter. There is nothing to compile, just do # make install PREFIX= If not specified, the prefix will default to "/usr/local". To see some example signatures, try the following: $ signify --input=examples/Simple $ signify --input=examples/Columned $ signify --input=examples/SimpleOrColumned $ signify --input=examples/Complex Then copy one of these to your home directory under ".signify" and make your own signatures for the world to see. signify/signify.sysopen0000755010210200017510000002756607706324030016235 0ustar bcwhitehome00000000000000#! /usr/bin/perl # # my %section ( # lines = \@lines, # next = \%section, # colflag = $bool, # weight = $real, # repeat = $bool, # minwidth = $bool, # halign = $number, # valign = $number, # ); # use IO::Handle; use Sys::Hostname; $dbg = 0; $prog = "Signify"; $vers = "1.10"; srand(); # If there is no $ENV{HOME}, set it from /etc/passwd. $ENV{HOME} = (getpwuid($<))[7] unless exists $ENV{HOME}; %vars = %ENV; $vars{PROGRAM} = "$prog v$vers"; $vars{SIGWIDTH} = 79; $vars{WEBSITE} = "http://www.debian.org/"; $vars{DOLSIGN} = "\$"; $vars{BLANK} = ""; $perlvarnam = "_perl_"; $perlvarnum = 1; $CurFile = ""; $CurPath = ""; @OpenFiles = (); @OpenPaths = (); $OutputFifo = ""; $InputFile = "$ENV{HOME}/.signify"; $FifoName = undef; $FifoLock = undef; sub Error { die "$CurFile:$.:$_[0]\n"; } sub SubstituteVars { my($line) = @_; $line =~ s/\$\$/\$DOLSIGN;/gs; $line =~ s/\$(\w+);?/$vars{$1}/gs; return $line; } sub DefaultSection { my %section; my @lines; $section{lines} = \@lines; $section{weight} = 1; $section{colflag} = 0; $section{repeat} = 0; $section{minwidth} = 0; $section{halign} =-1; $section{valign} =-1; return %section; } sub OpenFile { my($file) = @_; if ($CurPath || $CurFile) { push @OpenPaths,$CurPath; push @OpenFiles,$CurFile; } if (grep(/^\Q$file\E$/,@OpenFiles)) { die "Signify: File '$file' is read recursively\n"; } $CurFile = $file; $CurPath = new IO::Handle; open($CurPath,"<$file") || die "Signify: Could not read file '$file' -- $!\n"; print STDERR "Starting file '$CurFile'\n" if $dbg; } sub ReadLine { my $line = <$CurPath>; while (!defined $line || $line eq "") { print STDERR "Finished file '$CurFile'\n" if $dbg; close($CurPath); $CurPath = pop @OpenPaths; $CurFile = pop @OpenFiles; last if !defined $CurPath || !defined $CurFile; $line = <$CurPath>; } print STDERR "$CurFile: $line" if $dbg && $CurFile; $line =~ s/^\#.*$//; if ($line =~ m/\`([^\`]+?)\`/) { my $pvar = "$perlvarnam$perlvarnum"; $line =~ s/\`([^\`]+?)\`/\$$pvar;/g; $vars{$pvar} = eval $1; $perlvarnum++; } if ($line =~ m/^\%\s*include\s+[\'\"]?(.*?)[\"\']?$/i) { my $newfile; $newfile = SubstituteVars($1); $newfile =~s!^~/!$ENV{HOME}/!; OpenFile($newfile); $line = ReadLine(); } return $line; } sub ReadCommand { my($line) = @_; if ($line =~ m/^\%\s*\$(\w+)=(.*)$/) { $vars{$1} = SubstituteVars($2); print STDERR "var '$1' = '$vars{$1}'\n" if $dbg; return 1; } return; } sub ReadSection { my($line) = @_; my %section = DefaultSection(); my $secttype; Error "Unknown section identifier" unless $line=~m/^\%\s*[\{\(\|]/; ($secttype) = ($line =~ m/^\%\s*(.)/); $section{colflag} = ($secttype eq "("); $line =~ s/^\%\s*[\{\(\|]\s*//; foreach (split(/,\s*/,$line)) { if (/^bottom$/i) { $section{valign} = -2; next; } if (/^center$/i) { $section{halign} = 0; next; } if (/^center=(\d+)$/i) { $section{halign} = $1; next; } if (/^left$/i) { $section{halign} = -1; next; } if (/^minwidth$/i) { $section{minwidth}= 1; next; } if (/^repeat$/i) { $section{repeat} = 1; next; } if (/^right$/i) { $section{halign} = -2; next; } if (/^top$/i) { $section{valign} = -1; next; } if (/^vcenter$/i) { $section{valign} = 0; next; } if (/^weight=(.*)$/i) { $section{weight} = $1; next; } if (/^exec$/i) { $section{exec} = 1; next; } Error "Unknown option '$_'"; } while (1) { $line = ReadLine(); Error "Unexpected end-of-file" unless $line; chomp $line; next if !$line || $line =~ m/^\#/; if ($line =~ m/^\%/) { return \%section if $line =~ m/^\%\s*\}/ && !$section{colflag}; return \%section if $line =~ m/^\%\s*\)/ && $section{colflag}; # print STDERR "colflag=$section{colflag}\n" if $dbg; Error "Incorrect section terminator" if $line =~ m/^\%\s*[\}\)]/; # Error "Cannot nest columns within another section" if $line =~ m/^\%\s*\(/; # Error "Cannot nest 'alternate' sections" if $line =~ m/^\%\s*\{/ && !$section{colflag}; if ($line =~ m/^\%\s*[\{\(]/) { push @{$section{lines}},ReadSection($line); next; } elsif ($line =~ m/^\%\s*\|/) { $line =~ s/\|/$secttype/; $section{next} = ReadSection($line); return \%section; } next if ReadCommand($line); Error "Unknown command"; } else { print STDERR "Adding (section) line '$line'\n" if $dbg; push @{$section{lines}},SubstituteVars($line); } } } sub ReadFile { my($file) = @_; my $handle = new IO::Handle; my $oldfile = $CurFile; my %section = DefaultSection(); OpenFile($file); while ($_ = ReadLine()) { chomp; next if !$_; if (/^\%\s*[\{\(]/) { push @{$section{lines}},ReadSection($_); print STDERR "finished reading section\n" if $dbg; } elsif (/^\%/) { Error "Unknown command" unless ReadCommand($_); } else { print STDERR "Adding (base) line '$_'\n" if $dbg; push @{$section{lines}},SubstituteVars($_); } } return \%section; } sub GenerateSig { my($sect) = @_; my(@lines,$line,$i); my($status,$signal); if ($$sect{colflag}) { my @cols; my $csect = $sect; my $minwidth = 0; my $maxheight= 0; my $padcols = 0; my $lastpad = 0; while ($csect) { my @clines; my $count = 0; my $width = 0; push @cols,\@clines; foreach (@{$$csect{lines}}) { if (ref) { print STDERR "creference\n" if $dbg; push @clines,GenerateSig($_); } elsif ($$csect{exec}) { print STDERR "Executing shell command '$_'\n" if $dbg; @output = `$_`; $status = $? >> 8; $signal = $? & 255; if ($?) { print STDERR ("Shell command returned $status exit status", $signal ? " (killed on signal $signal)" : "", "\n") if $dbg; } else { chomp @output; if ($dbg) { foreach (@output) { print STDERR "Shell command output '$_'\n"; } } push @clines,@output; } } else { print STDERR "cline '$_'\n" if $dbg; push @clines,$_; } } foreach (@clines) { my $length = length; $count++; $width = $length if $length > $width; } $minwidth += $width; $maxheight = $count if $count > $maxheight; if ($$csect{minwidth}) { $lastpad = 0; } else { $padcols += 2 - $lastpad; $lastpad = 1; } $csect = $$csect{next}; print STDERR "minwidth=$minwidth, width=$width, maxheight=$maxheight, count=$count, varcols=$varcols\n" if $dbg; } my $padding = $vars{SIGWIDTH} - $minwidth; $csect = $sect; $lastpad = 0; foreach $col (@cols) { my $width = 0; if (!$$csect{minwidth}) { my $spaces = 0; $spaces = int($padding / $padcols) if $padcols && !$lastpad; for ($i=0; $i < $maxheight; $i++) { $lines[$i] .= " " x $spaces; } $padding -= $spaces; $padcols--; } foreach (@$col) { my $length = length; $width = $length if $length > $width; } if ($$csect{halign} == -1) { foreach (@$col) { my $length = length; $_ = $_ . " " x ($width - $length); } } if ($$csect{halign} == -2) { foreach (@$col) { my $length = length; $_ = " " x ($width - $length) . $_; } } if ($$csect{halign} >= 0) { foreach (@$col) { my $length = length; $_ = " " x (($width - $length + 1) / 2) . $_ . " " x (($width - $length) / 2); } } $i = 0; if ($$csect{valign} == -2 && !$$csect{repeat}) { my $skip = int($maxheight - scalar(@$col)); while ($i < $skip) { $lines[$i++] .= " " x $width; } } if ($$csect{valign} >= 0 && !$$csect{repeat}) { my $skip = int(($maxheight - scalar(@$col)) / 2); while ($i < $skip) { $lines[$i++] .= " " x $width; } } foreach $line (@$col) { $lines[$i++] .= $line; } while ($i < $maxheight && $$csect{repeat}) { foreach $line (@$col) { last if $i >= $maxheight; $lines[$i++] .= $line; } } while ($i < $maxheight) { $lines[$i++] .= " " x $width; } if (!$$csect{minwidth}) { my $spaces = 0; $spaces = int($padding / $padcols) if $padcols; for ($i=0; $i < $maxheight; $i++) { $lines[$i] .= " " x $spaces; } $padding -= $spaces; $padcols--; $lastpad = 1; } else { $lastpad = 0; } $csect = $$csect{next}; } } else { # !colflag if ($$sect{next}) { my $total = 0.0; my $sptr = $sect; while ($sptr) { $total += $$sptr{weight}; $sptr = $$sptr{next}; } my $index = rand($total); while ($$sect{weight} < $index) { $index -= $$sect{weight}; $sect = $$sect{next}; } } foreach (@{$$sect{lines}}) { if (ref) { print STDERR "reference\n" if $dbg; push @lines,GenerateSig($_); } elsif ($$sect{exec}) { print STDERR "Executing shell command '$_'\n" if $dbg; @output = `$_`; $status = $? >> 8; $signal = $? & 255; if ($?) { print STDERR ("Shell command returned $status exit status", $signal ? " (killed on signal $signal)" : "", "\n") if $dbg; } else { chomp @output; if ($dbg) { foreach (@output) { print STDERR "Shell command output '$_'\n"; } } push @lines,@output; } } else { print STDERR "line '$_'\n" if $dbg; push @lines,$_; } } if ($$sect{halign} >= 0) { my $center = $$sect{halign}; $center = ($vars{SIGWIDTH}+1)/2 unless $center; for ($i=0; $i < @lines; $i++) { my $length = length($lines[$i]); my $prefix = int($center - $length/2); $lines[$i] = " " x $prefix . $lines[$i]; } } if ($$sect{halign} == -2) { for ($i=0; $i < @lines; $i++) { my $length = length($lines[$i]); $lines[$i] = " " x ($vars{SIGWIDTH} - $length) . $lines[$i]; } } } # colflag return @lines; } sub MakeFifo { my ($fifo) = @_; $fifo =~ s!^~/!$ENV{HOME}/!; $FifoName = $fifo; die "Signify: '$fifo' already exists and is not a FIFO\n" if (-e $fifo && ! -p $fifo); system("mkfifo -m 644 $fifo") if (! -p $fifo); die "Signify: Could not make FIFO '$fifo'\n" if (! -p $fifo); } sub LockFifo { my($fifo) = @_; my $pid; $FifoLock = "$fifo.lock-$hostnam"; if (! -e $FifoLock) { open(LOCK,">>$FifoLock") || die "Signify: Could not create file '$FifoLock' -- $!\n"; close(LOCK); } open(LOCK,"+<$FifoLock") || die "Signify: Could not update file '$FifoLock' -- $!\n"; flock(LOCK,2) || die "Signify: could not lock file '$FifoLock' -- $!\n"; $pid = ; chomp $pid; kill 14,$pid if ($pid > 1 && $pid != $$); sleep(1); if (! -e $FifoLock) { open(LOCK,">>$FifoLock") || die "Signify: Could not create file '$FifoLock' -- $!\n"; close(LOCK); } seek LOCK,0,0; print LOCK $$,"\n"; close(LOCK); } ############################################################################### foreach (@ARGV) { if (/^--fifo=(.*)$/) { $OutputFifo = $1; MakeFifo($OutputFifo); next; } if (/^--input=(.*)$/) { $InputFile = $1; next; } if (/^--debug$/) { $dbg = 1; next; } die "Signify: Unknown parameter '$_'\n"; } $sectref = ReadFile($InputFile); $nowtime = 840000000; $hostnam = hostname(); sub ExitProg { # unlink $FifoName if ($FifoName); # may be in use across multiple machines unlink $FifoLock if ($FifoLock); exit(0); } $SIG{ALRM} = sub { exit(0); }; $SIG{HUP} = sub { $sectref = ReadFile($InputFile); }; $SIG{INT} = \&ExitProg; $SIG{KILL} = \&ExitProg; $SIG{TERM} = \&ExitProg; $SIG{ABRT} = \&ExitProg; $SIG{QUIT} = \&ExitProg; if ($OutputFifo) { local $SIG{PIPE} = sub {}; LockFifo($OutputFifo); while (1) { utime $nowtime,$nowtime,$OutputFifo; # open(FIFO,">$OutputFifo") || die "Signify: Could not write to '$OutputFifo' -- $!\n"; sysopen(FIFO,$OutputFifo,O_WRONLY) || die "Signify: Could not write to '$OutputFifo' -- $!\n"; print STDERR "."; @lines = GenerateSig($sectref); foreach (@lines) { s/\s+$// unless m/^--/; # print FIFO $_,"\n"; syswrite(FIFO,$_."\n"); } # close(FIFO); sysclose(FIFO); utime $nowtime,$nowtime,$OutputFifo; sleep(1); } } else { @lines = GenerateSig($sectref); foreach (@lines) { s/\s+$// unless m/^--/; print $_,"\n"; } } signify/signify.lsm0000644010210200017510000000157210034772140015307 0ustar bcwhitehome00000000000000Begin3 Title: Signify Version: 1.13 Entered-date: 2003-04-07 Description: Signify is a neat little Perl program that allows a random signature to be generated from a set of rules. Each section can be one of an unlimited number of possibilities, each with its own weighting so those really cool quotes can appear more often than others. Sections can also be placed next to each other vertically to create columns. Each section can be formatted independently as left/right/center and top/bottom/vcenter. See http://signify.sf.net/ Keywords: signature, generator, email, news, random, quotes Author: Brian White Maintained-by: Brian White Primary-site: sunsite.unc.edu /pub/Linux/utils/text 13k signify-1.13.tar.gz 860 signify-1.13.lsm Platform: Perl-5 Copying-policy: public domain End signify/signify.pl0000755010210200017510000003000210046154057015124 0ustar bcwhitehome00000000000000#! /usr/bin/perl # # my %section ( # lines = \@lines, # next = \%section, # colflag = $bool, # weight = $real, # repeat = $bool, # minwidth = $bool, # halign = $number, # valign = $number, # ); # use IO::Handle; use Sys::Hostname; $dbg = 0; $prog = "Signify"; $vers = "1.14"; srand(); use open ':locale'; # If there is no $ENV{HOME}, set it from /etc/passwd. $ENV{HOME} = (getpwuid($<))[7] unless exists $ENV{HOME}; %vars = %ENV; $vars{PROGRAM} = "$prog v$vers"; $vars{SIGWIDTH} = 79; $vars{WEBSITE} = "http://www.debian.org/"; $vars{DOLSIGN} = "\$"; $vars{BLANK} = ""; $perlvarnam = "_perl_"; $perlvarnum = 1; $CurFile = ""; $CurPath = ""; @OpenFiles = (); @OpenPaths = (); $OutputFifo = ""; $InputFile = "$ENV{HOME}/.signify"; $FifoName = undef; $FifoLock = undef; $KillOther = undef; sub Error { die "$CurFile:$.:$_[0]\n"; } sub SubstituteVars { my($line) = @_; $line =~ s/\$\$/\$DOLSIGN;/gs; $line =~ s/\$(\w+);?/$vars{$1}/gs; return $line; } sub DefaultSection { my %section; my @lines; $section{lines} = \@lines; $section{weight} = 1; $section{colflag} = 0; $section{repeat} = 0; $section{minwidth} = 0; $section{halign} =-1; $section{valign} =-1; return %section; } sub OpenFile { my($file) = @_; if ($CurPath || $CurFile) { push @OpenPaths,$CurPath; push @OpenFiles,$CurFile; } if (grep(/^\Q$file\E$/,@OpenFiles)) { die "$prog: File '$file' is read recursively\n"; } $CurFile = $file; $CurPath = new IO::Handle; open($CurPath,"<$file") || die "$prog: Could not read file '$file' -- $!\n"; print STDERR "Starting file '$CurFile'\n" if $dbg; } sub ReadLine { my $line = <$CurPath>; while (!defined $line || $line eq "") { print STDERR "Finished file '$CurFile'\n" if $dbg; close($CurPath); $CurPath = pop @OpenPaths; $CurFile = pop @OpenFiles; last if !defined $CurPath || !defined $CurFile; $line = <$CurPath>; } print STDERR "$CurFile: $line" if $dbg && $CurFile; $line =~ s/^\#.*$//; if ($line =~ m/\`([^\`]+?)\`/) { my $pvar = "$perlvarnam$perlvarnum"; $line =~ s/\`([^\`]+?)\`/\$$pvar;/g; $vars{$pvar} = eval $1; $perlvarnum++; } if ($line =~ m/^\%\s*include\s+[\'\"]?(.*?)[\"\']?$/i) { my $newfile; $newfile = SubstituteVars($1); $newfile =~s!^~/!$ENV{HOME}/!; OpenFile($newfile); $line = ReadLine(); } return $line; } sub ReadCommand { my($line) = @_; if ($line =~ m/^\%\s*\$(\w+)=(.*)$/) { $vars{$1} = SubstituteVars($2); print STDERR "var '$1' = '$vars{$1}'\n" if $dbg; return 1; } return; } sub ReadSection { my($line) = @_; my %section = DefaultSection(); my $secttype; Error "Unknown section identifier" unless $line=~m/^\%\s*[\{\(\|]/; ($secttype) = ($line =~ m/^\%\s*(.)/); $section{colflag} = ($secttype eq "("); $line =~ s/^\%\s*[\{\(\|]\s*//; foreach (split(/,\s*/,$line)) { if (/^bottom$/i) { $section{valign} = -2; next; } if (/^center$/i) { $section{halign} = 0; next; } if (/^center=(\d+)$/i) { $section{halign} = $1; next; } if (/^left$/i) { $section{halign} = -1; next; } if (/^minwidth$/i) { $section{minwidth}= 1; next; } if (/^repeat$/i) { $section{repeat} = 1; next; } if (/^right$/i) { $section{halign} = -2; next; } if (/^top$/i) { $section{valign} = -1; next; } if (/^vcenter$/i) { $section{valign} = 0; next; } if (/^weight=(.*)$/i) { $section{weight} = $1; next; } if (/^exec$/i) { $section{exec} = 1; next; } Error "Unknown option '$_'"; } while (1) { $line = ReadLine(); Error "Unexpected end-of-file" unless $line; chomp $line; next if !$line || $line =~ m/^\#/; if ($line =~ m/^\%/) { return \%section if $line =~ m/^\%\s*\}/ && !$section{colflag}; return \%section if $line =~ m/^\%\s*\)/ && $section{colflag}; # print STDERR "colflag=$section{colflag}\n" if $dbg; Error "Incorrect section terminator" if $line =~ m/^\%\s*[\}\)]/; # Error "Cannot nest columns within another section" if $line =~ m/^\%\s*\(/; # Error "Cannot nest 'alternate' sections" if $line =~ m/^\%\s*\{/ && !$section{colflag}; if ($line =~ m/^\%\s*[\{\(]/) { push @{$section{lines}},ReadSection($line); next; } elsif ($line =~ m/^\%\s*\|/) { $line =~ s/\|/$secttype/; $section{next} = ReadSection($line); return \%section; } next if ReadCommand($line); Error "Unknown command"; } else { print STDERR "Adding (section) line '$line'\n" if $dbg; push @{$section{lines}},SubstituteVars($line); } } } sub ReadFile { my($file) = @_; my $handle = new IO::Handle; my $oldfile = $CurFile; my %section = DefaultSection(); OpenFile($file); while ($_ = ReadLine()) { chomp; next if !$_; if (/^\%\s*[\{\(]/) { push @{$section{lines}},ReadSection($_); print STDERR "finished reading section\n" if $dbg; } elsif (/^\%/) { Error "Unknown command" unless ReadCommand($_); } else { print STDERR "Adding (base) line '$_'\n" if $dbg; push @{$section{lines}},SubstituteVars($_); } } return \%section; } sub GenerateSig { my($sect) = @_; my(@lines,$line,$i); my($status,$signal); if ($$sect{colflag}) { my @cols; my $csect = $sect; my $minwidth = 0; my $maxheight= 0; my $padcols = 0; my $lastpad = 0; while ($csect) { my @clines; my $count = 0; my $width = 0; push @cols,\@clines; foreach (@{$$csect{lines}}) { if (ref) { print STDERR "creference\n" if $dbg; push @clines,GenerateSig($_); } elsif ($$csect{exec}) { print STDERR "Executing shell command '$_'\n" if $dbg; @output = `$_`; $status = $? >> 8; $signal = $? & 255; if ($?) { print STDERR ("Shell command returned $status exit status", $signal ? " (killed on signal $signal)" : "", "\n") if $dbg; } else { chomp @output; if ($dbg) { foreach (@output) { print STDERR "Shell command output '$_'\n"; } } push @clines,@output; } } else { print STDERR "cline '$_'\n" if $dbg; push @clines,$_; } } foreach (@clines) { my $length = length; $count++; $width = $length if $length > $width; } $minwidth += $width; $maxheight = $count if $count > $maxheight; if ($$csect{minwidth}) { $lastpad = 0; } else { $padcols += 2 - $lastpad; $lastpad = 1; } $csect = $$csect{next}; print STDERR "minwidth=$minwidth, width=$width, maxheight=$maxheight, count=$count, varcols=$varcols\n" if $dbg; } my $padding = $vars{SIGWIDTH} - $minwidth; $csect = $sect; $lastpad = 0; foreach $col (@cols) { my $width = 0; if (!$$csect{minwidth}) { my $spaces = 0; $spaces = int($padding / $padcols) if $padcols && !$lastpad; for ($i=0; $i < $maxheight; $i++) { $lines[$i] .= " " x $spaces; } $padding -= $spaces; $padcols--; } foreach (@$col) { my $length = length; $width = $length if $length > $width; } if ($$csect{halign} == -1) { foreach (@$col) { my $length = length; $_ = $_ . " " x ($width - $length); } } if ($$csect{halign} == -2) { foreach (@$col) { my $length = length; $_ = " " x ($width - $length) . $_; } } if ($$csect{halign} >= 0) { foreach (@$col) { my $length = length; $_ = " " x (($width - $length + 1) / 2) . $_ . " " x (($width - $length) / 2); } } $i = 0; if ($$csect{valign} == -2 && !$$csect{repeat}) { my $skip = int($maxheight - scalar(@$col)); while ($i < $skip) { $lines[$i++] .= " " x $width; } } if ($$csect{valign} >= 0 && !$$csect{repeat}) { my $skip = int(($maxheight - scalar(@$col)) / 2); while ($i < $skip) { $lines[$i++] .= " " x $width; } } foreach $line (@$col) { $lines[$i++] .= $line; } while ($i < $maxheight && $$csect{repeat}) { foreach $line (@$col) { last if $i >= $maxheight; $lines[$i++] .= $line; } } while ($i < $maxheight) { $lines[$i++] .= " " x $width; } if (!$$csect{minwidth}) { my $spaces = 0; $spaces = int($padding / $padcols) if $padcols; for ($i=0; $i < $maxheight; $i++) { $lines[$i] .= " " x $spaces; } $padding -= $spaces; $padcols--; $lastpad = 1; } else { $lastpad = 0; } $csect = $$csect{next}; } } else { # !colflag if ($$sect{next}) { my $total = 0.0; my $sptr = $sect; while ($sptr) { $total += $$sptr{weight}; $sptr = $$sptr{next}; } my $index = rand($total); while ($$sect{weight} < $index) { $index -= $$sect{weight}; $sect = $$sect{next}; } } foreach (@{$$sect{lines}}) { if (ref) { print STDERR "reference\n" if $dbg; push @lines,GenerateSig($_); } elsif ($$sect{exec}) { print STDERR "Executing shell command '$_'\n" if $dbg; @output = `$_`; $status = $? >> 8; $signal = $? & 255; if ($?) { print STDERR ("Shell command returned $status exit status", $signal ? " (killed on signal $signal)" : "", "\n") if $dbg; } else { chomp @output; if ($dbg) { foreach (@output) { print STDERR "Shell command output '$_'\n"; } } push @lines,@output; } } else { print STDERR "line '$_'\n" if $dbg; push @lines,$_; } } if ($$sect{halign} >= 0) { my $center = $$sect{halign}; $center = ($vars{SIGWIDTH}+1)/2 unless $center; for ($i=0; $i < @lines; $i++) { my $length = length($lines[$i]); my $prefix = int($center - $length/2); $lines[$i] = " " x $prefix . $lines[$i]; } } if ($$sect{halign} == -2) { for ($i=0; $i < @lines; $i++) { my $length = length($lines[$i]); $lines[$i] = " " x ($vars{SIGWIDTH} - $length) . $lines[$i]; } } } # colflag return @lines; } sub MakeFifo { my ($fifo) = @_; $fifo =~ s!^~/!$ENV{HOME}/!; $FifoName = $fifo; die "$prog: '$fifo' already exists and is not a FIFO\n" if (-e $fifo && ! -p $fifo); system("mkfifo -m 644 $fifo") if (! -p $fifo); die "$prog: Could not make FIFO '$fifo'\n" if (! -p $fifo); } sub LockFifo { my($fifo) = @_; my $pid; $FifoLock = "$fifo.lock-$hostnam"; if (! -e $FifoLock) { open(LOCK,">>$FifoLock") || die "$prog: Could not create file '$FifoLock' -- $!\n"; close(LOCK); } open(LOCK,"+<$FifoLock") || die "$prog: Could not update file '$FifoLock' -- $!\n"; flock(LOCK,2) || die "$prog: could not lock file '$FifoLock' -- $!\n"; $pid = ; chomp $pid; if (!$KillOther && -d "/proc/self") { if (open(CMDLINE,"; if ($cmd =~ m/signify/i) { die "$prog: other signify already running (use --kill to replace it)\n"; } } } else { kill 14,$pid if ($pid > 1 && $pid != $$); sleep(1); } if (! -e $FifoLock) { open(LOCK,">>$FifoLock") || die "$prog: Could not create file '$FifoLock' -- $!\n"; close(LOCK); } seek LOCK,0,0; print LOCK $$,"\n"; close(LOCK); } ############################################################################### foreach (@ARGV) { if (/^--fifo=(.*)$/) { $OutputFifo = $1; MakeFifo($OutputFifo); next; } if (/^--input=(.*)$/) { $InputFile = $1; next; } if (/^--kill$/) { $KillOther = 1; next; } if (/^--debug$/) { $dbg = 1; next; } die "$prog: Unknown parameter '$_'\n"; } $sectref = ReadFile($InputFile); $nowtime = 1000000000; $hostnam = hostname(); sub ExitProg { # unlink $FifoName if ($FifoName); # may be in use across multiple machines unlink $FifoLock if ($FifoLock); exit(0); } $SIG{ALRM} = sub { exit(0); }; $SIG{HUP} = sub { $sectref = ReadFile($InputFile); }; $SIG{INT} = \&ExitProg; $SIG{KILL} = \&ExitProg; $SIG{TERM} = \&ExitProg; $SIG{ABRT} = \&ExitProg; $SIG{QUIT} = \&ExitProg; if ($OutputFifo) { local $SIG{PIPE} = sub {}; LockFifo($OutputFifo); while (1) { utime $nowtime,$nowtime,$OutputFifo; open(FIFO,">$OutputFifo") || die "$prog: Could not write to '$OutputFifo' -- $!\n"; @lines = GenerateSig($sectref); foreach (@lines) { s/\s+$// unless m/^--/; print FIFO $_,"\n"; } close(FIFO); utime $nowtime,$nowtime,$OutputFifo; sleep(1); } } else { @lines = GenerateSig($sectref); foreach (@lines) { s/\s+$// unless m/^--/; print $_,"\n"; } }