werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

fix-rc-scripts (601B)


      1 #!/usr/local/plan9/bin/rc
      2 
      3 # Fix rc shell scripts to find rc without launching env every time.
      4 # Invoke with rc and plan9 versions of grep and ed in $PATH
      5 
      6 # If your system lacks which (e.g. some gnu/linux)
      7 # substitute the full path to rc in this line:
      8 rc=/usr/local/plan9/bin/rc
      9 firstline='#!'$"rc
     10 
     11 if(~ $#* 0)	files = *
     12 if not	files = $*
     13 
     14 myname = `{basename $0}
     15 
     16 for(file in $files) {
     17 	if(test -d $file) $0 $file/*
     18 	if not if(~ $file *$myname) {}
     19 	if not if(sed 1q $file | grep '^#!/.*[/	 ]rc$' > /dev/null) {
     20 		{
     21 			echo 1c
     22 			echo $firstline
     23 			echo .
     24 			echo wq
     25 		} | ed $file > /dev/null
     26 	}
     27 }