This file is indexed.

/usr/bin/ngp2 is in ngraph-gtk 6.07.02-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
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
#! /usr/bin/ngraph -i
# $Id: ngp2.in,v 1.15 2010-02-18 06:38:49 hito Exp $

IGN_PATH=0
AUTO_SCALE=0
OPTION="-gra"
CHDIR=0
PWD=`pwd`
NULL_DEVICE=/dev/null
DPI=86

clear_viewer() {
    for i in `derive -instance draw fit`
    do
	del ${i}:0-!
    done

    if exist -q gra:viewer
    then
	del gra:viewer
    fi
}

save_image() {
    new gra2cairofile name=OUTPUT
    new gra name=OUTPUT
    gra2cairofile:OUTPUT:format=$1
    gra2cairofile:OUTPUT:file=$2
    gra2cairofile:OUTPUT:dpi=$DPI
    gra:OUTPUT:device=gra2cairofile:OUTPUT

    if exist -q gra:viewer
    then
	cpy gra:viewer,OUTPUT draw_obj left_margin top_margin zoom paper_width paper_height
    fi

    if exist -q fit:0
    then
	fit:0-!:display=false
    fi

    gra:OUTPUT:open
    gra:OUTPUT:draw
    gra:OUTPUT:close
    del gra:OUTPUT
    del gra2cairofile:OUTPUT
}

save_gra() {
    if [ -n "$1" ]
    then
	new gra2cairofile file=$NULL_DEVICE
	new gra name=DUMMY
	gra:DUMMY:device=gra2cairofile:0
	gra:DUMMY:open

	new gra2file name=OUTPUT file="$1"
	new gra name=OUTPUT

	if exist -q gra:viewer
	then
	    cpy gra:viewer,OUTPUT draw_obj left_margin top_margin zoom paper_width paper_height
	fi

	if exist -q fit:0
	then
	    fit:0-!:display=false
	fi

	gra:OUTPUT:device=gra2file:OUTPUT
	gra:OUTPUT:open
	gra:OUTPUT:draw
	gra:OUTPUT:close
	del gra:OUTPUT
	del gra2file:OUTPUT

	gra:DUMMY:close
	del gra:DUMMY
	del gra2cairofile
    fi
}

show_usage() {
    echo "ngp2 version 1.10"
    echo "usage: ngp2 [option] ngpfile ..."
    echo
    echo "    -I            ignore path"
    echo "    -a            auto scale"
    echo "    -A            clear scale and auto scale"
    echo "    -c            change directory"
    echo "    -d dpi        set dot per inch"
    echo
    echo "    -ps, -ps3     output PostScript level 3"
    echo "    -ps2          output PostScript level 2"
    echo "    -eps, -eps3   output Encapsulated PostScript level 3"
    echo "    -eps2         output Encapsulated PostScript level 2"
    echo "    -pdf          output Portable Document Format"
    echo "    -svg, -svg1.1 output Scalable Vector Graphics version 1.1"
    echo "    -svg1.2       output Scalable Vector Graphics version 1.2"
    echo "    -png          output Portable Network Graphics"
    echo "    -h, --help    show this usage"
    echo

    del system
}

set +e

new menu

while true
do
    case "$1" in
	-I)
	    IGN_PATH=1
	    shift
	    ;;
	-a)
	    AUTO_SCALE=1
	    shift
	    ;;
	-A)
	    AUTO_SCALE=2
	    shift
	    ;;
	-c)
	    CHDIR=1
	    shift
	    ;;
	-d)
	    shift
	    DPI=$1
	    shift
	    ;;
	-h|--help)
	    show_usage
	    ;;
	-*)
	    OPTION="$1"
	    shift
	    ;;
	*)
	    break
	    ;;
    esac
done

NGP_FILES=$@
if [ -z "$NGP_FILES" ]
then
    show_usage
fi

for NGP_FILE in $NGP_FILES
do
    clear_viewer

    if [ -f "$NGP_FILE" ]
    then
	NGP_NAME=`basename "$NGP_FILE" .ngp`
	PATH_NAME=`dirname $NGP_FILE`

	if exist -q menu:0
	then
	    menu::fullpath_ngp="$NGP_FILE"
	fi

	case "$OPTION" in
	    -)
		;;
	    *)
		echo "Drawing ${NGP_FILE}."
		;;
	esac

	new shell
	shell::shell "$NGP_FILE"
	del shell

	if [ $IGN_PATH -ne 0 ]
	then
	    for i in `object file -instances`
	    do
		put file:$i file=`get file:$i -field basename`
	    done
	fi

	if [ $CHDIR -ne 0 ]
	then
	    cd $PATH_NAME
	fi

	if exist -q axis:0
	then
	    if exist -q file:0
	    then
		case "$AUTO_SCALE" in
		    2)
			axis:0-!:clear
			axis:0-!:auto_scale:'file:0-!'
			;;
		    1)
			axis:0-!:auto_scale:'file:0-!'
			;;
		esac
	    fi
	fi

	TMPFILE=${system:0:temp_file}

	case "$OPTION" in
#======================================================================
# options
#
# $TMPFILE : temporary file (automatically deleted).
# $NGP_NAME : base name of ngp file.

	    -ps|-ps3)
		save_image "ps3" $NGP_NAME.ps
		;;
	    -ps2)
		save_image "ps2" $NGP_NAME.ps
		;;
	    -eps|-eps3)
		save_image "eps3" $NGP_NAME.eps
		;;
	    -eps2)
		save_image "eps2" $NGP_NAME.eps
		;;
	    -pdf)
		save_image "pdf" $NGP_NAME.pdf
		;;
	    -svg|svg1.1)
		save_image "svg1.1" $NGP_NAME.svg
		;;
	    -svg1.2)
		save_image "svg1.2" $NGP_NAME.svg
		;;
	    -png)
		save_image "png" $NGP_NAME.png
		;;
	    -)
		save_gra $TMPFILE
		cat $TMPFILE
		;;
	    *)
		save_gra "$NGP_NAME.gra"
		;;
#======================================================================
	esac
	system:0:unlink_temp_file

	if [ $CHDIR -ne 0 ]
	then
	    cd $PWD
	fi
    fi
done

echo

if exist -q menu:0
then
    del menu:0
fi

del system:0
exit