This file is indexed.

/usr/bin/minccomplete is in minc-tools 2.1.00-2.

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
#! /usr/bin/env perl
#
# Checks if a MINC file is complete
#
# Copyright Andrew Janke a.janke@gmail.com
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies.  The
# author makes no representations about the suitability of this software
# for any purpose.  It is provided "as is" without express or implied warranty.


use strict;
use warnings "all";
use Getopt::Long;
use Pod::Usage;
use File::Basename;

my($me, %opt, $dump, $infile, $error);

$me = basename($0);
%opt = (
   'help' => 0,
   'man' => 0,
   'verbose' => 0,
   'error_string' => undef,
   );

# Check arguments
&GetOptions(
   'help|?' => \$opt{'help'},
   'man' => \$opt{'man'},
   'v|verbose' => \$opt{'verbose'},
   'version' => sub { &print_version_info },
   'e|error_string=s' => \$opt{'error_string'},
   ) or pod2usage(-verbose => 1) && exit;
   
# handle -man, -help or missing args
pod2usage(-verbose => 1) if $opt{'help'};
pod2usage(-exitstatus => 0, -verbose => 2) if $opt{'man'};
pod2usage(-verbose => 0) && exit if ($#ARGV != 0);

$infile = $ARGV[0];

# check if the file in question exists
if(!-e $infile){
   if(defined($opt{error_string})){
      print STDOUT "$opt{error_string}\n";
      exit(-1);
      }
   else{
      die "$me: Couldn't find $infile\n\n";
      }
   }

# figure out what we have here
if($infile =~ m/\.mnc(\.gz|)$/){
   my($version);
   
   print STDOUT "Checking a MINC file ($infile)\n" if $opt{'verbose'};
   
   # first check that the header is "valid"
   if(system("mincdump -h $infile 2> /dev/null 1>&2") == 0){
      $error = 0;
      }
   else{
      $error = -1;
      }
   
   # if good, check if the image is complete for MINC2
   if($error == 0){
      chomp($version = `mincinfo -minc_version $infile 2> /dev/null`);
      
      if($version =~ m/HDF5/){
         print STDOUT "File is $version\n" if $opt{'verbose'};
         
         chomp($dump = `mincinfo -attvalue image:complete $infile 2> /dev/null`);
         $error = -1 if ($dump ne 'true_');
         }
      }
   }

elsif($infile =~ m/\.xfm$/){
   print STDOUT "Checking a XFM file ($infile)\n" if $opt{'verbose'};
   
   if(system("xfm2param $infile 2> /dev/null 1>&2") == 0){
      $error = 0;
      }
   else{
      $error = -1;
      }
   }


# now output the status
if($error){
   if(defined($opt{'error_string'})){
      print STDOUT "$opt{'error_string'}\n";
      }
   else{
      print STDOUT "$error\n";
      }
   }
else{
   print STDOUT "$error\n";
   }

exit($error);

# print version information
sub print_version_info {
   my $PACKAGE = 'minc';
   my $VERSION = '2.1.00';
   my $PACKAGE_BUGREPORT = 'Andrew Janke <a.janke@gmail.com>';
   
   print STDOUT "\n$PACKAGE version $VERSION\n".
                "Comments to $PACKAGE_BUGREPORT\n\n";
   exit 0;
   }


__END__

=head1 NAME

B<minccomplete> - checks if a MINC file is complete

=head1 SYNOPSIS

B<minccomplete> [options] <file.mnc>

minccomplete is designed as a QC tool that you can use to check
if MINC or xfm files have been completely written.

=head1 DESCRIPTION

B<minccomplete> will check if a file exists and is completely written.
The reasons for non-completion are varied but typically caused when 
a process writing a MINC or xfm file is interrupted. A zero will be 
returned if the file is complete and a -1 if it isn't.

Examples:

   $ minccomplete in.mnc
   0
   $ minccomplete in.xfm
   0

A MINC file is returned as complete if the image attribute image:complete
is set. ie:

   mincinfo -attvalue image:complete infile.mnc

A xfm file is deemed complete if xfm2param can parse the file.
The associated exit codes will also be set as part of this so 
that minccomplete can be used in scripts.

An entirely simplistic example:
   
   #! /bin/sh
   
   infile=$1
   
   if [ `minccomplete ${infile}` ]
   then
      echo "Yes!"
   else
      echo "Nope, try again"
   fi

Problems or comments should be sent to: a.janke@gmail.com
 
=head1 OPTIONS

=over 4

=item B<-v>, B<--verbose>

Be noisy when doing things

=item B<--version>

Print version number and exit

=item B<-h>, B<--help>

Dump some quick help output

=item B<--man>

Dump a man page

=item B<-e>, B<--error_string>

Don't die on errors (eg: file not found) and print the supplied value instead

=back

=head1 SEE ALSO

mincheader(1) mincinfo(1) xfm2param(1)

=head1 AUTHOR

Andrew Janke - a.janke@gmail.com

=head1 COPYRIGHTS

Copyright 2000 by Andrew L Janke

=cut