This file is indexed.

/usr/sbin/paperconfig is in libpaper-utils 1.1.24+nmu5.

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
#! /bin/sh

# paperconfig: configuration of system paper name
#
# Copyright (C) 1996, Yves Arrouye <arrouye@debian.org>
#               2001, Adrian Bunk  <bunk@fs.tum.de>

usage() {
    if [ "$1" = -h ]
    then
	exec 1>&2
	echo -n U
    else
	echo -n u
    fi

    echo "sage: `basename $0` [ -v, --version ] [ -h, --help ] [ -p, --paper name | --force ]"

    if [ "$1" = -h ]
    then
	cat <<EOF

Options: -v, --verbose          print version information and exit
         -h, --help             print this help and exit
	 -p, --paper name	specify the paper to use
         --force                force paper configuration
EOF
	exit 0
    else
	exit 1
    fi
}

# "|| true" added below, to assure that the script does not fail even if
# called with bash -e. (MP 22/08/98)

unset PAPERSIZE || true 
: ${PAPERCONF:=/etc/papersize}
export PAPERCONF

unset PAPERDIR || true 
: ${PAPERDIR:=/etc/libpaper.d}
export PAPERDIR

force=0

if [ "$#" -eq 0 ]
  then
    usage
fi

while [ $# -ne 0 ]
do
    case "$1" in
	-v|--version)
	    echo "`basename $0` version 1.0" \
		"by Yves Arrouye <arrouye@debian.org>"
	    exit 0
	    ;;
	-h|--help)
	    usage -h
	    ;;
	-p|--paper)
	    test $# -gt 1 || usage
	    paper="$2"
	    shift
	    ;;
	--force)
	    force=1
	    ;;
	*)
	    usage
	    ;;
    esac
    shift
done

invalidpaper() {
    ! paperconf "$1" 2>/dev/null 1>&2
}

format() {
    _maxwidth=$1; shift
    _start="$1"; shift

    _cline=

    for w
    do
	if [ `echo "$_start$_cline$w " | wc -c` -ge 0$_maxwidth ]
	then
	    echo "$_cline"
	    _cline=
	    _start=
	fi
	_cline="$_cline$w "
    done

    if [ -n "$_cline" ]
    then
	echo "$_cline"
    fi

    unset _maxwidth _cline _start
}

# "chmod 644" added below, to assure that the conf file is created
# with the right access permissions (MP 13/05/2000)

setpaper() {
    paperright=`paperconf "$1" 2>/dev/null`

    ok=0

    if 2>/dev/null echo "$paperright" >${PAPERCONF}.new
    then
        if 2>/dev/null mv -f ${PAPERCONF}.new $PAPERCONF
	then
	    if 2>/dev/null chmod 644 $PAPERCONF
	    then
		ok=1
            fi
        fi
    fi

    if [ $ok -eq 0 ]
    then
        echo `basename $0`: cannot create $PAPERCONF
        exit 2
    else
	#
	# Added code for calling back applications when
	# papersize changes. See bug #345466
	# eppesuig@debian.org, 2006-01-05
	if [ -d ${PAPERDIR} ]
	then
	    run-parts ${PAPERDIR}
	fi
    fi
}

if [ ! -z "$paper" ]
then
    if invalidpaper $paper
    then
	>&2 echo `basename $0`: \"$paper\" is not a known paper name
	exit 3
    fi
    setpaper "$paper"
    exit 0
fi

knownpapers="`paperconf -a`"

prompt=
width=72

# "|| true" added below, to assure that the script does not fail even if 
# called with bash -e. (MP 22/08/98)

paper=`paperconf 2>/dev/null || true`
dftpaper=`paperconf -d`

if [ $force -eq 1 ] || [ ! -e $PAPERCONF ] || invalidpaper $paper
then
    papers="`format $width \"\" $knownpapers`"
    echo

    if [ -x /usr/bin/pager ]
    then
	: ${PAGER:=/usr/bin/pager}
    fi
    if [ -x /bin/more ]
    then
	: ${PAGER:=/bin/more}
    fi
    : ${PAGER:=cat}

    LESS="-X -E $LESS"
    export LESS

    (
	cat <<EOF
The default (also known as system) paper can be chosen from many known
papers that are currently recognized by programs using the libpaper
library (with libpaper, paper names are case insensitive; if you use
programs that use the system paper size but do not rely on the libpaper
library, this may not be true and some of the papers listed below may
not be known by these programs):

EOF
	echo "$papers" | sed 's/^/    /'
	echo
    ) | ${PAGER}

    : ${paper:=$dftpaper}

    echo -n "Default paper name? [$paper] "
    read ans
    : ${ans:=$paper}
    paper=$ans
fi

while invalidpaper "$paper"
do
    if [ -z "$paper" ]
    then
	echo "Please choose a paper from the available papers list."
    else
	echo "Unknow paper \"$paper\"," \
	    "please choose one from the available papers list."
    fi

    paper=$dftpaper

    echo -n "Default paper name? [$paper] "
    read ans
    paper=$ans
done

if [ "`paperconf 2>/dev/null`" != "$paper" ] || grep -q "[# 	]" $PAPERCONF
then
    setpaper "$paper"
fi

exit 0