#include <linux/fs.h>
#include <sys/mount.h>
#include <stdlib.h>

int nfsmount(const char *spec, const char *node, int *flags,
            char **extra_opts, char **mount_opts);

int doMount(char * dev, char * where, char * fs, int rdonly) {
   char * buf = NULL;
   int isnfs = 0;
   char * mount_opt = NULL;
   long int flag;
   char * junk = NULL;
   int morejunk = 0;

   if (strcmp(fs, "nfs")) return 1;

   buf = dev;
   printf("calling nfsmount(%s, %s, &morejunk, &junk, &mount_opt)",
               buf, where);

   nfsmount(buf, where, &morejunk, &junk, &mount_opt);

   flag = MS_MGC_VAL | MS_RDONLY;

   if (mount(buf, where, fs, flag, mount_opt)) {
       printf("mount failed\n");
       return 1;
   }

   return 0;
}

int main (void) {
   doMount("porky.redhat.com:/mnt/alpha", "/mnt", "nfs", 1);
}