Style consistency fixes around bin/aux/* and bin/contrib/*

This commit is contained in:
uriel 2008-12-21 00:13:53 +01:00
parent 8c10f7653a
commit 14c33b7110
3 changed files with 21 additions and 21 deletions

View File

@ -8,38 +8,38 @@ fn die {
exit 1 exit 1
} }
if (~ $#* 0) if(~ $#* 0)
die 'Missing title' die 'Missing title'
if(~ $#user 0) if(~ $#user 0)
user = `{whoami} user=`{whoami}
file = (); title = (); file=(); title=();
bloguser = $user bloguser=$user
while(! ~ $#* 0) { while(! ~ $#* 0) {
switch($1) { switch($1) {
case -u case -u
base=/gsoc/www/people/$user/blog/ base=/gsoc/www/people/$user/blog/
shift shift
case * case *
title = $"* title=$"*
} }
shift shift
} }
date=`{/bin/date +%F} date=`{/bin/date +%F}
n = 1 n=1
for(f in $base/$date-*) { 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) if(! ~ $#i 0 && test $i -ge $n)
n = `{hoc -e $i'+1'} n=`{hoc -e $i'+1'}
} }
if(~ $EDITOR '') if(~ $EDITOR '')
EDITOR = vi EDITOR=vi
file = $home/.blogtmp.$pid file=$home/.blogtmp.$pid
rm $file >[2]/dev/null rm $file >[2]/dev/null
touch $file touch $file
$EDITOR $file $EDITOR $file

View File

@ -1,7 +1,7 @@
#!/usr/bin/env rc #!/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. # 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 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 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

View File

@ -3,28 +3,28 @@
# A web server in rc by maht # A web server in rc by maht
# Originally from http://www.proweb.co.uk/~matt/rc/webserver.rc # Originally from http://www.proweb.co.uk/~matt/rc/webserver.rc
ifs = ' ' ifs=' '
request = `{sed 1q} request=`{sed 1q}
url = $request(2) url=$request(2)
file = `{echo $url | sed 's/http:\/\/[^\/]*//' | tr -d \012} file=`{echo $url | sed 's/http:\/\/[^\/]*//' | tr -d \012}
if(test -d $file){ if(test -d $file){
file = $file ^'/index.html' file=$file ^'/index.html'
} }
if (test -e $file) { if(test -e $file) {
response = '200' response='200'
} }
if not { if not {
response = '404' response='404'
file = '404.html' file='404.html'
} }
echo 'HTTP/1.1 ' ^$response echo 'HTTP/1.1 ' ^$response
echo 'Date: ' `{date} echo 'Date: ' `{date}
echo 'Server: rc shell' echo 'Server: rc shell'
echo 'Content-Length: ' `{cat $file | wc -c | tr -d ' '} 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 'Connection: close'
echo echo
cat $file cat $file