Saturday, June 22, 2019

My first FreeDOS utilities

On June 29, the FreeDOS Project will officially turn 25 years old! That's a major milestone by any reckoning, and to celebrate we're making June our FreeDOS celebration month.
Following up on the story of how FreeDOS got started, I mentioned that I wrote my own DOS extensions, and I re-used several of these as the first FreeDOS utilities.

When I made that first release, I made the naive assumption that FreeDOS would likely work in three separate teams: a Kernel team, a Shell team, and a Utilities team.

With that first assumption, I collected several of my DOS-alike commands into a single package called "Util." I assumed we would continue to add other programs to "Util" over time. In fact, everyone contributed their own programs independently; it didn't make sense to follow the "teams" model.

But let's go back and look at the original "Util" release. You can find this at ibiblio.

If the code looks amateurish, please remember that I was still a university physics student when I wrote these. I didn't have any real experience as a programmer. I had taught myself programming, and some of these early programs show that.

Util 1.0 included these utilities:

Used ANSI to clear the screen or set color. For example, cls white on blue would clear the screen and set the text colors to grey text on a blue background. Or cls bright yellow on cyan would do the same with bright yellow text on a cyan background.
The standard utility to display the date and allow the user to change it.
Erases one or more files or directories. Using /S would recursively delete subdirectories, but would ask first unless you added the /F option.
Locates a string in one or more text files and prints them. Using /C would simply count the lines that contained the string. The /I option ignored case sensitivity. /N numbered the displayed lines, and /V would "invert" the search to display lines that did not contain the string.
A viewer for Help files. This was intentionally similar to Unix man, and even used a HELPPATH variable to set the locations of the Help files, and PAGER to set the viewer program.
Displays one or more files, pausing at each screenful. A pretty simple program.
Displays a prompt to the screen and waits for the user to press a key before it exits. The /R option returned the key pressed as an ASCII code.
A program to do a "warm" or "cold" reboot of the computer. Based on public domain code from Mike O'Carroll.
Similar to Unix tee, this acts as a filter and saves a copy of its input to a file, while also printing to standard output. Looking at this years later, there are much simpler ways to write this program.
Similar to DATE, the standard utility to display the current time and allow the user to change it.
This is one of those programs that started out as an extended DOS program I'd written for myself, then repurposed it for FreeDOS. The standard TYPE command displays a text file. This version of TYPE can also number the output with the /N option, or squeeze together non-blank lines using /S. You can show special characters, such as control characters with the /C option, ends of lines with the /E option, and tabs using /T. The /A ("All") option was the same as /N/C/E/T. And you can convert case: change everything to uppercase using /U and to lowercase using the /L option.
Converts a text file from Unix format to DOS format. This was especially useful for me because I was working in Linux most of the time, and booting into MS-DOS to run the applications that I needed. Converting text files was very handy.
A simple utility to display a hard-coded version number of the FreeDOS utilities. Since this was very early in FreeDOS history, the project was still called "Free-DOS" (with the hyphen).

There's a code comment that developers should refer to us as "Free-DOS" and not "FreeDOS" because another group got started about the same time as us (a few days after us, I think) and used the name "Freedos." Their project had different goals; I don't remember exactly, but I think they wanted to write everything in Assembly, and I wanted to be more flexible. We standardized on C and Assembly for any FreeDOS "Base" utilities, and generally let developers choose their own programming language for other extended utilities.
There's lots more history to share, and throughout June I hope to write about FreeDOS history and various milestones. Please join me in making June our FreeDOS celebration month!

1 comment:

Note: Only a member of this blog may post a comment.