diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-29 16:04:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:48:56 -0500 |
commit | 87fd7b5484b10ccdece6152f2a2a9adb4ea5fc78 (patch) | |
tree | d51e9094115a4717e6c29f0c95c112fd588756d3 /source4/librpc/tables.pl | |
parent | 1690ae449a6189d38a1d63dba22bf0ec774201f8 (diff) | |
download | samba-87fd7b5484b10ccdece6152f2a2a9adb4ea5fc78.tar.gz samba-87fd7b5484b10ccdece6152f2a2a9adb4ea5fc78.tar.bz2 samba-87fd7b5484b10ccdece6152f2a2a9adb4ea5fc78.zip |
r12574: Bring tables.pl back to life and move registration of interfaces
now completely to a new subsystem.
(This used to be commit bbacfaaea5819e0ecadf81e8fbb424916284c809)
Diffstat (limited to 'source4/librpc/tables.pl')
-rw-r--r-- | source4/librpc/tables.pl | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/source4/librpc/tables.pl b/source4/librpc/tables.pl new file mode 100644 index 0000000000..5757dc000a --- /dev/null +++ b/source4/librpc/tables.pl @@ -0,0 +1,91 @@ +#!/usr/bin/perl -w + +################################################### +# package to produce a table of all idl parsers +# Copyright tridge@samba.org 2003 +# Copyright jelmer@samba.org 2005 +# released under the GNU GPL + +use strict; + +use Getopt::Long; +use File::Basename; + +my $opt_output = 'librpc/gen_ndr/tables.c'; +my $opt_help = 0; + + +######################################### +# display help text +sub ShowHelp() +{ + print " + perl DCE/RPC interface table generator + Copyright (C) tridge\@samba.org + + Usage: tables.pl [options] <idlfile> + + Options: + --output OUTNAME put output in OUTNAME.* + \n"; + exit(0); +} + +# main program +GetOptions ( + 'help|h|?' => \$opt_help, + 'output=s' => \$opt_output, + ); + +if ($opt_help) { + ShowHelp(); + exit(0); +} + +my $init_fns = ""; + +################################### +# extract table entries from 1 file +sub process_file($) +{ + my $filename = shift; + open(FILE, $filename) || die "unable to open $filename\n"; + my $found = 0; + + while (my $line = <FILE>) { + if ($line =~ /extern const struct dcerpc_interface_table (\w+);/) { + $found = 1; + $init_fns.="\tlibrpc_register_interface(&$1);\n"; + } + } + + if ($found) { + print TABLEC "#include \"$filename\"\n"; + } + + close(FILE); +} + +print "Creating $opt_output\n"; +open(TABLEC, ">$opt_output") || die "failed to open $opt_output\n"; + +print TABLEC <<EOF; + +/* Automatically generated by tables.pl. DO NOT EDIT */ + +#include "includes.h" +EOF + +process_file($_) foreach (@ARGV); + +print TABLEC <<EOF; + +NTSTATUS dcerpc_table_init(void) +{ +$init_fns + + return NT_STATUS_OK; +} +EOF + +close(TABLEC); |