[hackers] diri: new tip (= 26)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Wed, 31 Jan 2007 11:40:01 +0100

changeset: 26:7c9114458cca
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Wed Jan 31 11:36:34 2007 +0100
files: edit.rc remove.rc show.rc
description:
changed paths in html-title tags

diff -r f37853ef1df0 show.rc
--- a/show.rc Wed Jan 31 11:22:03 2007 +0100
+++ b/show.rc Wed Jan 31 10:51:57 2007 +0100
@@ -26,27 +26,31 @@ fn menu {
         echo '</ul>'
 }
 
+fn catpage {
+ if(test -f $DIRIDIR^'/'^$PATH_INFO)
+ cat $DIRIDIR^'/'^$PATH_INFO
+ if not {
+ if(test -d $DIRIDIR^'/'^$PATH_INFO) {
+ file=`{find $DIRIDIR^'/'^$PATH_INFO -type f | grep '/[a-zA-Z0-9_]+$' | sort | sed 1q}
+ if(test $file && test -f $file)
+ cat $file
+ }
+ }
+}
+
 if(test $PATH_INFO && echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$') {
         echo 'Location: '^$ADDRESS^'/show.rc'
         echo
         exit 0
 }
 
-if(! test $PATH_INFO)
- PATH_INFO=''
-
-if(test -d $DIRIDIR^'/'^$PATH_INFO) {
- file=`{find $DIRIDIR^'/'^$PATH_INFO -type f | grep '/[a-zA-Z0-9_]+$' | sort | sed 1q}
- if(test $file && test -f $file) {
- file=`{cleanname $file}
- arg='s,'^$DIRIDIR^'/,,'
- PATH_INFO=`{echo $file | sed $arg}
- }
-}
 tmp=$ifs
 ifs='/
 '
-paths=`{echo $PATH_INFO}
+if(test $PATH_INFO)
+ paths=`{echo $PATH_INFO}
+if not
+ PATH_INFO=''
 ifs=$tmp
 
 cat <<END
@@ -105,8 +109,7 @@ cat <<END
                 <div id="page">
                         <div id="content" style="max-width: 60em;">
 END
-if(test -f $DIRIDIR^'/'^$PATH_INFO)
- cat $DIRIDIR^'/'^$PATH_INFO
+catpage
 cat <<END
                         </div>
                 </div>
Received on Wed Jan 31 2007 - 11:40:02 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:47 UTC