This file is indexed.

/usr/share/THE/complete.the is in the 3.3~b4-1.

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

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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
/***********************************************************************
 *                                                                     *
 * Macro  complete.the   V1.3  (THE)                                   *
 *                                                                     *
 * Author:   Pablo Garcia-Abia                                         *
 * Date:     14/01/98                                                  *
 *                                                                     *
 * Syntax:   complete alternative_command                              *
 *                                                                     *
 *                                                                     *
 * Description:                                                        *
 *                                                                     *
 *    Macro to complete filenames in the command line, whenever the    *
 *    first command typed is one of the following:                     *
 *                                                                     *
 *                    XEDIT  FFILE  FILE  MACRO     LS                 *
 *                    THE    SSAVE  SAVE  OSREDIR   DIRECTORY          *
 *                    EDIT   GET    PUTD  STATUS                       *
 *                                                                     *
 *    Otherwise, an alternative command is executed.                   *
 *                                                                     *
 *    When the filename is being typed in the command line, a double   *
 *    equal sign (==) is always substituted by the whole filename      *
 *    (without path) of the file being edited.                         *
 *                                                                     *
 *    A single equal sign (=) in a given field (delimitied by the      *
 *    selected separator) is substituted by the corresponding field    *
 *    of the filename of the file being edited.                        *
 *                                                                     *
 *    The separator is taken as the character preceding the equal      *
 *    sign unless it is the first in the string. In that case, the     *
 *    character following the '=' is taken as separator. The dot       *
 *    '.' is used as a separator in ill cases.                         *
 *                                                                     *
 *    More sophisticated completion may be implemented in the future   *
 *    for other commands, eventually.                                  *
 *                                                                     *
 *                                                                     *
 * Example:                                                            *
 *                                                                     *
 *    To use it, define a key in the following way:                    *
 *                                                                     *
 *         DEFINE keyname MACRO complete alternative_command           *
 *                                                                     *
 *    For example:                                                     *
 *                                                                     *
 *         define TAB macro complete sos tabfieldf                     *
 *                                                                     *
 *    In this example, the TAB key will complete filenames when typed  *
 *    IN the CMDline (after XEDIT, THE or any other allowed command).  *
 *    Otherwise it will execute "sos tabfieldf".                       *
 *                                                                     *
 *                                                                     *
 * Note:  more sophisticated completion may be implemented in the      *
 *        future for other commands, eventually.                       *
 *                                                                     *
 *                                                                     *
 * Version history:                                                    *
 *                                                                     *
 * 1.3 (14/01/98)  - follow up directory tree when looking for         *
 *                   completions: UNIX ok, to be checked in OS2.       *
 *                   Not implemented in other OS.                      *
 *                 - FJW: OS-dependent corrections (thanks)            *
 *                 - substitution of '=' and '=='                      *
 * 1.2 (11/12/97)  added list of commands allowed for file completion  *
 * 1.1 (10/12/97)  bug on ambiguities output corrected                 *
 * 1.0 (10/12/97)  first version                                       *
 *                                                                     *
 * Bugs, comments and/or questions to Pablo.Garcia.Abia@cern.ch        *
 ***********************************************************************/

  Parse Arg alt_command

  If translate(alt_command) == 'HELP' Then Signal HELP

  "PRESERVE"

  "EXTRACT /CMDLINE/CURSOR/MSGLINE/LSCREEN"

  If cmdline.1 = "OFF" Then Exit

  If cursor.3 = -1 & words(cmdline.3) > 0 Then Call COMPLETE
  Else alt_command

  "RESTORE"

  Exit


/* Filename completion */

COMPLETE:

os = version.3()      /* Credits for Franz-Josef Wirtz */

Select
   When (os == "OS2") Then Do
      dirsep = "\"
/*      dircmd = "ls -d" /* or "dir /B" if 'ls' is not available */ */
      dircmd = "ls -dp"  /* slash after dir name ??? */
   End

   When (os == "WIN32") Then Do
      dirsep = "\"
      dircmd = "dir /B"
   End

   Otherwise Do
      dirsep = "/"
      dircmd = "ls -dp"
   End
End                   /* Credits for Franz-Josef Wirtz (END) */

ori = delword(cmdline.3,words(cmdline.3))
cmd = translate(word(cmdline.3,1))

If words(cmdline.3) > 1 Then str = word(cmdline.3,words(cmdline.3))
Else                         str = ""


/* Deal with equals in input string */

fn   = filename.1()
if (os == "OS2") Then
   eqeq = pos( '==', str)     /* '==' is always the whole filename */
else
   eqeq = index(str,'==')     /* '==' is always the whole filename */

If eqeq > 0 Then Do
   str = delstr(str,eqeq,2)
   str = insert(fn,str,eqeq-1)
   'CMSG' ori||str
End

if (os == "OS2") Then
   equ = pos( '=', str)
else
   equ = index(str,'=')

If equ > 0 Then Do

/* get separator: character before the '=' sign, or after it if '=' is the
                  first char in str. If not char, dot '.' is assumed */

    If      equ == 1           Then eq_sep = substr(str,equ+1,1)
    Else                            eq_sep = substr(str,equ-1,1)

    If eq_sep = " " Then eq_sep = "."

/* split filename according to 'eq_sep' */

    ndot = 0
    nstr = 1
    fn.  = ''

    If substr(fn,1,1) == eq_sep Then dot = pos(eq_sep,fn,2)
    Else                             dot = pos(eq_sep,fn)

    Do While dot > 0
       ndot    = ndot+1
       fn.ndot = substr(fn,nstr,dot-nstr)
       nstr    = dot+1
       dot     = pos(eq_sep,fn,nstr)
    End

    ndot    = ndot+1
    fn.ndot = substr(fn,nstr)

/* substitute '=' by its counterparts */

    nstr = 1
    nequ = 0
    str. = ''

    If substr(str,1,1) == eq_sep Then dot = pos(eq_sep,str,2)
    Else                              dot = pos(eq_sep,str)

    Do While dot > 0
       nequ     = nequ+1

       If substr(str,nstr,dot-nstr) == '=' Then Do
          str = delstr(str,nstr,1)
          str = insert(fn.nequ,str,nstr-1)
       End

       nstr     = dot+1
       dot      = pos(eq_sep,str,nstr)
    End

    If substr(str,nstr) == '=' Then Do
       nequ     = nequ+1
       str = delstr(str,nstr,1)
       str = insert(fn.nequ,str,nstr-1)
    End

   'CMSG' ori||str
End


/* Match one of these commands */

list_cmd = "XEDIT THE EDIT FFILE FILE SAVE SSAVE LS DIRECTORY GET PUTD MACRO OSREDIR STATUS"
list_abb = "1     3   1    2     4    4    2     2  3         3   3    5     3       4     "

match = 0

Do i=1 To words(list_cmd)
   If 'ABBREV'(word(list_cmd,i),cmd,word(list_abb,i)) Then Do
     match = 1
     Leave
   End
End

/* no command matched */

If match <> 1 Then Do
      alt_command
      return
End

/* one command matched */

If os <> "OS2" Then stdin.0 = 0
slash = lastpos(dirsep,str)

x = run_os(dircmd str"*", ,"stdout.", "stderr.")

len_stdout = length(stdout.1)

If substr(stdout.1,len_stdout) == dirsep Then ,
     lout = lastpos(dirsep,substr(stdout.1,1,len_stdout-1))
Else lout = lastpos(dirsep,stdout.1)

/* No ambiguities */

If stderr.0 > 0 Then EMSG stderr.1
Else If stdout.0 = 1 Then
      If slash > 0 Then 'CMSG' ori||substr(str,1,slash)||substr(stdout.1,lout+1)
      Else              'CMSG' ori||stdout.1
Else Do


/* List ambiguities */

  trunc = 1
  Do itr=5 By 5 Until trunc = 0 | itr > lscreen.1-10

     nmax   = min(itr,lscreen.1-10)
     ncols  = format(stdout.0/nmax-0.5,,0)+1
     nlines = min(nmax,stdout.0)
     long.  = 0
     short  = 9999
     colu   = 0
     line   = 0
     line.  = ""
     width  = lscreen.2

     "set msgline ON 2" nmax "OVERLAY"

     Do i=1 To stdout.0
        line = line+1
        If line > nmax Then Do ; line = 1 ; colu = colu+1 ; End

        len_stdout = length(stdout.i)

        If substr(stdout.i,len_stdout) == dirsep Then ,
             last = lastpos(dirsep,substr(stdout.i,1,len_stdout-1))+1
        Else last = lastpos(dirsep,stdout.i)+1

        new.i = substr(stdout.i,last)

        short     = min(short,     length(new.i))
        long.colu = max(long.colu, length(new.i))

     End

     colu = 0
     line = 0
     Do i=1 To stdout.0
        line = line+1
        If line > nmax Then Do ; line = 1 ; colu = colu+1 ; End
        line.line = line.line||substr(new.i,1,long.colu+4)
     End

     trunc = 0
     Do i=1 To nlines
        If length(line.i) > width Then trunc = trunc+1
     End

  End

  Do i=1 To nlines
     MSG substr(line.i,1,width)
  End

  If trunc > 0 Then Do
     "set msgline ON 2" nmax+2 "OVERLAY"
      MSG
      MSG "Too many files to be displayed:" trunc "lines truncated..."
  End

/* Partial Completion (up to ambiguity) */

  If slash > 0 Then len = length(substr(str,slash+1))
  Else len = length(str)

  Do j=len+1 To short
    char = substr(new.1,j,1)
    inall = 1
    Do k=2 To stdout.0
      If substr(new.k,j,1) <> char Then Do
         inall = 0
         Leave
      End
    End
    If inall = 1 Then
      If slash > 0 Then 'CMSG' ori||substr(str,1,slash)||substr(new.1,1,j)
      Else              'CMSG' ori||substr(new.1,1,j)
    Else Leave
  End

End

return