From 85f15f07a01fc508f88fbbd2f1c3b61ec888cdd8 Mon Sep 17 00:00:00 2001 Message-Id: <85f15f07a01fc508f88fbbd2f1c3b61ec888cdd8.1717838906.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 24 May 2015 11:47:02 +0100 Subject: [PATCH 1/1] pwsafe: Eliminate the `dump' subcommand. Organization: Straylight/Edgeware From: Mark Wooding Its functionality will be replaced later. Also, remove some functions which existed only to support `dump'. --- pwsafe | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/pwsafe b/pwsafe index 45086ad..a3365e7 100644 --- a/pwsafe +++ b/pwsafe @@ -27,7 +27,8 @@ ###--------------------------------------------------------------------------- ### 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 @@ -58,22 +59,6 @@ def chomp(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. @@ -191,14 +176,6 @@ def cmd_del(av): 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'], @@ -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]]'], - 'delete' : [cmd_del, 'TAG'], - 'dump' : [cmd_dump, '']} + 'delete' : [cmd_del, 'TAG']} ###-------------------------------------------------------------------------- ### Command-line handling and dispatch. -- [mdw]