This file is indexed.

/usr/share/gnudatalanguage/astrolib/repstr.pro is in gdl-astrolib 2018.02.16+dfsg-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
function repstr,obj,in,out
;+
; NAME:
;   REPSTR
; PURPOSE:
;   Replace all occurences of one substring by another.
; EXPLANATION:
;   Meant to emulate the string substitution capabilities of text editors
;
;   Obsolete since introduction of the REPLACE method for string variables 
;   introduced in IDL 8.4
;
;	For a more sophisticated routine that allows regular expressions look
;	at MG_STRREPLACE() http://docs.idldev.com/idllib/strings/mg_streplace.html
; CALLING SEQUENCE:
;	result = repstr( obj, in, out )
;
; INPUT PARAMETERS:
;   obj    = object string for editing, scalar or array
;	in     = substring of 'obj' to be replaced, scalar 
;
; OPTIONAL INPUT PARMETER:
;	out    = what 'in' is replaced with, scalar.   If not supplied
;		then out = '', i.e. 'in' is not replaced by anything. 
;
; OUTPUT PARAMETERS:
;	Result returned as function value.  Input object string
;	not changed unless assignment done in calling program.
;
; PROCEDURE:
;	Searches for 'in', splits 'obj' into 3 pieces, reassembles
;	with 'out' in place of 'in'.  Repeats until all cases done.
;
; EXAMPLE:
;	If a = 'I am what I am' then print,repstr(a,'am','was')
;	will give 'I was what I was'.
;
; MODIFICATION HISTORY:
;	Written by Robert S. Hill, ST Systems Corp., 12 April 1989.
;	Accept vector object strings, W. Landsman   HSTX,   April, 1996
;   Convert loop to LONG, vectorize STRLEN call W. Landsman June 2002
;   Correct bug in optimization, case where STRLEN(OBJ) EQ
;         STRLEN(IN), C. Markwardt, Jan 2003
;   Fixed problem when multiple replacements extend the string length
;                 D. Finkbeiner, W. Landsman  April 2003
;   Allow third parameter to be optional again W. Landsman  August 2003
;   Remove limitation of 9999 characters, C. Markwardt Dec 2003
;   Test for empty "in" string (causing infinite loop) W. Landsman Jan 2010
;   Streamline code W Landsman Dec 2011
;   Use string .replace method in IDL 8.4 or later  W. Landsman Feb 2015
;   Use CALL_METHOD so that it still compiles in IDL 7.1 W.Landsman Aug 2015
;   Keep 3rd parameter optional in V8.4 or later W. Landsman Sep 2016
;   Test for valid parameter values even when using .replace method W.L. Jan 2017
;-
 On_error,2
 compile_opt idl2
 
 if N_params() LT 2 then begin
	print,'Syntax - result = REPSTR( obj, in, out )'
	return, obj
 endif

 if N_elements(out) EQ 0 then out = ''
 l1 = strlen(in)
 if l1 EQ 0 then message,'ERROR - empty input string not allowed'
 Nstring = N_elements(obj)
 if Nstring EQ 0 then message,'ERROR - undefined object string (first parameter)'
 if !VERSION.RELEASE GE '8.4' then return,call_method('replace',obj,in,out)
 l2 = strlen(out)

 diflen = l2- l1

 object = obj
 lo = strlen(object) - l1             ;Last character needed to look at 
 for i= 0L ,Nstring-1 do begin
 last_pos = 0
 pos = 0
 while ( pos LE lo[i]) do begin
   pos = strpos(object[i],in,last_pos)
   if (pos GE 0) then begin
	      first_part = strmid(object[i],0,pos)
	      last_part  = strmid(object[i],pos+l1)
	      object[i] = first_part + out + last_part
              last_pos = pos + l2
              lo[i] += diflen      ;Length of string may have changed
   endif else break
 endwhile
 endfor

 return,object

 end