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