mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
30891f35fa
We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
81 lines
1.6 KiB
C
81 lines
1.6 KiB
C
#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"
|