xref: /aoo41x/main/oowintool (revision 01d9dfef)
1cdf0e10cSrcweir#!/usr/bin/perl -w
2cdf0e10cSrcweir
3cdf0e10cSrcweiruse File::Copy;
4cdf0e10cSrcweir
5cdf0e10cSrcweirmy $output_format = 'u';
6cdf0e10cSrcweir
7cdf0e10cSrcweirsub reg_get_value($)
8cdf0e10cSrcweir{
9cdf0e10cSrcweir    # it is believed that the registry moves keys around
10cdf0e10cSrcweir    # depending on OS version, this will de-mangle that
11cdf0e10cSrcweir    my $key = shift;
12cdf0e10cSrcweir    my $fhandle;
13cdf0e10cSrcweir    my $value;
14cdf0e10cSrcweir
15cdf0e10cSrcweir    open ($fhandle, "/proc/registry/$key") || return;
16cdf0e10cSrcweir    # reg keys have 0x00 0x5c at the end
17cdf0e10cSrcweir    $value = (split /\0/, <$fhandle>)[0];
18cdf0e10cSrcweir    close ($fhandle);
19cdf0e10cSrcweir
20cdf0e10cSrcweir    if ( defined $value ) {
21cdf0e10cSrcweir        chomp ($value);
22cdf0e10cSrcweir        $value =~ s|\r\n||;
23cdf0e10cSrcweir#    print "Value '$value' at '$key'\n";
24cdf0e10cSrcweir    }
25cdf0e10cSrcweir
26cdf0e10cSrcweir    return $value;
27cdf0e10cSrcweir}
28cdf0e10cSrcweir
29cdf0e10cSrcweirsub reg_find_key($)
30cdf0e10cSrcweir{
31cdf0e10cSrcweir    # it is believed that the registry moves keys around
32cdf0e10cSrcweir    # depending on OS version, this will de-mangle that
33cdf0e10cSrcweir    my $key = shift;
34cdf0e10cSrcweir    $key =~ s| |\\ |;
35cdf0e10cSrcweir    $key = `cd /proc/registry/ ; ls $key`;
36cdf0e10cSrcweir
37cdf0e10cSrcweir    return $key;
38cdf0e10cSrcweir}
39cdf0e10cSrcweir
40cdf0e10cSrcweirsub print_syntax()
41cdf0e10cSrcweir{
42cdf0e10cSrcweir    print "oowintool [option] ...\n";
43cdf0e10cSrcweir    print " encoding options\n";
44cdf0e10cSrcweir    print "   -w   - windows form\n";
45cdf0e10cSrcweir    print "   -u   - unix form (default)\n";
46cdf0e10cSrcweir    print " commands:\n";
47cdf0e10cSrcweir    print "   --msvc-ver              - dump version of MSVC eg. 6.0\n";
48cdf0e10cSrcweir    print "   --msvc-copy-dlls <dest> - copy msvc[pr]??.dlls into <dest>/msvcp??/\n";
49cdf0e10cSrcweir    print "   --msvc-productdir       - dump productdir\n";
50cdf0e10cSrcweir    print "   --msvs-productdir       - dump productdir\n";
51cdf0e10cSrcweir    print "   --dotnetsdk-dir         - dump .Net SDK path\n";
52cdf0e10cSrcweir    print "   --csc-compilerdir       - dump .Net SDK compiler path\n";
53cdf0e10cSrcweir    print "   --psdk-home             - dump psdk install dir\n";
54cdf0e10cSrcweir    print "   --jdk-home              - dump the jdk install dir\n";
55cdf0e10cSrcweir    print "   --nsis-dir              - dump NSIS path\n";
56cdf0e10cSrcweir    print "   --help                  - this message\n";
57cdf0e10cSrcweir}
58cdf0e10cSrcweir
59cdf0e10cSrcweirsub cygpath($$$)
60cdf0e10cSrcweir{
61cdf0e10cSrcweir    my ($path, $input_format, $format) = @_;
62cdf0e10cSrcweir
63cdf0e10cSrcweir    return $path if ( ! defined $path );
64cdf0e10cSrcweir    # Strip trailing path separators
65cdf0e10cSrcweir    if ($input_format eq 'u') {
66cdf0e10cSrcweir	$path =~ s|/*\s*$||;
67cdf0e10cSrcweir    } else {
68cdf0e10cSrcweir	$path =~ s|\\*\s*$||;
69cdf0e10cSrcweir    }
70cdf0e10cSrcweir
71cdf0e10cSrcweir    # 'Unterminated quoted string errors' from 'ash' when
72cdf0e10cSrcweir    # forking cygpath  so - reimplement cygpath in perl [ gack ]
73cdf0e10cSrcweir    if ($format eq 'u' && $input_format eq 'w') {
74cdf0e10cSrcweir	$path =~ s|\\|/|g;
75cdf0e10cSrcweir	$path =~ s|([a-zA-Z]):/|/cygdrive/$1/|g;
76cdf0e10cSrcweir    }
77cdf0e10cSrcweir    elsif ($format eq 'w' && $input_format eq 'u') {
78cdf0e10cSrcweir	$path =~ s|/cygdrive/([a-zA-Z])/|/$1/|g;
79cdf0e10cSrcweir	$path =~ s|/|\\|g;
80cdf0e10cSrcweir    }
81cdf0e10cSrcweir
82cdf0e10cSrcweir    return $path;
83cdf0e10cSrcweir}
84cdf0e10cSrcweir
85cdf0e10cSrcweirsub print_path($$)
86cdf0e10cSrcweir{
87cdf0e10cSrcweir    my ($path, $unix) = @_;
88cdf0e10cSrcweir
89cdf0e10cSrcweir    $path = cygpath ($path, $unix, $output_format);
90cdf0e10cSrcweir
91cdf0e10cSrcweir    print $path;
92cdf0e10cSrcweir}
93cdf0e10cSrcweir
94cdf0e10cSrcweirsub print_psdk_home()
95cdf0e10cSrcweir{
96cdf0e10cSrcweir    my ($value, $key);
97cdf0e10cSrcweir    $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v6.1/InstallationFolder');
98cdf0e10cSrcweir    if (!defined $value)
99cdf0e10cSrcweir    {
100cdf0e10cSrcweir        $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder');
101*01d9dfefSHerbert Dürr    }
102cdf0e10cSrcweir    if (!defined $value)
103cdf0e10cSrcweir    {
104cdf0e10cSrcweir	    $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/Directories/Install Dir');
105*01d9dfefSHerbert Dürr    }
106cdf0e10cSrcweir    if (!defined $value)
107cdf0e10cSrcweir    {
108cdf0e10cSrcweir	    $key = reg_find_key ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install Dir');
109cdf0e10cSrcweir	    $value = reg_get_value ($key);
110*01d9dfefSHerbert Dürr    }
111cdf0e10cSrcweir    if (!defined $value)
112cdf0e10cSrcweir    {
113cdf0e10cSrcweir        my $dir = cygpath (find_msvc()->{'product_dir'}, 'w', $output_format);
114cdf0e10cSrcweir		$value = `/bin/find "$dir" -iname platformsdk | head -n 1`;
115cdf0e10cSrcweir    }
116cdf0e10cSrcweir
117cdf0e10cSrcweir    defined $value || die "psdk not found";
118cdf0e10cSrcweir
119cdf0e10cSrcweir    print cygpath ($value, 'w', $output_format);
120cdf0e10cSrcweir}
121cdf0e10cSrcweir
122cdf0e10cSrcweirmy %msvc_net_2003 = (
123cdf0e10cSrcweir    'ver' => '7.1',
124cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/7.1/Setup/VC/ProductDir',
125cdf0e10cSrcweir    'dll_path' => '../Visual Studio .NET Professional 2003 - English',
126cdf0e10cSrcweir    'dll_suffix' => '71'
127cdf0e10cSrcweir);
128cdf0e10cSrcweirmy %msvs_net_2003 = (
129cdf0e10cSrcweir    'ver' => '7.1',
130cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/7.1/Setup/VS/ProductDir',
131cdf0e10cSrcweir    'dll_path' => 'Visual Studio .NET Professional 2003 - English',
132cdf0e10cSrcweir    'dll_suffix' => '71'
133cdf0e10cSrcweir);
134cdf0e10cSrcweirmy %msvs_net_2003_ea = (
135cdf0e10cSrcweir    'ver' => '7.1',
136cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/7.1/Setup/VS/ProductDir',
137cdf0e10cSrcweir    'dll_path' => 'Visual Studio .NET Enterprise Architect 2003 - English', # testme ...
138cdf0e10cSrcweir    'dll_suffix' => '71'
139cdf0e10cSrcweir);
140cdf0e10cSrcweirmy %msvs_express_2005 = (
141cdf0e10cSrcweir    'ver' => '8.0',
142cdf0e10cSrcweir    'key' => 'Microsoft/VCExpress/8.0/Setup/VS/ProductDir',
143cdf0e10cSrcweir    'dll_path' => '../SDK/v2.0/Bin',
144cdf0e10cSrcweir    'dll_suffix' => '80'
145cdf0e10cSrcweir);
146cdf0e10cSrcweirmy %msvc_express_2005 = (
147cdf0e10cSrcweir    'ver' => '8.0',
148cdf0e10cSrcweir    'key' => 'Microsoft/VCExpress/8.0/Setup/VC/ProductDir',
149cdf0e10cSrcweir    'dll_path' => '../SDK/v2.0/Bin',
150cdf0e10cSrcweir    'dll_suffix' => '80'
151cdf0e10cSrcweir);
152cdf0e10cSrcweirmy %msvs_2005 = (
153cdf0e10cSrcweir    'ver' => '8.0',
154cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/8.0/Setup/VS/ProductDir',
155cdf0e10cSrcweir    'dll_path' => 'Visual Studio .NET Professional 2005 - English',
156cdf0e10cSrcweir    'dll_suffix' => '80'
157cdf0e10cSrcweir);
158cdf0e10cSrcweirmy %msvc_2005 = (
159cdf0e10cSrcweir    'ver' => '8.0',
160cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/8.0/Setup/VC/ProductDir',
161cdf0e10cSrcweir    'dll_path' => '../SDK/v2.0/Bin',
162cdf0e10cSrcweir    'dll_suffix' => '80'
163cdf0e10cSrcweir);
164cdf0e10cSrcweirmy %msvs_2008 = (
165cdf0e10cSrcweir    'ver' => '9.0',
166cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/9.0/Setup/VS/ProductDir',
167cdf0e10cSrcweir    'dll_path' => 'VC/redist/x86/Microsoft.VC90.CRT',
168cdf0e10cSrcweir    'dll_suffix' => '90'
169cdf0e10cSrcweir);
170cdf0e10cSrcweirmy %msvc_2008 = (
171cdf0e10cSrcweir    'ver' => '9.0',
172cdf0e10cSrcweir    'key' => 'Microsoft/VisualStudio/9.0/Setup/VC/ProductDir',
173cdf0e10cSrcweir    'dll_path' => 'redist/x86/Microsoft.VC90.CRT',
174cdf0e10cSrcweir    'dll_suffix' => '90'
175cdf0e10cSrcweir);
176cdf0e10cSrcweirmy %msvs_express_2008 = (
177cdf0e10cSrcweir    'ver' => '9.0',
178cdf0e10cSrcweir    'key' => 'Microsoft/VCExpress/9.0/Setup/VS/ProductDir',
179cdf0e10cSrcweir    'dll_path' => 'VC/redist/x86/Microsoft.VC90.CRT',
180cdf0e10cSrcweir    'dll_suffix' => '90'
181cdf0e10cSrcweir);
182cdf0e10cSrcweirmy %msvc_express_2008 = (
183cdf0e10cSrcweir    'ver' => '9.0',
184cdf0e10cSrcweir    'key' => 'Microsoft/VCExpress/9.0/Setup/VC/ProductDir',
185cdf0e10cSrcweir    'dll_path' => 'redist/x86/Microsoft.VC90.CRT',
186cdf0e10cSrcweir    'dll_suffix' => '90'
187cdf0e10cSrcweir);
188cdf0e10cSrcweir
189cdf0e10cSrcweirsub find_msvs()
190cdf0e10cSrcweir{
191cdf0e10cSrcweir    my @ms_versions = ( \%msvs_2008, \%msvs_express_2008, \%msvs_2005, \%msvs_express_2005, \%msvs_net_2003_ea, \%msvs_net_2003 );
192cdf0e10cSrcweir
193cdf0e10cSrcweir    for $ver (@ms_versions)
194cdf0e10cSrcweir    {
195cdf0e10cSrcweir	my $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/" . $ver->{'key'});
196cdf0e10cSrcweir	if (defined $install && $install ne '') {
197cdf0e10cSrcweir	    $ver->{'product_dir'} = $install;
198cdf0e10cSrcweir	    return $ver;
199cdf0e10cSrcweir	}
200cdf0e10cSrcweir    }
201cdf0e10cSrcweir    die "Can't find MS Visual Studio / VC++";
202cdf0e10cSrcweir}
203cdf0e10cSrcweir
204cdf0e10cSrcweirsub find_msvc()
205cdf0e10cSrcweir{
206cdf0e10cSrcweir    my @ms_versions = ( \%msvc_2008, \%msvc_express_2008, \%msvc_2005, \%msvc_express_2005, \%msvc_net_2003 );
207cdf0e10cSrcweir
208cdf0e10cSrcweir    for $ver (@ms_versions)
209cdf0e10cSrcweir    {
210cdf0e10cSrcweir	my $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/" . $ver->{'key'});
211cdf0e10cSrcweir	if (defined $install && $install ne '') {
212cdf0e10cSrcweir	    $ver->{'product_dir'} = $install;
213cdf0e10cSrcweir	    return $ver;
214cdf0e10cSrcweir	}
215cdf0e10cSrcweir    }
216cdf0e10cSrcweir    die "Can't find MS Visual Studio / VC++";
217cdf0e10cSrcweir}
218cdf0e10cSrcweir
219cdf0e10cSrcweirsub print_msvc_ver()
220cdf0e10cSrcweir{
221cdf0e10cSrcweir    my $ver = find_msvc();
222cdf0e10cSrcweir    print $ver->{'ver'};
223cdf0e10cSrcweir}
224cdf0e10cSrcweir
225cdf0e10cSrcweirsub print_msvc_product_dir()
226cdf0e10cSrcweir{
227cdf0e10cSrcweir    my $ver = find_msvc();
228cdf0e10cSrcweir    print cygpath ($ver->{'product_dir'}, 'w', $output_format);
229cdf0e10cSrcweir}
230cdf0e10cSrcweir
231cdf0e10cSrcweirsub print_msvs_productdir()
232cdf0e10cSrcweir{
233cdf0e10cSrcweir    my $ver = find_msvs();
234cdf0e10cSrcweir    print cygpath ($ver->{'product_dir'}, 'w', $output_format);
235cdf0e10cSrcweir}
236cdf0e10cSrcweir
237cdf0e10cSrcweirsub print_csc_compiler_dir()
238cdf0e10cSrcweir{
239cdf0e10cSrcweir    my $dir = cygpath (reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot"), 'w', $output_format);
240cdf0e10cSrcweir    my $csc_exe = `/bin/find "$dir" -iname csc.exe | grep "v2\." | head -n 1`;
241cdf0e10cSrcweir    print `dirname $csc_exe`;
242cdf0e10cSrcweir}
243cdf0e10cSrcweir
244cdf0e10cSrcweirsub print_dotnetsdk_dir()
245cdf0e10cSrcweir{
246cdf0e10cSrcweir    my $dir =
247cdf0e10cSrcweir          reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv1.1") ||
248cdf0e10cSrcweir          reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv2.0");
249cdf0e10cSrcweir    print cygpath ($dir, 'w', $output_format);
250cdf0e10cSrcweir}
251cdf0e10cSrcweir
252cdf0e10cSrcweirsub print_jdk_dir()
253cdf0e10cSrcweir{
254cdf0e10cSrcweir    my $dir =
255*01d9dfefSHerbert Dürr	  reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.7/JavaHome") ||
256*01d9dfefSHerbert Dürr	  reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.6/JavaHome") ||
257cdf0e10cSrcweir	  reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.5/JavaHome") ||
258cdf0e10cSrcweir	  reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.4/JavaHome") ||
259cdf0e10cSrcweir	  reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.3/JavaHome");
260cdf0e10cSrcweir    print cygpath($dir, 'w', $output_format);
261cdf0e10cSrcweir}
262cdf0e10cSrcweir
263cdf0e10cSrcweirsub print_nsis_dir()
264cdf0e10cSrcweir{
265cdf0e10cSrcweir    my $dir = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/NSIS/@");
266cdf0e10cSrcweir    print cygpath ($dir, 'w', $output_format) if defined $dir;
267cdf0e10cSrcweir}
268cdf0e10cSrcweir
269cdf0e10cSrcweirsub copy_dll($$$)
270cdf0e10cSrcweir{
271cdf0e10cSrcweir    my ($src, $fname, $dest) = @_;
272cdf0e10cSrcweir
273cdf0e10cSrcweir    -f "$src/$fname" || die "can't find $src";
274cdf0e10cSrcweir    -d $dest || die "no directory $dest";
275cdf0e10cSrcweir
276cdf0e10cSrcweir	print STDERR "Copying $src/$fname to $dest\n";
277cdf0e10cSrcweir    copy ("$src/$fname", $dest) || die "copy failed: $!";
278cdf0e10cSrcweir    chmod (0755, "$dest/$fname") || die "failed to set dll executable: $!";
279cdf0e10cSrcweir}
280cdf0e10cSrcweir
281cdf0e10cSrcweirsub msvc_find_version($)
282cdf0e10cSrcweir{
283cdf0e10cSrcweir    my $checkpath = shift;
284cdf0e10cSrcweir    my $ver = find_msvc();
285cdf0e10cSrcweir    my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' .
286cdf0e10cSrcweir		  $ver->{$checkpath});
287cdf0e10cSrcweir    -d $srcdir && return $ver;
288cdf0e10cSrcweir    $ver = find_msvs();
289cdf0e10cSrcweir    $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' .
290cdf0e10cSrcweir		  $ver->{$checkpath});
291cdf0e10cSrcweir    -d $srcdir && return $ver;
292cdf0e10cSrcweir    return undef;
293cdf0e10cSrcweir}
294cdf0e10cSrcweir
295cdf0e10cSrcweirsub msvc_copy_dlls($)
296cdf0e10cSrcweir{
297cdf0e10cSrcweir    my $dest = shift;
298cdf0e10cSrcweir    my $ver = msvc_find_version('dll_path');
299cdf0e10cSrcweir    defined $ver || return;
300cdf0e10cSrcweir    my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' .
301cdf0e10cSrcweir		  $ver->{'dll_path'});
302cdf0e10cSrcweir
303cdf0e10cSrcweir    copy_dll ($srcdir, "msvcp" . $ver->{'dll_suffix'} . ".dll",
304cdf0e10cSrcweir	      $dest . $ver->{'dll_suffix'});
305cdf0e10cSrcweir    copy_dll ($srcdir, "msvcr" . $ver->{'dll_suffix'} . ".dll",
306cdf0e10cSrcweir	      $dest . $ver->{'dll_suffix'});
307cdf0e10cSrcweir    if ($ver->{'dll_suffix'} >= 90) {
308cdf0e10cSrcweir        copy_dll ($srcdir, "msvcm" . $ver->{'dll_suffix'} . ".dll",
309cdf0e10cSrcweir                  $dest . $ver->{'dll_suffix'});
310cdf0e10cSrcweir        copy_dll ($srcdir, "Microsoft.VC90.CRT.manifest", $dest . $ver->{'dll_suffix'});
311cdf0e10cSrcweir    }
312cdf0e10cSrcweir}
313cdf0e10cSrcweir
314cdf0e10cSrcweirif (!@ARGV) {
315cdf0e10cSrcweir    print_syntax();
316cdf0e10cSrcweir    exit 1;
317cdf0e10cSrcweir}
318cdf0e10cSrcweir
319cdf0e10cSrcweirmy @commands = ();
320cdf0e10cSrcweirmy $opt;
321cdf0e10cSrcweirwhile (@ARGV) {
322cdf0e10cSrcweir    $opt = shift @ARGV;
323cdf0e10cSrcweir
324cdf0e10cSrcweir    if ($opt eq '-w' || $opt eq '-u') {
325cdf0e10cSrcweir	$output_format = substr($opt, 1, 1);
326cdf0e10cSrcweir    } else {
327cdf0e10cSrcweir	push @commands, $opt;
328cdf0e10cSrcweir    }
329cdf0e10cSrcweir}
330cdf0e10cSrcweir
331cdf0e10cSrcweirwhile (@commands) {
332cdf0e10cSrcweir    $opt = shift @commands;
333cdf0e10cSrcweir
334cdf0e10cSrcweir    if (0) {
335cdf0e10cSrcweir    } elsif ($opt eq '--msvc-ver') {
336cdf0e10cSrcweir	print_msvc_ver();
337cdf0e10cSrcweir    } elsif ($opt eq '--msvc-copy-dlls') {
338cdf0e10cSrcweir	my $dest = shift @commands;
339cdf0e10cSrcweir	defined $dest || die "copy-dlls requires a destination directory";
340cdf0e10cSrcweir	msvc_copy_dlls( $dest );
341cdf0e10cSrcweir    } elsif ($opt eq '--msvs-productdir') {
342cdf0e10cSrcweir	print_msvs_productdir();
343cdf0e10cSrcweir    } elsif ($opt eq '--msvc-productdir') {
344cdf0e10cSrcweir	print_msvc_product_dir();
345cdf0e10cSrcweir    } elsif ($opt eq '--dotnetsdk-dir') {
346cdf0e10cSrcweir	print_dotnetsdk_dir();
347cdf0e10cSrcweir    } elsif ($opt eq '--csc-compilerdir') {
348cdf0e10cSrcweir	print_csc_compiler_dir();
349cdf0e10cSrcweir    } elsif ($opt eq '--psdk-home') {
350cdf0e10cSrcweir	print_psdk_home();
351cdf0e10cSrcweir    } elsif ($opt eq '--jdk-home') {
352cdf0e10cSrcweir	print_jdk_dir();
353cdf0e10cSrcweir    } elsif ($opt eq '--nsis-dir') {
354cdf0e10cSrcweir	print_nsis_dir();
355cdf0e10cSrcweir    } elsif ($opt eq '--help' || $opt eq '/?') {
356cdf0e10cSrcweir	print_syntax();
357cdf0e10cSrcweir    } else {
358cdf0e10cSrcweir	print "Unknown option '$opt'\n";
359cdf0e10cSrcweir	print_syntax();
360cdf0e10cSrcweir	exit 1;
361cdf0e10cSrcweir    }
362cdf0e10cSrcweir}
363cdf0e10cSrcweir
364