On Thu, 16 Nov 2006 10:06:55 -0500 James Carlson wrote:
> If there were just one standard, things would be much simpler. :-/
right, like one true windows (emoticon for barf)
I attached a test script that spans the xpg variants per <sys/features_tests.h>
the test output on a solaris 10 sun4 machine is
---
XPG=000 PASS_MAX=256 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
XPG=300 PASS_MAX=256 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
XPG=400 PASS_MAX=256 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
XPG=402 PASS_MAX=256 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
XPG=500 PASS_MAX=8 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
XPG=600 PASS_MAX=256
PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
bin PASS_MAX=256 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
xpg4 PASS_MAX=8 PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
xpg6 PASS_MAX=256
PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
---
there is a mismatch between xpg4 compiled user programs and
/usr/xpg4/bin/getconf
maybe I didn't get the feature test macros right for xpg4/xpg4v2?
could you run the script on a solaris 11 machine and post the output
it is getting a bit clearer:
a user application with PATH=$(getconf PATH) can use getconf to
check the parameters for any other utility/application on $PATH
but once PATH is modified, some utilities/applications may not
correspond to getconf
thanks
-- Glenn Fowler -- AT&T Research, Florham Park NJ --
---
cat > testconf.c <<'!'
/*
* Feature Test Macro Specification
* ------------------------------------------------ -------------
* _XOPEN_SOURCE XPG3
* _XOPEN_SOURCE && _XOPEN_VERSION = 4 XPG4
* _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2
* _XOPEN_SOURCE = 500 XPG5
* _XOPEN_SOURCE = 600 (or POSIX_C_SOURCE=200112L) XPG6
*/
#if XPG == 300
# define _XOPEN_SOURCE 1
#elif XPG == 400
# define _XOPEN_SOURCE 1
# define _XOPEN_VERSION 4
#elif XPG == 402
# define _XOPEN_SOURCE 1
# define _XOPEN_SOURCE_EXTENDED 1
#elif XPG == 500
# define _XOPEN_SOURCE 500
#elif XPG == 600
# define _XOPEN_SOURCE 600
#else
# undef XPG
# define XPG 0
#endif
#include <stdio.h>
#include <unistd.h>
int
main()
{
char buf[1024];
size_t n;
long v;
printf("XPG=%03d ", XPG);
v = sysconf(_SC_PASS_MAX);
printf("PASS_MAX=%-3ld ", v);
n = confstr(_CS_PATH, buf, sizeof(buf));
printf("PATH=%-*.*s\n", n, n, buf);
return 0;
}
!
for xpg in 000 300 400 402 500 600
do
case $xpg in
600) cc=c99 ;;
*) cc=cc ;;
esac
$cc -DXPG=$xpg -o testconf.exe testconf.c 2>/dev/null
./testconf.exe
done
for xpg in "" xpg4 xpg6
do
getconf=/usr
case $xpg in
"") xpg=bin ;;
*) getconf=$getconf/$xpg ;;
esac
getconf=$getconf/bin/getconf
printf '%7s PASS_MAX=%-3d PATH=%s\n' "$xpg" "$($getconf PASS_MAX)"
"$($getconf PATH)"
done