Installing the Delorie Counter

The originating site for the Delorie Counter is

To get a distribution tarfile (.tar.gz format) directly from, use my autotar program. Please download as little as possible.

In all cases, you will need a copy of gd that can be used with C++, and a C++ compiler (gcc is recommended). Instructions for adding more character sets appear later in this document.

If you need the old version of gd, here it is.

Once you've built gd, modify gd.h to support C++ (see notes below) and build num2gif: gcc -O2 -o num2gif -lgd -lm

While you are allowed to copy this software onto your server, you are not allowed to modify it or its documentation in any way without obtaining permission first, not even the background or link colors. Forward all comments and requests back to if you want them considered for addition to the official sources.

ISPs may change the example site names in using.html to match the site you install the software on if you wish. You may also remove the "Installing" section of the home page (between the two <HR>s

The software includes two files for backup maintainence: dump-db, which converts the database to a text file; and restore-db that converts the text file back into a database. You should dump the database just before any scheduled backups, since the text file can be manually edited if needed.

Configuring your Server

Choose an appropriate directory for the Delorie Counter software. It doesn't matter where. In your conf/srm.conf file, add lines like this:

Note that this should be the virtual path to the counter, not the physical filesystem location.

Note that you can use any MIME type (as long as the two match) and any suffix (although I recommend keeping the default one).

Make sure that your server is configured to allow .cgi extensions to be executed as real CGIs in the counter's directory.

Some of the programs are perl scripts. They are shipped assuming that /bin/perl is a usable perl 4 or 5 interpreter with NDBM support. You may need to change the first lines of the perl scripts to suit your system configuration.

You must configure the counter.conf file for your site. This file defines all the permutations of server names you allow, as well as defining any virtual hosts you support and/or other servers you are serving counters to. For each entry, you must list three lines, as documented inside the file itself. Use "perl -c counter.cgi" to check the syntax. If none of these entries match the request, it checks against the ServerName you specified in conf/httpd.conf

Generating the Character Set Indexes

If you downloaded an index-less package or added new character sets or borders, you'll need to generate the charset browser indexes. These are single images that showcase a range of character sets, with a much faster download time than trying to download all the individual images. You do not need to generate or offer these, but you should.

Adding New Character Sets

I got my character sets from They must be converted to my custom format before they can be used. Here's how:

  1. Create a temporary directory with all the relevent .gif files (like 1new.gif, 2new.gif, . . . 9new.gif, anew.gif, cnew.gif, pnew.gif) in it.
  2. Create a map file that contains one line for each gif, with each line containing the character that the gif represents followed by the filename of the gif, like this:
  3. Now, run a command line like this ( is the name of the map file you just created): This will read all the gifs listed in the map file, and generate a custom gif (there is binary data to the left of each character) that the counter can use.
  4. Follow the directions (above) for regenerating the character set indexes.

Fixing gd.h

You have to wrap gd.h to support c++ like this:
#ifdef __cplusplus
extern "C" {

... original gd.h ...

#ifdef __cplusplus

The Delorie Counter is Copyright © 1996 DJ Delorie