diff options
author | Rob Austein <sra@hactrn.net> | 2015-10-26 06:29:00 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2015-10-26 06:29:00 +0000 |
commit | b46deb1417dc3596e9ac9fe2fe8cc0b7f42457e7 (patch) | |
tree | ca0dc0276d1adc168bc3337ce0564c4ec4957c1b /buildtools/defstack.py | |
parent | 397beaf6d9900dc3b3cb612c89ebf1d57b1d16f6 (diff) |
"Any programmer who fails to comply with the standard naming, formatting,
or commenting conventions should be shot. If it so happens that it is
inconvenient to shoot him, then he is to be politely requested to recode
his program in adherence to the above standard."
-- Michael Spier, Digital Equipment Corporation
svn path=/branches/tk705/; revision=6152
Diffstat (limited to 'buildtools/defstack.py')
-rw-r--r-- | buildtools/defstack.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/buildtools/defstack.py b/buildtools/defstack.py index 757516f3..b3df0777 100644 --- a/buildtools/defstack.py +++ b/buildtools/defstack.py @@ -8,11 +8,11 @@ # code with code maintained by humans, so "nasty" is a relative term. # # Copyright (C) 2011-2012 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, @@ -68,7 +68,7 @@ template = ''' ''' if len(sys.argv) < 2: - sys.exit("Usage: %s source.c [source.c ...]" % sys.argv[0]) + sys.exit("Usage: %s source.c [source.c ...]" % sys.argv[0]) splitter = re.compile("[() \t]+").split @@ -76,16 +76,16 @@ token = None for line in fileinput.input(): - if token is None: - path = fileinput.filename().split(os.path.sep) - path = os.path.join(path[-2], path[-1]) if len(path) > 1 else path[-1] - token = "".join(c if c.isalnum() else "_" for c in path.upper()) - sys.stdout.write(header.replace("%", token)) + if token is None: + path = fileinput.filename().split(os.path.sep) + path = os.path.join(path[-2], path[-1]) if len(path) > 1 else path[-1] + token = "".join(c if c.isalnum() else "_" for c in path.upper()) + sys.stdout.write(header.replace("%", token)) - if "DECLARE_STACK_OF" in line: - words = splitter(line) - if len(words) > 1 and words[0] == "DECLARE_STACK_OF": - sys.stdout.write(template.replace("%", words[1])) + if "DECLARE_STACK_OF" in line: + words = splitter(line) + if len(words) > 1 and words[0] == "DECLARE_STACK_OF": + sys.stdout.write(template.replace("%", words[1])) if token is not None: - sys.stdout.write(footer.replace("%", token)) + sys.stdout.write(footer.replace("%", token)) |