2024-03-11 10:46:40 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -uo pipefail
|
|
|
|
|
|
|
|
if grep ' ' index.txt | grep -E -v '^[^ ]+ [^ ]+ [^ ]+ [^ ]+$$'; then
|
|
|
|
echo 'bad lines in rfc/index.txt'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-09-14 21:53:21 +03:00
|
|
|
for number in $(sed -n 's/^\([0-9][0-9]*\)[ ].*$/\1/p' index.txt); do
|
2023-01-30 16:27:06 +03:00
|
|
|
if ! test -f "$number"; then
|
|
|
|
curl https://www.rfc-editor.org/rfc/rfc$number.txt >$number || rm $number
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2024-09-14 21:53:21 +03:00
|
|
|
for name in $(sed -n 's/^\([0-9][0-9]*-eid[0-9][0-9]*\)[ ].*$/\1/p' index.txt); do
|
2023-01-30 16:27:06 +03:00
|
|
|
if ! test -f "$name"; then
|
|
|
|
rfc=$(echo $name | cut -f1 -d-)
|
|
|
|
eid=$(echo $name | cut -f2 -d-)
|
|
|
|
curl https://www.rfc-editor.org/errata/$eid | go run errata.go >$name || rm $name
|
|
|
|
fi
|
|
|
|
done
|