summaryrefslogtreecommitdiff
path: root/intl/mangle-unprintable
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-12-07 02:53:31 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-12-07 02:53:31 -0800
commitcbb6286cb92020dd7ae88798ed831ed76fd2130e (patch)
tree782a01c00d5e064aa67ea3f9241a8ef1de1060c6 /intl/mangle-unprintable
downloadlinks-upstream.tar.gz
links-upstream.tar.bz2
links-upstream.zip
Imported Upstream version 2.6upstream/2.6upstream
Diffstat (limited to 'intl/mangle-unprintable')
-rwxr-xr-xintl/mangle-unprintable13
1 files changed, 13 insertions, 0 deletions
diff --git a/intl/mangle-unprintable b/intl/mangle-unprintable
new file mode 100755
index 0000000..7833c29
--- /dev/null
+++ b/intl/mangle-unprintable
@@ -0,0 +1,13 @@
+#!/bin/sh
+i=128
+a="sed"
+echo="`which echo`"
+while [ $i -lt 256 ]; do
+ oct="`printf %03o $i`"
+ # dash's internal echo doesn't know -e
+ char="`"$echo" -e \\\\$oct`"
+ a="$a -e 's/$char/\\\\\\\\$oct/g'"
+ i=`expr $i + 1`
+done
+# bash and dash differ here: bash creates double backslashes, dash single
+echo "$a"|sed 's/\\\\\\\\/\\\\/g'