freeswitch/libs/xmlrpc-c/tools/binmode-rpc-kit/oct2bin
Michael Jerris 3abb7730b2 add xmlrpc-c 1.03.14 to in tree libs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3772 d0543943-73ff-0310-b7d9-9358b9ac24b2
2006-12-21 03:57:49 +00:00

13 lines
235 B
Perl
Executable File

#!/usr/bin/perl
# Turn C-style octal escapes into binary.
# Call as "echo -n 'ab\0\001cd' | oct2bin > out.binmode".
binmode STDOUT;
while (<>) {
s/\\(\d\d\d)/chr(oct($1))/ge;
s/\\0/chr(0)/ge;
s/\\\\/\\/g;
print $_;
}