summaryrefslogtreecommitdiffstats
path: root/Demo/scripts/from.py
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/scripts/from.py')
-rwxr-xr-xDemo/scripts/from.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/Demo/scripts/from.py b/Demo/scripts/from.py
deleted file mode 100755
index c8a9346..0000000
--- a/Demo/scripts/from.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /usr/bin/env python3
-
-# Print From and Subject of messages in $MAIL.
-# Extension to multiple mailboxes and other bells & whistles are left
-# as exercises for the reader.
-
-import sys, os
-
-# Open mailbox file. Exits with exception when this fails.
-
-try:
- mailbox = os.environ['MAIL']
-except (AttributeError, KeyError):
- sys.stderr.write('No environment variable $MAIL\n')
- sys.exit(2)
-
-try:
- mail = open(mailbox)
-except IOError:
- sys.exit('Cannot open mailbox file: ' + mailbox)
-
-while 1:
- line = mail.readline()
- if not line:
- break # EOF
- if line.startswith('From '):
- # Start of message found
- print(line[:-1], end=' ')
- while 1:
- line = mail.readline()
- if not line or line == '\n':
- break
- if line.startswith('Subject: '):
- print(repr(line[9:-1]), end=' ')
- print()