Move operating system detection to input.h so that other programs can
benefit from this change.
Define a structure for the hardware paramters and a function to read them
from a configuration file.

Use this function in set_mode() and the structure.
Define a function to initialize the GPIO hardware (under FreeBSD).
Use this function in set_mode().
Cosmetic changes: infile -> datafile and printf()/strerror() -> perror()
No need to use a bogus value '2' for oldval.
Woops, return the file descriptor if init_hardware() was successful.
Add a simple test program to read the GPIO signal.

The program reads the sampling frequency and GPIO pin number from
hardware.txt. It displays a new line and resets the LOW and HIGH counters
when a LOW->HIGH (new second) slope occurs.

Returns either all LOW or garbage on my hardware...
Don't say we have no hardware...
Connect readpin to the all and clean targets.