#ifdef CCOD #pragma CCOD:script no #endif #include #include #include #include #ifdef __CYGWIN__ #include #include #endif int main(void) { #if defined(__CYGWIN__) && CYGWIN_VERSION_API_MINOR < 262 void *libc = dlopen ("cygwin1.dll", 0); struct mntent *(*getmntent_r) (FILE *, struct mntent *, char *, int) = dlsym (libc, "getmntent_r"); #endif FILE *mtab = setmntent (_PATH_MOUNTED, "r"); int buflen = 256; char *buf = (char *) malloc (buflen); struct mntent mntent, *mntret; int i, len; while (((mntret = getmntent_r (mtab, &mntent, buf, buflen)) != NULL)) { len = 0; for (i = 0; i < 6; i++) len += printf ("%s ", buf + len); printf ("\n"); /* check that these are identical with the above */ printf ("%s %s %s %s %d %d\n", mntent.mnt_fsname, mntent.mnt_dir, mntent.mnt_type, mntent.mnt_opts, mntent.mnt_freq, mntent.mnt_passno); printf ("%s %s %s %s %d %d\n", mntret->mnt_fsname, mntret->mnt_dir, mntret->mnt_type, mntret->mnt_opts, mntret->mnt_freq, mntret->mnt_passno); } return 0; }