﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
397	Please add --outfile argument to parseErrorCodes.pl	rhl@…	robert.desonia@…	"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"";"	enhancement	closed	high		sys	0.5.0	minor	fixed		
