home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / contrib / qpdecode.sed.mail next >
Encoding:
Internet Message Format  |  1993-02-02  |  2.0 KB

  1. From: "David Herron" <david@twg.com>
  2. Subject: Hackers corner: A sed script for decoding quoted printable
  3. To: MM Discussions <info-metamail@thumper.bellcore.com>,
  4.         IETF-822 Discussion <ietf-822@dimacs.rutgers.edu>
  5. Date: Tue, 26 Jan 93 10:05:31 PST
  6.  
  7. Last night I was setting up an emailable archive server on my home system
  8. (servicemail makes some things so easy).  The fact that it insists on returning
  9. files in quoted printable or base64 is a compatibility problem since most
  10. people don't have either.  So, as the first stage in boostrapping users
  11. to being able to decode these files the following was written.  The next
  12. step is leaving a standalone copy of the mimencode source on the server.
  13.  
  14. Nathaniel, I offer this up to the contrib part of the metamail distribution.
  15.  
  16. It misses the octets from =80 to =FF.  It has been tested to properly
  17. decode all the files on my archive server and doesn't crap out when the
  18. original text has a trailing equal-sign (=).  Since it has some control
  19. characters I'll include a uuencoded version as well.
  20.  
  21. USAGE:    sed -f qpdecode.sed <input >output
  22.  
  23.  
  24. : top
  25. s/=01//g
  26. s/=02//g
  27. s/=03//g
  28. s/=04//g
  29. s/=05//g
  30. s/=06//g
  31. s/=07//g
  32. s/=08//g
  33. s/=09/    /g
  34. s/=0[aA]/\
  35. /g
  36. s/=0[bB]/ /g
  37. s/=0[cC]/ /g
  38. s/=0[dD]//g
  39. s/=0[eE]//g
  40. s/=0[fF]//g
  41. s/=10//g
  42. s/=11//g
  43. s/=12//g
  44. s/=13//g
  45. s/=14//g
  46. s/=15//g
  47. s/=16//g
  48. s/=17//g
  49. s/=18//g
  50. s/=19//g
  51. s/=1[aA]//g
  52. s/=1[bB]//g
  53. s/=1[cC]//g
  54. s/=1[dD]//g
  55. s/=1[eE]//g
  56. s/=1[fF]//g
  57. s/=2[eE]/./g
  58. /=$/{
  59.     N
  60.     s/=\n//g
  61.     b top
  62. }
  63. s/=3[dD]/=/g
  64.  
  65.  
  66. begin 644 qpdecode.sed
  67. M.B!T;W *<R\],#$O 2]G"G,O/3 R+P(O9PIS+STP,R\#+V<*<R\],#0O!"]G
  68. M"G,O/3 U+P4O9PIS+STP-B\&+V<*<R\],#<O!R]G"G,O/3 X+P@O9PIS+STP
  69. M.2\)+V<*<R\],%MA05TO7 HO9PIS+STP6V)"72\++V<*<R\],%MC0UTO#"]G
  70. M"G,O/3!;9$1=+PTO9PIS+STP6V5%72\.+V<*<R\],%MF1ETO#R]G"G,O/3$P
  71. M+Q O9PIS+STQ,2\1+V<*<R\],3(O$B]G"G,O/3$S+Q,O9PIS+STQ-"\4+V<*
  72. M<R\],34O%2]G"G,O/3$V+Q8O9PIS+STQ-R\7+V<*<R\],3@O&"]G"G,O/3$Y
  73. M+QDO9PIS+STQ6V%!72\:+V<*<R\],5MB0ETO&R]G"G,O/3%;8T-=+QPO9PIS
  74. M+STQ6V1$72\=+V<*<R\],5ME15TO'B]G"G,O/3%;9D9=+Q\O9PIS+STR6V5%
  75. M72\N+V<*+STD+WL*"4X*"7,O/5QN+R]G"@EB('1O< I]"G,O/3-;9$1=+STO
  76. "9PHN
  77.  
  78. end
  79.  
  80.