Fix send_file operation on MacOS X, which used to crash (reported and pinpointed by LarsF and Egan Ford). In the process, use basename() in a more portable way.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
In configure.ac, depend on libpng instead of "libpng12", and add a bunch of CFLAGS from inside the configure script. Fix clang -Wdocumentation warnings.

Both changes are byproducts of multiple reports, the latest one being Egan Ford's.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Fix bugs which Clang warns about: wrong cable_model -> calc_model implicit conversion (due to copy & paste), a returned variable not initialized in a code path.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>