From 7cebc41015841ff97fd02ae83bc7024bb982539a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 25 Jan 2026 12:44:41 +0100 Subject: Use a macro for all utils that do not take arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- common.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'common.h') diff --git a/common.h b/common.h index 9b30011..7e42a49 100644 --- a/common.h +++ b/common.h @@ -11,3 +11,20 @@ void writeall(const char *s, size_t n); void writechar(uint_least32_t cp); int convert(enum libcharconv_result (*conv)(const char *, size_t, size_t *, uint_least32_t *, size_t *)); + + +#define SIMPLE(FUNCTION)\ + USAGE("");\ + \ + int\ + main(int argc, char *argv[])\ + {\ + ARGBEGIN {\ + default:\ + usage();\ + } ARGEND;\ + if (argc)\ + usage();\ + \ + return convert(&FUNCTION);\ + } -- cgit v1.2.3-70-g09d2