Skip to main content

source code

Source code ...

Posted in

I have added a page containing some of the source code I have written over the years. I just have three little utilities up there for now, but I will continue to add to the archive as time allows.

My Source Code

My Source Code

I have written many utilities over the years, some that I use everyday and others were just for educational purposes. The following are some of them. As I prepare others for distribution, I will add them to this list.

The vast majority of these are console based and assist me in my daily development work. I have worked from a console since the early '80s (Commodore, Apple, IBM) and I do so even to this day, whether on Windows, Linux or one of the other Unix-based systems I work on.

Instructions on how to build the sources are included in the header at the top of the main source file. Some build instructions may be included in the text below as well.

Note: The dates provided below denote when the source was made available via this page. The vast majority of these were written in the 80's and 90's.

Cross-platform ANSI C

This first set are utilities are written in ANSI C. As such, they can be compiled on virtually any system that has an ANSI C compiler. They have been tested on both Windows and Linux with build commands using at least the options below. The actual build commands used are documented in the header at the top of the main source file.

Windows > cl /Za /Ox /W4 {app}.c
Linux > gcc -Wall -ansi -O3 -pedantic -o {app} {app}.c

calc.c -- 2011.02.22
I wrote this utility to allow me to perform calculations from the command line at a time when there was no such "free" utility in a DOS environment. The parser was based upon code from a book I have long since forgotten.
num.c -- 2011.02.22
I wrote this utility to allow me to convert a value between the common bases used in programming, decimal, hex, octal and binary. Again, this was written many years ago when there were no such utilities freely available.
cvtbase.c -- 2011.02.22
This is an expansion of the num utility above. This allows me to convert a value from/to any base I specify (from base 2 to base 62).
nf.c -- 2012.07.02
I wrote this utility in response to a challenge posted in the "Plain Old C Programming" group on LinkedIn. I responded to the challenge more because of my interest in math than anything else. You can execute "nf test" to run the set of tests designed to validate the functionality of the conversion algorithm.

The following are implementations intended for use in other programs. They are a stack implementation and an array implementation written in ANSI-C.

Using C++ in development was a huge topic of discussion in the early 90's. I wrote these in response to that discussion as an example of how one could create a class in ANSI C. The first parameter of each function call (STACK_DATA_S * in stack.c or ARRAY_DATA_S * in array.c) is equivalent to the this pointer used in C++. I was writing this type of code on the job and had been for many years. Yes, there was no type-checking and templates (created later) makes it much easier to implement stacks, arrays and other similar objects in C++. Still, these are just as useful today as they were when I originally wrote them.

stack.c -- 2011.05.14
This is a stack implementation written in ANSI-C that can be used in other programs. It uses a void pointer for storage allowing one to store any type of data, from a single byte to a complex data structure. The test application demonstrates its usage.
array.c -- 2011.05.16
This is an array implementation written in ANSI-C that can be used in other programs. It uses a void pointer for storage allowing one to store any type of data, from a single byte to a complex data structure. The test application demonstrates its usage.

Yes, I know, C already supports arrays and does quite well with it. However, if you look at the array_find function, you can get an idea of how this class could be easily expanded. For example, as an exercise for yourself, add an array_sort function using a user-supplied comparison function.

Network Testing

pscan.c -- 2011.03.23
This is a cross-platform utility to send raw IP protocol packets. I use it to verify that our network security product handles the various IP protocols correctly.
ipwsvc.c -- 2011.03.23
This is a utility to monitor IP address changes that occur on a Windows system. This utility was written for a customer in an effort to diagnose issues we were seeing with handling IP address changes.
udp_echo_client.c -- 2013.01.01
This code demonstrates how one can use bsd-style sockets on both Windows and Linux. It is a simple UDP echo client that will send one or more messages to a UDP echo server and display the responses it receives (which should be the message sent, hence "echo").

Assembly

The following were written mainly to keep my general assembly knowledge current. One of my main responsibilities in my current position is to diagnose and solve critical customer issues. This often involves analyzing crash dumps on various platforms (Windows, Linux, Solaris and other Unix-based systems) where symbols may not be available and knowing how to read the assembly is paramount.

chaos.asm -- 2011.03.23
This is a demonstration of the Sierpinski triangle.
rot13.asm -- 2011.03.23
This is a simple utility to apply the ROT13 algorithm on data from stdin and output the results to stdout.