extend.sh (768B)
1 #!/bin/sh 2 # Extend all IANA records with a C-style identifier in all-caps. 3 set -eu 4 5 TARGET="$1" 6 shift 7 cat "$@" > ${TARGET} 8 9 # There is a problem w/ some versions of recutils that signals 10 # error on rename from /tmp/FOO in recset(1). Work around that 11 # by using current working directory as TMPDIR. 12 TMPDIR=`pwd` 13 export TMPDIR 14 15 n=100 16 while [ "$n" -le 599 ] 17 do 18 VAL=`recsel -e "Value = $n" -P Description iana.tmp || true` 19 CAPS=`echo ${VAL} | tr [a-z] [A-Z] | tr " -" "__"` 20 recset -f Identifier -a "${CAPS}" -e "Value = $n" ${TARGET} 21 n=`expr $n + 1` 22 done 23 24 25 # Apply fixes for records defined differently by MHD: 26 recset -f Identifier -s "SWITCH_PROXY" -e "Value = 306" ${TARGET} 27 recset -f Description -s "Switch proxy (not used)" -e "Value = 306" ${TARGET}