aboutsummaryrefslogtreecommitdiff
path: root/http-status-codes/extend.sh
blob: 91a600e5006ef5bccc72c1fe646146d76d1bed41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# Extend all IANA records with a C-style identifier in all-caps.
set -eu

TARGET="$1"
shift
cat "$@" > ${TARGET}

# There is a problem w/ some versions of recutils that signals
# error on rename from /tmp/FOO in recset(1).  Work around that
# by using current working directory as TMPDIR.
TMPDIR=`pwd`
export TMPDIR

n=100
while [ "$n" -le 599 ]
do
    VAL=`recsel -e "Value = $n" -P Description iana.tmp || true`
    CAPS=`echo ${VAL} | tr [a-z] [A-Z] | tr " -" "__"`
    recset -f Identifier -a "${CAPS}" -e "Value = $n" ${TARGET}
    n=`expr $n + 1`
done


# Apply fixes for records defined differently by MHD:
recset -f Identifier -s "SWITCH_PROXY" -e "Value = 306" ${TARGET}
recset -f Description -s "Switch proxy (not used)" -e "Value = 306" ${TARGET}