Okay, this is a bit old, but I found it, and it was fun to do ;))
SUN needed the configuration of our system, I could do it in C
but didn't feel like cutting and pasting everything:
#!/usr/bin/perl -w use strict; my (@Variables,@Code); foreach (`man sysconf`) { s/^\s+//; my $Var=(split /\s+/,$_,2)[0] or next; next unless ($Var=~/^_[A-Z_]+$/o); my $Cvar=lc $Var; push @Variables,"long int $Cvar=sysconf($Var);"; push @Code,"printf(\"$Var set to: \%d\\n\",$Cvar);"; }; local $"="\n "; print << "PROGRAM"; #include #include int main (argc,argv) int argc; char *argv[]; { @Variables @Code } PROGRAM
Presto!!! redirect to getconf.c, compile, run, be happy....

I have to add here that this code is NOT
very portable... In this case it didn't need to be...
It was short and worked ([jeroenes] posted an update here, and
I did some updating myself, so this should have made it a bit
more portable (for what I don't know though ;))

You MAY run into gcc compiling errors, this is a result from labels in
the man page not being in your include file
delete those items ;))

GreetZ!,