swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit d0a02720c629f40d787023fdd4276eded59fcfc8
parent 9a5efd4b9586132544e5b56003cfb0eab8db0341
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Sun, 21 Dec 2008 00:13:53 +0100

Style consistency fixes around bin/aux/* and bin/contrib/*
Diffstat:
Mbin/aux/bpst.rc | 20++++++++++----------
Mbin/aux/gensitemaptxt.rc | 2+-
Mbin/contrib/webserver.rc | 20++++++++++----------
3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/bin/aux/bpst.rc b/bin/aux/bpst.rc @@ -8,38 +8,38 @@ fn die { exit 1 } -if (~ $#* 0) +if(~ $#* 0) die 'Missing title' if(~ $#user 0) - user = `{whoami} + user=`{whoami} -file = (); title = (); -bloguser = $user +file=(); title=(); +bloguser=$user while(! ~ $#* 0) { switch($1) { case -u base=/gsoc/www/people/$user/blog/ shift case * - title = $"* + title=$"* } shift } date=`{/bin/date +%F} -n = 1 +n=1 for(f in $base/$date-*) { - i = `{echo $f | sed -n 's|^.*/'$date'-([0-9]+)_.*|\1|p'} + i=`{echo $f | sed -n 's|^.*/'$date'-([0-9]+)_.*|\1|p'} if(! ~ $#i 0 && test $i -ge $n) - n = `{hoc -e $i'+1'} + n=`{hoc -e $i'+1'} } if(~ $EDITOR '') - EDITOR = vi + EDITOR=vi -file = $home/.blogtmp.$pid +file=$home/.blogtmp.$pid rm $file >[2]/dev/null touch $file $EDITOR $file diff --git a/bin/aux/gensitemaptxt.rc b/bin/aux/gensitemaptxt.rc @@ -1,7 +1,7 @@ #!/usr/bin/env rc # DEPRECATED: sitemap.tpl now generates and updates a sitemap.txt when requested, and is also more smart than this simplistic script. -for ( d in sites/*/ ) { +for(d in sites/*/) { echo $d 9 du -a $d | awk '/\.(md|html)$/ { print $2 }; {}' | 9 sed -e 's/\.(md|html)$//' -e 's,/index$,/,' -e 's,^sites/,http://,' > $d/sitemap.txt diff --git a/bin/contrib/webserver.rc b/bin/contrib/webserver.rc @@ -3,28 +3,28 @@ # A web server in rc by maht # Originally from http://www.proweb.co.uk/~matt/rc/webserver.rc -ifs = ' ' -request = `{sed 1q} +ifs=' ' +request=`{sed 1q} -url = $request(2) -file = `{echo $url | sed 's/http:\/\/[^\/]*//' | tr -d \012} +url=$request(2) +file=`{echo $url | sed 's/http:\/\/[^\/]*//' | tr -d \012} if(test -d $file){ - file = $file ^'/index.html' + file=$file ^'/index.html' } -if (test -e $file) { - response = '200' +if(test -e $file) { + response='200' } if not { - response = '404' - file = '404.html' + response='404' + file='404.html' } echo 'HTTP/1.1 ' ^$response echo 'Date: ' `{date} echo 'Server: rc shell' echo 'Content-Length: ' `{cat $file | wc -c | tr -d ' '} -echo 'Content-Type: ' `{file -i $file | awk ' { print $2 } '} +echo 'Content-Type: ' `{file -i $file | awk '{ print $2 }'} echo 'Connection: close' echo cat $file