converted vinfo python script to full c program