"Fossies" - the Fresh Open Source Software Archive

Member "links-1.04/intl/mangle-unprintable" (21 Feb 2012, 329 Bytes) of package /linux/www/links-1.04.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "mangle-unprintable": 1.03_vs_1.04.

    1 #!/bin/sh
    2 i=128
    3 a="sed"
    4 echo="`which echo`"
    5 while [ $i -lt 256 ]; do
    6     oct="`printf %03o $i`"
    7     # dash's internal echo doesn't know -e
    8     char="`"$echo" -e \\\\$oct`"
    9     a="$a -e 's/$char/\\\\\\\\$oct/g'"
   10     i=`expr $i + 1`
   11 done
   12 # bash and dash differ here: bash creates double backslashes, dash single
   13 echo "$a"|sed 's/\\\\\\\\/\\\\/g'