forked from lapo-luchini/asn1js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateRFC.sh
executable file
·35 lines (35 loc) · 933 Bytes
/
updateRFC.sh
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
28
29
30
31
32
33
34
35
#/bin/sh
RFCs="5280 5208 3369 3161 2986"
downloadRFC() {
URL="https://www.ietf.org/rfc/rfc$1.txt"
if [ -x /usr/bin/fetch ]; then
/usr/bin/fetch -m --no-verify-peer $URL
elif [ -x /usr/bin/wget ]; then
/usr/bin/wget -N --no-check-certificate $URL
elif [ ! -r dumpasn1.cfg ]; then
echo Please download $URL in this directory.
exit 1
fi
}
echo '{}' > rfcdef.json # start from scratch
mkdir -p rfc
cd rfc
for n in $RFCs; do
downloadRFC $n
../parseRFC.js rfc$n.txt ../rfcdef.json
done
cd ..
{
echo "// content parsed from the following RFCs: $RFCs"
cat - <<EOF
(typeof define != "undefined" ? define : function (factory) { "use strict";
if (typeof module == "object") module.exports = factory();
else window.rfcdef = factory();
})(function () {
"use strict";
EOF
echo -n "return "
cat rfcdef.json
echo ";});"
} > rfcdef.js
echo Conversion completed.