This file is indexed.

/usr/bin/pstoepsi is in tgif 1:4.2.5-1.3.

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
#!/bin/sh
# Script to convert an arbitrary PostScript image to an encapsulated
# PostScript image with a bitmap, suitable for incorporation into
# FrameMaker, LaTeX, troff, etc.
#
# Options:
#	-gs	Use ghostscript to convert to EPSI
#	-news	Use Sun's X/NeWS (OpenWindows) to convert to EPSI
#	-strip	Strip all %% directives from the source file -- useful
#		when dealing with Adobe Illustrator and others who
#		use directives incompatible with this coversion.
#	-2x	Use 2x resolution
#	-noprev	Do not include the preview bitmap
#	-debug	Print debugging information
#
# Note in the USAGE line below, the source PostScript file must end
# in a .ps extention.  This is a GhostScript requirement, not mine...
#
# I am providing this without any guarantee.
#
# Thu Nov 29 10:57:05 EST 1990 - Doug Crabill dgc@cs.purdue.edu
#	Original release.
#
# Sun Jan 11 02:47:26 EST 1998 - William C. Cheng <bill.cheng@acm.org>
#	Handles Aladdin Ghostscript 5.x (no pstoppm.ps).
# Thu May 20 11:29:12 EDT 1999 - William C. Cheng <bill.cheng@acm.org>
#	Handles the "-2x" command line argument (needs netpbm-20may1999).
# Fri Sep  1 14:32:15 EDT 2000 - William C. Cheng <bill.cheng@acm.org>
#	Make the default STYLE to be "ppm".
# Fri Mar 23 11:18:17 PST 2001 - William C. Cheng <bill.cheng@acm.org>
#	Handles the "-noprev" command line argument.
# Sat Jan 19 15:50:54 EST 2002 - William C. Cheng <bill.cheng@acm.org>
#	Handles the "-debug" command line argument.
# Wed Sep  1 19:00:00 CDT 2010 - Carlo U. Segre <segre@iit.edu>
#	Reject ./file.eps as a valid input file name.  Patch from
#	Ryo Furue <furue@hawaii.edu> in Debian bug #451540

USAGE="Usage: $0 [ -gs | -news ] [ -strip ] [ -2x ] [ -noprev ] [ -debug ] \
<file>.ps <file>.epsi"

########################## Edit these variables #####################
GS='gs'
PSTOPPM='/usr/local/libdata/X11/gs/pstoppm.ps'
PBMTOEPSI='pbmtoepsi'
RASTTOPNM='/mm/bin/rasttopnm'
INTERP='gs'
STRIP='false'
HIRES='false'
PREVIEWBITMAP='true'
DEBUG='false'
PSTORAST='./pstorast'
######################################################################

GSCOPYRIGHT=`$GS -help | grep Ghostscript`
ALADDIN=`echo $GSCOPYRIGHT | grep Aladdin`
GSVERSION=`echo $GSCOPYRIGHT | cut -d" " -f3 | cut -d"." -f1`

for A do
    case $A in
    -gs)    INTERP='gs'
            shift
            ;;
    -news)  INTERP='news'
            shift
            ;;
    -strip) STRIP='true'
            shift
            ;;
    -2x)    HIRES='true'
            shift
            ;;
    -noprev) PREVIEWBITMAP='false'
            shift
            ;;
    -debug) DEBUG='true'
            shift
            ;;
    *)      break
            ;;
    esac
done

BASE=`basename "$1" .ps`

if [ $# -ne 2 -o ! -f "$1" -o "$1" = "$BASE" ] ; then
    echo $USAGE 1>&2
    exit 1
fi

case "$1" in
    *.ps);;
    *) echo $USAGE 1>&2
    exit 1
esac

TMP1="/tmp/$USER.1.$$"
TMP2="/tmp/$USER.2.$$"
TMP3="/tmp/$USER.3.$$"
trap 'rm -f $TMP1 $TMP2 ${BASE}.ppm; exit' 1 2 3 4 13 15

if [ "true" = "$STRIP" ] ; then
    awk '/^%%/ { next } {print}' < $1 > $TMP3
else
    TMP3="$1"
fi

if [ "gs" = "$INTERP" ] ; then
#    STYLE="none"
    STYLE="ppm"
    if [ "" != "$ALADDIN" ] ; then
        if [ "3" = "$GSVERSION" -o "4" = "$GSVERSION" ] ; then
            STYLE="pstoppm"
            STYLE="ppm"
        fi
        if [ "5" = "$GSVERSION" ] ; then
            STYLE="ppm"
        fi
        if [ "6" = "$GSVERSION" ] ; then
            STYLE="ppm"
        fi
    else
        if [ "2" = "$GSVERSION" ] ; then
            STYLE="pstoppm"
        fi
        if [ "3" = "$GSVERSION" ] ; then
            STYLE="ppm"
        fi
        if [ "4" = "$GSVERSION" ] ; then
            STYLE="ppm"
        fi
        if [ "5" = "$GSVERSION" ] ; then
            STYLE="ppm"
        fi
        if [ "6" = "$GSVERSION" ] ; then
            STYLE="ppm"
        fi
    fi

    if [ "true" = "$DEBUG" ] ; then
        echo ""
        echo "*******************************"
        echo "* Begin Debugging Information *"
        echo "*******************************"
        echo ""
        echo "GSCOPYRIGHT=$GSCOPYRIGHT"
        echo "ALADDIN=$ALADDIN"
        echo "GSVERSION=$GSVERSION"
        echo "STYLE=$STYLE"
        echo "GS=$GS"
        if [ "pstoppm" = "$STYLE" ] ; then
            echo "PSTOPPM=$PSTOPPM"
            echo "    (Note: PSTOPPM must be valid for this program to work)"
        fi
        if [ "ppm" = "$STYLE" ] ; then
            echo "PBMTOEPSI=$PBMTOEPSI"
            echo "    (Note: PBMTOEPSI must be valid for this program to work)"
        fi
        echo ""
        echo "*******************************"
        echo "*  End Debugging Information  *"
        echo "*******************************"
        echo ""
    fi

    if [ "none" = "$STYLE" ] ; then
        echo Does not know how to handle "$GSCOPYRIGHT".
        exit 1
    fi
    if [ "pstoppm" = "$STYLE" ] ; then
        $GS -q -dNODISPLAY $PSTOPPM << DGC
        ($BASE) ppm1run
DGC
    fi
    if [ "ppm" = "$STYLE" ] ; then
        if [ "false" = "$HIRES" ] ; then
            $GS -q -dNOPAUSE -sDEVICE=pbm -sOutputFile=${BASE}.ppm -- "$1"
        else
            $GS -q -dNOPAUSE -r144x144 -sDEVICE=pbm -sOutputFile=${BASE}.ppm -- "$1"
        fi
    fi
    if [ "false" = "$HIRES" ] ; then
        $PBMTOEPSI ${BASE}.ppm > $TMP1
    else
        $PBMTOEPSI -scale 0.5 ${BASE}.ppm > $TMP1
    fi
    if [ "true" = "$PREVIEWBITMAP" ] ; then
        cat $TMP1 $TMP3 > $2
    else
        head -2 $TMP1 > $2
        cat $TMP3 >> $2
    fi
else
    $PSTORAST -in $TMP3 -out $TMP1
    $RASTTOPNM < $TMP1 | $PBMTOEPSI > $TMP2
    cat $TMP2 $TMP3 > $2
fi

if [ "$1" != "$TMP3" ] ; then
    rm -f $TMP3
fi
rm -f $TMP1 $TMP2 ${BASE}.ppm

exit 0

#
# @(#)$Id: pstoepsi,v 1.4 2002/01/19 21:13:12 william Exp william $
#