[hackers] diri: new tip (= 40)

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

changeset: 40:a194745efd84
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Thu Feb 01 14:37:25 2007 +0100
files: save.rc
description:
uncluttered save

changeset: 39:14cf4f27f3ea
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Thu Feb 01 14:33:34 2007 +0100
files: dirirc edit.rc remove.rc
description:
checking if unlcuttered versions work

diff -r 631d51d39b28 -r a194745efd84 dirirc
--- a/dirirc Thu Feb 01 12:57:54 2007 +0100
+++ b/dirirc Thu Feb 01 14:37:25 2007 +0100
@@ -5,9 +5,9 @@ PLAN9=/usr/local/plan9
 PLAN9=/usr/local/plan9
 PATH=$PLAN9/bin:$PATH
 SLOGAN='pr0n for code fetishists'
-TITLE=suckless.org
 URLDECODE=/usr/local/bin/urldecode.awk
 WIKIFMT=/usr/local/bin/markdown.pl
+# scripts
 SHOW=wiki # show.rc
 EDIT=edit # edit.rc
 REMOVE=remove # remove.rc
diff -r 631d51d39b28 -r a194745efd84 edit.rc
--- a/edit.rc Thu Feb 01 12:57:54 2007 +0100
+++ b/edit.rc Thu Feb 01 14:37:25 2007 +0100
@@ -4,24 +4,23 @@ if(! test $PATH_INFO || echo $PATH_INFO
 if(! test $PATH_INFO || echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$'
         || echo $PATH_INFO | grep -v -s '[a-zA-Z0-9]')
 {
- echo 'Location: '^$ADDRESS^'/'^$SHOW
+ echo Location: $ADDRESS/$SHOW
         echo
         exit 0
 }
 if(test -d $DIRIDIR/$PATH_INFO) {
- echo 'Location: '^$ADDRESS^'/'^$SHOW^'/'^$PATH_INFO
+ echo Location: $ADDRESS/$SHOW/$PATH_INFO
         echo
         exit 0
 }
-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">
@@ -54,8 +53,8 @@ cat <<END
                         <form action="$ADDRESS/$SAVE$PATH_INFO" method="post">
                                 <textarea name='text' id='text' cols='80' rows='43'>
 END
-if(test -f $DIRIDIR^'/'^$PATH_INFO^'.diri') {
- cat $DIRIDIR^'/'^$PATH_INFO^'.diri'
+if(test -f $DIRIDIR/$PATH_INFO.diri) {
+ cat $DIRIDIR/$PATH_INFO.diri
 }
 cat <<END
 </textarea>
diff -r 631d51d39b28 -r a194745efd84 remove.rc
--- a/remove.rc Thu Feb 01 12:57:54 2007 +0100
+++ b/remove.rc Thu Feb 01 14:37:25 2007 +0100
@@ -4,13 +4,13 @@ if(! test $PATH_INFO || echo $PATH_INFO
 if(! test $PATH_INFO || echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$'
         || echo $PATH_INFO | grep -v -s '[a-zA-Z0-9]')
 {
- echo 'Location: '^$ADDRESS^'/'^$SHOW
+ echo Location: $ADDRESS/$SHOW
         echo
         exit 0
 }
 
 fn escape {
- echo 'Location: '^$ADDRESS^'/'^$SHOW^'/'^$PATH_INFO
+ echo Location: $ADDRESS/$SHOW/$PATH_INFO
         echo
         exit 0
 }
@@ -22,23 +22,22 @@ if(test $password) {
         password=`{echo -n $password | $URLDECODE | $HASHCMD}
         if(! ~ $password $HASHPASSWD || test ! $text)
                 escape
- if(test -e $DIRIDIR^'/'^$PATH_INFO) {
- /bin/rm -rf $DIRIDIR^'/'^$PATH_INFO^'.diri'
- /bin/rm -rf $DIRIDIR^'/'^$PATH_INFO
+ if(test -e $DIRIDIR/$PATH_INFO) {
+ /bin/rm -rf $DIRIDIR/$PATH_INFO.diri
+ /bin/rm -rf $DIRIDIR/$PATH_INFO
         }
- echo 'Location: '^$ADDRESS^'/'^$SHOW
+ echo Location: $ADDRESS/$SHOW
         echo
         exit 0
 }
-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">
diff -r 631d51d39b28 -r a194745efd84 save.rc
--- a/save.rc Thu Feb 01 12:57:54 2007 +0100
+++ b/save.rc Thu Feb 01 14:37:25 2007 +0100
@@ -4,13 +4,13 @@ if(! test $PATH_INFO || echo $PATH_INFO
 if(! test $PATH_INFO || echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$'
         || echo $PATH_INFO | grep -v -s '[a-zA-Z0-9]')
 {
- echo 'Location: '^$ADDRESS^'/'^$SHOW
+ echo Location: $ADDRESS/$SHOW
         echo
         exit 0
 }
 
 fn escape {
- echo 'Location: '^$ADDRESS^'/'^$SHOW^'/'^$PATH_INFO
+ echo Location: $ADDRESS/$SHOW/$PATH_INFO
         echo
         exit 0
 }
@@ -31,11 +31,11 @@ if(! ~ $password $HASHPASSWD || ! test $
 
 dirs=`{basename -d $PATH_INFO}
 if(test $dirs)
- /bin/mkdir -p $DIRIDIR^'/'^$dirs
-if(test -f $DIRIDIR^'/'^$PATH_INFO^'.diri')
- mv $DIRIDIR^'/'^$PATH_INFO^'.diri' $DIRIDIR^'/'^$PATH_INFO^'.'^`{date -n}
-echo $text | $URLDECODE > $DIRIDIR^'/'^$PATH_INFO^'.diri'
-cp $DIRIDIR^'/'^$PATH_INFO^'.diri' $DIRIDIR^'/'^$PATH_INFO^'.'^`{date -n}
-$WIKIFMT < $DIRIDIR^'/'^$PATH_INFO^'.diri' > $DIRIDIR^'/'^$PATH_INFO
-echo 'Location: '^$ADDRESS^'/'^$SHOW^'/'^$PATH_INFO
+ /bin/mkdir -p $DIRIDIR/$dirs
+if(test -f $DIRIDIR/$PATH_INFO.diri)
+ mv $DIRIDIR/$PATH_INFO.diri $DIRIDIR/$PATH_INFO.`{date -n}
+echo $text | $URLDECODE > $DIRIDIR/$PATH_INFO.diri
+cp $DIRIDIR/$PATH_INFO.diri $DIRIDIR/$PATH_INFO.`{date -n}
+$WIKIFMT < $DIRIDIR/$PATH_INFO.diri > $DIRIDIR/$PATH_INFO
+echo Location: $ADDRESS/$SHOW/$PATH_INFO
 echo
Received on Thu Feb 01 2007 - 14:40:02 UTC

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