1#!/bin/sh 2# $NetBSD: keywords.sh,v 1.6 2001/01/27 04:51:17 itojun 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 59_EOF_ 60 61 62################################################################ 63# Setup 64################################################################ 65 66# This creates a stream of: 67# keyword KEYWORD 68# (lower case, upper case). 69tr a-z A-Z < _keywords.t1 | 70paste _keywords.t1 - > _keywords.t2 71 72 73################################################################ 74# Generate the h file 75################################################################ 76exec > keywords.h 77 78echo '/* $'NetBSD'$ */ 79 80/* WARNING! This file was generated by keywords.sh */ 81 82extern struct keytab { 83 char *kt_cp; 84 int kt_i; 85} keywords[]; 86 87' # defines follow 88 89$awk '{ 90 printf("#define\tK_%s\t%d\n", $2, NR); 91}' < _keywords.t2 92 93 94################################################################ 95# Generate the c file 96################################################################ 97exec > keywords.c 98 99echo '/* $'NetBSD'$ */ 100 101/* WARNING! This file was generated by keywords.sh */ 102 103#include "keywords.h" 104 105struct keytab keywords[] = { 106' # initializers follow 107 108$awk '{ 109 printf("\t{\"%s\", K_%s},\n", $1, $2); 110}' < _keywords.t2 111 112echo ' {0, 0} 113}; 114' # tail 115 116 117################################################################ 118# Cleanup 119################################################################ 120 121rm -f _keywords.t1 _keywords.t2 122exit 0 123