This file is indexed.

/usr/share/epic5/script/data_array is in epic5 1.1.6-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
if (word(2 $loadinfo()) != [pf]) { load -pf $word(1 $loadinfo()); return; };

#
# Array manipulation functions.
#

#
# General one liners.  Brief description:
#
#   The *item functions operate on one array element.
#   The *items functions operate on as many elements as there are args.
#
# Note that unlike their inbuilt counterparts, these generally accept negative
# item numbers as the distance from the top of the array, starting with -1.
#
# Let's start with some basics:
#
#   getndelitems:   splice the items $1- from the array and return them as a list.
#   getndelindex:   splice the indices $1- from the array and return them as a list.
#   getnrolitems:   Splice items $2- from $0, put them at the end of $1, and return them.
#   itemnorm:       Supporting function.  Fixes/removes invalid item numbers.
#
alias itemnorm (ar,it) {@:ni=numitems($ar);fe it it {@it+=0<=it?0:ni,it=0<=it&&it<ni?it:[]};return $it};
alias getndelitems (ar,it) {@:it=itemnorm($ar $it),:function_return=getitem($ar $it),delitems($ar $it)};
alias getndelindex (ar,it) {@:it=itemnorm($ar $it),:function_return=igetitem($ar $it),delitems($ar $indextoitem($ar $it))};
alias getnrolitems (a1,a2,it) {@:dt=:it=itemnorm($a1 $it);fe it it {setnextitem $a2 ${it=getitem($a1 $it)}};@delitems($a1 $dt);return $it};
#
# Now onto some more complex functions:
#
#   getmaskitem[s]: return one/all array elements matching $1-.
#   getandmitem[s]: Get an' Del item[s] matching Mask ($1-) from array $0.
#   getanrmitem[s]: Get an' Rol item[s] matching Mask ($2-) from array $0 to $1.
#
alias getmaskitem  (ar,mask) {@:it=getmatches($ar $mask);return ${getitem($ar $word($rand($#it) $it))}};
alias getmaskitems (ar,mask) {return $getitem($ar $getmatches($ar $mask))};
alias getandmitem  (ar,mask) {@:it=getmatches($ar $mask);return ${getndelitems($ar $word($rand($#it) $it))}};
alias getandmitems (ar,mask) {return $getndelitems($ar $getmatches($ar $mask))};
alias getanrmitem  (a1,a2,mask) {@:it=getmatches($a1 $mask);return ${getnrolitems($a1 $a2 $word($rand($#it) $it))}};
alias getanrmitems (a1,a2,mask) {return $getnrolitems($a1 $a2 $getmatches($a1 $mask))};
#
# The set*item functions update arrays in certain potentially useful ways.
#
# The set*items functions call their set*item counterpart for each word given.
#
#   setnextitem[s]: set a new array element[s] with $1- as contents.
#   setranditem[s]: replace a random array element[s] with $1-
#   setrmaxitem[s]: setnextitem if $1 > numitems else setranditem.
#   setuniqitem[s]: setnextitem if the array item[s] doesn't already exist.
#
alias setnextitem  (ar,args) {return $setitem($ar $numitems($ar) $args)};
alias setnextitems (ar,args) {fe args foo {@foo=setitem($ar $numitems($ar) $foo)};return $args};
alias setranditem  (ar,args) {return $setitem($ar $rand($numitems($ar)) $args)};
alias setranditems (ar,args) {fe args foo {@foo=setitem($ar $rand($numitems($ar)) $foo)};return $args};
alias setrmaxitem  (ar,it,args) {@:ni=numitems($ar);return $setitem($ar ${it>ni?ni:rand($ni)} $args)};
alias setrmaxitems (ar,it,args) {@:ni=numitems($ar);fe args foo {@foo=setitem($ar ${it>ni?ni++:rand($ni)} $foo)};return $args};
alias setuniqitem  (ar,args) {if (0>finditem($ar $args)){return $setitem($ar $numitems($ar) $args)}};
alias setuniqitems (ar,args) {fe args foo {@foo=0>finditem($ar $foo)?setitem($ar $numitems($ar) $foo):-1};return $args};

#
# Delete contents matching $1- of array $0.
# If an arg isn't specified, it equates to *.
#
alias array.purge (args) {
	@ :mask = [];
	fe ($getarrays($shift(args))) foo {
		@ 1>#args ? delarray($foo) : delitems($foo $getmatches($foo $args));
	};
};

#
# Load files $1- into array $0
#
alias array.read (args) {
	@ :ar = shift(args);
	@ :it = numitems($ar);
	fe ($glob($args)) fn {
		@ :fd = open($fn r);
		while ((:dt = read($fd)) || !eof($fd)) {
			@ usetitem($ar ${it++} $dt);
		};
		@ close($fd);
	};
};
#
# Load files $* into arrays of the same name.
#
alias array.nread (args) {
	fe ($glob($args)) fn {
		@ :it = numitems($fn);
		@ :fd = open($fn r);
		while ((:dt = read($fd)) || !eof($fd)) {
			@ usetitem($fn ${it++} $dt);
		};
		@ close($fd);
	};
};

#
# Give a brief summary of all matching arrays, or all arrays.
alias array.stat {
	fe ($getarrays($*)) foo {
		echo $numitems($foo)/$#listarray($foo)/$@listarray($foo) $foo;
	};
};

#
# I tried to clean these up.  Really I did.  Just give me some time.
#
# Brief summary:
#   .dump/.grep displays matching contents of matching arrays (in different ways).
#   .codump/.cogrep as above but sews together multiple arrays for displaying.
#   .idump/.igrep/.coidump/.coigrep sorted versions of above.
#   .write/.iwrite/.nwrite/.niwrite inverse of .read, differing in the order in which lines are written.
#   .flush/.iflush/.nflush/.niflush write and delete the arrays.
#
stack push alias alias.x;
stack push alias alias.xx;

alias alias.xx (args) {
	alias $args;
	@ sar(gr/grep/dump/args);
	@ sar(gr/-nobanner/-banner/args);
	@ sar(gr/ -- / -- [\$[-4]item \$[-2]#content \$[-3]@content] /args);
	alias $args;
};
alias alias.x (args) {
	alias.xx $args;
	@ sar(gr/igrep/grep/args);
	@ sar(gr/igetitem/getitem/args);
	@ sar(gr/igetmatches/getmatches/args);
	alias.xx $args;
};
alias.x array.igrep (arrays default *, mask default *) {
	fe ($getarrays($arrays)) array {
		echo $numitems($array)/$#listarray($array)/$@listarray($array) $array;
		fe ($igetmatches($array $mask)) item {
			@ :content = igetitem($array $item);
			xecho -nobanner -- $content;
		}
	}
	echo $chr(2)$#getarrays($arrays)$chr(2) arrays listed;
};
alias.x array.coigrep (array, mk, args) {
	fe ($getarrays($array)) array {
		fe ($igetmatches($array $afterw($mk $args))) item {
			@ :content = igetitem($array $item);
			fe ($beforew($mk $args)) foo {
				push content $igetitem($foo $item);
			};
			xecho -nobanner -- $content;
		};
	};
};

alias alias.x (args) {
	alias $args;
	fe (write flush getmatches getitem) foo {
		@ sar(gr/i$foo/$foo/args);
	};
	alias $args;
};
alias.x array.iwrite (args) {
	@ :fd = open($shift(args) w);
	fe ($getarrays($shift(args))) foo {
		fe ($igetmatches($foo ${args?args:[*]})) bar {
			@ write($fd $igetitem($foo $bar));
		};
	};
	@ close($fd);
};
alias.x array.niwrite (args) {
	fe ($getarrays($shift(args))) foo {
		@ :fd = open($foo w);
		fe ($igetmatches($foo ${args?args:[*]})) bar {
			@ write($fd $igetitem($foo $bar));
		};
		@ close($fd);
	};
};
alias.x array.iflush {array.iwrite $*;array.purge $1-;};
alias.x array.niflush {array.niwrite $*;array.purge $*;};

stack pop alias alias.xx;
stack pop alias alias.x;