C running bare "mount" command in C

If a C program wants to find out which filesystems are mounted, it can fire up a subprocess, and in that subprocess run the "mount" command without any command line parameters; the parent process can then parse the subprocess's stdout, as one would read the result of typing "mount" on the command line.

I can do that. But is there a less ugly way to do this? (It's unfortunate we don't have /etc/mtab, but even that would involve parsing lines of characters, which it would be nice to avoid.)
 
Back
Top