This file is indexed.

/usr/bin/mincedit is in minc-tools 2.3.00+dfsg-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
#! /bin/sh
#
# Script to allow editing of minc files
#
# Usage: mincedit <minc file> [<editor>]
#
# Modifications: 
#   $Log: mincedit,v $
#   Revision 6.9  2008-06-18 03:55:25  stever
#   Remove illegitimate escape sequences (\n) from echo statements.
#   See Debian bug 486048 for details.
#
#   Revision 6.8  2008/02/05 13:48:45  rotor
#    * added code for checking VISUAL and EDITOR before falling back to emacs
#
#   Revision 6.7  2008/01/16 00:45:34  rotor
#    * replaced mincdump -h with mincheader to preserver image ranges
#
#   Revision 6.6  2008/01/09 14:42:24  rotor
#    * tidied up the man page and removed problematic errexit option
#
#   Revision 6.5  2008/01/09 12:39:46  rotor
#    * added errexit option
#
#   Revision 6.4  2008/01/09 12:31:08  rotor
#    * complete rewrite in sh
#
#   Revision 6.3  2004/06/16 16:27:27  bert
#   Use mincgen instead of ncgen
#
#   Revision 6.2  2000/09/12 15:43:37  neelin
#   Changed default TMPDIR to look for /var/tmp, /usr/tmp, /tmp.
#
#   Revision 6.1  1999/10/19 14:45:21  neelin
#   Fixed Log subsitutions for CVS
#
#   Revision 6.0  1997/09/12 13:23:34  neelin
#   Release of minc version 0.6
#    
#   Revision 5.0  1997/08/21  13:24:35  neelin
#   Release of minc version 0.5
#  
#   Revision 4.0  1997/05/07  20:00:36  neelin
#   Release of minc version 0.4
#  
#   Revision 3.0  1995/05/15  19:31:09  neelin
#   Release of minc version 0.3
#  
#   Revision 2.0  1994/09/28  10:33:58  neelin
#   Release of minc version 0.2
#  
#   Revision 1.6  94/09/28  10:33:55  neelin
#   Pre-release
#   
#   Revision 1.5  93/08/25  11:24:48  neelin
#   Added checking for -h or -help options.
#   
#   Revision 1.4  93/08/11  15:19:09  neelin
#   Added RCS logging in source.
# 
#
#
# Copyright 2008 Andrew Janke
# Based upon original version of Peter Neelins (1993)
#
# McConnell Brain Imaging Centre, 
# Montreal Neurological Institute, 
# McGill University.
#
# 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 and McGill University
# make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without
# express or implied warranty.


# simple little function to emulate perl's die();
die () {
    echo >&2 $@
    echo ""
    exit 1
}

me=`basename $0`
usage="Usage: $me <minc file> [<editor>]"

# create tmpdir
tmpdir=${TMPDIR:-/tmp}/mincedit.$$
trap 'rm -rf "$tmpdir"' 0
trap ' exit ' 0 1 2 3 15
(umask 077 && mkdir $tmpdir) || {
   echo "$me: Could not create temporary directory! Exiting." 1>&2 
   exit 1
   }

# check arguments
case $# in
   1)
      if [ "$1" = "-help" -o "$1" = "-h" -o "$1" = "" ]
      then
         echo $usage
         exit 0
      fi
      
      # if no editor is specified, find a suitable one
      if [ -n "$VISUAL" ]
      then
         editor=${VISUAL}
      else
         if [ -n "$EDITOR" ]
         then
            editor=${EDITOR}
         else
            editor="sensible-editor"
         fi
      fi
      ;;
   
   2)
      editor="$2"
      ;;
   
   *)
      echo $usage
      exit 0
esac

# only allow one input file and check for it
[ $# -eq 1 -o $# -eq 2 ] || die $usage
[ -f $1 ] || die "$me: no such file $1"

# set up the file names
infile="$1"
backup_infile=`echo ${infile} | sed -e "s/\.mnc/\.bu-$$\.mnc/"`
cdl_prefix=mincedit-$$
cdl_orig=${tmpdir}/${cdl_prefix}-orig.cdl
cdl_edit=${tmpdir}/${cdl_prefix}-edit.cdl

# dump the file
mincheader $infile > $cdl_orig
status=$?
if [ $status -ne 0 ]
then
   echo "${0}: Error reading file '$infile'"
   exit 1
fi

# make a copy to fiddle with
cp $cdl_orig $cdl_edit

# loop until successful file generation
do_edit=1
while [ $do_edit -ne 0 ]
do
   # edit the cdl file
   $editor $cdl_edit
   status=$?
   if [ $status -ne 0 ] 
   then
      echo "$me: Error editing with editor '$editor'"
      exit 1
   fi
   do_edit=0
   
   # compare the files for difference
   diff $cdl_orig $cdl_edit > /dev/null 2>&1
   status=$?
   if [ $status -eq 0 ] 
   then
      echo "$me: File $infile not modified"
      exit 0
   fi
   
   # rename the original file and generate a new one
   mv "$infile" "$backup_infile"
   status=$?
   mincgen -o $infile $cdl_edit
   status=$?
   if [ $status -ne 0 ]
   then
      mv $backup_infile $infile
      echo -n "$me: Error generating new file. Redit the file (y/n)? (def=n):"
      read answer
      case "$answer" in
         y*)
            do_edit=1
            continue
            ;;
      esac
      exit 0
   fi

   # copy the data back in
   minccopy $backup_infile $infile
   status=$?
   if [ $status -ne 0 ]
   then
      mv $backup_infile $infile
      echo -n "Error copying image data. Redit the file (y/n)? (def=n):"
      read answer
      case "$answer" in
         y*)
            do_edit=1
            continue
            ;;
      esac
      exit 0
   fi

done