Tuesday, January 4, 2011

Wrong Tool

Recently, I had cause to write a program that needed to create networking rules. This means having to ass-around with doing network/netmask/broadcast calculations. I so infrequently code that, my least-iffy coding skill-set is with UNIX shell scripts. Unfortunately, string handling and mathematical operations are onerous, at best, in these types of programs.

After a number of hours of fighting it, I finally decided to take a break from my self-imposed ordeal. Perhaps a bourne shell script is not the best way to write a CIDR calculator?

In the end, I woke up ass early in the morning, having had an epiphany on how to solve the problem. Mostly, it involved completely avoiding having to do the calculations and decimal/binary/octal conversions. C'est la vie.

No comments:

Post a Comment