Or you could use my “completely unsupported, don’t blame anyone if it doesn’t work” patch to rpc.cpp that adds listgenerated as a method. Pass it false (./bitcoind listgenerated false) to get only the unmatured coins. No argument or true gives a list of all coins. The interface is going to change, since a list of strings isn’t really the way RPC is supposed to work!
Of course, for that, you need to build from the SVN.
The latest version of the patch can always be found at http://www.alloscomp.com/bitcoin.