summaryrefslogtreecommitdiff
path: root/sample/from.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-30 07:41:23 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-30 07:41:23 +0000
commit287810940070b1c7b0cc915e6728da2f0aaac5e2 (patch)
treefd7394d6274c72eb3a15a179c627143bf8fb707f /sample/from.rb
parentb6e85a5e29a9790ec33add32bb554b55e3ad4ba9 (diff)
new exception model
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/from.rb')
-rw-r--r--sample/from.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/sample/from.rb b/sample/from.rb
index 0a83f081f11..98fc54799db 100644
--- a/sample/from.rb
+++ b/sample/from.rb
@@ -30,16 +30,19 @@ if ARGV[0] == '-w'
end
if ARGV.length == 0
- user = ENV['USER']
+ file = ENV['MAIL']
+ user = ENV['USER'] || ENV['USERNAME'] || ENV['LOGNAME']
else
file = user = ARGV[0]
ARGV.clear
end
-[ENV['SPOOLDIR'], '/usr/spool', '/var/spool', '/usr', '/var'].each do |m|
- if File.exist? f = "#{m}/mail/#{user}"
- file = f
- break
+if file == nil or !File.exist? file
+ [ENV['SPOOLDIR'], '/usr/spool', '/var/spool', '/usr', '/var'].each do |m|
+ if File.exist? f = "#{m}/mail/#{user}"
+ file = f
+ break
+ end
end
end