17
17
18
18
use strict;
19
19
use warnings;
20
+ use Getopt::Long;
20
21
21
22
use File::Basename;
22
23
25
26
26
27
use Catalog; # for RenameTempFile
27
28
29
+ my $output_path = ' .' ;
30
+
31
+ GetOptions(
32
+ ' output:s' => \$output_path );
33
+
28
34
29
35
# Test whether first argument is element of the list in the second
30
36
# argument
@@ -453,7 +459,7 @@ sub elem
453
459
# nodetags.h
454
460
455
461
push @output_files , ' nodetags.h' ;
456
- open my $nt , ' >' , ' nodetags.h' . $tmpext or die $! ;
462
+ open my $nt , ' >' , " $output_path / nodetags.h" . $tmpext or die " $output_path /nodetags.h: $! " ;
457
463
458
464
printf $nt $header_comment , ' nodetags.h' ;
459
465
@@ -480,13 +486,13 @@ sub elem
480
486
# copyfuncs.c, equalfuncs.c
481
487
482
488
push @output_files , ' copyfuncs.funcs.c' ;
483
- open my $cff , ' >' , ' copyfuncs.funcs.c' . $tmpext or die $! ;
489
+ open my $cff , ' >' , " $output_path / copyfuncs.funcs.c" . $tmpext or die $! ;
484
490
push @output_files , ' equalfuncs.funcs.c' ;
485
- open my $eff , ' >' , ' equalfuncs.funcs.c' . $tmpext or die $! ;
491
+ open my $eff , ' >' , " $output_path / equalfuncs.funcs.c" . $tmpext or die $! ;
486
492
push @output_files , ' copyfuncs.switch.c' ;
487
- open my $cfs , ' >' , ' copyfuncs.switch.c' . $tmpext or die $! ;
493
+ open my $cfs , ' >' , " $output_path / copyfuncs.switch.c" . $tmpext or die $! ;
488
494
push @output_files , ' equalfuncs.switch.c' ;
489
- open my $efs , ' >' , ' equalfuncs.switch.c' . $tmpext or die $! ;
495
+ open my $efs , ' >' , " $output_path / equalfuncs.switch.c" . $tmpext or die $! ;
490
496
491
497
printf $cff $header_comment , ' copyfuncs.funcs.c' ;
492
498
printf $eff $header_comment , ' equalfuncs.funcs.c' ;
@@ -672,13 +678,13 @@ sub elem
672
678
# outfuncs.c, readfuncs.c
673
679
674
680
push @output_files , ' outfuncs.funcs.c' ;
675
- open my $off , ' >' , ' outfuncs.funcs.c' . $tmpext or die $! ;
681
+ open my $off , ' >' , " $output_path / outfuncs.funcs.c" . $tmpext or die $! ;
676
682
push @output_files , ' readfuncs.funcs.c' ;
677
- open my $rff , ' >' , ' readfuncs.funcs.c' . $tmpext or die $! ;
683
+ open my $rff , ' >' , " $output_path / readfuncs.funcs.c" . $tmpext or die $! ;
678
684
push @output_files , ' outfuncs.switch.c' ;
679
- open my $ofs , ' >' , ' outfuncs.switch.c' . $tmpext or die $! ;
685
+ open my $ofs , ' >' , " $output_path / outfuncs.switch.c" . $tmpext or die $! ;
680
686
push @output_files , ' readfuncs.switch.c' ;
681
- open my $rfs , ' >' , ' readfuncs.switch.c' . $tmpext or die $! ;
687
+ open my $rfs , ' >' , " $output_path / readfuncs.switch.c" . $tmpext or die $! ;
682
688
683
689
printf $off $header_comment , ' outfuncs.funcs.c' ;
684
690
printf $rff $header_comment , ' readfuncs.funcs.c' ;
@@ -976,7 +982,7 @@ sub elem
976
982
# now rename the temporary files to their final names
977
983
foreach my $file (@output_files )
978
984
{
979
- Catalog::RenameTempFile($ file , $tmpext );
985
+ Catalog::RenameTempFile(" $output_path / $ file" , $tmpext );
980
986
}
981
987
982
988
0 commit comments