1 870210fb 2021-03-26 op BEGIN { 2 870210fb 2021-03-26 op print "static struct cmds { const char *cmd; void(*fn)(struct window*); } cmds[] = {"; 3 870210fb 2021-03-26 op } 4 870210fb 2021-03-26 op 5 870210fb 2021-03-26 op /^CMD/ { 6 870210fb 2021-03-26 op s = $2; 7 870210fb 2021-03-26 op sub("^cmd_", "", s); 8 870210fb 2021-03-26 op gsub("_", "-", s); 9 870210fb 2021-03-26 op printf("\t{ \"%s\", %s },\n", s, $2); 10 870210fb 2021-03-26 op next; 11 870210fb 2021-03-26 op } 12 870210fb 2021-03-26 op 13 870210fb 2021-03-26 op { 14 870210fb 2021-03-26 op next; 15 870210fb 2021-03-26 op } 16 870210fb 2021-03-26 op 17 870210fb 2021-03-26 op END { 18 870210fb 2021-03-26 op printf("\t{ NULL, NULL },\n"); 19 870210fb 2021-03-26 op print "};"; 20 870210fb 2021-03-26 op }