February 26, 2004

A signature program for email and news

Author: Joe Barr

I've always been fascinated by the messages in people's email signatures. When I see a great quote somewhere, I save it and use it in my own signature. Sometimes I just make up my own quotes. But either way, no matter how great a quote may be, after awhile I get bored with it. That's why I finally decided to automate the process.

A search for "signature" on freshmeat.net turned up 65 projects. The first one in line was Ian MacDonald's signature. Ian is the author of a number of tools for the Ruby programming language, but he wrote signature in C in order to learn the language. Ian notes in the README that "The idea for the program came from an old Perl script in the Camel Book (http://www.oreilly.com/catalog/pperl2/) that demonstrated the use of named pipes."

I grabbed the latest tarball noted on freshmeat, then decompressed, built, and installed the software with the familiar ./configure, make, and make install. If you prefer binary code to raw source, you can grab a precompiled RPM from the project site.

Installation details

Signature comes with a "stock" template, which is used to produce dynamic signatures. If you don't care for the default template, it's very easy to make your own.

The program picks up your kernel version and architecture and plugs them into the template. It also adds the signature text where you see all the less-than operators above. By default, signature calls the fortune program (fortune prints a random adage each time it is called) to get new text. Both the template and the source of the text are overridable.

Just for fun, I decided to customize the template. Here is what I came up after a couple of tries.

After saving the new template as ~/sig-template.txt, I entered the following command tell signature to use it:

signature -t ~/sig-template.txt

But when I tried the command above, it produced an error message about not being able to create FIFO .signature. I checked the .signature file permissions, thinking that was the problem, and found an interesting change had occurred. The .signature file was no longer a text file containing the signature to be used -- it was now a named pipe.

That led me to look at the source, Luke. Lo and behold, it seems that signature wants command line permission to remove the existing named pipe (the .signature file) before it will create a new one. So I added the argument to allow removal (an "r" on the command line), and tried again, this time typing

signature -rt ~/sig-template.txt

Now it worked. Isn't open source wonderful? Of course, if you're a little smarter than I am, you could have read what "man signature" had to say about this in the beginning and not have had to turn to the source code at all.

It's easy to create and use your own quote file if you prefer, rather than depend on fortune to be pithy and wise all the time. The quote file is an ASCII text file in which each quote is terminated a tilde (the ~ character) or a percent sign (the % character) on a line all by itself, like this:

This is a humorous quotation.
-- anonymous
~
This signature is quite pithy.
~
A man is only as good as his signature.
~

Be sure to terminate the last quote in the file.

I found Ian's signature program to be just what I've been looking for. I can't recommend it above others because I haven't used them, but I can say this one works, it does what I want, and it's pretty easy to install and use.

Category:

  • Free Software
Click Here!