This file is indexed.

/usr/bin/imgmerge is in xpaint 2.9.1.4-3.1+b2.

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
#!/bin/bash
# Copyright 2007, J.-P. Demailly <demailly@fourier.ujf-grenoble.fr>
# Licence : GPLv3

BASE=`pwd | tr " " "_"`
BASE=`basename $BASE`

echo -n "Suffix type of images (png/jpg/...) ? "
read SUFF
if test "$SUFF" = "" 
then
  SUFF=png
fi

echo -n "Radix name of pages ? "
read RADIX

echo -e "\
/* Xpaint-image */\n\
\n\
#define PERCENT 100.0\n\
#define GRAY 1\n\
#define PAPERX 596\n\
#define PAPERY 842\n\
#define SHIFTX 0.0       /* percent of page width */\n\
#define SHIFTY 0.0       /* percent of page height */\n\
#define ALTERNATE 1      /* alternate SHIFTX 1 or -1 */\n\
\n\
#include <Xpaint.h>\n\
#include <stdio.h>\n\
\n\
\n\
/* \n\
 * The key-word \"ImageCreate\" is reserved for user-defined image routines;\n\
 * Such a routine should create and process an image.\n\
 * \n\
 * Pixels are unsigned char arrays p[0]=red, p[1]=green, p[2]=blue\n\
 * (thus each value should be in the range 0..255)\n\
 */\n\
\n\
Image * ImageCreate()\n\
{\n\
    Image * input;\n\
    FILE * fd;\n\
    char buf[100];\n\
    int sign;\n\
    \n\
    static PageInfo pinfo;\n\
\n\
    input = ImageFromFile(\"xpaint_input\");\n\
\n\
    fd = fopen(\"__page_number\", \"r\");\n\
    fgets(buf, 80,fd);\n\
    sign = atoi(buf);\n\
    fclose(fd);\n\
    if (sign & 1) sign = 1 ; else sign = ALTERNATE;\n\
\n\
    /* Don't forget this otherwise xpaint may crash if input does not exist */\n\
    if (!input) \n\
    {\n\
       	       printf(\"Read failure : 'xpaint_input' !!\0134n\");\n\
               exit(0);\n\
    }\n\
     \n\
    pinfo.width = input->width;\n\
    pinfo.height = input->height;\n\
    pinfo.rx = (int) (SHIFTX * 0.01 * (float)PAPERX * sign);\n\
    pinfo.ry = (int) (SHIFTY * 0.01 * (float)PAPERY);\n\
    pinfo.wsubdiv = 1;\n\
    pinfo.hsubdiv = 1;\n\
    pinfo.wpercent = PERCENT * (float)PAPERX/((float)pinfo.width);\n\
    pinfo.hpercent = PERCENT * (float)PAPERY/((float)pinfo.height);\n\
    printf(\"Image size : %d x %d\", pinfo.width, pinfo.height);\n\
    printf(\"  -->  resizing  %4.2f %% x %4.2f %%\0134n\",\n\
	   pinfo.wpercent, pinfo.hpercent);\n\
    pinfo.wbbox = PAPERX;\n\
    pinfo.hbbox = PAPERY;\n\
    pinfo.orient = 0;\n\
    pinfo.gray = GRAY;\n\
    pinfo.eps = 0;\n\
    pinfo.compress = 1;\n\
    pinfo.pdf = 0;\n\
\n\
    WriteResizedPS(\"xpaint_output.ps\", input, &pinfo);\n\
    exit(0);\n\
    return NULL;\n\
}\n\
" > /tmp/xpaint_print_script.c

x-terminal-emulator -e sensible-editor /tmp/xpaint_print_script.c

FIRST=First
COUNT=0
i=0
i0=0
echo "Starting $BASE.pdf ..."
echo ""

while [ 1 ] 
do
  if test "$[$i<10]" == "1"
  then
    j=0$i
    k=00$i
  else
    j=$i
    if test "$[$i<100]" == "1"
    then
      k=0$i
    else
      k=$i
    fi
  fi
  FILE="$RADIX"$i.$SUFF
  if ! [ -r "$FILE" ]
  then
    FILE="$RADIX"$j.$SUFF  
  fi
  if ! [ -r "$FILE" ]
  then
    FILE="$RADIX"$k.$SUFF  
  fi 
  if ! [ -r "$FILE" ]
  then
     COUNT=$[$COUNT+1]
     if test "$[$COUNT<100]" == "1"
     then
        i=$[$i+1]
        i0=$i
        continue	
     else
        echo "No more pages seem to be there. Job over."
	echo ""
	echo "Check file $BASE.pdf"
	echo ""	
	break
     fi
  fi
  COUNT=0
  echo "$[1+$i-$i0]" > __page_number
  echo "Xpaint : processing $FILE  as PDF file ..."
  rm -f xpaint_input  
  ln -s "$FILE" xpaint_input
  xpaint -iconic /tmp/xpaint_print_script.c 2>/dev/null
  mv xpaint_output.ps __page_$j.ps
  ps2pdf __page_$j.ps
  rm -f __page_$j.ps  __page_new*

  if test "$FIRST" == "First"
  then
    FIRST=""
    mv -f __page_$j.pdf $BASE.pdf
    PREV=__page_$j
  else
    mv -f $BASE.pdf $PREV.pdf
    pdfconcat -o $BASE.pdf $PREV.pdf __page_$j.pdf 2>&1 1>/dev/null
    PREV=__page_$FIRST-$j
  fi
  i=$[$i+1]
done

rm -f __page*
rm -f xpaint_input
rm -f /tmp/xpaint_print_script.c