Fix the INI parser.

Fix the INI parser (issue #123). If you don't like this implementation, there are two others in my repo. This one is (IMO) the most readable, and the most modifiable. There is another one that is faster (premature optimization, yada yada), and one that minimizes the changes to the source, but still behaves in slightly odd (but not "wrong") ways.

I apologize for the size of the patch-set.  The earliest commit included is just cleaning up a few string manipulation functions, since I was staring at string manipulation anyway.