On Fri, Jul 26, 2013 at 12:14:08PM +0100, Nick wrote: > On Fri, Jul 26, 2013 at 01:51:01PM +0300, sin wrote: > > Incorporated Steve's changes as well to make it compile/work > > on OpenBSD. I realize #ifdef's are terrible but for now it should > > do the trick until we come up with a proper solution to this. > > Is there really no sensible way to get the required information for > most POSIXish systems? How does coreutils do it (I expect tons of > way more awful ifdefs than you've done here, but it's worth > checking)?
No idea, I have not looked at the coreutils code. Will check it out. > I wonder what the right approach for utilities that can't be made > portable should be? Are there any others that are likely to have > these problems? If the build system can switch between between say Linux ops and OpenBSD ops then we could have something like os/openbsd.c and os/linux.c (for things that are not portable between them). Then the df.c code can just call a function that will be implemented by both OSes (with the same signature etc.). The number of tools that might require this glue code is less than 2% of the overall number of tools. So maybe leaving the #ifdef's for now is enough until we encounter other situations as well? Thanks, sin