2 * Copyright © 2021 Nick Bowler
4 * Helper functions for formatting --help program output.
6 * License WTFPL2: Do What The Fuck You Want To Public License, version 2.
7 * This is free software: you are free to do what the fuck you want to.
8 * There is NO WARRANTY, to the extent permitted by law.
17 * Print an option string describing the short option character (if any),
18 * the long option name, and the argument name (if applicable). The argument
19 * name is localized (if NLS is enabled). If the string width is more than
20 * l columns, a newline is printed and 0 is returned. Otherwise, a newline
21 * is not printed and the string width (in columns) is returned.
23 int help_print_optstring(const struct option *opt, const char *argname, int l);
26 * Print an option description with each line indented. The string is first
27 * localized (if NLS is enabled). The first line will be indented by i-w
28 * spaces (to account for the cursor being in some other column), all other
29 * lines are indented by i spaces.
31 void help_print_desc(const struct option *opt, const char *desc, int i, int w);
33 static inline void help_print_option(const struct option *opt,
34 const char *argname, const char *desc,
40 help_print_desc(opt, desc, w,
41 help_print_optstring(opt, argname, w-2));