0: Okay, this is a bit old, but I found it, and it was fun to do ;)) <BR>
1: SUN needed the configuration of our system, I could do it in C<BR>
2: but didn't feel like cutting and pasting everything:<BR>
3: <CODE>
4: #!/usr/bin/perl -w
5: use strict;
6:
7: my (@Variables,@Code);
8:
9: foreach (`man sysconf`)
10: {
11: s/^\s+//;
12: my $Var=(split /\s+/,$_,2)[0] or next;
13: next unless ($Var=~/^_[A-Z_]+$/o);
14: my $Cvar=lc $Var;
15: push @Variables,"long int $Cvar=sysconf($Var);";
16: push @Code,"printf(\"$Var set to: \%d\\n\",$Cvar);";
17: };
18: local $"="\n ";
19:
20: print << "PROGRAM";
21: #include <stdio.h>
22: #include <unistd.h>
23:
24: int main (argc,argv)
25: int argc;
26: char *argv[];
27: {
28: @Variables
29: @Code
30: }
31: PROGRAM
32: </CODE>
33: <BR>
34: Presto!!! redirect to getconf.c, compile, run, be happy....<BR>
35: <BR>
36: I have to add here that this code is NOT <BR>
37: very portable... In this case it didn't need to be... <BR>
38: It was short and worked ([jeroenes] posted an update here, and<BR>
39: I did some updating myself, so this should have made it a bit<BR>
40: more portable (for what I don't know though ;))<BR>
41: <BR>
42: You MAY run into gcc compiling errors, this is a result from labels in<BR>
43: the man page not being in your include file<BR>
44: delete those items ;))<BR>
45: <BR>
46: GreetZ!, <BR><UL>ChOas</UL><BR> In reply to Get your system configuration from a man page. by ChOas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |