This page includes various C programs and utilities that I've written over the years to help me manage serial ports on our machines. Most of this stuff will work on any Unix machine, but I have developed it on Suns (SunOS4, Solaris2), so you may need to do a little bit of porting in some cases.
printfile is a program I wrote to enable me to test serial printers. It sets the serial speed to 38400 by default. Optionally, you can set the port to 19200 or 9600 bps with switches. It takes the first non-baud argument as the port, and the second as the file, and then sends the file to the port specified. It provides an example of how to set the baud rate, and a minimum amount of line conditioning you could set for a serial printer and still have it print.
upsprobe shows an example of how to modify RS-232 lines directly via IOCTL. It allows you to toggle the various common RS-232 lines and test how a device behaves in their presence. As the name suggests, I designed it to help test some APC UPS's. We bought the plug + play variety at a significantly cheaper price, and I used this program to reverse engineer the response of the UPS so that we could use it to automatically shut down sun workstations after the power has been off for a while (and then automatically come back on when the power comes back up). (see ups for more information, and the software we use.)
While upsprobe lets you set and toggle the RS-232 lines, upsstat provides a nice tabular output of the same at 1 second intervals.
termio.c is a simple little program that just prints the current IO in octal for a tty. Give it the argument of your current tty to see what is set and what isn't. termio `tty` is a good example.
stermio.c is a program that could be used to reset your terminal settings to a reasonable default in an emergency. It's a little bit more radical than an stty sane. I've used it on a couple of occassions on a remote dial-up when I've been fiddling too much with my term settings and things get way out of hand. This program assumes you're on a standard 24 line VT-100 style terminal.