perrin's REALLY OLD legacy pure c code (circa 1995...)