summaryrefslogtreecommitdiff
path: root/examples/misc/swat.pl
blob: f43aea029a881073e9903e956696341e3207ae3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#! /usr/bin/perl5
##
## This is a simple script written by Herb Lewis @ SGI <herb@samba.org>
## for reporting which parameters where supported by loadparm.c but 
## not by SWAT I just thought it looked fun and might be of interest to others
## --jerry@samba.org
##

$lastone = "nothing";

if (@ARGV[0]) {
	$filename = @ARGV[0];
} else {
	$filename = "/usr3/samba20/samba/source/param/loadparm.c";
}

open (INFILE,$filename) || die "unable to open $filename\n";
while (not eof(INFILE))
{
	$_ = <INFILE>;
	last if ( /^static struct parm_struct parm_table/) ;
}
print "Option Name                     Global Page  Share Page  Printer Page\n";
print "---------------------------------------------------------------------";
while (not eof(INFILE))
{
	$_ = <INFILE>;
	last if (/};/);
	@fields = split(/,/,$_);
	next if not ($fields[0] =~ /^.*{"/);
	$fields[0] =~ s/.*{"//;
	$fields[0] =~ s/"//;
	if ($fields[3] eq $lastone) {
		print "     $fields[0]\n";
		next;
	}
	$lastone = $fields[3];
	$fields[2] =~ s/^\s+//;
	$fields[2] =~ s/\s+$//;
	$fields[2] =~ s/}.*$//;
	$fields[6] =~ s/^\s+//;
	$fields[6] =~ s/\s+$//;
	$fields[6] =~ s/}.*$//;
	if ($fields[2] =~ /P_SEPARATOR/) {
		print "\n****************$fields[0]\n";
		next;
	}
	else {
		if ($fields[6] =~ /FLAG_DEPRECATED/) {
			print "*$fields[0]".' 'x(31-length($fields[0]));
		}
		else {
			print "$fields[0]".' 'x(32-length($fields[0]));
		}
	}
	if (($fields[2] =~ /P_GLOBAL/) || ($fields[6] =~ /FLAG_GLOBAL/)) {
		if ($fields[6] =~ /FLAG_GLOBAL/) {
			print "*";
		}
		else {
			print " ";
		}
		if ($fields[6] =~ /FLAG_BASIC/) {
			print "BASIC       ";
		}
		else {
			print "ADVANCED    ";
		}
	}
	else {
		print " no          ";
	}
	if ($fields[6] =~ /FLAG_SHARE/) {
		if ($fields[6] =~ /FLAG_BASIC/) {
			print "BASIC       ";
		}
		else {
			print "ADVANCED    ";
		}
	}
	else {
		print "no          ";
	}
	if ($fields[6] =~ /FLAG_PRINT/) {
		if ($fields[6] =~ /FLAG_BASIC/) {
			print "BASIC";
		}
		else {
			print "ADVANCED";
		}
	}
	else {
		print "no";
	}
	print "\n";
}