s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to cli_chkpath_send().
[Samba.git] / source4 / build / pasn1 / pasn1.pl
blobc3689fd9288a0222e186ca7fe30babd7cafd2e9d
1 #!/usr/bin/perl -w
3 ###################################################
4 # package to parse ASN.1 files and generate code for
5 # LDAP functions in Samba
6 # Copyright tridge@samba.org 2002-2003
7 # Copyright metze@samba.org 2004
9 # released under the GNU GPL
11 use strict;
13 use FindBin qw($RealBin);
14 use lib "$RealBin";
15 use lib "$RealBin/lib";
16 use Getopt::Long;
17 use File::Basename;
18 use asn1;
19 use util;
21 my($opt_help) = 0;
22 my($opt_output);
24 my $asn1_parser = new asn1;
26 #####################################################################
27 # parse an ASN.1 file returning a structure containing all the data
28 sub ASN1Parse($)
30 my $filename = shift;
31 my $asn1 = $asn1_parser->parse_asn1($filename);
32 util::CleanData($asn1);
33 return $asn1;
37 #########################################
38 # display help text
39 sub ShowHelp()
41 print "
42 perl ASN.1 parser and code generator
43 Copyright (C) tridge\@samba.org
44 Copyright (C) metze\@samba.org
46 Usage: pasn1.pl [options] <asn1file>
48 Options:
49 --help this help page
50 --output OUTNAME put output in OUTNAME
51 \n";
52 exit(0);
55 # main program
56 GetOptions (
57 'help|h|?' => \$opt_help,
58 'output|o=s' => \$opt_output,
61 if ($opt_help) {
62 ShowHelp();
63 exit(0);
66 sub process_file($)
68 my $input_file = shift;
69 my $output_file;
70 my $pasn1;
72 my $basename = basename($input_file, ".asn1");
74 if (!defined($opt_output)) {
75 $output_file = util::ChangeExtension($input_file, ".pasn1");
76 } else {
77 $output_file = $opt_output;
80 # if (file is .pasn1) {
81 # $pasn1 = util::LoadStructure($pasn1_file);
82 # defined $pasn1 || die "Failed to load $pasn1_file - maybe you need --parse\n";
83 # } else {
84 $pasn1 = ASN1Parse($input_file);
85 defined $pasn1 || die "Failed to parse $input_file";
86 util::SaveStructure($output_file, $pasn1) ||
87 die "Failed to save $output_file\n";
91 foreach my $filename (@ARGV) {
92 process_file($filename);