Merge branch 'v4-0-trivial' into v4-0-test
[jelmer/samba4-debian.git] / source / librpc / tables.pl
index 5757dc000a3ecbe47b1bc2f03125809ddf84bea5..04764f5fa0bfe101fb9ef50c4b882f3595eb968c 100644 (file)
@@ -20,13 +20,11 @@ my $opt_help  = 0;
 sub ShowHelp()
 {
     print "
-           perl DCE/RPC interface table generator
+           perl NDR interface table generator
            Copyright (C) tridge\@samba.org
 
            Usage: tables.pl [options] <idlfile>
 
-           Options:
-             --output OUTNAME      put output in OUTNAME.*
            \n";
     exit(0);
 }
@@ -53,39 +51,39 @@ sub process_file($)
        my $found = 0;
 
        while (my $line = <FILE>) {
-               if ($line =~ /extern const struct dcerpc_interface_table (\w+);/) {
+               if ($line =~ /extern const struct ndr_interface_table (\w+);/) {
                        $found = 1;
-                       $init_fns.="\tlibrpc_register_interface(&$1);\n";
+                       $init_fns.="\tstatus = ndr_table_register(&$1);\n";
+                       $init_fns.="\tif (NT_STATUS_IS_ERR(status)) return status;\n\n";
                }
        }
 
        if ($found) {
-               print TABLEC "#include \"$filename\"\n";
+               print "#include \"$filename\"\n";
        }
 
        close(FILE);
 }
 
-print "Creating $opt_output\n";
-open(TABLEC, ">$opt_output") || die "failed to open $opt_output\n";
-
-print TABLEC <<EOF;
+print <<EOF;
 
 /* Automatically generated by tables.pl. DO NOT EDIT */
 
 #include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
 EOF
 
 process_file($_) foreach (@ARGV);
 
-print TABLEC <<EOF;
+print <<EOF;
 
-NTSTATUS dcerpc_table_init(void)
+NTSTATUS ndr_table_register_builtin_tables(void)
 {
+       NTSTATUS status;
+
 $init_fns
        
        return NT_STATUS_OK;
 }
 EOF
-
-close(TABLEC);