Source Code

Assorted programs, patches and code fragments I’ve written up for Linux and other operating systems over the years. I find them useful; it’s possible you will as well.

An autologin program
This is a little program that init runs to have a user automatically logged in at some terminal all the time. It’s intended for laptop computers and home PCs where only one person is likely to be using the machine.
Annotations
The weblog program I wrote for julie. This one has the features that it’s all written in C, it uses static pages for all content, it provides syndication feeds in both RSS 2 and Atom 0.3 format, and it uses the web server authorisation system for user security. It’s not either complete or documented yet, so it’s still a work in progress, but it’s a work in progress that I’m actually using.
Automod
Sources to the automatic moderation robot I wrote for the newsgroup soc.singles.moderated. I wrote the ‘bot as a contract and the current production version has diverged from it, but I ran the newsgroup on gehenna for about 3 months with this code.
Chedit
A character set editor for linux
Configure
My remake of the GNU autoconf program. The big differences here (aside from the trivial things like the size of the contributerbase and the detail that it works on non-gnu machines) are that configure is a pure shell program, it’s released under a BSD-style license, and it doesn’t require loading a great long GNU toolchain to work.
Cron

The copy of Vixie-cron on pell kept falling over every 100 days or so. I looked briefly at it, but couldn’t find a screamingly obvious reason. So I threw it out and wrote my own.

Cron is a mainly vixie- and posix- compatable cron daemon; it falls short by not supporting the traditional system crontab (in /etc/crontab? Maybe /usr/share/crontab?) and not supporting some of the fancier aspects of the vixie-cron crontab format (no symbolic names for days of the week or months, no fancy parsing of environment variables,) but it makes up for it by being much smaller, and, at least to me, easier to read.

Cwatch
Cwatch is a log watcher much like the well-known swatch utility. Unlike swatch, cwatch is written in lex, yacc, and C, so it can run on a system that doesn’t have perl (or, as in my case, on a system where I don’t have the dynamic linking capacity that modern versons of perl require.)
Discount
My implementation of John Gruber’s Markdown markup language. This implementation is written in C, so I can use it without having to install a modern vanity language.
Gatekeeper
This is a lightweight firewall that runs on a webshield kernel and blocks tcp connections. It’s not the best firewall on the planet, because an intruder can still find out what ports are listening on the other side of the firewall, but it does the trick. This code is all BSD-licensed, so it doesn’t come with any nasty strings attached.
Init
I reinvented the wheel, again, and wrote my own version of init to ship with Mastodon. It’s not a complete clone of all of the other inits out there (except for the netbsd init, which it predates), but it
  1. contains an internal services database, so rc scripts can be registered with init for easier shutdown later.
  2. Uses runlevels h,s,r,m (halt, singleuser, reboot, multuser) instead of the conventional 0-9 levels than the System V init uses.
  3. Has a slightly modified inittab format that does not contain line tags – it’s just runlevel:when:what.
Levee
A teeny (37k on Mastodon) and ancient (ca 1981) vi clone that I’m still using on a variety of platforms ranging from Mastodon to MacOS.
Magicfilter
This is a multipurpose printer filter program that H. P. Anvin wrote several years ago. In 1999, he lost interest and I volunteered to take it over. Magicfilter uses libfile to do file type checking and m4 as a printr file preprocessor, plus it uses a much more compact printer filter language than 1.2 did.
Mastodon Tools
The installer, admintool, the X configurator, and a collection of utilities used in Mastodon Linux.
Ndialog

My replacement for libdialog. It’s smaller, less kludgy, and slightly more flexible. I built it against ncurses, and have modified it since then so that it will also work with BSD curses (with arrow and function key support) and so it’s slightly portable; these days I can build it on Mastodon against BSD curses or ncurses, and FreeBSD against ncurses.

The cloud around this silver lining is that it’s not documented very well, and it hasn’t been maintained for six years because I’ve not been working on the Mastodon installer.

Postoffice
Bothered by spam? Don’t want to upgrade your machine to modern libraries and load up a new copy of a big fancy SMTP server to deal with spam? You can do what I did and write your own, or you can use this one that I cranked out in a month of evenings, and which only has a couple of missing bits of functionality.
pstree
My reimplementation of the Linux pstree utility. This is not just a case where I reinvented the wheel because I could – no, I wanted a pstree that would work across all of the platforms I use (Linux, FreeBSD, and MacOS) without having to deal with the BSD ports system.
Quick Hacks
One evening coding projects; reimplementing code that I find useful and which doesn’t yet exist on Mastodon.
Ravel and unravel
Encode and decode mime documents. They were originally part of Mastodon , but have been split out and configured so I can build them on other platforms.
Roll the I-Ching

This program was originally an Ada program that I got from an Ada BBS in Madison, Wisconsin, and rewrote in Pascal on the Terak. From the Terak, it was converted into a C program on the Atari ST, finally migrated to the IBM PC, then was forgotten about for almost a decade starting on Nov 8, 1992 (which was sometime around the point where I quit dual-booting DOS and Linux).

But now that I’ve rediscovered it, it’s going into Mastodon as a productivity tool.

Rgrep
A clone of the SLang rgrep program that uses curses instead of slang. I wrote it after stumbling over trying to port the SLang rgrep forward to a modern commercial linux and having it fail horribly because the development library package was incomplete. I was thinking about what to do for this problem one weekend, and realized that if you struck the regular expression language the rest of the program was very simple to write. So I grabbed a copy of Henry Spencer’s BSD-regex library, modified it so it looked more like the SLang RE library, and constructed a grep around it. After a few mishaps having to do with developing it on a Mac, I made it portable and published it here.
Savelogs
My reinvention of the log rotation wheel. It’s not much different than any of the other log aging programs out there, except I wrote it and it’s been designed so that I can feed it command scripts from standard input. This code is part of Mastodon, and was included as part of the first incarnation of the McAfee antiviral firewall WebShield, which I designed.
virtual domain tools
When I started to give people virtual domains on my servers, I soon discovered that there weren’t that many tools written (at least not very many tools written in the One True Language or that would be glued into sendmail) and so I needed to write them myself. Eventually, I dumped sendmail for Postoffice, so I migrated the tools over to postoffice, where I continue to use them today.
Xrpm
I needed to have a rpm extraction tool for Mastodon, because a lot of modern Open source®©™ software can only be found in rpm format. The reference implementation isn’t good for what I want, because it carries around a lot of baggage that I don’t need, so I spent an exciting week or so digging through the piteous documentation for the reference implementation and wrote my own, which just unpacks and packs with none of the other goop.

Here are a few things that I did not write, but have found useful at one time or another.

Login with tcp wrappers

The standard Linux login program, modified to use Weitse Venema’s tcp wrappers instead of /etc/securetty for allowing root logins.


Linux libc 4
Pell and Mastodon still use the old Linux a.out executable format (I’ve got some almost 15 year old Linux binaries on pell that work with libc 4.8.0, and I’m in no hurry to replace them just because I can. Mastodon uses a.out for kernel programs because it makes it a lot harder to drop a rootkit onto the system and because it insulates the system from whimsical gl*bc interface changes,) so I have to maintain the library because nobody else will.

Other older projects may be found in the archive, and some of my more horrible hackery is kept in the partsbin in case I want to salvage useful snippets out of it.