| Add first umn-conforming dirlisting implementation. - geomyidae - A small C-bas… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit 8d1047f9e55a6210bdee47aecde5728c0ae12c60 | |
| parent d39742c74e21e225e06d1a7d55044a740158d6e4 | |
| Author: Christoph Lohmann <[email protected]> | |
| Date: Sun, 3 Apr 2022 09:41:42 +0200 | |
| Add first umn-conforming dirlisting implementation. | |
| Much is to fix here. | |
| Diffstat: | |
| M cgi-examples/dirlisting.dcgi | 36 +++++++++++++++++++++++++++++… | |
| D cgi-examples/maplisting.dcgi | 11 ----------- | |
| 2 files changed, 34 insertions(+), 13 deletions(-) | |
| --- | |
| diff --git a/cgi-examples/dirlisting.dcgi b/cgi-examples/dirlisting.dcgi | |
| @@ -1,7 +1,39 @@ | |
| #!/bin/sh | |
| # | |
| -# List all .md files in some directory and show a dir listing. | |
| +# Dir listing example. | |
| # | |
| +# Entry definition in .Links, .cap/$file or .names: | |
| +# Name=, Type=, Path=, Host=, Port=, Numb=, Abstract=, Admin=, URL=, TTL= | |
| +# | |
| + | |
| +[ -f .abstract ] && cat .abstract | sed 's/^t/&&/' | |
| + | |
| +find . -maxdepth 1 \ | |
| +| sort -r \ | |
| +| cut -d'/' -f 2- \ | |
| +| grep -v "^\." \ | |
| +| while read -r entry; | |
| +do | |
| + [ "${entry}" == ".cap" ] && continue | |
| + [ "${entry}" == ".Links" ] && continue | |
| + [ "${entry}" == ".names" ] && continue | |
| + | |
| + entrytype="9" | |
| + [ -d "${entry}" ] && entrytype="1" | |
| + | |
| + entryserver="server" | |
| + entryport="port" | |
| + entryname="%f" | |
| + if [ -f ".cap/$entry" ]; | |
| + then | |
| + entryname="$(cat ".cap/$entry" \ | |
| + | grep "^Name=" \ | |
| + | cut -d'=' -f 2-)" | |
| + fi | |
| + [ -z "${entryname}" ] && entryname="%f" | |
| -find *.md -printf "[0|%TY-%Tm-%Td %f|%f|server|port]\r\n" | sort -r | |
| + find "${entry}" \ | |
| + -maxdepth 0 \ | |
| + -printf "[${entrytype}|%TY-%Tm-%Td ${entryname}|%f|${entrys… | |
| +done | |
| diff --git a/cgi-examples/maplisting.dcgi b/cgi-examples/maplisting.dcgi | |
| @@ -1,11 +0,0 @@ | |
| -#!/bin/sh | |
| -# | |
| -# List all .md files in some directory and show a dir listing. | |
| -# Display map.gph first. | |
| -# | |
| - | |
| -[ -f map.gph ] && cat map.gph | |
| -[ -f .abstract ] && cat .abstract | |
| - | |
| -find *.md -printf "[0|%TY-%Tm-%Td %f|%f|server|port]\r\n" | sort -r | |
| - |