summaryrefslogtreecommitdiffstats
path: root/scripts/addheader.py
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2010-05-20 12:49:05 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2010-05-20 12:49:05 +0800
commitb1a91ad39f89efcaeb7bd01c3877b7fea0e6d1c7 (patch)
tree65b9d418979fb2774359b9e675949dee9d42dda3 /scripts/addheader.py
parentd52ce00ad6718933db0df16451a8ea0a9e15e505 (diff)
Add copyright header
Diffstat (limited to 'scripts/addheader.py')
-rw-r--r--scripts/addheader.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/addheader.py b/scripts/addheader.py
new file mode 100644
index 0000000..09e628e
--- /dev/null
+++ b/scripts/addheader.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+import sys
+
+def add_header(name, header):
+ with file(name) as fin:
+ lines = fin.readlines()
+ with file(name, "w") as fout:
+ for l in header:
+ print >> fout, l,
+ if lines[0].startswith("/*") and lines[0].endswith("*/\n"):
+ pass
+ else:
+ print >> fout, lines[0],
+ for l in lines[1:]:
+ print >> fout, l,
+
+def main():
+ with file("header") as f:
+ header = f.readlines()
+ for name in sys.argv[1:]:
+ add_header(name, header)
+
+if __name__ == "__main__":
+ main()