r12528: Add seperate proto headers for ntvfs, tdr, smb_server and nbt_server.
[samba.git] / source4 / script / mkproto.pl
index 479d53da32575aa1a05cf7db82f4066b8e57ed94..1b2a9d355abbf56e068087ed903721160cfd724c 100755 (executable)
@@ -56,14 +56,14 @@ if (not defined($private_define) and defined($private_file)) {
 }
 
 if (defined($public_file)) {
-       open PUBLIC, ">$public_file"; 
+       open PUBLIC, ">$public_file" or die("Can't open `$public_file': $!")
        $public_fd = \*PUBLIC;
 }
 
 if ($private_file eq $public_file) {
        $private_fd = $public_fd;
 } elsif (defined($private_file)) {
-       open PRIVATE, ">$private_file"; 
+       open PRIVATE, ">$private_file" or die("Can't open `$private_file': $!"); 
        $private_fd = \*PRIVATE;
 }
 
@@ -128,6 +128,10 @@ sub process_file($$$)
 
                next if ($line =~ /^\/|[;]/);
 
+               if ($line =~ s/^_PUBLIC_[\t ]//) {
+                       $target = $public_file;
+               }
+
                next unless ( $line =~ /
                              ^void|^BOOL|^int|^struct|^char|^const|^\w+_[tT]\s|^uint|^unsigned|^long|
                              ^NTSTATUS|^ADS_STATUS|^enum\s.*\(|^DATA_BLOB|^WERROR|^XFILE|^FILE|^DIR|
@@ -142,10 +146,6 @@ sub process_file($$$)
                        next;
                }
 
-               if ($line =~ s/_PUBLIC_//xo) {
-                       $target = $public_file;
-               }
-
                if ( $line =~ /\(.*\)\s*$/o ) {
                        chomp $line;
                        print $target "$line;\n";