From b74b974cfd1484fc4594ef6c4ab9897b0b94df87 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Wed, 29 May 2024 10:08:32 -0700 Subject: [PATCH] Introduce #include The normal getopt() function is bloated because it links printf(). This change exports the original authentic bsd getopt function, that cosmo's always used internally so cosmocc users don't need to include internals --- libc/isystem/tinygetopt.h | 1 + third_party/getopt/getopt.internal.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 libc/isystem/tinygetopt.h diff --git a/libc/isystem/tinygetopt.h b/libc/isystem/tinygetopt.h new file mode 100644 index 000000000..59b701162 --- /dev/null +++ b/libc/isystem/tinygetopt.h @@ -0,0 +1 @@ +#include "third_party/getopt/getopt.internal.h" diff --git a/third_party/getopt/getopt.internal.h b/third_party/getopt/getopt.internal.h index 9ef787473..faeb198f6 100644 --- a/third_party/getopt/getopt.internal.h +++ b/third_party/getopt/getopt.internal.h @@ -16,7 +16,7 @@ COSMOPOLITAN_C_START_ extern char *optarg; extern int optind, opterr, optopt, optreset; -int getopt(int, char *const[], const char *) paramsnonnull(); +int getopt(int, char *const[], const char *) paramsnonnull() libcesque; COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_GETOPT_H_ */