From 727948e585cb133c32c8d42570e5524c58190307 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 4 Aug 2017 16:23:42 +0200 Subject: getopt32: factor out code to treat all args as options Working towards making getopt32() xmalloc-free function old new delta make_all_argv_opts - 58 +58 top_main 914 912 -2 getopt32 1517 1458 -59 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/2 up/down: 58/-61) Total: -3 bytes Signed-off-by: Denys Vlasenko --- include/libbb.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/libbb.h') diff --git a/include/libbb.h b/include/libbb.h index 46180c5aa..bb27c59a1 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1183,7 +1183,9 @@ extern const char *opt_complementary; extern const char *applet_long_options; #endif extern uint32_t option_mask32; -extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; +uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; +/* For top, ps. Some argv[i] are replaced by malloced "-opt" strings */ +void make_all_argv_opts(char **argv) FAST_FUNC; /* BSD-derived getopt() functions require that optind be set to 1 in * order to reset getopt() state. This used to be generally accepted * way of resetting getopt(). However, glibc's getopt() -- cgit v1.2.3