gwcheck

Check .gnu.warning.* sections in ELF object files
Log | Files | Refs | README | LICENSE

commit dbbdd4ce7f6b52d02515d64ae66a042da39b9f7b
parent b404e14c362e20b3ea6d90c55752a48aa111bc3c
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri,  5 Nov 2021 14:03:08 +0100

Validate program arguments and show usage if no input file is specified.

Diffstat:
Mgwcheck | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gwcheck b/gwcheck @@ -35,6 +35,14 @@ def usage(): def main(): try: + sys.argv[1] + except IndexError: + usage() + sys.exit(0) + else: + input = sys.argv[1] + + try: options, args = getopt.getopt(sys.argv[1:], "hv") except getopt.GetoptError as err: print(err) @@ -48,7 +56,7 @@ def main(): print("gwcheck 1.0.0") sys.exit(0) - with open(sys.argv[1], "rb") as input: + with open(input, "rb") as input: try: for section in ELFFile(input).iter_sections(): if section["sh_type"] == "SHT_PROGBITS":