[hackers] diri: new tip (= 27)

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

changeset: 27:01caf41aed4e
tag: tip
user: arg_AT_suckless.org
date: Wed Jan 31 11:49:47 2007 +0100
files: show.rc
description:
adding leading slash in cases of pre-selection

diff -r 7c9114458cca edit.rc
--- a/edit.rc Wed Jan 31 11:36:34 2007 +0100
+++ b/edit.rc Wed Jan 31 10:51:57 2007 +0100
@@ -18,7 +18,7 @@ Content-Type: text/html
 
 <html>
         <head>
- <title>$TITLE - $PATH_INFO</title>
+ <title>$TITLE</title>
                 <meta name="author" content="Anselm R. Garbe">
                 <meta name="searchtitle" content="dwm wmii suck less">
                 <meta name="keywords" content="x11 dwm wmi wmii dmenu slock suck less window manager xlib">
diff -r 7c9114458cca remove.rc
--- a/remove.rc Wed Jan 31 11:36:34 2007 +0100
+++ b/remove.rc Tue Jan 30 17:00:02 2007 +0100
@@ -35,7 +35,7 @@ Content-Type: text/html
 
 <html>
         <head>
- <title>$TITLE - $PATH_INFO</title>
+ <title>$TITLE</title>
                 <meta name="author" content="Anselm R. Garbe">
                 <meta name="searchtitle" content="dwm wmii suck less">
                 <meta name="keywords" content="x11 dwm wmi wmii dmenu slock suck less window manager xlib">
diff -r 7c9114458cca show.rc
--- a/show.rc Wed Jan 31 11:36:34 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
@@ -54,7 +58,7 @@ Content-Type: text/html
 
 <html>
         <head>
- <title>$TITLE - $PATH_INFO</title>
+ <title>$TITLE</title>
                 <meta name="author" content="Anselm R. Garbe">
                 <meta name="searchtitle" content="dwm wmii suck less">
                 <meta name="keywords" content="x11 dwm wmi wmii dmenu slock suck less window manager xlib">
@@ -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:50:02 UTC

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