summaryrefslogtreecommitdiffstats
path: root/Lib/base64.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-09-18 21:49:24 (GMT)
committerGuido van Rossum <guido@python.org>1995-09-18 21:49:24 (GMT)
commit54c1510cb7eeda3135cd4ad23aebef8d13db7bc1 (patch)
tree14e73d1959763c9f33255be9b5435901e4be669f /Lib/base64.py
parenta1e7e6289301d981eff8357ed5b1f8ba95a9fc71 (diff)
downloadcpython-54c1510cb7eeda3135cd4ad23aebef8d13db7bc1.zip
cpython-54c1510cb7eeda3135cd4ad23aebef8d13db7bc1.tar.gz
cpython-54c1510cb7eeda3135cd4ad23aebef8d13db7bc1.tar.bz2
improved test/main program
Diffstat (limited to 'Lib/base64.py')
-rwxr-xr-xLib/base64.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/base64.py b/Lib/base64.py
index 55f01ce..90b5273 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -106,18 +106,19 @@ def decodestring(s):
decode(f, g)
return g.getvalue()
-# Small test program, reads stdin, writes stdout.
-# no arg: encode, any arg: decode.
+# Small test program
def test():
import sys, getopt
try:
opts, args = getopt.getopt(sys.argv[1:], 'deut')
except getopt.error, msg:
+ sys.stdout = sys.stderr
print msg
print """usage: basd64 [-d] [-e] [-u] [-t] [file|-]
-d, -u: decode
-e: encode (default)
-t: decode string 'Aladdin:open sesame'"""
+ sys.exit(2)
func = encode
for o, a in opts:
if o == '-e': func = encode