Anonymous user
Canonicalize CIDR: Difference between revisions
m
→{{header|REXX}}: changed a comment, updated example nodes.
(Add more examples.) |
m (→{{header|REXX}}: changed a comment, updated example nodes.) |
||
Line 434:
parse arg a . /*obtain optional argument from the CL.*/
if a=='' | a=="," then a= '87.70.141.1/22' , /*Not specified? Then use the defaults*/
'
'
'
'
'
do i=1 for words(a); z= word(a, i) /*process each IPv4 address in the list*/
Line 453 ⟶ 452:
##= left(##, 32, 0) /*replace cropped bits with binary '0's*/
do j=8 by 8 for 4 /* [↓] parse the four nodes of address*/
$= $ || . || b2d(substr(##, j-7, 8)) /*reconstitute the decimal nodes. */
end /*j*/ /* [↑] and insert a dot between nodes.*/
say /*introduce a blank line between IPv4's*/
Line 469 ⟶ 468:
canonicalized address: 87.70.140.0/22
original IPv4 address:
canonicalized address:
original IPv4 address:
canonicalized address:
original IPv4 address:
canonicalized address:
original IPv4 address:
canonicalized address:
original IPv4 address:
canonicalized address:
</pre>
|