tfix from plan 9 - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 82d3a08d01e8d374dd7764ed8998f38ae50d8299
parent fa059a4e3f19706674ed7314d5c4a764a1bc8222
Author: rsc 
Date:   Sun, 18 Dec 2005 11:36:30 +0000

fix from plan 9

Diffstat:
  M bin/yesterday                       |      20 +++++++++++++++++---

1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/bin/yesterday b/bin/yesterday
t@@ -1,6 +1,20 @@
 #!/usr/local/plan9/bin/rc
 
-path=($path $PLAN9/bin)
+. 9.rc
+
+smon='s/Jan/01/
+        s/Feb/02/
+        s/Mar/03/
+        s/Apr/04/
+        s/May/05/
+        s/Jun/06/
+        s/Jul/07/
+        s/Aug/08/
+        s/Sep/09/
+        s/Oct/10/
+        s/Nov/11/
+        s/Dec/12/'
+
 
 fn usage {
         echo 'usage: yesterday [-cd] [-[[yy]yy]mm]dd] [-n daysago] file ...' >[1=2]
t@@ -48,8 +62,8 @@ while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){
                 }
                 if not
                         days=`{echo $1 | sed 's/^-.//'}
-                last=`{date -r `{perl -e 'print time() - '$days'*60*60*24'} | 
-                                9 sed -e 's%... (...) (..) ..:..:.. ... (....)%\3/\1\2%' -e 'y/ /0/' -e $smon}
+                last=`{date `{hoc -e `{date -n} ^ '-'$days'*60*60*24'} | \
+                                sed -e 's%... (...) (..) ..:..:.. ... (....)%\3/\1\2%' -e 'y/ /0/' -e $smon}
                 shift
         case -[0-9]
                 mon=`{date|9 sed 's/^....(...).*/\1/' -e $smon}