Source Code

These are some of the various programs I have written over the years,
and more importantly are some of the few I actually hold the copyright on. I've put them up here
so that someone else might benefit from them. They are distributed under the
BSD license.

All of the Un*x programs include makefiles that should work with both BSD make and/or GNU
make and have been tested under OpenBSD and all but mtu have been tested under Linux.
With the exception of portions of netsound they should be easily portable to other Unices.

Rqal or Richard's Quality Assurance Library is very portable, since one
of its main points is to let you write more portable code. It includes a Makefile, an Xcode project, and a Visual Studio Project( both .NET 2003 and .NET 2005).

Imagize, fav, and fetchurl are Windows applications and include Visual C++ 6 projects along with the source.

Eval and breed2 also include Visual C++ 6 projects, but just use iostream type input and output
and should easily build on Unix or whatever also.

RCI is designed to be portable, but has only been setup for Visual Studio .NET 2003 and thus you might have to play with it a little bit to get it running on something else, but it should be straightforward.

There is a handy source browser so you can see a pretty HTML version of all
the source without having to download anything

This is a collection of elementary utility programs that I keep around. If you are just learning to program in C then they would make good examples, otherwise don't bother downloading them unless you need what one of them does and are feeling too lazy to type it in yourself. Included is a program to convert all newlines in a text file to the UNIX variety, a utility to wrap text file lines, an exact match only version of the grep utility I wrote so that the executable would take up less space

Library to read and write an image format that uses a super-fast LZ derivative to provide a middle ground between RLE and full-on compression like zlib. Uses some image prefiltering techniques like PNG to improve compression. Includes test code for the library to convert between raw images files and the RCI format.

This is a library that provides very nice assertion handling, a convenient setup for exception handling, and a logging system. Additionally it provides a file object wrapper for some portable I/O, because I really don't get along with iostream.

This is a simple archiver(as in like tar). It works but reliably but featurewise is probably too braindead in a few ways for serious use. Would be a good start if you wanted to right one though, and is also a very good example for someone learning of various types of file operations in UNIX, such as stat(), chmod(), etc.

This is a collection of classes for genetic algorithms and some test/example code for them that solves a knapsack problem and finds a polynomial to fit a set of data points. The code is rather handy. It supports multiple population GA's with an operation that periodically mingles genomes across populations. The test code is setup so that it shows you a comparison of multiple and single population runs on the two test cases, and it makes quite apparent the advantage of multiple populations. Although this is provided with a Visual C++ project, the code should be perfectly portable.

Also available as just the source file, eval.cpp. This is a very simple calculator along the lines of a stripped down version of the dc program available on most Un*x systems. You enter numbers and operators in postfix (also known as reverse Polish notation) one on each line. When you enter "e" on a line, it prints the results. When you enter "q" it exits. It's purpose at the time I wrote it was as an example/test of parsing reverse Polish notation, which infix notation can be converted to fairly easily.

This is a handy utility that reads all of your Internet Explorer favorites and creates an HTML file of full of URL's based on them. This is extremely useful for periodically backing up your URLs in a portable format, and of course it would be a good example of reading Internet Explorer's bookbarks or of reading URL shortcut files in Windows which is how Internet Explore stores your bookmarks.

This is an example project for using wininet (which is installed with Internet Explorer 3.0 or later) to retrieve a file over HTTP. It's pretty darn simple once you see the example; it's only about a page of code.

This is a Win32 application that demonstrates inverse image transformations. Specifically it can rotate, scale, and translate a BMP in a window. This is a great straightforward example if you need to rotate or scale an image, though it does not do antialiasing. It's also a good example of how to read and write BMP files. It's also not a bad example of a basic Windows application with menus, translator handling, and file opening and saving dialogs. The BMP handling is based on code by my friend Kevin Etheridge.

This is a program to parse mbox format mail folders such as used by /bin/mail, Elm, and by Mozilla ThunderBird. It can print out summaries, entire messages, and it can filter messages based on wildcard matches against subject and sender. Mainly intended as an example but if you need to do something to your mail files this can be really handy. Tested with gcc on Linux and with Visual C 6.

This is the anorexic version of the standard ifconfig command. If you need to determine something programmatically about a networking interface such as the MTU or IP address, then this is for you. It's intended to be an example of the SIOCGIFCONF ioctl and is in fact the test program I wrote when figuring out how to use it. Figuring out is the correct term because it isn't a very well documented ioctl atleast in the man pages even though it's really fairly simple. I don't know how portable SIOCGIFCONF is, but it works on OpenBSD and FreeBSD atleast.

This is a fairly nifty but simple client/server for playing audio streams over the network. It has been quite a while since I used it but to the best of my memory it worked well in practice with the exception of a bit of a lag and an almost imperceptible hickup occasionally. It was originally written on Linux and is known to compile on OpenBSD 3.0, but I have not tested that it actually works on OpenBSD, because I no longer have two UNIX machines with sound cards at my house and the server is meant to read from line in. I would be very interested to hear (no pun intended) how this works on your systems.

PPS stands for packets per second, since printing that statistic as well as bytes per second for a specified network interface is the purpose of this program. It is implemented via libpcap and it was what I wrote to learn to use libpcap and thus should server as a very obvious example of doing so to anyone interested.

This program simply serves as an example of how to manually load and call a function from a UNIX shared library. Doesn't do anything but call printf from the main program and a function within a shared library, but it makes an easy to understand example.

Meme is a small interpreted language built using lex and yacc. It is a fairly complete but still simple example if you want to learn lex and yacc because it has all of the basic language control structures, but it has not been optimized at all.