1*906afcb8SAndy Fiddaman#!/usr/bin/ksh93 2*906afcb8SAndy Fiddaman 3*906afcb8SAndy Fiddaman# 4*906afcb8SAndy Fiddaman# CDDL HEADER START 5*906afcb8SAndy Fiddaman# 6*906afcb8SAndy Fiddaman# The contents of this file are subject to the terms of the 7*906afcb8SAndy Fiddaman# Common Development and Distribution License (the "License"). 8*906afcb8SAndy Fiddaman# You may not use this file except in compliance with the License. 9*906afcb8SAndy Fiddaman# 10*906afcb8SAndy Fiddaman# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*906afcb8SAndy Fiddaman# or http://www.opensolaris.org/os/licensing. 12*906afcb8SAndy Fiddaman# See the License for the specific language governing permissions 13*906afcb8SAndy Fiddaman# and limitations under the License. 14*906afcb8SAndy Fiddaman# 15*906afcb8SAndy Fiddaman# When distributing Covered Code, include this CDDL HEADER in each 16*906afcb8SAndy Fiddaman# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*906afcb8SAndy Fiddaman# If applicable, add the following below this CDDL HEADER, with the 18*906afcb8SAndy Fiddaman# fields enclosed by brackets "[]" replaced with your own identifying 19*906afcb8SAndy Fiddaman# information: Portions Copyright [yyyy] [name of copyright owner] 20*906afcb8SAndy Fiddaman# 21*906afcb8SAndy Fiddaman# CDDL HEADER END 22*906afcb8SAndy Fiddaman# 23*906afcb8SAndy Fiddaman 24*906afcb8SAndy Fiddaman# 25*906afcb8SAndy Fiddaman# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 26*906afcb8SAndy Fiddaman# 27*906afcb8SAndy Fiddaman 28*906afcb8SAndy Fiddaman# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant 29*906afcb8SAndy Fiddamanexport PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin 30*906afcb8SAndy Fiddaman 31*906afcb8SAndy Fiddamanfunction fatal_error 32*906afcb8SAndy Fiddaman{ 33*906afcb8SAndy Fiddaman print -u 2 "${progname}: $*" 34*906afcb8SAndy Fiddaman exit 1 35*906afcb8SAndy Fiddaman} 36*906afcb8SAndy Fiddaman 37*906afcb8SAndy Fiddamanfunction attrstrtoattrarray 38*906afcb8SAndy Fiddaman{ 39*906afcb8SAndy Fiddaman#set -o xtrace 40*906afcb8SAndy Fiddaman typeset s="$1" 41*906afcb8SAndy Fiddaman nameref aa=$2 # attribute array 42*906afcb8SAndy Fiddaman integer aa_count=0 43*906afcb8SAndy Fiddaman integer aa_count=0 44*906afcb8SAndy Fiddaman typeset nextattr 45*906afcb8SAndy Fiddaman integer currattrlen=0 46*906afcb8SAndy Fiddaman typeset tagstr 47*906afcb8SAndy Fiddaman typeset tagval 48*906afcb8SAndy Fiddaman 49*906afcb8SAndy Fiddaman while (( ${#s} > 0 )) ; do 50*906afcb8SAndy Fiddaman # skip whitespaces 51*906afcb8SAndy Fiddaman while [[ "${s:currattrlen:1}" == ~(E)[[:blank:][:space:]] ]] ; do 52*906afcb8SAndy Fiddaman (( currattrlen++ )) 53*906afcb8SAndy Fiddaman done 54*906afcb8SAndy Fiddaman s="${s:currattrlen:${#s}}" 55*906afcb8SAndy Fiddaman 56*906afcb8SAndy Fiddaman # anything left ? 57*906afcb8SAndy Fiddaman (( ${#s} == 0 )) && break 58*906afcb8SAndy Fiddaman 59*906afcb8SAndy Fiddaman # Pattern tests: 60*906afcb8SAndy Fiddaman #x="foo=bar huz=123" ; print "${x##~(E)[[:alnum:]_-:]*=[^[:blank:]\"]*}" 61*906afcb8SAndy Fiddaman #x='foo="ba=r o" huz=123' ; print "${x##~(E)[[:alnum:]_-:]*=\"[^\"]*\"}" 62*906afcb8SAndy Fiddaman #x="foo='ba=r o' huz=123" ; print "${x##~(E)[[:alnum:]_-:]*=\'[^\"]*\'}" 63*906afcb8SAndy Fiddaman #x="foox huz=123" ; print "${x##~(E)[[:alnum:]_-:]*}" 64*906afcb8SAndy Fiddaman # All pattern combined via eregex (w|x|y|z): 65*906afcb8SAndy Fiddaman #x='foo="bar=o" huz=123' ; print "${x##~(E)([[:alnum:]_-:]*=[^[:blank:]\"]*|[[:alnum:]_-:]*=\"[^\"]*\"|[[:alnum:]_-:]*=\'[^\"]*\')}" 66*906afcb8SAndy Fiddaman nextattr="${s##~(E)([[:alnum:]_-:]*=[^[:blank:]\"]*|[[:alnum:]_-:]*=\"[^\"]*\"|[[:alnum:]_-:]*=\'[^\"]*\'|[[:alnum:]_-:]*)}" 67*906afcb8SAndy Fiddaman currattrlen=$(( ${#s} - ${#nextattr})) 68*906afcb8SAndy Fiddaman 69*906afcb8SAndy Fiddaman # add entry 70*906afcb8SAndy Fiddaman tagstr="${s:0:currattrlen}" 71*906afcb8SAndy Fiddaman if [[ "${tagstr}" == *=* ]] ; then 72*906afcb8SAndy Fiddaman # normal case: attribute with value 73*906afcb8SAndy Fiddaman 74*906afcb8SAndy Fiddaman tagval="${tagstr#*=}" 75*906afcb8SAndy Fiddaman 76*906afcb8SAndy Fiddaman # strip quotes ('' or "") 77*906afcb8SAndy Fiddaman if [[ "${tagval}" == ~(Elr)(\'.*\'|\".*\") ]] ; then 78*906afcb8SAndy Fiddaman tagval="${tagval:1:${#tagval}-2}" 79*906afcb8SAndy Fiddaman fi 80*906afcb8SAndy Fiddaman 81*906afcb8SAndy Fiddaman aa[${aa_count}]=( name="${tagstr%%=*}" value="${tagval}" ) 82*906afcb8SAndy Fiddaman else 83*906afcb8SAndy Fiddaman # special case for HTML where you have something like <foo baz> 84*906afcb8SAndy Fiddaman aa[${aa_count}]=( name="${tagstr}" ) 85*906afcb8SAndy Fiddaman fi 86*906afcb8SAndy Fiddaman (( aa_count++ )) 87*906afcb8SAndy Fiddaman (( aa_count > 1000 )) && fatal_error "$0: aa_count too large" # assert 88*906afcb8SAndy Fiddaman done 89*906afcb8SAndy Fiddaman} 90*906afcb8SAndy Fiddaman 91*906afcb8SAndy Fiddaman 92*906afcb8SAndy Fiddamanfunction handle_document 93*906afcb8SAndy Fiddaman{ 94*906afcb8SAndy Fiddaman#set -o xtrace 95*906afcb8SAndy Fiddaman nameref callbacks=${1} 96*906afcb8SAndy Fiddaman typeset tag_type="${2}" 97*906afcb8SAndy Fiddaman typeset tag_value="${3}" 98*906afcb8SAndy Fiddaman typeset tag_attributes="${4}" 99*906afcb8SAndy Fiddaman nameref doc=${callbacks["arg_tree"]} 100*906afcb8SAndy Fiddaman nameref nodepath="${stack.items[stack.pos]}" 101*906afcb8SAndy Fiddaman nameref nodesnum="${stack.items[stack.pos]}num" 102*906afcb8SAndy Fiddaman 103*906afcb8SAndy Fiddaman case "${tag_type}" in 104*906afcb8SAndy Fiddaman tag_begin) 105*906afcb8SAndy Fiddaman nodepath[${nodesnum}]+=( 106*906afcb8SAndy Fiddaman typeset tagtype="element" 107*906afcb8SAndy Fiddaman typeset tagname="${tag_value}" 108*906afcb8SAndy Fiddaman compound -A tagattributes 109*906afcb8SAndy Fiddaman compound -A nodes 110*906afcb8SAndy Fiddaman integer nodesnum=0 111*906afcb8SAndy Fiddaman ) 112*906afcb8SAndy Fiddaman 113*906afcb8SAndy Fiddaman # fill attributes 114*906afcb8SAndy Fiddaman if [[ "${tag_attributes}" != "" ]] ; then 115*906afcb8SAndy Fiddaman attrstrtoattrarray "${tag_attributes}" "nodepath[${nodesnum}].tagattributes" 116*906afcb8SAndy Fiddaman fi 117*906afcb8SAndy Fiddaman 118*906afcb8SAndy Fiddaman (( stack.pos++ )) 119*906afcb8SAndy Fiddaman stack.items[stack.pos]="${stack.items[stack.pos-1]}[${nodesnum}].nodes" 120*906afcb8SAndy Fiddaman (( nodesnum++ )) 121*906afcb8SAndy Fiddaman ;; 122*906afcb8SAndy Fiddaman tag_end) 123*906afcb8SAndy Fiddaman (( stack.pos-- )) 124*906afcb8SAndy Fiddaman ;; 125*906afcb8SAndy Fiddaman tag_text) 126*906afcb8SAndy Fiddaman nodepath[${nodesnum}]+=( 127*906afcb8SAndy Fiddaman typeset tagtype="text" 128*906afcb8SAndy Fiddaman typeset tagvalue="${tag_value}" 129*906afcb8SAndy Fiddaman ) 130*906afcb8SAndy Fiddaman (( nodesnum++ )) 131*906afcb8SAndy Fiddaman ;; 132*906afcb8SAndy Fiddaman tag_comment) 133*906afcb8SAndy Fiddaman nodepath[${nodesnum}]+=( 134*906afcb8SAndy Fiddaman typeset tagtype="comment" 135*906afcb8SAndy Fiddaman typeset tagvalue="${tag_value}" 136*906afcb8SAndy Fiddaman ) 137*906afcb8SAndy Fiddaman (( nodesnum++ )) 138*906afcb8SAndy Fiddaman ;; 139*906afcb8SAndy Fiddaman document_start) 140*906afcb8SAndy Fiddaman ;; 141*906afcb8SAndy Fiddaman document_end) 142*906afcb8SAndy Fiddaman ;; 143*906afcb8SAndy Fiddaman esac 144*906afcb8SAndy Fiddaman 145*906afcb8SAndy Fiddaman# print "xmltok: '${tag_type}' = '${tag_value}'" 146*906afcb8SAndy Fiddaman} 147*906afcb8SAndy Fiddaman 148*906afcb8SAndy Fiddamanfunction xml_tok 149*906afcb8SAndy Fiddaman{ 150*906afcb8SAndy Fiddaman typeset buf="" 151*906afcb8SAndy Fiddaman typeset namebuf="" 152*906afcb8SAndy Fiddaman typeset attrbuf="" 153*906afcb8SAndy Fiddaman typeset c="" 154*906afcb8SAndy Fiddaman typeset isendtag # bool: true/false 155*906afcb8SAndy Fiddaman typeset issingletag # bool: true/false (used for tags like "<br />") 156*906afcb8SAndy Fiddaman nameref callbacks=${1} 157*906afcb8SAndy Fiddaman 158*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["document_start"]}" ]] && ${callbacks["document_start"]} "${1}" "document_start" 159*906afcb8SAndy Fiddaman 160*906afcb8SAndy Fiddaman while IFS='' read -r -N 1 c ; do 161*906afcb8SAndy Fiddaman isendtag=false 162*906afcb8SAndy Fiddaman 163*906afcb8SAndy Fiddaman if [[ "$c" == "<" ]] ; then 164*906afcb8SAndy Fiddaman # flush any text content 165*906afcb8SAndy Fiddaman if [[ "$buf" != "" ]] ; then 166*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["tag_text"]}" ]] && ${callbacks["tag_text"]} "${1}" "tag_text" "$buf" 167*906afcb8SAndy Fiddaman buf="" 168*906afcb8SAndy Fiddaman fi 169*906afcb8SAndy Fiddaman 170*906afcb8SAndy Fiddaman IFS='' read -r -N 1 c 171*906afcb8SAndy Fiddaman if [[ "$c" == "/" ]] ; then 172*906afcb8SAndy Fiddaman isendtag=true 173*906afcb8SAndy Fiddaman else 174*906afcb8SAndy Fiddaman buf="$c" 175*906afcb8SAndy Fiddaman fi 176*906afcb8SAndy Fiddaman IFS='' read -r -d '>' c 177*906afcb8SAndy Fiddaman buf+="$c" 178*906afcb8SAndy Fiddaman 179*906afcb8SAndy Fiddaman # handle comments 180*906afcb8SAndy Fiddaman if [[ "$buf" == ~(El)!-- ]] ; then 181*906afcb8SAndy Fiddaman # did we read the comment completely ? 182*906afcb8SAndy Fiddaman if [[ "$buf" != ~(Elr)!--.*-- ]] ; then 183*906afcb8SAndy Fiddaman buf+=">" 184*906afcb8SAndy Fiddaman while [[ "$buf" != ~(Elr)!--.*-- ]] ; do 185*906afcb8SAndy Fiddaman IFS='' read -r -N 1 c || break 186*906afcb8SAndy Fiddaman buf+="$c" 187*906afcb8SAndy Fiddaman done 188*906afcb8SAndy Fiddaman fi 189*906afcb8SAndy Fiddaman 190*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["tag_comment"]}" ]] && ${callbacks["tag_comment"]} "${1}" "tag_comment" "${buf:3:${#buf}-5}" 191*906afcb8SAndy Fiddaman buf="" 192*906afcb8SAndy Fiddaman continue 193*906afcb8SAndy Fiddaman fi 194*906afcb8SAndy Fiddaman 195*906afcb8SAndy Fiddaman # check if the tag starts and ends at the same time (like "<br />") 196*906afcb8SAndy Fiddaman if [[ "${buf}" == ~(Er).*/ ]] ; then 197*906afcb8SAndy Fiddaman issingletag=true 198*906afcb8SAndy Fiddaman buf="${buf%*/}" 199*906afcb8SAndy Fiddaman else 200*906afcb8SAndy Fiddaman issingletag=false 201*906afcb8SAndy Fiddaman fi 202*906afcb8SAndy Fiddaman 203*906afcb8SAndy Fiddaman # check if the tag has attributes (e.g. space after name) 204*906afcb8SAndy Fiddaman if [[ "$buf" == ~(E)[[:space:][:blank:]] ]] ; then 205*906afcb8SAndy Fiddaman namebuf="${buf%%~(E)[[:space:][:blank:]].*}" 206*906afcb8SAndy Fiddaman attrbuf="${buf#~(E).*[[:space:][:blank:]]}" 207*906afcb8SAndy Fiddaman else 208*906afcb8SAndy Fiddaman namebuf="$buf" 209*906afcb8SAndy Fiddaman attrbuf="" 210*906afcb8SAndy Fiddaman fi 211*906afcb8SAndy Fiddaman 212*906afcb8SAndy Fiddaman if ${isendtag} ; then 213*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" 214*906afcb8SAndy Fiddaman else 215*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["tag_begin"]}" ]] && ${callbacks["tag_begin"]} "${1}" "tag_begin" "$namebuf" "$attrbuf" 216*906afcb8SAndy Fiddaman 217*906afcb8SAndy Fiddaman # handle tags like <br/> (which are start- and end-tag in one piece) 218*906afcb8SAndy Fiddaman if ${issingletag} ; then 219*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" 220*906afcb8SAndy Fiddaman fi 221*906afcb8SAndy Fiddaman fi 222*906afcb8SAndy Fiddaman buf="" 223*906afcb8SAndy Fiddaman else 224*906afcb8SAndy Fiddaman buf+="$c" 225*906afcb8SAndy Fiddaman fi 226*906afcb8SAndy Fiddaman done 227*906afcb8SAndy Fiddaman 228*906afcb8SAndy Fiddaman [[ ! -z "${callbacks["document_end"]}" ]] && ${callbacks["document_end"]} "${1}" "document_end" "exit_success" 229*906afcb8SAndy Fiddaman 230*906afcb8SAndy Fiddaman print # final newline to make filters like "sed" happy 231*906afcb8SAndy Fiddaman} 232*906afcb8SAndy Fiddaman 233*906afcb8SAndy Fiddamanfunction print_sample1_xml 234*906afcb8SAndy Fiddaman{ 235*906afcb8SAndy Fiddamancat <<EOF 236*906afcb8SAndy Fiddaman<br /> 237*906afcb8SAndy Fiddaman<score-partwise instrument="flute1"> 238*906afcb8SAndy Fiddaman <identification> 239*906afcb8SAndy Fiddaman <kaiman>nocrocodile</kaiman> 240*906afcb8SAndy Fiddaman </identification> 241*906afcb8SAndy Fiddaman <!-- a comment --> 242*906afcb8SAndy Fiddaman <partlist> 243*906afcb8SAndy Fiddaman <foo>myfootext</foo> 244*906afcb8SAndy Fiddaman <bar>mybartext</bar> 245*906afcb8SAndy Fiddaman <snap /> 246*906afcb8SAndy Fiddaman <!-- another 247*906afcb8SAndy Fiddaman comment --> 248*906afcb8SAndy Fiddaman <ttt>myttttext</ttt> 249*906afcb8SAndy Fiddaman </partlist> 250*906afcb8SAndy Fiddaman</score-partwise> 251*906afcb8SAndy FiddamanEOF 252*906afcb8SAndy Fiddaman} 253*906afcb8SAndy Fiddaman 254*906afcb8SAndy Fiddamanfunction usage 255*906afcb8SAndy Fiddaman{ 256*906afcb8SAndy Fiddaman OPTIND=0 257*906afcb8SAndy Fiddaman getopts -a "${progname}" "${xmldocumenttree1_usage}" OPT '-?' 258*906afcb8SAndy Fiddaman exit 2 259*906afcb8SAndy Fiddaman} 260*906afcb8SAndy Fiddaman 261*906afcb8SAndy Fiddaman# program start 262*906afcb8SAndy Fiddamanbuiltin basename 263*906afcb8SAndy Fiddamanbuiltin cat 264*906afcb8SAndy Fiddamanbuiltin date 265*906afcb8SAndy Fiddamanbuiltin uname 266*906afcb8SAndy Fiddaman 267*906afcb8SAndy Fiddamantypeset progname="${ basename "${0}" ; }" 268*906afcb8SAndy Fiddaman 269*906afcb8SAndy Fiddamantypeset -r xmldocumenttree1_usage=$'+ 270*906afcb8SAndy Fiddaman[-?\n@(#)\$Id: xmldocumenttree1 (Roland Mainz) 2009-05-09 \$\n] 271*906afcb8SAndy Fiddaman[-author?Roland Mainz <roland.mainz@nrubsig.org>] 272*906afcb8SAndy Fiddaman[+NAME?xmldocumenttree1 - XML tree demo] 273*906afcb8SAndy Fiddaman[+DESCRIPTION?\bxmldocumenttree\b is a small ksh93 compound variable demo 274*906afcb8SAndy Fiddaman which reads a XML input file, converts it into an internal 275*906afcb8SAndy Fiddaman variable tree representation and outputs it in the format 276*906afcb8SAndy Fiddaman specified by viewmode (either "list", "namelist", "tree" or "compacttree").] 277*906afcb8SAndy Fiddaman 278*906afcb8SAndy Fiddamanfile viewmode 279*906afcb8SAndy Fiddaman 280*906afcb8SAndy Fiddaman[+SEE ALSO?\bksh93\b(1)] 281*906afcb8SAndy Fiddaman' 282*906afcb8SAndy Fiddaman 283*906afcb8SAndy Fiddamanwhile getopts -a "${progname}" "${xmldocumenttree1_usage}" OPT ; do 284*906afcb8SAndy Fiddaman# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" 285*906afcb8SAndy Fiddaman case ${OPT} in 286*906afcb8SAndy Fiddaman *) usage ;; 287*906afcb8SAndy Fiddaman esac 288*906afcb8SAndy Fiddamandone 289*906afcb8SAndy Fiddamanshift $((OPTIND-1)) 290*906afcb8SAndy Fiddaman 291*906afcb8SAndy Fiddamantypeset xmlfile="$1" 292*906afcb8SAndy Fiddamantypeset viewmode="$2" 293*906afcb8SAndy Fiddaman 294*906afcb8SAndy Fiddamanif [[ "${xmlfile}" == "" ]] ; then 295*906afcb8SAndy Fiddaman fatal_error $"No file given." 296*906afcb8SAndy Fiddamanfi 297*906afcb8SAndy Fiddaman 298*906afcb8SAndy Fiddamanif [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then 299*906afcb8SAndy Fiddaman fatal_error $"Invalid view mode \"${viewmode}\"." 300*906afcb8SAndy Fiddamanfi 301*906afcb8SAndy Fiddaman 302*906afcb8SAndy Fiddamancompound xdoc 303*906afcb8SAndy Fiddamancompound -A xdoc.nodes 304*906afcb8SAndy Fiddamaninteger xdoc.nodesnum=0 305*906afcb8SAndy Fiddaman 306*906afcb8SAndy Fiddamancompound stack 307*906afcb8SAndy Fiddamantypeset -a stack.items=( [0]="doc.nodes" ) 308*906afcb8SAndy Fiddamaninteger stack.pos=0 309*906afcb8SAndy Fiddaman 310*906afcb8SAndy Fiddaman# setup callbacks for xml_tok 311*906afcb8SAndy Fiddamantypeset -A document_cb # callbacks for xml_tok 312*906afcb8SAndy Fiddamandocument_cb["document_start"]="handle_document" 313*906afcb8SAndy Fiddamandocument_cb["document_end"]="handle_document" 314*906afcb8SAndy Fiddamandocument_cb["tag_begin"]="handle_document" 315*906afcb8SAndy Fiddamandocument_cb["tag_end"]="handle_document" 316*906afcb8SAndy Fiddamandocument_cb["tag_text"]="handle_document" 317*906afcb8SAndy Fiddamandocument_cb["tag_comment"]="handle_document" 318*906afcb8SAndy Fiddaman# argument for "handle_document" 319*906afcb8SAndy Fiddamandocument_cb["arg_tree"]="xdoc" 320*906afcb8SAndy Fiddaman 321*906afcb8SAndy Fiddaman 322*906afcb8SAndy Fiddamanif [[ "${xmlfile}" == "#sample1" ]] ; then 323*906afcb8SAndy Fiddaman print_sample1_xml | xml_tok document_cb 324*906afcb8SAndy Fiddamanelif [[ "${xmlfile}" == "#sample2" ]] ; then 325*906afcb8SAndy Fiddaman /usr/sfw/bin/wget \ 326*906afcb8SAndy Fiddaman --user-agent='ksh93_xmldocumenttree' \ 327*906afcb8SAndy Fiddaman --output-document=- \ 328*906afcb8SAndy Fiddaman 'http://www.google.com/custom?q=gummi+bears' | 329*906afcb8SAndy Fiddaman /usr/bin/iconv -f "ISO8859-1" | 330*906afcb8SAndy Fiddaman xml_tok document_cb 331*906afcb8SAndy Fiddamanelse 332*906afcb8SAndy Fiddaman cat "${xmlfile}" | xml_tok document_cb 333*906afcb8SAndy Fiddamanfi 334*906afcb8SAndy Fiddaman 335*906afcb8SAndy Fiddamanprint -u2 "#parsing completed." 336*906afcb8SAndy Fiddaman 337*906afcb8SAndy Fiddamancase "${viewmode}" in 338*906afcb8SAndy Fiddaman list) 339*906afcb8SAndy Fiddaman set | egrep "xdoc.*(tagname|tagtype|tagval|tagattributes)" | fgrep -v ']=$' 340*906afcb8SAndy Fiddaman ;; 341*906afcb8SAndy Fiddaman namelist) 342*906afcb8SAndy Fiddaman typeset + | egrep "xdoc.*(tagname|tagtype|tagval|tagattributes)" 343*906afcb8SAndy Fiddaman ;; 344*906afcb8SAndy Fiddaman tree) 345*906afcb8SAndy Fiddaman print -v xdoc 346*906afcb8SAndy Fiddaman ;; 347*906afcb8SAndy Fiddaman compacttree) 348*906afcb8SAndy Fiddaman print -C xdoc 349*906afcb8SAndy Fiddaman ;; 350*906afcb8SAndy Fiddaman *) 351*906afcb8SAndy Fiddaman fatal_error $"Invalid view mode \"${viewmode}\"." 352*906afcb8SAndy Fiddaman ;; 353*906afcb8SAndy Fiddamanesac 354*906afcb8SAndy Fiddaman 355*906afcb8SAndy Fiddamanprint -u2 "#done." 356*906afcb8SAndy Fiddaman 357*906afcb8SAndy Fiddamanexit 0 358*906afcb8SAndy Fiddaman# EOF. 359