1
0
Fork 0

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

View File

@ -12,6 +12,11 @@ git -C ../registry/ checkout master --quiet
git checkout master --quiet
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
if [ -d roa/.git/ ] ; then
git -C roa/ checkout master --quiet
@ -28,7 +33,7 @@ php rfc8416.php
if [ ! -d roa/ ] ; then mkdir roa ; fi
if [ ! -f roa/.git/config ] ; then
git -C roa/ init
if [ ! -f roa/README.md ; then
if [ ! -f roa/README.md ] ; then
touch roa/README.md
echo '## roas' | tee roa/README.md ; fi
git -C roa/ commit --allow-empty -m "Initial commit"