diff --git a/proj/intercept/src/intercept.c b/proj/intercept/src/intercept.c index d250777..542e304 100644 --- a/proj/intercept/src/intercept.c +++ b/proj/intercept/src/intercept.c @@ -1226,7 +1226,7 @@ int sym(getopt)(const int argc, char *const argv[], const char *shortopts) { else if_invalid(getopt) } const int ret = __real_getopt(argc, argv, shortopts); - msg("return %i", ret); + msg("return %i; optind %i", ret, optind); return ret; } diff --git a/proj/server/src/intercept/__init__.py b/proj/server/src/intercept/__init__.py index ca89eb8..a97ea2d 100644 --- a/proj/server/src/intercept/__init__.py +++ b/proj/server/src/intercept/__init__.py @@ -344,6 +344,10 @@ class Parser: other_vals = ret[1].strip() if len(ret) > 1 else '' ret_value, _ = Parser.parse_arg(ret[0][7:]) kwargs = {} + if other_vals.startswith('optind '): + ret = other_vals[7:].split(';', 1) + kwargs['optind'] = int(ret[0].strip()) + other_vals = ret[1].strip() if len(ret) > 1 else '' if other_vals.startswith('errno '): ret = other_vals[6:].split(';', 1) kwargs['errno'] = ret[0].strip() @@ -404,7 +408,7 @@ class Parser: def before_getopt(self, argc: int, argv: PointerTo[list[PointerTo[bytes]]], optstring: PointerTo[bytes]) -> str: raise NotImplementedError() def after_getopt(self, argc: int, argv: PointerTo[list[PointerTo[bytes]]], optstring: PointerTo[bytes], - ret_value: int) -> None: + ret_value: int, optind: int = None) -> None: raise NotImplementedError() def before_exit(self, status: int) -> str: raise NotImplementedError()