diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-12-24 11:51:47 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2025-12-24 11:51:47 +0000 |
| commit | 50fd489b3dd53740ac2e2b024244b98967859d7b (patch) | |
| tree | 883a8488072573993090a00920695e0ee40666f6 /tools/help2c.sh | |
| parent | 97ed22b1bb075cb539e78fae2169ec56d3e8557b (diff) | |
| download | s6-frontend-50fd489b3dd53740ac2e2b024244b98967859d7b.tar.gz | |
Save before experimenting with help processing system...
Diffstat (limited to 'tools/help2c.sh')
| -rwxr-xr-x | tools/help2c.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/help2c.sh b/tools/help2c.sh new file mode 100755 index 0000000..5ce89e3 --- /dev/null +++ b/tools/help2c.sh @@ -0,0 +1,28 @@ +#!/bin/sh -e + +if test -z "$1" ; then + echo "$0: usage: $0 name < textfile > cfile" 1>&2 + exit 1 +fi + +echo '/* ISC license. */' +echo +echo '#include <unistd.h>' +echo +echo '#include <skalibs/buffer.h>' +echo '#include <skalibs/strerr.h>' +echo +echo '#include "s6-frontend-internal.h"' +echo +echo "void ${1}_help (char const *const *argv)" +echo '{' +echo " static char const *const ${1}_help_message =" + +sed 's/"/\\"/g; s/^/ "/; s/$/\\n"/' + +echo ' ;' +echo " if (!buffer_putsflush(buffer_1, ${1}_help_message))" +echo ' strerr_diefu1sys(111, "write to stdout") ;' +echo ' (void)argv ;' +echo ' _exit(0) ;' +echo '}' |
