C linux program to detect what a file is, scan and extract a file for sub-files and unpack archives