[hackers] diri: new tip (= 55)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Tue, 06 Feb 2007 11:10:02 +0100

changeset: 55:54cf4c41522e
tag: tip
user: arg_AT_suckless.org
date: Tue Feb 06 11:06:45 2007 +0100
files: show.rc
description:
fixed some bugs/missing features in Kris' awk-driven menu

diff -r f53076de4387 -r 54cf4c41522e show.rc
--- a/show.rc Tue Feb 06 10:39:09 2007 +0100
+++ b/show.rc Tue Feb 06 11:06:45 2007 +0100
@@ -9,18 +9,22 @@ fn menu {
                 /^([a-zA-Z0-9_]+[\/*]?)+$/ {
                         isdir = match($0, "/$");
                         sub("[*/]$", "");
- bname = $0;
+ file = bname = $0;
+ sub("^(.*/)", "", file);
                         sub("^(.*/)?([0-9]+_)?", "", bname);
                         gsub("_", " ", bname);
                         if(isdir)
                                 bname = bname "/"
                         sub("[^/]+$", "")
- path = $0 bname
-
- if(isdir && match(ENVIRON["PATH_INFO"]"/", "^"path)) {
+ path = $0 file
+ ispath = match(ENVIRON["PATH_INFO"]"/", "^"path);
+ if(isdir && ispath) {
                                 print "<li><a href=\"" urlbase path "\" class=\"current\">" bname "</a>"
                                 system("rc -c ''menu " path "''");
- }else
+ }
+ else if(ispath)
+ print "<li><a href=\"" urlbase path "\" class=\"current\">" bname "</a>"
+ else
                                 print "<li><a href=\"" urlbase path "\">" bname "</a>"
                         print "</li>"
                 }' | awk '{ print "\t" $0 }'
Received on Tue Feb 06 2007 - 11:10:02 UTC

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