Re: _SC_* gone?

Kai Henningsen (kai@khms.westfalen.de)
27 Jul 1996 09:50:00 +0200


ats@hubert.wustl.edu (Alan Shutko) wrote on 25.07.96 in <199607260408.XAA03395@hubert.wustl.edu>:

> >>>>> "CP" == Carlos Puchol <cpg@cs.utexas.edu> writes:

CP>> /* The following table is generated from all _SC_ values * in
CP>> unistd.h.

> Taking a look at <unistd.h>, I see:
>
> /* Get the `_PC_*' symbols for the NAME argument to `pathconf' and
> `fpathconf'; the `_SC_*' symbols for the NAME argument to
> `sysconf'; and the `_CS_*' symbols for the NAME argument to
> `confstr'. */
> #include <confname.h>
>
> Evidently, the sml tries to pull the values out, but doesn't follow
> the include. Even if they did, it probably wouldn't have worked
> since confname.h uses an enum to define them. I'm not sure how you
> could get them in an automated way....

Easy. Write a C program that #includes <unistd.h> (that is, it gets the
definitions the standard C way) and outputs whatever syntax you prefer,
like for exampel so:

#include <unistd.h>
#include <stdio.h>

main()
{
printf("_SC_OPEN_MAX = %d\n", (int)_SC_OPEN_MAX);
}

If you want to get at standardized constant definitions, that is a very
portable way to do it. It's a lot easier to get right than going through
the include files yourself.

MfG Kai