#!/usr/bin/env python

import commands
import os
import re

dlist = os.listdir('/')

for v in dlist:
    if v != 'sys' and v != 'etc' and v != 'proc' and v != 'var' and v != 'dev' and v != 'mnt' and v != 'sbin' and v != 'media' and v != 'tmp' and v != 'root' and v != 'boot':
        line = commands.getoutput('find /%s -name fitsio.h' % v)
        list = line.split('\n')
        for v2 in list:
            if re.search('fitsio.h', v2):
                print v2
                f = open(v2)
                for linef in f:
                    if re.search("CFITSIO_VERSION", linef):
                        vv = linef[:-1].split()
                        print vv[1], vv[2]
                f.close()

