#!/usr/bin/python

import re, sys

f = open(sys.argv[1], 'r')
template = f.read()
f.close()

exts = []
regex = re.compile('strcasecmp\(\s*ext\s*,\s*"([^"]+)"\s*\)')
f = open(sys.argv[2], 'r')
for line in f:
    m = regex.search(line)
    if m is not None:
        exts.append( re.escape( m.group(1) ) )
f.close()

print template.replace( '%extensions%', ' '.join(exts) ),

