I've been digging through Apple's documentation and it seems that the contents of a icns file is identical to the contents of a icns resource fork. In other words icns file == icns resource in data fork.
I pointed to that program because it already contains decoders for icns and the other mac icon types. The only problem might be the license on the source code (QPL).
The best approach of course would be to find the spec for the icns format. Supposedly it's hidden in one of the old 'Inside Macintosh' documents, but so far I haven't been able to locate it.
From
this article it seems that Rez (the resource compiler) should come with a bunch of headers that define the structure of these resources. I don't have my mac with me here, so I'll check once I get home.