Fix minor typos

This commit is contained in:
netravnen 2020-02-03 15:18:07 +01:00
parent c72d089e75
commit ea61a63811
2 changed files with 9 additions and 17 deletions

View file

@ -20,9 +20,7 @@ function checkoutMaster ()
*/ */
function startsWith ($haystack, $needle, $length = "0") function startsWith ($haystack, $needle, $length = "0")
{ {
if ($length <= 0 || $length > (strlen ($needle))) if ($length <= 0 || $length > (strlen ($needle))) $length = strlen ($needle);
$length = strlen ($needle);
return (substr ($haystack, 0, $length) === $needle); return (substr ($haystack, 0, $length) === $needle);
} }
@ -35,10 +33,7 @@ function startsWith ($haystack, $needle, $length = "0")
function endsWith ($haystack, $needle) function endsWith ($haystack, $needle)
{ {
$length = strlen ($needle); $length = strlen ($needle);
if ($length == 0) return true;
if ($length == 0)
return true;
return (substr( $haystack, -$length) === $needle); return (substr( $haystack, -$length) === $needle);
} }
@ -85,8 +80,7 @@ function writeBirdConfig ($roas)
$source = $roa["ta"]; $source = $roa["ta"];
$mntby = $roa["mnt-by"]; $mntby = $roa["mnt-by"];
$bird_strng = "$prefix max $maxLength as $asn;"; $bird_strng = "$prefix max $maxLength as $asn; # $source/$mntby";
$bird_strng .= " # $source/$mntby";
$bird1_strng = "roa $bird_strng\n"; $bird1_strng = "roa $bird_strng\n";
$bird2_strng = "route $bird_strng\n"; $bird2_strng = "route $bird_strng\n";
@ -118,11 +112,8 @@ function writeBirdConfig ($roas)
function writeRoutinatorExceptionFile ($roas) function writeRoutinatorExceptionFile ($roas)
{ {
$json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_NUMERIC_CHECK); $json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_NUMERIC_CHECK);
$fp = fopen('roa/export_rfc8416_dn42.json', 'w'); $fp = fopen('roa/export_rfc8416_dn42.json', 'w');
fwrite($fp, $json); fwrite($fp, $json);
fclose($fp); fclose($fp);
} }
@ -135,13 +126,9 @@ function writeExportJSON ($roas)
$roas['roas'][$n]['maxLength'] = (int)preg_replace('/\D/', '', $roas['roas'][$n]['maxLength']); // Ensure unquoted integer $roas['roas'][$n]['maxLength'] = (int)preg_replace('/\D/', '', $roas['roas'][$n]['maxLength']); // Ensure unquoted integer
$n++; $n++;
} }
$json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); $json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$fp = fopen ('roa/export_dn42.json', 'w'); $fp = fopen ('roa/export_dn42.json', 'w');
fwrite ($fp, $json); fwrite ($fp, $json);
fclose ($fp); fclose ($fp);
} }

View file

@ -12,6 +12,11 @@ git -C ../registry/ checkout master --quiet
git checkout master --quiet git checkout master --quiet
git pull origin master:master --quiet --rebase git pull origin master:master --quiet --rebase
if ! [ -d roa/ ] ; then mkdir -p roa ; fi
for file in README.md {bird,bird4,bird6}_{route,roa}_dn42.conf export{_rfc8416,}_dn42.json ; do
if ! [ -f roa/$file ] ; then touch roa/$file ; fi
done
# Do the same for sub-repo if exists # Do the same for sub-repo if exists
if [ -d roa/.git/ ] ; then if [ -d roa/.git/ ] ; then
git -C roa/ checkout master --quiet git -C roa/ checkout master --quiet
@ -28,7 +33,7 @@ php rfc8416.php
if [ ! -d roa/ ] ; then mkdir roa ; fi if [ ! -d roa/ ] ; then mkdir roa ; fi
if [ ! -f roa/.git/config ] ; then if [ ! -f roa/.git/config ] ; then
git -C roa/ init git -C roa/ init
if [ ! -f roa/README.md ; then if [ ! -f roa/README.md ] ; then
touch roa/README.md touch roa/README.md
echo '## roas' | tee roa/README.md ; fi echo '## roas' | tee roa/README.md ; fi
git -C roa/ commit --allow-empty -m "Initial commit" git -C roa/ commit --allow-empty -m "Initial commit"