1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1-or-later
3set -eu
4
5# shellcheck disable=SC1004
6awk '
7    BEGIN {
8        print "%{\n\
9#if __GNUC__ >= 7\n\
10_Pragma(\"GCC diagnostic ignored \\\"-Wimplicit-fallthrough\\\"\")\n\
11#endif\n\
12%}"
13        print "struct key_name { const char* name; unsigned short id; };"
14        print "%null-strings"
15        print "%%"
16    }
17
18    /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
19    { print tolower($1) ", " $1 }
20' < "${1:?}"
21