diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /misc/tst-mntent.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-zack/build-layout-experiment.tar glibc-zack/build-layout-experiment.tar.gz glibc-zack/build-layout-experiment.tar.bz2 glibc-zack/build-layout-experiment.zip |
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'misc/tst-mntent.c')
-rw-r--r-- | misc/tst-mntent.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c deleted file mode 100644 index b6ad8afcc6..0000000000 --- a/misc/tst-mntent.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Test case by Horst von Brand <vonbrand@sleipnir.valparaiso.cl> - and Ulrich Drepper <drepper@cygnus.com>. */ -#include <mntent.h> -#include <stdio.h> -#include <string.h> - - -static int -do_test (void) -{ - int result = 0; - struct mntent mef; - struct mntent *mnt = &mef; - FILE *fp; - - mef.mnt_fsname = strdupa ("/dev/hda1"); - mef.mnt_dir = strdupa ("/some dir"); - mef.mnt_type = strdupa ("ext2"); - mef.mnt_opts = strdupa ("defaults"); - mef.mnt_freq = 1; - mef.mnt_passno = 2; - - if (hasmntopt (mnt, "defaults")) - printf ("Found!\n"); - else - { - printf ("Didn't find it\n"); - result = 1; - } - - fp = tmpfile (); - if (fp == NULL) - { - printf ("Cannot open temporary file: %m\n"); - result = 1; - } - else - { - char buf[1024]; - - /* Write the name entry. */ - addmntent (fp, &mef); - - /* Prepare for reading. */ - rewind (fp); - - /* First, read it raw. */ - if (fgets (buf, sizeof (buf), fp) == NULL) - { - printf ("Cannot read temporary file: %m"); - result = 1; - } - else - if (strcmp (buf, "/dev/hda1 /some\\040dir ext2 defaults 1 2\n") != 0) - { - puts ("Raw file data not correct"); - result = 1; - } - - /* Prepare for reading, part II. */ - rewind (fp); - - /* Now read it cooked. */ - mnt = getmntent (fp); - - if (strcmp (mnt->mnt_fsname, "/dev/hda1") != 0 - || strcmp (mnt->mnt_dir, "/some dir") != 0 - || strcmp (mnt->mnt_type, "ext2") != 0 - || strcmp (mnt->mnt_opts, "defaults") != 0 - || mnt->mnt_freq != 1 - || mnt->mnt_passno != 2) - { - puts ("Error while reading written entry back in"); - result = 1; - } - } - - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" |