view lib/t-idcache @ 17363:5a51fb7777a9

sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin Problem reported by Marco Atzeri in <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>. * lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]: Simply delegate to the system <sys/select.h> in this case too. Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to be needed on Solaris either. * lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]: Simply delgate to the system <sys/time.h> in this case.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 19 Mar 2013 09:08:47 -0700
parents 585bd9712fc1
children
line wrap: on
line source

#!/bin/sh
# Compare the two halves (user and group) of idcache.c.
# Once xformed, they'd better be the same:

pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15

srcdir=../..
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1

if test $framework_failure = 1; then
  echo "$0: failure in testing framework" 1>&2
  (exit 1); exit 1
fi

# Extract user-oriented functions.
perl -ne \
  'print if /^static struct.*user_alist/ .. /^static struct.*group_alist/' \
  $srcdir/idcache.c | head -n -3 > u
# Extract group-oriented functions.
perl -ne 'print if /^static struct.*group_alist/ .. eof' $srcdir/idcache.c > g

# Convert user-specific strings of "u" into corresponding group-specific strings
subst='
s/user_/group_/g;
s/\buser\b/group/g;
s/USER/GROUP/g;
s/\bu\b/g/g;
s/passwd/group/g;
s/pw_uid/gr_gid/g;
s/pwnam/grnam/g;
s/pwent/grent/g;
s/getpw/getgr/g;
s/pw_/gr_/g;
s/UID/GID/g;
s/uid/gid/g;
s/getuser/getgroup/;
s/login name/group name/;
s/to be the/to belong to/;
s/pwd fun/grp fun/;
'

fail=0
# Ensure that the transformed "u" is the same as g.
# Any differences here constitute an error.
perl -pe "$subst" u | diff -u - g || fail=1

exit $fail