chiark / gitweb /
pwsafe: Eliminate the `dump' subcommand.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 May 2015 10:47:02 +0000 (11:47 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 28 May 2015 10:21:01 +0000 (11:21 +0100)
Its functionality will be replaced later.

Also, remove some functions which existed only to support `dump'.

pwsafe

diff --git a/pwsafe b/pwsafe
index 45086ad7ab2c48f1a9c89ccdb6e7f55fe52e3a10..a3365e72510c76dcf078619e294180b5c3de904e 100644 (file)
--- a/pwsafe
+++ b/pwsafe
@@ -27,7 +27,8 @@
 ###---------------------------------------------------------------------------
 ### Imported modules.
 
 ###---------------------------------------------------------------------------
 ### 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
 from os import environ
 from sys import argv, exit, stdin, stdout, stderr
 from getopt import getopt, GetoptError
@@ -58,22 +59,6 @@ def chomp(pp):
     pp = pp[:-1]
   return pp
 
     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.
 
 ###--------------------------------------------------------------------------
 ### Subcommand implementations.
 
@@ -191,14 +176,6 @@ def cmd_del(av):
   except KeyError, exc:
     die('Password `%s\' not found.' % exc.args[0])
 
   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'],
 commands = { 'create': [cmd_create,
                         '[-c CIPHER] [-h HASH] [-m MAC] [PP-TAG]'],
              'find' : [cmd_find, 'LABEL'],
@@ -207,8 +184,7 @@ commands = { 'create': [cmd_create,
              'changepp' : [cmd_changepp, ''],
              'copy' : [cmd_copy, 'DEST-FILE [GLOB-PATTERN]'],
              'to-pixie' : [cmd_topixie, '[TAG [PIXIE-TAG]]'],
              '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.
 
 ###--------------------------------------------------------------------------
 ### Command-line handling and dispatch.