mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Improve getting the mailbox from the environment.
This commit is contained in:
parent
56f78d9e3c
commit
6dd87830d0
1 changed files with 5 additions and 5 deletions
|
@ -142,12 +142,12 @@ def _test():
|
|||
|
||||
args = sys.argv[1:]
|
||||
if not args:
|
||||
if os.environ.has_key('MAIL'):
|
||||
mbox = os.environ['MAIL']
|
||||
elif os.environ.has_key('MAIL'):
|
||||
mbox = os.environ['USER']
|
||||
for key in 'MAIL', 'LOGNAME', 'USER':
|
||||
if os.environ.has_key(key):
|
||||
mbox = os.environ[key]
|
||||
break
|
||||
else:
|
||||
print "Who are you?"
|
||||
print "$MAIL, $LOGNAME nor $USER set -- who are you?"
|
||||
return
|
||||
else:
|
||||
mbox = args[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue