[hackers] diri: new tip (= 14)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Tue, 30 Jan 2007 15:50:01 +0100

changeset: 14:951f480b1e7fae69bb081db4d6c95b19d9053fee
tag: tip
user: arg_AT_suckless.org
date: Tue Jan 30 15:48:43 2007 +0100
files: history.rc
description:
using flatten operator

changeset: 13:4955b8a885c6a19c4929c73a5184fadb61a41669
user: arg_AT_suckless.org
date: Tue Jan 30 15:38:02 2007 +0100
files: history.rc show.rc
description:
simplified

diff -r aa56b5ec368e remove.rc
--- a/remove.rc Tue Jan 30 15:33:11 2007 +0100
+++ b/remove.rc Tue Jan 30 15:00:02 2007 +0100
@@ -63,7 +63,7 @@ cat <<END
 cat <<END
 </h1>
                         <form action="$ADDRESS/remove.rc$PATH_INFO" method="post">
- <p style='color: #f40;'>Please confirm removing '$PATH_INFO' through entering the password.</p>
+ <p style='color: #f80;'>Please confirm removing '$PATH_INFO' through entering the password.</p>
                                 <p align="right">
                                         <b>Password:</b> <input type='password' name='password' size='20'/>
                                         <input type='submit' value='Confirm'/><br />
diff -r aa56b5ec368e save.rc
--- a/save.rc Tue Jan 30 15:33:11 2007 +0100
+++ b/save.rc Tue Jan 30 15:00:02 2007 +0100
@@ -31,7 +31,6 @@ if(test -f $DIRIDIR^'/'^$PATH_INFO^'.dir
 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.rc'^$PATH_INFO
 echo
diff -r aa56b5ec368e history.rc
--- a/history.rc Tue Jan 30 15:33:11 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-#!/usr/local/plan9/bin/rc
-. /var/www/dirirc
-
-fn menu {
- level=`{expr $1 + 1}
- if(test $level -le $#paths) {
- sub=$paths($level)
- }
- if not {
- sub=()
- }
- echo '<ul>'
- for(file in $2/*) {
- base=`{basename $file}
- if(echo $base | grep '^[a-zA-Z0-9_]+$' > /dev/null) {
- if(test $sub && ~ $base $sub) {
- echo '<li>'^$base^''
- if(test -d $file)
- @{menu $level $file}
- echo '</li>'
- }
- if not
- echo '<li>'^$base^'</li>'
- }
- }
- echo '</ul>'
-}
-
-fn printhist {
- if(test -f $DIRIDIR^'/'^$PATH_INFO) {
- base=`{basename $PATH_INFO}
- for(file in $DIRIDIR^'/'^$PATH_INFO^'.'^*) {
- if(! ~ $file $PATH_INFO^'.diri') {
- fbase=`{basename $file}
- arg='s/'^$base^'//'
- timestamp=`{echo $base | sed $arg}
- echo '<li>'^`{date $timestamp}^': '^$base^'</li>'
- }
- }
- }
-}
-
-if(test $PATH_INFO && echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$') {
- echo 'Location: '^$ADDRESS^'/show.rc'
- echo
- exit 0
-}
-
-cd $DIRIDIR
-tmp=$ifs
-ifs='/
-'
-if(test $PATH_INFO)
- paths=`{echo $PATH_INFO}
-if not
- PATH_INFO=''
-ifs=$tmp
-
-cat <<END
-Content-Type: text/html
-
-<html>
- <head>
- <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">
- <meta name="description" content="dynamic window manager improved 2">
- <meta name="revisit-after" content="2 days">
- <meta name="audience" content="all">
- <meta name="content-language" content="en">
- <meta name="copyright" content="(C)opyright 2006-2007 by Anselm R. Garbe">
- <meta name="robots" content="index,follow">
- <style type="text/css">
- body { background-color: #333; color: #ddd; font-family: sans-serif; margin: 0px; width: 100%; }
- img { border: 0px; /* top right bottom left */ }
- a { color: #9cf; }
- div#slogan { background-color: #222; border: 0px; float: left; padding: 5px 1% 5px 1%; width: 68%; }
- div#ctrlmenu { background-color: #222; border: 0px; float: left; font-size: 95%; padding: 5px 1% 5px 0px; text-align: right; width: 29%; }
- #ctrlmenu ul { list-style: none; margin: 0; padding: 0px; }
- #ctrlmenu li { display: inline; }
- #ctrlmenu a { color: #9cf; padding: 5px; text-decoration: none; }
- #ctrlmenu a:hover { background-color: #333; padding: 5px; text-decoration: none; }
- div#menu { border: 0px; float: left; font-size: 90%; padding: 0%; width: 25%; }
- #menu ul { padding: 5px 5px 5px 1.5em; }
- #menu li { list-style: none; padding: 6px; }
- #menu a { color: #ccc; padding: 4px; text-decoration: none; }
- #menu a:hover { background-color: #444; padding: 4px; text-decoration: none; }
- #menu a.current { color: #fff; padding: 4px; text-decoration: none; }
- div#page { background-color: #444; border: 0px; color: #ddd; float: left; padding: 2%; width: 71%; min-height: 500px; height:auto !important; height: 500px;}
-
- div#bot { background-color: #222; border: 0px; clear: both; padding: 5px 1% 5px 0px; text-align: right; width: 99%; }
- </style>
- </head>
- <body>
- <div id="slogan">
- <i>$SLOGAN</i>
- </div>
- <div id="ctrlmenu">
- <ul>
- <li>edit</li>
- <li>remove</li>
- <li>history</li>
- </ul>
- </div>
- <div style='clear: both; padding: 0px;'></div>
- <div id="menu">
-END
-menu 0 .
-cat <<END
- </div>
- <div id="page">
- <div id="content" style="max-width: 60em;">
- <ul>
-END
-printhist
-cat <<END
- </ul>
- </div>
- </div>
- <div id="bot">
- <small>&copy Copyright 2007 Anselm R. Garbe Impressum</small>
- </div>
- </body>
-</html>
-END
Received on Tue Jan 30 2007 - 15:50:01 UTC

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