%PDF- %PDF-
| Direktori : /usr/lib/cups/filter/ |
| Current File : //usr/lib/cups/filter/brftoembosser |
#!/bin/bash
#
# Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
echo "ERROR: $0 jobid user name nb options [filename]" >&2
exit 1
fi
NB=$4
OPTIONS=$5
FILE=$6
if [ -z "$FILE" ]
then
# Get input from stdin
unset FILE
trap -- 'rm -f "$FILE"' EXIT
FILE=$(mktemp "${TMPDIR:-/tmp}/brftoembosser.XXXXXX")
cat > "$FILE"
fi
. /usr/share/cups/braille/cups-braille.sh
SENDFF=$(getOption SendFF)
SENDSUB=$(getOption SendSUB)
echo "INFO: Writing text to generic embosser" >&2
while [ $NB -gt 0 ]
do
< "$FILE" \
sed -e 's/^$/'$'\015''/' \
-e 's/'$'\302'$'\240''/ /g' \
-e 's/'$'\240''/ /g' \
-e 's/\([^'$'\015'']\)$/\1'$'\015''/'
if [ "$SENDFF" = True ]
then
printf '\014'
fi
if [ "$SENDSUB" = True ]
then
printf '\032'
fi
NB=$(($NB - 1))
done
echo "INFO: Ready" >&2
exit 0