: ########################################################################## # Shellscript: mkscripttab - make HTML table from command list # Author : Heiner Steven (heiner.steven@odn.de) # Date : 05.03.1998 # Category : HTML # $Id: mkscripttab,v 1.7 2009-01-04 15:13:22 heiner Exp $ ########################################################################## # Description # ########################################################################## : ${AWK:=awk} PN=`basename "$0"` # Program name VER=`echo '$Revision: 1.7 $' | cut -d' ' -f2` PATH=$PATH:../../bin export PATH Usage () { echo >&2 "$PN - make HTML table from command list, $VER usage: $PN [file ...]" exit 1 } Msg () { for MsgLine do echo "$PN: $MsgLine" >&2 done } Fatal () { Msg "$@"; exit 1; } #set -- `getopt h "$@"` while [ $# -gt 0 ] do case "$1" in --) shift; break;; -h) Usage;; -*) Usage;; *) break;; # First file name esac shift done # Ignore all commands ending in ".txt" Args= while [ $# -gt 0 ] do if [ -d "$1" ] then : # Ignore directory else case "$1" in *.txt) ;; # Ignore *) Args="$Args $1";; esac fi shift done set -- $Args NewFiles=${TMPDIR:=/tmp}/mkcmd$$.new trap 'rm -f "$NewFiles"' 0 trap "exit 2" 1 2 3 13 15 # Create a list of new files lsrecent -d `fdate +"%Y-%m-01" -1 month` "$@" > "$NewFiles" { # Format: "filename:# Shellscript: name - descriptive text" egrep '^# (Shellscript|Title[ ]*):[ ]' "$@" | sed -e 's/[ ][ ]*/ /g' \ -e 's/:# Shellscript:[ ]*/ /' \ -e 's/:# Title[ ]:[ ]*/ /' # Format: "filename:# name - descriptive text" egrep '^#[ ][ ]*[a-z0-9][a-z0-9]* - ' "$@" | sed 's/[ ][ ]*/ /g' | sed 's/:\#[ ]*/ /' } | $AWK -F" " '!L[$1]++' | # Sort by file name, ignoring case sort -f -k2 | { $AWK ' BEGIN { ChangeText ["new"] = "${NEWTAG}" ChangeText ["update"] = "${UPDATETAG}" # Input example: # test.sh update 2000-02-02 1.2 # testing new 2000-02-02 1.2 NewFiles = "'"$NewFiles"'" while ( getline < NewFiles ) { isNewFile [$1] = $2 } close (NewFiles) # Lower/upper case table LTab = "abcdefghijklmnopqrstuvwxyz" UTab = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" print "
" print "[" print "" for ( i=1; i<=length (UTab); i++ ) { c = substr (UTab, i, 1) L = "" c "" if ( i < length (UTab) ) L = L " | " print L } print "" print "]" print "
\n
" TabAnchor "" cmdname " | " L = "" L = L changetext if ( TabAnchor != "" ) { L = L "" cmdname } else { L = L "" cmdname } L = L " | " print L print "D | " print "" descr " | "
print "
---|