shithub: werc

Download patch

ref: ad9ac1c18dd274a94a6871897571d96bbc1faf00
parent: f40bff88ef02bd98160c8e95e58206382a378658
author: uriel <uriel@engel.se.cat-v.org>
date: Sat Dec 20 19:13:53 EST 2008

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

--- a/bin/aux/bpst.rc
+++ b/bin/aux/bpst.rc
@@ -8,14 +8,14 @@
 	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
@@ -22,7 +22,7 @@
         base=/gsoc/www/people/$user/blog/
 		shift
 	case *
-		title = $"*
+		title=$"*
 	}
     shift
 }
@@ -29,17 +29,17 @@
 
 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
--- 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
 
--- a/bin/contrib/webserver.rc
+++ b/bin/contrib/webserver.rc
@@ -3,21 +3,21 @@
 # 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
@@ -24,7 +24,7 @@
 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