summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1995-04-10 18:36:06 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:32 +0900
commitb2420d8ffa4d347a75efbbdc376f4ce65c0eb172 (patch)
treebd40c44d9155d9cb10232a0e962dc1cc221c2c8b /sample
parent11e21a36bc935088f88a7cd1548f8c74c3bf6099 (diff)
version 0.73v0_73
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.73.tar.gz Mon Apr 10 18:36:06 1995 Yukihiro Matsumoto (matz@ix-02) * version 0.73 Fri Apr 7 13:51:08 1995 Yukihiro Matsumoto (matz@ix-02) * cons.c->assoc.c: consの余計な機能は外してpairとしての機能だけを 残した.enumerableをincludeするのもやめた. * string.c(esub): 文字列置換イテレータ.perlのs///eの相当する.
Diffstat (limited to 'sample')
-rwxr-xr-x[-rw-r--r--]sample/from.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/sample/from.rb b/sample/from.rb
index a8baf4f375..df82d5a745 100644..100755
--- a/sample/from.rb
+++ b/sample/from.rb
@@ -59,8 +59,11 @@ $ARGV[0] = '/usr/spool/mail/' + ENV['USER'] if $ARGV.length == 0
$outcount = 0;
def fromout(date, from, subj)
- y, m, d = parsedate(date)
- printf "%-2d/%02d/%02d [%.28s] %.40s\n", y, m, d, from, subj
+ y = m = d = 0
+ y, m, d = parsedate(date) if date
+ from = "sombody@somewhere" if ! from
+ subj = "(nil)" if ! subj
+ printf "%-2d/%02d/%02d [%-28.28s] %-40.40s\n", y, m, d, from, subj
$outcount += 1
end
@@ -83,7 +86,6 @@ while TRUE
fromout fields['Date'], fields['From'], fields['Subject']
while gets()
-# print $_
break if /^From /
end