function do_cmd {
header text/plain
case "$1" in
+ ls)
+ ls -t db | column
+ ;;
head)
- awk '
- BEGIN { rows=4; cols=60; }
+ awk -v 'rows=4' -v 'cols=60' '
FNR==1 { gsub(/.*\//, "", FILENAME);
print FILENAME
print "-----" }
FNR==1,/^$/ { next }
/\S/ { i++; printf "%."cols"s\n", $0 }
- i>=rows { i=0; print ""; nextfile }
+ i>=rows { nextfile }
+ ENDFILE { i=0; print "" }
' $(ls -t db/*)
;;
- ls)
- ls -t db | column
+ stat)
+ ls -l --time-style='+%Y %m' db |
+ awk -v 'hdr=Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec' '
+ BEGIN { printf "%64s\n", hdr }
+ NR>1 { cnt[$6+0][$7+0]++ }
+ END { for (y in cnt) {
+ printf "%4d", y
+ for (m=1; m<=12; m++)
+ printf "%5s", cnt[y][m]
+ printf "\n" } }'
;;
esac
}
uploads=$(ls -t db | head -n 5)
filetype=$(get_param '^(ft|filet(y(pe?)?)?)$')
vpaste='<a href="vpaste?ft=sh">vpaste</a>'
+ repo='https://lug.rose-hulman.edu/svn/misc/trunk/htdocs/vpaste/'
header text/html
cat <<-EOF
padding: 0; }
body { margin: 4em 8em 4em 8em;
font-family: sans-serif; }
+ input { padding: 2px 6px 3px 6px; }
/* Items */
textarea { width: 100%;
margin-bottom: 0.5em; }
<p>See individual files for licenses</p>
<h1>Source code</h1>
- <ul>
- <li><a href="vpaste?ft=sh">vpaste</a></li>
- <li><a href="index.cgi?ft=sh">index.cgi</a>
+ <dl>
+ <dt>Client</dt>
+ <dd><a href="vpaste?ft=sh">vpaste</a></dd>
+ <dt>Server</dt>
+ <dd><a href="index.cgi?ft=sh">index.cgi</a>
<a href="vimrc?ft=vim">vimrc</a>
<a href="htaccess?ft=apache">htaccess</a>
<a href="robots.txt?ft=robots">robots.txt</a>
- <a href="sitemap.xml?ft=xml">sitemap.xml</a></li>
- <li><a href="2html.patch?ft=diff">2html.patch</a></li>
- <li><a href="https://lug.rose-hulman.edu/svn/misc/trunk/htdocs/vpaste/">Subversion</a></li>
- </ul>
+ <a href="sitemap.xml?ft=xml">sitemap.xml</a>
+ <dt>Patches</dt>
+ <dd><a href="2html.patch?ft=diff">2html.patch</a></dd>
+ <dt>Subversion</dt>
+ <dd><a href="$repo">$repo</a></dd>
+ </dl>
<h1>Bugs</h1>
<ul>
</ul>
<p><a href="ls">list all</a></p>
<p><a href="head">sample all</a></p>
+ <p><a href="stat">statistics</a></p>
</div>
</body>
</html>
do_cmd ls
elif [ "$pathinfo" = head ]; then
do_cmd head
+elif [ "$pathinfo" = stat ]; then
+ do_cmd stat
elif [ "$pathinfo" ]; then
do_print "$pathinfo"
elif [ "$CONTENT_TYPE" ]; then