summaryrefslogtreecommitdiff
path: root/sample/from.rb
diff options
context:
space:
mode:
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