BEncoded data dumper challenge
After talking a bit about BEncoding on IRC with ColonelJ today, I decided I'd make a quick C implementation of a tool that just dumps bencoded data into a human-readable form. When I mentioned that he immediately challenged me. After setting a few ground rules (C99, use stdin) we got started and after 2 hours he was done. My final result took more like 4 and a half hours. It is a state machine and has around 450 lines of code. ColonelJ's approach is just half as long and uses functions to handle dictionaries/lists and uses recursion to keep track of key/value ordering in dicts. Here's the results:
ColonelJ's Code and mine.