|
Atrinik Client 2.5
|
00001 # Script to adjust prototype declarations file after it's been created. 00002 00003 import sys 00004 00005 if len(sys.argv) < 2: 00006 sys.exit(0) 00007 00008 # Open the passed file and read all the lines. 00009 f = open(sys.argv[1], "r") 00010 lines = f.readlines() 00011 f.close() 00012 00013 # Re-open it in writing mode, truncating it, and re-add the lines. 00014 f = open(sys.argv[1], "w") 00015 00016 for line in lines: 00017 # Line has format specifiers, adjust it. 00018 if line.find(", ...);") != -1: 00019 commas = line.count(", ") 00020 line = line.replace(", ...);", ", ...) __attribute__((format(printf, {0}, {1})));".format(commas, commas + 1)) 00021 00022 f.write(line) 00023 00024 f.close()
1.7.4