diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-08-10 14:10:41 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-08-10 14:10:41 -0400 |
commit | 21544fa3cbd44b69f4e210bba579b488e521761e (patch) | |
tree | 60f7241f4e3beb38e6c6eddff0840dab78de9406 | |
parent | ee30ac4cb393cc516913d59a0763b8eab34c4836 (diff) | |
parent | a6fed3dde50298b0cb6b8e0cdc24b119a40a588b (diff) | |
download | illumos-joyent-21544fa3cbd44b69f4e210bba579b488e521761e.tar.gz |
[illumos-gate merge]
commit a6fed3dde50298b0cb6b8e0cdc24b119a40a588b
13488 Remove unneeded ast/ksh files
commit cbb067b0884d7d7559394b33b73aa0e0b19278ed
13999 Allow building with python 3.10
51 files changed, 4 insertions, 10974 deletions
diff --git a/exception_lists/check_rtime b/exception_lists/check_rtime index 21c88ff2f5..dc22d7a930 100644 --- a/exception_lists/check_rtime +++ b/exception_lists/check_rtime @@ -165,10 +165,8 @@ UNREF_OBJ /lib.*\ of\ .*libtspi\.so\.1 UNREF_OBJ /lib.*\ of\ .*libxml2\.so\.2 UNREF_OBJ /lib.*\ of\ .*libxslt\.so\.1 UNREF_OBJ /lib.*\ of\ .*libpq\.so\.4 -UNREF_OBJ /lib.*\ of\ .*libpython2\.4\.so\.1\.0 -UNREF_OBJ /lib.*\ of\ .*libpython2\.6\.so\.1\.0 -UNREF_OBJ /lib.*\ of\ .*libpython2\.7\.so\.1\.0 -UNREF_OBJ /lib.*\ of\ .*libpython3\.[56789]m?\.so\.1\.0 +UNREF_OBJ /lib.*\ of\ .*libpython2\.[467]\.so\.1\.0 +UNREF_OBJ /lib.*\ of\ .*libpython3\.\d+m?\.so\.1\.0 UNREF_OBJ /libgcc_s.*\ of\ .*libstdc\+\+\.so\.6 UNREF_OBJ /libgcc_s.*\ of\ .*libgmodule-2\.0\.so\.0 diff --git a/exception_lists/interface_check b/exception_lists/interface_check index e97322fac3..a3f0e493c8 100644 --- a/exception_lists/interface_check +++ b/exception_lists/interface_check @@ -21,7 +21,7 @@ # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2018 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. # This file provides exceptions to the usual rules applied to shared # objects by interface_check. All strings are Perl regular expressions @@ -58,7 +58,7 @@ PLUGIN ^usr/lib/mdb PLUGIN ^usr/lib/pci PLUGIN ^usr/lib/picl/plugins PLUGIN ^usr/lib/python2.[467] -PLUGIN ^usr/lib/python3.[56789] +PLUGIN ^usr/lib/python3.\d+ PLUGIN ^usr/lib/rcm/modules PLUGIN ^usr/lib/scsi/plugins PLUGIN ^usr/lib/sysevent/modules diff --git a/usr/src/cmd/ast/libshell/Makefile b/usr/src/cmd/ast/libshell/Makefile index 73bbad600c..494c31885d 100644 --- a/usr/src/cmd/ast/libshell/Makefile +++ b/usr/src/cmd/ast/libshell/Makefile @@ -62,7 +62,5 @@ FRC: ASTSRC= $(CONTRIB)/ast/src/cmd/ksh93 include Makefile.tests -include Makefile.demo -include Makefile.doc include $(SRC)/lib/Makefile.targ diff --git a/usr/src/cmd/ast/libshell/Makefile.demo b/usr/src/cmd/ast/libshell/Makefile.demo deleted file mode 100644 index 594ab8b11e..0000000000 --- a/usr/src/cmd/ast/libshell/Makefile.demo +++ /dev/null @@ -1,83 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. -# - -DEMOFILESRCDIR= $(ASTSRC) -ROOTDEMODIRBASE= $(ROOT)/usr/demo/ksh - -DF_SRC= \ - src/cpvprint.sh \ - src/crawlsrccomments.sh \ - src/filemutexdemo1.sh \ - src/filetree1.sh \ - src/gnaw.sh \ - src/mandelbrotset1.sh \ - src/multifollow.sh \ - src/numtree1.sh \ - src/primenumbers1.sh \ - src/rssread.sh \ - src/shcalc.sh \ - src/shircbot.sh \ - src/shlint.sh \ - src/shman.sh \ - src/shnote.sh \ - src/shpiano.sh \ - src/shtinyurl.sh \ - src/shtwitter.sh \ - src/simplefileattributetree1.sh \ - src/simplefiletree1.sh \ - src/svcproptree1.sh \ - src/termclock.sh \ - src/test_net_sctp.sh \ - src/xmldocumenttree1.sh - -DF_BIN= $(DF_SRC:src/%.sh=bin/%) - -DF_FUN= \ - fun/dirs \ - fun/popd \ - fun/pushd - -DEMOFILES= $(DF_SRC) $(DF_BIN) $(DF_FUN) - -# Rules for executables -$(ROOTDEMODIRBASE)/fun/% := FILEMODE= 755 -$(ROOTDEMODIRBASE)/bin/% := FILEMODE= 755 - -$(ROOTDEMODIRBASE)/bin/%: common/scripts/%.sh - /usr/bin/shcomp "$<" >"$(@F)" - $(INS) -s -m $(FILEMODE) -f $(@D) "$(@F)" - $(RM) "$(@F)" - -$(ROOTDEMODIRBASE)/src/%.sh: common/scripts/%.sh - $(INS.file) - -ROOTDEMODIRS= $(ROOTDEMODIRBASE) .WAIT \ - $(ROOTDEMODIRBASE)/bin \ - $(ROOTDEMODIRBASE)/fun \ - $(ROOTDEMODIRBASE)/src - -_demoinstall: $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES) -install: _demoinstall diff --git a/usr/src/cmd/ast/libshell/Makefile.doc b/usr/src/cmd/ast/libshell/Makefile.doc deleted file mode 100644 index 2020c89dd8..0000000000 --- a/usr/src/cmd/ast/libshell/Makefile.doc +++ /dev/null @@ -1,80 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. -# - -ROOTDOCDIRBASE= $(ROOT)/usr/share/doc/ksh - -DOCFILES= \ - RELEASE \ - README \ - TYPES \ - DESIGN \ - COMPATIBILITY \ - OBSOLETE \ - shell_styleguide.docbook \ - images/tag_bourne.png \ - images/tag_i18n.png \ - images/tag_ksh88.png \ - images/tag_ksh93.png \ - images/tag_ksh.png \ - images/tag_l10n.png \ - images/tag_perf.png \ - images/callouts/1.png \ - images/callouts/2.png \ - images/callouts/3.png \ - images/callouts/4.png \ - images/callouts/5.png \ - images/callouts/6.png \ - images/callouts/7.png \ - images/callouts/8.png \ - images/callouts/9.png \ - images/callouts/10.png - -# Documentation rules -$(ROOTDOCDIRBASE)/%: $(ASTSRC)/% - $(INS.file) - -$(ROOTDOCDIRBASE)/%: misc/% - $(INS.file) - -ROOTDOCDIRS= \ - $(ROOTDOCDIRBASE) .WAIT \ - $(ROOTDOCDIRBASE)/images .WAIT \ - $(ROOTDOCDIRBASE)/images/callouts - -# Generic documentation rules -DOCFILESRCDIR= common -ROOTDOCFILES= $(DOCFILES:%=$(ROOTDOCDIRBASE)/%) -$(ROOTDOCDIRS) := OWNER = root -$(ROOTDOCDIRS) := GROUP = bin -$(ROOTDOCDIRS) := DIRMODE = 755 - -$(ROOTDOCDIRS): - $(INS.dir) - -_docinstall: $(ROOTDOCDIRS) .WAIT $(ROOTDOCFILES) -install: _docinstall diff --git a/usr/src/cmd/ast/libshell/common/scripts/cpvprint.sh b/usr/src/cmd/ast/libshell/common/scripts/cpvprint.sh deleted file mode 100644 index 5c8c706579..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/cpvprint.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# cpvprint - compound variable pretty printer -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function prettyprint_compoundvar -{ - nameref var=$1 - - # print tree - str="${ print -v var ; }" - # do some "pretty-printing" for human users (the output is still a - # valid compound variable value) - # (note: This does not scale well with large files) - str="${str//$'\t'typeset -l -E /$'\t'float }" - str="${str//$'\t'typeset -l -i /$'\t'integer }" - str="${str//$'\t'typeset -C /$'\t'compound }" - print -r -- "${str}" - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${cpvprint_usage}" OPT '-?' - exit 2 -} - -# HTML constants -compound -r hc=( - compound -r doctype=( - compound -r xhtml=( - typeset -r transitional=$'<!DOCTYPE html\n\tPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n\t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' - ) - ) - compound -r namespace=( - typeset -r xhtml=$'http://www.w3.org/1999/xhtml' - ) - typeset -r xml_head=$'<?xml version="1.0" encoding="UTF-8"?>\n' -) - -# main -builtin basename - -set -o noglob -set -o errexit -set -o nounset - -# tree variable -compound tree - -typeset progname="${ basename "${0}" ; }" - -typeset -r cpvprint_usage=$'+ -[-?\n@(#)\$Id: cpvprint (Roland Mainz) 2009-06-15 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?cpvprint - render compound variable trees in various formats] -[+DESCRIPTION?\bcpvprint\b is converter which reads a ksh compound - variable and prints it on a different format. Supported - formats are \'default\', \'altdefault\', - \'tree\', \'alttree\', - \'pretty\', \'pretty.html\', \'list\' and \'fulllist\'] - -format [ arguments ] - -[+SEE ALSO?\bksh93\b(1), \bcpvlint\b(1)] -' - -while getopts -a "${progname}" "${cpvprint_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# prechecks -(( $# > 0 )) || usage - -printformat="$1" -shift - -# read variable -case $# in - 0) - read -C tree || fatal_error $"Read error." - ;; - 1) - integer fd - - redirect {fd}<> "$1" || fatal_error $"Cannot open file." - read -u${fd} -C tree || fatal_error $"Read error." - redirect {fd}<&- || fatal_error $"Close error." - ;; - 2) - print -u2 -f $"%s: Unsupported number of arguments.\n" "$0" - exit 1 - ;; -esac - -# print variable -case ${printformat} in - 'default' | 'tree') - print -v tree - ;; - 'altdefault' | 'alttree') - print -C tree - ;; - 'pretty') - # print variable tree (same as $ print -v filetree # except that it "looks better") - prettyprint_compoundvar tree - ;; - 'pretty.html') - printf '%s%s<html xmlns="%s" xml:lang="en" lang="en">\n<head><meta name="generator" content="%H" /><title>%H</title></head>\n<body><pre>%H\n</pre></body></html>\n' \ - "${hc.xml_head}" \ - "${hc.doctype.xhtml.transitional}" \ - "${hc.namespace.xhtml}" \ - "ksh Compound Variable Pretty Printer (cpvprint)" \ - "" \ - "$(prettyprint_compoundvar tree)" | iconv -f "UTF-8" - - - ;; - 'list') - set | egrep '^tree.' | sed 's/^tree\.//' | egrep -v '^[[:alnum:]]+(\.([[:alnum:]\.]+)(\[.*\])*)*=\(' - ;; - 'fulllist') - set | egrep "^tree." - ;; - *) - fatal_error $"Unsupported format." - ;; -esac - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/crawlsrccomments.sh b/usr/src/cmd/ast/libshell/common/scripts/crawlsrccomments.sh deleted file mode 100644 index 109a69f0ab..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/crawlsrccomments.sh +++ /dev/null @@ -1,1241 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -# constants values for tokenizer/parser stuff -compound -r ch=( - newline=$'\n' - tab=$'\t' - formfeed=$'\f' -) - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function printmsg -{ - print -u2 "$*" -} - - -function attrstrtoattrarray -{ -#set -o xtrace - typeset s="$1" - nameref aa=$2 # attribute array - integer aa_count=0 - integer aa_count=0 - typeset nextattr - integer currattrlen=0 - typeset tagstr - typeset tagval - - while (( ${#s} > 0 )) ; do - # skip whitespaces - while [[ "${s:currattrlen:1}" == ~(E)[[:blank:][:space:]] ]] ; do - (( currattrlen++ )) - done - s="${s:currattrlen:${#s}}" - - # anything left ? - (( ${#s} == 0 )) && break - - # Pattern tests: - #x="foo=bar huz=123" ; print "${x##~(E)[[:alnum:]_-:]*=[^[:blank:]\"]*}" - #x='foo="ba=r o" huz=123' ; print "${x##~(E)[[:alnum:]_-:]*=\"[^\"]*\"}" - #x="foo='ba=r o' huz=123" ; print "${x##~(E)[[:alnum:]_-:]*=\'[^\"]*\'}" - #x="foox huz=123" ; print "${x##~(E)[[:alnum:]_-:]*}" - # All pattern combined via eregex (w|x|y|z): - #x='foo="bar=o" huz=123' ; print "${x##~(E)([[:alnum:]_-:]*=[^[:blank:]\"]*|[[:alnum:]_-:]*=\"[^\"]*\"|[[:alnum:]_-:]*=\'[^\"]*\')}" - nextattr="${s##~(E)([[:alnum:]_-:]*=[^[:blank:]\"]*|[[:alnum:]_-:]*=\"[^\"]*\"|[[:alnum:]_-:]*=\'[^\"]*\'|[[:alnum:]_-:]*)}" - currattrlen=$(( ${#s} - ${#nextattr})) - - # add entry - tagstr="${s:0:currattrlen}" - if [[ "${tagstr}" == *=* ]] ; then - # normal case: attribute with value - - tagval="${tagstr#*=}" - - # strip quotes ('' or "") - if [[ "${tagval}" == ~(Elr)(\'.*\'|\".*\") ]] ; then - tagval="${tagval:1:${#tagval}-2}" - fi - - aa[${aa_count}]=( name="${tagstr%%=*}" value="${tagval}" ) - else - # special case for HTML where you have something like <foo baz> - aa[${aa_count}]=( name="${tagstr}" ) - fi - (( aa_count++ )) - (( aa_count > 1000 )) && fatal_error "$0: aa_count too large" # assert - done -} - -# XML document handler -function handle_xml_document -{ -#set -o xtrace - nameref callbacks=${1} - typeset tag_type="${2}" - typeset tag_value="${3}" - typeset tag_attributes="${4}" - nameref doc=${callbacks["arg_tree"]} - nameref nodepath="${stack.items[stack.pos]}" - nameref nodesnum="${stack.items[stack.pos]}num" - - case "${tag_type}" in - tag_comment) - nodepath[${nodesnum}]+=( - typeset tagtype="comment" - typeset tagvalue="${tag_value}" - ) - (( nodesnum++ )) - ;; - esac - -# print "xmltok: '${tag_type}' = '${tag_value}'" -} - -function xml_tok -{ - typeset buf="" - typeset namebuf="" - typeset attrbuf="" - typeset c="" - typeset isendtag # bool: true/false - typeset issingletag # bool: true/false (used for tags like "<br />") - nameref callbacks=${1} - - [[ ! -z "${callbacks["document_start"]}" ]] && ${callbacks["document_start"]} "${1}" "document_start" - - while IFS='' read -r -N 1 c ; do - isendtag=false - - if [[ "$c" == "<" ]] ; then - # flush any text content - if [[ "$buf" != "" ]] ; then - [[ ! -z "${callbacks["tag_text"]}" ]] && ${callbacks["tag_text"]} "${1}" "tag_text" "$buf" - buf="" - fi - - IFS='' read -r -N 1 c - if [[ "$c" == "/" ]] ; then - isendtag=true - else - buf="$c" - fi - IFS='' read -r -d '>' c - buf+="$c" - - # handle comments - if [[ "$buf" == ~(El)!-- ]] ; then - # did we read the comment completely ? - if [[ "$buf" != ~(Elr)!--.*-- ]] ; then - buf+=">" - while [[ "$buf" != ~(Elr)!--.*-- ]] ; do - IFS='' read -r -N 1 c || break - buf+="$c" - done - fi - - [[ ! -z "${callbacks["tag_comment"]}" ]] && ${callbacks["tag_comment"]} "${1}" "tag_comment" "${buf:3:${#buf}-5}" - buf="" - continue - fi - - # check if the tag starts and ends at the same time (like "<br />") - if [[ "${buf}" == ~(Er).*/ ]] ; then - issingletag=true - buf="${buf%*/}" - else - issingletag=false - fi - - # check if the tag has attributes (e.g. space after name) - if [[ "$buf" == ~(E)[[:space:][:blank:]] ]] ; then - namebuf="${buf%%~(E)[[:space:][:blank:]].*}" - attrbuf="${buf#~(E).*[[:space:][:blank:]]}" - else - namebuf="$buf" - attrbuf="" - fi - - if ${isendtag} ; then - [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" - else - [[ ! -z "${callbacks["tag_begin"]}" ]] && ${callbacks["tag_begin"]} "${1}" "tag_begin" "$namebuf" "$attrbuf" - - # handle tags like <br/> (which are start- and end-tag in one piece) - if ${issingletag} ; then - [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" - fi - fi - buf="" - else - buf+="$c" - fi - done - - [[ ! -z "${callbacks["document_end"]}" ]] && ${callbacks["document_end"]} "${1}" "document_end" "exit_success" - - print # final newline to make filters like "sed" happy -} - -# enumerate comments in a shell (or shell-like) script -function enumerate_comments_shell -{ - set -o errexit - - typeset input_file="$1" - nameref comment_array="$2" - integer max_num_comments="$3" - integer ca=0 # index in "comment_array" - - integer res=0 - - typeset comment="" - - while (( res == 0 )) ; do - IFS='' read -r line - (( res=$? )) - - if [[ "${line}" == ~(El)#.* ]] ; then - comment+="${line#\#}${ch.newline}" - else - if [[ "$comment" != "" ]] ; then - comment_array[ca++]="${comment}" - comment="" - - if (( ca > max_num_comments )) ; then - break - fi - fi - fi - done <"${input_file}" - - return 0 -} - - -# enumerate comments in a troff document -function enumerate_comments_troff -{ - set -o errexit - - typeset input_file="$1" - nameref comment_array="$2" - integer max_num_comments="$3" - integer ca=0 # index in "comment_array" - - integer res=0 - - typeset comment="" - - while (( res == 0 )) ; do - IFS='' read -r line - (( res=$? )) - - if [[ "${line}" == ~(El)\.*\\\" ]] ; then - comment+="${line#~(El)\.*\\\"}${ch.newline}" - else - if [[ "$comment" != "" ]] ; then - comment_array[ca++]="${comment}" - comment="" - - if (( ca > max_num_comments )) ; then - break - fi - fi - fi - done <"${input_file}" - - return 0 -} - - -# enumerate comments in files which are preprocessed by -# CPP (e.g. C, C++, Imakefile etc.) -function enumerate_comments_cpp -{ - set -o errexit -# set -o nounset - - integer err=0 - - typeset input_file="$1" - nameref comment_array="$2" - integer max_num_comments="$3" - integer max_filesize_for_scan="$4" - integer ca=0 # index in "comment_array" - - typeset content - integer content_length - - integer file_pos # file position - compound line_pos=( - integer x=0 # X position in line - integer y=0 # Y position in line (line number) - ) - typeset c c2 - - typeset comment - - compound state=( - # C comment state - typeset in_c_comment=false - # C++ comment state - compound cxx=( - typeset in_comment=false - typeset comment_continued=false - # position of current //-pos - compound comment_pos=( - integer x=-1 - integer y=-1 - ) - # position of previous //-pos - compound comment_prev_pos=( - integer x=-1 - integer y=-1 - ) - ) - # literal state - typeset in_sq_literal=false # single-quote literal - typeset in_dq_literal=false # double-quote literal - ) - - content="$(< "${input_file}")" - - # Truncate file to "max_filesize_for_scan" charatcters. - # This was originally added to work around a performance problem with - # the ${str:offset:chunksize} operator which scales badly in ksh93 - # version 's' with the number of characters - if (( ${#content} > max_filesize_for_scan )) ; then - print -u2 -f "## WARNING: File '%s' truncated to %d characters\n" \ - "${input_file}" \ - max_filesize_for_scan - content="${content:0:max_filesize_for_scan}" - fi - content_length=${#content} - - # Iterate through the source code. The last character - # (when file_pos == content_length) will be empty to indicate - # EOF (this is needed for cases like when - # a C++ comment is not terminated by a newline... ;-/) - for (( file_pos=0 ; file_pos <= content_length ; file_pos++ )) ; do - c2="${content:file_pos:2}" - c="${c2:0:1}" - - if [[ "$c" == "${ch.newline}" ]] ; then - (( line_pos.x=0, line_pos.y++ )) - else - (( line_pos.x++ )) - fi - - if ${state.in_c_comment} ; then - if [[ "$c2" == "*/" ]] ; then - (( file_pos++, line_pos.x++ )) - state.in_c_comment=false - - # flush comment text - comment_array[ca++]="${comment}" - comment="" - - if (( ca > max_num_comments )) ; then - break - fi - else - comment+="$c" - fi - elif ${state.cxx.in_comment} ; then - if [[ "$c" == "${ch.newline}" || "$c" == "" ]] ; then - state.cxx.in_comment=false - - # flush comment text - if ${state.cxx.comment_continued} ; then - comment_array[ca-1]+="${ch.newline}${comment}" - (( state.cxx.comment_prev_pos.x=state.cxx.comment_pos.x , - state.cxx.comment_prev_pos.y=state.cxx.comment_pos.y )) - else - comment_array[ca++]="${comment}" - (( state.cxx.comment_prev_pos.x=state.cxx.comment_pos.x , - state.cxx.comment_prev_pos.y=state.cxx.comment_pos.y )) - fi - comment="" - - if (( ca > max_num_comments )) ; then - break - fi - else - comment+="$c" - fi - elif ${state.in_sq_literal} ; then - if [[ "$c" == "'" && "${content:file_pos-1:1}" != '\' ]] ; then - state.in_sq_literal=false - fi - elif ${state.in_dq_literal} ; then - if [[ "$c" == '"' && "${content:file_pos-1:1}" != '\' ]] ; then - state.in_dq_literal=false - fi - else - if [[ "$c2" == "/*" ]] ; then - (( file_pos++, line_pos.x++ )) - state.in_c_comment=true - comment="" - elif [[ "$c2" == "//" ]] ; then - (( file_pos++, line_pos.x++ )) - if (( state.cxx.comment_prev_pos.x == line_pos.x && \ - state.cxx.comment_prev_pos.y == (line_pos.y-1) )) ; then - state.cxx.comment_continued=true - else - state.cxx.comment_continued=false - fi - (( state.cxx.comment_pos.x=line_pos.x , state.cxx.comment_pos.y=line_pos.y )) - state.cxx.in_comment=true - comment="" - elif [[ "$c" == "'" && "${content:file_pos-1:1}" != '\' ]] ; then - state.in_sq_literal=true - elif [[ "$c" == '"' && "${content:file_pos-1:1}" != '\' ]] ; then - state.in_dq_literal=true - fi - fi - done - - if [[ "$comment" != "" ]] ; then - print -u2 "## ERROR: Comment text buffer not empty at EOF." - err=1 - fi - - if ${state.in_c_comment} ; then - print -u2 "## ERROR: C comment did not close before EOF." - err=1 - fi - - if ${state.cxx.in_comment} ; then - print -u2 "## ERROR: C++ comment did not close before EOF." - err=1 - fi - - if ${state.in_dq_literal} ; then - print -u2 "## ERROR: Double-quoted literal did not close before EOF." - err=1 - fi - - # We treat this one only as warning since things like "foo.html.cpp" may - # trigger this condition accidently - if ${state.in_sq_literal} ; then - print -u2 "## WARNING: Single-quoted literal did not close before EOF." - fi - - return $err -} - -# determine file type -function get_file_format -{ - set -o errexit - - typeset filename="$1" - nameref file_format="$2" - - typeset fileeval # evaluation result of /usr/bin/file - - # check whether "filename" is a plain, readable file - [[ ! -f "$filename" ]] && return 1 - [[ ! -r "$filename" ]] && return 1 - - # In theory this code would exclusively look at the contents of - # the file to figure out it's file format - unfortunately - # /usr/bin/file is virtually useless (the heuristics, matching - # and output unreliable) for many file formats and therefore - # we have to do a multi-stage approach which looks - # at the file's content if possible and at the filename - # otherwise. Fun... ;-( - - # pass one: Find matches for file formats where /usr/bin/file - # is known to be unreliable: - case "$filename" in - *.[ch] | *.cpp | *.cc | *.cxx | *.hxx) - file_format="c_source" - return 0 - ;; - *Imakefile) - file_format="imakefile" - return 0 - ;; - *Makefile) - file_format="makefile" - return 0 - ;; - esac - - # pass two: match by file content via /usr/bin/file - fileeval="$(LC_ALL=C /usr/bin/file "$filename")" - case "$fileeval" in - ~(E)roff) - file_format="troff" - return 0 - ;; - ~(E)html\ document) - file_format="html" - return 0 - ;; - ~(E)sgml\ document) - file_format="sgml" - return 0 - ;; - ~(E)executable.*(shell|(/|/r|/pf)(sh|ksh|ksh93|rksh93|dtksh|tksh|bash))\ script) - file_format="shell" - return 0 - ;; - ~(E)executable.*/perl\ script) - file_format="perl" - return 0 - ;; - esac - - # pass three: fallhack to filename matching - case "$filename" in - *.man) - file_format="troff" - return 0 - ;; - *.html) - file_format="html" - return 0 - ;; - *.sgml) - file_format="sgml" - return 0 - ;; - *.xml) - file_format="xml" - return 0 - ;; - *.png) - file_format="image_png" - return 0 - ;; - *.xcf) - file_format="image_xcf" - return 0 - ;; - *.shar) - file_format="archive_shell" - return 0 - ;; - *.sh) - file_format="shell" - return 0 - ;; - *.pcf) - file_format="font_pcf" - return 0 - ;; - *.bdf) - file_format="font_bdf" - return 0 - ;; - *.pmf) - file_format="font_pmf" - return 0 - ;; - *.ttf | *.otf) - file_format="font_ttf" - return 0 - ;; - *.pfa | *.pfb) - file_format="font_postscript" - return 0 - ;; - esac - - return 1 -} - -function extract_comments -{ - set -o errexit - - nameref records="$1" - typeset filename="$2" - integer max_num_comments="$3" - integer max_filesize_for_scan="$4" - - typeset datatype="" - - records[${filename}]=( - typeset filename="$filename" - - typeset fileformat_found="false" # "true" or "false" - typeset file_format="" - - typeset -A hashsum - - typeset comments_parsed="false" # "true" or "false" - typeset -a comments - ) - - records[${filename}].hashsum["md5"]="$(sum -x md5 < "$filename")" - records[${filename}].hashsum["sha1"]="$(sum -x sha1 < "$filename")" - - if get_file_format "$filename" datatype ; then - records[${filename}].fileformat_found="true" - records[${filename}].file_format="$datatype" - else - return 1 - fi - - case "$datatype" in - c_source|imakefile) - enumerate_comments_cpp "${filename}" "records[${filename}].comments" ${max_num_comments} ${max_filesize_for_scan} && \ - records[${filename}].comments_parsed=true - ;; - shell|makefile) - enumerate_comments_shell "${filename}" "records[${filename}].comments" ${max_num_comments} ${max_filesize_for_scan} && \ - records[${filename}].comments_parsed=true - ;; - troff) - enumerate_comments_troff "${filename}" "records[${filename}].comments" ${max_num_comments} ${max_filesize_for_scan} && \ - records[${filename}].comments_parsed=true - ;; - # NOTE: Disabled for now - #xml|html|sgml) - # enumerate_comments_xml "${filename}" "records[${filename}].comments" ${max_num_comments} ${max_filesize_for_scan} && \ - # records[${filename}].comments_parsed=true - # ;; - esac - - return 0 -} - -# parse HTTP return code, cookies etc. -function parse_http_response -{ - nameref response="$1" - typeset h statuscode statusmsg i - - # we use '\r' as additional IFS to filter the final '\r' - IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> - [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } - [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } - response.statuscode="$statuscode" - response.statusmsg="$statusmsg" - - # skip remaining headers - while IFS='' read -r i ; do - [[ "$i" == $'\r' ]] && break - - # strip '\r' at the end - i="${i/~(Er)$'\r'/}" - - case "$i" in - ~(Eli)Content-Type:.*) - response.content_type="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Content-Length:[[:blank:]]*[0-9]*) - integer response.content_length="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Transfer-Encoding:.*) - response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" - ;; - esac - done - - return 0 -} - -function cat_http_body -{ - typeset emode="$1" - typeset hexchunksize="0" - integer chunksize=0 - - if [[ "${emode}" == "chunked" ]] ; then - while IFS=$'\r' read hexchunksize && - [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]+ ]] && - (( chunksize=$( printf "16#%s\n" "${hexchunksize}" ) )) && (( chunksize > 0 )) ; do - dd bs=1 count="${chunksize}" 2>/dev/null - done - else - cat - fi - - return 0 -} - -function cat_url -{ - typeset protocol="${1%://*}" - typeset path1="${1#*://}" # "http://foo.bat.net/x/y.html" ----> "foo.bat.net/x/y.html" - - if [[ "${protocol}" == "file" ]] ; then - cat "${path1}" - return $? - elif [[ "${protocol}" == ~(Elr)http(|s) ]] ; then - typeset host="${path1%%/*}" - typeset path="${path1#*/}" - typeset port="${host##*:}" - - integer netfd - compound httpresponse # http response - - # If URL did not contain a port number in the host part then look at the - # protocol to get the port number - if [[ "${port}" == "${host}" ]] ; then - case "${protocol}" in - "http") port=80 ;; - "https") port=443 ;; - *) port="$(getent services "${protocol}" | sed 's/[^0-9]*//;s/\/.*//')" ;; - esac - else - host="${host%:*}" - fi - - printmsg "protocol=${protocol} port=${port} host=${host} path=${path}" - - # prechecks - [[ "${protocol}" != "" ]] || { print -u2 -f "%s: protocol not set.\n" "$0" ; return 1 ; } - [[ "${port}" != "" ]] || { print -u2 -f "%s: port not set.\n" "$0" ; return 1 ; } - [[ "${host}" != "" ]] || { print -u2 -f "%s: host not set.\n" "$0" ; return 1 ; } - [[ "${path}" != "" ]] || { print -u2 -f "%s: path not set.\n" "$0" ; return 1 ; } - - # open TCP channel - if [[ "${protocol}" == "https" ]] ; then - compound sslfifo - sslfifo.dir="$(mktemp -d)" - sslfifo.in="${sslfifo.dir}/in" - sslfifo.out="${sslfifo.dir}/out" - - # register an EXIT trap and use "errexit" to leave it at the first error - # (this saves lots of if/fi tests for error checking) - trap "rm -r \"${sslfifo.dir}\"" EXIT - set -o errexit - - mkfifo "${sslfifo.in}" "${sslfifo.out}" - - # create async openssl child to handle https - openssl s_client -quiet -connect "${host}:${port}" <"${sslfifo.in}" >>"${sslfifo.out}" & - - # send HTTP request - request="GET /${path} HTTP/1.1\r\n" - request+="Host: ${host}\r\n" - request+="User-Agent: crawlsrccomments/ksh93(ssl) (2010-03-27; $(uname -s -r -p))\r\n" - request+="Connection: close\r\n" - print -n -- "${request}\r\n" >> "${sslfifo.in}" - - # collect response and send it to stdout - { - parse_http_response httpresponse - cat_http_body "${httpresponse.transfer_encoding}" - } <"${sslfifo.out}" - - wait || { print -u2 -f "%s: openssl failed.\n" ; exit 1 ; } - - return 0 - else - redirect {netfd}<> "/dev/tcp/${host}/${port}" - (( $? != 0 )) && { print -u2 -f "%s: Could not open %s\n" "$0" "${1}" ; return 1 ; } - - # send HTTP request - request="GET /${path} HTTP/1.1\r\n" - request+="Host: ${host}\r\n" - request+="User-Agent: crawlsrccomments/ksh93 (2010-03-27; $(uname -s -r -p))\r\n" - request+="Connection: close\r\n" - print -n -- "${request}\r\n" >&${netfd} - - # collect response and send it to stdout - parse_http_response httpresponse <&${netfd} - cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} - - # close connection - redirect {netfd}<&- - - return 0 - fi - else - return 1 - fi - # notreached -} - -function print_stats -{ - set -o errexit - - # gather some statistics - compound stats=( - integer files_with_comments=0 - integer files_without_comments=0 - - integer files_without_known_format=0 - - integer files_with_license_info=0 - integer files_without_license_info=0 - - integer total_num_files=0 - ) - - for i in $(printf "%s\n" "${!records[@]}" | sort) ; do - if "${records[$i].comments_parsed}" ; then - (( stats.files_with_comments++ )) - else - (( stats.files_without_comments++ )) - fi - - if ! "${records[$i].fileformat_found}" ; then - (( stats.files_without_known_format++ )) - fi - - if "${records[$i].license_info_found}" ; then - (( stats.files_with_license_info++ )) - else - (( stats.files_without_license_info++ )) - fi - - (( stats.total_num_files++ )) - done - - print -v stats - return 0 -} - - -function print_comments_plain -{ - set -o errexit - - nameref records=$1 - nameref options=$2 - typeset i j - - for i in $(printf "%s\n" "${!records[@]}" | sort) ; do - nameref node=records[$i] - - if [[ "${options.filepattern.accept}" != "" ]] && \ - [[ "${node.filename}" != ${options.filepattern.accept} ]] ; then - continue - fi - if [[ "${options.filepattern.reject}" != "" ]] && \ - [[ "${node.filename}" == ${options.filepattern.reject} ]] ; then - continue - fi - - node.license_info_found=false - - if ! "${node.comments_parsed}" ; then - continue - fi - - for j in "${!node.comments[@]}" ; do - typeset s="${node.comments[$j]}" - typeset match=false - - if [[ "${options.commentpattern.accept}" != "" ]] && \ - [[ "$s" == ${options.commentpattern.accept} ]] ; then - match=true - fi - if [[ "${options.commentpattern.reject}" != "" ]] && \ - [[ "$s" == ${options.commentpattern.reject} ]] ; then - match=false - fi - - if "${match}" ; then - printf "\f#### filename='%s',\tcomment=%s\n" "${node.filename}" "$j" - printf "%s\n" "$s" - node.license_info_found=true - fi - done - - if ! "${node.license_info_found}" ; then - printf "## no match found in '%s'," "${node.filename}" - printf "comments_parsed=%s, fileformat_found=%s, file_format=%s\n" \ - "${node.comments_parsed}" \ - "${node.fileformat_found}" \ - "${node.file_format}" - fi - done - - return 0 -} - -function print_comments_duplicates_compressed -{ - set -o errexit - - nameref records=$1 - nameref options=$2 - typeset i j - typeset -A hashed_comments - integer num_hashed_comments - - for i in $(printf "%s\n" "${!records[@]}" | sort) ; do - nameref node=records[$i] - - if [[ "${options.filepattern.accept}" != "" ]] && \ - [[ "${node.filename}" != ${options.filepattern.accept} ]] ; then - continue - fi - if [[ "${options.filepattern.reject}" != "" ]] && \ - [[ "${node.filename}" == ${options.filepattern.reject} ]] ; then - continue - fi - - node.license_info_found=false - - if ! "${node.comments_parsed}" ; then - continue - fi - - for j in "${!node.comments[@]}" ; do - typeset s="${node.comments[$j]}" - typeset match=false - - if [[ "${options.commentpattern.accept}" != "" ]] && \ - [[ "$s" == ${options.commentpattern.accept} ]] ; then - match=true - fi - if [[ "${options.commentpattern.reject}" != "" ]] && \ - [[ "$s" == ${options.commentpattern.reject} ]] ; then - match=false - fi - - - if "${match}" ; then - typeset -l hashstring # lowercase - - # compress the comment (e.g. convert whiteapces and '.,:;()"' to newline characters) ... - hashstring="${s//+([\n\r\t\v*#.,:;\(\)\"[:space:][:blank:]])/${ch.newline}}" - # ... and then create a MD5 hash from this string - hash="$(sum -x md5 <<<"${hashstring}")" - - nameref hc_node=hashed_comments[${hash}] - - if [[ "${hc_node}" == "" ]] ; then - # build node if there isn't one yet - typeset -a hc_node.fileids - typeset hc_node.comment="$s" - fi - - hc_node.fileids+=( "$(printf "%s (md5='%s', sha1='%s')\n" "${node.filename}" "${node.hashsum["md5"]}" "${node.hashsum["sha1"]}")" ) - - node.license_info_found=true - fi - done - - if ! "${node.license_info_found}" ; then - printf "## no match found in " - printf "%s (md5='%s', sha1='%s'), " "${node.filename}" "${node.hashsum["md5"]}" "${node.hashsum["sha1"]}" - printf "comments_parsed=%s, fileformat_found=%s, file_format=%s\n" \ - "${node.comments_parsed}" \ - "${node.fileformat_found}" \ - "${node.file_format}" - fi - done - - # print comments and all fileids (filename+hash sums) which include this comment - for i in "${!hashed_comments[@]}" ; do - printf "\f## The comment (ID=%s) ..." "${i}" - printf "\n-- snip --" - printf "\n%s" "${hashed_comments[${i}].comment}" - printf "\n-- snip --" - printf "\n... applies to the following files:\n" - printf "\t%s\n" "${hashed_comments[${i}].fileids[@]}" # printf repeats the format string for each array memeber - done - - return 0 -} - -function do_crawl -{ - set -o errexit - - compound options=( - integer max_filesize_for_scan=$((256*1024)) - integer max_num_comments=$((2**62)) # FIXME: This should be "+Inf" (=Infinite) - ) - - shift - while getopts -a "${progname}" "${do_crawl_usage}" OPT "$@" ; do - printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - S) options.max_filesize_for_scan="${OPTARG}" ;; - N) options.max_num_comments="${OPTARG}" ;; - *) usage do_crawl_usage ;; - esac - done - shift $((OPTIND-1)) - - compound scan=( - typeset -A records - ) - - # read filenames from stdin - while read i ; do - printf "## scanning %s ...\n" "$i" - extract_comments scan.records "$i" ${options.max_num_comments} ${options.max_filesize_for_scan} || true - done - - # print compound variable array (we strip the "typeset -A records" for now) - print -v scan >"crawlsrccomments_extracted_comments.cpv" - - print "# Wrote results to crawlsrccomments_extracted_comments.cpv" - - return 0 -} - -function do_getcomments -{ - set -o errexit - - # vars - compound scan - typeset database - typeset tmp - - compound options=( - typeset database="crawlsrccomments_extracted_comments.cpv" - - typeset print_stats=false - typeset zapduplicates=false - compound filepattern=( - typeset accept="*" - typeset reject="" - ) - compound commentpattern=( - typeset accept="~(Ei)(license|copyright)" - typeset reject="" - ) - ) - - shift - while getopts -a "${progname}" "${do_getcomments_usage}" OPT "$@" ; do - # printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - c) options.commentpattern.accept="${OPTARG}" ;; - C) options.commentpattern.reject="${OPTARG}" ;; - D) options.database="${OPTARG}" ;; - l) options.filepattern.accept="${OPTARG}" ;; - L) options.filepattern.reject="${OPTARG}" ;; - S) options.print_stats=true ;; - +S) options.print_stats=false ;; - Z) options.zapduplicates=true ;; - +Z) options.zapduplicates=false ;; - *) usage do_getcomments_usage ;; - esac - done - shift $((OPTIND-1)) - - # array of temporary files which should be cleaned-up upon exit - typeset -a tmpfiles - trap 'set -o errexit ; print -u2 "# Cleaning up..." ; ((${#tmpfiles[@]} > 0)) && rm -- "${tmpfiles[@]}" ; print -u2 "# Done."' EXIT - - # Support for HTTP URLs - if [[ "${options.database}" == ~(El)(http|https)://.* ]] ; then - database="/tmp/extract_license_cat_url_${PPID}_$$.tmp" - tmpfiles+=( "${database}" ) - print -u2 "# Loading URL..." - cat_url "${options.database}" >"${database}" - print -u2 "# Loading URL done." - else - database="${options.database}" - fi - - if [[ ! -r "${database}" ]] ; then - fatal_error "Can't read ${database}." - fi - - # Support for compressed database files - case "$(LC_ALL=C /usr/bin/file "${database}")" in - *bzip2*) - tmp="/tmp/extract_license_bzcat_${PPID}_$$.tmp" - tmpfiles+=( "${tmp}" ) - print -u2 "# Uncompressing data (bzip2) ..." - bzcat <"${database}" >"${tmp}" - print -u2 "# Uncompression done." - database="${tmp}" - ;; - *gzip*) - tmp="/tmp/extract_license_bzcat_${PPID}_$$.tmp" - tmpfiles+=( "${tmp}" ) - print -u2 "# Uncompressing data (gzip) ..." - gunzip -c <"${database}" >"${tmp}" - print -u2 "# Uncompression done." - database="${tmp}" - ;; - esac - - # Read compound variable which contain all recorded comments - print -u2 "# reading records..." - read -C scan <"${database}" || fatal_error 'Error reading data.' - print -u2 -f "# reading %d records done.\n" "${#scan.records[@]}" - - # print comments - print -u2 "# processing data..." - print "## comments start:" - if "${options.zapduplicates}" ; then - print_comments_duplicates_compressed scan.records options - else - print_comments_plain scan.records options - fi - print "## comments end" - print -u2 "# processing data done." - - if "${options.print_stats}" ; then - print_stats - fi - - return 0 -} - -function usage -{ - nameref usagemsg=$1 - OPTIND=0 - getopts -a "${progname}" "${usagemsg}" OPT '-?' - exit 2 -} - -typeset -r do_getcomments_usage=$'+ -[-?\n@(#)\$Id: getcomments (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?getcomments - extract license information from source files] -[+DESCRIPTION?\bgetcomments\b is a small utilty script which extracts - license information from the "\bgetcomments\b"-database - file created by \bcrawl\b. The script allows various - filters (see options below) to be applied on the database] -[+?The license extraction is done in two steps - first a crawler script - called \bcrawl\b will scan all source files, extract - the comments and stores this information in a "database" file called - "crawlsrccomments_extracted_comments.cpv" and then \bextract_license\b allows - queries on this database.] -[D:database?Database file for input (either file, http:// or https://-URL).]:[database] -[l:acceptfilepattern?Process only files which match pattern.]:[pattern] -[L:rejectfilepattern?Process only files which do not match pattern.]:[pattern] -[c:acceptcommentpattern?Match comments which match pattern. Defaults to ~(Ei)(license|copyright)]:[pattern] -[C:rejectcommentpattern?Discard comments which match pattern. Defaults to ""]:[pattern] -[S:stats?Print statistics.] -[Z:zapsimilar?Combine similar/duplicate comments in the report.] -[+SEE ALSO?\bksh93\b(1), \bsvcprop\b(1)] -' - -typeset -r do_crawl_usage=$'+ -[-?\n@(#)\$Id: crawl (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?crawl - crawl comment information from source files] -[+DESCRIPTION?\bcrawl\b is a small utilty script which reads - a list of source code files from stdin, determinates the type of - syntax used by these files and then extracts - comments from the source code and stores this information into a - "database"-like file called "crawlsrccomments_extracted_comments.cpv" which can then - be processed by \bextract_license\b or similar processing tools.] -[S:scanmaxcharacters?Scan a maximum number of numchars characters for comments. - Defaults to 256K characters.]:[numchars] -[N:maxnumcomments?Maximum numbers of comments to crawl. Defaults to "+Infinite"]:[numcomments] -[+SEE ALSO?\bksh93\b(1), \bsvcprop\b(1)] -' - -typeset -r crawlsrccomments_usage=$'+ -[-?\n@(#)\$Id: crawlsrccomments (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?crawlsrccomments - extract and filter comment information from source files] -[+DESCRIPTION?\bcrawlsrccomments\b is a small utilty script which reads - a list of source code files from stdin, determinates the type of - syntax used by these files and then extracts - comments from the source code and stores this information into a - "database"-like file called "crawlsrccomments_extracted_comments.cpv" which can then - be processed by \bextract_license\b or similar processing tools.] - -[crawl|getcomments] options - -[+SEE ALSO?\bksh93\b(1), \bsvcprop\b(1)] -' - - -# program start -builtin basename -builtin cat -builtin date -builtin uname -builtin rm -builtin sum || fatal_error "sum builtin not found." - -# exit at the first error we hit -set -o errexit - -typeset progname="${ basename "${0}" ; }" - -while getopts -a "${progname}" "${crawlsrccomments_usage}" OPT ; do - # printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage crawlsrccomments_usage ;; - esac -done -shift $((OPTIND-1)) - -typeset cmd="$1" - -case "$cmd" in - "crawl") - progname+=" ${cmd}" - do_crawl "$@" - exit $? - ;; - "getcomments") - progname+=" ${cmd}" - do_getcomments "$@" - exit $? - ;; - *) - usage crawlsrccomments_usage - ;; -esac - -fatal_error "not reached." -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/filemutexdemo1.sh b/usr/src/cmd/ast/libshell/common/scripts/filemutexdemo1.sh deleted file mode 100644 index bbfc84825c..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/filemutexdemo1.sh +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# filemutexdemo1 - a simple locking demo which supports read/write -# locks and critical sections (like JAVA's "syncronized" keyword) -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -# Definition for a mutex which uses the filesystem for locking -typeset -T filemutex_t=( - typeset name - - typeset lock_dirname - - typeset locked_exclusive="false" - typeset locked_shared="false" - - # keep track of subshell level. The problem is that we do not know a - # way to figure out whether someone calls "unlock" in a subshell and then - # leaves the subshell and calls "unlock" again - integer subshell=-1 - - typeset lock_dirname - - # create a filemutex instance (including lock directory) - function create - { - # make sure we return an error if the init didn't work - set -o errexit - - [[ "$1" == "" ]] && return 1 - - _.name="$1" - _.lock_dirname="/tmp/filemutex_t_${_.name}.lock" - - mkdir "${_.lock_dirname}" - - # last entry, used to mark the mutex as initalised+valid - (( _.subshell=.sh.subshell )) - return 0 - } - - # use a filemutex instance (same as "create" but without creating - # the lock directory) - function create_child - { - # make sure we return an error if the init didn't work - set -o errexit - - [[ "$1" == "" ]] && return 1 - - _.name="$1" - _.lock_dirname="/tmp/filemutex_t_${_.name}.lock" - - # last entry, used to mark the mutex as initalised+valid - (( _.subshell=.sh.subshell )) - return 0 - } - - function check_subshell - { - (( _.subshell == .sh.subshell )) && return 0 - print -u2 -f "filemutex_t.%s(%s): Wrong subshell level\n" "$1" "${_.name}" - return 1 - } - - function try_lock_shared - { - _.check_subshell "try_lock_shared" || return 1 - - mkdir "${_.lock_dirname}/shared_${PPID}_$$" 2>/dev/null || return 1 - _.locked_shared="true" - return 0 - } - - function lock_shared - { - float interval=0.2 - - _.check_subshell "lock_shared" || return 1 - - while ! _.try_lock_shared ; do sleep ${interval} ; (( interval+=interval/10. )) ; done - return 0 - } - - function try_lock_exclusive - { - _.check_subshell "try_lock_exclusive" || return 1 - - rmdir "${_.lock_dirname}" 2>/dev/null || return 1 - _.locked_exclusive="true" - return 0 - } - - function lock_exclusive - { - float interval=0.2 - - _.check_subshell "lock_exclusive" || return 1 - - while ! _.try_lock_exclusive ; do sleep ${interval} ; (( interval+=interval/10. )) ; done - return 0 - } - - # critical section support (like java's "synchronized" keyword) - function synchronized - { - integer retcode - - _.check_subshell "synchronized" || return 1 - - _.lock_exclusive - - "$@" - (( retcode=$? )) - - _.unlock - - return ${retcode} - } - - # critical section support with shared lock - function synchronized_shared - { - integer retcode - - _.check_subshell "synchronized_shared" || return 1 - - _.lock_shared - - "$@" - (( retcode=$? )) - - _.unlock - - return ${retcode} - } - - function unlock - { - # return an error if rmdir/mkdir/check_subshell fail... - set -o errexit - - _.check_subshell "unlock" - - if ${_.locked_shared} ; then - rmdir "${_.lock_dirname}/shared_${PPID}_$$" - _.locked_shared="false" - return 0 - elif ${_.locked_exclusive} ; then - mkdir "${_.lock_dirname}" - _.locked_exclusive="false" - return 0 - fi - - print -u2 -f "filemutex_t.unlock(%s): mutex '%s' not locked." "$1" "${_.name}" - return 1 - } - - # destroy mutex if noone is using it anymore (not the same as "unset" !!)) - function destroy - { - _.check_subshell "destroy" || return 1 - - (${_.locked_exclusive} || ${_.locked_shared}) && _.unlock - rmdir "${_.lock_dirname}" - return 0 - } -) - -# main -builtin mkdir -builtin rmdir - -print "## Start." - -typeset -r mymutexname="hello_world" - -filemutex_t fs - -fs.create "${mymutexname}" || print -u2 "Mutex init failed." - -print "# Starting child which keeps an exclusive lock for 10 seconds..." -( - filemutex_t child_fs - - child_fs.create_child "${mymutexname}" - - child_fs.lock_exclusive - sleep 10 - child_fs.unlock -) & - -sleep 1 - -printf "%T: # Waiting to obtain a shared lock...\n" -fs.lock_shared -printf "%T: # Obtained shared lock\n" - -printf "fs.locked_exclusive=%s, fs.locked_shared=%s\n" "${fs.locked_exclusive}" "${fs.locked_shared}" - -ls -lad /tmp/filemutex*/* - -printf "%T: # Executing child which runs printf '|%%s|\\\n' 'hello' 'world' inside a synchronized section\n" -( - filemutex_t child_fs - - child_fs.create_child "${mymutexname}" - - child_fs.synchronized printf '|%s|\n' 'hello' 'world' -) & - -printf "%T: # Sleeping 5 secs while holding the shared lock...\n" -sleep 5. - -printf "%T: # Releasing shared lock...\n" -fs.unlock - -sleep 5. -print "# Destroying lock..." -fs.destroy - -print "## Done." - -exit 0 diff --git a/usr/src/cmd/ast/libshell/common/scripts/filetree1.sh b/usr/src/cmd/ast/libshell/common/scripts/filetree1.sh deleted file mode 100644 index 595e081cdb..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/filetree1.sh +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - - -function do_directory -{ - nameref tree=$1 - typeset basedir="$2" - - typeset basename - typeset dirname - typeset i - typeset dummy - - typeset -C -A tree.files - typeset -C -A tree.dirs - - find "${basedir}"/* -prune 2>/dev/null | while read i ; do - dirname="$(dirname "$i")" - basename="$(basename "$i")" - - # define "node" - if [[ -d "$i" ]] ; then - typeset -C tree.dirs["${basename}"] - nameref node=tree.dirs["${basename}"] - typeset -C node.flags - node.flags.dir="true" - node.flags.file="false" - else - typeset -C tree.files["${basename}"] - nameref node=tree.files["${basename}"] - typeset -C node.flags - - node.flags.dir="false" - node.flags.file="true" - fi - - # basic attributes - typeset -C node.paths=( - dirname="${dirname}" - basename="${basename}" - path="${i}" - ) - - nameref nflags=node.flags - [[ -r "$i" ]] && nflags.readable="true" || nflags.readable="false" - [[ -w "$i" ]] && nflags.writeable="true" || nflags.writeable="false" - [[ -x "$i" ]] && nflags.executable="true" || nflags.executable="false" - - [[ -b "$i" ]] && nflags.blockdevice="true" || nflags.blockdevice="false" - [[ -c "$i" ]] && nflags.characterdevice="true" || nflags.characterdevice="false" - [[ -S "$i" ]] && nflags.socket="true" || nflags.socket="false" - - [[ -L "$i" ]] && nflags.symlink="true" || nflags.symlink="false" - - integer node.size - integer node.links - typeset -C node.owner - ( [[ -x /usr/bin/runat ]] && ls -@ade "$i" || ls -lade "$i" ) | - IFS=' ' read \ - node.mask \ - node.links \ - node.owner.uid \ - node.owner.gid \ - node.size \ - dummy - - typeset -C node.extended_attributes - if [[ ${node.mask} == ~(Er)@ ]] ; then - node.extended_attributes.hasattrs="true" - typeset -a attrlist=( - $( runat "$i" "ls -1" ) - ) - else - node.extended_attributes.hasattrs="false" - fi - - if ${nflags.readable} ; then - # note that /usr/xpg4/bin/file does not use $'\t' as seperator - we - # have to use ':' instead. - file -h "$i" | IFS=' ' read dummy node.filetype - fi - - if ${nflags.dir} ; then - do_directory "${!node}" "$i" - fi - done - - # remove empty lists - (( ${#tree.files[@]} == 0 )) && unset tree.files - (( ${#tree.dirs[@]} == 0 )) && unset tree.dirs - - return 0 -} - - -function pathtovartree -{ - nameref tree=$1 - typeset basedir="$2" - - do_directory tree "${basedir}" - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${filetree1_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin dirname -builtin date -builtin uname - -typeset progname="${ basename "${0}" ; }" - -typeset -r filetree1_usage=$'+ -[-?\n@(#)\$Id: filetree1 (Roland Mainz) 2009-05-06 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?filetree1 - file tree demo] -[+DESCRIPTION?\bfiletree1\b is a small ksh93 compound variable demo - which accepts a directory name as input, and then builds tree - nodes for all files+directories and stores all file attributes - in these notes and then outputs the tree in the format - specified by viewmode (either "list", "namelist", "tree" or "compacttree")..] - -viewmode dirs - -[+SEE ALSO?\bksh93\b(1), \bfile\b(1)] -' - -while getopts -a "${progname}" "${filetree1_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -typeset viewmode="$1" -shift - -if [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then - fatal_error $"Invalid view mode \"${viewmode}\"." -fi - -typeset -C myfiletree - -while (( $# > 0 )) ; do - print -u2 -f "# Scanning %s ...\n" "${1}" - pathtovartree myfiletree "${1}" - shift -done -print -u2 $"#parsing completed." - -case "${viewmode}" in - list) - set | egrep "^myfiletree\[" | fgrep -v ']=$' - ;; - namelist) - typeset + | egrep "^myfiletree\[" - ;; - tree) - print -v myfiletree - ;; - compacttree) - print -C myfiletree - ;; - *) - fatal_error $"Invalid view mode \"${viewmode}\"." - ;; -esac - -print -u2 $"#done." - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/gnaw.sh b/usr/src/cmd/ast/libshell/common/scripts/gnaw.sh deleted file mode 100644 index 9876d9c5dd..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/gnaw.sh +++ /dev/null @@ -1,1044 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# gnaw - a simple ksh93 technology demo -# -# Note that this script has been written with the main idea to show -# many of ksh93's new features (comparing to ksh88/bash) and not -# as an example of efficient&&clean script code (much of the code -# could be done more efficient using compound variables, this script -# focus is the usage of associative arrays). -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function print_setcursorpos -{ - print -n -- "${vtcode[cup_${1}_${2}]}" -} - -function beep -{ - ${quiet} || print -n -- "${vtcode["bel"]}" -} - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -# Get terminal size and put values into a compound variable with the integer -# members "columns" and "lines" -function get_term_size -{ - nameref rect=$1 - - rect.columns=${ tput cols ; } || return 1 - rect.lines=${ tput lines ; } || return 1 - - return 0 -} - -function print_levelmap -{ - integer screen_y_offset=$1 - integer start_y_pos=$2 # start at this line in the map - integer max_numlines=$3 # maximum lines we're allowed to render - integer x - integer y - typeset line="" - - print_setcursorpos 0 ${screen_y_offset} - - for (( y=start_y_pos; (y-start_y_pos) < max_numlines && y < levelmap["max_y"] ; y++ )) ; do - line="" - for (( x=0 ; x < levelmap["max_x"] ; x++ )) ; do - line+="${levelmap["${x}_${y}"]}" - done - - print -- "${line} " - done - - # print lines filled with spaces for each line not filled - # by the level map - line="${vtcode["spaceline"]:0:${levelmap["max_x"]}}" - for (( ; (y-start_y_pos) < max_numlines ; y++ )) ; do - print -- "${line} " - done - return 0 -} - -function level_completed -{ - integer i - typeset dummy - typeset render_buffer="$( - print -n -- "${vtcode["clear"]}" - cat <<ENDOFTEXT - - # ###### # # ###### # - # # # # # # - # ##### # # ##### # - # # # # # # - # # # # # # - ###### ###### ## ###### ###### - - (Good job) - - ##### #### # # ###### - # # # # ## # # - # # # # # # # ##### - # # # # # # # # - # # # # # ## # - ##### #### # # ###### - - -ENDOFTEXT - - printf " SCORE: --> %s <--\n" "${player["score"]}" - printf " LIVES: --> %s <--\n" "${player["lives"]}" - )" - print -- "${render_buffer}${end_of_frame}" - - # wait five seconds and swallow any user input - for (( i=0 ; i < 50 ; i++ )) ; do - read -r -t 0.1 -n 1 dummy - done - - print "Press any key to continue...${end_of_frame}" - # wait five secs or for a key - read -r -t 5 -n 1 dummy - return 0 -} - -function game_over -{ - typeset dummy - typeset render_buffer="$( - print -n -- "${vtcode["clear"]}" - cat <<ENDOFTEXT - - #### ## # # ###### - # # # # ## ## # - # # # # ## # ##### - # ### ###### # # # - # # # # # # # - #### # # # # ###### - - (LOSER!) - - #### # # ###### ##### - # # # # # # # - # # # # ##### # # - # # # # # ##### - # # # # # # # - #### ## ###### # # - -ENDOFTEXT - - printf "\n SCORE: --> %s <--\n" "${player["score"]}" - )" - print -r -- "${render_buffer}${end_of_frame}" - - # wait five seconds and swallow any user input - for (( i=0 ; i < 50 ; i++ )) ; do - read -r -t 0.1 -n 1 dummy - done - - print "Press any key to continue...${end_of_frame}" - # wait five secs or for a key - read -r -t 5 -n 1 dummy - return 0 -} - -function run_logo -{ - typeset render_buffer="$( - cat <<ENDOFTEXT - - ##### # # # # # ### -# # ## # # # # # # ### -# # # # # # # # # ### -# #### # # # # # # # # # -# # # # # ####### # # # -# # # ## # # # # # ### - ##### # # # # ## ## ### -ENDOFTEXT - )" - print -- "${vtcode["clear"]}${render_buffer}" - - # wait two seconds and swallow any user input - for (( i=0 ; i < 20 ; i++ )) ; do - read -r -t 0.1 -n 1 dummy - done - - print "\n (The KornShell 93 maze game)" - - attract_mode - return 0 -} - -function attract_mode -{ -( - # Now present some info, line-by-line in an endless loop - # until the user presses a key (we turn the "magic" return - # code for that) - integer -r magic_return_code=69 - typeset line - IFS='' ; # Make sure we do not swallow whitespaces - - while true ; do - ( - redirect 5<&0 - - (cat <<ENDOFTEXT - - - - - - ################ - ######################## - ############################ - ####### ###### ####### - ###### ###### ######## - ####### ###### ####### - ############################## - ############################## - ############################## - ############################## - ############################## - ######### ######## ######### - # #### #### #### # - - - - - - - Written by - - Roland Mainz - (roland.mainz@nrubsig.org) - - - - - - - ############## - ######################## - #################**############ - ################################ - ############################ - ###################### - ################ - ###################### - ############################ - ################################ - ############################## - ######################## - ############## - - - - - - - - High scores: - - * 'chin' 8200 pt - * 'gisburn' 7900 pt - * 'tpenta' 5520 pt - * 'kupfer' 5510 pt - * 'noname' 5000 pt - * 'noname' 4000 pt - * 'livad' 3120 pt - * 'noname' 3000 pt - * 'noname' 2000 pt - * 'noname' 1000 pt - -ENDOFTEXT - - # clear screen, line-by-line - for (( i=0 ; i < termsize.lines ; i++ )) ; do print "" ; done - ) | (while read -r line ; do - read -r -t 0.3 -n 1 c <&5 - [[ "$c" != "" ]] && exit ${magic_return_code} - print -- "${line}" - done) - (( $? == magic_return_code )) && exit ${magic_return_code} - ) - (( $? == magic_return_code )) && return 0 - - sleep 2 - done -) -} - -function run_menu -{ - integer numlevels=0 - integer selected_level=0 - typeset l - - # built list of available levels based on the "function levelmap_.*" - # built into this script - typeset -f | egrep "^function.*levelmap_.*" | sed 's/^function //' | - while read -r l ; do - levellist[numlevels]="$l" - numlevels+=1 - done - - # swallow any queued user input (e.g. drain stdin) - read -r -t 0.1 -n 100 dummy - - while true ; do - # menu loop with timeout (which switches to "attract mode") - while true ; do - print -n -- "${vtcode["clear"]}" - - cat <<ENDOFTEXT ->======================================\ -> /-\ .--. | -> | OO| / _.-' .-. .-. .-. .-. | -> | | \ '-. '-' '-' '-' '-' | -> ^^^^^ '--' | ->======\ /================\ .-. | -> | | | '-' | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -ENDOFTEXT - print " GNAW - the ksh93 maze game" - print "\n\tMenu:" - - print "\t - [L]evels:" - for (( i=0 ; i < numlevels ; i++ )) ; do - printf "\t %s %s \n" "$( (( i == selected_level )) && print -n "*" || print -n " ")" "${levellist[i]##levelmap_}" - done - - print "\t - Rendering options:" - printf "\t [%s] Use [U]nicode\n" "$( (( game_use_unicode == 1 )) && print -n "x" || print -n "_" )" - printf "\t [%s] Use [C]olors\n" "$( (( game_use_colors == 1 )) && print -n "x" || print -n "_" )" - - print "\t - [S]tart - [Q]uit" - - # wait 30 secs (before we switch to "attract mode") - c="" ; read -r -t 30 -n 1 c - case "$c" in - 'l') (( selected_level=(selected_level+numlevels+1) % numlevels )) ;; - 'L') (( selected_level=(selected_level+numlevels-1) % numlevels )) ;; - ~(Fi)s) - (( game_use_colors == 1 )) && print -- "${vtcode["bg_black"]}" - case "${game_use_colors}${game_use_unicode}" in - "00") main_loop "${levellist[selected_level]}" ;; - "01") main_loop "${levellist[selected_level]}" | map_filter 0 1 ;; - "10") main_loop "${levellist[selected_level]}" | map_filter 1 0 ;; - "11") main_loop "${levellist[selected_level]}" | map_filter 1 1 ;; - esac - print -- "${vtcode["vtreset"]}" - ;; - ~(Fi)q | $'\E') - # make sure we do not exit on a cursor key (e.g. <esc>[A,B,C,D) - read -r -t 0.01 -n 1 c - if [[ "$c" == "[" ]] ; then - # this was a cursor key sequence, just eat the 3rd charcater - read -r -t 0.01 -n 1 c - else - exit 0 - fi - ;; - ~(Fi)u) (( game_use_unicode=(game_use_unicode+2+1) % 2)) ;; - ~(Fi)c) (( game_use_colors=(game_use_colors+2+1) % 2)) ;; - "") break ;; # timeout, switch to attract mode - *) beep ;; - esac - done - - print -n -- "${vtcode["clear"]}" - attract_mode - done - return 0 -} - -function levelmap_stripes -{ -cat <<ENDOFLEVEL -################################### -#....... ............... P # -#########..#################..### # -#########..#################..### # -#....... .. ..............# # -############### ################ # -############### ################ # -#............. M ..............# # -##..##################### ###### # -##..##################### ###### # -#....... ........... .......# # -######## ############ ######### # -# #### ############ ######### # -# #.................. ......# # -# ############################### # -# # -################################### -ENDOFLEVEL - return 0 -} - -function levelmap_livad -{ -cat <<ENDOFLEVEL -##################################################### -# # -# ############## ############### ################ # -# #............ P ..............# # -# .#############################################.# # -# #.#.......... ............#. # -# #.#.########## ############### ############.#.# # -# #...#........ ..........#...# # -# #...#.#####################################.#.#.# # -# #...#.#...... ........#...#.# # -# #.#.#...###### #########################.#.#.#.# # -# .#.....#.... M ......#...#.#.# # -# #.#.#...####################### ########.#.#.#.# # -# #...#.#...... ........#...#.# # -# #...#.######## ############### ##########.#.#.# # -# #...#........ ..........#...# # -# #.#.#########################################.#.# # -# #.#.......... ............#. # -# .############ ############### ##############.# # -# #............ ..............# # -# ################################################# # -# # -##################################################### -ENDOFLEVEL - return 0 -} - -function levelmap_classic1 -{ -cat <<ENDOFLEVEL -######################### -#.P.........#...........# -#.####.####.#.####.####.# -#.# #.# #.#.# #.# #.# -#.# #.# #.#.# #.# #.# -#.####.####.#.####.####.# -#.......................# -#.####.#.#######.#.####.# -#.# #.#.# #.#.# #.# -#.####.#.#######.#.####.# -#......#....#....#......# -######.####.#.####.###### -###### # # ###### -###### # ## ## # ###### -###### # # # # ###### -# # M # # -###### # ####### # ###### -###### # # ###### -###### # ####### # ###### -###### # # # # ###### -######.#.#######.#.###### -#...........#...........# -#.###.###...#...###.###.# -#...#...............#...# -###.#....#######....#.### -# #.#..#.# #.#..#.# # -###....#.#######.#....### -#......#....#....#......# -#.#########.#.#########.# -#.......................# -######################### -ENDOFLEVEL - return 0 -} - -function levelmap_classic2 -{ -cat <<ENDOFLEVEL -####################### -#.P...#.........#.....# -#.###.#.#######.#.###.# -#.....................# -###.#.####.#.####.#.### -###.#......#......#.### -###.###.#######.###.### -###.................### -###.###.### ###.###.### -###.#...#M #...#.### -###.#.#.#######.#.#.### -#.....#.........#.....# -###.#####..#..#####.### -###........#........### -###.###.#######.###.### -#.....................# -#.###.####.#.####.###.# -#.###.#....#....#.###.# -#.###.#.#######.#.###.# -#.....................# -####################### -ENDOFLEVEL - return 0 -} - -function levelmap_easy -{ -cat <<ENDOFLEVEL -################## -# .............. # -# . ###### # -# . # M # # -# . # # # -# . ### ## # -# . # # -# . ### # -# . # -# .......... # -# .......... P # -################## -ENDOFLEVEL - return 0 -} - -function levelmap_sunsolaristext -{ -cat <<ENDOFLEVEL -################################################ -# .#### . # #....# # -# # # # #....# # -# #### # # #.#..# M # -# # # # #..#.# # -# # # # # #...## # -# #### #### #....# # -# # -# #### #### # ## ##### # #### # -# # #. .# # # # #....# # # # -# #### # # # # P # #....# # #### # -# # # ### #.#### #.### # # # -# # .# #. .. # # #...# # # # # -# #### #### ###### . # ....# # ####. # -################################################ -ENDOFLEVEL - return 0 -} - -function read_levelmap -{ - typeset map="$( $1 )" - - integer y=0 - integer x=0 - integer maxx=0 - integer numdots=0 - typeset line - typeset c - - while read -r line ; do - for (( x=0 ; x < ${#line} ; x++ )) ; do - c="${line:x:1}" - - case $c in - ".") numdots+=1 ;; - "M") - # log start position of monsters - levelmap["monsterstartpos_x"]="$x" - levelmap["monsterstartpos_y"]="$y" - c=" " - ;; - "P") - # log start position of player - levelmap["playerstartpos_x"]="$x" - levelmap["playerstartpos_y"]="$y" - c=" " - ;; - esac - - levelmap["${x}_${y}"]="$c" - done - (( maxx=x , y++ )) - done <<<"${map}" - - levelmap["max_x"]=${maxx} - levelmap["max_y"]=${y} - levelmap["numdots"]=${numdots} - - # consistency checks - if [[ "${levelmap["monsterstartpos_x"]}" == "" ]] ; then - fatal_error "read_levelmap: monsterstartpos_x is empty." - fi - if [[ "${levelmap["playerstartpos_x"]}" == "" ]] ; then - fatal_error "read_levelmap: playerstartpos_x is empty." - fi - - return 0 -} - -function player.set -{ - case "${.sh.subscript}" in - pos_y) - if [[ "${levelmap["${player["pos_x"]}_${.sh.value}"]}" == "#" ]] ; then - .sh.value=${player["pos_y"]} - beep - fi - ;; - - pos_x) - if [[ "${levelmap["${.sh.value}_${player["pos_y"]}"]}" == "#" ]] ; then - .sh.value=${player["pos_x"]} - beep - fi - ;; - esac - return 0 -} - -function monster.set -{ - case "${.sh.subscript}" in - *_pos_y) - if [[ "${levelmap["${monster[${currmonster}_"pos_x"]}_${.sh.value}"]}" == "#" ]] ; then - .sh.value=${monster[${currmonster}_"pos_y"]} - # turn homing off when the monster hit a wall - monster[${currmonster}_"homing"]=0 - fi - ;; - - *_pos_x) - if [[ "${levelmap["${.sh.value}_${monster[${currmonster}_"pos_y"]}"]}" == "#" ]] ; then - .sh.value=${monster[${currmonster}_"pos_x"]} - # turn homing off when the monster hit a wall - monster[${currmonster}_"homing"]=0 - fi - ;; - esac - return 0 -} - -function render_game -{ - # render_buffer is some kind of "background buffer" to "double buffer" - # all output and combine it in one write to reduce flickering in the - # terminal - typeset render_buffer="$( - integer screen_y_offset=1 - integer start_y_pos=0 - integer render_num_lines=${levelmap["max_y"]} - - if (( (termsize.lines-3) < levelmap["max_y"] )) ; then - (( start_y_pos=player["pos_y"] / 2)) - (( render_num_lines=termsize.lines-5)) - fi - - #print -n -- "${vtcode["clear"]}" - print_setcursorpos 0 0 - - # print score (note the " " around "%d" are neccesary to clean up cruft - # when we overwrite the level - printf "SCORE: %05d DOTS: %.3d LIVES: %2.d " "${player["score"]}" "${levelmap["numdots"]}" "${player["lives"]}" - print_levelmap ${screen_y_offset} ${start_y_pos} ${render_num_lines} - - # render player - print_setcursorpos ${player["pos_x"]} $((player["pos_y"]+screen_y_offset-start_y_pos)) - print -n "@" - - # render monsters - for currmonster in ${monsterlist} ; do - (( m_pos_x=monster[${currmonster}_"pos_x"] )) - (( m_pos_y=monster[${currmonster}_"pos_y"]+screen_y_offset-start_y_pos )) - - if (( m_pos_y >= screen_y_offset && m_pos_y < render_num_lines )) ; then - print_setcursorpos ${m_pos_x} ${m_pos_y} - print -n "x" - fi - done - - # status block - print_setcursorpos 0 $((render_num_lines+screen_y_offset)) - emptyline=" " - print -n " >> ${player["message"]} <<${emptyline:0:${#emptyline}-${#player["message"]}}" - )" - print -r -- "${render_buffer}${end_of_frame}" -# print "renderbuffersize=$(print "${render_buffer}" | wc -c) ${end_of_frame}" - return 0 -} - -function main_loop -{ - float sleep_per_cycle=0.2 - float seconds_before_read - integer num_cycles=0 - float rs - - print -n -- "${vtcode["clear"]}" - - read_levelmap "$1" - - # player init - player["pos_x"]=${levelmap["playerstartpos_x"]} - player["pos_y"]=${levelmap["playerstartpos_y"]} - player["score"]=0 # player score - player["lives"]=5 # number of lives - player["invulnerable"]=10 # cycles how long the player remains invulnerable - player["message"]="Go..." - - monsterlist="maw claw jitterbug tentacle grendel" - - for currmonster in ${monsterlist} ; do - monster[${currmonster}_"pos_x"]=${levelmap["monsterstartpos_x"]} - monster[${currmonster}_"pos_y"]=${levelmap["monsterstartpos_y"]} - monster[${currmonster}_"xstep"]=0 - monster[${currmonster}_"ystep"]=0 - monster[${currmonster}_"homing"]=0 - done - - # main game cycle loop - while true ; do - num_cycles+=1 - seconds_before_read=${SECONDS} - c="" ; read -r -t ${sleep_per_cycle} -n 1 c - - if [[ "$c" != "" ]] ; then - # special case handling for cursor keys which are usually composed - # of three characters (e.g. "<ESC>[D"). If only <ESC> is hit we - # quicky exit - if [[ "$c" == $'\E' ]] ; then - read -r -t 0.1 -n 1 c - if [[ "$c" != "[" ]] ; then - return 0 - fi - - # we assume the user is using the cursor keys, this |read| - # should fetch the 3rd byte of the three-character sequence - # for the cursor keys - read -r -t 0.1 -n 1 c - fi - - # if the user hit a key the "read" above was interrupted - # and didn't wait exactly |sleep_per_cycle| seconds. - # We wait here some moments (|rs|="remaining seconds") to - # avoid that the game gets "faster" when more user input - # is given. - (( rs=sleep_per_cycle-(SECONDS-seconds_before_read) )) - (( rs > 0.001 )) && sleep ${rs} - - player["message"]="" - - case "$c" in - j|D|4) (( player["pos_x"]-=1 )) ;; - k|C|6) (( player["pos_x"]+=1 )) ;; - i|A|8) (( player["pos_y"]-=1 )) ;; - m|B|2) (( player["pos_y"]+=1 )) ;; - - q) return 0 ;; - esac - - if [[ "${levelmap["${player["pos_x"]}_${player["pos_y"]}"]}" == "." ]] ; then - levelmap["${player["pos_x"]}_${player["pos_y"]}"]=" " - (( levelmap["numdots"]-=1 )) - - (( player["score"]+=10 )) - player["message"]='GNAW!!' - - if (( levelmap["numdots"] <= 0 )) ; then - level_completed - return 0 - fi - fi - fi - - # generic player status change - if (( player["invulnerable"] > 0 )) ; then - (( player["invulnerable"]-=1 )) - fi - if (( player["lives"] <= 0 )) ; then - game_over - return 0 - fi - - # move monsters - for currmonster in ${monsterlist} ; do - # make monster as half as slow then the others when it is following the user - if (( monster[${currmonster}_"homing"] > 0 )) ; then - (( (num_cycles%2) > 0 )) && continue - fi - - if [[ ${monster[${currmonster}_"pos_x"]} == ${player["pos_x"]} ]] ; then - if (( (monster[${currmonster}_"pos_y"]-player["pos_y"]) > 0 )) ; then - (( monster[${currmonster}_"xstep"]=+0 , monster[${currmonster}_"ystep"]=-1 )) - else - (( monster[${currmonster}_"xstep"]=+0 , monster[${currmonster}_"ystep"]=+1 )) - fi - monster[${currmonster}_"homing"]=1 - if (( player["invulnerable"] <= 0 )) ; then - player["message"]="Attention: ${currmonster} is chasing you" - fi - elif (( monster[${currmonster}_"pos_y"] == player["pos_y"] )) ; then - if (( (monster[${currmonster}_"pos_x"]-player["pos_x"]) > 0 )) ; then - (( monster[${currmonster}_"xstep"]=-1 , monster[${currmonster}_"ystep"]=-0 )) - else - (( monster[${currmonster}_"xstep"]=+1 , monster[${currmonster}_"ystep"]=+0 )) - fi - monster[${currmonster}_"homing"]=1 - if (( player["invulnerable"] <= 0 )) ; then - player["message"]="Attention: ${currmonster} is chasing you" - fi - else - if (( monster[${currmonster}_"homing"] == 0 )) ; then - case $((SECONDS % 6 + RANDOM % 4)) in - 0) (( monster[${currmonster}_"xstep"]=+0 , monster[${currmonster}_"ystep"]=+0 )) ;; - 2) (( monster[${currmonster}_"xstep"]=+0 , monster[${currmonster}_"ystep"]=+1 )) ;; - 3) (( monster[${currmonster}_"xstep"]=+1 , monster[${currmonster}_"ystep"]=+0 )) ;; - 5) (( monster[${currmonster}_"xstep"]=+0 , monster[${currmonster}_"ystep"]=-1 )) ;; - 6) (( monster[${currmonster}_"xstep"]=-1 , monster[${currmonster}_"ystep"]=+0 )) ;; - esac - fi - fi - - (( monster[${currmonster}_"pos_x"]=monster[${currmonster}_"pos_x"]+monster[${currmonster}_"xstep"] )) - (( monster[${currmonster}_"pos_y"]=monster[${currmonster}_"pos_y"]+monster[${currmonster}_"ystep"] )) - - # check if a monster hit the player - if (( player["invulnerable"] <= 0 )) ; then - if (( monster[${currmonster}_"pos_x"] == player["pos_x"] && \ - monster[${currmonster}_"pos_y"] == player["pos_y"] )) ; then - # if player was hit by a monster take one life and - # make him invulnerable for 10 cycles to avoid that - # the next cycle steals more lives - player["message"]="Ouuuchhhh" - player["invulnerable"]=10 - (( player["lives"]-=1 )) - - beep ; beep ; sleep 0.2 ; beep ; beep - fi - fi - done - - render_game - done - return 0 -} - -function map_filter -{ - typeset ch_player ch_monster ch_wall var - - if (( $1 == 1 )) ; then - ch_player="${vtcode["fg_yellow"]}" - ch_monster="${vtcode["fg_red"]}" - ch_wall="${vtcode["fg_blue"]}" - else - ch_player="" - ch_monster="" - ch_wall="" - fi - - if (( $2 == 1 )) ; then - # unicode map - ch_player+="$(printf '\u[24d2]')" - ch_monster+="$(printf '\u[2605]')" - ch_wall+="$(printf '\u[25a6]')" - else - # ascii map - ch_player+="@" - ch_monster+="x" - ch_wall+="#" - fi - - # note that this filter currently defeats the "double-buffering" - while IFS='' read -r -d "${end_of_frame}" var ; do - var="${var// /${vtcode["fg_grey"]} }" - var="${var//\./${vtcode["fg_lightred"]}.}" - var="${var//@/${ch_player}}" - var="${var//x/${ch_monster}}" - var="${var//#/${ch_wall}}" - - print -r -- "${var}" - done - return 0 -} - -function exit_trap -{ - # restore stty settings - stty ${saved_stty} - - print "bye." - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${gnaw_usage}" OPT '-?' - exit 2 -} - -# program start -# make sure we use the ksh93 "cat" builtin which supports the "-u" option -builtin basename -builtin cat -builtin wc - -typeset progname="${ basename "${0}" ; }" - -# terminal size rect -compound termsize=( - integer columns=-1 - integer lines=-1 -) - -# global variables -typeset quiet=false - -typeset -A levelmap -typeset -A player -typeset -A monster -# global rendering options -integer game_use_colors=0 -integer game_use_unicode=0 - -typeset -r gnaw_usage=$'+ -[-?\n@(#)\$Id: gnaw (Roland Mainz) 2009-05-09 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?gnaw - maze game written in ksh93] -[+DESCRIPTION?\bgnaw\b is a maze game. - The player maneuvers a yellow "@" sign to navigate a maze while eating - small dots. A level is finished when all the dots are eaten. Five monsters - (maw, claw, jitterbug, tentacle and grendel) also wander the maze in an attempt - to catch the "@". Each level begins with all ghosts in their home, and "@" near - the bottom of the maze. The monsters are released from the home one by one at the - start of each level and start their rentless hunt after the player.] -[q:quiet?Disable use of terminal bell.] -[+SEE ALSO?\bksh93\b(1)] -' - -while getopts -a "${progname}" "${gnaw_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - q) quiet=true ;; - +q) quiet=false ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# save stty values and register the exit trap which restores these values on exit -saved_stty="$(stty -g)" -trap exit_trap EXIT - -print "Loading..." - -# set stty values, "-icanon min 1 time 0 -inpck" should improve input latency, -# "-echo" turns the terminal echo off -stty -icanon min 1 time 0 -inpck -echo - -get_term_size termsize || fatal_error "Could not get terminal size." - -# prechecks -(( termsize.columns < 60 )) && fatal_error "Terminal width must be larger than 60 columns (currently ${termsize.columns})." - -typeset -A vtcode -# color values taken from http://frexx.de/xterm-256-notes/, other -# codes from http://vt100.net/docs/vt100-tm/ -vtcode=( - ["bg_black"]="$(print -n "\E[40m")" - ["fg_black"]="$(print -n "\E[30m")" - ["fg_red"]="$(print -n "\E[31m")" - ["fg_lightred"]="$(print -n "\E[1;31m")" - ["fg_green"]="$(print -n "\E[32m")" - ["fg_lightgreen"]="$(print -n "\E[1;32m")" - ["fg_yellow"]="$(print -n "\E[33m")" - ["fg_lightyellow"]="$(print -n "\E[1;33m")" - ["fg_blue"]="$(print -n "\E[34m")" - ["fg_lightblue"]="$(print -n "\E[1;34m")" - ["fg_grey"]="$(print -n "\E[1;37m")" - ["fg_white"]="$(print -n "\E[37m")" - - # misc other vt stuff - ["vtreset"]="$(tput reset)" - ["clear"]="$(tput clear)" - ["bel"]="$(tput bel)" - ["spaceline"]="$(for (( i=0 ; i < termsize.columns ; i++ )) ; do print -n " " ; done)" -) - -# character used to as marker that a single frame ends at this point - this -# is used by the "double buffering" code to make sure the "read" builtin -# can read a whole "frame" instead of reading stuff line-by-line -typeset -r end_of_frame=$'\t' - -# get terminal sequence to move cursor to position x,y -# (see http://vt100.net/docs/vt100-ug/chapter3.html#CPR) -case ${TERM} in - xterm | xterm-color | vt100 | vt220 | dtterm | sun | sun-color) - cup="$(infocmp -1 | \ - egrep '^[[:space:]]*cup=' | \ - sed -e 's/.*cup=//' \ - -e 's/%[%id]*p1[%id]*/%2\\\$d/g' \ - -e 's/%[%id]*p2[%id]*/%1\\\$d/g' \ - -e 's/,$//')" - for (( x=0 ; x < termsize.columns ; x++ )) ; do - for (( y=0 ; y < termsize.lines ; y++ )) ; do - vtcode[cup_${x}_${y}]="$(printf "${cup}" $((x + 1)) $((y + 1)) )" - done - done - ;; - *) - printf "# Unrecognised terminal type '%s', fetching %dx%d items from terminfo database, please wait...\n" "${TERM}" "${termsize.columns}" "${termsize.lines}" - for (( x=0 ; x < termsize.columns ; x++ )) ; do - for (( y=0 ; y < termsize.lines ; y++ )) ; do - vtcode[cup_${x}_${y}]="$(tput cup ${y} ${x})" - done - done - ;; -esac - -print -- "${vtcode["vtreset"]}" - -run_logo -run_menu - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/mandelbrotset1.sh b/usr/src/cmd/ast/libshell/common/scripts/mandelbrotset1.sh deleted file mode 100644 index 726a577850..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/mandelbrotset1.sh +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# mandelbrotset1 - a simple mandelbrot set generation and -# parallel execution demo -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function printmsg -{ - print -u2 "$*" -} - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -# Get terminal size and put values into a compound variable with the integer -# members "columns" and "lines" -function get_term_size -{ - nameref rect=$1 - - rect.columns=${ tput cols ; } || return 1 - rect.lines=${ tput lines ; } || return 1 - - return 0 -} - -function mandelbrot -{ - nameref result=$1 - float x=$2 - float y=$3 - float xx - float yy - float x1=$4 - float y1=$5 - integer iteration=$6 - integer max_iteration=$7 - float mag - - for (( mag=0 ; mag < max_mag && iteration < max_iteration ; iteration++ )) ; do - (( - xx=x*x , - yy=y*y , - mag=xx+yy , - y=x*y*2+y1 , - x=xx-yy+x1 - )) - done - - (( result=iteration )) - - return 0 -} - -# build mandelbrot image serially -function loop_serial -{ - integer value - typeset line="" - - for (( y=y_min ; y < y_max ; y+=stepwidth )) ; do - for (( x=x_min ; x < x_max ; x+=stepwidth )) ; do - mandelbrot value ${x} ${y} ${x} ${y} 1 ${symbollistlen} - line+="${symbollist:value:1}" - done - - line+=$'\n' - done - - print -r -- "${line}" - - return 0 -} - -# build mandelbrot image using parallel worker jobs -function loop_parallel -{ - integer numjobs=0 - # the following calculation suffers from rounding errors - integer lines_per_job=$(( ((m_height+(numcpus-1)) / numcpus) )) - typeset tmpjobdir - - printmsg $"# lines_per_job=${lines_per_job}" - printmsg $"# numcpus=${numcpus}" - - # "renice" worker jobs - set -o bgnice - - tmpjobdir="$(mktemp --default=/tmp --directory "mandelbrotset1${PPID}_$$_XXXXXX")" || fatal_error $"Could not create temporary directory." - trap "rm -r ${tmpjobdir}" EXIT # cleanup - - # try to generate a job identifer prefix which is unique across multiple hosts - jobident="job_host_$(uname -n)pid_$$_ppid${PPID}" - - printmsg $"## prepare..." - for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do - rm -f "${tmpjobdir}/${jobident}_child_$y.joboutput" - - (( numjobs++ )) - done - - printmsg $"## running ${numjobs} children..." - for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do - ( - integer value - typeset line="" - # save file name since we're going to modify "y" - typeset filename="${tmpjobdir}/${jobident}_child_$y.joboutput" - - for (( ; y < y_max && lines_per_job-- > 0 ; y+=stepwidth )) ; do - for (( x=x_min ; x < x_max ; x+=stepwidth )) ; do - mandelbrot value ${x} ${y} ${x} ${y} 1 ${symbollistlen} - line+="${symbollist:value:1}" - done - - line+=$'\n' - done - print -r -- "${line}" >"${filename}" - - exit 0 - ) & - done - - printmsg $"## waiting for ${numjobs} children..." - wait - - printmsg $"## output:" - for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do - print -r -- "$( < "${tmpjobdir}/${jobident}_child_$y.joboutput")" - # EXIT trap will cleanup temporary files - done - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${mandelbrotset1_usage}" OPT '-?' - exit 2 -} - -# main -builtin basename -builtin cat -builtin rm -builtin uname # loop_parallel needs the ksh93 builtin version to generate unique job file names -builtin mktemp - -set -o noglob -set -o nounset - -typeset progname="${ basename "${0}" ; }" - -float x_max -float x_min -float y_max -float y_min -float m_width -float m_height -float max_mag -float stepwidth -integer numcpus - -# terminal size rect -compound termsize=( - integer columns=-1 - integer lines=-1 -) - -get_term_size termsize || fatal_error $"Could not get terminal size." - -typeset symbollist=' .:0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%#' -typeset symbollistlen=$(( ${#symbollist} - 1)) -typeset mode="parallel" - -(( max_mag=400 )) -(( stepwidth=0.1 )) - -# calculate number of worker CPUs and use 3 as fallback -(( numcpus=$(getconf NPROCESSORS_ONLN || print "3") )) -(( numcpus=numcpus*4 )) - -(( m_width=termsize.columns-1 , m_height=termsize.lines-2 )) - -typeset -r mandelbrotset1_usage=$'+ -[-?\n@(#)\$Id: mandelbrotset1 (Roland Mainz) 2010-03-31 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?mandelbrotset1 - generate mandelbrot set fractals with ksh93] -[+DESCRIPTION?\bmandelbrotset1\b mandelbrot set fractal generator - which runs either in serial or parallel mode (using multiple worker jobs).] -[w:width?Width of fractal.]:[width] -[h:height?Height of fractal.]:[height] -[s:symbols?Symbols to build the fractal from.]:[symbolstring] -[m:mag?Magnification level.]:[magnificationlevel] -[p:stepwidth?Width per step.]:[widthperstep] -[S:serial?Run in serial mode.] -[P:parallel?Run in parallel mode.] -[M:mode?Execution mode.]:[mode] -[C:numcpus?Number of processors used for parallel execution.]:[numcpus] -[+SEE ALSO?\bjuliaset1\b(1), \bksh93\b(1)] -' - -while getopts -a "${progname}" "${mandelbrotset1_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - w) m_width="${OPTARG}" ;; - h) m_height="${OPTARG}" ;; - s) symbollist="${OPTARG}" ;; - m) max_mag="${OPTARG}" ;; - p) stepwidth="${OPTARG}" ;; - S) mode="serial" ;; - +S) mode="parallel" ;; - P) mode="parallel" ;; - +P) mode="serial" ;; - M) mode="${OPTARG}" ;; - C) numcpus="${OPTARG}" ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -printmsg "# width=${m_width}" -printmsg "# height=${m_height}" -printmsg "# max_mag=${max_mag}" -printmsg "# stepwidth=${stepwidth}" -printmsg "# symbollist='${symbollist}'" -printmsg "# mode=${mode}" - -(( symbollistlen=${#symbollist}-1 )) - -(( - x_max=m_width*stepwidth/2. , - x_min=-x_max , - y_max=m_height*stepwidth/2. , - y_min=-y_max -)) - -case "${mode}" in - parallel) loop_parallel ; exit $? ;; - serial) loop_serial ; exit $? ;; - *) fatal_error $"Unknown mode \"${mode}\"." ;; -esac - -fatal_error "not reached." -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/multifollow.sh b/usr/src/cmd/ast/libshell/common/scripts/multifollow.sh deleted file mode 100644 index c3d6e3740d..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/multifollow.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u 2 "${progname}: $@" - exit 1 -} - - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${multifollow_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat - -typeset progname="$(basename "${0}")" - -typeset -r multifollow_usage=$'+ -[-?\n@(#)\$Id: multifollow (Roland Mainz) 2009-04-08 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?multifollow - use tail -f on multiple files] -[+DESCRIPTION?\bmultifollow\b is a small utilty which can "follow" multiple - files similar to tail -f.] - -[ file ... ] - -[+SEE ALSO?\bksh93\b(1), \btail\b(1)] -' - -while getopts -a "${progname}" "${multifollow_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# expecting at least one more arguments -(($# >= 1)) || usage - -builtin -f libshell.so.1 poll || fatal_error "poll builtin not found." - -typeset -a files -integer numfiles=0 -integer i - -# register trap to cleanup child processes -trap 'for ((i=0 ; i < numfiles ; i++ )) ; do kill -TERM ${files[i].childpid} ; done' EXIT - -# setup "tail -f" childs, FIFOs and information for the "poll" builtin -for (( ; $# > 0 ; numfiles++ )) ; do - typeset files[${numfiles}]=( - typeset name="$1" - typeset pipename="/tmp/multifollow_pipe_${PPID}_$$_${numfiles}" - integer childpid=-1 - - # poll(1) information - integer fd="-1" - typeset events="POLLIN" - typeset revents="" - ) - - mkfifo "${files[${numfiles}].pipename}" - redirect {files[numfiles].fd}<> "${files[numfiles].pipename}" - - tail -f "${files[${numfiles}].name}" >"${files[${numfiles}].pipename}" & - files[${numfiles}].childpid=$! - - rm "${files[${numfiles}].pipename}" - - shift -done - -typeset do_poll=true - -# event loop -while true ; do - if ${do_poll} ; then - for ((i=0 ; i < numfiles ; i++ )) ; do - files[i].revents="" - done - poll files - fi - do_poll=true - - for ((i=0 ; i < numfiles ; i++ )) ; do - if [[ "${files[i].revents}" != "" ]] ; then - # todo: investigate why we have to use "do_poll" at all - AFAIK it - # should be sufficient to call "poll" and get "revents" set if there - # are any remaining data... - if read -t0 -u${files[i].fd} line ; then - print -- "#${i}: ${line}" - do_poll=false - fi - fi - done -done - -fatal_error "not reached." -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/numtree1.sh b/usr/src/cmd/ast/libshell/common/scripts/numtree1.sh deleted file mode 100644 index e736bc61b9..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/numtree1.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# numtree1 - basic compound variable tree demo+benchmark -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function add_number_to_tree -{ - typeset treename=$1 - integer num=$2 - integer i - typeset nodepath # full name of compound variable - integer -a pe # path elements - integer len - typeset revnums="$(rev <<<"${num}")" - - # first built an array containing the names of each path element - # (e.g. "135" results in an array containing "( 1 3 5 )") - # 10#<number> is used to prevent leading zeros being interpreted - # as octals - for (( len=${#revnums} , i=$( printf "10#%s\n" "${revnums}" ) ; len > 0 ; len--, i=i/10 )) ; do - pe+=( $((i % 10)) ) - done - - # walk path described via the "pe" array and build nodes if - # there aren't any nodes yet - nodepath="${treename}" - for (( i=0 ; i < ${#pe[@]} ; i++ )) ; do - nameref x="${nodepath}" - - # [[ -v ]] does not work for arrays because [[ -v ar ]] - # is equal to [[ -v ar[0] ]]. In this case we can - # use the output of typeset +p x.nodes - [[ "${ typeset +p x.nodes ;}" == "" ]] && compound -a x.nodes - - nodepath+=".nodes[${pe[i]}]" - done - - # insert element (leaf) - nameref node="${nodepath}" - [[ "${ typeset +p node.elements ;}" == "" ]] && integer -a node.elements - node.elements+=( ${num} ) - - # DEBUG only - [[ "${!node.elements[*]}" != "" ]] || fatal_error "assertion $LINENO FAILED" - [[ "${ typeset +p node.elements ;}" == *-a* ]] || fatal_error "assertion $LINENO FAILED" - [[ "${ typeset +p node.elements ;}" == *-i* ]] || fatal_error "assertion $LINENO FAILED" - [[ -v node ]] || fatal_error "assertion $LINENO FAILED" - [[ -R node ]] || fatal_error "assertion $LINENO FAILED" - [[ "${ typeset +p ${!node} ;}" == *-C* ]] || fatal_error "assertion $LINENO FAILED" - [[ "${!x.nodes[*]}" != "" ]] || fatal_error "assertion $LINENO FAILED" - [[ "${ typeset +p x.nodes ;}" == *-a* ]] || fatal_error "assertion $LINENO FAILED" - [[ "${ typeset +p x.nodes ;}" == *-C* ]] || fatal_error "assertion $LINENO FAILED" - - return 0 -} - - -# floating-point version of "seq" -function floatseq -{ - float i - float arg1=$1 - float arg2=$2 - float arg3=$3 - - case $# in - 1) - for (( i=1. ; i <= arg1 ; i=i+1. )) ; do - printf "%a\n" i - done - ;; - 2) - for (( i=arg1 ; i <= arg2 ; i=i+1. )) ; do - printf "%a\n" i - done - ;; - 3) - for (( i=arg1 ; i <= arg3 ; i+=arg2 )) ; do - printf "%a\n" i - done - ;; - *) - print -u2 -f "%s: Illegal number of arguments %d\n" "$0" $# - return 1 - ;; - esac - - return 0 -} - - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${numtree1_usage}" OPT '-?' - exit 2 -} - -# main -builtin basename -builtin rev - -set -o noglob -set -o errexit -set -o nounset - -compound base - -compound bench=( - float start - float stop -) - -integer i - -typeset progname="${ basename "${0}" ; }" - -typeset -r numtree1_usage=$'+ -[-?\n@(#)\$Id: numtree1 (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?numtree1 - generate sorted variable tree containing numbers] -[+DESCRIPTION?\bnumtree1\b is a simple variable tree generator - sorts a given set of numbers into a ksh compound variable tree). - the application supports two different modes: \'seq\' takes - 1-3 arguments to specify the set of numbers via seq(1) and - \'stdin\' reads the numbers from stdin (one per line)] - -method [ arguments ] - -[+SEE ALSO?\bksh93\b(1), \bseq\b(1)] -' - -while getopts -a "${progname}" "${numtree1_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# prechecks -(( $# > 0 )) || usage - -cmd=$1 -shift - -# Read numbers from stdin outside benchmark loop -if [[ ${cmd} == 'stdin' ]] ; then - stdin_numbers="$( cat /dev/stdin )" || fatal_error "stdin read error" -fi - -(( bench.start=SECONDS )) - -case ${cmd} in - "seq") - for i in ${ floatseq "$@" ; } ; do - add_number_to_tree base "${i}" - done - ;; - "stdin") - for i in ${stdin_numbers} ; do - add_number_to_tree base "${i}" - done - ;; - "demo1") - for i in 1 32 33 34 34 38 90 ; do - add_number_to_tree base "${i}" - done - ;; - "demo2") - for (( i=1000000000 ; i < 1000000000+10 ; i++ )) ; do - add_number_to_tree base "$i" - done - ;; - *) - fatal_error "Invalid command ${cmd}." - ;; -esac - -(( bench.stop=SECONDS )) - -print -u2 -f "# time used: %f\n" $((bench.stop - bench.start)) - -# print tree -print -v base - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/primenumbers1.sh b/usr/src/cmd/ast/libshell/common/scripts/primenumbers1.sh deleted file mode 100644 index abb00a9ade..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/primenumbers1.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# primenumbers1 - a simple prime number generator -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - - -# check whether arg1 is a prime number via comparing it against the "pn" array -function is_prime -{ - integer i - integer num=$1 - float max_pn - - (( max_pn=sqrt(num)+1. )) - - for (( i=0 ; i < num_pn && pn[i] < max_pn ; i++)) ; do - (( num % pn[i] == 0 )) && return 1; - done - return 0 -} - -# main -set -o errexit - -# get arguments -integer max_prime=$1 # maximum prime number -typeset outputformat=$2 - -# variables -integer -a pn # integer array for the prime numbers -integer num_pn=1 # number of prime numbers -integer n # current number which should be tested -pn[0]=2 # start value - -# prechecks -(( max_prime > 1 )) || { print -u2 -f "%s: requires a positive integer as first input.\n" "$0" ; exit 1 ; } - -# calculate prime numbers -printf $"# %s: Calculating prime numbes from 1 to %i\n" "${ date '+%T' ; }" max_prime 1>&2 - -for (( n=3 ; n < max_prime ; n+=2 )) ; do - if is_prime $n ; then - (( pn[num_pn++]=n )) - fi -done - -# print results -printf $"# %s: Calculation done, printing results:\n" "${ date '+%T' ; }" 1>&2 - -for (( n=0 ; n < num_pn ; n++ )) ; do - # print prime number - case ${outputformat} in - block) - printf $"%i$( (( n % 8 == 0 )) && print -r '\n' || print -r ',\t')" pn[n] - ;; - line) - printf $"%i\n" pn[n] - ;; - *) - printf $"prime %i:\t%i\n" n pn[n] - ;; - esac -done - -if [[ ${outputformat} == "block" ]] && (( n % 8 != 1 )); then - print -fi - -printf $"# %s: Done.\n" "${ date '+%T' ; }" 1>&2 - -#EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/rssread.sh b/usr/src/cmd/ast/libshell/common/scripts/rssread.sh deleted file mode 100644 index 97d391de98..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/rssread.sh +++ /dev/null @@ -1,674 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# rssread - a simple RSS2.0 reader with RSS to XHTML to -# plaintext conversion. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -function printmsg -{ - print -u2 "$*" -} - -function debugmsg -{ -# printmsg "$*" -true -} - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -typeset -T urlconnection_t=( - # public - typeset user_agent="ksh93/urlconnection_t" - - # private variables - typeset protocol - typeset path1 - typeset host - typeset path - typeset port - - compound netfd=( - integer in=-1 # incoming traffic - integer out=-1 # outgoing traffic - ) - - # only used for https - compound ssl=( - compound fifo=( - typeset dir="" - typeset in="" - typeset out="" - ) - integer openssl_client_pid=-1 - ) - - # parse HTTP return code, cookies etc. - function parse_http_response - { - nameref response="$1" - typeset h statuscode statusmsg i - - # we use '\r' as additional IFS to filter the final '\r' - IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> - [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } - [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } - response.statuscode="$statuscode" - response.statusmsg="$statusmsg" - - # skip remaining headers - while IFS='' read -r i ; do - [[ "$i" == $'\r' ]] && break - - # strip '\r' at the end - i="${i/~(Er)$'\r'/}" - - case "$i" in - ~(Eli)Content-Type:.*) - response.content_type="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Content-Length:[[:blank:]]*[0-9]*) - integer response.content_length="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Transfer-Encoding:.*) - response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" - ;; - esac - done - - return 0 - } - - function cat_http_body - { - typeset emode="$1" - typeset hexchunksize="0" - integer chunksize=0 - - if [[ "${emode}" == "chunked" ]] ; then - while IFS=$'\n' read hexchunksize ; do - hexchunksize="${hexchunksize//$'\r'/}" - [[ "${hexchunksize}" != "" ]] || continue - [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]+ ]] || break - (( chunksize=$( printf "16#%s\n" "${hexchunksize}" ) )) - (( chunksize > 0 )) || break - dd bs=1 count="${chunksize}" 2>/dev/null - done - else - cat - fi - - return 0 - } - - function init_url - { - _.protocol="${1%://*}" - _.path1="${1#*://}" # "http://foo.bat.net/x/y.html" ----> "foo.bat.net/x/y.html" - - if [[ "${_.protocol}" == ~(Elr)http(|s) ]] ; then - _.host="${_.path1%%/*}" - _.path="${_.path1#*/}" - _.port="${_.host##*:}" - fi - - return 0 - } - - # close connection - function close_connection - { - integer ret - - if (( _.netfd.in != -1 )) ; then - redirect {_.netfd.in}<&- - (( _.netfd.in=-1 )) - fi - - if (( _.netfd.in != _.netfd.out && _.netfd.out != -1 )) ; then - redirect {_.netfd.out}<&- - (( _.netfd.out=-1 )) - fi - - if [[ "${_.protocol}" == "https" ]] ; then - wait ${_.ssl.openssl_client_pid} || { print -u2 -f "%s: openssl failed.\n" ; return 1 ; } - (( _.ssl.openssl_client_pid=-1 )) - - rm -r \"${_.ssl.fifo.dir}\" - _.ssl.fifo.dir="" - fi - - return 0 - } - - function open_connection - { - if [[ "${_.protocol}" == "https" ]] ; then - _.ssl.fifo.dir="$(mktemp -t -d)" - _.ssl.fifo.in="${_.ssl.fifo.dir}/in" - _.ssl.fifo.out="${_.ssl.fifo.dir}/out" - - # Use "errexit" to leave it at the first error - # (this saves lots of if/fi tests for error checking) - set -o errexit - - mkfifo "${_.ssl.fifo.in}" "${_.ssl.fifo.out}" - - # create async openssl child to handle https - openssl s_client -quiet -connect "${_.host}:${_.port}" <"${_.ssl.fifo.in}" >>"${_.ssl.fifo.out}" & - - _.ssl.openssl_client_pid=$! - else - redirect {_.netfd.in}<> "/dev/tcp/${_.host}/${_.port}" - (( $? != 0 )) && { print -u2 -f "%s: Could not open %s\n" "$0" "${1}" ; return 1 ; } - (( _.netfd.out=_.netfd.in )) - fi - return 0 - } - - function send_request - { - typeset request="$1" - - set -o errexit - - if [[ "${_.protocol}" == "https" ]] ; then - print -n -- "${request}\r\n" >> "${_.ssl.fifo.in}" - - redirect {_.netfd.in}< "${_.ssl.fifo.out}" - else - print -n -- "${request}\r\n" >&${_.netfd.out} - fi - return 0 - } - - function cat_url - { - if [[ "${_.protocol}" == "file" ]] ; then - cat "${_.path1}" - return $? - elif [[ "${_.protocol}" == ~(Elr)http(|s) ]] ; then - compound httpresponse # http response - - # If URL did not contain a port number in the host part then look at the - # protocol to get the port number - if [[ "${_.port}" == "${_.host}" ]] ; then - case "${_.protocol}" in - "http") _.port=80 ;; - "https") _.port=443 ;; - *) _.port="$(getent services "${_.protocol}" | sed 's/[^0-9]*//;s/\/.*//')" ;; - esac - else - _.host="${_.host%:*}" - fi - - printmsg "protocol=${_.protocol} port=${_.port} host=${_.host} path=${_.path}" - - # prechecks - [[ "${_.protocol}" != "" ]] || { print -u2 -f "%s: protocol not set.\n" "$0" ; return 1 ; } - [[ "${_.port}" != "" ]] || { print -u2 -f "%s: port not set.\n" "$0" ; return 1 ; } - [[ "${_.host}" != "" ]] || { print -u2 -f "%s: host not set.\n" "$0" ; return 1 ; } - [[ "${_.path}" != "" ]] || { print -u2 -f "%s: path not set.\n" "$0" ; return 1 ; } - - _.open_connection || return 1 - - # send HTTP request - request="GET /${_.path} HTTP/1.1\r\n" - request+="Host: ${_.host}\r\n" - request+="User-Agent: ${_.user_agent}\r\n" - request+="Connection: close\r\n" - _.send_request "${request}\r\n" - - # collect response and send it to stdout - { - _.parse_http_response httpresponse - _.cat_http_body "${httpresponse.transfer_encoding}" - } <&${_.netfd.in} - - _.close_connection - - return 0 - else - return 1 - fi - # notreached - } -) - -function html_entity_to_ascii -{ - typeset buf - typeset entity - typeset c - typeset value - - # Todo: Add more HTML/MathML entities here - # Note we use a static variable (typeset -S) here to make sure we - # don't loose the cache data between calls - typeset -S -A entity_cache=( - # entity to ascii (fixme: add UTF-8 transliterations) - ["nbsp"]=' ' - ["lt"]='<' - ["le"]='<=' - ["gt"]='>' - ["ge"]='>=' - ["amp"]='&' - ["quot"]='"' - ["apos"]="'" - ) - - buf="" - while IFS='' read -r -N 1 c ; do - if [[ "$c" != "&" ]] ; then - print -n -r -- "${c}" - continue - fi - - entity="" - while IFS='' read -r -N 1 c ; do - case "$c" in - ";") - break - ;; - ~(Eilr)[a-z0-9#]) - entity+="$c" - continue - ;; - *) -# debugmsg "error &${entity}${c}#" - - print -n -r -- "${entity}${c}" - entity="" - continue 2 - ;; - esac - done - - value="" - if [[ "${entity_cache["${entity}"]}" != "" ]] ; then -# debugmsg "match #${entity}# = #${entity_cache["${entity}"]}#" - value="${entity_cache["${entity}"]}" - else - if [[ "${entity:0:1}" == "#" ]] ; then - # decimal literal - value="${ printf "\u[${ printf "%x" "${entity:1:8}" ; }]" ; }" - elif [[ "${entity:0:7}" == ~(Eilr)[0-9a-f]* ]] ; then - # hexadecimal literal - value="${ printf "\u[${entity:0:7}]" ; }" - else - # unknown literal - pass-through - value="ENT=|${entity}|" - fi - - entity_cache["${entity}"]="${value}" - -# debugmsg "lookup #${entity}# = #${entity_cache["${entity}"]}#" - fi - - printf "%s" "${value}" - done - - return 0 -} - -# dumb xhtml handler - no CSS, tables, images, iframes or nested -# structures are supported (and we assume that the input is correct -# xhtml). The code was written in a trial&&error manner and should be -# rewritten to parse xhtml correctly. -function handle_html -{ - # we can't use global variables here when multiple callbacks use the same - # callback function - but we can use the callback associative array for - # variable storage instead - nameref callbacks=${1} - typeset tag_type="$2" - typeset tag_value="$3" - - case "${tag_type}" in - tag_begin) - case "${tag_value}" in - br) printf "\n" ;; - hr) printf "\n-------------------------------------\n" ;; - pre) callbacks["html_pre"]='true' ;; - p) printf "\n" ;; - esac - ;; - - tag_end) - case "${tag_value}" in - pre) callbacks["html_pre"]='false' ;; - esac - ;; - - tag_text) - if ${callbacks["html_pre"]} ; then - printf "%s" "${tag_value}" - else - # compress spaces/newlines/tabs/etc. - printf "%s" "${tag_value//+([\n\r\t\v[:space:][:blank:]])/ }" - fi - ;; - - document_start) - callbacks["html_pre"]='false' - ;; - document_end) ;; - esac - - return 0 -} - -function handle_rss -{ - # we can't use global variables here when multiple callbacks use the same - # callback function - but we can use the callback associative array for - # variable storage instead - nameref callbacks=${1} - typeset tag_type="$2" - typeset tag_value="$3" - - case "${tag_type}" in - tag_begin) - case "${tag_value}" in - item) - item["title"]="" - item["link"]="" - item["tag"]="" - item["description"]="" - ;; - esac - callbacks["textbuf"]="" - ;; - tag_end) - case "${tag_value}" in - item) - # note that each RSS item needs to be converted seperately from RSS to HTML to plain text - # to make sure that the state of one RSS item doesn't affect others - ( - printf $"<br />#### RSS item: title: %s ####" "${item["title"]}" - printf $"<br />## author: %s" "${item["author"]}" - printf $"<br />## link: %s" "${item["link"]}" - printf $"<br />## date: %s" "${item["pubDate"]}" - printf $"<br />## begin description:" - printf $"<br />%s<br />" "${item["description"]}" - printf $"<br />## end description<br />" - print # extra newline to make sure the sed pipeline gets flushed - ) | - html_entity_to_ascii | # convert XML entities (e.g. decode RSS content to HTML code) - xml_tok "xhtmltok_cb" | # convert HTML to plain text - html_entity_to_ascii # convert HTML entities - ;; - title) item["title"]="${callbacks["textbuf"]}" ; callbacks["textbuf"]="" ;; - link) item["link"]="${callbacks["textbuf"]}" ; callbacks["textbuf"]="" ;; - dc:creator | author) item["author"]="${callbacks["textbuf"]}" ; callbacks["textbuf"]="" ;; - dc:date | pubDate) item["pubDate"]="${callbacks["textbuf"]}" ; callbacks["textbuf"]="" ;; - description) item["description"]="${callbacks["textbuf"]}" ; callbacks["textbuf"]="" ;; - esac - callbacks["textbuf"]="" - ;; - tag_text) - callbacks["textbuf"]+="${tag_value}" - ;; - document_start) ;; - document_end) ;; - esac - return 0 -} - -function xml_tok -{ - typeset buf="" - typeset namebuf="" - typeset attrbuf="" - typeset c="" - typeset isendtag # bool: true/false - typeset issingletag # bool: true/false (used for tags like "<br />") - nameref callbacks=${1} - - [[ ! -z "${callbacks["document_start"]}" ]] && ${callbacks["document_start"]} "${1}" "document_start" - - while IFS='' read -r -N 1 c ; do - isendtag=false - - if [[ "$c" == "<" ]] ; then - # flush any text content - if [[ "$buf" != "" ]] ; then - [[ ! -z "${callbacks["tag_text"]}" ]] && ${callbacks["tag_text"]} "${1}" "tag_text" "$buf" - buf="" - fi - - IFS='' read -r -N 1 c - if [[ "$c" == "/" ]] ; then - isendtag=true - else - buf="$c" - fi - IFS='' read -r -d '>' c - buf+="$c" - - # handle comments - if [[ "$buf" == ~(El)!-- ]] ; then - # did we read the comment completely ? - if [[ "$buf" != ~(Elr)!--.*-- ]] ; then - buf+=">" - while [[ "$buf" != ~(Elr)!--.*-- ]] ; do - IFS='' read -r -N 1 c || break - buf+="$c" - done - fi - - [[ ! -z "${callbacks["tag_comment"]}" ]] && ${callbacks["tag_comment"]} "${1}" "tag_comment" "${buf:3:${#buf}-5}" - buf="" - continue - fi - - # check if the tag starts and ends at the same time (like "<br />") - if [[ "${buf}" == ~(Er).*/ ]] ; then - issingletag=true - buf="${buf%*/}" - else - issingletag=false - fi - - # check if the tag has attributes (e.g. space after name) - if [[ "$buf" == ~(E)[[:space:][:blank:]] ]] ; then - namebuf="${buf%%~(E)[[:space:][:blank:]].*}" - attrbuf="${buf#~(E).*[[:space:][:blank:]]}" - else - namebuf="$buf" - attrbuf="" - fi - - if ${isendtag} ; then - [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" - else - [[ ! -z "${callbacks["tag_begin"]}" ]] && ${callbacks["tag_begin"]} "${1}" "tag_begin" "$namebuf" "$attrbuf" - - # handle tags like <br/> (which are start- and end-tag in one piece) - if ${issingletag} ; then - [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" - fi - fi - buf="" - else - buf+="$c" - fi - done - - [[ ! -z "${callbacks["document_end"]}" ]] && ${callbacks["document_end"]} "${1}" "document_end" "exit_success" - - print # final newline to make filters like "sed" happy -} - -# return the value of LC_MESSAGES needed for subprocesses which -# want to run in a different locale/encoding -function get_lc_messages -{ - [[ "${LC_ALL}" != "" ]] && { print "${LC_ALL}" ; return 0 ; } - [[ "${LC_MESSAGES}" != "" ]] && { print "${LC_MESSAGES}" ; return 0 ; } - [[ "${LANG}" != "" ]] && { print "${LANG}" ; return 0 ; } - print "C" ; return 0 -} - -function do_rssread -{ - # set unicode locale since RSS is encoded in UTF-8 - # (and make sure $LC_MESSAGES is set to the parent - # process's locale that all error messages are using - # the callers locale/encoding) - export \ - LC_MESSAGES="${ get_lc_messages ; }" \ - LC_MONETARY="en_US.UTF-8" \ - LC_NUMERIC="en_US.UTF-8" \ - LC_COLLATE="en_US.UTF-8" \ - LC_CTYPE="en_US.UTF-8" \ - LC_TIME="en_US.UTF-8" \ - LANG="en_US.UTF-8" - - # return non-zero exit code for this function if the rss processing below fails - set -o errexit - - urlconnection_t hc - hc.user_agent="rssread/ksh93(ssl) (2010-03-27; $(uname -s -r -p))" - hc.init_url "$1" - - # need extra newline after cat_url to terminate line with $'\n' - # to make "xml_tok" happy - data="${ hc.cat_url ; print ; }" - - print -u2 -f "# Got %d lines of RSS data, processing...\n" "${ wc -l <<< "${data}" ; }" - - xml_tok "rsstok_cb" <<< "${data}" - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${rssread_usage}" OPT '-?' - exit 2 -} - -# make sure we use the ksh93 builtin versions -builtin basename -builtin cat -builtin mkfifo - -typeset -A rsstok_cb # callbacks for xml_tok -rsstok_cb["tag_begin"]="handle_rss" -rsstok_cb["tag_end"]="handle_rss" -rsstok_cb["tag_text"]="handle_rss" -rsstok_cb["textbuf"]="" - -typeset -A xhtmltok_cb # callbacks for xml_tok -xhtmltok_cb["tag_begin"]="handle_html" -xhtmltok_cb["tag_end"]="handle_html" -xhtmltok_cb["tag_text"]="handle_html" -xhtmltok_cb["textbuf"]="" -xhtmltok_cb["html_pre"]='false' - -typeset -A item - -typeset -A bookmark_urls - -# "ramdom" urls for testing -bookmark_urls=( - ["google_blogs_ksh"]="http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&q=(%22ksh93%22%7C%22ksh+93%22+%7C+%22korn93%22+%7C+%22korn+93%22)&ie=utf-8&num=100&output=rss" - # some Sun staff/sites - ["blogs_sun_com"]="http://blogs.sun.com/main/feed/entries/rss" - ["bigadmin"]="http://www.sun.com/bigadmin/content/rss/motd.xml" - ["bigadmin_scripts"]="https://www.sun.com/bigadmin/content/rss/scripts.xml" - ["jmcp"]="http://www.jmcp.homeunix.com/roller/jmcp/feed/entries/rss" - ["katakai"]="http://blogs.sun.com/katakai/feed/entries/rss" - ["alanc"]="http://blogs.sun.com/alanc/feed/entries/rss" - ["planetsun"]="http://www.planetsun.org/rss20.xml" - ["planetsolaris"]="http://www.planetsolaris.org/rss20.xml" - ["planetopensolaris"]="http://planet.opensolaris.org/rss20.xml" - ["theregister_uk"]="http://www.theregister.co.uk/headlines.rss" - ["heise"]="http://www.heise.de/newsticker/heise.rdf" - ["slashdot"]="http://rss.slashdot.org/Slashdot/slashdot" - ["wikipedia_command_shells"]="http://en.wikipedia.org/w/index.php?title=Comparison_of_command_shells&feed=rss&action=history" -) - -typeset progname="${ basename "${0}" ; }" - -typeset -r rssread_usage=$'+ -[-?\n@(#)\$Id: rssread (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?rssread - fetch RSS messages and convert them to plain text] -[+DESCRIPTION?\brssread\b RSS to plain text converter - which fetches RSS streams via HTTP and converts them from - RSS to HTML to plain text in the current locale/encoding.] -[I:noiconv?Do not convert data from UTF-8 to current locale/encoding.] - -[ url ] - -[+SEE ALSO?\bksh93\b(1), \bshnote\b(1)] -' - -typeset noiconv=false - -while getopts -a "${progname}" "${rssread_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - I) noiconv=true ;; - +I) noiconv=false ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -typeset url="$1" - -if [[ "${url}" == "" ]] ; then - fatal_error $"No url given." -fi - -if [[ "${bookmark_urls[${url}]}" != "" ]] ; then - printmsg $"Using bookmark ${url} = ${bookmark_urls[${url}]}" - url="${bookmark_urls[${url}]}" -fi - -if ${noiconv} ; then - do_rssread "${url}" -else - do_rssread "${url}" | iconv -f "UTF-8" - - -fi - -exit 0 -#EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shcalc.sh b/usr/src/cmd/ast/libshell/common/scripts/shcalc.sh deleted file mode 100644 index 6858ba12a1..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shcalc.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# shcalc - small shell-based calculator -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function do_calculate -{ - typeset calcline="$1" - float x=0.0 - - printf "(( x=( %s ) ))\n" "${calcline}" | source /dev/stdin - if (( $? != 0 )) ; then - print -f $"%s: Syntax error in %s\n" "${progname}" "${calcline}" - return 1 - fi - - printf "%s == %.40g\n" "${calcline}" x - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${shcalc_usage}" OPT '-?' - exit 2 -} - -# program start -# (be carefull with builtins here - they are unconditionally available -# in the shell's "restricted" mode) -builtin basename -builtin sum - -typeset progname="${ basename "${0}" ; }" - -typeset -r shcalc_usage=$'+ -[-?\n@(#)\$Id: shcalc (Roland Mainz) 2008-11-03 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shcalc - simple shell calculator] -[+DESCRIPTION?\bsshcalc\b is a small calculator application which - prints the results of ISO C99 math expressions read from either - arguments or stdin if no arguments are given.] -[+SEE ALSO?\bksh93\b(1),\bceil\b(3M), \bcopysign\b(3M), \bcos\b(3M), - \bcosh\b(3M), \berf\b(3M), \berfc\b(3M), \bexp\b(3M), - \bexp2\b(3M), \bexpm1\b(3M), \bfabs abs\b(3M), \bfdim\b(3M), - \bfinite\b(3M), \bfloor int\b(3M), \bfma\b(3M), \bfmax\b(3M), \bfmin\b(3M), - \bfmod\b(3M), \bfpclassify\b(3M), \bhypot\b(3M), \bilogb\b(3M), - \bisfinite\b(3M), \bisgreater\b(3M), \bisgreaterequal\b(3M), \bisinf\b(3M), - \bisless\b(3M), \bislessequal\b(3M), \bislessgreater\b(3M), \bisnan\b(3M), - \bisnormal\b(3M), \bissubnormal\b(3M), \bisunordered\b(3M), \biszero\b(3M), - \blgamma\b(3M), \blog\b(3M), \blog1p\b(3M), \blog2\b(3M), - \blogb\b(3M), \bnearbyint\b(3M), \bnextafter\b(3M), \bnexttoward\b(3M), - \bpow\b(3M), \bremainder\b(3M), \brint\b(3M), \bround\b(3M), - \bscalb\b(3M), \bscalbn\b(3M), \bsignbit\b(3M), \bsin\b(3M), - \bsinh\b(3M), \bsqrt\b(3M), \btan\b(3M), \btanh\b(3M), - \btgamma\b(3M), \btrunc\b(3M)] -' -while getopts -a "${progname}" "${shcalc_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -integer res - -if (( $# == 0 )) ; then - # No arguments ? Switch to interactive mode... - - # make sure "read" below uses "gmacs"-like editor keys and "multiline" mode - - set -o gmacs - set -o multiline - - while read "calcline?calc> " ; do - # quit ? - [[ "${calcline}" == ~(Elri)(exit|quit|eof) ]] && break - - # empty line ? - [[ "${calcline}" == ~(Elri)([[:space:]]*) ]] && continue - - do_calculate "$calcline" - (( res=$? )) - done - - exit ${res} -else - while (( $# > 0 )) ; do - do_calculate "$1" - (( res=$? )) - shift - done - - exit ${res} -fi - -# not reached - -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shircbot.sh b/usr/src/cmd/ast/libshell/common/scripts/shircbot.sh deleted file mode 100644 index 7d415d2505..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shircbot.sh +++ /dev/null @@ -1,428 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# shircbot - a simple IRC client/bot demo -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -# Definition for a IRC session class -typeset -T ircsession_t=( - compound server=( - typeset name - integer port - ) - - typeset nick="ksh93irc" - - typeset running=true - - integer fd=-1 - - function createsession - { - set -o xtrace - - _.server.name=$1 - _.server.port=$2 - _.nick=$3 - - redirect {_.fd}<> "/dev/tcp/${_.server.name}/${_.server.port}" - (( $? == 0 )) || { print -n2 $"Could not open server connection." ; return 1 ; } - - printf "fd=%d\n" _.fd - - return 0 - } - - function login - { - { - printf "USER %s %s %s %s\n" "${_.nick}" "${_.nick}" "${_.nick}" "${_.nick}" - printf "NICK %s\n" "${_.nick}" - } >&${_.fd} - - return 0 - } - - function join_channel - { - printf "JOIN %s\n" "$1" >&${_.fd} - - return 0 - } - - function mainloop - { - typeset line - float -S last_tick=0 - # We use the linebuf_t class here since network traffic - # isn't guranteed to fit a single $'\n'-terminated line - # into one TCP package. linebuf_t buffers characters - # until it has one complete line. This avoids the need for - # async I/O normally used by IRC clients - linebuf_t serverbuf - linebuf_t clientbuf - integer fd=${_.fd} - - _.login - - while ${_.running} ; do - while serverbuf.readbuf line <&${fd} ; do - _.dispatch_serverevent "$line" - done - - while clientbuf.readbuf line </dev/stdin ; do - printf "client: %q\n" "${line}" - printf "%s\n" "${line}" >&${fd} - done - - # call mainloop_tick function in intervals to handle - # async events (e.g. automatic /join etc.) - if (( (SECONDS-last_tick) > 5. )) ; then - (( last_tick=SECONDS )) - _.mainloop_tick - fi - done - - return 0 - } - - function mainloop_tick - { - return 0 - } - - function dispatch_serverevent - { - typeset line="$1" - - case "${line}" in - ~(El)PING) - compound ping_args=( - line="$line" - ) - _.serverevent_ping "ping_args" - ;; - ~(El):.*\ PRIVMSG) - compound privmsg_args=( - typeset line="$line" - typeset msguser="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\1}" - typeset msgchannel="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\3}" - typeset msg="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\4}" - ) - _.serverevent_privmsg "privmsg_args" - ;; - ~(El):.*\ INVITE) - compound invite_args=( - typeset line="$line" - typeset inviteuser="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\1}" - typeset invitenick="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\3}" - typeset invitechannel="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\4}" - ) - _.serverevent_invite "invite_args" - ;; - *) - printf "server: %q\n" "${line}" - ;; - esac - - return 0 - } - - function serverevent_privmsg - { - nameref args=$1 - typeset msguser="${args.msguser}" - typeset msgchannel="${args.msgchannel}" - typeset msg="${args.msg}" - - printf "#privms: user=%q, channel=%q, msg=%q\n" "$msguser" "$msgchannel" "$msg" - - return 0 - } - - function serverevent_invite - { - nameref args=$1 - - printf "JOIN %s\n" "${args.invitechannel/:/}" >&${_.fd} - - return 0 - } - - function send_privmsg - { - typeset channel="$1" - typeset msg="$2" - - # Do we have to escape any characters in "msg" ? - printf "PRIVMSG %s :%s\n" "${channel}" "${msg}" >&${_.fd} - - return 0 - } - - function serverevent_ping - { - nameref args=$1 - - printf "PONG %s\n" "${args.line/~(Elr)([^ ]+) ([^ ]+).*/\2}" >&${_.fd} - - return 0 - } -) - -# line buffer class -# The buffer class tries to read characters from the given <fd> until -# it has read a whole line. -typeset -T linebuf_t=( - typeset buf - - function reset - { - _.buf="" - return 0 - } - - function readbuf - { - nameref var=$1 - typeset ch - - while IFS='' read -t 0.2 -N 1 ch ; do - [[ "$ch" == $'\r' ]] && continue - - if [[ "$ch" == $'\n' ]] ; then - var="${_.buf}" - _.reset - return 0 - fi - - _.buf+="$ch" - done - - return 1 - } -) - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${shircbot_usage}" OPT '-?' - exit 2 -} - -# program start -# (be carefull with builtins here - they are unconditionally available -# in the shell's "restricted" mode) -builtin basename -builtin sum - -typeset progname="${ basename "${0}" ; }" - -typeset -r shircbot_usage=$'+ -[-?\n@(#)\$Id: shircbot (Roland Mainz) 2009-09-09 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shircbot - simple IRC bot demo] -[+DESCRIPTION?\bshircbot\b is a small demo IRC bot which provides - a simple IRC bot with several subcommands.] -[n:nickname?IRC nickname for this bot.]:[nick] -[s:ircserver?IRC servername.]:[servername] -[j:joinchannel?IRC servername.]:[channelname] -[+SEE ALSO?\bksh93\b(1)] -' - -compound config=( - typeset nickname="${LOGNAME}bot" - typeset servername="irc.freenode.net" - integer port=6667 - typeset -a join_channels -) - -while getopts -a "${progname}" "${shircbot_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - n) config.nickname="${OPTARG}" ;; - s) config.servername="${OPTARG}" ;; - j) config.join_channels+=( "${OPTARG}" ) ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# if no channel was provided we join a predefined set of channels -if (( ${#config.join_channels[@]} == 0 )) ; then - if [[ "${config.servername}" == "irc.freenode.net" ]] ; then - config.join_channels+=( "#opensolaris" ) - config.join_channels+=( "#opensolaris-dev" ) - config.join_channels+=( "#opensolaris-arc" ) - config.join_channels+=( "#opensolaris-meeting" ) - config.join_channels+=( "#ospkg" ) - config.join_channels+=( "#ksh" ) - elif [[ "${config.servername}" == ~(E)irc.(sfbay|sweden) ]] ; then - config.join_channels+=( "#onnv" ) - fi -fi - -print "## Start." - -ircsession_t mybot - -# override ircsession_t::serverevent_privmsg with a new method for our bot -function mybot.serverevent_privmsg -{ - nameref args=$1 - typeset msguser="${args.msguser}" - typeset msgchannel="${args.msgchannel}" - typeset msg="${args.msg}" - - printf "#message: user=%q, channel=%q, msg=%q\n" "$msguser" "$msgchannel" "$msg" - - # Check if we get a private message - if [[ "${msgchannel}" == "${_.nick}" ]] ; then - # ${msgchannel} point to our own nick if we got a private message, - # we need to extract the sender's nickname from ${msguser} and put - # it into msgchannel - msgchannel="${msguser/~(El):(.*)!.*/\1}" - else - # check if this is a command for this bot - [[ "$msg" != ~(Eli):${_.nick}:[[:space:]] ]] && return 0 - fi - - # strip beginning (e.g. ":<nick>:" or ":") plus extra spaces - msg="${msg/~(Eli)(:${_.nick})*:[[:space:]]*/}" - - printf "botmsg=%q\n" "$msg" - - case "$msg" in - ~(Eli)date) - _.send_privmsg "$msgchannel" "${ - printf "%(%Y-%m-%d, %Th/%Z)T\n" - }" - ;; - ~(Eli)echo) - _.send_privmsg "$msgchannel" "${msg#*echo}" - ;; - ~(Eli)exitbot) - typeset exitkey="$(print "$msguser" | sum -x sha1)" # this is unwise&&insecure - if [[ "$msg" == *${exitkey}* ]] ; then - _.running=false - fi - ;; - ~(Eli)help) - _.send_privmsg "$msgchannel" "${ - printf "Hello, this is shircbot, written in ksh93 (%s). " "${.sh.version}" - printf "Subcommands are 'say hello', 'math <math-expr>', 'stocks', 'uuid', 'date' and 'echo'." - }" - ;; - ~(Eli)math) - if [[ "${msg}" == ~(E)[\`\$] ]] ; then - # "restricted" shell mode would prevent any damage but we try to be carefull... - _.send_privmsg "$msgchannel" "Syntax error." - else - typeset mathexpr="${msg#*math}" - - printf "Calculating '%s'\n" "${mathexpr}" - _.send_privmsg "$msgchannel" "${ - ( printf 'export PATH=/usr/${RANDOM}/$$/${RANDOM}/foo ; set -o restricted ; printf "%%s = %%.40g\n" "%s" $(( %s ))\n' "${mathexpr}" "${mathexpr}" | source /dev/stdin 2>&1 ) - }" - fi - ;; - ~(Eli)say\ hello) - _.send_privmsg "$msgchannel" "Hello, this is a bot." - ;; - ~(Eli)stocks) - typeset stockmsg tickersymbol - for tickersymbol in "JAVA" "ORCL" "IBM" "AAPL" "HPQ" ; do - stockmsg="$( /usr/sfw/bin/wget -q -O /dev/stdout "http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=${tickersymbol}" 2>&1 )" - _.send_privmsg "$msgchannel" "${tickersymbol}: ${stockmsg//,/ }" - done - ;; - ~(Eli)uuid) - _.send_privmsg "$msgchannel" "${ - print "%(%Y%M%D%S%N)T$((RANDOM))%s\n" "${msguser}" | sum -x sha256 - }" - ;; - esac - - return 0 -} - -# Automatically join the list of channels listed in |config.join_channels| -# after the client is connected to the server for some time -function mybot.mainloop_tick -{ - integer -S autojoin_done=2 - integer i - - if (( autojoin_done-- == 0 && ${#config.join_channels[@]} > 0 )) ; then - print "# Autojoin channels..." - - for ((i=0 ; i < ${#config.join_channels[@]} ; i++ )) ; do - mybot.join_channel "${config.join_channels[i]}" - done - fi - - return 0 -} - -mybot.createsession "${config.servername}" ${config.port} "${config.nickname}" - -# This is a network-facing application - once we've set eveything up -# we set PATH to a random value and switch to the shell's restricted -# mode to make sure noone can escape the jail. -#export PATH=/usr/$RANDOM/foo -#set -o restricted - -mybot.mainloop - -print "## End." - -exit 0 diff --git a/usr/src/cmd/ast/libshell/common/scripts/shlint.sh b/usr/src/cmd/ast/libshell/common/scripts/shlint.sh deleted file mode 100644 index 23df1805c2..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shlint.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# shlint - a simple lint wrapper around "shcomp" -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${shlint_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename - -typeset progname="${ basename "${0}" ; }" - -typeset -r shlint_usage=$'+ -[-?\n@(#)\$Id: shlint (Roland Mainz) 2009-03-15 \$\n] -[-author?Roland Mainz <roland.mainz@sun.com>] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shlint - lint for POSIX shell scripts] -[+DESCRIPTION?\bshlint\b is a lint for POSIX shell scripts.] -[+SEE ALSO?\bshcomp\b(1), \bksh93\b(1)] -' - -while getopts -a "${progname}" "${shlint_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -(( $# > 0 )) || usage - -file="$1" -[[ ! -f "$file" ]] && fatal_error $"File ${file} not found." -[[ ! -r "$file" ]] && fatal_error $"File ${file} not readable." - -x="$( /usr/bin/shcomp -n "${file}" /dev/null 2>&1 1>/dev/null )" - -printf "%s\n" "$x" - -[[ "$x" != "" ]] && exit 1 || exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shman.sh b/usr/src/cmd/ast/libshell/common/scripts/shman.sh deleted file mode 100644 index 6d40ddd66e..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shman.sh +++ /dev/null @@ -1,395 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function debug_print -{ - # don't use "--" here to allow "-f" for formatting -# print -u2 "$@" - return 0 -} - -# Build a list of compound variables calculated from MANPATH and -# locale which contain... -# "manpath_element" - the MANPATH element this entry belongs to -# "dir" - physical directory of "manpath_element" -# "sect" - section (if "manpath_element" is something like /usr/share/man,1b) -# ... and put the result in the array named by argv[1] -function enumerate_mandirs -{ - nameref md=$1 - typeset manpath_element dir sect manlang - integer i=0 - - if [[ "${LC_MESSAGES}" != "" ]] ; then - manlang="${LC_MESSAGES}" - else - manlang="${LANG}" - fi - - print -r -- "${MANPATH//:/$'\n'}" | while read manpath_element ; do - # strip section from manpath elements like "/usr/share/man,1b" - dir="${manpath_element/~(E)(.*),(.*)/\1}" - sect="${manpath_element/~(E)(.*),(.*)/\2}" - [[ "${sect}" == "${dir}" ]] && sect="" - - if [[ "${manlang}" != "" && -d "${dir}/${manlang}" ]] ; then - md+=( - manpath_element="${manpath_element}" - dir="${dir}/${manlang}" - sect="${sect}" - ) - fi - if [[ -d "${dir}" ]] ; then - md+=( - manpath_element="${manpath_element}" - dir="${dir}" - sect="${sect}" - ) - fi - done - - return 0 -} - -function enumerate_mansects -{ - nameref ms=$1 - nameref mandir_node=$2 - typeset mancf="${mandir_node.dir}/man.cf" - typeset x s l - - if [[ "${mandir_node.sect}" != "" ]] ; then - x="${mandir_node.sect}" - elif [[ "${MANSECTS}" != "" ]] ; then - x="${MANSECTS//,/$'\n'}" - elif [[ -f "${mancf}" && -r "${mancf}" ]] ; then - x="$(egrep -v '^#|^[[:space:]]*$' <"${mancf}" | egrep '^MANSECTS=')" - x="${x/MANSECTS=}/" - x="${x//,/$'\n'}" - else - x="$(cd "${mandir_node.dir}" ; \ - ls -1d ~(El)(sman|man).*/ | \ - while read s ; do \ - s="${s/~(El)(sman|man)/}" ; \ - s="${s/~(Er)\//}" ; \ - print -r -- "$s" ; \ - done)" - fi - - while read l ; do - [[ "${l}" != ~(Elr)[[:blank:]]* ]] && ms+=( "${l}" ) -# print -- "sect=$l" - done <<<"${x}" - -# printf "enumerate_mansects: found %d entries.\n" ${#ms[@]} - - return 0 -} - -# wrapper around more/less -function browse_manpage -{ - typeset tmpdirname - typeset doc_filename="$1" - typeset doc_title="$2" - - # squish characters in filename which are not allowed in a filesystem - # (currently '/') - doc_title="${doc_title//\//}" - - # check if we have "less" installed, if not fall back to /usr/xpg4/bin/more - if which less >/dev/null 2>&1 ; then - # use "cat" here to avoid that "less" may try funny things - cat <"${doc_filename}" | less -I -M $"--prompt=MManual\ page\ ${doc_title}\ ?ltline\ %lt?L/%L.:" - else - tmpdirname="$(mktemp -t -d "shman_${PPID}_$$_XXXXXX")" - - mkdir -p "${tmpdirname}" || { print -u2 -f $"Couldn't create tmp. dir %s\n" "${tmpdirname}" ; return 1 ; } - - ( - cd "${tmpdirname}" - - # note: we need to support /dev/stdin - cat <"${doc_filename}" >"./${doc_title}" - - /usr/xpg4/bin/more "${doc_title}" - - rm -f "${doc_title}" - ) - - rmdir "${tmpdirname}" - fi - - return 0 -} - -# /usr/bin/man <keyword> -function show_manpage -{ - compound -a mandirs - integer i - integer j - - enumerate_mandirs mandirs -# debug_print -- "${mandirs[@]}" - - integer num_mandirs=${#mandirs[@]} - - for ((i=0 ; i < num_mandirs ; i++ )) ; do - typeset mandir="${mandirs[i].dir}" - - typeset -a mansects - enumerate_mansects mansects "mandirs[$i]" - - integer num_mansects="${#mansects[@]}" -# debug_print -- "mansects=${mansects[@]}" - - for ((j=0 ; j < num_mansects ; j++ )) ; do - typeset mansect="${mansects[j]}" - - # try 1: SGML manpage - typeset match="${mandir}/sman${mansect}/${manname}.${mansect}" - if [[ -r "${match}" ]] ; then - typeset note nlink - - # follow SGML links if needed (needs rework, including protection against link loops) - while true ; do - debug_print -f "match: %s\n" "${match}" - - tmp="$(cd "${mandir}" ; LC_MESSAGES=C /usr/lib/sgml/sgml2roff "${match}")" - read note nlink <<<"${tmp}" - - if [[ "${note}" == ".so" ]] ; then - match="${nlink}" - else - break - fi - done - - tbl <<<"${tmp}" | eqn | nroff -u0 -Tlp -man - | col -x | browse_manpage /dev/stdin "${manname}(${mansect})" - return 0 - fi - - # try 2: troff manpage - match="${mandir}/man${mansect}/${manname}.${mansect}" - if [[ -r "${match}" ]] ; then - debug_print -f "match: %s\n" "${match}" - tbl <"${match}" | eqn | nroff -u0 -Tlp -man - | col -x | browse_manpage /dev/stdin "${manname}(${mansect})" - return 0 - fi - done - unset mansects num_mansects - done - - printf $"No manual entry for %s.\n" "${manname}" - return 0 -} - -# /usr/bin/man -l <keyword> -function list_manpages -{ - compound -a mandirs - - enumerate_mandirs mandirs - #debug_print -- "${mandirs[@]}" - - integer num_mandirs=${#mandirs[@]} - - for ((i=0 ; i < num_mandirs ; i++ )) ; do - typeset mandir="${mandirs[i].dir}" - - typeset -a mansects - enumerate_mansects mansects "mandirs[$i]" - - integer num_mansects="${#mansects[@]}" -# debug_print -- "mansects=${mansects[@]}" - - for ((j=0 ; j < num_mansects ; j++ )) ; do - mansect="${mansects[j]}" - - # try 1: SGML manpage - match="${mandir}/sman${mansect}/${manname}.${mansect}" - if [[ -r "${match}" ]] ; then - printf "%s (%s)\t-M %s\n" "${manname}" "${mansect}" "${mandir}" - continue - fi - - # try 2: troff manpage - match="${mandir}/man${mansect}/${manname}.${mansect}" - if [[ -r "${match}" ]] ; then - printf "%s (%s)\t-M %s\n" "${manname}" "${mansect}" "${mandir}" - continue - fi - done - unset mansects num_mansects - done - - return 0 -} - -# /usr/bin/appropos -function list_keywords -{ - typeset -a mandirs - typeset name namesec title - - enumerate_mandirs mandirs - #debug_print -- "${mandirs[@]}" - - integer num_mandirs=${#mandirs[@]} - - for ((i=0 ; i < num_mandirs ; i++ )) ; do - typeset mandir="${mandirs[i].dir}" - typeset windexfile="${mandir}/windex" - - if [[ ! -r "${windexfile}" ]] ; then - print -u2 -f $"%s: Can't open %s.\n" "${progname}" "${windexfile}" - continue - fi - - while IFS=$'\t' read name namesec title ; do - if [[ "${name}${namesec}${title}" == ~(Fi)${manname} ]] ; then - printf "%s\t%s\t%s\n" "${name}" "${namesec}" "${title}" - fi - done <"${windexfile}" - done - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${man_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date - -typeset progname="$(basename "${0}")" - -typeset -r man_usage=$'+ -[-?\n@(#)\$Id: shman (Roland Mainz) 2009-12-02 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[-author?Roland Mainz <roland.mainz@sun.com>] -[+NAME?man - find and display reference manual pages] -[+DESCRIPTION?The man command displays information from the reference - manuals. It displays complete manual pages that you select - by name, or one-line summaries selected either by keyword - (-k), or by the name of an associated file (-f). If no - manual page is located, man prints an error message.] -[+?write me.] -[k:keyword?Prints out one-line summaries from the windex database (table of contents) that - contain any of the given keywords. The windex database is created using - catman(1M).] -[l:list?Lists all manual pages found matching name within the search path.] -[M:mpath?Specifies an alternate search path for manual pages. path is a colon-separated - list of directories that contain manual page directory subtrees. For example, if - path is /usr/share/man:/usr/local/man, man searches for name in the standard - location, and then /usr/local/man. When used with the -k or -f options, the -M - option must appear first. Each directory in the path is assumed to contain subdirectories of the form man* or sman* , - one for each section. This option overrides the MANPATH environment variable.]:[path] -[s:section?Specifies sections of the manual for man to search. The directories searched for - name are limited to those specified by section. section can be a numerical - digit, perhaps followed by one or more letters to match the desired section of - the manual, for example, "3libucb". Also, section can be a word, for example, - local, new, old, public. section can also be a letter. - To specify multiple sections, separate each section with - a comma. This option overrides the MANPATH environment variable and the man.cf - file. - See Search Path below for an explanation of how man conducts its search.]:[section] - -name - -[+SEE ALSO?\bksh93\b(1), \bman\b(1)] -' - -typeset do_list=false -typeset do_keyword=false - -while getopts -a "${progname}" "${man_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - M) MANPATH="${OPTARG}" ;; - l) do_list=true ;; - k) do_keyword=true ;; - s) MANSECTS="${OPTARG}" ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# cd /usr/man; LC_MESSAGES=C /usr/lib/sgml/sgml2roff /usr/man/sman1as/asadmin-list-timers.1as | tbl | eqn | nroff -u0 -Tlp -man - | col -x > /tmp/mpLQaqac - -# prechecks -(( $# > 0 )) || usage - -# process arguments -while (( $# > 0 )) ; do - typeset manname="$1" - shift - - debug_print -f "# searching for %s ...\n" "${manname}" - - if ${do_keyword} ; then - list_keywords - elif ${do_list} ; then - list_manpages - else - show_manpage - fi -done - -# todo: better exit codes -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shnote.sh b/usr/src/cmd/ast/libshell/common/scripts/shnote.sh deleted file mode 100644 index 06e28a219f..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shnote.sh +++ /dev/null @@ -1,413 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function encode_multipart_form_data -{ - nameref formdata="$1" - nameref content="formdata.content" - integer numformelements=${#formdata.form[*]} - integer i - typeset tmp - - content="" - - # todo: add support to upload files - for (( i=0 ; i < numformelements ; i++ )) ; do - nameref element="formdata.form[${i}]" - - content+="--${formdata.boundary}\n" - content+="Content-Disposition: form-data; name=\"${element.name}\"\n" - content+="\n" - # make sure we quote the '\' properly since we pass these data to one instance of - # "print" when putting the content on the wire. - content+="${element.data//\\/\\\\}\n" # fixme: may need encoding for non-ASCII data - done - - # we have to de-quote the content before we can count the real numer of bytes in the payload - tmp="$(print -- "${content}")" - formdata.content_length=${#tmp} - - # add content tail (which MUST not be added to the content length) - content+="--${formdata.boundary}--\n" - - return 0 -} - -# parse HTTP return code, cookies etc. -function parse_http_response -{ - nameref response="$1" - typeset h statuscode statusmsg i - - # we use '\r' as additional IFS to filter the final '\r' - IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> - [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } - [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } - response.statuscode="$statuscode" - response.statusmsg="$statusmsg" - - # skip remaining headers - while IFS='' read -r i ; do - [[ "$i" == $'\r' ]] && break - - # strip '\r' at the end - i="${i/~(Er)$'\r'/}" - - case "$i" in - ~(Eli)Content-Type:.*) - response.content_type="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Content-Length:[[:blank:]]*[0-9]*) - integer response.content_length="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Transfer-Encoding:.*) - response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" - ;; - esac - done - - return 0 -} - -function cat_http_body -{ - typeset emode="$1" - typeset hexchunksize="0" - integer chunksize=0 - - if [[ "${emode}" == "chunked" ]] ; then - while IFS=$'\r' read hexchunksize && - [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]+ ]] && - (( chunksize=$( printf "16#%s\n" "${hexchunksize}" ) )) && (( chunksize > 0 )) ; do - dd bs=1 count="${chunksize}" 2>/dev/null - done - else - cat - fi - - return 0 -} - -function history_write_record -{ - # rec: history record: - # rec.title - # rec.description - # rec.provider - # rec.providertoken - # rec.url - nameref rec="$1" - integer histfd - - mkdir -p "${HOME}/.shnote" - - { - # write a single-line record which can be read - # as a compound variable back into the shell - printf "title=%q description=%q date=%q provider=%q providertoken=%q url=%q\n" \ - "${rec.title}" \ - "${rec.description}" \ - "$(date)" \ - "${rec.provider}" \ - "${rec.providertoken}" \ - "${rec.url}" - } >>"${history_file}" - - return $? -} - -function print_history -{ - integer histfd # http stream number - typeset line - - (( $# != 0 && $# != 1 )) && { print -u2 -f $"%s: Wrong number of arguments.\n" "$0" ; return 1 ; } - - # default output format is: - # <access url>/<title> <date> <access url> - [[ "$1" == "-l" ]] || printf "# %s\t\t\t\t\t%s\t%s\n" "<url>" "<title>" "<date>" - - # no history file ? - if [[ ! -f "${history_file}" ]] ; then - return 0 - fi - - # open history file - redirect {histfd}<> "${history_file}" - (( $? != 0 )) && { print -u2 "Could not open history file." ; return 1 ; } - - while read -u${histfd} line ; do - compound rec - - printf "( %s )\n" "${line}" | read -C rec - - if [[ "$1" == "-l" ]] ; then - print -- "${rec}" - else - printf "%q\t%q\t%q\n" "${rec.url}" "${rec.title}" "${rec.date}" - fi - - unset rec - done - - # close history file - redirect {histfd}<&- - - return 0 -} - -function put_note_pastebin_ca -{ - # key to autheticate this script against pastebin.ca - typeset -r pastebin_ca_key="9CFXFyeNC3iga/vthok75kTBu5kSSLPD" - # site setup - typeset url_host="opensolaris.pastebin.ca" - typeset url_path="/quiet-paste.php?api=${pastebin_ca_key}" - typeset url="http://${url_host}${url_path}" - integer netfd # http stream number - compound httpresponse - - (( $# != 1 )) && { print -u2 -f $"%s: Wrong number of arguments.\n" "$0" ; return 1 ; } - (( ${#1} == 0 )) && { print -u2 -f $"%s: No data.\n" "$0" ; return 1 ; } - - # argument for "encode_multipart_form_data" - compound mimeform=( - # input - typeset boundary - typeset -a form - # output - typeset content - integer content_length - ) - - typeset request="" - typeset content="" - - typeset -r boundary="--------shnote_${RANDOM}_Xfish_${RANDOM}_Yeats_${RANDOM}_Zchicken_${RANDOM}monster_--------" - - mimeform.boundary="${boundary}" - mimeform.form=( # we use explicit index numbers since we rely on them below when filling the history - [0]=( name="name" data="${LOGNAME}" ) - [1]=( name="expiry" data="Never" ) - [2]=( name="type" data="1" ) - [3]=( name="description" data="logname=${LOGNAME};hostname=$(hostname);date=$(date)" ) - [4]=( name="content" data="$1" ) - ) - encode_multipart_form_data mimeform - - content="${mimeform.content}" - - request="POST ${url_path} HTTP/1.1\r\n" - request+="Host: ${url_host}\r\n" - request+="User-Agent: ${http_user_agent}\r\n" - request+="Connection: close\r\n" - request+="Content-Type: multipart/form-data; boundary=${boundary}\r\n" - request+="Content-Length: $(( mimeform.content_length ))\r\n" - - redirect {netfd}<> "/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } - - # send http post - { - print -n -- "${request}\r\n" - print -n -- "${content}\r\n" - } >&${netfd} - - # process reply - parse_http_response httpresponse <&${netfd} - response="$(cat_http_body "${httpresponse.transfer_encoding}" <&${netfd})" - - # close connection - redirect {netfd}<&- - - if [[ "${response}" == ~(E).*SUCCESS.* ]] ; then - typeset response_token="${response/~(E).*SUCCESS:/}" - - printf "SUCCESS: http://opensolaris.pastebin.ca/%s\n" "${response_token}" - - # write history entry - compound histrec=( - title="${mimeform.form[0].data}" - description="${mimeform.form[3].data}" - providertoken="${response_token}" - provider="opensolaris.pastebin.ca" - url="http://opensolaris.pastebin.ca/${response_token}" - ) - - history_write_record histrec - return 0 - else - printf "ERROR: %s\n" "${response}" - return 1 - fi - - # not reached -} - -function get_note_pastebin_ca -{ - typeset recordname="$1" - integer netfd # http stream number - - (( $# != 1 )) && { print -u2 -f $"%s: No key or key URL.\n" "$0" ; return 1 ; } - - case "${recordname}" in - ~(Elr)[0-9][0-9]*) - # pass-through - ;; - ~(Elr)http://opensolaris.pastebin.ca/raw/[0-9]*) - recordname="${recordname/~(El)http:\/\/opensolaris.pastebin.ca\/raw\//}" - ;; - ~(Elr)http://opensolaris.pastebin.ca/[0-9]*) - recordname="${recordname/~(El)http:\/\/opensolaris.pastebin.ca\//}" - ;; - *) - fatal_error $"Unsupported record name ${recordname}." - esac - - print -u2 -f "# Record name is '%s'\n" "${recordname}" - - typeset url_host="opensolaris.pastebin.ca" - typeset url_path="/raw/${recordname}" - typeset url="http://${url_host}${url_path}" - # I hereby curse Solaris for not having an entry for "http" in /etc/services - - # open TCP channel - redirect {netfd}<> "/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } - - # send HTTP request - request="GET ${url_path} HTTP/1.1\r\n" - request+="Host: ${url_host}\r\n" - request+="User-Agent: ${http_user_agent}\r\n" - request+="Connection: close\r\n" - print -u${netfd} -- "${request}\r\n" - - # collect response and send it to stdout - parse_http_response httpresponse <&${netfd} - cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} - - # close connection - redirect {netfd}<&- - - print # add newline - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${USAGE}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date -builtin uname - -typeset progname="${ basename "${0}" ; }" - -# HTTP protocol client identifer -typeset -r http_user_agent="shnote/ksh93 (2010-03-27; $(uname -s -r -p))" - -# name of history log (the number after "history" is some kind of version -# counter to handle incompatible changes to the history file format) -typeset -r history_file="${HOME}/.shnote/history0.txt" - -typeset -r shnote_usage=$'+ -[-?\n@(#)\$Id: shnote (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shnote - read/write text data to internet clipboards] -[+DESCRIPTION?\bshnote\b is a small utilty which can read and write text - data to internet "clipboards" such as opensolaris.pastebin.ca.] -[+?The first arg \bmethod\b describes one of the methods, "put" saves a string - to the internet clipboard, returning an identifer and the full URL - where the data are stored. The method "get" retrives the raw - information using the identifer from the previous "put" action. - The method "hist" prints a history of transactions created with the - "put" method and the keys to retrive them again using the "get" method.] -[+?The second arg \bstring\b contains either the string data which should be - stored on the clipboard using the "put" method, the "get" method uses - this information as identifer to retrive the raw data from the - clipboard.] - -method [ string ] - -[+SEE ALSO?\bksh93\b(1), \brssread\b(1), \bshtwitter\b(1), \bshtinyurl\b(1), http://opensolaris.pastebin.ca] -' - -while getopts -a "${progname}" "${shnote_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# expecting at least one more argument, the single method below will do -# the checks for more arguments if needed ("put" and "get" methods need -# at least one extra argument, "hist" none). -(($# >= 1)) || usage - -typeset method="$1" -shift - -case "${method}" in - put) put_note_pastebin_ca "$@" ; exit $? ;; - get) get_note_pastebin_ca "$@" ; exit $? ;; - hist) print_history "$@" ; exit $? ;; - *) usage ;; -esac - -fatal_error $"not reached." -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shpiano.sh b/usr/src/cmd/ast/libshell/common/scripts/shpiano.sh deleted file mode 100644 index d144af8bed..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shpiano.sh +++ /dev/null @@ -1,1414 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function beep -{ - tput bel - return 0 -} - -# array which holds frequency and sample data -# (the data are created on demand, "sample_set" indicates whether the "sample" variable -# needs to be filled or not) -compound -A tones=( - ["C3"]=( float freq=261.63 ; typeset sample_set="false" ; typeset -b sample ) - ["C#3"]=( float freq=277.18 ; typeset sample_set="false" ; typeset -b sample ) - ["D3"]=( float freq=293.66 ; typeset sample_set="false" ; typeset -b sample ) - ["D#3"]=( float freq=311.13 ; typeset sample_set="false" ; typeset -b sample ) - ["E3"]=( float freq=329.63 ; typeset sample_set="false" ; typeset -b sample ) - ["F3"]=( float freq=349.23 ; typeset sample_set="false" ; typeset -b sample ) - ["F#3"]=( float freq=369.99 ; typeset sample_set="false" ; typeset -b sample ) - ["G3"]=( float freq=391.99 ; typeset sample_set="false" ; typeset -b sample ) - ["G#3"]=( float freq=415.31 ; typeset sample_set="false" ; typeset -b sample ) - ["A3"]=( float freq=440.00 ; typeset sample_set="false" ; typeset -b sample ) - ["A#3"]=( float freq=466.16 ; typeset sample_set="false" ; typeset -b sample ) - ["B3"]=( float freq=493.88 ; typeset sample_set="false" ; typeset -b sample ) - ["C4"]=( float freq=523.25 ; typeset sample_set="false" ; typeset -b sample ) - ["C#4"]=( float freq=554.37 ; typeset sample_set="false" ; typeset -b sample ) - ["D4"]=( float freq=587.33 ; typeset sample_set="false" ; typeset -b sample ) - ["D#4"]=( float freq=622.25 ; typeset sample_set="false" ; typeset -b sample ) - ["E4"]=( float freq=659.26 ; typeset sample_set="false" ; typeset -b sample ) - ["F4"]=( float freq=698.46 ; typeset sample_set="false" ; typeset -b sample ) - ["F#4"]=( float freq=739.99 ; typeset sample_set="false" ; typeset -b sample ) - ["G4"]=( float freq=783.99 ; typeset sample_set="false" ; typeset -b sample ) - ["G#4"]=( float freq=830.61 ; typeset sample_set="false" ; typeset -b sample ) - ["A4"]=( float freq=880.00 ; typeset sample_set="false" ; typeset -b sample ) - ["A#4"]=( float freq=932.32 ; typeset sample_set="false" ; typeset -b sample ) - ["B4"]=( float freq=987.77 ; typeset sample_set="false" ; typeset -b sample ) - ["C5"]=( float freq=1046.5 ; typeset sample_set="false" ; typeset -b sample ) - - # dummy entry for pause - ["p"]=( float freq=NaN ; typeset sample_set="false" ; typeset -b sample ) -) - -# alias table which translates the various names of "notes" to the matching entry -# in the "tones" table -compound -r -A notes=( - ["C3"]=( val=tones["C3"] ) ["key_d"]=( val=tones["C3"] ) - ["C#3"]=( val=tones["C#3"] ) ["key_r"]=( val=tones["C#3"] ) - ["D3"]=( val=tones["D3"] ) ["key_f"]=( val=tones["D3"] ) - ["D#3"]=( val=tones["D#3"] ) ["key_t"]=( val=tones["D#3"] ) - ["E3"]=( val=tones["E3"] ) ["key_g"]=( val=tones["E3"] ) - ["F3"]=( val=tones["F3"] ) ["key_h"]=( val=tones["F3"] ) - ["F#3"]=( val=tones["F#3"] ) ["key_u"]=( val=tones["F#3"] ) - ["G3"]=( val=tones["G3"] ) ["key_j"]=( val=tones["G3"] ) - ["G#3"]=( val=tones["G#3"] ) ["key_i"]=( val=tones["G#3"] ) - ["A3"]=( val=tones["A3"] ) ["key_k"]=( val=tones["A3"] ) - ["A#3"]=( val=tones["A#3"] ) ["key_o"]=( val=tones["A#3"] ) - ["B3"]=( val=tones["B3"] ) ["key_l"]=( val=tones["B3"] ) - ["C4"]=( val=tones["C4"] ) ["key_D"]=( val=tones["C4"] ) - ["C#4"]=( val=tones["C#4"] ) ["key_R"]=( val=tones["C#4"] ) - ["D4"]=( val=tones["D4"] ) ["key_F"]=( val=tones["D4"] ) - ["D#4"]=( val=tones["D#4"] ) ["key_T"]=( val=tones["D#4"] ) - ["E4"]=( val=tones["E4"] ) ["key_G"]=( val=tones["E4"] ) - ["F4"]=( val=tones["F4"] ) ["key_H"]=( val=tones["F4"] ) - ["F#4"]=( val=tones["F#4"] ) ["key_U"]=( val=tones["F#4"] ) - ["G4"]=( val=tones["G4"] ) ["key_J"]=( val=tones["G4"] ) - ["G#4"]=( val=tones["G#4"] ) ["key_I"]=( val=tones["G#4"] ) - ["A4"]=( val=tones["A4"] ) ["key_K"]=( val=tones["A4"] ) - ["A#4"]=( val=tones["A#4"] ) ["key_O"]=( val=tones["A#4"] ) - ["B4"]=( val=tones["B4"] ) ["key_L"]=( val=tones["B4"] ) - ["C5"]=( val=tones["C5"] ) -) - -# array used to convert a 14-bit unsigned PCM value to -# inverted 8-bit u-law -# (values were "stolen" from usr/src/cmd/audio/utilities/g711.c -integer -r -a audio_pcmulinear14bittoulaw8bit=( - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 - 0x01 0x01 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 0x02 - 0x02 0x02 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 - 0x03 0x03 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 - 0x04 0x04 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 - 0x05 0x05 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 - 0x06 0x06 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 0x07 - 0x07 0x07 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 0x08 - 0x08 0x08 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 - 0x09 0x09 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a - 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a - 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a - 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a - 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0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0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f - 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f - 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f 0x0f - 0x0f 0x0f 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 - 0x10 0x10 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 - 0x11 0x11 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 0x12 - 0x12 0x12 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 0x13 - 0x13 0x13 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 - 0x14 0x14 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 0x15 - 0x15 0x15 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16 - 0x16 0x16 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 0x17 - 0x17 0x17 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 - 0x18 0x18 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 0x19 - 0x19 0x19 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a - 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0x1a 0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0x1f 0x1f 0x1f 0x1f - 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f - 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f - 0x1f 0x1f 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 - 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 - 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 - 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 - 0x20 0x20 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 - 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 - 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 - 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 0x21 - 0x21 0x21 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 - 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 - 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 - 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 0x22 - 0x22 0x22 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 - 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 - 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 - 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 0x23 - 0x23 0x23 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 - 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 - 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 - 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 0x24 - 0x24 0x24 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 - 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 - 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 - 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 0x25 - 0x25 0x25 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 - 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 - 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 - 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 0x26 - 0x26 0x26 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 - 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 - 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 - 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 0x27 - 0x27 0x27 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 - 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 - 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 - 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 0x28 - 0x28 0x28 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 - 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 - 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 - 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 0x29 - 0x29 0x29 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a - 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a - 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a 0x2a - 0x2a 0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x32 0x32 0x32 0x32 0x32 0x32 0x32 0x32 0x32 0x32 0x32 - 0x32 0x32 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 - 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 0x33 - 0x33 0x33 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 - 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 0x34 - 0x34 0x34 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 - 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 0x35 - 0x35 0x35 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 - 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 0x36 - 0x36 0x36 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 - 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 0x37 - 0x37 0x37 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 - 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 0x38 - 0x38 0x38 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 - 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 0x39 - 0x39 0x39 0x3a 0x3a 0x3a 0x3a 0x3a 0x3a 0x3a 0x3a 0x3a 0x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x41 0x41 0x41 0x41 0x41 0x41 - 0x41 0x41 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 0x42 - 0x42 0x42 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 0x43 - 0x43 0x43 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 0x44 - 0x44 0x44 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 0x45 - 0x45 0x45 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 0x46 - 0x46 0x46 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 0x47 - 0x47 0x47 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 0x48 - 0x48 0x48 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 0x49 - 0x49 0x49 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a 0x4a - 0x4a 0x4a 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b 0x4b - 0x4b 0x4b 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c 0x4c - 0x4c 0x4c 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d 0x4d - 0x4d 0x4d 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e 0x4e - 0x4e 0x4e 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f - 0x4f 0x4f 0x50 0x50 0x50 0x50 0x50 0x50 0x50 0x50 0x51 0x51 0x51 0x51 0x51 0x51 - 0x51 0x51 0x52 0x52 0x52 0x52 0x52 0x52 0x52 0x52 0x53 0x53 0x53 0x53 0x53 0x53 - 0x53 0x53 0x54 0x54 0x54 0x54 0x54 0x54 0x54 0x54 0x55 0x55 0x55 0x55 0x55 0x55 - 0x55 0x55 0x56 0x56 0x56 0x56 0x56 0x56 0x56 0x56 0x57 0x57 0x57 0x57 0x57 0x57 - 0x57 0x57 0x58 0x58 0x58 0x58 0x58 0x58 0x58 0x58 0x59 0x59 0x59 0x59 0x59 0x59 - 0x59 0x59 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5b 0x5b 0x5b 0x5b 0x5b 0x5b - 0x5b 0x5b 0x5c 0x5c 0x5c 0x5c 0x5c 0x5c 0x5c 0x5c 0x5d 0x5d 0x5d 0x5d 0x5d 0x5d - 0x5d 0x5d 0x5e 0x5e 0x5e 0x5e 0x5e 0x5e 0x5e 0x5e 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f - 0x5f 0x5f 0x60 0x60 0x60 0x60 0x61 0x61 0x61 0x61 0x62 0x62 0x62 0x62 0x63 0x63 - 0x63 0x63 0x64 0x64 0x64 0x64 0x65 0x65 0x65 0x65 0x66 0x66 0x66 0x66 0x67 0x67 - 0x67 0x67 0x68 0x68 0x68 0x68 0x69 0x69 0x69 0x69 0x6a 0x6a 0x6a 0x6a 0x6b 0x6b - 0x6b 0x6b 0x6c 0x6c 0x6c 0x6c 0x6d 0x6d 0x6d 0x6d 0x6e 0x6e 0x6e 0x6e 0x6f 0x6f - 0x6f 0x6f 0x70 0x70 0x71 0x71 0x72 0x72 0x73 0x73 0x74 0x74 0x75 0x75 0x76 0x76 - 0x77 0x77 0x78 0x78 0x79 0x79 0x7a 0x7a 0x7b 0x7b 0x7c 0x7c 0x7d 0x7d 0x7e 0x7e - 0xff 0xfe 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f 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf - 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xaf 0xae - 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae - 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae - 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae - 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xae 0xad - 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad - 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad - 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad - 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xad 0xac - 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac - 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac - 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac - 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xac 0xab - 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab 0xab - 0xab 0xab 0xab 0xab 0xab 0xab 0x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a 0x9a - 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a - 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a - 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a - 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a - 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a - 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x9a 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 - 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x99 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 - 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 - 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x97 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 - 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 - 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x95 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 - 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x94 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 - 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x93 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 - 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x92 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 - 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x91 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 - 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x8f - 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f - 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f - 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f - 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f - 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0x8f 0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0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a - 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a - 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x8a 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 - 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x89 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 - 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 - 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x87 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 - 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x86 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 - 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x85 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 - 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x84 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 - 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x83 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 - 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x82 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 - 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x81 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 - 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 -) - -# base64 handling stuff -typeset -r base64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" - -function bytearraytobase64 -{ - nameref bytearray=$1 - typeset out="" - integer len - integer i i0 i1 i2 - - (( len=${#bytearray[*]}-1 )) - for (( i=0 ; i < len ; i+=3 )) ; do - (( i0=bytearray[i+0] , i1=bytearray[i+1] , i2=bytearray[i+2] )) - - out+="${base64chars:$(( i0 >> 2 )):1}" - out+="${base64chars:$(( ((i0 & 0x03) << 4) | ((i1 & 0xf0) >> 4) )):1}" - (( (i+1) < len )) && { out+="${base64chars:$(( ((i1 & 0x0f) << 2) | ((i2 & 0xc0) >> 6) )):1}" ; } || out+="=" - (( (i+2) < len )) && { out+="${base64chars:$(( i2 & 0x3f )):1}" ; } || out+="=" - done - - printf "%s" "${out}" - return 0 -} - - -# stack layout: -# stack.currpos = current position -# stack.data = nameref to integer array -function stack_init -{ - nameref stk=$1 - stk.currpos=0 - return 0 -} - -function stack_put_byte -{ - nameref stk=$1 - stk.data[stk.currpos++]=$(( $2 & 0xFF )) - return 0 -} - -function stack_put_uint16 -{ - integer val=$2 - stack_put_byte $1 $(( (val >> 8) & 0xFF )) - stack_put_byte $1 $(( val & 0xFF )) - return 0 -} - -# put an au(4) header on a stack variable -function audio_put_au_header -{ - nameref au=$1 - - # au_magic: magic number - stack_put_byte au $(('.')) - stack_put_byte au $(('s')) - stack_put_byte au $(('n')) - stack_put_byte au $(('d')) - # au_offset - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 0x1C - # au_data_size (0xFFFFFFFF = AUDIO_AU_UNKNOWN_SIZE ((unsigned)(~0))) - stack_put_byte au 0xFF - stack_put_byte au 0xFF - stack_put_byte au 0xFF - stack_put_byte au 0xFF - # au_encoding - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 1 - # au_sample_rate - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 0x1f - stack_put_byte au 0x40 - # au_channels - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 0x00 - stack_put_byte au 0x01 - # dummy - stack_put_byte au 0 - stack_put_byte au 0 - stack_put_byte au 0 - stack_put_byte au 0 - return 0 -} - -function print_piano_layout -{ - cat <<ENDOFTEXT ----------------------------------------------------- - | ##### ##### | ##### ##### ##### | - | ##### ##### | ##### ##### ##### | - | ##### ##### | ##### ##### ##### | - | #cis# #dis# | #fis# #gis# #ais# | - | #des# # es# | #ges# # as# # b # | - | \###/ \###/ | \###/ \###/ \###/ | - | | | | | | | | - | | | | | | | | - | c | d | e | f | g | a | h | - | | | | | | | | -/\-----/\-----/\-----/\-----/\-----/\-----/\-----/\- - -Keys: - R T U I O - D F G H J K L -ENDOFTEXT - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${shpiano_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename - -typeset progname="${ basename "${0}" ; }" - -typeset -r shpiano_usage=$'+ -[-?\n@(#)\$Id: shpiano (Roland Mainz) 2009-05-09 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[-author?Valeria Elisabeth Mainz <valeria.mainz@no.such.email.toddler>] -[+NAME?shpiano - simple audio demo] -[+DESCRIPTION?\bshpiano\b is a small demo application which converts - keyboard input into 8bit Mu-law audio samples which are - send to /dev/audio.] -[b:babymode?Mode to entertain toddlers. Plays a sound for any key - and ignores SIGINT. Requires ESC to quit the application.] -[+SEE ALSO?\bksh93\b(1), \bau\b(4), \baudio\b(7i)] -' -typeset babymode=false - -while getopts -a "${progname}" "${shpiano_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - b) babymode=true ;; - +b) babymode=false ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -float -r M_PI=3.14159265358979323846 - -float sample_rate=8000. -float duration=0.10 -float freq -float w # temporary "wave" value -integer i -integer audiofd # audio device file descriptor -typeset key -compound audio=( integer currpos=0 ; integer -a data=( [0]=0 ) ) # stack object - -clear -print_piano_layout - -if ${babymode} ; then - [[ -x /usr/bin/banner ]] || fatal_error "-n requires /usr/bin/banner" - - typeset lastkeys - - nameref curr_note=tones["A#4"] - (( freq=curr_note.freq )) - - trap "" INT -fi - -if [[ "${AUDIODEV}" == "" ]] ; then - AUDIODEV="/dev/audio" -fi -print -u2 -f $"Playing sound to device %s\n" "${AUDIODEV}" - -# open channel to audio device -redirect {audiofd}<> "${AUDIODEV}" -(( $? != 0 )) && fatal_error $"Could not open audio device." - -# build pause sample -stack_init audio -for ((i=0 ; i < ((sample_rate*duration)/2.) ; i++)) ; do - stack_put_byte audio 0 -done -typeset -b pause_sample=${ bytearraytobase64 audio.data ; } - -stack_init audio -audio_put_au_header audio -typeset -b au_header=${ bytearraytobase64 audio.data ; } - -# begin playing -printf "%B" au_header >&${audiofd} - - -# warning: the math used here is so wrong that your head may -# explode when you continue reading this -while read -r -N 1 key?$'\r > ' ; do - if [[ ${key} == $'\E' ]] || [[ ${babymode} != "true" && ${key} == ~(E)($'\E'|'q'|'Q') ]] ; then - break # quit - fi - - printf "\r" - if [[ -v notes[key_${key}] ]] ; then - nameref curr_note="${notes[key_${key}].val}" - (( freq=curr_note.freq )) - else - if ${babymode} ; then - nameref curr_note=tones["A#4"] - (( freq=curr_note.freq )) - else - nameref curr_note=tones["p"] - (( freq=1.*(1./duration) )) - fi - fi - - # babymode: print "keys" to screen via /usr/bin/banner - if ${babymode} ; then - lastkeys="${lastkeys/~(Er).*(........)/\1}${key}" - banner "${lastkeys}" - fi - -# printf "note=%s sample_rate=%f, freq=%f\n" "${!curr_note}" sample_rate freq >&2 - - # Create sample data if they didn't exist yet and - # store them in the "tones" array - if ! ${curr_note.sample_set} ; then - stack_init audio - - for ((i=0 ; i < (sample_rate*duration) ; i++)) ; do - # first create the sinus wave... - (( w=sin( ((i*freq)/sample_rate) * (2.*M_PI)) )) - # ...scale it to 14bit signed PCM linear and... - (( w=8192.+w*8191. )) - # ...then convert it to 8bit ulaw - # ("audio_pcmulinear14bittoulaw8bit" is unsigned but we use - # "8192" above as starting point to do the "signed to unsigned" - # conversion) ... - stack_put_byte audio $(( audio_pcmulinear14bittoulaw8bit[int(w)] )) - done - - curr_note.sample=${ bytearraytobase64 audio.data ; } - curr_note.sample_set="true" - fi - - # output sample - { - printf "%B" curr_note.sample - printf "%B" pause_sample - } >&${audiofd} -done - -# close audio device -redirect {audiofd}<&- - -print -u2 $"# done." -exit 0 -#EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shtinyurl.sh b/usr/src/cmd/ast/libshell/common/scripts/shtinyurl.sh deleted file mode 100644 index 38f5e393d7..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shtinyurl.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -# parse HTTP return code, cookies etc. -function parse_http_response -{ - nameref response="$1" - typeset h statuscode statusmsg i - - # we use '\r' as additional IFS to filter the final '\r' - IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> - [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } - [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } - response.statuscode="$statuscode" - response.statusmsg="$statusmsg" - - # skip remaining headers - while IFS='' read -r i ; do - [[ "$i" == $'\r' ]] && break - - # strip '\r' at the end - i="${i/~(Er)$'\r'/}" - - case "$i" in - ~(Eli)Content-Type:.*) - response.content_type="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Content-Length:[[:blank:]]*[0-9]*) - integer response.content_length="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Transfer-Encoding:.*) - response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" - ;; - esac - done - - return 0 -} - -function cat_http_body -{ - typeset emode="$1" - typeset hexchunksize="0" - integer chunksize=0 - - if [[ "${emode}" == "chunked" ]] ; then - while IFS=$'\r' read hexchunksize && - [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]+ ]] && - (( chunksize=$( printf "16#%s\n" "${hexchunksize}" ) )) && (( chunksize > 0 )) ; do - dd bs=1 count="${chunksize}" 2>/dev/null - done - else - cat - fi - - return 0 -} - -function request_tinyurl -{ - # site setup - typeset url_host="tinyurl.com" - typeset url_path="/api-create.php" - typeset url="http://${url_host}${url_path}" - integer netfd # http stream number - typeset inputurl="$1" - compound httpresponse # http response - typeset request="" - - # we assume "inputurl" is a correctly encoded URL which doesn't - # require any further mangling - url_path+="?url=${inputurl}" - - request="GET ${url_path} HTTP/1.1\r\n" - request+="Host: ${url_host}\r\n" - request+="User-Agent: ${http_user_agent}\r\n" - request+="Connection: close\r\n" - - redirect {netfd}<> "/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } - - # send http post - { - print -n -- "${request}\r\n" - } >&${netfd} - - # process reply - parse_http_response httpresponse <&${netfd} - response="${ cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} ; }" - - # close connection - redirect {netfd}<&- - - if (( httpresponse.statuscode >= 200 && httpresponse.statuscode <= 299 )) ; then - print -r -- "${response}" - return 0 - else - print -u2 -f $"tinyurl response was (%s,%s):\n%s\n" "${httpresponse.statuscode}" "${httpresponse.statusmsg}" "${response}" - return 1 - fi - - # not reached -} - -function request_trimurl -{ - # site setup - typeset url_host="api.tr.im" - typeset url_path="/api/trim_url.xml" - typeset url="http://${url_host}${url_path}" - integer netfd # http stream number - typeset inputurl="$1" - compound httpresponse # http response - typeset request="" - - # we assume "inputurl" is a correctly encoded URL which doesn't - # require any further mangling - url_path+="?url=${inputurl}" - - request="GET ${url_path} HTTP/1.1\r\n" - request+="Host: ${url_host}\r\n" - request+="User-Agent: ${http_user_agent}\r\n" - request+="Connection: close\r\n" - - redirect {netfd}<> "/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } - - # send http post - { - print -n -- "${request}\r\n" - } >&${netfd} - - # process reply - parse_http_response httpresponse <&${netfd} - response="${ cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} ; }" - - # close connection - redirect {netfd}<&- - - if (( httpresponse.statuscode >= 200 && httpresponse.statuscode <= 299 )) ; then - # the statement below should really parse the XML... - print -r -- "${response/~(Elr).*(\<url\>)(.*)(\<\/url\>).*/\2}" - return 0 - else - print -u2 -f $"tr.im response was (%s,%s):\n%s\n" "${httpresponse.statuscode}" "${httpresponse.statusmsg}" "${response}" - return 1 - fi - - # not reached -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${shtinyurl_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date -builtin uname - -typeset progname="${ basename "${0}" ; }" - -# HTTP protocol client identifer -typeset -r http_user_agent="shtinyurl/ksh93 (2010-03-27; ${ uname -s -r -p ; })" - -typeset -r shtinyurl_usage=$'+ -[-?\n@(#)\$Id: shtinyurl (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shtinyurl - create short alias URL from long URL] -[+DESCRIPTION?\bshtinyurl\b is a small utility which passes a given URL - to internet service which creates short aliases in the - form of http://<servicename>/XXXXXXXX to redirect long URLs.] -[+?The first arg \burl\b describes a long URL which is transformed into - a tinyurl.com short alias.] -[P:provider?Service provider (either \'tinyurl.com\' or \'tr.im\').]:[mode] - -url - -[+SEE ALSO?\bksh93\b(1), \brssread\b(1), \bshtwitter\b(1), http://www.tinyurl.com, http://tr.im] -' - -typeset service_provider="tr.im" - -while getopts -a "${progname}" "${shtinyurl_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - P) service_provider="${OPTARG}" ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# expecting at least one more argument -(( $# >= 1 )) || usage - -typeset url="$1" -shift - -case "${service_provider}" in - "tinyurl.com") - request_tinyurl "${url}" - exit $? - ;; - "tr.im") - request_trimurl "${url}" - exit $? - ;; - *) - fatal_error "Unsupported service provider." -esac - -# not reached - -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/shtwitter.sh b/usr/src/cmd/ast/libshell/common/scripts/shtwitter.sh deleted file mode 100644 index d088a1d01a..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/shtwitter.sh +++ /dev/null @@ -1,355 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -function encode_x_www_form_urlencoded -{ - nameref formdata=$1 - nameref content="formdata.content" - integer numformelements=${#formdata.form[*]} - integer i j - - content="" - - for (( i=0 ; i < numformelements ; i++ )) ; do - nameref element="formdata.form[${i}]" - typeset data="${element.data}" - integer datalen="${#data}" - typeset c - - [[ "$content" != "" ]] && content+="&" - - content+="${element.name}=" - - for ((j=0 ; j < datalen ; j++)) ; do - c="${data:j:1}" - case "$c" in - ' ') c="+" ;; - '!') c="%21" ;; - '*') c="%2A" ;; - "'") c="%27" ;; - '(') c="%28" ;; - ')') c="%29" ;; - ';') c="%3B" ;; - ':') c="%3A" ;; - '@') c="%40" ;; - '&') c="%26" ;; - '=') c="%3D" ;; - '+') c="%2B" ;; - '$') c="%24" ;; - ',') c="%2C" ;; - '/') c="%2F" ;; - '?') c="%3F" ;; - '%') c="%25" ;; - '#') c="%23" ;; - '[') c="%5B" ;; - '\') c="%5C" ;; # we need this to avoid the '\'-quoting hell - ']') c="%5D" ;; - *) ;; - esac - content+="$c" - done - done - - formdata.content_length=${#content} - - return 0 -} - -# parse HTTP return code, cookies etc. -function parse_http_response -{ - nameref response="$1" - typeset h statuscode statusmsg i - - # we use '\r' as additional IFS to filter the final '\r' - IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> - [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } - [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } - response.statuscode="$statuscode" - response.statusmsg="$statusmsg" - - # skip remaining headers - while IFS='' read -r i ; do - [[ "$i" == $'\r' ]] && break - - # strip '\r' at the end - i="${i/~(Er)$'\r'/}" - - case "$i" in - ~(Eli)Content-Type:.*) - response.content_type="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Content-Length:[[:blank:]]*[0-9]*) - integer response.content_length="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Transfer-Encoding:.*) - response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" - ;; - esac - done - - return 0 -} - -function cat_http_body -{ - typeset emode="$1" - typeset hexchunksize="0" - integer chunksize=0 - - if [[ "${emode}" == "chunked" ]] ; then - while IFS=$'\r' read hexchunksize && - [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]+ ]] && - (( chunksize=$( printf "16#%s\n" "${hexchunksize}" ) )) && (( chunksize > 0 )) ; do - dd bs=1 count="${chunksize}" 2>/dev/null - done - else - cat - fi - - return 0 -} - -function encode_http_basic_auth -{ - typeset user="$1" - typeset passwd="$2" - typeset s - integer s_len - typeset -b base64var - - # ksh93 binary variables use base64 encoding, the same as the - # HTTP basic authentification. We only have to read the - # plaintext user:passwd string into the binary variable "base64var" - # and then print this variable as ASCII. - s="${user}:${passwd}" - s_len="${#s}" - print -n "${s}" | read -N${s_len} base64var - - print -- "${base64var}" # print ASCII (base64) representation of binary var - - return 0 -} - -function put_twitter_message -{ - [[ "$SHTWITTER_USER" == "" ]] && { print -u2 -f $"%s: SHTWITTER_USER not set.\n" "$0" ; return 1 ; } - [[ "$SHTWITTER_PASSWD" == "" ]] && { print -u2 -f $"%s: SHTWITTER_PASSWD not set.\n" "$0" ; return 1 ; } - - (( $# != 1 )) && { print -u2 -f $"%s: Wrong number of arguments.\n" "$0" ; return 1 ; } - - # site setup - typeset url_host="twitter.com" - typeset url_path="/statuses/update.xml" - typeset url="http://${url_host}${url_path}" - integer netfd # http stream number - typeset msgtext="$1" - compound httpresponse # http response - - # argument for "encode_x_www_form_urlencoded" - compound urlform=( - # input - compound -a form=( - ( name="status" data="${msgtext}" ) - ) - # output - typeset content - integer content_length - ) - - typeset request="" - typeset content="" - - encode_x_www_form_urlencoded urlform - - content="${urlform.content}" - - request="POST ${url_path} HTTP/1.1\r\n" - request+="Host: ${url_host}\r\n" - request+="Authorization: Basic ${ encode_http_basic_auth "${SHTWITTER_USER}" "${SHTWITTER_PASSWD}" ; }\r\n" - request+="User-Agent: ${http_user_agent}\r\n" - request+="Connection: close\r\n" - request+="Content-Type: application/x-www-form-urlencoded\r\n" - request+="Content-Length: $(( urlform.content_length ))\r\n" - - redirect {netfd}<> "/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f "%s: Could not open connection to %s\n." "$0" "${url_host}" ; return 1 ; } - - # send http post - { - print -n -- "${request}\r\n" - print -n -- "${content}\r\n" - } >&${netfd} - - # process reply - parse_http_response httpresponse <&${netfd} - response="${ cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} ; }" - - # close connection - redirect {netfd}<&- - - printf $"twitter response was (%s,%s): %s\n" "${httpresponse.statuscode}" "${httpresponse.statusmsg}" "${response}" - - if (( httpresponse.statuscode >= 200 && httpresponse.statuscode <= 299 )) ; then - return 0 - else - return 1 - fi - - # not reached -} - -function verify_twitter_credentials -{ - [[ "$SHTWITTER_USER" == "" ]] && { print -u2 -f $"%s: SHTWITTER_USER not set.\n" "$0" ; return 1 ; } - [[ "$SHTWITTER_PASSWD" == "" ]] && { print -u2 -f $"%s: SHTWITTER_PASSWD not set.\n" "$0" ; return 1 ; } - - (( $# != 0 )) && { print -u2 -f $"%s: Wrong number of arguments.\n" "$0" ; return 1 ; } - - # site setup - typeset url_host="twitter.com" - typeset url_path="/account/verify_credentials.xml" - typeset url="http://${url_host}${url_path}" - integer netfd # http stream number - compound httpresponse # http response - - typeset request="" - - request="POST ${url_path} HTTP/1.1\r\n" - request+="Host: ${url_host}\r\n" - request+="Authorization: Basic ${ encode_http_basic_auth "${SHTWITTER_USER}" "${SHTWITTER_PASSWD}" ; }\r\n" - request+="User-Agent: ${http_user_agent}\r\n" - request+="Connection: close\r\n" - request+="Content-Type: application/x-www-form-urlencoded\r\n" - request+="Content-Length: 0\r\n" # dummy - - redirect {netfd}<> "/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } - - # send http post - { - print -n -- "${request}\r\n" - } >&${netfd} - - # process reply - parse_http_response httpresponse <&${netfd} - response="${ cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} ; }" - - # close connection - redirect {netfd}<&- - - printf $"twitter response was (%s,%s): %s\n" "${httpresponse.statuscode}" "${httpresponse.statusmsg}" "${response}" - - if (( httpresponse.statuscode >= 200 && httpresponse.statuscode <= 299 )) ; then - return 0 - else - return 1 - fi - - # not reached -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${shtwitter_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date -builtin uname - -typeset progname="${ basename "${0}" ; }" - -# HTTP protocol client identifer -typeset -r http_user_agent="shtwitter/ksh93 (2010-03-27; ${ uname -s -r -p ; })" - -typeset -r shtwitter_usage=$'+ -[-?\n@(#)\$Id: shtwitter (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shtwitter - read/write text data to internet clipboards] -[+DESCRIPTION?\bshtwitter\b is a small utility which can read and write text - to the twitter.com microblogging site.] -[+?The first arg \bmethod\b describes one of the methods, "update" posts a - text message to the users twitter blog, returning the raw response - message from the twitter server.] -[+?The second arg \bstring\b contains the string data which should be - stored on twitter.com.] - -method [ string ] - -[+SEE ALSO?\bksh93\b(1), \brssread\b(1), \bshtinyurl\b(1), http://www.twitter.com] -' - -while getopts -a "${progname}" "${shtwitter_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# expecting at least one more argument -(($# >= 1)) || usage - -typeset method="$1" -shift - -case "${method}" in - update|blog) put_twitter_message "$@" ; exit $? ;; - verify_credentials) verify_twitter_credentials "$@" ; exit $? ;; - *) usage ;; -esac - -fatal_error $"not reached." -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/simplefileattributetree1.sh b/usr/src/cmd/ast/libshell/common/scripts/simplefileattributetree1.sh deleted file mode 100644 index 8be1f0acf3..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/simplefileattributetree1.sh +++ /dev/null @@ -1,276 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# simplefileattributetree1 - build a simple file tree (including file attributes) -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - - -function add_file_to_tree -{ - typeset treename=$1 - typeset filename=$2 - nameref destnodename=$3 - integer i - typeset nodepath # full name of compound variable - typeset -a pe # path elements - - # first built an array containing the names of each path element - # (e.g. "foo/var/baz"" results in an array containing "( 'foo' 'bar' 'baz' )") - typeset IFS='/' - pe+=( ${filename} ) - - [[ ${pe[0]} == '' ]] && pe[0]='/' - - # walk path described via the "pe" array and build nodes if - # there aren't any nodes yet - nodepath="${treename}" - for (( i=0 ; i < (${#pe[@]}-1) ; i++ )) ; do - nameref x="${nodepath}" - - # [[ -v ]] does not work for arrays because [[ -v ar ]] - # is equal to [[ -v ar[0] ]]. In this case we can - # use the output of typeset +p x.nodes - [[ "${ typeset +p x.nodes ; }" == "" ]] && compound -A x.nodes - - nodepath+=".nodes[${pe[i]}]" - done - - # insert element - nameref node="${nodepath}" - [[ "${ typeset +p node.elements ; }" == "" ]] && compound -A node.elements - node.elements[${pe[i]}]=( - filepath="${filename}" - ) - - destnodename="${!node}.elements[${pe[i]}]" - - return 0 -} - -function parse_findls -{ - nameref out=$1 - typeset str="$2" - - # find -ls on Solaris uses the following output format by default: - #604302 3 -rw-r--r-- 1 test001 users 2678 May 9 00:46 ./httpsresdump - - integer out.inodenum="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\1}" - integer out.kbblocks="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\2}" - typeset out.mode="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\3}" - integer out.numlinks="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\4}" - compound out.owner=( - typeset user="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\5}" - typeset group="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\6}" - ) - integer out.filesize="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\7}" - typeset out.date="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\8}" - typeset out.filepath="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\9}" - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${simplefileattributetree1_usage}" OPT '-?' - exit 2 -} - -# main -builtin basename -builtin dirname - -set -o noglob -set -o nounset - -# tree base -compound filetree - -# benchmark data -compound bench=( - float start - float stop -) - -compound appconfig=( - typeset do_benchmarking=false - compound do_record=( - typeset content=false - typeset filetype=false - ) -) - - -integer i - -typeset progname="${ basename "${0}" ; }" - -typeset -r simplefileattributetree1_usage=$'+ -[-?\n@(#)\$Id: simplefileattributetree1 (Roland Mainz) 2010-03-27 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?simplefileattributetree1 - generate compound variable tree which contains file names and their attributes] -[+DESCRIPTION?\bsimplefileattributetree1\b is a simple variable tree - demo which builds a compound variable tree based on the output - of /usr/xpg4/bin/file which contains the file name, the file attributes - and optionally file type and content] -[b:benchmark?Print time needed to generate the tree.] -[c:includecontent?Include the file\'s content in the tree, split into 1kb blocks.] -[t:includefiletype?Include the file type (output of /usr/xpg4/bin/file).] - -path - -[+SEE ALSO?\bksh93\b(1), \bfile\b(1), \bfind\b(1)] -' - -while getopts -a "${progname}" "${simplefileattributetree1_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - b) appconfig.do_benchmarking="true" ;; - +b) appconfig.do_benchmarking="false" ;; - c) appconfig.do_record.content="true" ;; - +c) appconfig.do_record.content="false" ;; - t) appconfig.do_record.filetype="true" ;; - +t) appconfig.do_record.filetype="false" ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - - -# argument prechecks -if (( $# == 0 )) ; then - print -u2 -f "%s: Missing <path> argument.\n" "${progname}" - exit 1 -fi - - -print -u2 -f "# reading file names...\n" -while (( $# > 0 )) ; do - # "ulimit -c 0" use used to force ksh93 to use a seperate process for subshells, - # this is used to work around a bug with LC_ALL changes bleeding through subshells - IFS=$'\n' ; typeset -a findls_lines=( $(ulimit -c 0 ; LC_ALL=C find "$1" -type f -ls) ) ; IFS=$' \t\n' - shift -done - - -print -u2 -f "# building tree...\n" - -${appconfig.do_benchmarking} && (( bench.start=SECONDS )) - -for (( i=0 ; i < ${#findls_lines[@]} ; i++ )) ; do - compound parseddata - typeset treenodename - - # parse "find -ls" output - parse_findls parseddata "${findls_lines[i]}" - - # add node to tree and return it's absolute name in "treenodename" - add_file_to_tree filetree "${parseddata.filepath}" treenodename - - # merge parsed "find -ls" output into tree node - nameref treenode="${treenodename}" - treenode+=parseddata - - # extras (calculated from the existing values in "parseddata") - typeset treenode.dirname="${ dirname "${treenode.filepath}" ; }" - typeset treenode.basename="${ basename "${treenode.filepath}" ; }" - - if ${appconfig.do_record.filetype} ; then - # Using /usr/(xpg4/)*/bin/file requires a |fork()|+|exec()| which makes the script a few hundred times slower... ;-( - typeset treenode.filetype="$(file "${treenode.filepath}")" - fi - - if ${appconfig.do_record.content} ; then - if [[ -r "${treenode.filepath}" ]] ; then - # We use an array of compound variables here to support - # files with holes (and later alternative streams, too) - compound -a treenode.content - integer cl=0 - while \ - { - treenode.content[${cl}]=( - typeset type="data" # (todo: "add support for "holes" (sparse files)) - typeset -b bin - ) - read -n1024 treenode.content[${cl}].bin - } ; do - (( cl++ )) - done < "${treenode.filepath}" - unset treenode.content[${cl}] - - typeset -A treenode.hashsum=( - [md5]="$(sum -x md5 < "${treenode.filepath}")" - [sha512]="$(sum -x sha512 < "${treenode.filepath}")" - ) - - # we do this for internal debugging only - if [[ "${ { - integer j - for (( j=0 ; j < ${#treenode.content[@]} ; j++ )) ; do - printf "%B" treenode.content[$j].bin - done - } | sum -x sha512 ; }" != "${treenode.hashsum[sha512]}" ]] ; then - # this should never happen... - print -u2 -f "fatal hash mismatch for %s\n" "${treenode.filepath}" - unset treenode.content treenode.hashsum - fi - fi - fi -done - -${appconfig.do_benchmarking} && (( bench.stop=SECONDS )) - - -if ${appconfig.do_benchmarking} ; then - # print benchmark data - print -u2 -f "# time used: %f\n" $((bench.stop - bench.start)) -fi - -# print variable tree -print -v filetree - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/simplefiletree1.sh b/usr/src/cmd/ast/libshell/common/scripts/simplefiletree1.sh deleted file mode 100644 index d3c75d3652..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/simplefiletree1.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# simplefiletree1 - build a simple file tree -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - - -function add_file_to_tree -{ - typeset treename=$1 - typeset filename=$2 - integer i - typeset nodepath # full name of compound variable - typeset -a pe # path elements - - # first built an array containing the names of each path element - # (e.g. "foo/var/baz"" results in an array containing "( 'foo' 'bar' 'baz' )") - typeset IFS='/' - pe+=( ${filename} ) - - [[ ${pe[0]} == '' ]] && pe[0]='/' - - # walk path described via the "pe" array and build nodes if - # there aren't any nodes yet - nodepath="${treename}" - for (( i=0 ; i < (${#pe[@]}-1) ; i++ )) ; do - nameref x="${nodepath}" - - # [[ -v ]] does not work for arrays because [[ -v ar ]] - # is equal to [[ -v ar[0] ]]. In this case we can - # use the output of typeset +p x.nodes - [[ "${ typeset +p x.nodes ; }" == "" ]] && compound -A x.nodes - - nodepath+=".nodes[${pe[i]}]" - done - - # insert element - nameref node="${nodepath}" - [[ "${ typeset +p node.elements ; }" == "" ]] && typeset -a node.elements - node.elements+=( "${pe[i]}" ) - - return 0 -} - -# main -builtin rev - -# tree base -compound filetree - -# benchmark data -compound bench=( - float start - float stop -) - -typeset i - -# argument prechecks -if (( $# == 0 )) ; then - print -u2 -f "%s: Missing <path> argument." "$0" - exit 1 -fi - -print -u2 "# reading file names" -while (( $# > 0 )) ; do - IFS=$'\n' ; typeset -a filenames=( $(find "$1" -type f) ) ; IFS=$' \t\n' - shift -done -print -u2 "# building tree..." - -(( bench.start=SECONDS )) - -for ((i=0 ; i < ${#filenames[@]} ; i++ )) ; do - add_file_to_tree filetree "${filenames[i]}" -done - -(( bench.stop=SECONDS )) - -# print benchmark data -print -u2 -f "# time used: %f\n" $((bench.stop - bench.start)) - -# print tree -print -v filetree - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/svcproptree1.sh b/usr/src/cmd/ast/libshell/common/scripts/svcproptree1.sh deleted file mode 100644 index 11ee1577f6..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/svcproptree1.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - - -function svcproptovartree -{ - nameref tree=$1 - - typeset name - typeset servicename - typeset propname - - typeset datatype - - typeset -a fields - integer num_fields - integer i - - while IFS=' ' read -A fields ; do - num_fields=${#fields[*]} - - name="${fields[0]}" - datatype="${fields[1]}" - # parse service/property name - servicename="${name%~(Er):properties/.*}" - servicename="${servicename/~(El)svc:\//}" # strip "svc:/" - propname="${name#~(El).*:properties/}" - - [[ "${ typeset +p "tree[${servicename}].properties" ; }" == "" ]] && compound -A tree[${servicename}].properties - - nameref node=tree[${servicename}].properties[${propname}] - - node=( - typeset datatype="${datatype}" - typeset valuelist="true" - typeset -a values - ) - - for (( i=2 ; i < num_fields ; i++ )) ; do - node.values+=( "${fields[i]}" ) - done - done - - return 0 -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${svcproptree1_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date -builtin uname - -typeset progname="${ basename "${0}" ; }" - -typeset -r svcproptree1_usage=$'+ -[-?\n@(#)\$Id: svcproptree1 (Roland Mainz) 2010-04-02 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?svcproptree1 - SMF tree demo] -[+DESCRIPTION?\bsvcproptree1\b is a small ksh93 compound variable demo - which reads accepts a SMF service pattern name input file, - reads the matching service properties and converts them into an internal - variable tree representation and outputs it in the format - specified by viewmode (either "list", "namelist", "tree" or "compacttree")..] - -pattern viewmode - -[+SEE ALSO?\bksh93\b(1), \bsvcprop\b(1)] -' - -while getopts -a "${progname}" "${svcproptree1_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -typeset svcpattern="$1" -typeset viewmode="$2" - -if [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then - fatal_error $"Invalid view mode \"${viewmode}\"." -fi - -compound svc=( - typeset -A proptree -) - -typeset s - -s="$(/usr/bin/svcprop -f "${svcpattern}")" || fatal_error $"svcprop failed with exit code $?." -print -u2 $"#loading completed." - -print -r -- "$s" | svcproptovartree svc.proptree -print -u2 $"#parsing completed." - -case "${viewmode}" in - list) - set | egrep "^svc.proptree\[" | fgrep -v ']=$' - ;; - namelist) - typeset + | egrep "^svc.proptree\[" - ;; - tree) - print -v svc - ;; - compacttree) - print -C svc - ;; - *) - fatal_error $"Invalid view mode \"${viewmode}\"." - ;; -esac - -print -u2 $"#done." - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/termclock.sh b/usr/src/cmd/ast/libshell/common/scripts/termclock.sh deleted file mode 100644 index e9b84a70a1..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/termclock.sh +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# termclock - a simple analog clock for terminals -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -# Make sure all math stuff runs in the "C" locale to avoid problems -# with alternative # radix point representations (e.g. ',' instead of -# '.' in de_DE.*-locales). This needs to be set _before_ any -# floating-point constants are defined in this script). -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C - -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} - -# cache tput values (to avoid |fork()|'ing a "tput" child every second) -function tput_cup -{ - # static variable as cache for "tput_cup" - typeset -S -A tput_cup_cache - - integer y="$1" x="$2" - nameref c="tput_cup_cache[\"${y}_${x}\"]" - - if [[ "$c" == "" ]] ; then - # fast path for known terminal types - if [[ ${TERM} == ~(Elr)(vt100|vt220|xterm|xterm-color|dtterm) ]] ; then - c="${ printf "\E[%d;%dH" y+1 x+1 ; }" - else - c="${ tput cup $y $x ; }" - fi - fi - - print -r -n -- "$c" - return 0 -} - -# Get terminal size and put values into a compound variable with the integer -# members "columns" and "lines" -function get_term_size -{ - nameref rect=$1 - - rect.columns=${ tput cols ; } || return 1 - rect.lines=${ tput lines ; } || return 1 - - return 0 -} - -function draw_clock -{ - float angle a - float x y - integer i=1 - - for(( angle=0.0 ; angle < 360. ; angle+=6 )) ; do - (( - a=angle/360.*(2*M_PI) , - - x=clock.len_x*cos(a) , - y=clock.len_y*sin(a) - )) - - tput_cup $(( y+clock.middle_y )) $(( x+clock.middle_x )) - - # add "mark" every 30 degrees - if (( int(angle)%30 == 0 )) ; then - print -r -n "$(((++i)%12+1))" - else - print -r -n "x" - fi - done - return 0 -} - -function draw_hand -{ - float angle="$1" a - typeset ch="$2" - float length="$3" - float x y - - (( a=angle/360.*(2*M_PI) )) - - for (( s=0.0 ; s < 10. ; s+=0.5 )) ; do - (( - x=(clock.len_x*(s/10.)*(length/100.))*cos(a) , - y=(clock.len_y*(s/10.)*(length/100.))*sin(a) - )) - - tput_cup $(( y+clock.middle_y )) $(( x+clock.middle_x )) - print -r -n -- "${ch}" - done - return 0 -} - -function draw_clock_hand -{ - nameref hand=$1 - draw_hand $(( 360.*(hand.val/hand.scale)-90. )) "${hand.ch}" ${hand.length} - return 0 -} - -function clear_clock_hand -{ - nameref hand=$1 - draw_hand $(( 360.*(hand.val/hand.scale)-90. )) " " ${hand.length} - return 0 -} - -function main_loop -{ - typeset c - - # note: we can't use subshells when writing to the double-buffer file because this - # will render the tput value cache useless - while true ; do - if ${init_screen} ; then - init_screen="false" - - get_term_size termsize || fatal_error $"Couldn't get terminal size." - - (( - clock.middle_x=termsize.columns/2.-.5 , - clock.middle_y=termsize.lines/2.-.5 , - clock.len_x=termsize.columns/2-2 , - clock.len_y=termsize.lines/2-2 , - )) - - { - clear - draw_clock - } >&6 - fi - - { - (( ${ date +"hours.val=%H , minutes.val=%M , seconds.val=%S" ; } )) - - # small trick to get a smooth "analog" flair - (( - hours.val+=minutes.val/60. , - minutes.val+=seconds.val/60. - )) - - draw_clock_hand seconds - draw_clock_hand minutes - draw_clock_hand hours - - # move cursor to home position - tput_cup 0 0 - } >&6 - - 6<#((0)) - cat <&6 - - redirect 6<&- ; rm -f "${scratchfile}" ; redirect 6<> "${scratchfile}" - - c="" ; read -r -t ${update_interval} -N 1 c - if [[ "$c" != "" ]] ; then - case "$c" in - ~(Fi)q | $'\E') return 0 ;; - esac - fi - - { - clear_clock_hand hours - clear_clock_hand minutes - clear_clock_hand seconds - } >&6 - done -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${termclock_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date -builtin mktemp -builtin rm - -typeset progname="${ basename "${0}" ; }" - -float -r M_PI=3.14159265358979323846 - -# terminal size rect -compound termsize=( - integer columns=-1 - integer lines=-1 -) - -typeset init_screen="true" - -compound clock=( - float middle_x - float middle_y - integer len_x - integer len_y -) - - -# set clock properties -compound seconds=( - float val - typeset ch - float scale - integer length ) -compound minutes=( - float val - typeset ch - float scale - integer length ) -compound hours=( - float val - typeset ch - float scale - integer length ) - -seconds.length=90 seconds.scale=60 seconds.ch=$"s" -minutes.length=75 minutes.scale=60 minutes.ch=$"m" -hours.length=50 hours.scale=12 hours.ch=$"h" - -float update_interval=0.9 - -typeset -r termclock_usage=$'+ -[-?\n@(#)\$Id: termclock (Roland Mainz) 2009-12-02 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[-author?David Korn <dgk@research.att.com>] -[+NAME?termclock - analog clock for terminals] -[+DESCRIPTION?\btermclock\b is an analog clock for terminals. - The termclock program displays the time in analog or digital - form. The time is continuously updated at a frequency which - may be specified by the user.] -[u:update?Update interval (defaults to 0.9 seconds).]:[interval] -[+SEE ALSO?\bksh93\b(1), \bxclock\b(1)] -' - -while getopts -a "${progname}" "${termclock_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - u) update_interval=${OPTARG} ;; - *) usage ;; - esac -done -shift $((OPTIND-1)) - -# prechecks -which tput >/dev/null || fatal_error $"tput not found." -(( update_interval >= 0. && update_interval <= 7200. )) || fatal_error $"invalid update_interval value." - -# create temporary file for double-buffering and register an EXIT trap -# to remove this file when the shell interpreter exits -scratchfile="${ mktemp -t "termclock.ppid${PPID}_pid$$.XXXXXX" ; }" -[[ "${scratchfile}" != "" ]] || fatal_error $"Could not create temporary file name." -trap 'rm -f "${scratchfile}"' EXIT -rm -f "${scratchfile}" ; redirect 6<> "${scratchfile}" || fatal_error $"Could not create temporary file." - -# register trap to handle window size changes -trap 'init_screen="true"' WINCH - -main_loop - -# exiting - put cursor below clock -tput_cup $((termsize.lines-2)) 0 - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/test_net_sctp.sh b/usr/src/cmd/ast/libshell/common/scripts/test_net_sctp.sh deleted file mode 100644 index 6b863d5fbc..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/test_net_sctp.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# -# test_net_sctp - a simple ksh93 SCTP demo -# - -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -set -o xtrace -set -o errexit - -# declare variables -integer netfd -typeset request - -# print intro -print "# testing SCTP support" -print "# (via fetching the main page of http://www.sctp.org/ via SCTP)" - -# open sctp stream and print it's number -redirect {netfd}<> /dev/sctp/www.sctp.org/80 -print "sctp fd=${netfd}" - -# send HTTP request -request="GET / HTTP/1.1\r\n" -request+="Host: www.sctp.org\r\n" -request+="User-Agent: ksh93/test_net_sctp (2009-04-08; $(uname -s -r -p))\r\n" -request+="Connection: close\r\n" -print -u${netfd} -n -- "${request}\r\n" - -# print response to stdout -cat <&${netfd} - -# close connection -redirect {netfd}<&- - -print "#done" - -#EOF. diff --git a/usr/src/cmd/ast/libshell/common/scripts/xmldocumenttree1.sh b/usr/src/cmd/ast/libshell/common/scripts/xmldocumenttree1.sh deleted file mode 100644 index e527fed85f..0000000000 --- a/usr/src/cmd/ast/libshell/common/scripts/xmldocumenttree1.sh +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/ksh93 - -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin - -function fatal_error -{ - print -u 2 "${progname}: $*" - exit 1 -} - -function attrstrtoattrarray -{ -#set -o xtrace - typeset s="$1" - nameref aa=$2 # attribute array - integer aa_count=0 - integer aa_count=0 - typeset nextattr - integer currattrlen=0 - typeset tagstr - typeset tagval - - while (( ${#s} > 0 )) ; do - # skip whitespaces - while [[ "${s:currattrlen:1}" == ~(E)[[:blank:][:space:]] ]] ; do - (( currattrlen++ )) - done - s="${s:currattrlen:${#s}}" - - # anything left ? - (( ${#s} == 0 )) && break - - # Pattern tests: - #x="foo=bar huz=123" ; print "${x##~(E)[[:alnum:]_-:]*=[^[:blank:]\"]*}" - #x='foo="ba=r o" huz=123' ; print "${x##~(E)[[:alnum:]_-:]*=\"[^\"]*\"}" - #x="foo='ba=r o' huz=123" ; print "${x##~(E)[[:alnum:]_-:]*=\'[^\"]*\'}" - #x="foox huz=123" ; print "${x##~(E)[[:alnum:]_-:]*}" - # All pattern combined via eregex (w|x|y|z): - #x='foo="bar=o" huz=123' ; print "${x##~(E)([[:alnum:]_-:]*=[^[:blank:]\"]*|[[:alnum:]_-:]*=\"[^\"]*\"|[[:alnum:]_-:]*=\'[^\"]*\')}" - nextattr="${s##~(E)([[:alnum:]_-:]*=[^[:blank:]\"]*|[[:alnum:]_-:]*=\"[^\"]*\"|[[:alnum:]_-:]*=\'[^\"]*\'|[[:alnum:]_-:]*)}" - currattrlen=$(( ${#s} - ${#nextattr})) - - # add entry - tagstr="${s:0:currattrlen}" - if [[ "${tagstr}" == *=* ]] ; then - # normal case: attribute with value - - tagval="${tagstr#*=}" - - # strip quotes ('' or "") - if [[ "${tagval}" == ~(Elr)(\'.*\'|\".*\") ]] ; then - tagval="${tagval:1:${#tagval}-2}" - fi - - aa[${aa_count}]=( name="${tagstr%%=*}" value="${tagval}" ) - else - # special case for HTML where you have something like <foo baz> - aa[${aa_count}]=( name="${tagstr}" ) - fi - (( aa_count++ )) - (( aa_count > 1000 )) && fatal_error "$0: aa_count too large" # assert - done -} - - -function handle_document -{ -#set -o xtrace - nameref callbacks=${1} - typeset tag_type="${2}" - typeset tag_value="${3}" - typeset tag_attributes="${4}" - nameref doc=${callbacks["arg_tree"]} - nameref nodepath="${stack.items[stack.pos]}" - nameref nodesnum="${stack.items[stack.pos]}num" - - case "${tag_type}" in - tag_begin) - nodepath[${nodesnum}]+=( - typeset tagtype="element" - typeset tagname="${tag_value}" - compound -A tagattributes - compound -A nodes - integer nodesnum=0 - ) - - # fill attributes - if [[ "${tag_attributes}" != "" ]] ; then - attrstrtoattrarray "${tag_attributes}" "nodepath[${nodesnum}].tagattributes" - fi - - (( stack.pos++ )) - stack.items[stack.pos]="${stack.items[stack.pos-1]}[${nodesnum}].nodes" - (( nodesnum++ )) - ;; - tag_end) - (( stack.pos-- )) - ;; - tag_text) - nodepath[${nodesnum}]+=( - typeset tagtype="text" - typeset tagvalue="${tag_value}" - ) - (( nodesnum++ )) - ;; - tag_comment) - nodepath[${nodesnum}]+=( - typeset tagtype="comment" - typeset tagvalue="${tag_value}" - ) - (( nodesnum++ )) - ;; - document_start) - ;; - document_end) - ;; - esac - -# print "xmltok: '${tag_type}' = '${tag_value}'" -} - -function xml_tok -{ - typeset buf="" - typeset namebuf="" - typeset attrbuf="" - typeset c="" - typeset isendtag # bool: true/false - typeset issingletag # bool: true/false (used for tags like "<br />") - nameref callbacks=${1} - - [[ ! -z "${callbacks["document_start"]}" ]] && ${callbacks["document_start"]} "${1}" "document_start" - - while IFS='' read -r -N 1 c ; do - isendtag=false - - if [[ "$c" == "<" ]] ; then - # flush any text content - if [[ "$buf" != "" ]] ; then - [[ ! -z "${callbacks["tag_text"]}" ]] && ${callbacks["tag_text"]} "${1}" "tag_text" "$buf" - buf="" - fi - - IFS='' read -r -N 1 c - if [[ "$c" == "/" ]] ; then - isendtag=true - else - buf="$c" - fi - IFS='' read -r -d '>' c - buf+="$c" - - # handle comments - if [[ "$buf" == ~(El)!-- ]] ; then - # did we read the comment completely ? - if [[ "$buf" != ~(Elr)!--.*-- ]] ; then - buf+=">" - while [[ "$buf" != ~(Elr)!--.*-- ]] ; do - IFS='' read -r -N 1 c || break - buf+="$c" - done - fi - - [[ ! -z "${callbacks["tag_comment"]}" ]] && ${callbacks["tag_comment"]} "${1}" "tag_comment" "${buf:3:${#buf}-5}" - buf="" - continue - fi - - # check if the tag starts and ends at the same time (like "<br />") - if [[ "${buf}" == ~(Er).*/ ]] ; then - issingletag=true - buf="${buf%*/}" - else - issingletag=false - fi - - # check if the tag has attributes (e.g. space after name) - if [[ "$buf" == ~(E)[[:space:][:blank:]] ]] ; then - namebuf="${buf%%~(E)[[:space:][:blank:]].*}" - attrbuf="${buf#~(E).*[[:space:][:blank:]]}" - else - namebuf="$buf" - attrbuf="" - fi - - if ${isendtag} ; then - [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" - else - [[ ! -z "${callbacks["tag_begin"]}" ]] && ${callbacks["tag_begin"]} "${1}" "tag_begin" "$namebuf" "$attrbuf" - - # handle tags like <br/> (which are start- and end-tag in one piece) - if ${issingletag} ; then - [[ ! -z "${callbacks["tag_end"]}" ]] && ${callbacks["tag_end"]} "${1}" "tag_end" "$namebuf" - fi - fi - buf="" - else - buf+="$c" - fi - done - - [[ ! -z "${callbacks["document_end"]}" ]] && ${callbacks["document_end"]} "${1}" "document_end" "exit_success" - - print # final newline to make filters like "sed" happy -} - -function print_sample1_xml -{ -cat <<EOF -<br /> -<score-partwise instrument="flute1"> - <identification> - <kaiman>nocrocodile</kaiman> - </identification> - <!-- a comment --> - <partlist> - <foo>myfootext</foo> - <bar>mybartext</bar> - <snap /> - <!-- another - comment --> - <ttt>myttttext</ttt> - </partlist> -</score-partwise> -EOF -} - -function usage -{ - OPTIND=0 - getopts -a "${progname}" "${xmldocumenttree1_usage}" OPT '-?' - exit 2 -} - -# program start -builtin basename -builtin cat -builtin date -builtin uname - -typeset progname="${ basename "${0}" ; }" - -typeset -r xmldocumenttree1_usage=$'+ -[-?\n@(#)\$Id: xmldocumenttree1 (Roland Mainz) 2009-05-09 \$\n] -[-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?xmldocumenttree1 - XML tree demo] -[+DESCRIPTION?\bxmldocumenttree\b is a small ksh93 compound variable demo - which reads a XML input file, converts it into an internal - variable tree representation and outputs it in the format - specified by viewmode (either "list", "namelist", "tree" or "compacttree").] - -file viewmode - -[+SEE ALSO?\bksh93\b(1)] -' - -while getopts -a "${progname}" "${xmldocumenttree1_usage}" OPT ; do -# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" - case ${OPT} in - *) usage ;; - esac -done -shift $((OPTIND-1)) - -typeset xmlfile="$1" -typeset viewmode="$2" - -if [[ "${xmlfile}" == "" ]] ; then - fatal_error $"No file given." -fi - -if [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then - fatal_error $"Invalid view mode \"${viewmode}\"." -fi - -compound xdoc -compound -A xdoc.nodes -integer xdoc.nodesnum=0 - -compound stack -typeset -a stack.items=( [0]="doc.nodes" ) -integer stack.pos=0 - -# setup callbacks for xml_tok -typeset -A document_cb # callbacks for xml_tok -document_cb["document_start"]="handle_document" -document_cb["document_end"]="handle_document" -document_cb["tag_begin"]="handle_document" -document_cb["tag_end"]="handle_document" -document_cb["tag_text"]="handle_document" -document_cb["tag_comment"]="handle_document" -# argument for "handle_document" -document_cb["arg_tree"]="xdoc" - - -if [[ "${xmlfile}" == "#sample1" ]] ; then - print_sample1_xml | xml_tok document_cb -elif [[ "${xmlfile}" == "#sample2" ]] ; then - /usr/sfw/bin/wget \ - --user-agent='ksh93_xmldocumenttree' \ - --output-document=- \ - 'http://www.google.com/custom?q=gummi+bears' | - /usr/bin/iconv -f "ISO8859-1" | - xml_tok document_cb -else - cat "${xmlfile}" | xml_tok document_cb -fi - -print -u2 "#parsing completed." - -case "${viewmode}" in - list) - set | egrep "xdoc.*(tagname|tagtype|tagval|tagattributes)" | fgrep -v ']=$' - ;; - namelist) - typeset + | egrep "xdoc.*(tagname|tagtype|tagval|tagattributes)" - ;; - tree) - print -v xdoc - ;; - compacttree) - print -C xdoc - ;; - *) - fatal_error $"Invalid view mode \"${viewmode}\"." - ;; -esac - -print -u2 "#done." - -exit 0 -# EOF. diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/1.png b/usr/src/cmd/ast/libshell/misc/images/callouts/1.png Binary files differdeleted file mode 100644 index 608fad3596..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/1.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/10.png b/usr/src/cmd/ast/libshell/misc/images/callouts/10.png Binary files differdeleted file mode 100644 index 39e55197cf..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/10.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/2.png b/usr/src/cmd/ast/libshell/misc/images/callouts/2.png Binary files differdeleted file mode 100644 index 5444738841..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/2.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/3.png b/usr/src/cmd/ast/libshell/misc/images/callouts/3.png Binary files differdeleted file mode 100644 index 64b87c7151..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/3.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/4.png b/usr/src/cmd/ast/libshell/misc/images/callouts/4.png Binary files differdeleted file mode 100644 index c308193ac4..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/4.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/5.png b/usr/src/cmd/ast/libshell/misc/images/callouts/5.png Binary files differdeleted file mode 100644 index 24799f0a43..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/5.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/6.png b/usr/src/cmd/ast/libshell/misc/images/callouts/6.png Binary files differdeleted file mode 100644 index 8919a670cd..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/6.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/7.png b/usr/src/cmd/ast/libshell/misc/images/callouts/7.png Binary files differdeleted file mode 100644 index e30e8a70cb..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/7.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/8.png b/usr/src/cmd/ast/libshell/misc/images/callouts/8.png Binary files differdeleted file mode 100644 index 3e35c8827c..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/8.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/callouts/9.png b/usr/src/cmd/ast/libshell/misc/images/callouts/9.png Binary files differdeleted file mode 100644 index ed2f14b4eb..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/callouts/9.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_bourne.png b/usr/src/cmd/ast/libshell/misc/images/tag_bourne.png Binary files differdeleted file mode 100644 index f1f78e3a25..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_bourne.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_i18n.png b/usr/src/cmd/ast/libshell/misc/images/tag_i18n.png Binary files differdeleted file mode 100644 index 559929df2a..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_i18n.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_ksh.png b/usr/src/cmd/ast/libshell/misc/images/tag_ksh.png Binary files differdeleted file mode 100644 index b33d5a7aa1..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_ksh.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_ksh88.png b/usr/src/cmd/ast/libshell/misc/images/tag_ksh88.png Binary files differdeleted file mode 100644 index d36dc0f5f5..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_ksh88.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_ksh93.png b/usr/src/cmd/ast/libshell/misc/images/tag_ksh93.png Binary files differdeleted file mode 100644 index 357ee3c50a..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_ksh93.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_l10n.png b/usr/src/cmd/ast/libshell/misc/images/tag_l10n.png Binary files differdeleted file mode 100644 index be89f7a163..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_l10n.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/images/tag_perf.png b/usr/src/cmd/ast/libshell/misc/images/tag_perf.png Binary files differdeleted file mode 100644 index fcb2960852..0000000000 --- a/usr/src/cmd/ast/libshell/misc/images/tag_perf.png +++ /dev/null diff --git a/usr/src/cmd/ast/libshell/misc/shell_styleguide.docbook b/usr/src/cmd/ast/libshell/misc/shell_styleguide.docbook deleted file mode 100644 index 74bc7501b5..0000000000 --- a/usr/src/cmd/ast/libshell/misc/shell_styleguide.docbook +++ /dev/null @@ -1,1464 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd" [ - <!ENTITY tag_bourneonly '<inlinemediaobject><imageobject><imagedata fileref="images/tag_bourne.png"></imagedata></imageobject><textobject><phrase>[Bourne]</phrase></textobject></inlinemediaobject> '> - <!ENTITY tag_kshonly '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh.png"></imagedata></imageobject><textobject><phrase>[ksh]</phrase></textobject></inlinemediaobject> '> - <!ENTITY tag_ksh88only '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh88.png"></imagedata></imageobject><textobject><phrase>[ksh88]</phrase></textobject></inlinemediaobject> '> - <!ENTITY tag_ksh93only '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh93.png"></imagedata></imageobject><textobject><phrase>[ksh93]</phrase></textobject></inlinemediaobject> '> - <!ENTITY tag_performance '<inlinemediaobject><imageobject><imagedata fileref="images/tag_perf.png"></imagedata></imageobject><textobject><phrase>[perf]</phrase></textobject></inlinemediaobject> '> - <!ENTITY tag_i18n '<inlinemediaobject><imageobject><imagedata fileref="images/tag_i18n.png"></imagedata></imageobject><textobject><phrase>[i18n]</phrase></textobject></inlinemediaobject> '> - <!ENTITY tag_l10n '<inlinemediaobject><imageobject><imagedata fileref="images/tag_l10n.png"></imagedata></imageobject><textobject><phrase>[l10n]</phrase></textobject></inlinemediaobject> '> -]> -<!-- - - CDDL HEADER START - - The contents of this file are subject to the terms of the - Common Development and Distribution License (the "License"). - You may not use this file except in compliance with the License. - - You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - or http://www.opensolaris.org/os/licensing. - See the License for the specific language governing permissions - and limitations under the License. - - When distributing Covered Code, include this CDDL HEADER in each - file and include the License file at usr/src/OPENSOLARIS.LICENSE. - If applicable, add the following below this CDDL HEADER, with the - fields enclosed by brackets "[]" replaced with your own identifying - information: Portions Copyright [yyyy] [name of copyright owner] - - CDDL HEADER END - ---> - -<!-- - - Copyright 2009 Sun Microsystems, Inc. All rights reserved. - Use is subject to license terms. - ---> - -<!-- tag images were created like this: -$ (text="perf" ; - pbmtext -nomargins -lspace 0 -builtin fixed "${text}" | - pbmtopgm 1 1 | - pgmtoppm 1.0,1.0,1.0-0,0,0 /dev/stdin | - ppmtogif | - giftopnm | - pnmtopng >"tag_${text}.png") ---> - -<!-- compile with: -xsltproc −−stringparam generate.section.toc.level 0 \ - −−stringparam toc.max.depth 3 \ - −−stringparam toc.section.depth 12 \ - −−xinclude -o opensolaris_shell_styleguide.html /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.69.1/html/docbook.xsl opensolaris_shell_styleguide.docbook ---> - -<article - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns="http://docbook.org/ns/docbook" - xml:lang="en"> - <!-- xmlns:xi="http://www.w3.org/2001/XInclude" --> - - <info> - <title><emphasis>[DRAFT]</emphasis> Bourne/Korn Shell Coding Conventions</title> - - <!-- subtitle abuse --> - <subtitle> - This page is currently work-in-progress until it is approved by the OS/Net community. Please send any comments to - <email>shell-discuss@opensolaris.org</email>. - </subtitle> - - - <authorgroup> -<!-- - <author><personname>David G. Korn</personname><email>dgk@research.att.com</email></author> - <author><personname>Roland Mainz</personname><email>roland.mainz@nrubsig.org</email></author> - <author><personname>Mike Shapiro</personname><email>mike.shapiro@sun.com</email></author> ---> - <author><orgname>OpenSolaris.org</orgname></author> - </authorgroup> - </info> - -<section xml:id="intro"> - <title>Intro</title> - <para>This document describes the shell coding style used for all the SMF script changes integrated into (Open)Solaris.</para> - <para>All new SMF shell code should conform to this coding standard, which is intended to match our existing C coding standard.</para> - <para>When in doubt, think "what would be the C-Style equivalent ?" and "What does the POSIX (shell) standard say ?"</para> -</section><!-- end of intro --> - - -<section xml:id="rules"> - <title>Rules</title> - - - - <section xml:id="general"> - <title>General</title> - - <section xml:id="basic_format"> - <title>Basic Format</title> - <para>Similar to <literal>cstyle</literal>, the basic format is that all - lines are indented by TABs or eight spaces, and continuation lines (which - in the shell end with "\") are indented by an equivalent number of TABs - and then an additional four spaces, e.g. -<programlisting> -cp foo bar -cp some_realllllllllllllllly_realllllllllllllly_long_path \ - to_another_really_long_path -</programlisting> - </para> - <para>The encoding used for the shell scripts is either <literal>ASCII</literal> - or <literal>UTF-8</literal>, alternative encodings are only allowed when the - application requires this.</para> - </section> - - - <section xml:id="commenting"> - <title>Commenting</title> - <para>Shell comments are preceded by the '<literal>#</literal>' character. Place - single-line comments in the right-hand margin. Use an extra '<literal>#</literal>' - above and below the comment in the case of multi-line comments: -<programlisting> -cp foo bar # Copy foo to bar - -# -# Modify the permissions on bar. We need to set them to root/sys -# in order to match the package prototype. -# -chown root bar -chgrp sys bar -</programlisting> - </para> - </section> - - - <section xml:id="interpreter_magic"> - <title>Interpreter magic</title> - <para>The proper interpreter magic for your shell script should be one of these: -<programlisting> -#!/bin/sh Standard Bourne shell script -#!/bin/ksh -p Standard Korn shell 88 script. You should always write ksh - scripts with -p so that ${ENV} (if set by the user) is not - sourced into your script by the shell. -#!/bin/ksh93 Standard Korn shell 93 script (-p is not needed since ${ENV} is - only used for interactive shell sessions). -</programlisting> - </para> - </section> - - - <section xml:id="harden_your_script_against_unexpected_input"> - <title>Harden the script against unexpected (user) input</title> - <para>Harden your script against unexpected (user) input, including - command line options, filenames with blanks (or other special - characters) in the name, or file input</para> - </section> - - - <section xml:id="use_builtin_commands"> - <title>&tag_kshonly;&tag_performance;Use builtin commands if the shell provides them</title> - <para> - Use builtin commands if the shell provides them. For example ksh93s+ - (ksh93, version 's+') delivered with Solaris (as defined by PSARC 2006/550) - supports the following builtins: - <simplelist type="inline"> - <member>basename</member> - <member>cat</member> - <member>chgrp</member> - <member>chmod</member> - <member>chown</member> - <member>cmp</member> - <member>comm</member> - <member>cp</member> - <member>cut</member> - <member>date</member> - <member>dirname</member> - <member>expr</member> - <member>fds</member> - <member>fmt</member> - <member>fold</member> - <member>getconf</member> - <member>head</member> - <member>id</member> - <member>join</member> - <member>ln</member> - <member>logname</member> - <member>mkdir</member> - <member>mkfifo</member> - <member>mv</member> - <member>paste</member> - <member>pathchk</member> - <member>rev</member> - <member>rm</member> - <member>rmdir</member> - <member>stty</member> - <member>tail</member> - <member>tee</member> - <member>tty</member> - <member>uname</member> - <member>uniq</member> - <member>wc</member> - <member>sync</member> - </simplelist> - Those builtins can be enabled via <literal>$ builtin name_of_builtin #</literal> in shell - scripts (note that ksh93 builtins implement exact POSIX behaviour - some - commands in Solaris <filename>/usr/bin/</filename> directory implement pre-POSIX behaviour. - Add <literal>/usr/xpg6/bin/:/usr/xpg4/bin</literal> before - <filename>/usr/bin/</filename> in <envar>${PATH}</envar> to test whether your script works with - the XPG6/POSIX versions) - </para> - </section> - - - <section xml:id="use_blocks_not_subshells"> - <title>&tag_performance;Use blocks and not subshells if possible</title> - <para>Use blocks and not subshells if possible, e.g. use - <literal>$ { print "foo" ; print "bar" ; }</literal> instead of - <literal>$ (print "foo" ; print "bar") #</literal> - blocks are - faster since they do not require to save the subshell context (ksh93) or - trigger a shell child process (Bourne shell, bash, ksh88 etc.) - </para> - </section> - - - <section xml:id="use_long_options_for_set_builtin"> - <title>&tag_kshonly; use long options for "<literal>set</literal>"</title> - <para>use long options for "<literal>set</literal>", for example instead of <literal>$ set -x #</literal> - use <literal>$ set -o xtrace #</literal> to make the code more readable.</para> - </section> - - - <section xml:id="use_posix_command_substitutions_syntax"> - <title>&tag_kshonly; Use <literal>$(...)</literal> instead of <literal>`...`</literal> command substitutions</title> - <para>Use <literal>$(...)</literal> instead of <literal>`...`</literal> - <literal>`...`</literal> - is an obsolete construct in ksh+POSIX sh scripts and <literal>$(...)</literal>.is a cleaner design, - requires no escaping rules, allows easy nesting etc.</para> - - <note><title>&tag_ksh93only; <literal>${ ...;}</literal>-style command substitutions</title> - <para>ksh93 has support for an alternative version of command substitutions with the - syntax <literal>${ ...;}</literal> which do not run in a subshell. - </para></note> - </section> - - - <section xml:id="put_command_substitution_result_in_quotes"> - <title>&tag_kshonly; Always put the result of a <literal>$(...)</literal> or - <literal>$( ...;)</literal> command substitution in quotes</title> - <para>Always put the result of <literal>$( ... )</literal> or <literal>$( ...;)</literal> in - quotes (e.g. <literal>foo="$( ... )"</literal> or <literal>foo="$( ...;)"</literal>) unless - there is a very good reason for not doing it</para> - </section> - - - <section xml:id="always_set_path"> - <title>Scripts should always set their <envar>PATH</envar></title> - <para>Scripts should always set their <envar>PATH</envar> to make sure they do not use - alternative commands by accident (unless the value of <envar>PATH</envar> is well-known - and guaranteed to be set by the caller)</para> - </section> - - - <section xml:id="make_sure_commands_are_available"> - <title>Make sure that commands from other packages/applications are really installed on the machine</title> - <para>Scripts should make sure that commands in optional packages are really - there, e.g. add a "precheck" block in scipts to avoid later failure when - doing the main job</para> - </section> - - - <section xml:id="check_usage_of_boolean_variables"> - <title>Check how boolean values are used/implemented in your application</title> - <para>Check how boolean values are used in your application.</para> - <para>For example: -<programlisting> -mybool=0 -# do something -if [ $mybool -eq 1 ] ; then do_something_1 ; fi -</programlisting> -could be rewritten like this: -<programlisting> -mybool=false # (valid values are "true" or "false", pointing -# to the builtin equivalents of /bin/true or /bin/false) -# do something -if ${mybool} ; then do_something_1 ; fi -</programlisting> -or -<programlisting> -integer mybool=0 # values are 0 or 1 -# do something -if (( mybool==1 )) ; then do_something_1 ; fi -</programlisting> - </para> - </section> - - <section xml:id="shell_uses_characters_not_bytes"> - <title>&tag_i18n;The shell always operates on <emphasis>characters</emphasis> not bytes</title> - <para>Shell scripts operate on characters and <emphasis>not</emphasis> bytes. - Some locales use multiple bytes (called "multibyte locales") to represent one character</para> - - <note><para>ksh93 has support for binary variables which explicitly - operate on bytes, not characters. This is the <emphasis>only</emphasis> allowed - exception.</para></note> - </section> - - - <section xml:id="multibyte_locale_input"> - <title>&tag_i18n;Multibyte locales and input</title> - <para>Think about whether your application has to handle file names or - variables in multibyte locales and make sure all commands used in your - script can handle such characters (e.g. lots of commands in Solaris's - <filename>/usr/bin/</filename> are <emphasis>not</emphasis> able to handle such values - either use ksh93 - builtin constructs (which are guaranteed to be multibyte-aware) or - commands from <filename>/usr/xpg4/bin/</filename> and/or <filename>/usr/xpg6/bin</filename>) - </para> - </section> - - - <section xml:id="use_external_filters_only_for_large_datasets"> - <title>&tag_performance;Only use external filters like <literal>grep</literal>/<literal>sed</literal>/<literal>awk</literal>/etc. - if you want to process lots of data with them</title> - <para>Only use external filters like <literal>grep</literal>/<literal>sed</literal>/<literal>awk</literal>/etc. - if a significant amount of data is processed by the filter or if - benchmarking shows that the use of builtin commands is significantly slower - (otherwise the time and resources needed to start the filter are - far greater then the amount of data being processed, - creating a performance problem).</para> - <para>For example: -<programlisting> -if [ "$(echo "$x" | egrep '.*foo.*')" != "" ] ; then - do_something ; -done -</programlisting> -can be re-written using ksh93 builtin constructs, saving several -<literal>|fork()|+|exec()|</literal>'s: -<programlisting> -if [[ "${x}" == ~(E).*foo.* ]] ; then - do_something ; -done -</programlisting> - </para> - </section> - - - <section xml:id="use_dashdash_if_first_arg_is_variable"> - <title>If the first operand of a command is a variable, use <literal>--</literal></title> - <para>If the first operand of a command is a variable, use <literal>--</literal> - for any command that accepts this as end of argument to - avoid problems if the variable expands to a value starting with <literal>-</literal>. - </para> - <note><para> - At least - <simplelist type="inline"> - <member>print</member> - <member>/usr/bin/fgrep</member> - <member>/usr/bin/grep</member> - <member>/usr/bin/egrep</member> - </simplelist> - support <literal>--</literal> as "end of arguments"-terminator. - </para></note> - </section> - - <section xml:id="use_export"> - <title>&tag_kshonly;&tag_performance;Use <literal>$ export FOOBAR=val #</literal> instead of - <literal>$ FOOBAR=val ; export FOOBAR #</literal></title> - <para>Use <literal>$ export FOOBAR=val # instead of $ FOOBAR=val ; export FOOBAR #</literal> - - this is much faster.</para> - </section> - - - <section xml:id="use_subshell_around_set_dashdash_usage"> - <title>Use a subshell (e.g. <literal>$ ( mycmd ) #</literal>) around places which use - <literal>set -- $(mycmd)</literal> and/or <literal>shift</literal></title> - <para>Use a subshell (e.g. <literal>$ ( mycmd ) #</literal>) around places which use - <literal>set -- $(mycmd)</literal> and/or <literal>shift</literal> unless the variable - affected is either a local one or if it's guaranteed that this variable will no longer be used - (be careful for loadable functions, e.g. ksh/ksh93's <literal>autoload</literal> !!!!) - </para> - </section> - - - <section xml:id="be_careful_with_tabs_in_script_code"> - <title>Be careful with using TABS in script code, they are not portable - between editors or platforms</title> - <para>Be careful with using TABS in script code, they are not portable - between editors or platforms.</para> - <para>If you use ksh93 use <literal>$'\t'</literal> to include TABs in sources, not the TAB character itself.</para> - </section> - - - <section xml:id="centralise_error_exit"> - <title>If you have multiple points where your application exits with an error - message create a central function for this purpose</title> - <para>If you have multiple points where your application exits with an error - message create a central function for this, e.g. -<programlisting> -if [ -z "$tmpdir" ] ; then - print -u2 "mktemp failed to produce output; aborting." - exit 1 -fi -if [ ! -d $tmpdir ] ; then - print -u2 "mktemp failed to create a directory; aborting." - exit 1 -fi -</programlisting> -should be replaced with -<programlisting> -function fatal_error -{ - print -u2 "${progname}: $*" - exit 1 -} -# do something (and save ARGV[0] to variable "progname") -if [ -z "$tmpdir" ] ; then - fatal_error "mktemp failed to produce output; aborting." -fi -if [ ! -d "$tmpdir" ] ; then - fatal_error "mktemp failed to create a directory; aborting." -fi -</programlisting> - </para> - </section> - - - <section xml:id="use_set_o_nounset"> - <title>&tag_kshonly; Think about using <literal>$ set -o nounset #</literal> by default</title> - <para>Think about using <literal>$ set -o nounset #</literal> by default (or at least during the - script's development phase) to catch errors where variables are used - when they are not set (yet), e.g. -<screen> -$ <userinput>(set -o nounset ; print ${foonotset})</userinput> -<computeroutput>/bin/ksh93: foonotset: parameter not set</computeroutput> -</screen> - </para> - </section> - - - <section xml:id="avoid_eval_builtin"> - <title>Avoid using <literal>eval</literal> unless absolutely necessary</title> - <para>Avoid using <literal>eval</literal> unless absolutely necessary. Subtle things - can happen when a string is passed back through the shell - parser. You can use name references to avoid uses such as - <literal>eval $name="$value"</literal>. - </para> - </section> - - - <section xml:id="use_concatenation_operator"> - <title>&tag_ksh93only;Use the string/array concatenation operator <literal>+=</literal></title> - <para>Use <literal>+=</literal> instead of manually adding strings/array elements, e.g. -<programlisting> -foo="" -foo="${foo}a" -foo="${foo}b" -foo="${foo}c" -</programlisting> -should be replaced with -<programlisting> -foo="" -foo+="a" -foo+="b" -foo+="c" -</programlisting> - </para> - </section> - - <section xml:id="use_source_not_dot"> - <title>&tag_ksh93only;Use <literal>source</literal> instead of '<literal>.</literal> '(dot) - to include other shell script fragments</title> - <para>Use <literal>source</literal> instead of '<literal>.</literal>' - (dot) to include other shell script fragments - the new form is much - more readable than the tiny dot and a failure can be caught within the script.</para> - </section> - - - <section xml:id="use_builtin_localisation_support"> - <title>&tag_ksh93only;&tag_performance;&tag_l10n;Use <literal>$"..."</literal> instead of - <literal>gettext ... "..."</literal> for strings that need to be localized for different locales</title> - <para>Use $"..." instead of <literal>gettext ... "..."</literal> for strings that need to be - localized for different locales. <literal>gettext</literal> will require a - <literal>fork()+exec()</literal> and - reads the whole catalog each time it's called, creating a huge overhead for localisation - (and the <literal>$"..."</literal> is easier to use, e.g. you only have to put a - <literal>$</literal> in front of the catalog and the string will be localised). - </para> - </section> - - - <section xml:id="use_set_o_noglob"> - <title>&tag_kshonly;&tag_performance;Use <literal>set -o noglob</literal> if you do not need to expand files</title> - <para>If you don't expect to expand files, you can do set <literal>-f</literal> - (<literal>set -o noglob</literal>) as well. This way the need to use <literal>""</literal> is - greatly reduced.</para> - </section> - - - <section xml:id="use_empty_ifs_to_handle_spaces"> - <title>&tag_ksh93only;Use <literal>IFS=</literal> to avoid problems with spaces in filenames</title> - <para>Unless you want to do word splitting, put <literal>IFS=</literal> - at the beginning of a command. This way spaces in - file names won't be a problem. You can do - <literal>IFS='delims' read -r</literal> line - to override <envar>IFS</envar> just for the <literal>read</literal> command. However, - you can't do this for the <literal>set</literal> builtin.</para> - </section> - - - <section xml:id="set_locale_when_comparing_against_localised_output"> - <title>Set the message locale if you process output of tools which may be localised</title> - <para>Set the message locale (<envar>LC_MESSAGES</envar>) if you process output of tools which may be localised</para> - <example><title>Set <envar>LC_MESSAGES</envar> when testing for specific outout of the <filename>/usr/bin/file</filename> utility:</title> -<programlisting> -# set french as default message locale -export LC_MESSAGES=fr_FR.UTF-8 - -... - -# test whether the file "/tmp" has the filetype "directory" or not -# we set LC_MESSAGES to "C" to ensure the returned message is in english -if [[ "$(LC_MESSAGES=C file /tmp)" = *directory ]] ; then - print "is a directory" -fi -</programlisting> - <note><para>The environment variable <envar>LC_ALL</envar> always - overrides any other <envar>LC_*</envar> environment variables - (and <envar>LANG</envar>, too), - including <envar>LC_MESSAGES</envar>. - if there is the chance that <envar>LC_ALL</envar> may be set - replace <envar>LC_MESSAGES</envar> with <envar>LC_ALL</envar> - in the example above.</para></note> - </example> - </section> - - <section xml:id="cleanup_after_yourself"> - <title>Cleanup after yourself.</title> - <para>Cleanup after yourself. For example ksh/ksh93 have an <literal>EXIT</literal> trap which - is very useful for this. - </para> - <note><para> - Note that the <literal>EXIT</literal> trap is executed for a subshell and each subshell - level can run it's own <literal>EXIT</literal> trap, for example -<screen> -$ <userinput>(trap "print bam" EXIT ; (trap "print snap" EXIT ; print "foo"))</userinput> -<computeroutput>foo -snap -bam</computeroutput> -</screen> - </para></note> - </section> - - <section xml:id="use_proper_exit_code"> - <title>Use a proper <literal>exit</literal> code</title> - <para>Explicitly set the exit code of a script, otherwise the exit code - from the last command executed will be used which may trigger problems - if the value is unexpected.</para> - </section> - - - <section xml:id="shell_lint"> - <title>&tag_ksh93only;Use <literal>shcomp -n scriptname.sh /dev/null</literal> to check for common errors</title> - <para>Use <literal>shcomp -n scriptname.sh /dev/null</literal> to - check for common problems (such as insecure, depreciated or ambiguous constructs) in shell scripts.</para> - </section> - </section><!-- end of general --> - - - - - - <section xml:id="functions"> - <title>Functions</title> - - <section xml:id="use_functions"> - <title>Use functions to break up your code</title> - <para>Use functions to break up your code into smaller, logical blocks.</para> - </section> - - <section xml:id="do_not_reserved_keywords_for_function_names"> - <title>Do not use function names which are reserved keywords in C/C++/JAVA or the POSIX shell standard</title> - <para>Do not use function names which are reserved keywords (or function names) in C/C++/JAVA or the POSIX shell standard - (to avoid confusion and/or future changes/updates to the shell language). - </para> - </section> - - <section xml:id="use_ksh_style_function_syntax"> - <title>&tag_kshonly;&tag_performance;Use ksh-style <literal>function</literal></title> - <para>It is <emphasis>highly</emphasis> recommended to use ksh style functions - (<literal>function foo { ... }</literal>) instead - of Bourne-style functions (<literal>foo() { ... }</literal>) if possible - (and local variables instead of spamming the global namespace).</para> - - <warning><para> - The difference between old-style Bourne functions and ksh functions is one of the major differences - between ksh88 and ksh93 - ksh88 allowed variables to be local for Bourne-style functions while ksh93 - conforms to the POSIX standard and will use a function-local scope for variables declared in - Bourne-style functions.</para> - <para>Example (note that "<literal>integer</literal>" is an alias for "<literal>typeset -li</literal>"): -<programlisting> -# new style function with local variable -$ ksh93 -c 'integer x=2 ; function foo { integer x=5 ; } ; print "x=$x" -; foo ; print "x=$x" ;' -x=2 -x=2 -# old style function with an attempt to create a local variable -$ ksh93 -c 'integer x=2 ; foo() { integer x=5 ; } ; print "x=$x" ; foo ; -print "x=$x" ;' -x=2 -x=5 -</programlisting> - - <uri xlink:href="http://www.opensolaris.org/os/project/ksh93-integration/docs/ksh93r/general/compatibility/">usr/src/lib/libshell/common/COMPATIBILITY</uri> - says about this issue: -<blockquote><para> -Functions, defined with name() with ksh-93 are compatible with -the POSIX standard, not with ksh-88. No local variables are -permitted, and there is no separate scope. Functions defined -with the function name syntax, maintain compatibility. -This also affects function traces. -</para></blockquote> -(this issue also affects <filename>/usr/xpg4/bin/sh</filename> in Solaris 10 because it is based on ksh88. This is a bug.). - </para></warning> - - </section> - - - <section xml:id="use_proper_return_code"> - <title>Use a proper <literal>return</literal> code</title> - <para>Explicitly set the return code of a function - otherwise the exit code - from the last command executed will be used which may trigger problems - if the value is unexpected.</para> - <para>The only allowed exception is if a function uses the shell's <literal>errexit</literal> mode to leave - a function, subshell or the script if a command returns a non-zero exit code. - </para> - </section> - - <section xml:id="use_fpath_to_load_common_code"> - <title>&tag_kshonly;Use <envar>FPATH</envar> to load common functions, not <literal>source</literal></title> - <para> - Use the ksh <envar>FPATH</envar> (function path) feature to load functions which are shared between scripts - and not <literal>source</literal> - this allows to load such a function on demand and not all at once.</para> - </section> - - </section><!-- end of functions --> - - - - - <section xml:id="if_for_while"> - <title><literal>if</literal>, <literal>for</literal> and <literal>while</literal></title> - - <section xml:id="if_for_while_format"> - <title>Format</title> - <para>To match <literal>cstyle</literal>, the shell token equivalent to the <literal>C</literal> - "<literal>{</literal>" should appear on the same line, separated by a - "<literal>;</literal>", as in: -<programlisting> -if [ "$x" = "hello" ] ; then - echo $x -fi - -if [[ "$x" = "hello" ]] ; then - print $x -fi - -for i in 1 2 3; do - echo $i -done - -for ((i=0 ; i < 3 ; i++)); do - print $i -done - -while [ $# -gt 0 ]; do - echo $1 - shift -done - -while (( $# > 0 )); do - print $1 - shift -done -</programlisting> - </para> - </section> - - - <section xml:id="test_builtin"> - <title><literal>test</literal> Builtin</title> - <para>DO NOT use the test builtin. Sorry, executive decision.</para> - <para>In our Bourne shell, the <literal>test</literal> built-in is the same as the "[" - builtin (if you don't believe me, try "type test" or refer to <filename>usr/src/cmd/sh/msg.c</filename>).</para> - <para> - So please do not write: -<programlisting> -if test $# -gt 0 ; then -</programlisting> -instead use: -<programlisting> -if [ $# -gt 0 ] ; then -</programlisting> - </para> - </section> - - - <section xml:id="use_ksh_test_syntax"> - <title>&tag_kshonly;&tag_performance;Use "<literal>[[ expr ]]</literal>" instead of "<literal>[ expr ]</literal>"</title> - <para>Use "<literal>[[ expr ]]</literal>" instead of "<literal>[ expr ]</literal>" if possible - since it avoids going through the whole pattern expansion/etc. machinery and - adds additional operators not available in the Bourne shell, such as short-circuit - <literal>&&</literal> and <literal>||</literal>. - </para> - </section> - - - <section xml:id="use_posix_arithmetic_expressions"> - <title>&tag_kshonly; Use "<literal>(( ... ))</literal>" for arithmetic expressions</title> - <para>Use "<literal>(( ... ))</literal>" instead of "<literal>[ expr ]</literal>" - or "<literal>[[ expr ]]</literal>" expressions. - </para> - <para> - Example: Replace -<programlisting> -i=5 -# do something -if [ $i -gt 5 ] ; then -</programlisting> -with -<programlisting> -i=5 -# do something -if (( i > 5 )) ; then -</programlisting> - </para> - </section> - - - <section xml:id="compare_exit_code_using_math"> - <title>&tag_kshonly;&tag_performance;Compare exit code using arithmetic expressions expressions</title> - <para>Use POSIX arithmetic expressions to test for exit/return codes of commands and functions. - For example turn -<programlisting> -if [ $? -gt 0 ] ; then -</programlisting> -into -<programlisting> -if (( $? > 0 )) ; then -</programlisting> - </para> - </section> - - - <section xml:id="use_builtin_commands_in_loops"> - <title>&tag_bourneonly; Use builtin commands in conditions for <literal>while</literal> endless loops</title> - <para>Make sure that your shell has a "<literal>true</literal>" builtin (like ksh93) when - executing endless loops like <literal>$ while true ; do do_something ; done #</literal> - - otherwise each loop cycle runs a <literal>|fork()|+|exec()|</literal>-cycle to run - <filename>/bin/true</filename> - </para> - </section> - - - <section xml:id="single_line_if_statements"> - <title>Single-line if-statements</title> - <para>It is permissible to use <literal>&&</literal> and <literal>||</literal> to construct - shorthand for an "<literal>if</literal>" statement in the case where the if statement has a - single consequent line: -<programlisting> -[ $# -eq 0 ] && exit 0 -</programlisting> -instead of the longer: -<programlisting> -if [ $# -eq 0 ]; then - exit 0 -fi -</programlisting> - </para> - </section> - - - <section xml:id="exit_status_and_if_for_while"> - <title>Exit Status and <literal>if</literal>/<literal>while</literal> statements</title> - <para>Recall that "<literal>if</literal>" and "<literal>while</literal>" - operate on the exit status of the statement - to be executed. In the shell, zero (0) means true and non-zero means false. - The exit status of the last command which was executed is available in the $? - variable. When using "<literal>if</literal>" and "<literal>while</literal>", - it is typically not necessary to use - <literal>$?</literal> explicitly, as in: -<programlisting> -grep foo /etc/passwd >/dev/null 2>&1 -if [ $? -eq 0 ]; then - echo "found" -fi -</programlisting> -Instead, you can more concisely write: -<programlisting> -if grep foo /etc/passwd >/dev/null 2>&1; then - echo "found" -fi -</programlisting> -Or, when appropriate: -<programlisting> -grep foo /etc/passwd >/dev/null 2>&1 && echo "found" -</programlisting> - </para> - </section> - - </section><!-- end of if/for/while --> - - - - - - - <section xml:id="variables"> - <title>Variable types, naming and usage</title> - - <section xml:id="names_should_be_lowercase"> - <title>Names of local, non-environment, non-constant variables should be lowercase</title> - <para>Names of variables local to the current script which are not exported to the environment - should be lowercase while variable names which are exported to the - environment should be uppercase.</para> - <para>The only exception are global constants (=global readonly variables, - e.g. <literal>$ float -r M_PI=3.14159265358979323846 #</literal> (taken from <math.h>)) - which may be allowed to use uppercase names, too. - </para> - - <warning><para> - Uppercase variable names should be avoided because there is a good chance - of naming collisions with either special variable names used by the shell - (e.g. <literal>PWD</literal>, <literal>SECONDS</literal> etc.). - </para></warning> - </section> - - <section xml:id="do_not_reserved_keywords_for_variable_names"> - <title>Do not use variable names which are reserved keywords/variable names in C/C++/JAVA or the POSIX shell standard</title> - <para>Do not use variable names which are reserved keywords in C/C++/JAVA or the POSIX shell standard - (to avoid confusion and/or future changes/updates to the shell language). - </para> - <note> - <para>The Korn Shell and the POSIX shell standard have many more - reserved variable names than the original Bourne shell. All - these reserved variable names are spelled uppercase. - </para> - </note> - </section> - - <section xml:id="use_brackets_around_long_names"> - <title>Always use <literal>'{'</literal>+<literal>'}'</literal> when using variable - names longer than one character</title> - <para>Always use <literal>'{'</literal>+<literal>'}'</literal> when using - variable names longer than one character unless a simple variable name is - followed by a blank, <literal>/</literal>, <literal>;</literal>, or <literal>$</literal> - character (to avoid problems with array, - compound variables or accidental misinterpretation by users/shell) -<programlisting> -print "$foo=info" -</programlisting> -should be rewritten to -<programlisting> -print "${foo}=info" -</programlisting> - </para> - </section> - - - <section xml:id="quote_variables_containing_filenames_or_userinput"> - <title><emphasis>Always</emphasis> put variables into quotes when handling filenames or user input</title> - <para><emphasis>Always</emphasis> put variables into quotes when handling filenames or user input, even if - the values are hardcoded or the values appear to be fixed. Otherwise at - least two things may go wrong: - <itemizedlist> - <listitem><para>a malicious user may be able to exploit a script's inner working to - infect his/her own code</para></listitem> - <listitem><para>a script may (fatally) misbehave for unexpected input (e.g. file names - with blanks and/or special symbols which are interpreted by the shell)</para></listitem> - </itemizedlist> - </para> - - <note><para> - As alternative a script may set <literal>IFS='' ; set -o noglob</literal> to turn off the - interpretation of any field seperators and the pattern globbing. - </para></note> - </section> - - - - <section xml:id="use_typed_variables"> - <title>&tag_kshonly;&tag_performance;Use typed variables if possible.</title> - <para>For example the following is very - inefficient since it transforms the integer values to strings and back - several times: -<programlisting> -a=0 -b=1 -c=2 -# more code -if [ $a -lt 5 -o $b -gt c ] ; then do_something ; fi -</programlisting> -This could be rewritten using ksh constructs: -<programlisting> -integer a=0 -integer b=1 -integer c=2 -# more code -if (( a < 5 || b > c )) ; then do_something ; fi -</programlisting> - </para> - </section> - - - <section xml:id="store_lists_in_arrays"> - <title>&tag_ksh93only; Store lists in arrays or associative arrays</title> - <para>Store lists in arrays or associative arrays - this is usually easier - to manage.</para> - <para> - For example: -<programlisting> -x=" -/etc/foo -/etc/bar -/etc/baz -" -echo $x -</programlisting> -can be replaced with -<programlisting> -typeset -a mylist -mylist[0]="/etc/foo" -mylist[1]="/etc/bar" -mylist[2]="/etc/baz" -print "${mylist[@]}" -</programlisting> -or (ksh93-style append entries to a normal (non-associative) array) -<programlisting> -typeset -a mylist -mylist+=( "/etc/foo" ) -mylist+=( "/etc/bar" ) -mylist+=( "/etc/baz" ) -print "${mylist[@]}" -</programlisting> - </para> - <note> - <title>Difference between expanding arrays with mylist[@] and mylist[*] subscript operators</title> - <para> - Arrays may be expanded using two similar subscript operators, @ and *. These subscripts - differ only when the variable expansion appears within double quotes. If the variable expansion - is between double-quotes, "${mylist[*]}" expands to a single string with the value of each array - member separated by the first character of the <envar>IFS</envar> variable, and "${mylist[@]}" - expands each element of name to a separate string. - </para> - <example><title>Difference between [@] and [*] when expanding arrays</title> -<programlisting> -typeset -a mylist -mylist+=( "/etc/foo" ) -mylist+=( "/etc/bar" ) -mylist+=( "/etc/baz" ) -IFS="," -printf "mylist[*]={ 0=|%s| 1=|%s| 2=|%s| 3=|%s| }\n" "${mylist[*]}" -printf "mylist[@]={ 0=|%s| 1=|%s| 2=|%s| 3=|%s| }\n" "${mylist[@]}" -</programlisting> -<para>will print:</para> -<screen> -<computeroutput>mylist[*]={ 0=|/etc/foo,/etc/bar,/etc/baz| 1=|| 2=|| 3=|| } -mylist[@]={ 0=|/etc/foo| 1=|/etc/bar| 2=|/etc/baz| 3=|| } -</computeroutput> -</screen> - </example> - </note> - </section> - - - <section xml:id="use_compound_variables_or_lists_for_grouping"> - <title>&tag_ksh93only; Use compound variables or associative arrays to group similar variables together</title> - <para>Use compound variables or associative arrays to group similar variables together.</para> - <para> - For example: -<programlisting> -box_width=56 -box_height=10 -box_depth=19 -echo "${box_width} ${box_height} ${box_depth}" -</programlisting> -could be rewritten to ("associative array"-style) -<programlisting> -typeset -A -E box=( [width]=56 [height]=10 [depth]=19 ) -print -- "${box[width]} ${box[height]} ${box[depth]}" -</programlisting> -or ("compound variable"-style -<programlisting> -box=( - float width=56 - float height=10 - float depth=19 - ) -print -- "${box.width} ${box.height} ${box.depth}" -</programlisting> - </para> - </section> - </section><!-- end of variables --> - - - - - - - - <section xml:id="io"> - <title>I/O</title> - - <section xml:id="avoid_echo"> - <title>Avoid using the "<literal>echo</literal>" command for output</title> - <para>The behaviour of "<literal>echo</literal>" is not portable - (e.g. System V, BSD, UCB and ksh93/bash shell builtin versions all - slightly differ in functionality) and should be avoided if possible. - POSIX defines the "<literal>printf</literal>" command as replacement - which provides more flexible and portable behaviour.</para> - - <note> - <title>&tag_kshonly;Use "<literal>print</literal>" and not "<literal>echo</literal>" in Korn Shell scripts</title> - <para>Korn shell scripts should prefer the "<literal>print</literal>" - builtin which was introduced as replacement for "<literal>echo</literal>".</para> - <caution> - <para>Use <literal>$ print -- ${varname}" #</literal> when there is the slightest chance that the - variable "<literal>varname</literal>" may contain symbols like "-". Or better use "<literal>printf</literal>" - instead, for example -<programlisting> -integer fx -# do something -print $fx -</programlisting> -may fail if "f" contains a negative value. A better way may be to use -<programlisting> -integer fx -# do something -printf "%d\n" fx -</programlisting> - </para> - </caution> - </note> - </section> - - <section xml:id="use_redirect_not_exec_to_open_files"> - <title>&tag_ksh93only;Use <literal>redirect</literal> and not <literal>exec</literal> to open files</title> - <para>Use <literal>redirect</literal> and not <literal>exec</literal> to open files - <literal>exec</literal> - will terminate the current function or script if an error occurs while <literal>redirect</literal> - just returns a non-zero exit code which can be caught.</para> -<para>Example: -<programlisting> -if redirect 5</etc/profile ; then - print "file open ok" - head <&5 -else - print "could not open file" -fi -</programlisting> - </para> - </section> - - <section xml:id="group_identical_redirections_together"> - <title>&tag_performance;Avoid redirections per command when the output goes into the same file, - e.g. <literal>$ echo "foo" >xxx ; echo "bar" >>xxx ; echo "baz" >>xxx #</literal></title> - <para>Each of the redirections above trigger an - <literal>|open()|,|write()|,|close()|</literal>-sequence. It is much - more efficient (and faster) to group the rediction into a block, - e.g. <literal>{ echo "foo" ; echo "bar" ; echo "baz" } >xxx #</literal></para> - </section> - - - <section xml:id="avoid_using_temporary_files"> - <title>&tag_performance;Avoid the creation of temporary files and store the values in variables instead</title> - <para>Avoid the creation of temporary files and store the values in variables instead if possible</para> - <para> - Example: -<programlisting> -ls -1 >xxx -for i in $(cat xxx) ; do - do_something ; -done -</programlisting> -can be replaced with -<programlisting> -x="$(ls -1)" -for i in ${x} ; do - do_something ; -done -</programlisting> - </para> - <note><para>ksh93 supports binary variables (e.g. <literal>typeset -b varname</literal>) which can hold any value.</para></note> - </section> - - - <section xml:id="create_subdirs_for_multiple_temporary_files"> - <title>If you create more than one temporary file create an unique subdir</title> - <para>If you create more than one temporary file create an unique subdir for - these files and make sure the dir is writable. Make sure you cleanup - after yourself (unless you are debugging). - </para> - </section> - - - <section xml:id="use_dynamic_file_descriptors"> - <title>&tag_ksh93only;Use {n}<file instead of fixed file descriptor numbers</title> - <para>When opening a file use {n}<file, where <envar>n</envar> is an - integer variable rather than specifying a fixed descriptor number.</para> - <para>This is highly recommended in functions to avoid that fixed file - descriptor numbers interfere with the calling script.</para> -<example><title>Open a network connection and store the file descriptor number in a variable</title> -<programlisting> -function cat_http -{ - integer netfd - -... - - # open TCP channel - redirect {netfd}<>"/dev/tcp/${host}/${port}" - - # send HTTP request - request="GET /${path} HTTP/1.1\n" - request+="Host: ${host}\n" - request+="User-Agent: demo code/ksh93 (2007-08-30; $(uname -s -r -p))\n" - request+="Connection: close\n" - print "${request}\n" >&${netfd} - - # collect response and send it to stdout - cat <&${netfd} - - # close connection - exec {netfd}<&- - -... - -} -</programlisting> -</example> - </section> - - - <section xml:id="use_inline_here_documents"> - <title>&tag_ksh93only;&tag_performance;Use inline here documents - instead of <literal>echo "$x" | command</literal></title> - <para>Use inline here documents, for example -<programlisting> -command <<< $x -</programlisting> - rather than -<programlisting> -print -r -- "$x" | command -</programlisting> - </para> - </section> - - - <section xml:id="use_read_r"> - <title>&tag_ksh93only;Use the <literal>-r</literal> option of <literal>read</literal> to read a line</title> - <para>Use the <literal>-r</literal> option of <literal>read</literal> to read a line. - You never know when a line will end in <literal>\</literal> and without a - <literal>-r</literal> multiple - lines can be read.</para> - </section> - - - <section xml:id="print_compound_variables_using_print_C"> - <title>&tag_ksh93only;Print compound variables using <literal>print -C varname</literal> or <literal>print -v varname</literal></title> - <para>Print compound variables using <literal>print -C varname</literal> or - <literal>print -v varname</literal> to make sure that non-printable characters - are correctly encoded.</para> -<example><title>Print compound variable with non-printable characters</title> -<programlisting> -compound x=( - a=5 - b="hello" - c=( - d=9 - e="$(printf "1\v3")" <co xml:id="co.vertical_tab1" /> - ) -) -print -v x -</programlisting> -<para>will print:</para> -<screen> -<computeroutput>( - a=5 - b=hello - c=( - d=9 - e=$'1\0133' <co xml:id="co.vertical_tab2" /> - ) -)</computeroutput> -</screen> -<calloutlist> - <callout arearefs="co.vertical_tab1 co.vertical_tab2"> - <para>vertical tab, <literal>\v</literal>, octal=<literal>\013</literal>.</para> - </callout> -</calloutlist> -</example> - </section> - - <section xml:id="command_name_before_redirections"> - <title>Put the command name and arguments before redirections</title> - <para>Put the command name and arguments before redirections. - You can legally do <literal>$ > file date</literal> instead of <literal>date > file</literal> - but don't do it.</para> - </section> - - <section xml:id="enable_gmacs_editor_mode_for_user_prompts"> - <title>&tag_ksh93only;Enable the <literal>gmacs</literal> editor - mode when reading user input using the <literal>read</literal> builtin</title> - <para>Enable the <literal>gmacs</literal>editor mode before reading user - input using the <literal>read</literal> builtin to enable the use of - cursor+backspace+delete keys in the edit line</para> -<example><title>Prompt user for a string with gmacs editor mode enabled</title> -<programlisting> -set -o gmacs <co xml:id="co.enable_gmacs" /> -typeset inputstring="default value" -... -read -v<co xml:id="co.read_v" /> inputstring<co xml:id="co.readvar" />?"Please enter a string: "<co xml:id="co.prompt" /> -... -printf "The user entered the following string: '%s'\n" "${inputstring}" - -... -</programlisting> -<calloutlist> - <callout arearefs="co.enable_gmacs"> - <para>Enable gmacs editor mode.</para> - </callout> - <callout arearefs="co.read_v"> - <para>The value of the variable is displayed and used as a default value.</para> - </callout> - <callout arearefs="co.readvar"> - <para>Variable used to store the result.</para> - </callout> - <callout arearefs="co.prompt"> - <para>Prompt string which is displayed in stderr.</para> - </callout> -</calloutlist> -</example> - </section> - </section><!-- end of I/O --> - - - - - - - <section xml:id="math"> - <title>Math</title> - - <section xml:id="use_builtin_arithmetic_expressions"> - <title>&tag_kshonly;&tag_performance;Use builtin arithmetic expressions instead of external applications</title> - <para>Use builtin (POSIX shell) arithmetic expressions instead of - <filename>expr</filename>, - <filename>bc</filename>, - <filename>dc</filename>, - <filename>awk</filename>, - <filename>nawk</filename> or - <filename>perl</filename>. - </para> - <note> - <para>ksh93 supports C99-like floating-point arithmetic including special values - such as - <simplelist type="inline"> - <member>+Inf</member> - <member>-Inf</member> - <member>+NaN</member> - <member>-NaN</member> - </simplelist>. - </para> - </note> - </section> - - - <section xml:id="use_floating_point_arithmetic_expressions"> - <title>&tag_ksh93only; Use floating-point arithmetic expressions if - calculations may trigger a division by zero or other exceptions</title> - <para>Use floating-point arithmetic expressions if calculations may - trigger a division by zero or other exceptions - floating point arithmetic expressions in - ksh93 support special values such as <literal>+Inf</literal>/<literal>-Inf</literal> and - <literal>+NaN</literal>/<literal>-NaN</literal> which can greatly simplify testing for - error conditions, e.g. instead of a <literal>trap</literal> or explicit - <literal>if ... then... else</literal> checks for every sub-expression - you can check the results for such special values. - </para> - <para>Example: -<screen> -$ <userinput>ksh93 -c 'integer i=0 j=5 ; print -- "x=$((j/i)) "'</userinput> -<computeroutput>ksh93: line 1: j/i: divide by zero</computeroutput> -$ <userinput>ksh93 -c 'float i=0 j=-5 ; print -- "x=$((j/i)) "'</userinput> -<computeroutput>x=-Inf</computeroutput> -</screen> - </para> - </section> - - - <section xml:id="use_printf_a_for_passing_float_values"> - <title>&tag_ksh93only; Use <literal>printf "%a"</literal> when passing floating-point values</title> - <para>Use <literal>printf "%a"</literal> when passing floating-point values between scripts or - as output of a function to avoid rounding errors when converting between - bases.</para> - <para> - Example: -<programlisting> -function xxx -{ - float val - - (( val=sin(5.) )) - printf "%a\n" val -} -float out -(( out=$(xxx) )) -xxx -print -- $out -</programlisting> -This will print: -<programlisting> --0.9589242747 --0x1.eaf81f5e09933226af13e5563bc6p-01 -</programlisting> - </para> - </section> - - - <section xml:id="put_constants_into_readonly_variables"> - <title>&tag_kshonly;&tag_performance;Put constant values into readonly variables</title> - <para>Put constant values into readonly variables</para> - <para>For example: -<programlisting> -float -r M_PI=3.14159265358979323846 -</programlisting> -or -<programlisting> -float M_PI=3.14159265358979323846 -readonly M_PI -</programlisting> - </para> - </section> - - - <section xml:id="avoid_unnecessary_string_number_conversions"> - <title>&tag_kshonly;&tag_performance;Avoid string to number - (and/or number to string) conversions in arithmetic expressions - expressions</title> - <para>Avoid string to number and/or number to string conversions in - arithmetic expressions expressions to avoid performance degradation - and rounding errors.</para> - <example><title>(( x=$x*2 )) vs. (( x=x*2 ))</title> -<programlisting> -float x -... -(( x=$x*2 )) -</programlisting> -<para> -will convert the variable "x" (stored in the machine's native -<literal>|long double|</literal> datatype) to a string value in base10 format, -apply pattern expansion (globbing), then insert this string into the -arithmetic expressions and parse the value which converts it into the internal |long double| datatype format again. -This is both slow and generates rounding errors when converting the floating-point value between -the internal base2 and the base10 representation of the string. -</para> -<para> -The correct usage would be: -</para> -<programlisting> -float x -... -(( x=x*2 )) -</programlisting> -<para> -e.g. omit the '$' because it's (at least) redundant within arithmetic expressions. -</para> - </example> - - - <example><title>x=$(( y+5.5 )) vs. (( x=y+5.5 ))</title> -<programlisting> -float x -float y=7.1 -... -x=$(( y+5.5 )) -</programlisting> -<para> -will calculate the value of <literal>y+5.5</literal>, convert it to a -base-10 string value amd assign the value to the floating-point variable -<literal>x</literal> again which will convert the string value back to the -internal |long double| datatype format again. -</para> -<para> -The correct usage would be: -</para> -<programlisting> -float x -float y=7.1 -... -(( x=y+5.5 )) -</programlisting> -<para> -i.e. this will save the string conversions and avoid any base2-->base10-->base2-conversions. -</para> - </example> - </section> - - - <section xml:id="set_lc_numeric_when_using_floating_point"> - <title>&tag_ksh93only;Set <envar>LC_NUMERIC</envar> when using floating-point constants</title> - <para>Set <envar>LC_NUMERIC</envar> when using floating-point constants to avoid problems with radix-point - representations which differ from the representation used in the script, for example the <literal>de_DE.*</literal> locale - use ',' instead of '.' as default radix point symbol.</para> - <para>For example: -<programlisting> -# Make sure all math stuff runs in the "C" locale to avoid problems with alternative -# radix point representations (e.g. ',' instead of '.' in de_DE.*-locales). This -# needs to be set _before_ any floating-point constants are defined in this script) -if [[ "${LC_ALL}" != "" ]] ; then - export \ - LC_MONETARY="${LC_ALL}" \ - LC_MESSAGES="${LC_ALL}" \ - LC_COLLATE="${LC_ALL}" \ - LC_CTYPE="${LC_ALL}" - unset LC_ALL -fi -export LC_NUMERIC=C -... -float -r M_PI=3.14159265358979323846 -</programlisting> - </para> - - <note><para>The environment variable <envar>LC_ALL</envar> always overrides all other <envar>LC_*</envar> variables, - including <envar>LC_NUMERIC</envar>. The script should always protect itself against custom <envar>LC_NUMERIC</envar> and - <envar>LC_ALL</envar> values as shown in the example above. - </para></note> - </section> - - - - </section><!-- end of math --> - - - - - - - <section xml:id="misc"> - <title>Misc</title> - - <section xml:id="debug_use_lineno_in_ps4"> - <title>Put <literal>[${LINENO}]</literal> in your <envar>PS4</envar></title> - <para>Put <literal>[${LINENO}]</literal> in your <envar>PS4</envar> prompt so that you will get line - numbers with you run with <literal>-x</literal>. If you are looking at performance - issues put <literal>$SECONDS</literal> in the <envar>PS4</envar> prompt as well.</para> - </section> - - </section><!-- end of misc --> - - - - -</section><!-- end of RULES --> - - - - -</article> diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf index 7cd67ac2d4..dd8f8cfe49 100644 --- a/usr/src/pkg/manifests/SUNWcs.mf +++ b/usr/src/pkg/manifests/SUNWcs.mf @@ -250,7 +250,6 @@ dir path=usr/sbin $(i386_ONLY)dir path=usr/sbin/$(ARCH32) dir path=usr/sbin/$(ARCH64) dir path=usr/share -dir path=usr/share/doc group=other dir path=usr/share/lib dir path=usr/share/lib/mailx dir path=usr/share/lib/pub diff --git a/usr/src/pkg/manifests/shell-ksh93.mf b/usr/src/pkg/manifests/shell-ksh93.mf index 073a1acbed..c2bff3a36a 100644 --- a/usr/src/pkg/manifests/shell-ksh93.mf +++ b/usr/src/pkg/manifests/shell-ksh93.mf @@ -27,9 +27,6 @@ dir path=usr/bin/$(ARCH32) dir path=usr/bin/$(ARCH64) dir path=usr/lib dir path=usr/lib/$(ARCH64) -dir path=usr/share/doc/ksh -dir path=usr/share/doc/ksh/images -dir path=usr/share/doc/ksh/images/callouts file path=etc/ksh.kshrc group=sys original_name=SUNWcs:etc/ksh.kshrc \ preserve=renameold file path=etc/skel/.kshrc group=other original_name=SUNWcs:etc/skel/.kshrc \ @@ -48,30 +45,6 @@ file path=usr/lib/libcmd.so.1 file path=usr/lib/libdll.so.1 file path=usr/lib/libshell.so.1 file path=usr/lib/libsum.so.1 -file path=usr/share/doc/ksh/COMPATIBILITY -file path=usr/share/doc/ksh/DESIGN -file path=usr/share/doc/ksh/OBSOLETE -file path=usr/share/doc/ksh/README -file path=usr/share/doc/ksh/RELEASE -file path=usr/share/doc/ksh/TYPES -file path=usr/share/doc/ksh/images/callouts/1.png -file path=usr/share/doc/ksh/images/callouts/10.png -file path=usr/share/doc/ksh/images/callouts/2.png -file path=usr/share/doc/ksh/images/callouts/3.png -file path=usr/share/doc/ksh/images/callouts/4.png -file path=usr/share/doc/ksh/images/callouts/5.png -file path=usr/share/doc/ksh/images/callouts/6.png -file path=usr/share/doc/ksh/images/callouts/7.png -file path=usr/share/doc/ksh/images/callouts/8.png -file path=usr/share/doc/ksh/images/callouts/9.png -file path=usr/share/doc/ksh/images/tag_bourne.png -file path=usr/share/doc/ksh/images/tag_i18n.png -file path=usr/share/doc/ksh/images/tag_ksh.png -file path=usr/share/doc/ksh/images/tag_ksh88.png -file path=usr/share/doc/ksh/images/tag_ksh93.png -file path=usr/share/doc/ksh/images/tag_l10n.png -file path=usr/share/doc/ksh/images/tag_perf.png -file path=usr/share/doc/ksh/shell_styleguide.docbook file path=usr/share/man/man1/cksum.1 file path=usr/share/man/man1/cmp.1 file path=usr/share/man/man1/comm.1 diff --git a/usr/src/pkg/manifests/source-demo-system.mf b/usr/src/pkg/manifests/source-demo-system.mf index 21d895f0b2..d065022c2f 100644 --- a/usr/src/pkg/manifests/source-demo-system.mf +++ b/usr/src/pkg/manifests/source-demo-system.mf @@ -33,10 +33,6 @@ set name=variant.arch value=$(ARCH) dir path=usr group=sys dir path=usr/demo dir path=usr/demo/ELF -dir path=usr/demo/ksh -dir path=usr/demo/ksh/bin -dir path=usr/demo/ksh/fun -dir path=usr/demo/ksh/src dir path=usr/demo/libexacct dir path=usr/demo/librtld_db dir path=usr/demo/librtld_db/amd64 @@ -55,57 +51,6 @@ file path=usr/demo/ELF/dcom.c file path=usr/demo/ELF/dispsyms.c file path=usr/demo/ELF/pcom.c file path=usr/demo/ELF/tpcom.c -file path=usr/demo/ksh/bin/cpvprint mode=0755 -file path=usr/demo/ksh/bin/crawlsrccomments mode=0755 -file path=usr/demo/ksh/bin/filemutexdemo1 mode=0755 -file path=usr/demo/ksh/bin/filetree1 mode=0755 -file path=usr/demo/ksh/bin/gnaw mode=0755 -file path=usr/demo/ksh/bin/mandelbrotset1 mode=0755 -file path=usr/demo/ksh/bin/multifollow mode=0755 -file path=usr/demo/ksh/bin/numtree1 mode=0755 -file path=usr/demo/ksh/bin/primenumbers1 mode=0755 -file path=usr/demo/ksh/bin/rssread mode=0755 -file path=usr/demo/ksh/bin/shcalc mode=0755 -file path=usr/demo/ksh/bin/shircbot mode=0755 -file path=usr/demo/ksh/bin/shlint mode=0755 -file path=usr/demo/ksh/bin/shman mode=0755 -file path=usr/demo/ksh/bin/shnote mode=0755 -file path=usr/demo/ksh/bin/shpiano mode=0755 -file path=usr/demo/ksh/bin/shtinyurl mode=0755 -file path=usr/demo/ksh/bin/shtwitter mode=0755 -file path=usr/demo/ksh/bin/simplefileattributetree1 mode=0755 -file path=usr/demo/ksh/bin/simplefiletree1 mode=0755 -file path=usr/demo/ksh/bin/svcproptree1 mode=0755 -file path=usr/demo/ksh/bin/termclock mode=0755 -file path=usr/demo/ksh/bin/test_net_sctp mode=0755 -file path=usr/demo/ksh/bin/xmldocumenttree1 mode=0755 -file path=usr/demo/ksh/fun/dirs mode=0755 -file path=usr/demo/ksh/fun/popd mode=0755 -file path=usr/demo/ksh/fun/pushd mode=0755 -file path=usr/demo/ksh/src/cpvprint.sh -file path=usr/demo/ksh/src/crawlsrccomments.sh -file path=usr/demo/ksh/src/filemutexdemo1.sh -file path=usr/demo/ksh/src/filetree1.sh -file path=usr/demo/ksh/src/gnaw.sh -file path=usr/demo/ksh/src/mandelbrotset1.sh -file path=usr/demo/ksh/src/multifollow.sh -file path=usr/demo/ksh/src/numtree1.sh -file path=usr/demo/ksh/src/primenumbers1.sh -file path=usr/demo/ksh/src/rssread.sh -file path=usr/demo/ksh/src/shcalc.sh -file path=usr/demo/ksh/src/shircbot.sh -file path=usr/demo/ksh/src/shlint.sh -file path=usr/demo/ksh/src/shman.sh -file path=usr/demo/ksh/src/shnote.sh -file path=usr/demo/ksh/src/shpiano.sh -file path=usr/demo/ksh/src/shtinyurl.sh -file path=usr/demo/ksh/src/shtwitter.sh -file path=usr/demo/ksh/src/simplefileattributetree1.sh -file path=usr/demo/ksh/src/simplefiletree1.sh -file path=usr/demo/ksh/src/svcproptree1.sh -file path=usr/demo/ksh/src/termclock.sh -file path=usr/demo/ksh/src/test_net_sctp.sh -file path=usr/demo/ksh/src/xmldocumenttree1.sh file path=usr/demo/libexacct/Makefile file path=usr/demo/libexacct/README file path=usr/demo/libexacct/exdump.c diff --git a/usr/src/pkg/transforms/defaults b/usr/src/pkg/transforms/defaults index b62738c664..df66e776e0 100644 --- a/usr/src/pkg/transforms/defaults +++ b/usr/src/pkg/transforms/defaults @@ -58,7 +58,6 @@ # Catch some of the collections of largely read-only files # <transform file path=usr/lib/help/.+ -> default mode 0444> -<transform file path=usr/share/doc/ksh/.+ -> default mode 0644> <transform file path=usr/share/ipfilter/.+ -> default mode 0644> <transform file path=usr/share/lib/ccs/.+ -> default mode 0644> <transform file path=usr/share/lib/java/.+ -> default mode 0644> |