ULTRIX 4.5 nawk does not always interpret a nonempty string as "true",
so install a workaround to the gen-cmdlist.awk script for this issue.
And fix the test suite which purports to test this command but failed
to notice that no useful help was printed.
-# Copyright © 2021 Nick Bowler
+# Copyright © 2021, 2023 Nick Bowler
#
# Hackjob to try and find all the relevant wordlist items from the gperf
# output, in order to produce (at runtime) a list of those commands, in
#
# Hackjob to try and find all the relevant wordlist items from the gperf
# output, in order to produce (at runtime) a list of those commands, in
-$1 == "char" && (id = get_stringpool_id($2)) {
+$1 == "char" && get_stringpool_id($2) {
sub(/[^"]*"/, "", $2)
sub(/".*/, "", $2)
sub(/[^"]*"/, "", $2)
sub(/".*/, "", $2)
-(id = get_stringpool_id($0)) && $0 ~ "cmd_" pool[id] {
- sub(/^stringpool_str/, "", id)
- indices[line] = id
+get_stringpool_id($0) && $0 ~ "cmd_" pool[ID] {
+ sub(/^stringpool_str/, "", ID)
+ indices[line] = ID
function get_stringpool_id(s)
{
if (sub(/.*stringpool_str/, "stringpool_str", s) && sub(/[,[].*/, "", s)) {
function get_stringpool_id(s)
{
if (sub(/.*stringpool_str/, "stringpool_str", s) && sub(/[,[].*/, "", s)) {
AT_SETUP([cdecl99 help command])
AT_SETUP([cdecl99 help command])
+AT_DATA([input],
+[[help
-AT_CHECK([cdecl99 -f input], [0], [stdout])
-AT_CHECK([sed -n '$p' stdout], [0], [type int
-])
+# Program to generate expected output based on src/execute.gperf
+AT_DATA([expout.sed],
+[[#n
+/^%%$/,/^%%$/ {
+ s/^exit.*//
+ s/,.*//p
+}
+$a\
+type int
+]])
+sed -f expout.sed "$srcdir/src/execute.gperf" >expout
+
+# Program to filter the help output to extract the command list from "help"
+# without any descriptions.
+AT_DATA([filter.sed],
+[[/^ /,$ !d
+/^ /d
+s/^ *\([^ ]*\).*/\1/
+]])
+
+AT_CHECK([LC_ALL=C cdecl99 -f input >stdout && sed -f filter.sed stdout],
+ [0], [expout])