This file is indexed.

/usr/bin/dfg2otter.pl is in spass 3.7-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#! /usr/bin/perl

#**************************************************************
#* ********************************************************** *
#* *                                                        * *
#* *          Adds appropriate options for Otter            * *
#* *                                                        * *
#* *                                                        * *
#* $Revision: 1.1 $                                        * *
#* $State: Exp $                                            * *
#* $Date: 2006-03-07 16:19:26 $                             * *
#* $Author: topic $                                       * *
#* *                                                        * *
#* *             Contact:                                   * *
#* *             Christoph Weidenbach                       * *
#* *             MPI fuer Informatik                        * *
#* *             Stuhlsatzenhausweg 85                      * *
#* *             66123 Saarbruecken                         * *
#* *             Email: spass@mpi-inf.mpg.de                * *
#* *             Germany                                    * *
#* *                                                        * *
#* ********************************************************** *
#**************************************************************


# $RCSfile: dfg2otter.pl,v $ 


#############################################################
#
# Perl script for converting DFG input files into
# OTTER input files. The main work is done by the
# c-executable 'dfg2otter'.
#
# Usage:
#
# dfg2otter.pl [ -t] [file1] [file2]
#
# Options:
#
# -t (time): sets timelimit in seconds for OTTER in the converted
#     file (i.e., generates the command 'assign(max_seconds, time).')
#
# Functionality:
#
# The number of file arguments determines where dfg2otter
# takes its input from and directs its output to:
#
# file1 and file2 are given:
#     read from file1, write to file2
#
# file1 is given:
#     read from file1, generate output file file.ot
#
# No file arguments: 
#     input is read from stdin, output written to stdout
#
#
#############################################################

#########################################################
#  Packages
#########################################################

use strict;
# getopts package
use Getopt::Std;
use File::Copy;

#########################################################
# temporaries
#########################################################
my @TOREMOVE = ();

#########################################################
# Defaults
#########################################################

my $DFG2OTTER = "dfg2otter";    # dfg2otterpath
my $OUTFILESUFFIX = ".ot";      # generic output file suffix
my $ERRORFILESUFFIX = ".error"; # generic error file suffix

#########################################################
# options
#########################################################

# define default options
my %options = ( t => 10 );    # default: 10 seconds timeout for proof checker

# read options
&getopts("t:", \%options);

# shortcuts for options
my $timelimit = $options{'t'};

#########################################################
# MAIN
#########################################################
$SIG{INT} = \&catchint;         # set up interrupt handler
# try to get dfg2otter path from environment
# otherwise default is kept
if (defined($ENV{'DFG2OTTER'})) { 
  $DFG2OTTER = $ENV{'DFG2OTTER'};
}


# check that there are at most 2 arguments
if (@ARGV > 2) { die "Too many arguments.\n";}
#########################################################
# if there are no arguments, just call the original
#########################################################
if (@ARGV == 0) {
  system("$DFG2OTTER -Stdin");
}

#########################################################
# if one argument is given, use it as input file and
# generate file.ot output file 
#########################################################
my ($in, $out);
if (@ARGV == 1) {
  $in  = $ARGV[0];
  $out = $in."_".$$."_".$OUTFILESUFFIX;
  print `$DFG2OTTER -Stdin < $in > $out`;
}

#########################################################
# if two arguments are given, generate output filename
# first, write parameters to it, and then append dfg2otter
# output
#########################################################
my ($errorfile, $parout, $convout, @conv_res, $errorlines);

if (@ARGV == 2) { 
  
  $in  = $ARGV[0];
  $out = $ARGV[1];
  $errorfile = $out."_".$$."_".$ERRORFILESUFFIX;
  
  # print parameters
  $parout  = gettmp($out);
  open(CONV, ">$parout") or die "dfg2otter.pl: could not open '$in': $!"; 
  select CONV;
  &print_parameters();
  close CONV;
  
  # convert SPASS file
  $convout = gettmp($out);
  @conv_res = `$DFG2OTTER $in $convout 2>$errorfile`;
  
  # echo STDERR, remove files if errors occured
  # (that is if $errorfile is not empty)
  if (-e $errorfile) {
    unless (open(EF, "<$errorfile")) {
      cleanup();
      die "dfg2otter.pl: error opening '$errorfile': $!";
    }
    $errorlines = 0;
    while (<EF>) {
      print STDERR;
      $errorlines++;
    }
    close(EF);
    unlink($errorfile);
    if ($errorlines) { 
      unlink($out);
    }
  }
  
  # the following lines copy the file $parout to $out, and then append $convout,
  # like the UNIX command 'cat $parout $convout > $out'
  copy($parout, $out) or die "Could not copy $parout to $out: $!";
  open (IN, "$convout") or die "Could not open $convout: $!";
  open(APPEND, ">>$out") or die "Could not open $out: $!";
  while (<IN>) {
    print APPEND;
  }
  close(APPEND);
  close(IN);
  
  cleanup();
}


####################################################
# INPUT  : A signal name
# EFFECTS: Remove temporaries and reports interrupt 
####################################################
sub catchint {
  my $signame = shift;
  cleanup();
  die "\n\ndfg2otter.pl: caught signal $signame. Cleaning up."; 
}

####################################################
# EFFECTS: Remove temporaries
#####################################################
sub cleanup {
  unlink @TOREMOVE;
}

####################################################
# EFFECTS: Print otter default parameters to stdout
####################################################
sub print_parameters {
  print "set(process_input).\n";
  print "set(binary_res).\n";
  print "set(factor).\n";
  print "set(hyper_res).\n";
  print "assign(pick_given_ratio, 4).\n";
  print "clear(print_kept).\n";
  print "clear(print_new_demod).\n";
  print "clear(print_back_demod).\n";
  print "clear(print_back_sub).\n";
  print "set(knuth_bendix).\n";
  
  print "set(para_from).\n";
  print "set(para_into).\n";
  print "set(para_from_right).\n";
  print "set(para_into_right).\n";
  print "set(para_from_left).\n";
  print "set(para_into_left).\n";
  print "set(para_from_vars).\n";
  print "set(back_demod).\n";
  print "set(auto).\n";
  print "assign(max_seconds, $timelimit).\n";
}

####################################################
# INPUT:  A filename
# OUTPUT: A similar filename that is unique 
####################################################
sub gettmp {
  my ($file) = @_;
  my ($cnt)  = 0;
  
  while (-e $file."$cnt") {
    $cnt++;
  }
  $file = $file."$cnt"; 
  unshift(@TOREMOVE, $file); 
  
  return($file);
}