On Fri, 17 Nov 2006 15:15:27 -0800 (PST) Don Cragun wrote:
> If you believe it is important for getconf to accept some of these with
> and without the leading underscore, let me know which ones you want and
> I'll file another RFE to add the missing synonyms.

thanks Don
Roland got me access to a solaris 11 sun4
now the only difference is
  VERSION synomym for POSIX_VERSION and _POSIX_VERSION
  _POSIX2_SYMLINKS synomym for POSIX2_SYMLINKS
these are not that important (from my side anyway)
they are provided by the builtin but not the underlying getconf

I've attached the test/comparison script I've been using
let me know if it looks like anything is missing
it tests "_" prefix or not and standard (e.g. POSIX or XOPEN) prefix or not

this checks that the builtin getconf covers valid names (and prefix 
permutations)
of /usr/bin/getconf names:

  $SHELL testgetconf.sh getconf /ust/bin/getconf

the output for the latest (unposted) version is:

           VERSION -              "199506"           DIAGNOSTICS
  _POSIX2_SYMLINKS /                   "1"           DIAGNOSTICS

this shows the differences between getconf and /usr/bin/getconf for the
union of names (and prefix permutations) of both (so it will include
non-standard builtin getconf extension names not provided by /usr/bin/getconf):

  $SHELL testgetconf.sh --diff getconf /ust/bin/getconf

and this shows the differences between /usr/bin/getconf and 
/usr/xpg4/bin/getconf:

  $SHELL testgetconf.sh --diff /usr/bin/getconf /usr/xpg4/bin/getconf

note that the builtin getconf for posted ksh93s- will show many diffs

-- Glenn Fowler -- AT&T Research, Florham Park NJ --

--- testgetconf.sh
# test if getconf implementation $1 covers getconf implementation $2
# --diff lists differences between implementations (coverage both ways)
# differences listed as
#       NAME PATH "TOP-VALUE" "BOT-VALUE"
# PATH - for no path specified, / for path specified
# DIAGNOSTIC for non-zero exit status

case $1 in
-d|--diff)
        diff=1
        shift
        ;;
*)      diff=0
        ;;
esac
case $# in
2)      ;;
*)      echo "Usage: $0 [ --diff ] getconf-implementation 
underlying-getconf-implementation" >&2
        exit 2
        ;;
esac
getconf=$1
underlying=$2
case $getconf in
*/*)    case $underlying in
        */*)    ;;
        *)      export PATH=${getconf%/*}:$PATH ;;
        esac
        ;;
*)      case $underlying in
        */*)    export PATH=${underlying%/*}:$PATH ;;
        esac
        ;;
esac

{
        case $diff in
        1)      $getconf
                $getconf -a
                ;;
        esac
        $underlying
        $underlying -a
} 2>/dev/null |
sed \
        -e 's/[:=].*//' \
        -e $'s/^_\\(.*\\)/&\\\n\\1/' \
        -e $'s/^[^_].*/&\\\n_&/' \
        -e $'s/^_*POSIX[2-9]*_\\(.*\\)/&\\\n_\\1\\\n\\1/' \
        -e $'s/^_*XOPEN[2-9]*_\\(.*\\)/&\\\n_\\1\\\n\\1/' \
        |
sort -u | {
tmp=/tmp/test.$$
trap "rm -rf $tmp.*" 0 1 2
while   read v
do
        for p in "" /
        do
                if      $underlying $v $p >$tmp.1
                then    bot_val=\"$(<$tmp.1)\"
                else    bot_val=DIAGNOSTICS
                fi
                if      $getconf $v $p >$tmp.1
                then    top_val=\"$(<$tmp.1)\"
                else    top_val=DIAGNOSTICS
                fi
                if      [[ $bot_val != $top_val ]]
                then    printf $'%34s %1s  %20s  %20s\n' "$v" "${p:--}" 
"$top_val" "$bot_val"
                fi
        done 2>/dev/null
done
}


Reply via email to