xref: /netbsd-src/sbin/route/keywords.sh (revision 4b896b232495b7a9b8b94a1cf1e21873296d53b8)
1#!/bin/sh
2# $NetBSD: keywords.sh,v 1.7 2003/07/19 01:36:47 jrf Exp $
3# @(#)keywords	8.2 (Berkeley) 3/19/94
4#
5# WARNING!  If you change this file, re-run it!
6
7# This program requires "new" awk (or GNU awk).
8awk=${AWK:-awk}
9
10cat << _EOF_ > _keywords.t1
11add
12atalk
13blackhole
14change
15cloned
16cloning
17delete
18dst
19expire
20flush
21gateway
22genmask
23get
24host
25hopcount
26iface
27interface
28ifa
29ifp
30inet
31inet6
32iso
33link
34llinfo
35lock
36lockrest
37mask
38monitor
39mtu
40net
41netmask
42nostatic
43osi
44prefixlen
45proto1
46proto2
47recvpipe
48reject
49rtt
50rttvar
51sa
52sendpipe
53show
54ssthresh
55static
56x25
57xns
58xresolve
59flushall
60_EOF_
61
62
63################################################################
64# Setup
65################################################################
66
67# This creates a stream of:
68#	keyword KEYWORD
69# (lower case, upper case).
70tr a-z A-Z < _keywords.t1 |
71paste _keywords.t1 - > _keywords.t2
72
73
74################################################################
75# Generate the h file
76################################################################
77exec > keywords.h
78
79echo '/* $'NetBSD'$ */
80
81/* WARNING!  This file was generated by keywords.sh  */
82
83extern struct keytab {
84	char	*kt_cp;
85	int	kt_i;
86} keywords[];
87
88' # defines follow
89
90$awk '{
91	printf("#define\tK_%s\t%d\n", $2, NR);
92}' < _keywords.t2
93
94
95################################################################
96# Generate the c file
97################################################################
98exec > keywords.c
99
100echo '/* $'NetBSD'$ */
101
102/* WARNING!  This file was generated by keywords.sh  */
103
104#include "keywords.h"
105
106struct keytab keywords[] = {
107' # initializers follow
108
109$awk '{
110	printf("\t{\"%s\", K_%s},\n", $1, $2);
111}' < _keywords.t2
112
113echo '	{0, 0}
114};
115' # tail
116
117
118################################################################
119# Cleanup
120################################################################
121
122rm -f _keywords.t1 _keywords.t2
123exit 0
124