IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#397 closed enhancement (fixed)

Please add --outfile argument to parseErrorCodes.pl

Reported by: rhl@… Owned by: robert.desonia@…
Priority: high Milestone:
Component: sys Version: 0.5.0
Severity: minor Keywords:
Cc:

Description

When generating input files to be registered with psError, it is useful not to have
parseErrorCodes.pl modify the file in place (e.g. it doesn't confuse cvs; the machine
generated code should not be checked in).

Here's a patch that achieves this.

Index: src/parseErrorCodes.pl
===============================================================
====
RCS file: /usr/local/cvs/repositories/pan-starrs/datasys/IPP/psLib/src/parseErrorCodes.pl,v
retrieving revision 1.3
diff -a -c -w -r1.3 parseErrorCodes.pl
* src/parseErrorCodes.pl 3 Feb 2005 00:54:10 -0000 1.3
--- src/parseErrorCodes.pl 6 May 2005 17:56:45 -0000
*
* 11,26

# Assign variables based on the presence of command line options to the script
GetOptions(

"data=s" => \$data,
"verbose" => \$verbose,
"help" => \$help

! );

if ($help) {

! print "Usage: parseErrorCodes ", "[--data=$data] ", "[--help] ",
! "[--verbose] filename [filename ...]\n\n";

exit(0);

}


print "Using data file '$data'\n" if $verbose;
unless ( open( DATAFILE, "<", $data ) ) {

die "Can not open data file $data.";

--- 11,33 ----

# Assign variables based on the presence of command line options to the script
GetOptions(

"data=s" => \$data,

+ "outfile=s" => \$outputfile,

"verbose" => \$verbose,
"help" => \$help

! ) or exit(1);

if ($help) {

! print "Usage: parseErrorCodes ", "[--data=$data] ", "[--outfile=$file] ", "[--help] ",
! "[--verbose] [filename [filename ...]]\n\n";

exit(0);

}


+ if(defined($outputfile)) {
+ if (@ARGV > 1) {
+ die "You may only specify one input filename if you use --outfile\n";
+ }
+ }
+

print "Using data file '$data'\n" if $verbose;
unless ( open( DATAFILE, "<", $data ) ) {

die "Can not open data file $data.";

*
* 84,91

close(INFILE);


die "Failed to overwrite input file"

! if !open( OUTFILE, ">", $filename );

foreach (@result) {

print OUTFILE "$_\n";

--- 91,103 ----

close(INFILE);


+ if (defined($outputfile)) {
+ $ofile = $outputfile;
+ } else {
+ $ofile = $filename;
+ }

die "Failed to overwrite input file"

! if !open( OUTFILE, ">", $ofile );

foreach (@result) {

print OUTFILE "$_\n";

Change History (4)

comment:1 by robert.desonia@…, 21 years ago

Status: newassigned

yeah, that should be fixed to be CVS friendly. I need to modify some makefiles
as well, I assume.

comment:2 by robert.desonia@…, 21 years ago

Resolution: fixed
Status: assignedclosed

I modified the script to mimick autoconf/automake style behavior, in that it looks for the input
template with an '.in' suffix on it. This effective does what you want, in that the file is not modified in-
place.

-rdd

comment:3 by Paul Price, 20 years ago

Keywords: VERIFIED added

Bug has been resolved.... closing.

comment:4 by Paul Price, 20 years ago

Keywords: VERIFIED removed

Bugs have been fixed... closing.

Note: See TracTickets for help on using tickets.