While BSD 4.3 had several text based calculators, it didn't have anything that would just take a list of numbers and add them up. That's when I decided to use my budding C powers (pascal was the language of choice up until the year before), and write something to add numbers.
#include <stdio.h> #include <stdlib.h> #include <strings.h> main() { double numb; char c, *p, ixline[128]; int i; numb= 0.0, i= 0; while (fgets(ixline, 128, stdin)) { p= ixline ; while ((c= *p) && (' ' == c) || ('\t' == c)) p ++ ; numb+= atof(p), i++ ; } printf("summ [%d], %8.2f\n", i, numb); exit(0); }Pretty simple and pretty useful. I called it addl (for add line). Eats numbers up until EOL, and you can feed it from a unix pipe (like grep V ledg04 | cutu -f8- | addl) or just type right into the terminal. The handing thing about using it interactively, is that after you type a long list of numbers, you can go back and look at the list (like you would the paper tape) and spot mistakes pretty easy. Then you just restart addl and copy in the numbers that were fine and re-type the number that was wrong, and get the correct total.
Pretty impressive to have written a program 18 years ago that's still useful. (ok, so I'm easily impressed)
Feb '04
Oops I dropped by satellite.
New Jets create excitement in the air.
The audience is not listening.
Mar '04
Neat chemicals you don't want to mess with.
The Lack of Practise Effect
Apr '04
Scramjets take to the air
Doing dangerous things in the fire.
The Real Way to get a job
May '04
Checking out cool tools (with the kids)
A master geek (Ink Tank flashback)
How to play with your kids