xref: /openbsd/sbin/route/keywords.sh (revision 097a140d)
1#!/bin/sh
2# $OpenBSD: keywords.sh,v 1.33 2020/10/29 21:15:26 denis Exp $
3# $NetBSD: keywords.sh,v 1.2 1996/11/15 18:57:21 gwr Exp $
4# @(#)keywords	8.2 (Berkeley) 3/19/94
5#
6# WARNING!  If you change this file, re-run it!
7
8# This program requires "new" awk (or GNU awk).
9awk=${AWK:-awk}
10
11# the following must be sorted
12cat << _EOF_ | sort > _keywords.t1
13add
14bfd
15blackhole
16bgp
17change
18cloning
19connected
20del
21delete
22dst
23exec
24expire
25flush
26gateway
27get
28host
29hopcount
30iface
31interface
32ifa
33ifp
34in
35inet
36inet6
37jumbo
38label
39link
40llinfo
41local
42lock
43lockrest
44monitor
45mpath
46mpls
47mplslabel
48mtu
49net
50netmask
51nobfd
52nojumbo
53nostatic
54ospf
55out
56pop
57prefixlen
58priority
59proto1
60proto2
61push
62recvpipe
63reject
64rip
65rtt
66rttvar
67sa
68sendpipe
69show
70sourceaddr
71ssthresh
72static
73swap
74_EOF_
75
76
77################################################################
78# Setup
79################################################################
80
81# This creates a stream of:
82#	keyword KEYWORD
83# (lower case, upper case).
84tr a-z A-Z < _keywords.t1 |
85paste _keywords.t1 - > _keywords.t2
86
87################################################################
88# Generate the h file
89################################################################
90exec > keywords.h
91
92echo '/* $'OpenBSD'$ */
93
94/* WARNING!  This file was generated by keywords.sh  */
95
96struct keytab {
97	char	*kt_cp;
98	int	kt_i;
99};
100
101enum {
102	K_NULL,'
103
104$awk '{
105	printf("\tK_%s,\n", $2);
106}' < _keywords.t2
107
108echo '};
109
110struct keytab keywords[] = {'
111
112$awk '{
113	printf("\t{ \"%s\",\tK_%s },\n", $1, $2);
114}' < _keywords.t2
115
116echo '};
117' # tail
118
119
120################################################################
121# Cleanup
122################################################################
123
124rm -f _keywords.t1 _keywords.t2
125exit 0
126