This file is indexed.

/usr/share/ngraph-gtk/addin/fig2gra.nsc is in ngraph-gtk-addin-import-ps 6.06.13-5.1build1.

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
set +e

fig2gra_delete_obj() {
    del io:fig2gra
    del regexp:fig2gra
    del sarray:fig2gra
    del iarray:fig2gra
    del sarray:palette
    del iarray:points
}

fig2gra_set_color() {
    c=`get sarray:palette -field get:$1`
    if [ -n "$c" ]
    then
	io:fig2gra:puts "G,4,$c,255"
    fi
}

fig2gra_set_line_attribute () {
    style=${iarray:fig2gra:get:2}
    width=`iexpr "${iarray:fig2gra:get:3} * $COORD_CONV * 100 / 80"`
    len=`iexpr "${iarray:fig2gra:get:9} * $COORD_CONV * 100 / 80"`
    join=${iarray:fig2gra:get:10}
    cap=${iarray:fig2gra:get:11}
    case $style in
	1)
	    io:fig2gra:puts "A,7,2,$width,$cap,$join,1000,$len,$len"
	    ;;
	2)
	    io:fig2gra:puts "A,7,2,$width,$cap,$join,1000,50,$len"
	    ;;
	3)
	    io:fig2gra:puts "A,9,4,$width,$cap,$join,1000,$len,100,50,100"
	    ;;
	4)
	    io:fig2gra:puts "A,11,6,$width,$cap,$join,1000,$len,100,50,100,50,100"
	    ;;
	5)
	    io:fig2gra:puts "A,13,8,$width,$cap,$join,1000,$len,100,50,100,50,100,50,100"
	    ;;
	*)
	    io:fig2gra:puts "A,5,0,$width,$cap,$join,1000"
	    ;;
    esac
}

fig2gra_draw_poly_line() {
    n=${iarray:points:num}

    if [ $n -lt 4 ]
    then
	return
    fi

    fill=0
    if [ "${iarray:fig2gra:get:8}" != -1 ]
    then
	fill=1
    fi

    close_path=0
    if [ ${iarray:points:get:0} -eq ${iarray:points:get:-2} -a ${iarray:points:get:1} -eq  ${iarray:points:get:-1} ]
    then
	iarray:points:pop
	iarray:points:pop
	n=${iarray:points:num}
	close_path=1
    fi

    m=`iexpr $n/2`
    if [ ${iarray:fig2gra:get:1} -ne 1 -o $fill -ne 0 ]
    then
	n2=`iexpr $n+2`
	if [ $fill -ne 0 ]
	then
	    fig2gra_set_color ${iarray:fig2gra:get:5}
	    io:fig2gra:puts "D,$n2,$m,1,${iarray:points:join:','}"
	fi

	if [ ${iarray:fig2gra:get:3} -gt 0 ]
	then
	    fig2gra_set_color ${iarray:fig2gra:get:4}
	    fig2gra_set_line_attribute
	    io:fig2gra:puts "D,$n2,$m,0,${iarray:points:join:','}"
	fi
    else
	fig2gra_set_color ${iarray:fig2gra:get:4}
	fig2gra_set_line_attribute
	if [ $close_path -ne 0 ]
	then
	    io:fig2gra:puts "D,`iexpr $n+2`,$m,0,${iarray:points:join:','}"
	else
	    io:fig2gra:puts "R,`iexpr $n+1`,$m,${iarray:points:join:','}"
	fi
    fi
}

fig2gra_init_palette() {
    sarray:palette:@=""
    sarray:palette:push "0,0,0"
    sarray:palette:push "0,0,255"
    sarray:palette:push "0,255,0"
    sarray:palette:push "0,255,255"
    sarray:palette:push "255,0,0"
    sarray:palette:push "255,0,255"
    sarray:palette:push "255,255,0"
    sarray:palette:push "255,255,255"
    sarray:palette:push "0,0,144"
    sarray:palette:push "0,0,176"
    sarray:palette:push "0,0,208"
    sarray:palette:push "135,206,255"
    sarray:palette:push "0,144,0"
    sarray:palette:push "0,176,0"
    sarray:palette:push "0,208,0"
    sarray:palette:push "0,144,144"
    sarray:palette:push "0,176,176"
    sarray:palette:push "0,208,208"
    sarray:palette:push "144,0,144"
    sarray:palette:push "176,0,176"
    sarray:palette:push "208,0,208"
    sarray:palette:push "128,48,0"
    sarray:palette:push "160,64,0"
    sarray:palette:push "192,96,0"
    sarray:palette:push "255,128,128"
    sarray:palette:push "255,160,160"
    sarray:palette:push "255,192,192"
    sarray:palette:push "255,224,224"
    sarray:palette:push "255,215,224"

    new int
    int::@=512
    while int::times
    do
	sarray:palette:push "0,0,0"
    done
    del int
}

fig2gra_add_palette() {
    new string
    string::@=$3
    r=`iexpr 0x${string::slice:"1 2"}`
    g=`iexpr 0x${string::slice:"3 2"}`
    b=`iexpr 0x${string::slice:"5 2"}`
    sarray:palette:put $2 "$r,$g,$b"
    del string
}

fig2gra() {
    new io name=fig2gra
    new sarray name=fig2gra
    new iarray name=fig2gra
    new regexp name=fig2gra
    new iarray name=points
    new sarray name=palette

    fig2gra_init_palette

    if [ "$1" = "-dummy" ]
    then
	shift
    fi

    io:fig2gra:mode="r"
    regexp:fig2gra:@='^#'

    io:fig2gra:open $1
    while true
    do
	l=${io:fig2gra:gets}
	if io:fig2gra:eof
	then
	    break
	fi

	if regexp:fig2gra:match:"$l"
	then
	    continue
	fi
	sarray:fig2gra:push "$l"
    done
    io:fig2gra:close

    if [ ${sarray:fig2gra:num} -lt 9 ]
    then
	fig2gra_delete_obj
	return 1
    fi

    head=${sarray:fig2gra:shift} # 0
    head=${sarray:fig2gra:shift} # 1
    head=${sarray:fig2gra:shift} # 2
    if [ $head = "Metric" ]
    then
	COORD_CONV=1
    else
	COORD_CONV=25.4
    fi
    head=${sarray:fig2gra:shift} # 3
    head=${sarray:fig2gra:shift} # 4
    head=${sarray:fig2gra:shift} # 5
    head=${sarray:fig2gra:shift} # 6

    iarray:fig2gra:@=${sarray:fig2gra:shift} # 7
    RESOLUTION=${iarray:fig2gra:get:0}

    regexp:fig2gra:@='^a\W'
    io:fig2gra:mode="w"

    io:fig2gra:open "$2"
    io:fig2gra:puts ${system::GRAF}
    io:fig2gra:puts '%Creator: fig2gra.nsc'
    io:fig2gra:puts "I,5,0,0,21600,27900,10000"
    io:fig2gra:puts "V,5,0,0,21600,27900,0"

    while true
    do
	a=${sarray:fig2gra:shift}
	if [ -z "$a" ]
	then
	    break
	fi

	b=""
	while true
	do
	    l=${sarray:fig2gra:shift}
	    if regexp:fig2gra:match "a$l"
	    then
		b="$b $l"
	    else
		sarray:fig2gra:unshift "$l"
		break
	    fi
	done
	iarray:fig2gra:@="$a"

	case ${iarray:fig2gra:get:0} in
	    0)			# Color Pseudo-objects
		fig2gra_add_palette $a
		;;
	    1)			# ELLIPSE
		;;
	    2)			# POLYLINE
		if [ ${iarray:fig2gra:get:1} -ne 5 ]
		then
		    iarray:points:@="$b"
		    iarray:points:map "x * $COORD_CONV * 100 / $RESOLUTION"
		    fig2gra_draw_poly_line
		fi
		;;
	    3)			# SPLINE
		;;
	    4)			# TEXT
		;;
	    5)			# ARC
		;;
	    6)			# COMPOUND
		;;
	esac
    done

    io:fig2gra:puts 'E,0'

    io:fig2gra:close
    fig2gra_delete_obj

    return 0
}