r955: Update debian package rules... builds now
[sfrench/samba-autobuild/.git] / source4 / build / pidl / pidl.pl
index 9b870d7263f07de6b120310cfe8a764851e1fa0a..1c122932ba48c94a6a72c6cd64f499c466790af8 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 ###################################################
-# package to parse IDL files and generate code for 
+# package to parse IDL files and generate code for
 # rpc functions in Samba
 # Copyright tridge@samba.org 2000-2003
 # released under the GNU GPL
@@ -65,7 +65,7 @@ sub ShowHelp()
              --dump                dump a pidl file back to idl
              --header              create a C header file
              --parser              create a C parser
-             --server              create server boilterplate
+             --server              create server boilerplate
              --template            print a template for a pipe
              --eparser             create an ethereal parser
              --diff                run diff on the idl and dumped output
@@ -118,15 +118,16 @@ sub process_file($)
                IdlValidator::Validate($pidl);
                if ($opt_keep && !util::SaveStructure($pidl_file, $pidl)) {
                            die "Failed to save $pidl_file\n";
-               }               
+               }
        } else {
                $pidl = util::LoadStructure($pidl_file);
+               defined $pidl || die "Failed to load $pidl_file - maybe you need --parse\n";
        }
-       
+
        if ($opt_dump) {
                print IdlDump::Dump($pidl);
        }
-       
+
        if ($opt_header) {
                my($header) = util::ChangeExtension($output, ".h");
                util::FileSave($header, IdlHeader::Parse($pidl));
@@ -136,17 +137,17 @@ sub process_file($)
                my($server) = util::ChangeExtension($output, "_s.c");
                util::FileSave($server, IdlServer::Parse($pidl));
        }
-       
+
        if ($opt_parser) {
                my($parser) = util::ChangeExtension($output, ".c");
                IdlParser::Parse($pidl, $parser);
        }
-       
+
        if ($opt_eparser) {
-               my($parser) = util::ChangeExtension($output, ".c");
-               util::FileSave($parser, IdlEParser::Parse($pidl));
+               my($parser) = dirname($output) . "/packet-dcerpc-$basename.c";
+               IdlEParser::Parse($pidl, $parser);
        }
-       
+
        if ($opt_diff) {
                my($tempfile) = util::ChangeExtension($output, ".tmp");
                util::FileSave($tempfile, IdlDump::Dump($pidl));