1#!/bin/sh 2# $OpenBSD: keywords.sh,v 1.34 2021/08/04 18:17:23 benno 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 49nameserver 50net 51netmask 52nobfd 53nojumbo 54nostatic 55ospf 56out 57pop 58prefixlen 59priority 60proto1 61proto2 62push 63recvpipe 64reject 65rip 66rtt 67rttvar 68sa 69sendpipe 70show 71sourceaddr 72ssthresh 73static 74swap 75_EOF_ 76 77 78################################################################ 79# Setup 80################################################################ 81 82# This creates a stream of: 83# keyword KEYWORD 84# (lower case, upper case). 85tr a-z A-Z < _keywords.t1 | 86paste _keywords.t1 - > _keywords.t2 87 88################################################################ 89# Generate the h file 90################################################################ 91exec > keywords.h 92 93echo '/* $'OpenBSD'$ */ 94 95/* WARNING! This file was generated by keywords.sh */ 96 97struct keytab { 98 char *kt_cp; 99 int kt_i; 100}; 101 102enum { 103 K_NULL,' 104 105$awk '{ 106 printf("\tK_%s,\n", $2); 107}' < _keywords.t2 108 109echo '}; 110 111struct keytab keywords[] = {' 112 113$awk '{ 114 printf("\t{ \"%s\",\tK_%s },\n", $1, $2); 115}' < _keywords.t2 116 117echo '}; 118' # tail 119 120 121################################################################ 122# Cleanup 123################################################################ 124 125rm -f _keywords.t1 _keywords.t2 126exit 0 127