###---------------------------------------------------------------------------
### Imported modules.
-import gdbm as G
+from __future__ import with_statement
+
from os import environ
from sys import argv, exit, stdin, stdout, stderr
from getopt import getopt, GetoptError
pp = pp[:-1]
return pp
-def asciip(s):
- """Answer whether all of the characters of S are plain ASCII."""
- for ch in s:
- if ch < ' ' or ch > '~': return False
- return True
-
-def present(s):
- """
- Return a presentation form of the string S.
-
- If S is plain ASCII, then return S unchanged; otherwise return it as one of
- Catacomb's ByteString objects.
- """
- if asciip(s): return s
- return C.ByteString(s)
-
###--------------------------------------------------------------------------
### Subcommand implementations.
except KeyError, exc:
die('Password `%s\' not found.' % exc.args[0])
-def cmd_dump(av):
- db = gdbm.open(file, 'r')
- k = db.firstkey()
- while True:
- if k is None: break
- print '%r: %r' % (present(k), present(db[k]))
- k = db.nextkey(k)
-
commands = { 'create': [cmd_create,
'[-c CIPHER] [-h HASH] [-m MAC] [PP-TAG]'],
'find' : [cmd_find, 'LABEL'],
'changepp' : [cmd_changepp, ''],
'copy' : [cmd_copy, 'DEST-FILE [GLOB-PATTERN]'],
'to-pixie' : [cmd_topixie, '[TAG [PIXIE-TAG]]'],
- 'delete' : [cmd_del, 'TAG'],
- 'dump' : [cmd_dump, '']}
+ 'delete' : [cmd_del, 'TAG']}
###--------------------------------------------------------------------------
### Command-line handling and dispatch.