[hackers] diri: new tip (= 41)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Thu, 01 Feb 2007 14:50:01 +0100

changeset: 41:c0b771171f58
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Thu Feb 01 14:42:33 2007 +0100
files: show.rc
description:
more uncluttering

diff -r a194745efd84 -r c0b771171f58 show.rc
--- a/show.rc Thu Feb 01 14:37:25 2007 +0100
+++ b/show.rc Thu Feb 01 14:42:33 2007 +0100
@@ -13,10 +13,10 @@ fn menu {
         for(file in $2/*) {
                 file=`{cleanname $file}
                 base=`{basename $file}
- if(echo $base | grep '^[a-zA-Z0-9_]+$' > /dev/null) {
+ if(echo $base | grep -s '^[a-zA-Z0-9_]+$') {
                         bname=`{echo $base | sed 's/^[0-9]+_//; s/_/ /g'}
                         if(test -d $file)
- bname=$"bname^'/'
+ bname=$"bname/
                         if(test $sub && ~ $base $sub) {
                                 echo '<li>'^$"bname^''
                                 if(test -d $file)
@@ -31,7 +31,7 @@ fn menu {
 }
 
 if(test $PATH_INFO && echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$') {
- echo 'Location: '^$ADDRESS^'/'^$SHOW
+ echo Location: $ADDRESS/$SHOW
         echo
         exit 0
 }
@@ -39,12 +39,12 @@ if(! test $PATH_INFO)
 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 -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}
+ PATH_INFO=/`{echo $file | sed $arg}
         }
 }
 tmp=$ifs
@@ -52,15 +52,14 @@ ifs='/
 '
 paths=`{echo $PATH_INFO}
 ifs=$tmp
-titlex=`{basename $PATH_INFO | sed 's/^[0-9]+_//; s/_/ /g'}
-TITLE=$TITLE^' - '^$"titlex
+title=`{basename $PATH_INFO | sed 's/^[0-9]+_//; s/_/ /g'}
 cat <<END
 Content-Type: text/html
 
 <!DOCTYPE HTML SYSTEM>
 <html>
         <head>
- <title>$TITLE</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">
@@ -111,8 +110,8 @@ cat <<END
                 <div id="page">
                         <div id="content" style="max-width: 60em;">
 END
-if(test -f $DIRIDIR^'/'^$PATH_INFO)
- cat $DIRIDIR^'/'^$PATH_INFO
+if(test -f $DIRIDIR/$PATH_INFO)
+ cat $DIRIDIR/$PATH_INFO
 cat <<END
                         </div>
                 </div>
Received on Thu Feb 01 2007 - 14:50:01 UTC

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