aboutsummaryrefslogtreecommitdiff
path: root/bin/yesterday
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-12-18 11:36:30 +0000
committerrsc <devnull@localhost>2005-12-18 11:36:30 +0000
commit82d3a08d01e8d374dd7764ed8998f38ae50d8299 (patch)
tree1992b441141bf4a97c8fa40e032c0b3ba3e45ced /bin/yesterday
parentfa059a4e3f19706674ed7314d5c4a764a1bc8222 (diff)
downloadplan9port-82d3a08d01e8d374dd7764ed8998f38ae50d8299.tar.gz
plan9port-82d3a08d01e8d374dd7764ed8998f38ae50d8299.tar.bz2
plan9port-82d3a08d01e8d374dd7764ed8998f38ae50d8299.zip
fix from plan 9
Diffstat (limited to 'bin/yesterday')
-rwxr-xr-xbin/yesterday20
1 files changed, 17 insertions, 3 deletions
diff --git a/bin/yesterday b/bin/yesterday
index bf31dac6..04ef31c7 100755
--- a/bin/yesterday
+++ b/bin/yesterday
@@ -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]
@@ -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}