If you are looking for an OS independent method of getting IP info then you might try what
tadman suggested to me thanks tadman. The netstat -r is apparently OS independant. It needs to be processed to pick them out but that looks reasonably easy. To be honest I havn't had a chance to try it yet (I'm waiting for a *nix head to email me the output it produces)