diff options
| author | hmeland | 1999-03-04 17:18:24 +0000 |
|---|---|---|
| committer | hmeland | 1999-03-04 17:18:24 +0000 |
| commit | 97d8f58144ccae5b22b8eaeeabd1450d318a404b (patch) | |
| tree | c38f5b6d8464c229d43a7aa9bab0fe11053d5d2b /bin/remove_members | |
| parent | 07b365ac5e2af38dd05472092133a2278a2e7065 (diff) | |
| download | mailman-97d8f58144ccae5b22b8eaeeabd1450d318a404b.tar.gz mailman-97d8f58144ccae5b22b8eaeeabd1450d318a404b.tar.zst mailman-97d8f58144ccae5b22b8eaeeabd1450d318a404b.zip | |
If the file specified with -f is "-", read addresses to remove from
stdin (in addition to those specified on the command line).
Diffstat (limited to '')
| -rwxr-xr-x | bin/remove_members | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bin/remove_members b/bin/remove_members index 991443752..26b3bc2f9 100755 --- a/bin/remove_members +++ b/bin/remove_members @@ -25,7 +25,8 @@ Where: --file file -f file - Remove member addresses found in the given file. + Remove member addresses found in the given file. If file is + `-', read stdin. --help -h @@ -50,6 +51,15 @@ def usage(status, msg=''): print msg sys.exit(status) +def ReadFile(filename): + lines = [] + if filename == "-": + fp = sys.stdin + else: + fp = open(filename) + lines = filter(None, map(string.strip, fp.readlines())) + fp.close() + return lines def main(): @@ -76,13 +86,10 @@ def main(): if filename: try: - fp = open(filename) - addresses = addresses + \ - filter(None, map(string.strip, fp.readlines())) - fp.close() + addresses = addresses + ReadFile(filename) except IOError: print 'Could not open file for reading: %s. Ignoring...' % \ - filename + `filename` try: # open locked |
