#!/bin/bash # # Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # # 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 case $0 in *indexv3*) . /usr/share/cups/braille/indexv3.sh ;; *indexv4*) . /usr/share/cups/braille/indexv4.sh ;; *) echo "ERROR: $0 must be called as somethingindexv3 or somethingindexv4" >&2 exit 1 ;; esac printf "$INIT" if [ $LIBLOUIS1 != None -o \ $LIBLOUIS2 != None -o \ $LIBLOUIS3 != None -o \ $LIBLOUIS4 != None ] then # software-translated, send to printer in transparent mode echo "INFO: Writing text to Index embosser in transparent mode" >&2 if [ -z "$FILE" ] then cat else cat "$FILE" fi | ( IFS=$'\n' read -r LINE EOF=$? while [ "$EOF" = 0 -o -n "$LINE" ] do # Strip CRs LINE=${LINE//$'\015'} # Ignore SUBs LINE=${LINE//$'\032'} # Turn non-breakable spaces into spaces LINE=${LINE//$'\302'$'\240'/ } LINE=${LINE//$'\240'/ } # Interpret FFs while [ -n "$LINE" -a -z "${LINE/#$'\014'*}" ] do printf "\\f" LINE=${LINE#$'\014'} done # Make sure there is nothing else we don't process if [ -n "$LINE" ] then if [ -z "${LINE/*[$'\000'-$'\037'$'\177']*}" ] then echo "ERROR: unsupported control character in BRF file" >&2 fi if [ -z "${LINE/*[$'\200'-$'\377']*}" ] then echo "ERROR: unsupported non-ASCII character in BRF file" >&2 fi fi CHARS=$(printf %s "$LINE" | wc -c) if [ "$CHARS" -gt 127 ] then # Index printers have a bug with numbers between 128 and 255 in # transparent mode escape sequence. This is normally not a problem since # 128 chars is more than a line worth of text echo "ERROR: Line too long ($CHARS)" >&2 exit 1 fi if [ "$CHARS" -gt 0 ] then # Enter transparent mode for $CHARS characters printf "\\033\\\\\\x$(printf %02x $CHARS)\\x00" # Echo those $CHARS characters. # First normalize BRF characters (`a-z{|}~ are non-standard). # Drop unicode patterns with dots 7 or 8 in case the liblouis table happened to erroneously emit one # Drop remaining erroneous multibyte characters # Drop remaining erroneous 1-byte characters # Then turn it into Index 6dots sequences. printf %s "$LINE" | \ tr "\`a-z{|}~" "@A-Z\\[\\\\]_" | \ sed -e 's/[⡀⡁⡂⡃⡄⡅⡆⡇⡈⡉⡊⡋⡌⡍⡎⡏⡐⡑⡒⡓⡔⡕⡖⡗⡘⡙⡚⡛⡜⡝⡞⡟⡠⡡⡢⡣⡤⡥⡦⡧⡨⡩⡪⡫⡬⡭⡮⡯⡰⡱⡲⡳⡴⡵⡶⡷⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⢈⢉⢊⢋⢌⢍⢎⢏⢐⢑⢒⢓⢔⢕⢖⢗⢘⢙⢚⢛⢜⢝⢞⢟⢠⢡⢢⢣⢤⢥⢦⢧⢨⢩⢪⢫⢬⢭⢮⢯⢰⢱⢲⢳⢴⢵⢶⢷⢸⢹⢺⢻⢼⢽⢾⢿⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿]/ /g' | \ sed -e "s/[^] \!\"#$%&'()*+,.\\/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\\\^_[-]/ /g" | \ tr "\000-\037\177\200-\377" " " | \ tr " \!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[\\\\\\]^_" "\\0V tSQW"$'\004'"gvAT@DP"$'\024'"d"$'\002\006'"\"bB&fF\$a\`Cw4q"$'\020\001\003\021'"1!"$'\023'"3#"$'\022'"2"$'\005\007\025'"5%"$'\027'"7'"$'\026'"6EGrUueRcs0p" fi if [ "$EOF" = 0 ] then printf "\\r\\n" fi IFS=$'\n' read -r LINE EOF=$? done ) if [ $? != 0 ] then printf '\032' exit 1 fi else # not software-translated, send to printer as such echo "INFO: Writing text to Index embosser" >&2 if [ -z "$FILE" ] then cat else cat "$FILE" fi fi printf '\032' echo "INFO: Ready" >&2
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
bannertopdf | File | 58.47 KB | 0755 |
|
brftoembosser | File | 1.96 KB | 0755 |
|
brftopagedbrf | File | 3.39 KB | 0755 |
|
c2esp | File | 42.43 KB | 0755 |
|
c2espC | File | 30.32 KB | 0755 |
|
cgmtopdf | File | 2.13 KB | 0755 |
|
cmxtopdf | File | 2.13 KB | 0755 |
|
command2esp | File | 22.32 KB | 0755 |
|
command2foo2lava-pjl | File | 22.39 KB | 0755 |
|
commandtoescpx | File | 14.3 KB | 0755 |
|
commandtopclx | File | 14.3 KB | 0755 |
|
commandtops | File | 14.31 KB | 0755 |
|
emftopdf | File | 2.13 KB | 0755 |
|
foomatic-rip | File | 115.42 KB | 0755 |
|
gstopdf | File | 555 B | 0755 |
|
gstopxl | File | 558 B | 0755 |
|
gstoraster | File | 62.47 KB | 0755 |
|
gziptoany | File | 14.31 KB | 0755 |
|
hpcups | File | 430.86 KB | 0755 |
|
hpcupsfax | File | 34.32 KB | 0755 |
|
hpps | File | 46.7 KB | 0755 |
|
imagetobrf | File | 3.67 KB | 0755 |
|
imagetopdf | File | 46.36 KB | 0755 |
|
imagetops | File | 988 B | 0755 |
|
imagetoraster | File | 59.66 KB | 0755 |
|
imagetoubrl | File | 3.67 KB | 0755 |
|
imageubrltoindexv3 | File | 6.43 KB | 0755 |
|
imageubrltoindexv4 | File | 6.49 KB | 0755 |
|
mupdftoraster | File | 22.3 KB | 0755 |
|
musicxmltobrf | File | 1.83 KB | 0755 |
|
pdftopdf | File | 174.49 KB | 0755 |
|
pdftops | File | 74.84 KB | 0755 |
|
pdftoraster | File | 46.49 KB | 0755 |
|
pstops | File | 54.34 KB | 0755 |
|
pstoqpdl | File | 26.31 KB | 0755 |
|
pstotiff | File | 393 B | 0755 |
|
rastertobrlaser | File | 42.23 KB | 0755 |
|
rastertoepson | File | 22.3 KB | 0755 |
|
rastertoescpx | File | 34.3 KB | 0755 |
|
rastertohp | File | 18.3 KB | 0755 |
|
rastertolabel | File | 22.3 KB | 0755 |
|
rastertopclm | File | 563 B | 0755 |
|
rastertopclx | File | 38.32 KB | 0755 |
|
rastertopdf | File | 94.41 KB | 0755 |
|
rastertops | File | 18.32 KB | 0755 |
|
rastertoptch | File | 34 KB | 0755 |
|
rastertopwg | File | 18.3 KB | 0755 |
|
rastertoqpdl | File | 74.34 KB | 0755 |
|
rastertosag-gdi | File | 15.59 KB | 0755 |
|
svgtopdf | File | 2.13 KB | 0755 |
|
sys5ippprinter | File | 34.42 KB | 0755 |
|
textbrftoindexv3 | File | 4.8 KB | 0755 |
|
textbrftoindexv4 | File | 4.8 KB | 0755 |
|
texttobrf | File | 9.07 KB | 0755 |
|
texttopdf | File | 61.6 KB | 0755 |
|
texttops | File | 982 B | 0755 |
|
texttotext | File | 30.3 KB | 0755 |
|
vectortobrf | File | 2.53 KB | 0755 |
|
vectortopdf | File | 2.13 KB | 0755 |
|
vectortoubrl | File | 2.53 KB | 0755 |
|
wmftopdf | File | 2.13 KB | 0755 |
|
xfigtopdf | File | 2.13 KB | 0755 |
|