class StringHandler(RenderHandler):
argtype = 'const char *'
decl = Template('const char *$varname = NULL;')
- code = Template('$varname = argv[_i]->arg;')
+ code = Template('$varname = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;')
drop_str = True
canfail = False
code = Template('_fail = !inet_aton(argv[_i]->arg, &$varname);')
class IP6Handler(IPBase):
argtype = 'struct in6_addr'
- decl = Template('struct in6_addr $varname = IN6ADDR_ANY_INIT;')
+ decl = Template('struct in6_addr $varname = {};')
code = Template('_fail = !inet_pton(AF_INET6, argv[_i]->arg, &$varname);')
class IPGenHandler(IPBase):
argtype = 'const union sockunion *'
filedata = clippy.parse(fn)
for entry in filedata['data']:
- if entry['type'] == 'DEFPY' or (all_defun and entry['type'].startswith('DEFUN')):
+ if entry['type'].startswith('DEFPY') or (all_defun and entry['type'].startswith('DEFUN')):
cmddef = entry['args'][2]
cmddef = ''.join([i[1:-1] for i in cmddef])
process_file(args.cfile, ofd, dumpfd, args.all_defun)
if args.o is not None:
- clippy.wrdiff(args.o, ofd, [args.cfile, os.path.realpath(__file__)])
+ clippy.wrdiff(args.o, ofd, [args.cfile, os.path.realpath(__file__), sys.executable])