Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
# $XConsortium: DtFuncs.compat.sh /main/1 1995/11/01 15:48:48 rswiston $
#
# COMPONENT_NAME: desktop
#
# FUNCTIONS: DtAddButtons
# DtFloatBottom
# DtFloatLeft
# DtFloatRight
# DtFloatTop
# DtLeftOf
# DtOver
# DtRightOf
# DtSetReturnKeyControls
# DtUnder
#
# ORIGINS: 27,118,119,120,121
#
# This module contains IBM CONFIDENTIAL code. -- (IBM
# Confidential Restricted when combined with the aggregated
# modules for this product)
# OBJECT CODE ONLY SOURCE MATERIALS
#
# (C) COPYRIGHT International Business Machines Corp. 1995
# All Rights Reserved
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
###############################################################################
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
###############################################################################
# This script is for compatibility with previous AIXwindows Desktop releases.
###############################################################################
. /usr/dt/lib/dtksh/DtFuncs.dtsh
alias DtAddButtons="DtkshAddButtons"
alias DtSetReturnKeyControls="DtkshSetReturnKeyControls"
alias DtUnder="DtkshUnder"
alias DtOver="DtkshOver"
alias DtRightOf="DtkshRightOf"
alias DtLeftOf="DtkshLeftOf"
alias DtFloatRight="DtkshFloatRight"
alias DtFloatLeft="DtkshFloatLeft"
alias DtFloatTop="DtkshFloatTop"
alias DtFloatBottom="DtkshFloatBottom"
alias DtAnchorRight="DtkshAnchorRight"
alias DtAnchorLeft="DtkshAnchorLeft"
alias DtAnchorTop="DtkshAnchorTop"
alias DtAnchorBottom="DtkshAnchorBottom"
alias DtSpanWidth="DtkshSpanWidth"
alias DtSpanHeight="DtkshSpanHeight"
alias DtDisplayErrorDialog="DtkshDisplayErrorDialog"
alias DtDisplayQuestionDialog="DtkshDisplayQuestionDialog"
alias DtDisplayWorkingDialog="DtkshDisplayWorkingDialog"
alias DtDisplayWarningDialog="DtkshDisplayWarningDialog"
alias DtDisplayInformationDialog="DtkshDisplayInformationDialog"
alias DtDisplayQuickHelpDialog="DtkshDisplayQuickHelpDialog"
alias DtDisplayHelpDialog="DtkshDisplayHelpDialog"

View File

@@ -0,0 +1,739 @@
# $XConsortium: DtFuncs.sh /main/3 1995/11/01 15:48:57 rswiston $
###############################################################################
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
###############################################################################
###############################################################################
#
# DtkshAddButtons - Convenience function for adding 1 or more buttons of the
# same kind into a composite widget. Most frequently
# used to add a collection of buttons into a menupane.
#
# Usages:
#
# DtkshAddButtons parent widgetClass label1 callback1 [label2 callback2 ...]
#
# DtkshAddButtons [-w] parent widgetClass variable1 label1 callback1 \
# [variable2 label2 callback2 ...]
#
# The "-w" option indicates that the convenience function should return
# the widget handle for each of the created buttons. The widget handle
# is returned in the specified environment variable.
#
# The widgetClass can be one of the following, and will default to the
# XmPushButtonGadget class, if not specified:
#
# XmPushButton
# XmPushButtonGadget
# XmToggleButton
# XmToggleButtonGadget
# XmCascadeButton
# XmCascadeButtonGadget
#
# Examples:
#
# DtkshAddButtons $MENU XmPushButtonGadget Open do_Open Save do_Save Quit exit
#
# DtkshAddButtons -w $MENU XmPushButtonGadget B1 Open do_Open B2 Save do_Save
#
DtkshAddButtons()
{
typeset parent widgetClass callback returnWidget="false" TMP=""
typeset -i paramCount=2
if [ $# -ge 1 ] && [ x"$1" = "x-w" ]; then
returnWidget=true
paramCount=3
shift
fi
if [ $# -lt 2 ]; then
return 1
fi
parent=$1
shift
widgetClass=${1:-XmPushButtonGadget}
shift
case $widgetClass in
XmPushButtonGadget) callback=activateCallback;;
XmPushButton) callback=activateCallback;;
XmToggleButtonGadget) callback=valueChangedCallback;;
XmToggleButton) callback=valueChangedCallback;;
XmCascadeButtonGadget) callback=activateCallback;;
XmCascadeButton) callback=activateCallback;;
*) return 1
esac
while [ $# -ge $paramCount ]
do
if [ "$returnWidget" = true ]; then
if [ ! "$3" = "" ]; then
XtCreateManagedWidget "$1" "$1" $widgetClass "$parent" \
labelString:"$2" ${callback}:"$3"
else
XtCreateManagedWidget "$1" "$1" $widgetClass "$parent" \
labelString:"$2"
fi
shift 3
else
if [ ! "$2" = "" ]; then
XtCreateManagedWidget Id "btn" $widgetClass "$parent" \
labelString:"$1" ${callback}:"$2"
else
XtCreateManagedWidget Id "btn" $widgetClass "$parent" \
labelString:"$1"
fi
shift 2
fi
done
return 0
}
###############################################################################
#
# DtkshSetReturnKeyControls - Convenience function for configuring a text
# widget (within a form!) so that the Return key does not
# activate the default button within the form, but instead
# moves the focus to the next text widget within the form.
# This is useful if you have a window which contains a
# series of text fields, and the default button should not
# be activated until the user presses the Return key in the
# last text field.
#
# Usage:
#
# DtkshSetReturnKeyControls textWidgetId nextTextWidgetId formWidgetId \
# defaultButtonId
#
# The textWidgetId parameter specifies the widget which is to be configured
# to catch the 'Return' key, and force the focus to move to the next text
# widget (as indicated by the nextTextWidgetId parameter). The formWidgetId
# parameter specifies the form which contains the default button, and should
# be the parent of the two text widgets. The defaultButtonId indicates which
# component is to be treated as the default button within the form.
#
# Examples:
#
# DtkshSetReturnKeyControls $TEXT1 $TEXT2 $FORM $OK
# DtkshSetReturnKeyControls $TEXT2 $TEXT3 $FORM $OK
#
DtkshSetReturnKeyControls()
{
if [ $# -ne 4 ]; then
return 1
fi
XtAddCallback $1 focusCallback "XtSetValues $3 defaultButton:NULL"
XtAddCallback $1 losingFocusCallback "XtSetValues $3 defaultButton:$4"
XtOverrideTranslations $1 \
"Ctrl<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")
<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")"
return 0
}
###############################################################################
#
# DtkshUnder
# DtkshOver
# DtkshRightOf
# DtkshLeftOf - Convenience functions for specifying form constraints.
# This set of functions allow a component to be attached
# to one of the edges of another component.
#
# Usages:
#
# DtkshUnder widgetId [offset]
# DtkshOver widgetId [offset]
# DtkshRightOf widgetId [offset]
# DtkshLeftOf widgetId [offset]
#
# The widgetId parameter specifies the widget to which the current
# component is to be attached. The offset value is optional, and
# defaults to 0 if not specified.
#
# Examples:
#
# XtCreateManagedWidget BUTTON2 button2 XmPushButton $FORM \
# labelString:"Exit" \
# $(DtkshUnder $BUTTON1)
#
DtkshUnder()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "topWidget:$1 topAttachment:ATTACH_WIDGET topOffset:${2:-0}"
}
DtkshOver()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "bottomWidget:$1 bottomAttachment:ATTACH_WIDGET bottomOffset:${2:-0}"
}
DtkshRightOf()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "leftWidget:$1 leftAttachment:ATTACH_WIDGET leftOffset:${2:-0}"
}
DtkshLeftOf()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "rightWidget:$1 rightAttachment:ATTACH_WIDGET rightOffset:${2:-0}"
}
###############################################################################
#
# DtkshFloatRight
# DtkshFloatLeft
# DtkshFloatTop
# DtkshFloatBottom - Convenience functions for specifying form constraints.
# This set of functions allow a component to be positioned
# independent of the other components within the form.
# As the form grows or shrinks, the component maintains
# its relative position within the form. The component
# may still grow or shrink, depending upon the other form
# constraints which have been specified for the component.
#
# Usages:
#
# DtkshFloatRight [position]
# DtkshFloatLeft [position]
# DtkshFloatTop [position]
# DtkshFloatBottom [position]
#
# The optional position parameter specifies the relative position
# to which the indicated edge of the component will be positioned.
# A default position is used, if not specified.
#
# Examples:
#
# XtCreateManagedWidget BUTTON1 button1 XmPushButton $FORM \
# labelString:"Ok" \
# $(DtkshUnder $SEPARATOR) \
# $(DtkshFloatLeft 10) \
# $(DtkshFloatRight 40)
#
DtkshFloatRight()
{
echo "rightAttachment:ATTACH_POSITION rightPosition:${1:-0}"
}
DtkshFloatLeft()
{
echo "leftAttachment:ATTACH_POSITION leftPosition:${1:-0}"
}
DtkshFloatTop()
{
echo "topAttachment:ATTACH_POSITION topPosition:${1:-0}"
}
DtkshFloatBottom()
{
echo "bottomAttachment:ATTACH_POSITION bottomPosition:${1:-0}"
}
###############################################################################
#
# DtkshAnchorRight
# DtkshAnchorLeft
# DtkshAnchorTop
# DtkshAnchorBottom - Convenience functions for specifying form constraints.
# This set of functions allow a component to be attached
# to one of the edges of the form in such a fashion that
# as the form grows or shrinks, the component's position
# does not change. However, depending upon the other
# form constaints set on this component, the component
# may still grow or shrink in size.
#
# Usages:
#
# DtkshAnchorRight [offset]
# DtkshAnchorLeft [offset]
# DtkshAnchorTop [offset]
# DtkshAnchorBottom [offset]
#
# The optional offset parameter specifies how far from the edge
# of the form the component should be positioned. If an offset
# is not specified, then 0 is user.
#
# Examples:
#
# XtCreateManagedWidget BUTTON1 button1 XmPushButton $FORM \
# labelString:"Ok" \
# $(DtkshUnder $SEPARATOR) \
# $(DtkshAnchorLeft 10) \
# $(DtkshAnchorBottom 10)
#
DtkshAnchorRight()
{
echo "rightAttachment:ATTACH_FORM rightOffset:${1:-0}"
}
DtkshAnchorLeft()
{
echo "leftAttachment:ATTACH_FORM leftOffset:${1:-0}"
}
DtkshAnchorTop()
{
echo "topAttachment:ATTACH_FORM topOffset:${1:-0}"
}
DtkshAnchorBottom()
{
echo "bottomAttachment:ATTACH_FORM bottomOffset:${1:-0}"
}
###############################################################################
#
# DtkshSpanWidth
# DtkshSpanHeight - Convenience functions for specifying form constraints.
# This set of functions allow a component to be configured
# such that it spans either the full height or width of
# the form widget. This effect is accomplished by attaching
# two edges of the component (top & bottom for DtkshSpanHeight,
# and left and right for DtkshSpanWidth) to the form. The
# component will typically resize whenever the form is
# resized.
#
# Usages:
#
# DtkshSpanWidth [offset]
# DtkshSpanHeight [offset]
#
# The optional offset parameter specifies how far from the edge
# of the form the component should be positioned. If an offset
# is not specified, then 0 is user.
#
# Examples:
#
# XtCreateManagedWidget SEPARATOR $FORM XmSeparator \
# $(DtkshSpanWidth 1 1)
#
DtkshSpanWidth()
{
echo "leftAttachment:ATTACH_FORM leftOffset:${1:-0} \
rightAttachment:ATTACH_FORM rightOffset:${2:-0}"
}
DtkshSpanHeight()
{
echo "topAttachment:ATTACH_FORM topOffset:${1:-0} \
bottomAttachment:ATTACH_FORM bottomOffset:${2:-0}"
}
###############################################################################
#
# DtkshDisplayInformationDialog
# DtkshDisplayQuestionDialog
# DtkshDisplayWarningDialog
# DtkshDisplayWorkingDialog
# DtkshDisplayErrorDialog - Convenience functions for creating a single
# instance of each of the flavors of the Motif
# feedback dialog. If an instance of the requested
# type of dialog already exists, then it will be
# reused. The parent of the dialog is obtained
# from the environment variable $TOPLEVEL, which
# should be set by the calling shell script. The
# handle for the requested dialog is returned in
# one of the following environment variables:
#
# _DT_ERROR_DIALOG_HANDLE
# _DT_QUESTION_DIALOG_HANDLE
# _DT_WORKING_DIALOG_HANDLE
# _DT_WARNING_DIALOG_HANDLE
# _DT_INFORMATION_DIALOG_HANDLE
#
# WARNING: IF ATTACHING YOUR OWN CALLBACKS TO THE DIALOG
# BUTTONS, DO NOT DESTROY THE DIALOG WHEN YOU
# ARE DONE WITH IT; SIMPLY UNMANAGE THE DIALOG,
# SO THAT IT CAN BE USED AT A LATER TIME.
#
# Usages:
#
# DtkshDisplay*Dialog title message okCallback closeCallback helpCallback \
# dialogStyle
#
# The "Ok" button is always managed, and by default will simply unmanage
# the dialog. The "Cancel" and "Help" buttons are only managed when a
# callback is supplied for them.
#
# The "dialogStyle" parameter accepts any of the standard resource settings
# supported by the bulletin board widget.
#
# Examples:
#
# DtkshDisplayErrorDialog "Read Error" "Unable to read the file" "OkCallback" \
# "CancelCallback" "" DIALOG_PRIMARY_APPLICATION_MODAL
#
# Global feedback dialog handles
_DT_ERROR_DIALOG_HANDLE=""
_DT_QUESTION_DIALOG_HANDLE=""
_DT_WORKING_DIALOG_HANDLE=""
_DT_WARNING_DIALOG_HANDLE=""
_DT_INFORMATION_DIALOG_HANDLE=""
_DT_TMP_DIALOG_HANDLE=""
#
# This function was accidentally *not* renamed to DtkshDisplayErrorDialog
# when the sample implementation of dtksh was released; however, the
# documentation tells users to use DtkshDisplayErrorDialog, but it did not
# exist. Therefore, to be backwards compatible, both DtDisplayErrorDialog
# and DtkshDisplayErrorDialog are defined.
#
DtDisplayErrorDialog()
{
_DtkshDisplayFeedbackDialog "$_DT_ERROR_DIALOG_HANDLE" "Error" "${@:-}"
if [ "$_DT_ERROR_DIALOG_HANDLE" = "" ] ; then
_DT_ERROR_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayErrorDialog()
{
_DtkshDisplayFeedbackDialog "$_DT_ERROR_DIALOG_HANDLE" "Error" "${@:-}"
if [ "$_DT_ERROR_DIALOG_HANDLE" = "" ] ; then
_DT_ERROR_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayQuestionDialog()
{
_DtkshDisplayFeedbackDialog "$_DT_QUESTION_DIALOG_HANDLE" "Question" "${@:-}"
if [ "$_DT_QUESTION_DIALOG_HANDLE" = "" ] ; then
_DT_QUESTION_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayWorkingDialog()
{
_DtkshDisplayFeedbackDialog "$_DT_WORKING_DIALOG_HANDLE" "Working" "${@:-}"
if [ "$_DT_WORKING_DIALOG_HANDLE" = "" ] ; then
_DT_WORKING_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayWarningDialog()
{
_DtkshDisplayFeedbackDialog "$_DT_WARNING_DIALOG_HANDLE" "Warning" "${@:-}"
if [ "$_DT_WARNING_DIALOG_HANDLE" = "" ] ; then
_DT_WARNING_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayInformationDialog()
{
_DtkshDisplayFeedbackDialog "$_DT_INFORMATION_DIALOG_HANDLE" "Information" \
"${@:-}"
if [ "$_DT_INFORMATION_DIALOG_HANDLE" = "" ] ; then
_DT_INFORMATION_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
###############################################################################
#
# DtkshDisplayQuickHelpDialog
# DtkshDisplayHelpDialog - Convenience functions for creating a single
# instance of a help dialog and a quick help
# dialog. If an instance of the requested type
# of help dialog already exists, then it will be
# reused. The parent of the dialog is obtained
# from the environment variable $TOPLEVEL, which
# should be set by the calling shell script. The
# handle for the requested dialog is returned in
# one of the following environment variables:
#
# _DT_HELP_DIALOG_HANDLE
# _DT_QUICK_HELP_DIALOG_HANDLE
#
# WARNING: DO NOT DESTROY THIS DIALOG, UNLESS YOU ALSO CLEAR THE
# CORRESPONDING ENVIRONMENT VARIABLE, SO THAT THIS CODE
# WILL NOT ATTEMPT TO REUSE THE DIALOG AGAIN.
#
# Usages:
#
# DtkshDisplay*HelpDialog title helpType helpInformation [locationId]
#
# The meaning of the parameters is dependent upon the value specified
# for the 'helpType' parameter. There meanings are explained below:
#
# helpType = HELP_TYPE_TOPIC
# helpInformation = help volume name
# locationId = help topic location id
#
# helpType = HELP_TYPE_STRING
# helpInformation = help string
# locationId = <not used>
#
# helpType = HELP_TYPE_DYNAMIC_STRING
# helpInformation = help string
# locationId = <not used>
#
# helpType = HELP_TYPE_MAN_PAGE
# helpInformation = man page name
# locationId = <not used>
#
# helpType = HELP_TYPE_FILE
# helpInformation = help file name
# locationId = <not used>
#
# Examples:
#
# DtkshDisplayHelpDialog "Help On Dtksh" HELP_TYPE_FILE "HelpFileName"
#
# Global help dialog handles
_DT_HELP_DIALOG_HANDLE=""
_DT_QUICK_HELP_DIALOG_HANDLE=""
DtkshDisplayQuickHelpDialog()
{
_DtkshDisplayHelpDialog "$_DT_QUICK_HELP_DIALOG_HANDLE" "Quick" "${@:-}"
if [ "$_DT_QUICK_HELP_DIALOG_HANDLE" = "" ] ; then
_DT_QUICK_HELP_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
}
DtkshDisplayHelpDialog()
{
_DtkshDisplayHelpDialog "$_DT_HELP_DIALOG_HANDLE" "" "${@:-}"
if [ "$_DT_HELP_DIALOG_HANDLE" = "" ] ; then
_DT_HELP_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
}
##############################################################################
#
# This internal shell function performs most of the work required to
# create an instance of a feedback dialog (error, warning, information,
# working and question). It will reuse an existing instance of the
# requested type of feedback dialog, if one has already been created;
# otherwise, it will create a new one.
#
# The "Ok" button is always managed, and by default will simply unpost
# the dialog. The "Cancel" and "Help" buttons are only managed if the
# callers specifies a callback for the butttons. Both the "Ok" and
# "Cancel" buttons rely on the fact that the 'autoUnpost' resource for
# the dialog is 'True'.
#
# The implied parent of the dialog is identified by the environment
# variable '$TOPLEVEL'.
#
# The incoming parameters are defined as follows (note that $1 and $2 are
# defined by the convenience function which is calling us, while $3 - $8
# are the parameters which were passed by the caller to the convenience
# function:
#
# $1 = existing dialog handle, or "" if first time
# $2 = type of feedback dialog (Information, Question, Working, ... )
# $3 = dialog title
# $4 = message string
# $5 = okCallback
# $6 = cancelCallback
# $7 = helpCallback
# $8 = dialogStyle
#
_DtkshDisplayFeedbackDialog()
{
if [ "$1" = "" ]; then
XmCreate${2}Dialog _DT_TMP_DIALOG_HANDLE $TOPLEVEL "$2"
else
_DT_TMP_DIALOG_HANDLE=$1
fi
XtSetValues $_DT_TMP_DIALOG_HANDLE \
dialogTitle:"${3:-$2}" \
messageString:"${4:- }" \
dialogStyle:"${8:-DIALOG_MODELESS}"
if [ $# -ge 5 ] && [ "$5" != "" ]; then
XtSetValues $_DT_TMP_DIALOG_HANDLE okCallback:"$5"
fi
if [ $# -lt 6 ] || [ "$6" = "" ]; then
XtUnmanageChild $(XmMessageBoxGetChild "-" $_DT_TMP_DIALOG_HANDLE \
DIALOG_CANCEL_BUTTON)
else
XtSetValues $_DT_TMP_DIALOG_HANDLE cancelCallback:"$6"
fi
if [ $# -lt 7 ] || [ "$7" = "" ]; then
XtUnmanageChild $(XmMessageBoxGetChild "-" $_DT_TMP_DIALOG_HANDLE \
DIALOG_HELP_BUTTON)
else
XtSetValues $_DT_TMP_DIALOG_HANDLE helpCallback:"$7"
fi
_DtkshPositionDialog "$1"
XtManageChild $_DT_TMP_DIALOG_HANDLE
return 0
}
##############################################################################
#
# This internal shell function performs most of the work required to
# create an instance of a help dialog (regular help or quick help)
# It will reuse an existing instance of the requested type of help
# dialog, if one has already been created; otherwise, it will create
# a new one.
#
# The implied parent of the dialog is identified by the environment
# variable '$TOPLEVEL'.
#
# The incoming parameters are defined as follows (note that $1 and $2 are
# defined by the convenience function which is calling us, while $3 - $6
# are the parameters which were passed by the caller to the convenience
# function:
#
# $1 = existing dialog handle, or "" if first time
# $2 = type of help dialog (Quick or "")
# $3 = dialog title
# $4 = help type
# $5 = help information:
# help volume (if help type = HELP_TYPE_TOPIC)
# help string (if help type = HELP_TYPE_STRING)
# help string (if help type = HELP_TYPE_DYNAMIC_STRING)
# man page name (if help type = HELP_TYPE_MAN_PAGE)
# help file name (if help type = HELP_TYPE_FILE)
# $6 = help location Id (if help type = HELP_TYPE_TOPIC)
#
_DtkshDisplayHelpDialog()
{
typeset helpType ARG1="" ARG2="" ARG3=""
typeset helpType VAL1="" VAL2="" VAL3=""
helpType="${4:-HELP_TYPE_TOPIC}"
ARG1="helpType:"
VAL1="$helpType"
case $helpType in
HELP_TYPE_TOPIC) ARG2="helpVolume:"
VAL2="${5:-}"
ARG3="locationId:"
VAL3="${6:-_HOMETOPIC}";;
HELP_TYPE_STRING) ARG2="stringData:"
VAL2="${5:-}";;
HELP_TYPE_DYNAMIC_STRING) ARG2="stringData:"
VAL2="${5:-}";;
HELP_TYPE_MAN_PAGE) ARG2="manPage:"
VAL2="${5:-}";;
HELP_TYPE_FILE) ARG2="helpFile:"
VAL2="${5:-}";;
*) return 1;;
esac
if [ "$1" = "" ]; then
if [ "$ARG3" != "" ]; then
DtCreateHelp${2}Dialog _DT_TMP_DIALOG_HANDLE $TOPLEVEL "$2" \
"${ARG1}${VAL1}" "${ARG2}${VAL2}" "${ARG3}${VAL3}"
else
DtCreateHelp${2}Dialog _DT_TMP_DIALOG_HANDLE $TOPLEVEL "$2" \
"${ARG1}${VAL1}" "${ARG2}${VAL2}"
fi
else
_DT_TMP_DIALOG_HANDLE=$1
if [ "$ARG3" != "" ]; then
XtSetValues $_DT_TMP_DIALOG_HANDLE \
"${ARG1}${VAL1}" "${ARG2}${VAL2}" "${ARG3}${VAL3}"
else
XtSetValues $_DT_TMP_DIALOG_HANDLE \
"${ARG1}${VAL1}" "${ARG2}${VAL2}"
fi
fi
if [ "$2" = "Quick" ]; then
XtSetSensitive $(DtHelpQuickDialogGetChild "-" $_DT_TMP_DIALOG_HANDLE \
HELP_QUICK_HELP_BUTTON) false
fi
XtSetValues $(XtParent "-" $_DT_TMP_DIALOG_HANDLE) title:"${3:-Help}"
_DtkshPositionDialog "$1"
XtManageChild $_DT_TMP_DIALOG_HANDLE
return 0
}
##############################################################################
#
# This internal shell function takes care of positioning the dialog so
# that it is centered over the window for which it is transient; if the
# window it is transient for is not currently managed, then the window
# will be positioned over in the center of the screen.
#
# Positioning does not occur that first time the dialog is posted; that
# is taken care of automatically by Motif and the window manager. It
# only needs to happen for subsequent postings.
#
_DtkshPositionDialog()
{
typeset -i WIDTH HEIGHT X_P Y_P WIDTH_P HEIGHT_P
typeset -i finalX finalY
if [ "$1" != "" ] && ! XtIsManaged $1 && XtIsShell $TOPLEVEL ; then
XtGetValues $1 width:WIDTH height:HEIGHT
if XtIsRealized $TOPLEVEL; then
XtGetValues $TOPLEVEL x:X_P y:Y_P width:WIDTH_P height:HEIGHT_P
(( finalX=$X_P+($WIDTH_P-$WIDTH)/2 ))
(( finalY=$Y_P+($HEIGHT_P-$HEIGHT)/2 ))
else
(( finalX=($(XWidthOfScreen "-" $(XtScreen "-" $1) )-$WIDTH)/2 ))
(( finalY=($(XHeightOfScreen "-" $(XtScreen "-" $1) )-$HEIGHT)/2 ))
fi
XtSetValues $(XtParent "-" $1) x:$finalX y:$finalY
fi
}

View File

@@ -0,0 +1,751 @@
# $XConsortium: DtFuncs.sh.src /main/1 1995/11/01 15:49:09 rswiston $
#
# COMPONENT_NAME: desktop
#
# FUNCTIONS: DtkshAddButtons
# DtkshFloatBottom
# DtkshFloatLeft
# DtkshFloatRight
# DtkshFloatTop
# DtkshLeftOf
# DtkshOver
# DtkshRightOf
# DtkshSetReturnKeyControls
# DtkshUnder
#
# ORIGINS: 27,118,119,120,121
#
# This module contains IBM CONFIDENTIAL code. -- (IBM
# Confidential Restricted when combined with the aggregated
# modules for this product)
# OBJECT CODE ONLY SOURCE MATERIALS
#
# (C) COPYRIGHT International Business Machines Corp. 1995
# All Rights Reserved
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
###############################################################################
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
###############################################################################
###############################################################################
#
# DtkshAddButtons - Convenience function for adding 1 or more buttons of the
# same kind into a composite widget. Most frequently
# used to add a collection of buttons into a menupane.
#
# Usages:
#
# DtkshAddButtons parent widgetClass label1 callback1 [label2 callback2 ...]
#
# DtkshAddButtons [-w] parent widgetClass variable1 label1 callback1 \
# [variable2 label2 callback2 ...]
#
# The "-w" option indicates that the convenience function should return
# the widget handle for each of the created buttons. The widget handle
# is returned in the specified environment variable.
#
# The widgetClass can be one of the following, and will default to the
# XmPushButtonGadget class, if not specified:
#
# XmPushButton
# XmPushButtonGadget
# XmToggleButton
# XmToggleButtonGadget
# XmCascadeButton
# XmCascadeButtonGadget
#
# Examples:
#
# DtkshAddButtons $MENU XmPushButtonGadget Open do_Open Save do_Save Quit exit
#
# DtkshAddButtons -w $MENU XmPushButtonGadget B1 Open do_Open B2 Save do_Save
#
DtkshAddButtons()
{
typeset parent widgetClass callback returnWidget="false" TMP=""
typeset -i paramCount=2
if [ $# -ge 1 ] && [ x"$1" = "x-w" ]; then
returnWidget=true
paramCount=3
shift
fi
if [ $# -lt 2 ]; then
return 1
fi
parent=$1
shift
widgetClass=${1:-XmPushButtonGadget}
shift
case $widgetClass in
XmPushButtonGadget) callback=activateCallback;;
XmPushButton) callback=activateCallback;;
XmToggleButtonGadget) callback=valueChangedCallback;;
XmToggleButton) callback=valueChangedCallback;;
XmCascadeButtonGadget) callback=activateCallback;;
XmCascadeButton) callback=activateCallback;;
*) return 1
esac
while [ $# -ge $paramCount ]
do
if [ "$returnWidget" = true ]; then
if [ ! "$3" = "" ]; then
XtCreateManagedWidget "$1" "$1" $widgetClass "$parent" \
labelString:"$2" ${callback}:"$3"
else
XtCreateManagedWidget "$1" "$1" $widgetClass "$parent" \
labelString:"$2"
fi
shift 3
else
if [ ! "$2" = "" ]; then
XtCreateManagedWidget Id "btn" $widgetClass "$parent" \
labelString:"$1" ${callback}:"$2"
else
XtCreateManagedWidget Id "btn" $widgetClass "$parent" \
labelString:"$1"
fi
shift 2
fi
done
return 0
}
###############################################################################
#
# DtkshSetReturnKeyControls - Convenience function for configuring a text
# widget (within a form!) so that the Return key does not
# activate the default button within the form, but instead
# moves the focus to the next text widget within the form.
# This is useful if you have a window which contains a
# series of text fields, and the default button should not
# be activated until the user presses the Return key in the
# last text field.
#
# Usage:
#
# DtkshSetReturnKeyControls textWidgetId nextTextWidgetId formWidgetId \
# defaultButtonId
#
# The textWidgetId parameter specifies the widget which is to be configured
# to catch the 'Return' key, and force the focus to move to the next text
# widget (as indicated by the nextTextWidgetId parameter). The formWidgetId
# parameter specifies the form which contains the default button, and should
# be the parent of the two text widgets. The defaultButtonId indicates which
# component is to be treated as the default button within the form.
#
# Examples:
#
# DtkshSetReturnKeyControls $TEXT1 $TEXT2 $FORM $OK
# DtkshSetReturnKeyControls $TEXT2 $TEXT3 $FORM $OK
#
DtkshSetReturnKeyControls()
{
if [ $# -ne 4 ]; then
return 1
fi
XtAddCallback $1 focusCallback "XtSetValues $3 defaultButton:NULL"
XtAddCallback $1 losingFocusCallback "XtSetValues $3 defaultButton:$4"
XtOverrideTranslations $1 \
"Ctrl<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")
<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")"
return 0
}
###############################################################################
#
# DtkshUnder
# DtkshOver
# DtkshRightOf
# DtkshLeftOf - Convenience functions for specifying form constraints.
# This set of functions allow a component to be attached
# to one of the edges of another component.
#
# Usages:
#
# DtkshUnder widgetId [offset]
# DtkshOver widgetId [offset]
# DtkshRightOf widgetId [offset]
# DtkshLeftOf widgetId [offset]
#
# The widgetId parameter specifies the widget to which the current
# component is to be attached. The offset value is optional, and
# defaults to 0 if not specified.
#
# Examples:
#
# XtCreateManagedWidget BUTTON2 button2 XmPushButton $FORM \
# labelString:"Exit" \
# $(DtkshUnder $BUTTON1)
#
DtkshUnder()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "topWidget:$1 topAttachment:ATTACH_WIDGET topOffset:${2:-0}"
}
DtkshOver()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "bottomWidget:$1 bottomAttachment:ATTACH_WIDGET bottomOffset:${2:-0}"
}
DtkshRightOf()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "leftWidget:$1 leftAttachment:ATTACH_WIDGET leftOffset:${2:-0}"
}
DtkshLeftOf()
{
if [ $# -lt 1 ]; then
return 1
fi
echo "rightWidget:$1 rightAttachment:ATTACH_WIDGET rightOffset:${2:-0}"
}
###############################################################################
#
# DtkshFloatRight
# DtkshFloatLeft
# DtkshFloatTop
# DtkshFloatBottom - Convenience functions for specifying form constraints.
# This set of functions allow a component to be positioned
# independent of the other components within the form.
# As the form grows or shrinks, the component maintains
# its relative position within the form. The component
# may still grow or shrink, depending upon the other form
# constraints which have been specified for the component.
#
# Usages:
#
# DtkshFloatRight [position]
# DtkshFloatLeft [position]
# DtkshFloatTop [position]
# DtkshFloatBottom [position]
#
# The optional position parameter specifies the relative position
# to which the indicated edge of the component will be positioned.
# A default position is used, if not specified.
#
# Examples:
#
# XtCreateManagedWidget BUTTON1 button1 XmPushButton $FORM \
# labelString:"Ok" \
# $(DtkshUnder $SEPARATOR) \
# $(DtkshFloatLeft 10) \
# $(DtkshFloatRight 40)
#
DtkshFloatRight()
{
echo "rightAttachment:ATTACH_POSITION rightPosition:${1:-0}"
}
DtkshFloatLeft()
{
echo "leftAttachment:ATTACH_POSITION leftPosition:${1:-0}"
}
DtkshFloatTop()
{
echo "topAttachment:ATTACH_POSITION topPosition:${1:-0}"
}
DtkshFloatBottom()
{
echo "bottomAttachment:ATTACH_POSITION bottomPosition:${1:-0}"
}
###############################################################################
#
# DtkshAnchorRight
# DtkshAnchorLeft
# DtkshAnchorTop
# DtkshAnchorBottom - Convenience functions for specifying form constraints.
# This set of functions allow a component to be attached
# to one of the edges of the form in such a fashion that
# as the form grows or shrinks, the component's position
# does not change. However, depending upon the other
# form constaints set on this component, the component
# may still grow or shrink in size.
#
# Usages:
#
# DtkshAnchorRight [offset]
# DtkshAnchorLeft [offset]
# DtkshAnchorTop [offset]
# DtkshAnchorBottom [offset]
#
# The optional offset parameter specifies how far from the edge
# of the form the component should be positioned. If an offset
# is not specified, then 0 is user.
#
# Examples:
#
# XtCreateManagedWidget BUTTON1 button1 XmPushButton $FORM \
# labelString:"Ok" \
# $(DtkshUnder $SEPARATOR) \
# $(DtkshAnchorLeft 10) \
# $(DtkshAnchorBottom 10)
#
DtkshAnchorRight()
{
echo "rightAttachment:ATTACH_FORM rightOffset:${1:-0}"
}
DtkshAnchorLeft()
{
echo "leftAttachment:ATTACH_FORM leftOffset:${1:-0}"
}
DtkshAnchorTop()
{
echo "topAttachment:ATTACH_FORM topOffset:${1:-0}"
}
DtkshAnchorBottom()
{
echo "bottomAttachment:ATTACH_FORM bottomOffset:${1:-0}"
}
###############################################################################
#
# DtkshSpanWidth
# DtkshSpanHeight - Convenience functions for specifying form constraints.
# This set of functions allow a component to be configured
# such that it spans either the full height or width of
# the form widget. This effect is accomplished by attaching
# two edges of the component (top & bottom for DtkshSpanHeight,
# and left and right for DtkshSpanWidth) to the form. The
# component will typically resize whenever the form is
# resized.
#
# Usages:
#
# DtkshSpanWidth [offset]
# DtkshSpanHeight [offset]
#
# The optional offset parameter specifies how far from the edge
# of the form the component should be positioned. If an offset
# is not specified, then 0 is user.
#
# Examples:
#
# XtCreateManagedWidget SEPARATOR $FORM XmSeparator \
# $(DtkshSpanWidth 1 1)
#
DtkshSpanWidth()
{
echo "leftAttachment:ATTACH_FORM leftOffset:${1:-0} \
rightAttachment:ATTACH_FORM rightOffset:${2:-0}"
}
DtkshSpanHeight()
{
echo "topAttachment:ATTACH_FORM topOffset:${1:-0} \
bottomAttachment:ATTACH_FORM bottomOffset:${2:-0}"
}
###############################################################################
#
# DtkshDisplayInformationDialog
# DtkshDisplayQuestionDialog
# DtkshDisplayWarningDialog
# DtkshDisplayWorkingDialog
# DtkshDisplayErrorDialog - Convenience functions for creating a single
# instance of each of the flavors of the Motif
# feedback dialog. If an instance of the requested
# type of dialog already exists, then it will be
# reused. The parent of the dialog is obtained
# from the environment variable $TOPLEVEL, which
# should be set by the calling shell script. The
# handle for the requested dialog is returned in
# one of the following environment variables:
#
# _DT_ERROR_DIALOG_HANDLE
# _DT_QUESTION_DIALOG_HANDLE
# _DT_WORKING_DIALOG_HANDLE
# _DT_WARNING_DIALOG_HANDLE
# _DT_INFORMATION_DIALOG_HANDLE
#
# WARNING: IF ATTACHING YOUR OWN CALLBACKS TO THE DIALOG
# BUTTONS, DO NOT DESTROY THE DIALOG WHEN YOU
# ARE DONE WITH IT; SIMPLY UNMANAGE THE DIALOG,
# SO THAT IT CAN BE USED AT A LATER TIME.
#
# Usages:
#
# DtDisplay*Dialog title message okCallback closeCallback helpCallback \
# dialogStyle
#
# The "Ok" button is always managed, and by default will simply unmanage
# the dialog. The "Cancel" and "Help" buttons are only managed when a
# callback is supplied for them.
#
# The "dialogStyle" parameter accepts any of the standard resource settings
# supported by the bulletin board widget.
#
# Examples:
#
# DtkshDisplayErrorDialog "Read Error" "Unable to read the file" \
# "OkCallback" "CancelCallback" "" \
# DIALOG_PRIMARY_APPLICATION_MODAL
#
# Global feedback dialog handles
_DT_ERROR_DIALOG_HANDLE=""
_DT_QUESTION_DIALOG_HANDLE=""
_DT_WORKING_DIALOG_HANDLE=""
_DT_WARNING_DIALOG_HANDLE=""
_DT_INFORMATION_DIALOG_HANDLE=""
_DT_TMP_DIALOG_HANDLE=""
DtkshDisplayErrorDialog()
{
_DtDisplayFeedbackDialog "$_DT_ERROR_DIALOG_HANDLE" "Error" "${@:-}"
if [ "$_DT_ERROR_DIALOG_HANDLE" = "" ] ; then
_DT_ERROR_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayQuestionDialog()
{
_DtDisplayFeedbackDialog "$_DT_QUESTION_DIALOG_HANDLE" "Question" "${@:-}"
if [ "$_DT_QUESTION_DIALOG_HANDLE" = "" ] ; then
_DT_QUESTION_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayWorkingDialog()
{
_DtDisplayFeedbackDialog "$_DT_WORKING_DIALOG_HANDLE" "Working" "${@:-}"
if [ "$_DT_WORKING_DIALOG_HANDLE" = "" ] ; then
_DT_WORKING_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayWarningDialog()
{
_DtDisplayFeedbackDialog "$_DT_WARNING_DIALOG_HANDLE" "Warning" "${@:-}"
if [ "$_DT_WARNING_DIALOG_HANDLE" = "" ] ; then
_DT_WARNING_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
DtkshDisplayInformationDialog()
{
_DtDisplayFeedbackDialog "$_DT_INFORMATION_DIALOG_HANDLE" "Information" \
"${@:-}"
if [ "$_DT_INFORMATION_DIALOG_HANDLE" = "" ] ; then
_DT_INFORMATION_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
return 0
}
###############################################################################
#
# DtkshDisplayQuickHelpDialog
# DtkshDisplayHelpDialog - Convenience functions for creating a single
# instance of a help dialog and a quick help
# dialog. If an instance of the requested type
# of help dialog already exists, then it will be
# reused. The parent of the dialog is obtained
# from the environment variable $TOPLEVEL, which
# should be set by the calling shell script. The
# handle for the requested dialog is returned in
# one of the following environment variables:
#
# _DT_HELP_DIALOG_HANDLE
# _DT_QUICK_HELP_DIALOG_HANDLE
#
# WARNING: DO NOT DESTROY THIS DIALOG, UNLESS YOU ALSO CLEAR THE
# CORRESPONDING ENVIRONMENT VARIABLE, SO THAT THIS CODE
# WILL NOT ATTEMPT TO REUSE THE DIALOG AGAIN.
#
# Usages:
#
# DtDisplay*HelpDialog title helpType helpInformation [locationId]
#
# The meaning of the parameters is dependent upon the value specified
# for the 'helpType' parameter. There meanings are explained below:
#
# helpType = HELP_TYPE_TOPIC
# helpInformation = help volume name
# locationId = help topic location id
#
# helpType = HELP_TYPE_STRING
# helpInformation = help string
# locationId = <not used>
#
# helpType = HELP_TYPE_DYNAMIC_STRING
# helpInformation = help string
# locationId = <not used>
#
# helpType = HELP_TYPE_MAN_PAGE
# helpInformation = man page name
# locationId = <not used>
#
# helpType = HELP_TYPE_FILE
# helpInformation = help file name
# locationId = <not used>
#
# Examples:
#
# DtkshDisplayHelpDialog "Help On Dtksh" HELP_TYPE_FILE "HelpFileName"
#
# Global help dialog handles
_DT_HELP_DIALOG_HANDLE=""
_DT_QUICK_HELP_DIALOG_HANDLE=""
DtkshDisplayQuickHelpDialog()
{
_DtkshDisplayHelpDialog "$_DT_QUICK_HELP_DIALOG_HANDLE" "Quick" "${@:-}"
if [ "$_DT_QUICK_HELP_DIALOG_HANDLE" = "" ] ; then
_DT_QUICK_HELP_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
}
DtkshDisplayHelpDialog()
{
_DtkshDisplayHelpDialog "$_DT_HELP_DIALOG_HANDLE" "" "${@:-}"
if [ "$_DT_HELP_DIALOG_HANDLE" = "" ] ; then
_DT_HELP_DIALOG_HANDLE=$_DT_TMP_DIALOG_HANDLE
fi
}
##############################################################################
#
# This internal shell function performs most of the work required to
# create an instance of a feedback dialog (error, warning, information,
# working and question). It will reuse an existing instance of the
# requested type of feedback dialog, if one has already been created;
# otherwise, it will create a new one.
#
# The "Ok" button is always managed, and by default will simply unpost
# the dialog. The "Cancel" and "Help" buttons are only managed if the
# callers specifies a callback for the butttons. Both the "Ok" and
# "Cancel" buttons rely on the fact that the 'autoUnpost' resource for
# the dialog is 'True'.
#
# The implied parent of the dialog is identified by the environment
# variable '$TOPLEVEL'.
#
# The incoming parameters are defined as follows (note that $1 and $2 are
# defined by the convenience function which is calling us, while $3 - $8
# are the parameters which were passed by the caller to the convenience
# function:
#
# $1 = existing dialog handle, or "" if first time
# $2 = type of feedback dialog (Information, Question, Working, ... )
# $3 = dialog title
# $4 = message string
# $5 = okCallback
# $6 = cancelCallback
# $7 = helpCallback
# $8 = dialogStyle
#
_DtDisplayFeedbackDialog()
{
if [ "$1" = "" ]; then
XmCreate${2}Dialog _DT_TMP_DIALOG_HANDLE $TOPLEVEL "$2"
else
_DT_TMP_DIALOG_HANDLE=$1
fi
XtSetValues $_DT_TMP_DIALOG_HANDLE \
dialogTitle:"${3:-$2}" \
messageString:"${4:- }" \
dialogStyle:"${8:-DIALOG_MODELESS}"
if [ $# -ge 5 ] && [ "$5" != "" ]; then
XtSetValues $_DT_TMP_DIALOG_HANDLE okCallback:"$5"
fi
if [ $# -lt 6 ] || [ "$6" = "" ]; then
XtUnmanageChild $(XmMessageBoxGetChild "-" $_DT_TMP_DIALOG_HANDLE \
DIALOG_CANCEL_BUTTON)
else
XtSetValues $_DT_TMP_DIALOG_HANDLE cancelCallback:"$6"
fi
if [ $# -lt 7 ] || [ "$7" = "" ]; then
XtUnmanageChild $(XmMessageBoxGetChild "-" $_DT_TMP_DIALOG_HANDLE \
DIALOG_HELP_BUTTON)
else
XtSetValues $_DT_TMP_DIALOG_HANDLE helpCallback:"$7"
fi
_DtkshPositionDialog "$1"
XtManageChild $_DT_TMP_DIALOG_HANDLE
return 0
}
##############################################################################
#
# This internal shell function performs most of the work required to
# create an instance of a help dialog (regular help or quick help)
# It will reuse an existing instance of the requested type of help
# dialog, if one has already been created; otherwise, it will create
# a new one.
#
# The implied parent of the dialog is identified by the environment
# variable '$TOPLEVEL'.
#
# The incoming parameters are defined as follows (note that $1 and $2 are
# defined by the convenience function which is calling us, while $3 - $6
# are the parameters which were passed by the caller to the convenience
# function:
#
# $1 = existing dialog handle, or "" if first time
# $2 = type of help dialog (Quick or "")
# $3 = dialog title
# $4 = help type
# $5 = help information:
# help volume (if help type = HELP_TYPE_TOPIC)
# help string (if help type = HELP_TYPE_STRING)
# help string (if help type = HELP_TYPE_DYNAMIC_STRING)
# man page name (if help type = HELP_TYPE_MAN_PAGE)
# help file name (if help type = HELP_TYPE_FILE)
# $6 = help location Id (if help type = HELP_TYPE_TOPIC)
#
_DtkshDisplayHelpDialog()
{
typeset helpType ARG1="" ARG2="" ARG3=""
typeset helpType VAL1="" VAL2="" VAL3=""
helpType="${4:-HELP_TYPE_TOPIC}"
ARG1="helpType:"
VAL1="$helpType"
case $helpType in
HELP_TYPE_TOPIC) ARG2="helpVolume:"
VAL2="${5:-}"
ARG3="locationId:"
VAL3="${6:-_HOMETOPIC}";;
HELP_TYPE_STRING) ARG2="stringData:"
VAL2="${5:-}";;
HELP_TYPE_DYNAMIC_STRING) ARG2="stringData:"
VAL2="${5:-}";;
HELP_TYPE_MAN_PAGE) ARG2="manPage:"
VAL2="${5:-}";;
HELP_TYPE_FILE) ARG2="helpFile:"
VAL2="${5:-}";;
*) return 1;;
esac
if [ "$1" = "" ]; then
if [ "$ARG3" != "" ]; then
DtCreateHelp${2}Dialog _DT_TMP_DIALOG_HANDLE $TOPLEVEL "$2" \
"${ARG1}${VAL1}" "${ARG2}${VAL2}" "${ARG3}${VAL3}"
else
DtCreateHelp${2}Dialog _DT_TMP_DIALOG_HANDLE $TOPLEVEL "$2" \
"${ARG1}${VAL1}" "${ARG2}${VAL2}"
fi
else
_DT_TMP_DIALOG_HANDLE=$1
if [ "$ARG3" != "" ]; then
XtSetValues $_DT_TMP_DIALOG_HANDLE \
"${ARG1}${VAL1}" "${ARG2}${VAL2}" "${ARG3}${VAL3}"
else
XtSetValues $_DT_TMP_DIALOG_HANDLE \
"${ARG1}${VAL1}" "${ARG2}${VAL2}"
fi
fi
if [ "$2" = "Quick" ]; then
XtSetSensitive $(DtHelpQuickDialogGetChild "-" $_DT_TMP_DIALOG_HANDLE \
HELP_QUICK_HELP_BUTTON) false
fi
XtSetValues $(XtParent "-" $_DT_TMP_DIALOG_HANDLE) title:"${3:-Help}"
_DtkshPositionDialog "$1"
XtManageChild $_DT_TMP_DIALOG_HANDLE
return 0
}
##############################################################################
#
# This internal shell function takes care of positioning the dialog so
# that it is centered over the window for which it is transient; if the
# window it is transient for is not currently managed, then the window
# will be positioned over in the center of the screen.
#
# Positioning does not occur that first time the dialog is posted; that
# is taken care of automatically by Motif and the window manager. It
# only needs to happen for subsequent postings.
#
_DtkshPositionDialog()
{
typeset -i WIDTH HEIGHT X_P Y_P WIDTH_P HEIGHT_P
typeset -i finalX finalY
if [ "$1" != "" ] && ! XtIsManaged $1 && XtIsShell $TOPLEVEL ; then
XtGetValues $1 width:WIDTH height:HEIGHT
if XtIsRealized $TOPLEVEL; then
XtGetValues $TOPLEVEL x:X_P y:Y_P width:WIDTH_P height:HEIGHT_P
(( finalX=$X_P+($WIDTH_P-$WIDTH)/2 ))
(( finalY=$Y_P+($HEIGHT_P-$HEIGHT)/2 ))
else
(( finalX=($(XWidthOfScreen "-" $(XtScreen "-" $1) )-$WIDTH)/2 ))
(( finalY=($(XHeightOfScreen "-" $(XtScreen "-" $1) )-$HEIGHT)/2 ))
fi
XtSetValues $(XtParent "-" $1) x:$finalX y:$finalY
fi
}

17
cde/programs/dtksh/Dtksh Normal file
View File

@@ -0,0 +1,17 @@
!######################################################################
!#
!# Dtksh
!#
!# Common Desktop Environment (CDE)
!#
!# Application Defaults for the CDE dtksh application
!#
!# (c) Copyright 1993, 1994 Hewlett-Packard Company
!# (c) Copyright 1993, 1994 International Business Machines Corp.
!# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
!#
!# $XConsortium: Dtksh /main/3 1995/11/01 15:49:19 rswiston $
!#
!######################################################################
#include "Dt"

View File

@@ -0,0 +1,138 @@
XCOMM $TOG: Imakefile /main/15 1998/04/07 08:55:29 mgreess $
DESKTOP_VERSION_STRING = DesktopVersionString
KSH93SRC = ./ksh93
INCLUDES = -I. -I$(KSH93SRC)/include/ast -I$(KSH93SRC)/src/cmd/ksh93/include -I$(KSH93SRC)/src/cmd/ksh93
/* DEPLIBS contains the list of library depencies for a client.
* LOCAL_LIBRARIES contains the list of libraries on the link line.
* Generally, the dependency form of a library has DEP as a prefix.
* e.g. put $(XLIB) in LOCAL_LIBRARIES and $(DEPXLIB) in DEPLIBS.
* NOTE: if DEPLIBS is not set here, it is by default null and there
* are no library dependencies for clients.
* You cannot put -Llibpath into DEPLIBS. You must put actual
* paths to the library.
*/
DEPLIBS = $(DEPDTHELPLIB) $(DEPDTSVCLIB) $(DEPDTWIDGETLIB) $(DEPDTPRINTLIB) \
$(DEPXPLIB) $(DEPTTLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) \
$(KSH93SRC)/lib/libast.a
LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(DTPRINTLIB) \
$(XPLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) \
$(KSH93SRC)/lib/libcmd.a $(KSH93SRC)/lib/libast.a
SYS_LIBRARIES = -lm $(DYNLIBSYSLIB) $(REGEXSYSLIB) $(ICONVSYSLIB)
#ifdef HPArchitecture
EXTRA_DEFINES = -Wl,-E -DHPUX_DYNLIB -Wp,-H12000
SYS_LIBRARIES = -lm -ldld
#endif
#ifdef RsArchitecture
EXTRA_DEFINES = -DDYNLIB -D_IBMRPC_
LOCAL_LDFLAGS = -bE:dtksh.exp
#endif
#if defined (SunArchitecture)
EXTRA_DEFINES = -DDYNLIB
#endif
#if defined (USLArchitecture)
EXTRA_DEFINES = -DDYNLIB
LOCAL_LDFLAGS = -Wl,-Bexport:dtksh.exp
#endif
#if defined (UXPArchitecture)
EXTRA_DEFINES = -DDYNLIB
LOCAL_LDFLAGS = -Wl,-Bexport:dtksh.exp
#endif
#if defined(HPOSFArchitecture)
#endif
#if defined(ApolloArchitecture)
EXTRA_INCLUDES = -I/bsd4.3/usr/include -I/sys5/usr/include \
-I$(DTHELPSRC) -I$(DTPRINTSRC)
#else
EXTRA_INCLUDES = -I$(DTHELPSRC) -I$(DTPRINTSRC)
#endif
#ifdef SunArchitecture
.NO_PARALLEL:
#endif
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
#if defined(LinuxArchitecture)
SUBDIRS = examples
KSH93OBJ =
#else
SUBDIRS = examples ksh93
KSH93OBJ = $(KSH93SRC)/ksh93.o
#endif
MakeSubdirs($(SUBDIRS))
KSH93LIBSHELL = $(KSH93SRC)/src/cmd/ksh93/libshell.a
PROGRAMS = dtksh
SRCS = \
userinit.c \
builtins.c \
aliases.c \
widget.c \
dtkcvt.c \
dtkcmds.c \
XtCvtrs.c \
xmcvt.c \
xmcmds.c \
xmwidgets.c \
extra.c \
xmdtksym.c \
findsym.c \
msgs.c \
version.c
OBJS = \
$(KSH93OBJ) \
libshell.a \
widget.o \
dtkcvt.o \
dtkcmds.o \
XtCvtrs.o \
xmcvt.o \
xmcmds.o \
xmwidgets.o \
extra.o \
xmdtksym.o \
findsym.o \
msgs.o \
version.o \
$(LOCAL_LIBRARIES2)
all:: dtksh
$(KSH93SRC)/ksh93.o:
cd $(KSH93SRC); $(MAKE)
XCOMM
XCOMM Must replace standard ksh tables of builtins and aliases
XCOMM with our augmented versions.
XCOMM
libshell.a: $(KSH93SLIBSHELL) userinit.o builtins.o aliases.o
$(CP) $(KSH93LIBSHELL) libshell.a; \
ar d libshell.a userinit.o builtins.o aliases.o ; \
$(AR) libshell.a userinit.o builtins.o aliases.o
SpecialObjectRule(userinit.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ )
SpecialObjectRule(builtins.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ )
SpecialObjectRule(aliases.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ )
ComplexProgramTarget($(PROGRAMS))
clean::
@echo " Cleaning ksh directories"
./MakeClean

102
cde/programs/dtksh/MakeClean Executable file
View File

@@ -0,0 +1,102 @@
#! /bin/ksh
echo
find . -name MAM.time -print -exec rm -f {} \;
echo
echo "******************"
echo
find . -name in.log -print -exec rm -f {} \;
echo
echo "******************"
echo
find . -name \*.a -print -exec rm -f {} \;
echo
echo "******************"
echo
find . -name \*.o -print -exec rm -f {} \;
echo
echo "******************"
echo
find . -name BUILT -print -exec rm -f {} \;
echo
echo "******************"
echo
find . -name ERROR -print -exec rm -f {} \;
echo
echo "******************"
echo
echo "rm ksh93/bin/*"
rm -f ksh93/bin/feature
rm -f ksh93/bin/iffe
rm -f ksh93/bin/ignore
rm -f ksh93/bin/pax
rm -f ksh93/bin/bax
rm -f ksh93/bin/pax.save
rm -f ksh93/bin/proto
rm -f ksh93/bin/silent
rm -f ksh93/bin/suid_exec
rm -f ksh93/bin/shcomp
rm -f ksh93/bin/nocom
rm -f ksh93/bin/*.old
echo
echo "rm ksh93/src/cmd/ksh93/suid_exec"
rm -f ksh93/src/cmd/ksh93/suid_exec
echo "rm ksh93/src/cmd/ksh93/shcomp"
rm -f ksh93/src/cmd/ksh93/shcomp
echo "rm ksh93/src/cmd/ksh93/ksh.msg"
rm -f ksh93/src/cmd/ksh93/ksh.msg
echo "rm ksh93/src/cmd/pax/pax"
rm -f ksh93/src/cmd/pax/pax
echo "rm ksh93/src/cmd/pax/bax"
rm -f ksh93/src/cmd/pax/bax
echo "rm ksh93/src/cmd/pax/nocom"
rm -f ksh93/src/cmd/pax/nocom
echo "rm ksh93/src/cmd/pax/cpio"
rm -f ksh93/src/cmd/pax/cpio
echo "rm ksh93/src/cmd/pax/tar"
rm -f ksh93/src/cmd/pax/tar
#echo "rm ksh93/src/lib/libcmd/cmd.h"
#rm -f ksh93/src/lib/libcmd/cmd.h
echo "rm ksh93/src/lib/libcmd/cmd.req"
rm -f ksh93/src/lib/libcmd/cmd.req
echo "rm ksh93/src/cmd/ksh"
rm -f ksh93/src/cmd/ksh
echo "rm ksh93/bin/ksh"
rm -f ksh93/bin/ksh
echo "rm ksh93/ship/shipslog/!t_gryphon_dgk"
rm -f ksh93/ship/shipslog/!t_gryphon_dgk
echo "rm ksh93/ship/shipslog/!t_gryphon_gsf"
rm -f ksh93/ship/shipslog/!t_gryphon_gsf
echo "rm ksh93/src/cmd/ksh93/FEATURE/*"
rm -f ksh93/src/cmd/ksh93/FEATURE/*
echo "rm ksh93/src/cmd/pax/FEATURE/*"
rm -f ksh93/src/cmd/pax/FEATURE/*
echo "rm ksh93/src/lib/libast/FEATURE/*"
rm -f ksh93/src/lib/libast/FEATURE/*
echo "rm ksh93/src/lib/libcmd/FEATURE/*"
rm -f ksh93/src/lib/libcmd/FEATURE/*
echo "rm ksh93/src/lib/libast/*.h"
rm -f ksh93/src/lib/libast/*.h
echo "rm ksh93/src/lib/libast/conf"
rm -f ksh93/src/lib/libast/conf
echo "rm ksh93/src/lib/lib0ast/hostinfo"
rm -f ksh93/src/lib/lib0ast/hostinfo
echo "rm ksh93/src/cmd/ksh93/ksh"
rm -f ksh93/src/cmd/ksh93/ksh
echo "rm ksh93/ship/SHIP*"
rm -f ksh93/ship/SHIP*
echo "rm ksh93/ship/shipfeature"
rm -f ksh93/ship/shipfeature
echo "rm ksh93/ship/shipproto"
rm -f ksh93/ship/shipproto

View File

@@ -0,0 +1,370 @@
/* $XConsortium: README-DEVELOPER /main/3 1996/07/15 14:12:13 drk $ */
IMPORTANT!!! PLEASE READ ON!!
------------------------------
The intention of this file is to outline the procedure to use, anytime
a new update of the ksh-93 source is received. When you receive the
new source package, you will first need to do the following:
0) mkdir ksh93-base
1) copy the packing into this directory
2) uudecode the package
3) uncompress the package
4) un-tar the package into ksh93-base (you may need to use
cpio, if that is what Korn used to create his package).
Once the source ball has been un-tar'ed, go down into the hierarchy,
until you see a directory called 'ship' ; don't go down into the 'ship'
directory, simply stop at its parent. Dave Korn uses his own mechanism
for creating the actual ksh-93 sources. It's not like you can simply
look at what is in the 'ship' directory. Instead, you need to run his
'shipin' tool, which takes his base source ball, and applies all of his
patches, thus generating the source tree. To start this process, which
will result in the latest source files being generated, issue the following
commands:
<First, log onto a 10.0 build machine, such as hpcvusp>
/bin/ksh
export SHELL=/bin/ksh
nohup /bin/ksh ship/shipin -u -L&
tail -f nohup.out
When this completes, you will notice that the current directory now
contains a series of other subdirectories; the only ones we really care
about now are the 'man', 'ship' and the 'src' subdirectories.
The trick now is to determine which of the files in
these subdirectories have changed, so that you can update the real
dtksh/ksh93 source tree. You will want to copy into the dtksh/ksh93/ship
directory the newest versions of the following files:
shipiffe.sh
shipout
shipin
shipproto.c
shipop.c
Go into the 'shipin' file, and locate the several places where it attempts
to mail out information (I look for the word 'mail', until I find what
looks like the correct places). Remove this code, since we don't want
a ton of mail messages happening each time we build.
Within the 'ship' directory, you will notice a series of subdirectories;
each one of these corresponds to one of the pieces making up the ksh93
client (i.e. there is one for each library: libast, libcmd, libvdelta, etc).
Within each of these subdirectories is another subdirectory, whose name
represents the date that source depot was created (i.e. 950619). You will
need to recreate these dated directories, along with their contents, within
your dtksh tree (under dtksh/ksh93/ship). Within each dated directory,
copy over (and check in) the items, copyright, UNCRATED and owner files.
Check in a dummy 'base' file also. Doing these steps will allow the ksh
build to proceed, without it ever again attempting to uncrate new ksh93
sources. The 'items' file is particularly important, since it indicates
which other libraries the indicated piece is dependent upon.
====================
In /clone/fred/DtkshTools I have a collection of scripts which make it easier
to update a dtksh tree with new ksh sources. The steps for determining which
files have changed are as follows:
1) First get a list of all of the files in the new source tree. I do this
with the following steps:
cd ksh93-base (This is the tree you just untar'ed)
find src -print > srcList
This gives you a complete list of all of the source files.
2) Use this list to determine which source files are new or have changed:
/clone/fred/DtkshTools/CheckKshSrc dtksh ksh93-base srcList > diffList
The output generated by the above script will tell you which files have
changed, which have not changed, and which have been added.
3) You now need to take the diffList, and modify it so that it only
contains the name of new or changed files within the ksh93 source
tree:
/clone/fred/DtkshTools/CreateTrimList diffList > trimList
4) Now, we will delete the files in the dtksh tree which we are going
to replace; we do this before we copy over the new versions:
/clone/fred/DtkshTools/TrimOldSrcs /clone/fred/dtksh trimList
5) We now need to check out (Rcs -l) the files we are going to replace:
/clone/fred/DtkshTools/CheckOutSrcs /clone/fred/dtksh trimList
If at any time you want to get a complete list of checked out files
in your dtksh tree, issue the following commands:
find /clone/fred/dtksh -type d > dirList
/clone/fred/DtkshTools/RunRcslocks dirList
6) We are now ready to copy the new source files out of the ksh93-base
directory, and into the dtksh directory:
cd /clone/fred
/clone/fred/DtkshTools/CopyNewSrcs ksh93-base dtksh trimList
====================
You're not done yet, however. We have found it necessary to modify
several of the stock ksh sources, Makefiles and Mamfiles, to accomodate
problems we have encountered, or to enable options not turned on by
default, such as multibyte support. You will need to make sure that
these changes get rolled back in, before checking in the new source.
The following source files need to have changes added:
src/cmd/ksh93/Makefile (*** THIS STEP IS OBSOLETE ***)
----------------------
Change: MULTIBYTE ==
To: MULTIBYTE == 1
src/cmd/ksh93/Mamfile (*** THIS STEP IS OBSOLETE ***)
---------------------
Change: setv MULTIBYTE -UMULTIBYTE
To: setv MULTIBYTE -DMULTIBYTE
src/cmd/ksh93/OPTIONS (*** THIS STEP IS OBSOLETE ***)
---------------------
Change: MULTIBYTE=0
To: MULTIBYTE=1
***
The following two files must change, to prevent the ksh source from linking
in its own malloc package. This creates problems on the IBM platform, due
to the way their libraries are built. As it turns out, the IBM Xt library
already has all of its malloc/free/etc calls resolved to their standard
libc malloc functions. If ksh defines its own malloc package, then dtksh
ends of effectively linked simultaneously to two different malloc packages.
This rapidly leads to a core dump, due to cross contamination of the
memory pools (i.e. A value obtained by XtMalloc() passed to free() ). As
it turns out, this also creates problems on the HP platform, as was
recently discovered (Note that it appears that the problem which was
seen on the HP platform was due to a defect in the ksh93 memory allocation
code; this defect had not yet been fixed in the ksh93-d release. Until
the time that this is fixed, we must continue to be sure to not link
in ksh93's malloc package).
src/lib/libast/Makefile
-----------------------
Remove: calloc.c malloc.c from the list of sources
src/lib/libast/Mamfile
----------------------
Remove: calloc.o malloc.o from the archive line; DO NOT REMOVE
ANY OF THE OTHER REFERENCES TO malloc OR calloc, AS
THIS WILL CAUSE THE BUILD TO BREAK.
***
Another file which needs special handling is builtins.c, which is in
the base dtksh directory. This file was first created by taking the
file 'dtksh/ksh93/src/cmd/ksh93/data/builtins.c', and adding into its
list of builtin commands, the list we added for X, Xt, Xm and Dt. The
best way to update this file is to first goto 'dtksh/ksh93/src/cmd/ksh93/data'
and do an Rcsdiff, to find out what changes Dave Korn made. You will
then make those same changes to the dtksh/builtins.c file.
dtksh/builtins.c
----------------
Fold in any changes made to dtksh/ksh93/src/cmd/ksh93/data/builtins.c
***
Another file which needs special handling is aliases.c, which is in
the base dtksh directory. This file was first created by taking the
file 'dtksh/ksh93/src/cmd/ksh93/data/aliases.c', and adding into its
list of commands aliases, the list we added for X, Xt, Xm and Dt. The
best way to update this file is to first goto 'dtksh/ksh93/src/cmd/ksh93/data'
and do an Rcsdiff, to find out what changes Dave Korn made. You will
then make those same changes to the dtksh/aliases.c file.
dtksh/aliases.c
---------------
Fold in any changes made to dtksh/ksh93/src/cmd/ksh93/data/aliases.c
HP-SPECIFIC Ksh-93 SOURCE MODIFICATIONS:
========================================
The dtksh code requires a handful of changes to be made to the ksh93
source itself. Most of these changes relate to either localization
customizations, additional multibyte support, or fixes for environment
variable mirroring. For each of the files listed below, two versions
have been checked into the RCS vaults: the original (unaltered) version,
and the version with our customizations. This will make it easy to
determine the changes we have made, so that the next time we receive
new code from Korn, it is a relatively simple task to again merge in the
changes. Note that all of the changes relating to multibyte support
have been passed onto David Korn, and that hopefully they will show up
in the official source sometime in the future (after the ksh93-d release).
Modification 1:
---------------
The ksh (and dtksh) executables use a special client (suid_exec) when
trying to execute an suid script; this special client makes sure that
you really have permission to run the suid script. The client, as
supplied by David Korn, has hardcoded assumptions about where it lives
(/etc) and where the valid (and secure) places are where shells can
live. We need to change this so that it knows the client lives in
the cde tree, and that in addition to the normal 'safe' shell locations,
/usr/dt/bin is also a safe location. To do this, the following changes
must be made, each time new ksh source is received:
dtksh/ksh93/src/cmd/ksh93/data/msg.c
------------------------------------
Change:
e_sysprofile = "/etc/profile";
e_suidprofile = "/etc/suid_profile";
e_suidexec = "/etc/suid_exec";
To:
e_sysprofile = PROFILEPATH;
e_suidprofile = SUIDPROFILEPATH;
e_suidexec = SUIDEXECPATH;
dtksh/ksh93/src/cmd/ksh93/sh/suid_exec.c
----------------------------------------
Change:
#define THISPROG "/etc/suid_exec"
To:
#define THISPROG SUIDEXECPATH
Also, search for the block of code like the following (around line 256):
if (shell == 0 || !endsh(shell) || (
!in_dir("/bin",shell) &&
!in_dir("/usr/bin",shell) &&
And change it as follows:
if (shell == 0 || !endsh(shell) || (
!in_dir(CDE_INSTALLATION_TOP"/bin",shell) &&
!in_dir("/bin",shell) &&
!in_dir("/usr/bin",shell) &&
Modification 2:
---------------
During CDE development, it was discovered that some shared library
implementations (i.e. at least IBM) bound a shared library to all
of its dependencies at the time that the library was build. This
created problems for libraries which made getenv() or putenv()
calls, because we expected those calls to be resolved against the
getenv() and putenv() calls provided in the ksh93 libraries, not
against the standard libc versions. This was a problem because
ksh keeps track of its own environment, and does not pass the
information on through to the standard libc environment. The result
was that certain key pieces of information (i.e LANG) might be set
by a shell script, but when calls where made to shared library functions,
they would not see this setting. The fix is to modify the ksh93 code
to *also* pass along any environment settings onto the libc functions;
we call this 'environment variable mirroring'. We won't describe the
exact changes here; you can find them by diff'ing the last two revisions
for the following files:
src/cmd/ksh93/include/nval.h (New field added to Namval structure)
src/cmd/ksh93/sh/name.c (Mirroring code implemented here)
Modification 3:
---------------
There are a handful of multibyte and localization changes which we
must make. Some of them relate to adding message catalog support
to ksh, while others relate to making changes so that Japanese SJIS character
will work. The files which must be modified are:
src/cmd/ksh93/sh/init.c (Message cat and file desc locking/unlocking)
src/cmd/ksh93/sh/lex.c (Japanese SJIS processing fixes)
src/cmd/ksh93/sh/macro.c (Multibyte fixes)
src/cmd/ksh93/bltins/print.c (SJIS multibyte fix to echo/print command)
src/cmd/ksh93/sh/userinit.c (Add call to setlocale() in sh_userinit())
Modification 4:
---------------
During CDE development, USL needed to add an 'ifndef __USLC__' around
a certain define. The file which needs the change is:
src/lib/libast/sfio/sfhdr.h
Modification 5:
---------------
There appears to be a bug in the ksh93 build process, which shows up
on the HP platform. David Korn was unable to find the cause, so we
need to modify one of his build scripts:
ksh93/src/cmd/ksh93/features/options.sh
---------------------------------------
Towards the top of the script, there is the following set of
statements:
: get the option settings from the options file
. $OPTIONS
You need to modify this so that it is like the following:
: get the option settings from the options file
if [ -z "$OPTIONS" ] ; then
OPTIONS="OPTIONS"
fi
. $OPTIONS
=======================
Each time a new release is received from Dave Korn, we also need to copy
his latest ksh93 man page from src/cmd/ksh93/sh.1 into
/x/cdesrc/doc/cde1/man/man1/ksh93. You will need to make one change to
the man page, so that it prints out the ksh information, instead of sh
information. The change is one approximately line 7.
Change:
-------
.nr Z 0 \" set to 1 when command name is ksh rather than sh
To:
---
.nr Z 1 \" set to 1 when command name is ksh rather than sh
===================
One last note. There is a shell script called 'MakeClean' in the root
directory of the dtksh tree. This script cleans out files in the ksh93
portion of the tree, which will force a complete build to occur. Since
the ksh93 portion does not use Imake (it uses Mam or something bazarre
like that), we needed to jury rig something which would act like our
normal 'make clean' . If you discover any other ksh93 files which need
to be removed during a 'make clean' operation, simply add another line
to the MakeClean script. A good indication that a file needs to be
added is if you make a clone from one of the source trees, do a 'make clean',
start a 'make', and somewhere during the building of the ksh93 sources,
you see an error message telling you that you did not have permission to
overwrite something within your clone tree. The ksh93 build process builds
alot of files on the fly, and moves things around to other directories, so
these file typically need to be cleared out before doing a complete make.

View File

@@ -0,0 +1,42 @@
/* $XConsortium: README.building /main/2 1996/07/15 14:12:43 drk $ */
Since dtksh does not use anything like a normal build environment,
here are some hints.
- Make a Makefile in cdesrc/cde1/dtksh as if it were a normal
component
- make includes; make all
dtksh will build initially fine.
Now, if you change anything, you'll find that just typing "make"
doesn't do anything. What you have to do is go to
cdesrc/cde1/dtksh/ksh93/ship. Under there you'll find a distorted
version of the directory structure under ksh93. Find the directory
that corresponds to the directory that contains your change and
remove the file "BUILT". Now cd back up to dtksh and make, and
dtksh should remake itself. Of course, it will recompile many
more files than you actually built, since dtksh does not use
make in any recognizable way.
In fact, it appears the best thing to do is go to cde1/dtksh
and run "ksh MakeClean" which will blow away many files and force
a clean make.
Be extremely careful: Just because you get a dtksh built at
the end does *not* mean the build was successful. There
are several auxiliary binaries in ksh93/bin that must be built.
Make sure that ksh93/bin looks like this at the end:
urth 1331$ pwd
/scde/SunOS_sparc/opt/stable/build/cde1/dtksh/ksh93/bin
urth 1332$ ls
feature* ksh* proto* silent*
ignore* pax* shcomp* suid_exec*
If any of these are missing, search carefully back through
the make log looking for errors.

View File

@@ -0,0 +1,217 @@
/* $XConsortium: XtCvtrs.c /main/3 1995/07/14 13:25:38 drk $ */
/*LINTLIBRARY*/
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* Conversion.c - implementations of resource type conversion procs */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include "stdio.h"
#include <X11/keysym.h>
#include <X11/Xlocale.h>
#include "msgs.h"
#include "XtCvtrs.h"
#define done(type, value) \
{ \
if (toVal->addr != NULL) { \
if (toVal->size < sizeof(type)) { \
toVal->size = sizeof(type); \
return False; \
} \
*(type*)(toVal->addr) = (value); \
} \
else { \
static type static_val; \
static_val = (value); \
toVal->addr = (XPointer)&static_val; \
} \
toVal->size = sizeof(type); \
return True; \
}
static void FreePixel(
XtAppContext app,
XrmValuePtr toVal,
XtPointer closure,
XrmValuePtr args,
Cardinal *num_args) ;
static XtConvertArgRec xtColorConvertArgs[] = {
{XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen),
sizeof(Screen *)},
{XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
sizeof(Colormap)}
};
Boolean
DtkshCvtStringToPixel(
Display *dpy,
XrmValuePtr args,
Cardinal *num_args,
XrmValuePtr fromVal,
XrmValuePtr toVal,
XtPointer *closure_ret )
{
String str = (String)fromVal->addr;
XColor screenColor;
XColor exactColor;
Screen *screen;
Colormap colormap;
Status status;
char *errmsg;
if (*num_args != 2)
return False;
screen = *((Screen **) args[0].addr);
colormap = *((Colormap *) args[1].addr);
if (DtCompareISOLatin1(str, XtDefaultBackground)) {
*closure_ret = False;
done(Pixel, WhitePixelOfScreen(screen));
}
if (DtCompareISOLatin1(str, XtDefaultForeground)) {
*closure_ret = False;
done(Pixel, BlackPixelOfScreen(screen));
}
status = XAllocNamedColor(DisplayOfScreen(screen), colormap,
(char*)str, &screenColor, &exactColor);
if (status == 0) {
String type;
/* Server returns a specific error code but Xlib discards it. Ugh */
if (XLookupColor(DisplayOfScreen(screen), colormap, (char*)str,
&exactColor, &screenColor)) {
*closure_ret = (char*)True;
done(Pixel, screenColor.pixel);
}
else {
/* One last chance; see if it is a pixel number */
char * p;
Pixel pixelValue;
pixelValue = strtoul(str, &p, 0);
if (p == str)
{
char * errbuf;
errmsg = GETMESSAGE(1, 1,
"DtkshCvtStringToPixel: The color '%s' is not defined");
errbuf = XtMalloc(strlen(errmsg) + strlen(str) + 10);
sprintf(errbuf, errmsg, str);
XtWarning(errbuf);
XtFree(errbuf);
*closure_ret = False;
return False;
}
else
{
*closure_ret = False;
done(Pixel, pixelValue);
}
}
} else {
*closure_ret = (char*)True;
done(Pixel, screenColor.pixel);
}
}
/* ARGSUSED */
static void
FreePixel(
XtAppContext app,
XrmValuePtr toVal,
XtPointer closure,
XrmValuePtr args,
Cardinal *num_args )
{
Screen *screen;
Colormap colormap;
if (*num_args != 2)
return;
screen = *((Screen **) args[0].addr);
colormap = *((Colormap *) args[1].addr);
if (closure) {
XFreeColors( DisplayOfScreen(screen), colormap,
(unsigned long*)toVal->addr, 1, (unsigned long)0
);
}
}
Boolean
DtCompareISOLatin1(
char *first,
char *second )
{
register unsigned char *ap, *bp;
for (ap = (unsigned char *) first, bp = (unsigned char *) second;
*ap && *bp; ap++, bp++) {
register unsigned char a, b;
if ((a = *ap) != (b = *bp)) {
/* try lowercasing and try again */
if ((a >= XK_A) && (a <= XK_Z))
a += (XK_a - XK_A);
else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
a += (XK_agrave - XK_Agrave);
else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
a += (XK_oslash - XK_Ooblique);
if ((b >= XK_A) && (b <= XK_Z))
b += (XK_a - XK_A);
else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis))
b += (XK_agrave - XK_Agrave);
else if ((b >= XK_Ooblique) && (b <= XK_Thorn))
b += (XK_oslash - XK_Ooblique);
if (a != b) break;
}
}
return ((((int) *bp) - ((int) *ap)) == 0);
}
void
RegisterXtOverrideConverters( void )
{
XtSetTypeConverter(XtRString, XtRPixel,
(XtTypeConverter)DtkshCvtStringToPixel,
xtColorConvertArgs, XtNumber(xtColorConvertArgs),
XtCacheNone, FreePixel);
}

View File

@@ -0,0 +1,44 @@
/* $XConsortium: XtCvtrs.h /main/4 1995/11/01 15:50:01 rswiston $ */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef _Dtksh_XtCvtrs_h
#define _Dtksh_XtCvtrs_h
extern Boolean DtkshCvtStringToPixel(
Display *dpy,
XrmValuePtr args,
Cardinal *num_args,
XrmValuePtr fromVal,
XrmValuePtr toVal,
XtPointer *closure_ret) ;
extern void RegisterXtOverrideConverters( void ) ;
extern Boolean DtCompareISOLatin1(
char *first,
char *second) ;
#endif /* _Dtksh_XtCvtrs_h */

View File

@@ -0,0 +1,125 @@
/* $XConsortium: aliases.c /main/3 1995/11/01 15:50:11 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1993 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Advanced Software Technology Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* {ulysses,attmail}!dgk *
* dgk@ulysses.att.com *
* David Korn 908-582-7975 *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#include <signal.h>
#include "FEATURE/options"
#include "FEATURE/dynamic"
#include "shtable.h"
#include "name.h"
#include <X11/X.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#define NO_AST
#include "dtksh.h"
#undef NO_AST
#include "dtextra.h"
#include "xmextra.h"
#include "msgs.h"
/*
* This is the table of built-in aliases. These should be exported.
*/
const struct shtable2 shtab_aliases[] =
{
#ifdef SHOPT_FS_3D
"2d", NV_NOFREE|NV_EXPORT, "set -f;_2d",
#endif /* SHOPT_FS_3D */
"autoload", NV_NOFREE|NV_EXPORT, "typeset -fu",
"command", NV_NOFREE|NV_EXPORT, "command ",
"fc", NV_NOFREE|NV_EXPORT, "hist",
"float", NV_NOFREE|NV_EXPORT, "typeset -E",
"functions", NV_NOFREE|NV_EXPORT, "typeset -f",
"hash", NV_NOFREE|NV_EXPORT, "alias -t --",
"history", NV_NOFREE|NV_EXPORT, "hist -l",
"integer", NV_NOFREE|NV_EXPORT, "typeset -i",
"nameref", NV_NOFREE|NV_EXPORT, "typeset -n",
"nohup", NV_NOFREE|NV_EXPORT, "nohup ",
"r", NV_NOFREE|NV_EXPORT, "hist -s",
"redirect", NV_NOFREE|NV_EXPORT, "command exec",
"times", NV_NOFREE|NV_EXPORT, "{ { time;} 2>&1;}",
"type", NV_NOFREE|NV_EXPORT, "whence -v",
#ifdef SIGTSTP
"stop", NV_NOFREE|NV_EXPORT, "kill -s STOP",
"suspend", NV_NOFREE|NV_EXPORT, "kill -s STOP $$",
#endif /*SIGTSTP */
DTK_EXTRA_ALIAS
"", 0, (char*)0
};

View File

@@ -0,0 +1,102 @@
/* $XConsortium: basetbl.c /main/3 1995/11/01 15:50:27 rswiston $ */
/** %W% **/
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/types.h>
#include "exksh.h"
#include "msgs.h"
/*
* Declare all strings in one place to avoid duplication
*/
char STR_uint[] = "uint";
static char STR_intp[] = "intp";
static char STR_int[] = "int";
static char STR_dint[] = "dint";
char STR_unsigned_long[] = "unsigned_long";
static char STR_longp[] = "longp";
static char STR_long[] = "long";
static char STR_dlong[] = "dlong";
static char STR_ushort[] = "ushort";
static char STR_short[] = "short";
static char STR_dshort[] = "dshort";
static char STR_unchar[] = "unchar";
static char STR_char[] = "char";
char STR_string_t[] = "string_t";
struct memtbl T_uint[] = {
{ (char *) STR_uint, (char *) STR_uint, K_INT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(uint), 0 }, NULL
};
struct memtbl T_dint[] = {
{ (char *) STR_dint, (char *) STR_dint, K_DINT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(int) }, NULL
};
struct memtbl T_int[] = {
{ (char *) STR_int, (char *) STR_int, K_INT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(int) }, NULL
};
struct memtbl T_intp[] = {
{ (char *) STR_intp, (char *) STR_intp, K_INT, F_SIMPLE, -1, 1, 0, 0, 0, 0, sizeof(int) }, NULL
};
struct memtbl T_unsigned_long[] = {
{ (char *) STR_unsigned_long, (char *) STR_unsigned_long, K_LONG, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(unsigned long), 0 }, NULL
};
struct memtbl T_long[] = {
{ (char *) STR_long, (char *) STR_long, K_LONG, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(long) }, NULL
};
struct memtbl T_dlong[] = {
{ (char *) STR_dlong, (char *) STR_dlong, K_DLONG, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(long) }, NULL
};
struct memtbl T_longp[] = {
{ (char *) STR_longp, (char *) STR_longp, K_LONG, F_SIMPLE, -1, 1, 0, 0, 0, 0, sizeof(long) }, NULL
};
struct memtbl T_ushort[] = {
{ (char *) STR_ushort, (char *) STR_ushort, K_SHORT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(ushort) }, NULL
};
struct memtbl T_short[] = {
{ (char *) STR_dshort, (char *) STR_dshort, K_DSHORT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(short) }, NULL
};
struct memtbl T_dshort[] = {
{ (char *) STR_short, (char *) STR_short, K_SHORT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(short) }, NULL
};
struct memtbl T_unchar[] = {
{ (char *) STR_unchar, (char *) STR_unchar, K_CHAR, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(unsigned char) }, NULL
};
struct memtbl T_char[] = {
{ (char *) STR_char, (char *) STR_char, K_CHAR, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(char) }, NULL
};
struct memtbl T_string_t[] = {
{ (char *) STR_string_t, (char *) STR_string_t, K_STRING, F_TYPE_IS_PTR, -1, 0, 0, -1, 0, 0, sizeof(char *) }, NULL
};
struct memtbl *basemems[] = {
T_uint,
T_int,
T_dint,
T_intp,
T_unsigned_long,
T_long,
T_dlong,
T_longp,
T_ushort,
T_short,
T_dshort,
T_unchar,
T_char,
T_string_t,
NULL
};
struct symarray basedefs[] = {
{ "PRDECIMAL", PRDECIMAL },
{ "PRHEX", PRHEX },
{ "PRMIXED", PRMIXED },
{ "PRMIXED_SYMBOLIC", PRMIXED_SYMBOLIC },
{ "PRNAMES", PRNAMES },
{ "PRSYMBOLIC", PRSYMBOLIC },
{ NULL, 0 }
};

View File

@@ -0,0 +1,29 @@
/* $XConsortium: basetbl.h /main/3 1995/11/01 15:50:37 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: basetbl.h
**
** Project: CDE
**
** Description: Public include file for basetbl.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_basetbl_h
#define _Dtksh_basetbl_h
extern struct memtbl *basemems[];
extern struct symarray basedefs[];
extern struct memtbl T_unsigned_long[];
extern struct memtbl T_string_t[];
#endif /* _Dtksh_basetbl_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,283 @@
/* $XConsortium: builtins.c /main/3 1995/11/01 15:50:47 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Advanced Software Technology Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* {research,attmail}!dgk *
* dgk@research.att.com *
* David Korn 908-582-7975 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 3
#define mount _AST_mount
#include <shell.h>
#include <signal.h>
#include "shtable.h"
#include "name.h"
#ifdef KSHELL
# include "builtins.h"
# include "jobs.h"
# include "FEATURE/cmds"
#if defined(__STDC__) || defined(__STDPP__)
# define bltin(x) (b_##x)
#else
# define bltin(x) (b_/**/x)
#endif
#line 13
#else
# define bltin(x) 0
#endif
#include <X11/X.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#define NO_AST
#include "dtksh.h"
#undef NO_AST
#include "dtextra.h"
#include "xmextra.h"
#include "msgs.h"
/*
* The order up through "[" is significant
*/
const struct shtable3 shtab_builtins[] =
{
"login", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(login),
"exec", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(exec),
"set", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(set),
":", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(true),
"true", NV_BLTIN|BLT_ENV, bltin(true),
"command", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(command),
"cd", NV_BLTIN|BLT_ENV, bltin(cd),
"break", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(brk_cont),
"continue", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(brk_cont),
"typeset", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
"test", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(test),
"[", NV_BLTIN|BLT_ENV, bltin(test),
#ifdef _bin_newgrp
"newgrp", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(login),
#endif /* _bin_newgrp */
".", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(dot_cmd),
"alias", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias),
"hash", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias),
"exit", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(ret_exit),
"export", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(read_export),
"eval", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval),
"fc", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist),
"hist", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist),
"readonly", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(read_export),
"return", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(ret_exit),
"shift", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(shift),
"trap", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(trap),
"unalias", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(unalias),
"unset", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(unset),
"builtin", NV_BLTIN, bltin(builtin),
#ifdef SHOPT_ECHOPRINT
"echo", NV_BLTIN|BLT_ENV, bltin(print),
#else
"echo", NV_BLTIN|BLT_ENV, bltin(echo),
#endif /* SHOPT_ECHOPRINT */
#ifdef JOBS
# ifdef SIGTSTP
"bg", NV_BLTIN|BLT_ENV, bltin(bg_fg),
"fg", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(bg_fg),
"disown", NV_BLTIN|BLT_ENV, bltin(bg_fg),
"kill", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(kill),
# else
"/bin/kill", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(kill),
# endif /* SIGTSTP */
"jobs", NV_BLTIN|BLT_ENV, bltin(jobs),
#endif /* JOBS */
"false", NV_BLTIN|BLT_ENV, bltin(false),
"getconf", NV_BLTIN|BLT_ENV, bltin(getconf),
"getopts", NV_BLTIN|BLT_ENV, bltin(getopts),
"let", NV_BLTIN|BLT_ENV, bltin(let),
"print", NV_BLTIN|BLT_ENV, bltin(print),
"printf", NV_BLTIN|NV_NOFREE, bltin(printf),
"pwd", NV_BLTIN|NV_NOFREE, bltin(pwd),
"read", NV_BLTIN|BLT_ENV, bltin(read),
"sleep", NV_BLTIN|NV_NOFREE, bltin(sleep),
"alarm", NV_BLTIN, bltin(alarm),
"ulimit", NV_BLTIN|BLT_ENV, bltin(ulimit),
"umask", NV_BLTIN|BLT_ENV, bltin(umask),
#ifdef _cmd_universe
"universe", NV_BLTIN|BLT_ENV, bltin(universe),
#endif /* _cmd_universe */
#ifdef SHOPT_FS_3D
"vpath", NV_BLTIN|BLT_ENV, bltin(vpath_map),
"vmap", NV_BLTIN|BLT_ENV, bltin(vpath_map),
#endif /* SHOPT_FS_3D */
"wait", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(wait),
"type", NV_BLTIN|BLT_ENV, bltin(whence),
"whence", NV_BLTIN|BLT_ENV, bltin(whence),
#ifdef apollo
"inlib", NV_BLTIN|BLT_ENV, bltin(inlib),
"rootnode", NV_BLTIN, bltin(rootnode),
"ver", NV_BLTIN, bltin(ver),
#endif /* apollo */
"/bin/basename",NV_BLTIN|NV_NOFREE, bltin(basename),
"/bin/chmod", NV_BLTIN|NV_NOFREE, bltin(chmod),
"/bin/dirname", NV_BLTIN|NV_NOFREE, bltin(dirname),
"/bin/head", NV_BLTIN|NV_NOFREE, bltin(head),
"/bin/mkdir", NV_BLTIN|NV_NOFREE, bltin(mkdir),
#if defined(_usr_bin_logname) && !defined(_bin_logname)
"/usr/bin/logname", NV_BLTIN|NV_NOFREE, bltin(logname),
#else
"/bin/logname", NV_BLTIN|NV_NOFREE, bltin(logname),
#endif
"/bin/cat", NV_BLTIN|NV_NOFREE, bltin(cat),
"/bin/cmp", NV_BLTIN|NV_NOFREE, bltin(cmp),
#if defined(_usr_bin_cut) && !defined(_bin_cut)
"/usr/bin/cut", NV_BLTIN|NV_NOFREE, bltin(cut),
#else
"/bin/cut", NV_BLTIN|NV_NOFREE, bltin(cut),
#endif
"/bin/uname", NV_BLTIN|NV_NOFREE, bltin(uname),
#if defined(_usr_bin_wc) && !defined(_bin_wc)
"/usr/bin/wc", NV_BLTIN|NV_NOFREE, bltin(wc),
#else
# if defined(_usr_ucb_wc) && !defined(_bin_wc)
"/usr/ucb/wc", NV_BLTIN|NV_NOFREE, bltin(wc),
# else
"/bin/wc", NV_BLTIN|NV_NOFREE, bltin(wc),
# endif
#endif
DTK_EXTRA_TABLE
DTK_EXTRA_TABLE2
DTK_TK_EXTRA_TABLE
DTK_TK_LIST_TABLE
DTK_TK_TEXT_TABLE
"", 0, 0
};
const char sh_optalarm[] = "r [varname seconds]";
const char sh_optalias[] = "ptx [name=[value]...]";
const char sh_optbuiltin[] = "dsf:[library] [name...]";
const char sh_optcd[] = "LP [dir] [change]";
const char sh_optcflow[] = " [n]";
const char sh_optcommand[] = "pvV name [arg]...";
const char sh_optdot[] = " name [arg...]";
#ifndef ECHOPRINT
const char sh_optecho[] = " [-n] [arg...]";
#endif /* !ECHOPRINT */
const char sh_opteval[] = " [arg...]";
const char sh_optexec[] = "a:[name]c [command [args...] ]";
const char sh_optexport[] = "p [name[=value]...]";
const char sh_optgetopts[] = ":a:[name] optstring name [args...]";
const char sh_optgetconf[] = " [name [pathname] ]";
const char sh_optjoblist[] = " [job...]";
const char sh_opthist[] = "e:[editor]lnrsN# [first] [last]";
const char sh_optjobs[] = "nlp [job...]";
const char sh_optkill[] = "ln#[signum]s:[signame] sig...";
const char sh_optlet[] = " expr...";
const char sh_optprint[] = "f:[format]enprsu:[filenum] [arg...]";
const char sh_optprintf[] = " format [arg...]";
const char sh_optpwd[] = "LP";
const char sh_optread[] = "Ad:[delim]prst#[timeout]u#[filenum] [name...]";
#ifdef SHOPT_KIA
const char sh_optksh[] = "+DircabefhkmnpstuvxCR:[file]o:?[option] [arg...]";
const char sh_optset[] = "+abefhkmnpstuvxCR:[file]o:?[option]A:[name] [arg...]";
#else
const char sh_optksh[] = "+DircabefhkmnpstuvxCo:?[option] [arg...]";
const char sh_optset[] = "+abefhkmnpstuvxCo:?[option]A:[name] [arg...]";
#endif /* SHOPT_KIA */
const char sh_optsleep[] = " seconds";
const char sh_opttrap[] = "p [action condition...]";
#ifdef SHOPT_OO
const char sh_opttypeset[] = "+AC:E#?F#?H:[name]L#?R#?Z#?fi#?[base]lnprtux [name=[value]...]";
#else
const char sh_opttypeset[] = "+AE#?F#?HL#?R#?Z#?fi#?[base]lnprtux [name=[value]...]";
#endif /* SHOPT_OO */
const char sh_optulimit[] = "HSacdfmnstv [limit]";
const char sh_optumask[] = "S [mask]";
const char sh_optuniverse[] = " [name]";
const char sh_optunset[] = "fnv name...";
const char sh_optunalias[] = "a name...";
#ifdef SHOPT_FS_3D
const char sh_optvpath[] = " [top] [base]";
const char sh_optvmap[] = " [dir] [list]";
#endif /* SHOPT_FS_3D */
const char sh_optwhence[] = "afpv name...";
const char e_alrm1[] = "alarm -r %s +%.3g\n";
const char e_alrm2[] = "alarm %s %.3f\n";
const char e_badfun[] = "%s: illegal function name";
const char e_baddisc[] = "%s: invalid discipline function";
const char e_nospace[] = "out of memory";
const char e_nofork[] = "cannot fork";
const char e_nosignal[] = "%s: unknown signal name";
const char e_numeric[] = "*([0-9])?(.)*([0-9])";
const char e_condition[] = "condition(s) required";
const char e_cneedsarg[] = "-c requires argument";

324
cde/programs/dtksh/define.c Normal file
View File

@@ -0,0 +1,324 @@
/* $XConsortium: define.c /main/4 1995/11/01 15:51:03 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include "exksh.h" /* which includes sys/types.h */
#include <sys/param.h>
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "misc.h"
#include "docall.h"
#include "basetbl.h"
#include "msgs.h"
static growdef( void ) ;
static int add_deflist(
struct symarray *defptr,
char *prefix) ;
static def_init( void ) ;
static struct symarray *Dyndef = NULL;
static int Ndyndef = 0;
static int Sdyndef = 0;
static char defInited = 0;
static char use[] = "0x%x";
static char use2[] = "%s=0x%x";
struct deflist {
char *prefix;
int size;
struct symarray *defs;
};
struct deflist *Deflist = NULL;
int Ndeflist;
static
growdef( void )
{
int i;
if (!defInited)
def_init();
if (!(Dyndef = (struct symarray *) realloc(Dyndef, (Sdyndef + 20) *
sizeof(struct symarray))))
{
return(SH_FAIL);
}
Deflist->defs = Dyndef;
memset(((char *) Dyndef) + Sdyndef * sizeof(struct symarray), '\0',
20 * sizeof(struct symarray));
Sdyndef += 20;
}
int
do_define(
int argc,
char **argv )
{
int i, argstart, redo;
char *name;
struct symarray *found, dummy;
if (!defInited)
def_init();
if (argc > 1 && C_PAIR(argv[1], '-', 'R'))
{
redo = 0;
argstart = 2;
}
else
{
argstart = 1;
redo = 1;
}
if ((argstart +1) >= argc)
XK_USAGE(argv[0]);
name = argv[argstart++];
dummy.str = name;
found = (struct symarray *) bsearch((char *) &dummy, Dyndef, Ndyndef,
sizeof(struct symarray), symcomp);
if (found)
{
if (!redo)
return(SH_SUCC);
i = found - Dyndef;
}
else
{
if (Sdyndef == Ndyndef)
growdef();
Ndyndef++;
if (Ndyndef > 1)
for (i = Ndyndef - 1; i > 0; i--)
{
if (strcmp(name, Dyndef[i - 1].str) >= 0)
break;
Dyndef[i] = Dyndef[i - 1];
}
else
i = 0;
Dyndef[i].str = strdup(name);
Deflist->size++;
}
RIF(xk_par_int(argv + argstart, &Dyndef[i].addr, NULL));
return(SH_SUCC);
}
int
fdef(
char *str,
unsigned long *val )
{
struct symarray *found, dummy;
int i;
dummy.str = str;
if (!Deflist)
return(0);
for (i = 0; i < Ndeflist; i++)
{
if (Deflist[i].defs)
{
if (Deflist[i].size < 0)
{
found = (struct symarray *) lfind((char *) &dummy, Deflist[i].defs,
(unsigned int *) &Deflist[i].size, sizeof(struct symarray),
symcomp);
}
else
{
found = (struct symarray *) bsearch((char *) &dummy,
Deflist[i].defs, Deflist[i].size, sizeof(struct symarray),
symcomp);
}
if (found != NULL)
{
*val = found->addr;
return(1);
}
}
}
return(0);
}
int
do_deflist(
int argc,
char **argv )
{
int i, j;
char *prefix = NULL;
struct symarray *defptr = NULL;
char * errmsg;
for (i = 1; (i < argc) && argv[i]; i++)
{
if (argv[i][0] == '-')
{
for (j = 1; argv[i][j]; j++)
{
switch(argv[i][j])
{
case 'p':
{
if (argv[i][j + 1])
{
prefix = argv[i] + j;
j += strlen(prefix) - 2;
}
else
{
prefix = argv[++i];
j = strlen(prefix) - 1;
}
}
}
}
}
else
{
if ((defptr = (struct symarray *) getaddr(argv[i])) == NULL)
{
errmsg=strdup(GETMESSAGE(3,1,
"Unable to locate the definition list '%s'"));
printerrf(argv[0], errmsg, argv[i], NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
}
}
if (defptr == NULL)
{
XK_USAGE(argv[0]);
}
for (i = 0; i < Ndeflist; i++)
if ((Deflist[i].defs == defptr) &&
(!prefix || (strcmp(Deflist[i].prefix, prefix) == 0)))
{
return(SH_SUCC);
}
return(add_deflist(defptr, prefix));
}
static int
add_deflist(
struct symarray *defptr,
char *prefix )
{
int i;
if (!Deflist)
{
Deflist = (struct deflist *) malloc((Ndeflist + 1) *
sizeof(struct deflist));
}
else
{
Deflist = (struct deflist *) realloc(Deflist, (Ndeflist + 1) *
sizeof(struct deflist));
}
if (!Deflist)
return(SH_FAIL);
Deflist[Ndeflist].defs = defptr;
Deflist[Ndeflist].prefix = strdup(prefix);
if (!defptr[0].str)
Deflist[Ndeflist].size = 0;
else
{
for (i = 1; defptr[i].str && defptr[i].str[0]; i++)
if (symcomp((void *) (defptr + i), (void *) (defptr + i - 1)) < 0)
break;
if (!(defptr[i].str && defptr[i].str[0]))
Deflist[Ndeflist].size = i;
else
Deflist[Ndeflist].size = -1;
}
Ndeflist++;
return(SH_SUCC);
}
int
do_finddef(
int argc,
char **argv )
{
unsigned long found;
struct symarray dummy;
char * errmsg;
if (argc < 2)
XK_USAGE(argv[0]);
if (fdef(argv[1], &found))
{
if (argc >= 3)
{
char buf[50];
sprintf(buf, use2, argv[2], found);
env_set(buf);
}
else
{
sprintf(xk_ret_buffer, use, found);
xk_ret_buf = xk_ret_buffer;
}
return(SH_SUCC);
}
errmsg = strdup(GETMESSAGE(3, 2, "Unable to locate the define '%s'"));
printerrf(argv[0], errmsg, argv[1], NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
static
def_init( void )
{
char * errhdr;
char * errmsg;
defInited = 1;
if (!(Dyndef = (struct symarray *) malloc(20 * sizeof(struct symarray))))
{
errhdr = strdup(GetSharedMsg(DT_ERROR));
errmsg = strdup(GetSharedMsg(DT_ALLOC_FAILURE));
printerr(errhdr, errmsg, NULL);
free(errhdr);
free(errmsg);
exit(1);
}
Dyndef[0].str = NULL;
Sdyndef = 20;
Ndyndef = 0;
add_deflist(Dyndef, "dynamic");
add_deflist(basedefs, "base");
}

View File

@@ -0,0 +1,41 @@
/* $XConsortium: define.h /main/4 1995/11/01 15:51:12 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: define.h
**
** Project: CDE
**
** Description: Public include file for define.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_define_h
#define _Dtksh_define_h
extern int do_define(
int argc,
char **argv) ;
extern int fdef(
char *str,
unsigned long *val) ;
extern int do_deflist(
int argc,
char **argv) ;
extern int do_finddef(
int argc,
char **argv) ;
#endif /* _Dtksh_define_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

752
cde/programs/dtksh/docall.c Normal file
View File

@@ -0,0 +1,752 @@
/* $TOG: docall.c /main/7 1998/04/17 11:22:59 mgreess $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include "exksh.h" /* which includes sys/types.h */
#include "docall.h"
#include <sys/param.h>
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "struct.h"
#include "misc.h"
#include "exksh_tbls.h"
#include "basetbl.h"
#include "msgs.h"
#include <X11/Xosdefs.h>
#include <errno.h>
#ifdef X_NOT_STDC_ENV
extern int errno;
#endif
static int allprint(
unsigned long *pargs,
memtbl_t *tbls) ;
static pp_usage( void ) ;
static int call_postprompt(
char * argv0,
unsigned long *pargs,
memtbl_t *tbls,
int *freeit) ;
static long get_prdebug( void ) ;
static long set_prdebug(
long n) ;
static int myprompt(
char *prompt) ;
struct memtbl Null_tbl = { NULL };
static char use[] = "0x%x";
static char use2[] = "%s=0x%x";
int Xk_errno = 0;
int Xkdebug = 0;
char xk_ret_buffer[100];
char *xk_ret_buf = xk_ret_buffer;
struct Bfunction xk_prdebug = { get_prdebug, set_prdebug };
int
do_field_get(
int argc,
char **argv )
{
char buf[BIGBUFSIZ], *p, *bufstart;
char *fld, *type, *ptr, *ptr2, **pptr2;
memtbl_t tbl[2], *tbl2;
int i;
char *targvar = NULL;
char fail = 0, always_ptr;
char * errmsg;
always_ptr = 0;
for (i = 1; (i < argc) && argv[i] != NULL && argv[i][0] == '-'; i++) {
switch(argv[i][1]) {
case 'p':
always_ptr = 1;
break;
case 'v':
targvar = argv[++i];
break;
}
}
if ((i + 1) >= argc)
{
XK_USAGE(argv[0]);
}
type = argv[i++];
if (!isdigit(argv[i][0]))
always_ptr = 1;
ptr = (char *) getaddr(argv[i++]);
tbl[1] = Null_tbl;
if (!type || !ptr || (parse_decl(argv[0], tbl, type, 1) == FAIL)) {
if (!type || !ptr)
{
XK_USAGE(argv[0]);
}
else
{
errmsg = strdup(GETMESSAGE(4,1,
"Cannot parse the structure named '%s'; it may not have been defined"));
printerrf(argv[0], errmsg, type, NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
}
if ((always_ptr || !IS_SIMPLE(tbl)) && !tbl->ptr && !(tbl->flags & F_TYPE_IS_PTR))
tbl->ptr = 1;
else while (tbl->ptr > 1) {
ptr = *((void **) ptr);
tbl->ptr--;
}
Pr_tmpnonames = 1;
p = buf;
if (targvar) {
strcpy(p, targvar);
p += strlen(p);
*p++ = '=';
bufstart = p;
}
else
bufstart = buf;
while ((i < argc) && (fld = argv[i++])) {
if (p != bufstart)
*p++ = targvar ? ' ' : '\n';
tbl2 = tbl;
ptr2 = ptr;
pptr2 = &ptr2;
if (!C_PAIR(fld, '.', '\0'))
tbl2 = ffind(tbl, fld, (char **)&pptr2);
if (!tbl2) {
errmsg = strdup(GetSharedMsg(DT_BAD_FIELD_NAME));
printerrf(argv[0], errmsg, fld, type,
NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
fail = 1;
break;
}
if (XK_PRINT(tbl2, &p, (char *)pptr2, 0, 0, NULL,
all_tbl_find) == FAIL)
{
errmsg=strdup(GETMESSAGE(4,2,
"Cannot print the field '%s' in structure '%s'"));
printerrf(argv[0], errmsg, fld, type,
NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
fail = 1;
break;
}
}
if (!fail) {
*p = '\0';
if (targvar)
env_set(buf);
else
ALTPUTS(buf);
}
Pr_tmpnonames = 0;
return(fail ? SH_FAIL : SH_SUCC);
}
static int
allprint(
unsigned long *pargs,
memtbl_t *tbls )
{
char buf[BIGBUFSIZ], *p;
int i;
char * errmsg;
for (i = 0; tbls[i].name; i++) {
errmsg = strdup(GETMESSAGE(4,3, "Argument %d (type %s):\n\t"));
printf(errmsg, i + 1, tbls[i].name);
free(errmsg);
p = buf;
XK_PRINT(tbls + i, &p, (char *)(pargs + i), 0, 0, NULL,
all_tbl_find);
ALTPUTS(buf);
}
}
static
pp_usage( void )
{
char * errmsg;
errmsg = strdup(GETMESSAGE(4,4,
"Please enter p(rint), s(end), q(uit) or field=value\n"));
printf(errmsg);
free(errmsg);
}
static int
call_postprompt(
char * argv0 ,
unsigned long *pargs,
memtbl_t *tbls,
int *freeit )
{
char buf[BUFSIZ];
char * errmsg;
char * quitStr, *printStr, *sendStr, *promptStr;
int returnVal = 0;
quitStr = strdup(GETMESSAGE(4,5, "q"));
printStr = strdup(GETMESSAGE(4,6, "p"));
sendStr = strdup(GETMESSAGE(4,7, "s"));
promptStr = strdup(GETMESSAGE(4,8, "Postprompt: "));
for ( ; ; ) {
myprompt(promptStr);
strcpy(buf, quitStr);
*buf = '\0';
fgets(buf, sizeof(buf), stdin);
if (strlen(buf) && buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0';
if (xk_Strncmp(buf, quitStr, 2) == 0)
{
errmsg=strdup(GETMESSAGE(4,9,
"Warning: command was not executed\n"));
printf(errmsg);
free(errmsg);
returnVal = 0;
break;
}
else if (xk_Strncmp(buf, printStr, 2) == 0)
allprint(pargs, tbls);
else if (xk_Strncmp(buf, sendStr, 2) == 0)
{
returnVal = 1;
break;
}
else if (!strchr(buf, '=') ||
(asl_set(argv0,tbls, buf, (unsigned char **)pargs) == SH_FAIL))
{
pp_usage();
}
}
free(quitStr);
free(printStr);
free(sendStr);
free(promptStr);
return(returnVal);
}
#define ZERORET 0
#define NONZERO 1
#define NONNEGATIVE 2
/* In shell, 0 is success so, ZERORET means direct return, NONZERO means
** return the opposite of its truth value and NONNEGATIVE means return
** true if the value IS negative (since FALSE is success)
*/
#define CALL_RETURN(RET) return(SET_RET(RET), ((ret_type == ZERORET) ? (RET) : ((ret_type == NONZERO) ? !(RET) : ((RET) < 0))))
#define EARLY_RETURN(RET) return(SET_RET(RET))
#define SET_RET(RET) (((int) sprintf(xk_ret_buffer, use, (RET))), (int) (xk_ret_buf = xk_ret_buffer), RET)
int
do_call(
int argc,
char **argv )
{
void *pargs[MAX_CALL_ARGS];
memtbl_t tblarray[MAX_CALL_ARGS];
char freeit[MAX_CALL_ARGS];
unsigned long (*func)();
char *p;
char dorun, promptflag;
unsigned char freeval, ret_type;
register int i, j, ret;
char * msg;
char * errbuf;
char * errmsg;
promptflag = 0;
freeval = 1;
ret_type = ZERORET;
dorun = 1;
if (argc == 1) {
errmsg = strdup(GetSharedMsg(DT_NO_FUNC_NAME));
printerr(argv[0], errmsg, NULL);
free(errmsg);
xk_usage(argv[0]);
EARLY_RETURN(1);
}
for (j = 1; (j < argc) && argv[j][0] == '-'; j++) {
for (i = 1; argv[j][i]; i++) {
switch(argv[j][i]) {
case 'F':
/* Do not free */
freeval = 0;
break;
case 'r':
/* reverse sense of return value */
ret_type = NONZERO;
break;
case 'n':
/* Non-negative return value is okay */
ret_type = NONNEGATIVE;
break;
default:
errmsg =strdup(GetSharedMsg(DT_UNKNOWN_OPTION));
printerrf(argv[0], errmsg,
argv[j], NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
xk_usage(argv[0]);
EARLY_RETURN(1);
}
}
}
if (j >= argc) {
errmsg = strdup(GetSharedMsg(DT_NO_FUNC_NAME));
printerr(argv[0], errmsg, NULL);
free(errmsg);
xk_usage(argv[0]);
CALL_RETURN(1);
}
memset(tblarray, '\0', MAX_CALL_ARGS * sizeof(memtbl_t));
memset(pargs, '\0', MAX_CALL_ARGS * sizeof(void *));
memset(freeit, '\0', MAX_CALL_ARGS * sizeof(char));
func = (unsigned long (*)()) fsym(argv[j], -1);
if (!func && ((argv[j][0] != '0') || (UPP(argv[j][1]) != 'X') || !(func = (unsigned long (*)()) strtoul(argv[j], &p, 16)) || *p)) {
errmsg = strdup(GETMESSAGE(4,10,
"Unable to locate the function '%s'"));
printerrf(argv[0], errmsg,
argv[j], NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
CALL_RETURN(1);
}
j++;
for (i = 0; (i < MAX_CALL_ARGS) && (j < argc) && argv[j]; j++, i++) {
char *val;
char type[100];
if (C_PAIR(argv[j], '+', '?')) {
promptflag = 1;
continue;
}
else if (C_PAIR(argv[j], '+', '+')) {
j++;
break;
}
if (argv[j][0] == '@') {
if (!(val = strchr(argv[j] + 1, ':'))) {
dorun = 0;
ret = -1;
break;
}
strncpy(type, argv[j] + 1, val - argv[j] - 1);
type[val - argv[j] - 1] = '\0';
val++;
if (parse_decl(argv[0], tblarray + i, type, 1) == FAIL)
{
dorun = 0;
ret = -1;
break;
}
else {
if (!strparse(tblarray + i,
(char **)(pargs + i), val))
{
errmsg=strdup(GETMESSAGE(4,11,
"The value descriptor '%s' does not match the definition for structure '%s'"));
printerrf(argv[0], errmsg,
val, type, NULL, NULL, NULL,
NULL, NULL, NULL);
free(errmsg);
dorun = 0;
ret = -1;
break;
}
else
freeit[i] = freeval;
}
}
else if (isdigit(argv[j][0])) {
char *p;
p = argv[j];
tblarray[i] = T_unsigned_long[0];
xk_par_int(&p, pargs + i, NULL);
}
else if (strcmp(argv[j], (char *) "NULL") == 0) {
tblarray[i] = T_unsigned_long[0];
pargs[i] = NULL;
}
else {
pargs[i] = (void *) argv[j];
tblarray[i] = T_string_t[0];
}
}
/* Process special arguments */
while (j < argc) {
asl_set(argv[0], tblarray, argv[j], (unsigned char **)pargs);
j++;
}
if (dorun) {
if (!promptflag ||
call_postprompt(argv[0], (unsigned long *)pargs, tblarray,
(int *)freeit))
{
ret = (*func)(pargs[0], pargs[1], pargs[2], pargs[3],
pargs[4], pargs[5], pargs[6], pargs[7],
pargs[8], pargs[9], pargs[10], pargs[11],
pargs[12], pargs[13], pargs[14]);
}
else
ret = 0;
Xk_errno = errno;
}
for (i = 0; i < MAX_CALL_ARGS; i++) {
if (pargs[i] && freeit[i])
{
/* There is no recourse for failure */
XK_FREE(tblarray + i, (char *)(pargs + i), 0, 0,
all_tbl_find);
}
}
CALL_RETURN(ret);
}
int _Prdebug;
static long
get_prdebug( void )
{
return(_Prdebug);
}
static long
set_prdebug(
long n )
{
_Prdebug = n;
}
int
asl_set(
char *argv0,
memtbl_t *tblarray,
char *desc,
unsigned char **pargs )
{
char *ptr;
char *val;
memtbl_t *tbl;
memtbl_t usetbl[2];
char op;
char field[80], *fldp = field;
unsigned long intval, i, newval;
unsigned long top, bottom;
char * errmsg;
if ((val = strchr(desc, '=')) == NULL)
return(SH_FAIL);
if (ispunct(val[-1]) && (val[-1] != ']')) {
op = val[-1];
strncpy(field, desc, val - desc - 1);
field[val - desc - 1] = '\0';
val++;
}
else {
op = '\0';
strncpy(field, desc, val - desc);
field[val - desc] = '\0';
val++;
}
if (isdigit(fldp[0])) {
top = bottom = strtoul(fldp, &fldp, 0) - 1;
if (*fldp == '.')
fldp++;
}
else {
top = 9;
bottom = 0;
}
usetbl[1] = Null_tbl;
for (i = bottom; i <= top; i++) {
usetbl[0] = tblarray[i];
ptr = (char *) (pargs + i);
if (tbl = ffind(usetbl, fldp, &ptr))
break;
}
if (!tbl || (i > top)) {
errmsg=strdup(GETMESSAGE(4,12, "Cannot locate the field '%s'"));
printerrf(argv0, errmsg, fldp, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
if (!op || !(tbl->flags & F_SIMPLE))
{
if (XK_PARSE(tbl, &val, ptr, 0, 0, NULL, all_tbl_find) < 0)
{
errmsg = strdup(GETMESSAGE(4,13,
"Cannot set the following value for the field '%s': %s"));
printerrf(argv0, errmsg, val, NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
}
}
else {
xk_par_int(&val, &newval, NULL);
switch (tbl->size) {
case sizeof(long):
intval = ((unsigned long *) ptr)[0];
break;
case sizeof(short):
intval = ((unsigned short *) ptr)[0];
break;
case sizeof(char):
intval = ((unsigned char *) ptr)[0];
break;
default:
if (tbl-size == sizeof(int))
{
intval = ((unsigned int *) ptr)[0];
break;
}
}
switch(op) {
case '+':
intval += newval;
break;
case '-':
intval -= newval;
break;
case '*':
intval *= newval;
break;
case '/':
intval /= newval;
break;
case '%':
intval %= newval;
break;
case '&':
intval &= newval;
break;
case '|':
intval |= newval;
break;
case '^':
intval ^= newval;
break;
}
switch (tbl->size) {
case sizeof(long):
((unsigned long *) ptr)[0] = intval;
break;
case sizeof(short):
((unsigned short *) ptr)[0] = intval;
break;
case sizeof(char):
((unsigned char *) ptr)[0] = intval;
break;
default:
if (tbl->size == sizeof(int))
{
((unsigned int *) ptr)[0] = intval;
break;
}
}
}
return(SH_SUCC);
}
int
do_field_comp(
int argc,
char **argv )
{
char *val, *type;
void *ptr, *ptr2, **pptr2, *nuptr;
memtbl_t tbl[2], *tbl2;
unsigned int i;
unsigned char always_ptr;
char pr1[5 * BUFSIZ], pr2[5 * BUFSIZ], *p1, *p2;
char * errbuf;
char * msg;
char * errmsg;
i = 1;
if (argc > 1 && C_PAIR(argv[i], '-', 'p')) {
i++;
always_ptr = 1;
}
else
always_ptr = 0;
if ((i + 2) > argc)
{
XK_USAGE(argv[0]);
}
type = argv[i++];
if (!isdigit(argv[i][0]))
always_ptr = 1;
ptr = getaddr(argv[i++]);
tbl[1] = Null_tbl;
if (!type || !ptr || (parse_decl(argv[0], tbl, type, 1) == FAIL))
{
XK_USAGE(argv[0]);
}
if ((always_ptr || !IS_SIMPLE(tbl)) && !tbl->ptr && !(tbl->flags & F_TYPE_IS_PTR))
tbl->ptr = 1;
else while (tbl->ptr > 1) {
ptr = *((void **) ptr);
tbl->ptr--;
}
for ( ; (i < argc) && argv[i]; i++) {
tbl2 = tbl;
ptr2 = ptr;
pptr2 = &ptr2;
if (val = strchr(argv[i], '=')) {
*val++ = '\0';
tbl2 = ffind(tbl, argv[i], (char **)&pptr2);
if (!tbl2) {
errmsg = strdup(GetSharedMsg(DT_BAD_FIELD_NAME));
printerrf(argv[0], errmsg, argv[i],
type, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
val[-1] = '=';
}
else
val = argv[i];
p1 = pr1;
p2 = pr2;
Pr_tmpnonames = 1;
XK_PRINT(tbl2, &p1, (char *)pptr2, 0, 0, NULL, all_tbl_find);
if (XK_PARSE(tbl2, &val, (char *)&nuptr, 0, 0, NULL,
all_tbl_find) < 0)
{
errmsg=strdup(GETMESSAGE(4,15,
"Cannot parse the following expression: %s"));
printerrf(argv[0], errmsg, argv[i],
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
XK_PRINT(tbl2, &p2, (char *)&nuptr, 0, 0, NULL, all_tbl_find);
XK_FREE(tbl2, (char *)&nuptr, 0, 0, all_tbl_find);
Pr_tmpnonames = 0;
if (strcmp(pr1, pr2)) {
if (env_get((char *) "PRCOMPARE"))
{
errmsg=strdup(GETMESSAGE(4,16,
"The following comparision failed: '%s'\n\tActual: %s\n\tCompare: %s"));
printerrf(argv[0], errmsg,
argv[i], pr1, pr2, NULL, NULL, NULL,
NULL, NULL);
free(errmsg);
}
return(SH_FAIL);
}
}
return(SH_SUCC);
}
static int
myprompt(
char *prompt )
{
fprintf(stderr,prompt);
}
#if 0
/* This needs a functional proto, and needs to be extern'ed in docall.h */
unsigned long
strprint(va_alist)
va_dcl
{
va_list ap;
char *arg;
char *variable = NULL;
memtbl_t tbl;
char *p;
char buf[5 * BUFSIZ];
char *name;
void *val;
char always_ptr;
int nonames = 0;
int ret;
va_start(ap);
always_ptr = 0;
while ((arg = (char *) va_arg(ap, unsigned long)) && (arg[0] == '-')) {
int i;
for (i = 1; arg[i]; i++) {
switch (arg[i]) {
case 'v':
variable = va_arg(ap, char *);
i = strlen(arg) - 1;
break;
case 'p':
always_ptr = 1;
break;
case 'N':
nonames = 1;
}
}
}
name = arg;
if (!arg) {
printerr(argv[0], "Insufficient arguments", NULL);
va_end(ap);
return(SH_FAIL);
}
val = (void *) va_arg(ap, unsigned long);
va_end(ap);
if (parse_decl("strprintf", &tbl, name, 1) == FAIL)
return(SH_FAIL);
if (variable)
p = buf + lsprintf(buf, "%s=", variable);
else
p = buf;
if ((always_ptr || !IS_SIMPLE(&tbl)) && !tbl.ptr && !(tbl.flags & F_TYPE_IS_PTR))
tbl.ptr = 1;
if (!val && (tbl.ptr || (tbl.flags & F_TYPE_IS_PTR))) {
printerr(argv[0], "NULL value argument to strprint", NULL);
return(SH_FAIL);
}
if (always_ptr && (tbl.flags & F_TYPE_IS_PTR))
val = *((void **) val);
else while (tbl.ptr > 1) {
val = *((void **) val);
tbl.ptr--;
}
Pr_tmpnonames = nonames;
ret = XK_PRINT(&tbl, &p, (void *) &val, 0, 0, NULL, all_tbl_find);
Pr_tmpnonames = 0;
if (ret == FAIL)
return(SH_FAIL);
if (variable)
env_set(buf);
else
ALTPUTS(buf);
return(SH_SUCC);
}
#endif

View File

@@ -0,0 +1,51 @@
/* $XConsortium: docall.h /main/4 1995/11/01 15:51:36 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: docall.h
**
** Project: CDE
**
** Description: Public include file for docall.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_docall_h
#define _Dtksh_docall_h
#include "exksh.h"
extern int _Prdebug;
extern struct memtbl Null_tbl;
extern char xk_ret_buffer[];
extern char * xk_ret_buf;
extern struct Bfunction xk_prdebug;
extern int do_field_get(
int argc,
char **argv) ;
extern int do_call(
int argc,
char **argv) ;
extern int asl_set(
char *argv0,
memtbl_t *tblarray,
char *desc,
unsigned char **pargs) ;
extern int do_field_comp(
int argc,
char **argv) ;
#endif /* _Dtksh_docall_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,177 @@
/* $XConsortium: dtextra.h /main/3 1995/11/01 15:51:46 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ifndef _Dtksh_dtextra_h
#define _Dtksh_dtextra_h
#include "widget.h"
#include "dtkcmds.h"
#include "xmcmds.h"
/*
* CDExc17788
*
* The following corrects for a type-mismatch throughout the following
* functions with the element in the table into which they are to be
* inserted.
*/
#if defined(bltin) && ( defined(__STDC__) || defined(__STDPP__) )
#define lcl_cast(x) ((int (*)__PROTO__((int, char*[], __V_*)))x)
#else
#define lcl_cast(x) x
#endif
#define DTK_EXTRA_TABLE \
{ "DtLoadWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtLoadWidget) }, \
{ "DtWidgetInfo", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWidgetInfo) }, \
{ "XBell", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XBell) }, \
{ "XRootWindowOfScreen", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XRootWindowOfScreen) }, \
{ "XWidthOfScreen", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XWidthOfScreen) }, \
{ "XHeightOfScreen", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XHeightOfScreen) }, \
{ "XDefineCursor", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDefineCursor) }, \
{ "XUndefineCursor", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XUndefineCursor) }, \
{ "XFlush", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XFlush) }, \
{ "XSync", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XSync) }, \
{ "XRaiseWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XRaiseWindow) }, \
{ "XtInitialize", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtInitialize) }, \
{ "XtIsSensitive", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtIsSensitive) }, \
{ "XtIsShell", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtIsShell) }, \
{ "XtIsRealized", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtIsRealized) }, \
{ "XtIsManaged", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtIsManaged) }, \
{ "XtCreateManagedWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtCreateManagedWidget) }, \
{ "XtCreateApplicationShell", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtCreateApplicationShell) }, \
{ "XtCreateWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtCreateWidget) }, \
{ "XtDestroyWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtDestroyWidget) }, \
{ "XtSetValues", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtSetValues) }, \
{ "XtSetSensitive", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtSetSensitive) }, \
{ "XtAugmentTranslations", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtAugmentTranslations) }, \
{ "XtOverrideTranslations", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtOverrideTranslations) }, \
{ "XtUninstallTranslations", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtUninstallTranslations) }, \
{ "XtAddCallback", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtAddCallback) }, \
{ "XtRemoveCallback", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRemoveCallback) }, \
{ "XtRemoveAllCallbacks", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRemoveAllCallbacks) }, \
{ "XtCallCallbacks", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtCallCallbacks) }, \
{ "XtHasCallbacks", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtHasCallbacks) }, \
{ "XtAddEventHandler", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtAddEventHandler) }, \
{ "XtRemoveEventHandler", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRemoveEventHandler) }, \
{ "XtGetValues", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtGetValues) }, \
{ "XtCreatePopupShell", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtCreatePopupShell) }, \
{ "XtPopup", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtPopup) }, \
{ "XtPopdown", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtPopdown) }, \
{ "XtMapWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtMapWidget) }, \
{ "XtUnmapWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtUnmapWidget) }, \
{ "XtManageChildren", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtManageChildren) }, \
{ "XtIsSubclass", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtIsSubclass) }, \
{ "XtClass", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtClass) }, \
{ "XtUnmanageChildren", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtUnmanageChildren) }, \
{ "XtAddTimeOut", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtAddTimeOut) }, \
{ "XtRemoveTimeOut", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRemoveTimeOut) }, \
{ "XtAddInput", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtAddInput) }, \
{ "XtRemoveInput", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRemoveInput) }, \
{ "XtAddWorkProc", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtAddWorkProc) }, \
{ "XtRemoveWorkProc", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRemoveWorkProc) }, \
{ "XtRealizeWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtRealizeWidget) }, \
{ "XtUnrealizeWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtUnrealizeWidget) }, \
{ "DtSessionRestorePath", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtSessionRestorePath) }, \
{ "DtSessionSavePath", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtSessionSavePath) }, \
{ "DtShellIsIconified", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtShellIsIconified) }, \
{ "DtSetStartupCommand", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtSetStartupCommand) }, \
{ "DtSetIconifyHint", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtSetIconifyHint) }, \
{ "DtWsmAddWorkspaceFunctions", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmAddWorkspaceFunctions) }, \
{ "DtWsmRemoveWorkspaceFunctions", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmRemoveWorkspaceFunctions) }, \
{ "DtWsmGetCurrentWorkspace", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmGetCurrentWorkspace) }, \
{ "DtWsmSetCurrentWorkspace", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmSetCurrentWorkspace) }, \
{ "DtWsmGetWorkspaceList", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmGetWorkspaceList) }, \
{ "DtWsmGetWorkspacesOccupied", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmGetWorkspacesOccupied) }, \
{ "DtWsmSetWorkspacesOccupied", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmSetWorkspacesOccupied) }, \
{ "DtWsmGetCurrentBackdropWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmGetCurrentBackdropWindow) }, \
{ "DtWsmOccupyAllWorkspaces", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmOccupyAllWorkspaces) }, \
{ "DtGetHourGlassCursor", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do__DtGetHourGlassCursor) }, \
{ "DtTurnOnHourGlass", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do__DtTurnOnHourGlass) }, \
{ "DtTurnOffHourGlass", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do__DtTurnOffHourGlass) }, \
{ "_DtGetHourGlassCursor", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do__DtGetHourGlassCursor) }, \
{ "_DtTurnOnHourGlass", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do__DtTurnOnHourGlass) }, \
{ "_DtTurnOffHourGlass", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do__DtTurnOffHourGlass) }, \
{ "DtWsmAddCurrentWorkspaceCallback", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmAddCurrentWorkspaceCallback) }, \
{ "DtWsmRemoveWorkspaceCallback", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtWsmRemoveWorkspaceCallback) }, \
{ "DtDbLoad", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDbLoad) }, \
{ "DtDbReloadNotify", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDbReloadNotify) }, \
{ "DtActionExists", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtActionExists) }, \
{ "DtActionLabel", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtActionLabel) }, \
{ "DtActionDescription", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtActionDescription) }, \
{ "DtActionInvoke", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtActionInvoke) }, \
{ "DtDtsLoadDataTypes", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsLoadDataTypes) }, \
{ "DtDtsFileToDataType", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsFileToDataType) }, \
{ "DtDtsFileToAttributeValue", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsFileToAttributeValue) }, \
{ "DtDtsFileToAttributeList", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsFileToAttributeList) }, \
{ "DtDtsDataTypeToAttributeValue", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsDataTypeToAttributeValue) }, \
{ "DtDtsDataTypeToAttributeList", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsDataTypeToAttributeList) }, \
{ "DtDtsFindAttribute", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsFindAttribute) }, \
{ "DtDtsDataTypeNames", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsDataTypeNames) }, \
{ "DtDtsSetDataType", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsSetDataType) }, \
{ "DtDtsDataTypeIsAction", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_DtDtsDataTypeIsAction) }, \
{ "ttdt_open", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_open) }, \
{ "ttdt_close", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_close) }, \
{ "tttk_Xt_input_handler", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tttk_Xt_input_handler) }, \
{ "ttdt_session_join", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_session_join) }, \
{ "ttdt_session_quit", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_session_quit) }, \
{ "ttdt_file_event", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_file_event) }, \
{ "ttdt_file_join", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_file_join) }, \
{ "ttdt_file_quit", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_file_quit) }, \
{ "ttdt_Get_Modified", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_Get_Modified) }, \
{ "ttdt_Save", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_Save) }, \
{ "ttdt_Revert", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_ttdt_Revert) }, \
{ "tt_error_pointer", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tt_error_pointer) }, \
{ "tttk_message_destroy", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tttk_message_destroy) }, \
{ "tttk_message_reject", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tttk_message_reject) }, \
{ "tttk_message_fail", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tttk_message_fail) }, \
{ "tt_file_netfile", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tt_file_netfile) }, \
{ "tt_netfile_file", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tt_netfile_file) }, \
{ "tt_host_file_netfile", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tt_host_file_netfile) }, \
{ "tt_host_netfile_file", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tt_host_netfile_file) }, \
{ "tt_message_reply", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_tt_message_reply) },
#define DTK_EXTRA_TABLE2 \
{ "XClearArea", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XClearArea) }, \
{ "XClearWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XClearWindow) }, \
{ "XCopyArea", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XCopyArea) }, \
{ "XDrawArc", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawArc) }, \
{ "XDrawImageString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawImageString) }, \
{ "XDrawLine", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawLine) }, \
{ "XDrawLines", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawLines) }, \
{ "XDrawPoint", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawPoint) }, \
{ "XDrawPoints", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawPoints) }, \
{ "XDrawRectangle", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawRectangle) }, \
{ "XDrawSegments", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawSegments) }, \
{ "XDrawString", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XDrawString) }, \
{ "XFillArc", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XFillArc) }, \
{ "XFillPolygon", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XFillPolygon) }, \
{ "XFillRectangle", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XFillRectangle) }, \
{ "XTextWidth", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XTextWidth) }, \
{ "XtMainLoop", NV_BLTIN|BLT_SPC, lcl_cast(do_XtMainLoop) }, \
{ "XtDisplay", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtDisplay) }, \
{ "XtDisplayOfObject", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtDisplayOfObject) }, \
{ "XtNameToWidget", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtNameToWidget) }, \
{ "XtScreen", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtScreen) }, \
{ "XtWindow", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtWindow) }, \
{ "XtParent", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtParent) }, \
{ "XtLastTimestampProcessed", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_XtLastTimestampProcessed) }, \
{ "catopen", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_catopen) }, \
{ "catgets", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_catgets) }, \
{ "catclose", NV_BLTIN|BLT_ENV|BLT_SPC, lcl_cast(do_catclose) },
#define DTK_EXTRA_ALIAS \
"XtManageChild", NV_NOFREE|NV_EXPORT, "XtManageChildren", \
"XtUnmanageChild", NV_NOFREE|NV_EXPORT, "XtUnmanageChildren",
#endif /* _Dtksh_dtextra_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

9466
cde/programs/dtksh/dtkcmds.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,651 @@
/* $XConsortium: dtkcmds.h /main/6 1996/04/01 17:54:01 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: dtkcmds.h
**
** Project: CDE
**
** Description: Public include file for dtkcmds.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_dtkcmds_h
#define _Dtksh_dtkcmds_h
#include <Dt/Wsm.h>
#include <Dt/Print.h>
#include "name.h"
#define CONVERT_SUCCEEDED 1
#define CONVERT_POSTPONED 0
#define CONVERT_FAILED -1
extern Widget Toplevel;
extern char str_nill[];
extern wtab_t * DTKSHConversionWidget;
extern classtab_t * DTKSHConversionClass;
extern char * DTKSHConversionResource;
extern wtab_t * set_up_w(
Widget wid,
wtab_t *parent,
char *var,
char *name,
classtab_t *class) ;
extern void parse_args(
char *arg0,
int argc,
char **argv,
wtab_t *w,
wtab_t *parent,
classtab_t *class,
int *n,
Arg *args,
int * pargc,
char ** pargv,
Boolean postponePixmaps ) ;
extern void free_args(
int n,
Arg *args) ;
extern int do_XtInitialize(
int argc,
char *argv[]) ;
extern int do_XtCreateApplicationShell(
int argc,
char *argv[]) ;
extern int do_XtCreatePopupShell(
int argc,
char *argv[]) ;
extern int do_XtCreateManagedWidget(
int argc,
char *argv[]) ;
extern int do_XtCreateWidget(
int argc,
char *argv[]) ;
extern int do_XtPopup(
int argc,
char *argv[]) ;
extern int do_XtDestroyWidget(
int argc,
char *argv[]) ;
extern int do_single_widget_test_func(
int (*func)(),
int argc,
char **argv) ;
extern int do_XtIsSensitive(
int argc,
char *argv[]) ;
extern int do_XtIsShell(
int argc,
char *argv[]) ;
extern int do_XtIsManaged(
int argc,
char *argv[]) ;
extern int do_XtIsRealized(
int argc,
char *argv[]) ;
extern int do_XtRealizeWidget(
int argc,
char *argv[]) ;
extern int do_XtUnrealizeWidget(
int argc,
char *argv[]) ;
extern int do_XtMapWidget(
int argc,
char *argv[]) ;
extern int do_XtUnmapWidget(
int argc,
char **argv) ;
extern int do_XtPopdown(
int argc,
char **argv) ;
extern int do_XtMainLoop(
int argc,
char **argv) ;
extern int do_XtDisplay(
int argc,
char **argv) ;
extern int do_XtDisplayOfObject(
int argc,
char **argv) ;
extern int do_XtNameToWidget(
int argc,
char **argv) ;
extern int do_XtScreen(
int argc,
char **argv) ;
extern int do_XtWindow(
int argc,
char **argv) ;
extern int do_XtCallCallbacks(
int argc,
char **argv) ;
extern int do_XtHasCallbacks(
int argc,
char **argv) ;
extern int do_XtAddCallback(
int argc,
char **argv) ;
extern int AddOneCallback(
char *cmd,
char *widget,
char *cbName,
char *kshcmd,
char *propAtomStr) ;
extern int do_XtRemoveCallback(
int argc,
char **argv) ;
extern int RemoveOneCallback(
char *cmd,
char *widget,
char *cbName,
char *kshcmd,
char *propAtomStr,
char *handleStr) ;
extern int do_XtAddEventHandler(
int argc,
char **argv) ;
extern int do_XtRemoveEventHandler(
int argc,
char **argv) ;
extern int do_XtGetValues(
int argc,
char **argv) ;
extern int do_XtSetValues(
int argc,
char **argv) ;
extern int do_XtAddWorkProc(
int argc,
char *argv[]) ;
extern int do_XtRemoveWorkProc(
int argc,
char *argv[]) ;
extern int do_XtAddTimeOut(
int argc,
char *argv[]) ;
extern int do_XtRemoveTimeOut(
int argc,
char *argv[]) ;
extern int do_XtUnmanageChildren(
int argc,
char *argv[]) ;
extern int do_XtManageChildren(
int argc,
char *argv[]) ;
extern int do_XtIsSubclass(
int argc,
char *argv[]) ;
extern int do_XtClass(
int argc,
char *argv[]) ;
extern int do_managelist_func(
int argc,
char *argv[],
int (*func)()) ;
extern int create_standard_gc(
Display *display,
Window drawable) ;
extern int do_XBell(
int argc,
char *argv[]) ;
extern int do_XRootWindowOfScreen(
int argc,
char *argv[]) ;
extern int do_XWidthOfScreen(
int argc,
char *argv[]) ;
extern int do_XHeightOfScreen(
int argc,
char *argv[]) ;
extern int do_XDefineCursor(
int argc,
char *argv[]) ;
extern int do_XUndefineCursor(
int argc,
char *argv[]) ;
extern int do_XtRemoveAllCallbacks(
int argc,
char *argv[]) ;
extern int do_XTextWidth(
int argc,
char *argv[]) ;
extern int do_XDrawArc(
int argc,
char *argv[]) ;
extern int do_XDrawImageString(
int argc,
char *argv[]) ;
extern int do_XDrawLine(
int argc,
char *argv[]) ;
extern int do_XDrawLines(
int argc,
char *argv[]) ;
extern int do_XDrawPoint(
int argc,
char *argv[]) ;
extern int do_XDrawPoints(
int argc,
char *argv[]) ;
extern int do_XDrawRectangle(
int argc,
char *argv[]) ;
extern int do_XCopyArea(
int argc,
char *argv[]) ;
extern int do_XDrawSegments(
int argc,
char *argv[]) ;
extern int do_XDrawString(
int argc,
char *argv[]) ;
extern int do_XFillArc(
int argc,
char *argv[]) ;
extern int do_XFillPolygon(
int argc,
char *argv[]) ;
extern int do_XFillRectangle(
int argc,
char *argv[]) ;
extern int do_XClearArea(
int argc,
char *argv[]) ;
extern int do_XClearWindow(
int argc,
char *argv[]) ;
extern int ConvertTypeToString(
char *arg0,
classtab_t *class,
wtab_t *w,
wtab_t *parent,
char *resource,
XtArgVal val,
char **ret) ;
extern int ConvertStringToType(
char *arg0,
wtab_t *w,
wtab_t *parent,
classtab_t *class,
char *resource,
char *val,
XtArgVal *ret,
int *freeit,
Boolean postponePixmaps) ;
extern int do_XtAddInput(
int argc,
char *argv[]) ;
extern int do_XtRemoveInput(
int argc,
char *argv[]) ;
extern void Translation_ksh_eval(
Widget w,
XEvent *event,
String *params,
Cardinal *num_params) ;
extern void RestorePriorEnvVarValues(
Namval_t *np1,
char *value1,
Namval_t *np2,
char *value2) ;
extern void stdCB(
void *widget,
caddr_t clientData,
caddr_t callData) ;
extern void stdWSCB(
void *widget,
Atom atom,
caddr_t clientData) ;
extern void stdInputCB(
inputrec_t *inp,
int *source,
XtInputId *id) ;
extern int stdWorkProcCB(
char *clientData) ;
extern void stdTimerCB(
char *clientData,
long *id) ;
extern void stdPrintSetupProc(
int proctype,
void *widget,
DtPrintSetupData *callData);
extern void stdPrinterInfoProc(
void *widget,
DtPrintSetupData *callData);
extern void stdSelectFileProc(
void *widget,
DtPrintSetupData *callData);
extern void stdSelectPrinterProc(
void *widget,
DtPrintSetupData *callData);
extern void stdSetupProc(
void *widget,
DtPrintSetupData *callData);
extern void stdVerifyPrinterProc(
void *widget,
DtPrintSetupData *callData);
extern int do_VerifyString(
int argc,
char *argv[]) ;
extern int do_XFlush(
int argc,
char *argv[]) ;
extern int do_XSync(
int argc,
char *argv[]) ;
extern int do_XRaiseWindow(
int argc,
char *argv[]) ;
extern int do_XtSetSensitive(
int argc,
char *argv[]) ;
extern int do_XtOverrideTranslations(
int argc,
char **argv) ;
extern int do_XtAugmentTranslations(
int argc,
char **argv) ;
extern int do_XtUninstallTranslations(
int argc,
char *argv[]) ;
extern int do_XtParent(
int argc,
char **argv) ;
extern int do_XtLastTimestampProcessed(
int argc,
char **argv) ;
extern dtksh_client_data_t * GetNewCBData(
char *ksh_cmd,
wtab_t *w,
char *cbname,
Atom propAtom) ;
extern int LocateCBRecord(
wtab_t *w,
char *cbname,
char *ksh_cmd,
Atom propAtom,
DtWsmCBContext handle) ;
extern void stdEH(
void *widget,
caddr_t clientData,
XEvent *event,
Boolean *continueToDispatch) ;
extern dtksh_event_handler_data_t * GetNewEHData(
char *ksh_cmd,
wtab_t *w,
EventMask eventMask,
Boolean nonMaskable) ;
extern int do_DtSessionRestorePath(
int argc,
char *argv[]) ;
extern int do_DtSessionSavePath(
int argc,
char *argv[]) ;
extern int do_DtShellIsIconified(
int argc,
char *argv[]) ;
extern int do_DtSetStartupCommand(
int argc,
char *argv[]) ;
extern int do_DtSetIconifyHint(
int argc,
char *argv[]) ;
extern int do_DtWsmAddWorkspaceFunctions(
int argc,
char *argv[]) ;
extern int do_DtWsmRemoveWorkspaceFunctions(
int argc,
char *argv[]) ;
extern int do_DtWsmGetCurrentWorkspace(
int argc,
char *argv[]) ;
extern int do_DtWsmSetCurrentWorkspace(
int argc,
char *argv[]) ;
extern int do_DtWsmGetWorkspaceList(
int argc,
char *argv[]) ;
extern int do_DtWsmGetWorkspacesOccupied(
int argc,
char *argv[]) ;
extern int do_DtWsmSetWorkspacesOccupied(
int argc,
char *argv[]) ;
extern int do_DtWsmGetCurrentBackdropWindow(
int argc,
char *argv[]) ;
extern int do_DtWsmOccupyAllWorkspaces(
int argc,
char *argv[]) ;
extern int do__DtGetHourGlassCursor(
int argc,
char *argv[]) ;
extern int do__DtTurnOnHourGlass(
int argc,
char *argv[]) ;
extern int do__DtTurnOffHourGlass(
int argc,
char *argv[]) ;
extern int do_DtWsmAddCurrentWorkspaceCallback(
int argc,
char **argv) ;
extern int do_DtWsmRemoveWorkspaceCallback(
int argc,
char **argv) ;
extern int do_DtDbLoad(
int argc,
char *argv[]) ;
extern int do_DtDbReloadNotify(
int argc,
char *argv[]) ;
extern int do_DtActionExists(
int argc,
char *argv[]) ;
extern int do_DtActionLabel(
int argc,
char *argv[]) ;
extern int do_DtActionDescription(
int argc,
char *argv[]) ;
extern int do_DtActionInvoke(
int argc,
char *argv[]) ;
extern int do_DtDtsLoadDataTypes(
int argc,
char *argv[] );
extern int do_DtDtsFileToDataType(
int argc,
char *argv[] );
extern int do_DtDtsFileToAttributeValue(
int argc,
char *argv[] );
extern int do_DtDtsFileToAttributeList(
int argc,
char *argv[] );
extern int do_DtDtsDataTypeToAttributeValue(
int argc,
char *argv[] );
extern int do_DtDtsDataTypeToAttributeList(
int argc,
char *argv[] );
extern int do_DtDtsFindAttribute(
int argc,
char *argv[] );
extern int do_DtDtsDataTypeNames(
int argc,
char *argv[] );
extern int do_DtDtsSetDataType(
int argc,
char *argv[] );
extern int do_DtDtsDataTypeIsAction(
int argc,
char *argv[] );
extern int do_ttdt_open(
int argc,
char *argv[] );
extern int do_ttdt_close(
int argc,
char *argv[] );
extern int do_tttk_Xt_input_handler(
int argc,
char *argv[] );
extern int do_ttdt_session_join(
int argc,
char *argv[] );
extern int do_ttdt_session_quit(
int argc,
char *argv[] );
extern int do_ttdt_file_event(
int argc,
char *argv[] );
extern int do_ttdt_file_join(
int argc,
char *argv[] );
extern int do_ttdt_file_quit(
int argc,
char *argv[] );
extern int do_ttdt_Get_Modified(
int argc,
char *argv[] );
extern int do_ttdt_Save(
int argc,
char *argv[] );
extern int do_ttdt_Revert(
int argc,
char *argv[] );
extern int do_tt_error_pointer(
int argc,
char *argv[] );
extern int do_tttk_message_destroy(
int argc,
char *argv[] );
extern int do_tt_message_reply(
int argc,
char *argv[] );
extern int do_tttk_message_reject(
int argc,
char *argv[] );
extern int do_tttk_message_fail(
int argc,
char *argv[] );
extern int do_tt_file_netfile(
int argc,
char *argv[] );
extern int do_tt_netfile_file(
int argc,
char *argv[] );
extern int do_tt_host_file_netfile(
int argc,
char *argv[] );
extern int do_tt_host_netfile_file(
int argc,
char *argv[] );
extern Namval_t * GetNameValuePair(
char *name) ;
extern void FreeNestedVariables( void ) ;
extern Namval_t * nopCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * dftCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * ehCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * transCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * scaleCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * arrowCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * comboCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * cmdCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * dAreaCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * dbtnCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * dtPrintSetupProcDisc(
Namval_t *np,
char *name,
Namfun_t *fp);
extern Namval_t * fselCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * listCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * pbtnCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * rcCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * sbarCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * swinCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * sboxCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * tbtnCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * textCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * textCreateDisc2(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern Namval_t * helpCreateDisc(
Namval_t *np,
char *name,
Namfun_t *fp) ;
extern int * LockKshFileDescriptors( void ) ;
extern void UnlockKshFileDescriptors(
int * fdList) ;
#endif /* _Dtksh_dtkcmds_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

1015
cde/programs/dtksh/dtkcvt.c Normal file

File diff suppressed because it is too large Load Diff

173
cde/programs/dtksh/dtkcvt.h Normal file
View File

@@ -0,0 +1,173 @@
/* $XConsortium: dtkcvt.h /main/5 1996/03/13 13:19:27 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: dtkcvt.h
**
** Project: CDE
**
** Description: Public include file for dtkcvt.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_dtkcvt_h
#define _Dtksh_dtkcvt_h
extern void DtkshCvtWindowToString(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtScreenToString(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtStringToScreen(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtStringToTopItemPosition(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtHexIntToString(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtIntToString(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtBooleanToString(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtStringToPointer(
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval) ;
extern void DtkshCvtStringToWidget(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToCallback(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtCallbackToString(
Display *display,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer converterData) ;
extern void DtkshCvtStringToPrintSetupProc(
Display *display,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data);
extern void DtkshCvtWidgetToString(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToEventMask(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToListItems(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToWidgetClass(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtWidgetClassToString(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToMWMDecoration(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtMWMDecorationToString(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToMWMFunctions(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtMWMFunctionsToString(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtStringToPanedWinPosIndex(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
extern void DtkshCvtPanedWinPosIndexToString(
Display *dpy,
XrmValuePtr args,
Cardinal *nargs,
XrmValuePtr fval,
XrmValuePtr toval,
XtPointer data) ;
#endif /* _Dtksh_dtkcvt_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

116
cde/programs/dtksh/dtksh.c Normal file
View File

@@ -0,0 +1,116 @@
/* $XConsortium: dtksh.c /main/3 1995/11/01 15:53:19 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#define CONSTCHAR (const char *)
#define TRUE 1
#define FALSE 0
#ifndef DTKSHBINDIR
#define DTKSHBINDIR "/usr/bin"
#endif
static int
FileExists(dir, file)
char *dir, *file;
{
struct stat sbuf;
char path[1024];
sprintf(path, "%s/%s", dir, file);
return(stat(path, &sbuf) != -1);
}
/*
* Bootstrap dtksh by calling xmcoeksh and forcing it to execute
* an rc file that calls the dtksh init function and does some
* other minor housekeeping.
*
* The rc file then sees if there was a previous user rc file (in $_HOLDENV_)
* and if so executes it.
*/
int
main(argc, argv)
int argc;
char *argv[];
{
char *env;
char *bindir = NULL;
char *executable, *envfile;
char *buf;
char envbuf[1024];
/*
* Set the ENV variable to the standard dtksh rc file, which
* will do a libdirload of the dtksh shared object file and add all
* the dtksh commands and widgets to the exksh. If the user already
* had an ENV file, then set the variable _HOLDENV_ to it so the
* standard dtksh rc file can execute it later.
*/
env = getenv((const char *)"ENV");
buf = (char *)malloc((env ? strlen(env) : 0) + 12);
strcpy(buf, "_HOLDENV_=");
strcat(buf, env ? env : "");
putenv(buf);
executable = "xmcoeksh";
envfile = "xmcoeksh.rc";
/*
* Search order for DTKSH binaries:
*
* 1. if $DTKSHBINDIR is set, use that path if it exists.
* 2. if the hard-wired #define DTKSHBINDIR is set and is a
* readable directory, use it.
* 3. punt.
*/
if ((bindir = getenv((const char *)"DTKSHBINDIR")) != NULL) {
if ((!FileExists(bindir, executable)) ||
(!FileExists(bindir, envfile)))
{
bindir = NULL;
}
}
if (bindir == NULL)
{
bindir = DTKSHBINDIR;
if ((!FileExists(bindir, executable)) ||
(!FileExists(bindir, envfile)))
{
bindir = NULL;
}
}
if (bindir == NULL) {
fprintf(stderr,
"dtksh: bootstrap failed. Unable to locate both\nxmcoeksh and xmcoeksh.rc in the same directory.\n Try setting $DTKSHBINDIR.\n");
exit(1);
}
sprintf(envbuf, "DTKSHBINDIR=%s", bindir);
putenv(strdup(envbuf));
sprintf(envbuf, "ENV=%s/%s", bindir, envfile);
putenv(strdup(envbuf));
sprintf(envbuf, "%s/%s", bindir, executable);
execv(envbuf, argv);
fprintf(stderr, "dtksh: Bootstrap of dtksh failed: '%s'\n", envbuf);
perror("Reason");
return(1); /* failure */
}

View File

@@ -0,0 +1,4 @@
env_get
env_set
handle_to_widget
ksh_eval

139
cde/programs/dtksh/dtksh.h Normal file
View File

@@ -0,0 +1,139 @@
/* $XConsortium: dtksh.h /main/4 1996/03/13 13:19:34 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ifndef _Dtksh_dtksh_h
#define _Dtksh_dtksh_h
#if !defined(NO_AST)
#include "nval.h"
#endif
#define SUCCESS 0
#define FAIL (-1)
/* bits for the flags field of wtab_t */
#define F_CHILD 1
#define F_TOPLEVEL 2
/*
* Table types
*/
#define TAB_EMPTY 0
#define TAB_FIELDS 1
#define TAB_ITEMS 2
#define TAB_WIDGET 3
/*
* Widget entry states
*/
#define DT_PENDING_DESTROY 0x01
typedef struct {
char *name;
char *class;
char *type;
int size;
} resfixup_t;
typedef struct {
char * callbackName;
void * discipline;
} discInfo;
typedef struct {
char *cname;
WidgetClass class; /* Class record */
resfixup_t *resfix; /* fixup list for resources */
resfixup_t *confix; /* fixup list for constraint resources */
discInfo * disciplines; /* Callback data environment disciplines */
char *res; /* Hashed list of resources */
char *con; /* Hashed list of constraint resources */
} classtab_t;
typedef struct wtab {
int type; /* entry type (TAB_) */
int size; /* entry size */
Widget w; /* widget pointer */
char *wname; /* name of widget */
char *widid; /* id of widget */
classtab_t *wclass; /* widget's class */
struct wtab *parent; /* pointer to widget's parent wtab_t */
char *envar; /* initial environment variable user gave */
unsigned char mask; /* keeps track of state; i.e. pending destroy */
XtPointer info; /* some widgets use this for any other info */
} wtab_t;
typedef struct {
char *ksh_cmd;
wtab_t *w;
char *cbname;
int refCount;
Atom propAtom;
XtPointer handle;
} dtksh_client_data_t;
typedef struct {
char *ksh_cmd;
wtab_t *w;
EventMask eventMask;
Boolean nonMaskable;
} dtksh_event_handler_data_t;
typedef struct {
char *name;
EventMask mask;
} EventMaskTable;
typedef struct {
char *name;
int value;
} MWMTable;
#define LINESIZE 1024
/* Input buffer modes */
#define LINE_INPUT_MODE (1<<0)
#define RAW_INPUT_MODE (1<<1)
#define INPUT_SOURCE_BUSY (1<<2)
#define INPUT_SOURCE_PENDING_DELETE (1<<3)
typedef struct {
int fd; /* the input source */
char *lnbuf; /* a line being built */
int lnbufsize; /* size of line buffer */
int lnend; /* current end of the line */
char *cmd; /* the ksh command to execute given the line */
unsigned char flags; /* mode flags */
char lastCharIsBackslash; /* Used during backslash processing */
char lineWasTouched; /* Empty line, but had a backslash */
} inputrec_t;
#ifndef CONSTCHAR
#define CONSTCHAR (const char *)
#endif
#define PRINTER_INFO_PROC 0
#define SELECT_FILE_PROC 1
#define SELECT_PRINTER_PROC 2
#define SETUP_PROC 3
#define VERIFY_PRINTER_PROC 4
typedef struct {
String printerInfoProcCommand;
String selectFileProcCommand;
String selectPrinterProcCommand;
String setupProcCommand;
String verifyPrinterProcCommand;
} ProcInfo_t;
#endif /* _Dtksh_dtksh_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,540 @@
$ $XConsortium: dtksh.msg /main/3 1995/11/01 15:53:40 rswiston $
$set 1
1 DtkshCvtStringToPixel: The color '%s' is not defined
$set 5
1 Too many resource parameters have been specified; skipping '%s'
2 Bad resource specification; should be of the form 'name:value' : %s
3 The resource separator is ':' but you used '=' : %s
4 The toolkit has already been initialized
5 Usage: XtInitialize variable applicationName applicationClass [args ...]
6 Usage: %s variable name class parent [arg:val ...]
7 Usage: XtCreateApplicationShell variable name class [arg:val ...]
8 Usage: XtPopup widget GrabNone|GrabNonexclusive|GrabExclusive
9 The grab type '%s' is not recognized; using 'GrabNone'
10 Usage: XtIsShell widget
11 Usage: XtMapWidget widget
12 Usage: XtUnmapWidget widget
13 Usage: %s variable widget
14 Usage: XtScreen variable widget
15 Usage: XtWindow variable widget
16 Usage: XtCallCallbacks widget callbackName
17 Usage: XtHasCallbacks variable widget callbackName
18 Usage: XtAddCallback widget callbackName ksh-command
19 Usage: XtRemoveCallback widget callbackName ksh-command
20 The following is an invalid callback handle: %s
21 The specified callback is not registered
22 Usage: XtAddEventHandler widget mask nonMaskable ksh-command
23 Usage: XtRemoveEventHandler widget mask nonMaskable ksh-command
24 The specified event handler is not registered
25 Usage: XtGetValues widget resource:variable ...
26 The following resource parameter is incorrectly formed: %s
27 Usage: XtSetValues widget arg:val ...
28 Usage: XtAddWorkProc variable command
29 Usage: XtRemoveWorkProc workProcId
30 The workProcId parameter must be a hex number: %s
31 Usage: XtAddTimeOut variable milliseconds command
32 The milliseconds parameter must be greater than zero
33 Usage: XtRemoveTimeOut intervalId
34 The intervalId parameter must be a hex number: %s
35 Usage: %s widget ...
36 Usage: XBell display volume
37 Usage: %s variable screen
38 The screen parameter is invalid: %s
39 Usage: XDefineCursor display window cursorId
40 The cursorId parameter is invalid: %s
41 Usage: XUndefineCursor display window
42 Usage: XtRemoveAllCallbacks widget callbackName
43 Usage: XTextWidth variable fontName string
44 Usage: %s display drawable [args ...]
45 The drawable parameter is invalid: %s
46 The destination parameter is invalid: %s
47 Unrecognized graphics function name: %s
48 Unrecognized line style: %s
49 Unrecognized drawing option: %s
50 There were left over points which were ignored
51 Usage: XCopyArea display source dest sourceX sourceY width height destX destY [args ...]
52 Unable to convert resource type '%s' to 'String'
53 Unable to convert resource type 'String' to type '%s'
54 Usage: XtAddInput variable [-r] fileDescriptor kshCommand
56 Usage: XtRemoveInput inputId
57 The inputId parameter must be a hex number: %s
59 Usage: XFlush display
60 Usage: XSync display discard
61 Usage: XRaiseWindow display window
62 Usage: %s widget [True|False]
63 Usage: %s widget translations
64 Usage: XtUninstallTranslations widget
65 Usage: XtParent variable widget
66 Usage: XtLastTimestampProcessed variable display
67 Usage: DtSessionRestorePath widget pathVariable saveFile
68 Usage: DtSessionSavePath widget pathVariable fileVariable
69 Usage: DtShellIsIconified widget
70 Usage: DtSetStartupCommand widget command
71 Usage: DtSetIconifyHint widget boolean
73 The rootWindow parameter is invalid: %s
74 Usage: DtWsmSetCurrentWorkspace widget atom
75 The workspace atom is invalid: %s
78 Usage: DtWsmSetWorkspacesOccupied display window workspaceList
79 Usage: DtGetHourGlassCursor variable display
80 Usage: DtWsmAddCurrentWorkspaceCallback variable widget ksh-command
81 Usage: DtWsmRemoveWorkspaceCallback handle
82 Usage: XtNameToWidget variable referenceWidget names
83 Usage: DtDbLoad
84 Usage: DtDbReloadNotify ksh-command
85 Usage: DtActionExists actionName
86 Usage: DtActionLabel variable actionName
87 Usage: DtActionDescription variable actionName
88 Usage: DtActionInvoke widget actionName termParms execHost contextDir useIndicator ksh-command ["FILE" fileName] ...
89 Usage: DtDtsLoadDataTypes
90 Usage: DtDtsFileToDataType variable fileName
91 Usage: DtDtsFileToAttributeValue variable fileName attrName
92 Usage: DtDtsFileToAttributeList variable fileName
93 Usage: DtDtsDataTypeToAttributeValue variable dataType attrName optName
94 Usage: DtDtsDataTypeToAttributeList variable dataType optName
95 Usage: DtDtsFindAttribute variable name value
96 Usage: DtDtsDataTypeNames variable
97 Usage: DtDtsSetDataType variable fileName dataType override
98 Usage: DtDtsDataTypeIsAction dataType
99 Usage: ttdt_open variable status variable2 toolname vendor version sendStarted
100 Usage: tttk_Xt_input_handler procId source id
101 The source parameter must be an integer: %s
102 The id parameter must be a hex number: %s
103 Usage: ttdt_close status procId newProcId sendStopped
104 Usage: ttdt_session_join variable status sessId shellWidgetHandle join
105 Usage: ttdt_session_quit status sessId sessPatterns quit
106 The sessPatterns parameter is invalid: %s
107 Usage: ttdt_file_event status op patterns send
108 Usage: ttdt_file_quit status patterns quit
109 Usage: ttdt_Get_Modified pathName scope timeout
110 Usage: %s status pathName scope timeout
112 Usage: tt_error_pointer variable ttStatus
113 Usage: %s status msg
114 Usage: %s status msg msgStatus msgStatusString destroy
115 Usage: ttdt_file_join variable status pathName scope join ksh-command
116 Usage: tt_file_netfile variable status filename
117 Usage: tt_netfile_file variable status netfilename
118 Usage: tt_host_file_netfile variable status host filename
119 Usage: tt_host_netfile_file variable status host netfilename
120 Usage: XtIsSubclass widget class
121 %s is not a valid widget class name
122 Usage: XtClass variable widget
$set 6
1 DtkshCvtWindowToString: The 'from' value is an invalid size
2 DtkshCvtHexIntToString: The 'from' value is an invalid size
3 DtkshCvtIntToString: The 'from' value is an invalid size
4 DtkshCvtBooleanToString: The 'from' value is an invalid size
5 DtkshCvtStringToWidget: The 'from' value is an invalid size
6 DtkshCvtStringToWidget: Unable to find a widget named '%s'
7 DtkshCvtStringToCallback: The 'from' value is an invalid size
8 DtkshCvtCallbackToString: The 'from' value is an invalid size
9 DtkshCvtWidgetToString: The 'from' value is an invalid size
10 DtkshCvtWidgetToString: Unable to find a name for the widget
11 DtkshCvtWidgetClassToString: The 'from' value is an invalid size
12 DtkshCvtWidgetClassToString: Unknown widget class
13 DtkshCvtStringToWidgetClass: Unknown widget class name
14 DtkshCvtScreenToString: The 'from' value is an invalid size
$set 11
1 Cannot find a field named '%s' in the structure '%s'
2 DtkshCvtCallbackToString: An internal conversion buffer overflowed
3 Hashing failure for resource '%s' in widget class '%s'
4 No function name was supplied
5 The command cannot be executed; the toolkit has not been initialized
6 The creation of widget '%s' failed
7 The display parameter is invalid: %s
8 The following property atom is invalid: %s
9 The following resource is not defined for widget '%s': %s
10 The position specified is invalid: %s
11 The specified font is invalid: %s
12 The widget handle '%s' does not refer to an existing widget
13 The widget must be a 'command' widget
14 The widget must be a 'mainWindow' widget
15 The widget must be a 'scale' widget
16 The widget must be a 'scrollBar' widget
17 The widget must be a 'toggleButton' widget or gadget
18 The window parameter is invalid: %s
19 Unable to allocate required memory; exiting
20 Unable to find the parent widget
21 Unable to locate the symbol '%s'
22 Unable to locate the type '%s'
23 Unable to parse the declaration '%s'; using 'unsigned long'
24 Unknown child type: %s
25 Unrecognized option flag: %s
26 Usage: %s widget position
27 Usage: %s widget time
28 Usage: %s widget
29 dtksh error
30 dtksh warning
31 Usage: %s display window
32 Usage: %s display window variable
33 Usage: %s display rootWindow variable
34 The timeout parameter is invalid: %s
35 The msg parameter is invalid: %s
36 The patterns parameter is invalid: %s
$set 14
1 Internal hash table failure during widget class initialization; exiting
2 Could not find a widget class named '%s'
3 The identifier '%s' is not a valid widget handle
4 Unable to find the widget class
5 Usage: DtLoadWidget widgetClassName widgetClassRecordName
6 Unable to locate a widget class record named '%s'
7 Internal hash table failure during initialization of widget class '%s'
8 \n%sRESOURCES FOR %s%s%s:\n
9 CONSTRAINT
10 R
11 M
12 S
13 %-15s %-6s %-6s %-18s %-6s %s\n
14 ENV VARIABLE HANDLE PARENT CLASS STATUS NAME\n
15 \nUsage:\tDtWidgetInfo [widgetHandle]\n\tDtWidgetInfo -r <widgetHandle|className>\n\tDtWidgetInfo -R <widgetHandle|className>\n\tDtWidgetInfo -c [className]\n\tDtWidgetInfo -h [widgetHandle]
$set 15
1 Unable to initialize the Toolkit
2 The following resource cannot be set at widget\ncreation time. Use XtSetValues after creation instead: %s
3 Usage: %s variable parent name [argument:value ...]
4 Usage: DtHelpReturnSelectedWidgetId variable widget variable
5 Usage: DtHelpSetCatalogName catalogName
6 Usage: DtHelpQuickDialogGetChild variable quickHelpWidget child
7 The widget must be a 'quickHelp' widget
8 The widget must be a 'list' widget
9 Usage: %s widget position item
10 Usage: %s widget position itemList
11 Usage: %s widget item
12 Usage: XmListDeleteItemsPos widget count position
13 Usage: XmListDeleteItems widget itemList
14 Usage: XmListDeletePositions widget positionList
15 Usage: XmListGetKbdItemPos variable widget
16 Usage: XmListItemExists widget item
17 Usage: XmListItemPos variable widget item
18 Usage: XmListPosSelected widget position
19 Usage: XmListPosToBounds widget position variable variable variable variable
20 Usage: %s widget position notifyFlag
21 Usage: %s widget item notifyFlag
22 Usage: XmListSetAddMode widget boolean
23 Usage: XmListSetKbdItemPos widget position
24 Usage: XmMainWindowSetAreas mainwindow menu command hscroll vscroll work
25 The 'mainWindow' handle is NULL
26 Usage: %s variable mainwindow
27 Usage: XmProcessTraversal widget direction
28 Unknown traversal direction: %s
29 Usage: XmInternAtom variable display name onlyIfExists
30 Usage: XmGetAtomName variable display atom
31 The specified atom is invalid: %s
32 Usage: XmGetColors widget background foreground topshadow bottomshadow select
33 The background pixel is invalid: %s
34 Usage: XmUpdateDisplay widget
35 Usage: %s widget protocol [protocol ...]
36 The atom specified is invalid: %s
37 Usage: XmAddWMProtocolCallback widget protocol ksh-command
38 Usage: XmRemoveWMProtocolCallback widget protocol ksh-command
39 Usage: XmMenuPosition menu event
40 The specified event is invalid: %s
41 Usage: XmCommandAppendValue commandWidget string
42 Usage: XmCommandError commandWidget errorMessage
43 Usage: XmCommandSetValue commandWidget command
44 Usage: XmCommandGetChild variable commandWidget child
45 Usage: XmMessageBoxGetChild variable commandWidget child
46 The widget must be a 'messageBox' widget
47 Usage: XmFileSelectionBoxGetChild variable widget child
48 The widget must be a 'file selection box' widget
49 Usage: XmSelectionBoxGetChild variable widget child
50 The widget must be a 'selection box' widget
51 Usage: XmScaleGetValue scaleWidget variable
52 Usage: XmScaleSetValue scaleWidget value
53 The scale value specified is invalid: %s
54 Usage: XmScrollBarGetValues scrollbar variable variable variable variable
55 Usage: XmScrollBarSetValues scrollbar value sliderSize increment pageIncrement notify
56 The value specified is invalid: %s
57 The slider size specified is invalid: %s
58 The increment specified is invalid: %s
59 The page increment specified is invalid: %s
60 Usage: XmScrollVisible scrolledWin widget leftRightMargin topBottomMargin
61 The widget must be a 'scrolledWindow' widget
62 The widget to be made visible does not exist.
63 The left/right margin specified is invalid: %s
64 The top/bottom margin specified is invalid: %s
65 Usage: %s widget state notify
66 Usage: catopen variable catName
67 Usage: catclose catId
68 Usage: catgets variable catId setNum msgNum dftMsg
69 The widget must be a 'text' or 'textField' widget
70 Usage: %s variable widget
71 Usage: %s widget boolean
72 The parameter specified is invalid: %s
73 Usage: %s widget lines
74 Usage: %s widget maxLength
75 Usage: %s widget string
76 Usage: %s widget variable variable
77 Usage: %s widget position string
78 Usage: %s widget position variable variable
79 Usage: %s widget fromPosition toPosition string
80 The 'from' position specified is invalid: %s
81 The 'to' position specified is invalid: %s
82 Usage: %s widget firstPosition lastPosition time
83 The first position specified is invalid: %s
84 The last position specified is invalid: %s
85 The time specified is invalid: %s
86 Usage: %s variable widget x y
87 The x position specified is invalid: %s
88 The y position specified is invalid: %s
89 Usage: %s widget left right mode
90 The left position specified is invalid: %s
91 The right position specified is invalid: %s
92 Usage: %s widget start string direction variable
93 The start position specified is invalid: %s
94 Usage: XmListGetSelectedPos variable widget
95 Usage: XmListGetMatchPos variable widget item
96 Usage: XmOptionLabelGadget variable widget
97 Usage: XmOptionButtonGadget variable widget
98 Usage: XmGetVisibility variable widget
99 Usage: XmGetTearOffControl variable widget
100 Usage: XmGetTabGroup variable widget
101 Usage: XmGetPostedFromWidget variable widget
102 Usage: XmGetFocusWidget variable widget
103 Usage: XmFileSelectionDoSearch widget directoryMask
$set 16
1 DtkshCvtNamedValueToString: No match found
2 DtkshCvtStringToNamedValue: Unable to convert the string '%s'
$ The following messages are for ksh93 itself. The message numbers must
$ match those specified in the MsgStr array allmsgs in
$ ksh93/src/cmd/ksh93/sh/init.c, as must the set number.
$set 25
1 Done
3 Running
4 [-n] [arg...]
5 [arg...]
6 [dir] [list]
7 [job...]
8 [n]
9 [name [pathname] ]
10 [name]
11 [top] [base]
12 expr...
13 format [arg...]
14 is a function
15 is a keyword
16 is a shell builtin
17 is an exported function
18 is an undefined function
19 name [arg...]
20 :a:[name] optstring name [args...]
21 seconds
23 ${HOME:-.}/.profile
24 %c: invalid character in expression - %s
25 %c: unknown format specifier
26 %d-%d: invalid range
27 %d: invalid binary script version
28 %s is an alias for
29 %s is an exported alias for
30 %s missing
31 %s unknown base
32 %s: ':' expected for '?' operator
33 %s: Ambiguous
34 %s: Arguments must be %job or process ids
35 %s: alias not found\n
36 %s: arithmetic syntax error
37 %s: assignment requires lvalue
38 %s: bad file unit number
39 %s: bad format
40 %s: bad number
41 %s: bad option(s)
42 %s: bad substitution
43 %s: bad trap
44 %s: cannot create
45 %s: cannot execute
46 %s: cannot open
47 %s: divide by zero
48 %s: domain exception
49 %s: fails %s
50 %s: file already exists
51 %s: illegal function name
52 %s: invalid alias name
53 %s: invalid discipline function
54 %s: invalid export name
55 %s: invalid function name
56 %s: invalid name
57 %s: invalid regular expression
58 %s: invalid self reference
59 %s: invalid use of :
60 %s: invalid variable name
61 %s: is not an identifier
62 %s: is read only
63 %s: label not implemented
64 %s: limit exceeded
65 %s: more tokens expected
66 %s: no parent
67 %s: no reference name
68 %s: not found
69 %s: not implemented
70 %s: operands have incompatible types
71 %s: overflow exception
72 %s: parameter not set
73 %s: parameter null or not set
74 %s: recursion too deep
75 %s: reference variable cannot be an array
76 %s: requires pathname argument
77 %s: restricted
78 %s: singularity exception
79 %s: subscript out of range
80 %s: unbalanced parenthesis
81 %s: unknown function
82 %s: unknown locale
83 %s: unknown operator
84 %s: unknown signal name
85 %s: would cause loop
86 (coredump)
87 -c requires argument
88 -e - requires single argument
89 /vpix
90 <command unknown>
91 AC:E#?F#?H:[name]L#?R#?Z#?fi#?[base]lnprtux [name=[value]...]
92 AE#?F#?HL#?R#?Z#?fi#?[base]lnprtux [name=[value]...]
93 Abort
94 Ad:[delim]prst#[timeout]u#[filenum] [name...]
95 Alarm call
96 Bad root node specification
97 Bad system call
98 Broken Pipe
99 Bus error
100 Cannot start job control
101 Current option settings
102 DIL signal
103 Death of Child
104 DircabefhkmnpstuvxCR:[file]o:?[option] [arg...]
105 DircabefhkmnpstuvxCo:?[option] [arg...]
106 EMT trap
107 Exceeded CPU time limit
108 Exceeded file size limit
109 Floating exception
110 HSacdfmnstv [limit]
111 Hangup
112 IO signal
113 Illegal instruction
114 Interrupt
115 Killed
116 LP [dir] [change]
117 Memory fault
118 Migrate process
119 No job control
120 Phone interrupt
121 Polling alarm
122 Power fail
123 Profiling time alarm
124 Quit
125 Resources lost
126 Reverting to old tty driver...
127 S [mask]
128 SIGAPOLLO
129 Security label changed
130 Socket interrupt
131 Sound completed
132 Stopped (signal)
133 Stopped (tty input)
134 Stopped process continued
135 Stopped
136 Stopped(tty output)
137 Switching to new tty driver...
138 System crash soon
139 Terminated
140 Trace/BPT trap
141 Unrecognized version
142 Use 'exit' to terminate this shell
143 User signal 1
144 User signal 2
145 Version not defined
146 Virtual time alarm
147 Window size change
148 You have running jobs
149 You have stopped jobs
150 [_[:alpha:]]*([_[:alnum:]])
151 \n@(#)Version 12/28/93\0\n
152 \n@(#)Version M-12/28/93\0\n
153 \nreal
154 \r\n\007shell will timeout in 60 seconds due to inactivity
155 a name...
156 a:[name]c [command [args...] ]
157 afpv name...
158 alarm %s %.3f\n
159 alarm -r %s +%.3g\n
160 argument expected
161 bad directory
162 bad file unit number
163 bad substitution
164 cannot access parent directories
165 cannot create pipe
166 cannot create tempory file
167 cannot fork
168 cannot get %s
169 cannot set %s
170 cannot set alarm
171 condition(s) required
172 dsf:[library] [name...]
173 e:[editor]lnrsN# [first] [last]
174 end of file
175 f:[format]enprsu:[filenum] [arg...]
176 fnv name...
177 hist -e \"${VISUAL:-${EDITOR:-vi}}\"
178 history file cannot open
179 incorrect syntax
180 invalid argument of type %c
181 is a shell builtin version of
182 is a tracked alias for
183 kill
184 line %d: $ not preceeded by \\
185 line %d: %c within ${} should be quoted
186 line %d: %s unknown label
187 line %d: %s within [[...]] obsolete, use ((...))
188 line %d: '=' obsolete, use '=='
189 line %d: -a obsolete, use -e
190 line %d: \\ in front of %c reserved for future use
191 line %d: `...` obsolete, use $(...)
192 line %d: escape %c to avoid ambiguities
193 line %d: label %s ignored
194 line %d: quote %c to avoid ambiguities
195 line %d: set %s obsolete
196 line %d: spaces required for nested subshell
197 line %d: use braces to avoid ambiguities with $id[...]
198 line %d: use space or tab to separate operators %c and %c
199 ln#[signum]s:[signame] sig...
200 login setuid/setgid shells prohibited
201 mapping
202 newline
203 nlp [job...]
204 no history file
205 no query process
206 no such job
207 no such process
208 not supported
209 off
210 on
211 open file limit exceeded
212 out of memory
213 p [action condition...]
214 p [name[=value]...]
215 parameter not set
216 permission denied
217 process already exists
218 ptx [name=[value]...]
219 pvV name [arg]...
220 r [varname seconds]
221 syntax error at line %d: `%s' %s
222 syntax error at line %d: duplicate label %s
223 syntax error: `%s' %s
224 sys
225 timed out waiting for input
226 unexpected
227 universe not accessible
228 unlimited
229 unmatched
230 user
231 versions
232 write to %d failed
233 you have mail in $_
234 zero byte

View File

@@ -0,0 +1,143 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: CallDataTest4.src /main/3 1996/04/23 20:17:51 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how the CB_WIDGET and CB_CALL_DATA
XCOMM convenience environment variables can be referenced within a callback
XCOMM function.
XCOMM
XCOMM PushButton Callback: Forces the scale to reset to the origin
ResetScale()
{
XmScaleSetValue $SCALE 0
}
XCOMM PushButton Callback: Forces the scale to its minimum value
SetScaleMin()
{
XmScaleSetValue $SCALE -200
}
XCOMM PushButton Callback: Forces the scale to its maximum value
SetScaleMax()
{
XmScaleSetValue $SCALE 200
echo "CB Widget = "$CB_WIDGET
echo "CallData = "$CB_CALL_DATA
echo "CallData.Reason = "${CB_CALL_DATA.REASON}
echo "CallData.Event = "${CB_CALL_DATA.EVENT}
echo "CallData.Event.Type = "${CB_CALL_DATA.EVENT.TYPE}
echo "CallData.Event.Xbutton.Type = "${CB_CALL_DATA.EVENT.XBUTTON.TYPE}
echo "CallData.Event.Xbutton.Serial = "${CB_CALL_DATA.EVENT.XBUTTON.SERIAL}
echo "CallData.Event.Xbutton.Send_Event = "${CB_CALL_DATA.EVENT.XBUTTON.SEND_EVENT}
echo "CallData.Event.Xbutton.Display = "${CB_CALL_DATA.EVENT.XBUTTON.DISPLAY}
echo "CallData.Event.Xbutton.Window = "${CB_CALL_DATA.EVENT.XBUTTON.WINDOW}
echo "CallData.Event.Xbutton.Root = "${CB_CALL_DATA.EVENT.XBUTTON.ROOT}
echo "CallData.Event.Xbutton.Subwindow = "${CB_CALL_DATA.EVENT.XBUTTON.SUBWINDOW}
echo "CallData.Event.Xbutton.Time = "${CB_CALL_DATA.EVENT.XBUTTON.TIME}
echo "CallData.Event.Xbutton.X = "${CB_CALL_DATA.EVENT.XBUTTON.X}
echo "CallData.Event.Xbutton.Y = "${CB_CALL_DATA.EVENT.XBUTTON.Y}
echo "CallData.Event.Xbutton.X_root = "${CB_CALL_DATA.EVENT.XBUTTON.X_ROOT}
echo "CallData.Event.Xbutton.Y_root = "${CB_CALL_DATA.EVENT.XBUTTON.Y_ROOT}
echo "CallData.Event.Xbutton.State = "${CB_CALL_DATA.EVENT.XBUTTON.STATE}
echo "CallData.Event.Xbutton.Button = "${CB_CALL_DATA.EVENT.XBUTTON.BUTTON}
echo "CallData.Event.Xbutton.Same_Screen = "${CB_CALL_DATA.EVENT.XBUTTON.SAME_SCREEN}
echo
}
XCOMM Scale Callback: Invoked when the user interactively modified the scale value
ScaleValueChanged()
{
XmScaleGetValue $CB_WIDGET VALUE
echo "New Scale Value = "$VALUE
echo "CB Widget = "$CB_WIDGET
echo "CallData = "$CB_CALL_DATA
echo "CallData.Value = "${CB_CALL_DATA.VALUE}
echo "CallData.Event = "${CB_CALL_DATA.EVENT}
echo "CallData.Event.Xany.Type = "${CB_CALL_DATA.EVENT.XANY.TYPE}
echo "CallData.Event.Type = "${CB_CALL_DATA.EVENT.TYPE}
echo "CallData.Reason = "${CB_CALL_DATA.REASON}
echo
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL command1 Command1 "$0" "$@"
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
XtCreateManagedWidget SCALE scale XmScale $FORM \
showValue:True \
orientation:HORIZONTAL \
maximum:200 \
minimum:-200 \
topAttachment:ATTACH_FORM \
topOffset:10 \
leftAttachment:ATTACH_FORM \
leftOffset:10 \
rightAttachment:ATTACH_FORM \
rightOffset:10
XtAddCallback $SCALE valueChangedCallback ScaleValueChanged
XtCreateManagedWidget SEP sep XmSeparator $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$SCALE \
topOffset:10 \
leftAttachment:ATTACH_FORM \
rightAttachment:ATTACH_FORM
XtCreateManagedWidget PB pb XmPushButton $FORM \
labelString:"Reset Scale" \
topAttachment:ATTACH_WIDGET \
topOffset:10 \
topWidget:$SEP \
bottomAttachment:ATTACH_FORM \
bottomOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:30
XtAddCallback $PB activateCallback ResetScale
XtCreateManagedWidget PB2 pb XmPushButton $FORM \
labelString:"Set Scale Max" \
topAttachment:ATTACH_WIDGET \
topOffset:10 \
topWidget:$SEP \
bottomAttachment:ATTACH_FORM \
bottomOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:40 \
rightAttachment:ATTACH_POSITION \
rightPosition:60
XtAddCallback $PB2 activateCallback SetScaleMax
XtCreateManagedWidget PB3 pb XmPushButton $FORM \
labelString:"Set Scale Min" \
topAttachment:ATTACH_WIDGET \
topOffset:10 \
topWidget:$SEP \
bottomAttachment:ATTACH_FORM \
bottomOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:70 \
rightAttachment:ATTACH_POSITION \
rightPosition:90
XtAddCallback $PB3 activateCallback SetScaleMin
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,89 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: CallbackTest2.src /main/3 1996/04/23 20:17:57 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how widget callbacks can be
XCOMM added and removed. It adds callbacks both using XtAddCallback and
XCOMM by specifying a callback as a resource, when the test pushbutton
XCOMM is created.
XCOMM
XCOMM The activate callback which can be dynamically added and removed
ActivateCallback1()
{
echo "activateCallback1 invoked"
}
XCOMM The activate callback which is added when the widget was created
ActivateCallback2()
{
echo "activateCallback2 invoked"
}
XCOMM Pushbutton Callback: Adds an activate callback to the test pushbutton
AddCallback1()
{
XtAddCallback $TESTPB activateCallback ActivateCallback1
XtGetValues $TESTPB activateCallback:AC
echo "Callback list = "$AC
}
XCOMM Pushbutton Callback: Removes an activate callback from the test pushbutton
DeleteCallback1()
{
XtRemoveCallback $TESTPB activateCallback ActivateCallback1
XtGetValues $TESTPB activateCallback:AC2
echo "Callback list = "$AC2
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL callbackTest CallbackTest "$0" "$@"
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
XtCreateManagedWidget PB1 pb XmPushButton $FORM \
labelString:"Add Callback1" \
topAttachment:ATTACH_FORM \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:40 \
activateCallback:AddCallback1
XtCreateManagedWidget PB2 pb2 XmPushButton $FORM \
labelString:"Delete Callback1" \
topAttachment:ATTACH_FORM \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:60 \
rightAttachment:ATTACH_POSITION \
rightPosition:90 \
activateCallback:DeleteCallback1
XtCreateManagedWidget TESTPB testpb XmPushButton $FORM \
labelString:"Test Button" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB2 \
topOffset:20 \
leftAttachment:ATTACH_POSITION \
leftPosition:20 \
rightAttachment:ATTACH_POSITION \
rightPosition:80 \
bottomAttachment:ATTACH_FORM \
bottomOffset:10 \
activateCallback:ActivateCallback2
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,59 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: DtCursorTest2.src /main/3 1996/04/23 20:18:02 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how a cursor can be defined or
XCOMM undefined for an X window.
XCOMM
XCOMM Pushbutton Callback: set the busy cursor for the toplevel window
DefineCursor()
{
XDefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) $CURSOR
}
XCOMM Pushbutton Callback: remove the busy cursor from the toplevel window
UndefineCursor()
{
XUndefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL dtCursorTest2 DtCursorTest2 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
XtSetValues $DA height:200 width:200
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 dtCursorTest2a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Define Cursor"
XtAddCallback $PB1 activateCallback "DefineCursor"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Undefine Cursor"
XtAddCallback $PB2 activateCallback "UndefineCursor"
_DtGetHourGlassCursor CURSOR $(XtDisplay "-" $TOPLEVEL)
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,155 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: DtWsTest1.src /main/3 1996/04/23 20:18:06 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how to interact with the workspace
XCOMM manager. It demonstrates the following capabilities:
XCOMM
XCOMM 1) How to query which workspaces the widgets currently reside it.
XCOMM 2) How to set the current workspace.
XCOMM 3) How to be notified when the current workspace changes.
XCOMM
integer wsCount
XCOMM Pushbutton Callback: This function asks the workspace manager to change
XCOMM to the workspace indicated by $1; $1 is an X atom
XCOMM which identifies the new workspace. At some point
XCOMM after our request to the workspace manager, the
XCOMM workspace manager will activate our WsCB function,
XCOMM letting us know that the change has actually taken
XCOMM place.
SetWorkspace()
{
echo
if DtWsmSetCurrentWorkspace $TOPLEVEL $1; then
echo "Changing to new workspace"
else
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $1
echo "Unable to Change to workspace " $NAME
fi
}
XCOMM Workspace Changed Callback: This function is invoked whenever the workspace
XCOMM manager changes workspaces. It will simply
XCOMM query the 'name' of the new workspace, and
XCOMM echo it outl
WsCB()
{
DtWsmGetCurrentWorkspace $(XtDisplay "-" $TOPLEVEL) \
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
NEW_ATOM
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $NEW_ATOM
echo "Change to workspace complete " $NAME "("$NEW_ATOM")"
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL dtWsTest DtWsTest "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
XtSetValues $DA height:200 width:200
XtRealizeWidget $TOPLEVEL
XSync $(XtDisplay "-" $TOPLEVEL) False
XtCreateApplicationShell TOPLEVEL2 DtWsTesta TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
packing:PACK_COLUMN
XCOMM Get a list of all of the workspaces, and create a pushbutton for each one.
XCOMM When a pushbutton is activated, it will ask the workspace manager to
XCOMM change to the indicated workspace.
oldIF=$IFS
if DtWsmGetWorkspaceList $(XtDisplay "-" $TOPLEVEL) \
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
WS_LIST;
then
IFS=,
wsCount=0
for item in $WS_LIST;
do
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
label="Set Current Workspace to "$NAME
XtCreateManagedWidget ITEM $item XmPushButton $RC \
labelString:$label
XtAddCallback $ITEM activateCallback "SetWorkspace $item"
wsCount=$wsCount+1
done
IFS=$oldIFS
else
echo "Unable to get workspace list"
exit -1
fi
XtSetValues $RC numColumns:$wsCount
XtRealizeWidget $TOPLEVEL2
XSync $(XtDisplay "-" $TOPLEVEL) False
XCOMM The following block queries the initial set of workspaces occupied by
XCOMM this shell script; this list is printed out. Next, it will ask the
XCOMM workspace manager to move the shell script windows into all workspaces.
XCOMM Lastly, it will again ask the workspace manager for the list of
XCOMM workspaces occupied by the shell script windows, and will again print
XCOMM out the list.
if DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
$(XtWindow "-" $TOPLEVEL) \
CURRENT_WS_LIST ;
then
echo "Initial workspaces occupied:"
for item in $CURRENT_WS_LIST;
do
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
echo " "$NAME
done
DtWsmGetWorkspaceList $(XtDisplay "-" $TOPLEVEL) \
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
WS_LIST
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
$(XtWindow "-" $TOPLEVEL) \
$WS_LIST
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL2) \
$(XtWindow "-" $TOPLEVEL2) \
$WS_LIST
else
echo "Unable to get current list of occupied workspaces"
echo -2
fi
XSync $(XtDisplay "-" $TOPLEVEL) False
XCOMM Print the new list of workspaces occupied
DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
$(XtWindow "-" $TOPLEVEL) \
CURRENT_WS_LIST
echo "After modification, workspaces occupied:"
IFS=,
for item in $CURRENT_WS_LIST;
do
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
echo " "$NAME
done
IFS=$oldIFS
echo ""
XCOMM Add a callback to be notified whenever the workspace changes.
DtWsmAddCurrentWorkspaceCallback HANDLE1 $TOPLEVEL WsCB
XtMainLoop

View File

@@ -0,0 +1,215 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: EventHandlerTest.src /main/3 1996/04/23 20:18:10 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how event handlers can be added
XCOMM and removed. It also demonstrates how the EH_WIDGET and EH_EVENT
XCOMM convenience environment variables can be referenced.
XCOMM
EventHandler1()
{
echo "EH_WIDGET ="$EH_WIDGET
echo "EH_EVENT ="$EH_EVENT
echo "EH_EVENT.TYPE ="${EH_EVENT.TYPE}
echo "event handler 1 invoked ("$1")"
}
EventHandler2()
{
echo "EH_WIDGET ="$EH_WIDGET
echo "EH_EVENT ="$EH_EVENT
echo "EH_EVENT.TYPE ="${EH_EVENT.TYPE}
echo "event handler 1 invoked ("$1")"
}
XCOMM PushbuttonCallback: Adds an event handler to the form widget
AddMaskableEventHandler1()
{
XtAddEventHandler $FORM2 "Button2MotionMask" False \
"EventHandler1 1"
}
XCOMM PushbuttonCallback: Adds an event handler to the form widget
AddMaskableEventHandler2()
{
XtAddEventHandler $FORM2 "ButtonPressMask|ButtonReleaseMask" False \
"EventHandler1 1"
}
XCOMM PushbuttonCallback: Adds an event handler to the form widget
AddMaskableEventHandler3()
{
XtAddEventHandler $FORM2 "Button2MotionMask" False \
"EventHandler1 2"
}
XCOMM PushbuttonCallback: Adds an event handler to the form widget
AddNonmaskableEventHandler()
{
XtAddEventHandler $FORM2 "NoEventMask" True "EventHandler2 1"
}
XCOMM PushbuttonCallback: Adds an event handler to the form widget.
XCOMM Should report a bad event mask.
AddBadEventHandler()
{
XtAddEventHandler $FORM2 "fooMask" False "EventHandler2 1"
}
XCOMM PushbuttonCallback: Removes an event handler to the form widget
RemoveEventHandler1()
{
XtRemoveEventHandler $FORM2 "Button2MotionMask" False \
"EventHandler1 1"
}
XCOMM PushbuttonCallback: Removes an event handler to the form widget
RemoveEventHandler2()
{
XtRemoveEventHandler $FORM2 "ButtonPressMask|ButtonReleaseMask" False \
"EventHandler1 1"
}
XCOMM PushbuttonCallback: Removes an event handler to the form widget
RemoveEventHandler1and2()
{
XtRemoveEventHandler $FORM2 "XtAllEvents" True "EventHandler1 1"
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL eventHandlerTest EventHandlerTest "$0" "$@"
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
XtCreateManagedWidget FORM2 form2 XmForm $FORM \
topAttachment:ATTACH_FORM \
leftAttachment:ATTACH_FORM \
rightAttachment:ATTACH_FORM
XtSetValues $FORM2 height:150 width:150
XtCreateManagedWidget SEP sep XmSeparator $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$FORM2 \
leftAttachment:ATTACH_FORM \
rightAttachment:ATTACH_FORM
XtCreateManagedWidget PB1 pb XmPushButton $FORM \
labelString:"Add Maskable Event Handler 1" \
topAttachment:ATTACH_WIDGET \
topWidget:$SEP \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:40
XtAddCallback $PB1 activateCallback AddMaskableEventHandler1
XtCreateManagedWidget PB2 pb2 XmPushButton $FORM \
labelString:"Add Maskable Event Handler 2" \
topAttachment:ATTACH_WIDGET \
topWidget:$SEP \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:60 \
rightAttachment:ATTACH_POSITION \
rightPosition:90
XtAddCallback $PB2 activateCallback AddMaskableEventHandler2
XtCreateManagedWidget PB3 pb3 XmPushButton $FORM \
labelString:"Add Maskable Event Handler 3" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB2 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:40
XtAddCallback $PB3 activateCallback AddMaskableEventHandler3
XtCreateManagedWidget PB4 pb4 XmPushButton $FORM \
labelString:"Add Maskable Event Handler 4" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB2 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:60 \
rightAttachment:ATTACH_POSITION \
rightPosition:90
XtAddCallback $PB4 activateCallback AddMaskableEventHandler4
XtSetSensitive $PB4 False
XtCreateManagedWidget PB5 pb5 XmPushButton $FORM \
labelString:"Add non-maskable Event Handler" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB4 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:40
XtAddCallback $PB5 activateCallback AddNonmaskableEventHandler
XtCreateManagedWidget PB6 pb6 XmPushButton $FORM \
labelString:"Add Bad Event Handler" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB4 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:60 \
rightAttachment:ATTACH_POSITION \
rightPosition:90
XtAddCallback $PB6 activateCallback AddBadEventHandler
XtCreateManagedWidget PB7 pb7 XmPushButton $FORM \
labelString:"Remove Maskable Event Handler 1" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB6 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:40
XtAddCallback $PB7 activateCallback RemoveEventHandler1
XtCreateManagedWidget PB8 pb8 XmPushButton $FORM \
labelString:"Remove Maskable Event Handler 2" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB6 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:60 \
rightAttachment:ATTACH_POSITION \
rightPosition:90
XtAddCallback $PB8 activateCallback RemoveEventHandler2
XtCreateManagedWidget PB9 pb9 XmPushButton $FORM \
labelString:"Remove Maskable Event Handler 1 and 2" \
topAttachment:ATTACH_WIDGET \
topWidget:$PB8 \
topOffset:10 \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:40 \
bottomAttachment:ATTACH_FORM \
bottomOffset:10
XtAddCallback $PB9 activateCallback RemoveEventHandler1and2
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,31 @@
XCOMM $XConsortium: Imakefile /main/4 1996/04/21 19:30:42 drk $
DESKTOP_VERSION_STRING = DesktopVersionString
MODULE=dtksh/examples
LOCAL_CPP_DEFINES = -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP)
CppSourceFile(CallDataTest4,CallDataTest4.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(CallbackTest2,CallbackTest2.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(DtCursorTest2,DtCursorTest2.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(DtWsTest1,DtWsTest1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(EventHandlerTest,EventHandlerTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(ListBounds1,ListBounds1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(ListItemPos1,ListItemPos1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(ListPosSel1,ListPosSel1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(PipeTest,PipeTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(PopupTest,PopupTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(SelBoxResTest,SelBoxResTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(SessionTest,SessionTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(TextCutBuf1,TextCutBuf1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(TextDisp1,TextDisp1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(TextFXYPos1,TextFXYPos1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(TransEventTest,TransEventTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(TransTest1,TransTest1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(WorkProcTest1,WorkProcTest1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(XCursorTest1,XCursorTest1.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(XdrawTest,XdrawTest.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(crMovesText1,crMovesText1.src,$(LOCAL_CPP_DEFINES),)
all::

View File

@@ -0,0 +1,71 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: ListBounds1.src /main/3 1996/04/23 20:18:16 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how to create a list widget, and
XCOMM also how to query the bounds for each of the list items.
XCOMM
integer i
XCOMM Pushbutton Callback: Query the bound for each list item
GetBounds()
{
i=1
echo
while XmListPosToBounds $LIST $i X Y W H; do
echo "Bounds of item "$i" is ("$X $Y $W $H")"
i=i+1
done
}
XCOMM Pushbutton Callback: Delete the first list item
DelFirst()
{
XmListDeletePos $LIST 1
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL listKbd1 ListKbd1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XmCreateScrolledList LIST $TOPLEVEL list \
itemCount:11 \
items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
visibleItemCount:15 \
listSizePolicy:VARIABLE
XtSetValues $LIST \
selectedItemCount:3 \
selectedItems:"item2,item4,item6"
XtManageChild $LIST
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 listKbd1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Get Item Bounds"
XtAddCallback $PB1 activateCallback "GetBounds"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Delete First Item"
XtAddCallback $PB2 activateCallback "DelFirst"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,71 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: ListItemPos1.src /main/3 1996/04/23 20:18:21 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how to create a list widget, and
XCOMM verifies that the XmListItemPos command operates correctly. The list
XCOMM contains multiple items with the label "item4"; XmListItemPos will
XCOMM return the position of the first occurrence. By selecting the push
XCOMM button labeled "Delete First Item", you can delete the first item
XCOMM labeled "item4"; the next call to XmListItemPos should now return
XCOMM the position of the next item labeled "item4".
XCOMM
XCOMM Pushbutton Callback: prints the position occupied by the first occurrence
XCOMM of the "item4" label.
GetItemPosition()
{
XmListItemPos POS $LIST "item4"
echo "First position for item4 is: "$POS
}
XCOMM Pushbutton Callback: deletes the first item in the list.
DelFirstItem()
{
XmListDeletePos $LIST 1
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL listItemPos1 ListItemPos1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XmCreateScrolledList LIST $TOPLEVEL list \
itemCount:11 \
items:"item4,item2,item4,item3,item5,item6,item7,item8,item9,item4,item11" \
visibleItemCount:15 \
listSizePolicy:VARIABLE
XtSetValues $LIST \
selectedItemCount:3 \
selectedItems:"item2,item4,item6"
XtManageChild $LIST
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 ListItemPos1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Get Position Of item4"
XtAddCallback $PB1 activateCallback "GetItemPosition"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Delete First Item"
XtAddCallback $PB2 activateCallback "DelFirstItem"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,66 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: ListPosSel1.src /main/3 1996/04/23 20:18:25 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how to create a list widget, and
XCOMM also verifies that the XmListPosSelected command works; this command
XCOMM returns information about whether an indicated list item is selected.
XCOMM
integer i
XCOMM Pushbutton Callback: print the selection state of each list item.
GetSelectionStatus()
{
i=1
echo
while (($i <= 11 )); do
if XmListPosSelected $LIST $i; then
echo "Item "$i" is selected"
else
echo "Item "$i" is not selected"
fi
i=i+1
done
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL listPosSel1 ListPosSel1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XmCreateScrolledList LIST $TOPLEVEL list \
itemCount:11 \
items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
visibleItemCount:15 \
listSizePolicy:VARIABLE
XtSetValues $LIST \
selectedItemCount:3 \
selectedItems:"item2,item4,item6"
XtManageChild $LIST
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 ListPosSel1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Get Item Selection Status"
XtAddCallback $PB1 activateCallback "GetSelectionStatus"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,43 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: PipeTest.src /main/3 1996/04/23 20:18:30 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates some of the more advanced features
XCOMM of dtksh. It shows how a structure can be defined and accessed, and
XCOMM how a C library function can be called.
XCOMM
XCOMM Define a structure made up of 2 integer fields: pipe_in and pipe_out
struct pipe_fds pipe_in:int pipe_out:int
typedef 'struct pipe_fds *' pipe_fds_ptr
echo "Test 1"
XCOMM Malloc space for the structure, and initialize the fields
call -F nop '@pipe_fds_ptr:{0,0}'
PIPE_FDS=$RET
XCOMM Call the pipe(2) kernel intrinsic
call pipe $PIPE_FDS
RESULT=$RET
XCOMM Print the values of the fields in the structure
call strprint pipe_fds_ptr $PIPE_FDS
echo RESULT = $RESULT
echo
XCOMM Repeat the test, to make sure we get different file descriptors
echo "Test 2"
call -F nop '@pipe_fds_ptr:{0,0}'
PIPE_FDS=$RET
call pipe $PIPE_FDS
RESULT=$RET
call strprint pipe_fds_ptr $PIPE_FDS
echo RESULT = $RESULT
echo

View File

@@ -0,0 +1,57 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: PopupTest.src /main/3 1996/04/23 20:18:36 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates the steps necessary to create and
XCOMM manage a popup menu.
XCOMM
XCOMM This event handler positions the menu at the point where the button event
XCOMM occurred, and then posts the popup menu.
EventHandler()
{
XmMenuPosition $POPUP $EH_EVENT
XtManageChild $POPUP
}
XCOMM Menu button callback
MenuActivated()
{
echo "Menu Activated: "$1
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL popupTest PopupTest "$0" "$@"
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
XtSetValues $FORM height:300 width:300
XtAddEventHandler $FORM "ButtonPressMask" False EventHandler
XmCreatePopupMenu POPUP $FORM "popup"
XmCreatePushButton PB1 $POPUP "pb1" \
labelString:"Menu Item 1"
XtManageChild $PB1
XtAddCallback $PB1 activateCallback "MenuActivated MenuItem1"
XmCreatePushButton PB2 $POPUP "pb2" \
labelString:"Menu Item 2"
XtManageChild $PB2
XtAddCallback $PB2 activateCallback "MenuActivated MenuItem2"
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,63 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: SelBoxResTest.src /main/3 1996/04/23 20:18:42 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script verifies that the selection box properly
XCOMM interprets the 'childPlacement' resource. Using a timer, it will
XCOMM set the resource to a particular value, verify it is correct, and
XCOMM then repeat for the next setting.
XCOMM
Timeout3()
{
XtGetValues $SB childPlacement:CP
echo ChildPlacement
echo " Expected = PLACE_TOP"
echo " Actual = " $CP
}
Timeout2()
{
XtGetValues $SB childPlacement:CP
echo ChildPlacement
echo " Expected = PLACE_BELOW_SELECTION"
echo " Actual = " $CP
XtSetValues $SB childPlacement:PLACE_TOP
XtAddTimeOut ID 5000 "Timeout3"
}
Timeout1()
{
XtGetValues $SB childPlacement:CP
echo ChildPlacement
echo " Expected = PLACE_ABOVE_SELECTION"
echo " Actual = " $CP
XtSetValues $SB childPlacement:PLACE_BELOW_SELECTION
XtAddTimeOut ID 5000 "Timeout2"
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL selectionBoxTest SelectionBoxTest "$0" "$@"
XtCreateManagedWidget SB sb XmSelectionBox $TOPLEVEL \
childPlacement:PLACE_ABOVE_SELECTION
XtCreateManagedWidget SCALE scale XmScale $SB \
orientation:HORIZONTAL
XtRealizeWidget $TOPLEVEL
XtAddTimeOut ID 5000 "Timeout1"
XtMainLoop

View File

@@ -0,0 +1,137 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: SessionTest.src /main/6 1996/04/23 20:18:46 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates the steps necessary for tying into
XCOMM session management. To run, simply run this script, and then save the
XCOMM current session. When the session is restored, this script should again
XCOMM restore to its previous state.
XCOMM
XCOMM This function is invoked when the user attempts to save the current session.
XCOMM It will save off its state information (whether it is iconified, and the
XCOMM list of workspaces it occupies) into a session file, and then tell the
XCOMM session manager how to reinvoke it when the session is restored.
SessionCallback()
{
XCOMM Get the name of our session file
if DtSessionSavePath $TOPLEVEL PATH SAVEFILE; then
exec 9>$PATH
XCOMM Save our iconification state
if DtShellIsIconified $TOPLEVEL ; then
print -u9 'Iconified'
else
print -u9 'Deiconified'
fi
XCOMM Save the list of workspace we occupy
if DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
$(XtWindow "-" $TOPLEVEL) \
CURRENT_WS_LIST ;
then
oldIFS=$IFS
IFS=","
for item in $CURRENT_WS_LIST;
do
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
print -u9 $NAME
done
IFS=$oldIFS
fi
exec 9<&-
XCOMM Tell the session manager how to restart us
DtSetStartupCommand $TOPLEVEL \
"/usr/dt/share/examples/dtksh/SessionTest $SAVEFILE"
else
echo "DtSessionSavePath FAILED!!"
exit -3
fi
}
XCOMM This function is invoked when we are restarted at session restore time.
XCOMM It is passed the name of the session file as $1. It will extract our
XCOMM session information from the session file, and will restore our state
XCOMM accordingly.
RestoreSession()
{
XCOMM Get the full path of our session file
if DtSessionRestorePath $TOPLEVEL PATH $1; then
exec 9<$PATH
read -u9 ICONIFY
XCOMM Restore our iconification state
case $ICONIFY in
Iconified) DtSetIconifyHint $TOPLEVEL True;;
*) DtSetIconifyHint $TOPLEVEL False;;
esac
XCOMM Place us into the indicated set of workspaces
WS_LIST=""
while read -u9 NAME
do
XmInternAtom ATOM $(XtDisplay "-" $TOPLEVEL) $NAME False
if [ ${#WS_LIST} -gt 0 ]; then
WS_LIST=$WS_LIST,$ATOM
else
WS_LIST=$ATOM
fi
done
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
$(XtWindow "-" $TOPLEVEL) \
$WS_LIST
exec 9<&-
else
echo "DtSessionRestorePath FAILED!!"
exit -3
fi
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL wmProtTest WmProtTest "$0" "$@"
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
XtSetValues $DA height:200 width:200
XmInternAtom SAVE_SESSION_ATOM $(XtDisplay "-" $TOPLEVEL) "WM_SAVE_YOURSELF" False
XCOMM If we are invoked with any command line parameters, then we will assume
XCOMM that it is the name of our session file, and will restore to the indicated
XCOMM state.
if (( $# > 0))
then
XtSetValues $TOPLEVEL mappedWhenManaged:False
XtRealizeWidget $TOPLEVEL
XSync $(XtDisplay "-" $TOPLEVEL) False
RestoreSession $1
XtSetValues $TOPLEVEL mappedWhenManaged:True
XtPopup $TOPLEVEL GrabNone
else
XtRealizeWidget $TOPLEVEL
XSync $(XtDisplay "-" $TOPLEVEL) False
fi
XCOMM Register our interest in participating in session management.
XmAddWMProtocols $TOPLEVEL $SAVE_SESSION_ATOM
XmAddWMProtocolCallback $TOPLEVEL $SAVE_SESSION_ATOM SessionCallback
XtMainLoop

View File

@@ -0,0 +1,114 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: TextCutBuf1.src /main/3 1996/04/23 20:18:52 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how the Text cut, copy and paste
XCOMM facilities work.
XCOMM
XCOMM Pushbutton Callback: cut the currently select text
Cut()
{
if XmTextCut $TEXT $(XtLastTimestampProcessed "-" $(XtDisplay "-" $TEXT));
then
echo "Cut occurred"
else
echo "No primary selection"
fi
}
XCOMM Pushbutton Callback: copy the currently select text
Copy()
{
if XmTextCopy $TEXT $(XtLastTimestampProcessed "-" $(XtDisplay "-" $TEXT));
then
echo "Copy occurred"
else
echo "No primary selection"
fi
}
XCOMM Pushbutton Callback: clear the text selection
ClearSelection()
{
XmTextClearSelection $TEXT $(XtLastTimestampProcessed "-" $(XtDisplay "-" $TEXT))
}
XCOMM Pushbutton Callback: paste the cut buffer at the current insertion position
Paste()
{
if XmTextPaste $TEXT; then
echo "Paste occurred"
else
echo "No primary selection"
fi
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL textCutBuf1 TextCutBuf1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XtCreateManagedWidget FORM form XmForm $TOPLEVEL \
XtCreateManagedWidget TEXT text XmText $FORM \
topAttachment:ATTACH_FORM \
topOffset:10 \
leftAttachment:ATTACH_FORM \
leftOffset:10 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
columns:40 \
value:"This is the default string"
XtCreateManagedWidget TEXT2 text2 XmText $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$TEXT \
topOffset:10 \
leftAttachment:ATTACH_FORM \
leftOffset:10 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
bottomAttachment:ATTACH_FORM \
bottomOffset:10 \
columns:40 \
editable:False
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 textCutBuf1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Cut Selection"
XtAddCallback $PB1 activateCallback "Cut"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Copy Selection"
XtAddCallback $PB2 activateCallback "Copy"
XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
labelString:"Paste"
XtAddCallback $PB3 activateCallback "Paste"
XtCreateManagedWidget PB4 pb4 XmPushButton $RC \
labelString:"Clear Selection"
XtAddCallback $PB4 activateCallback "ClearSelection"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,100 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: TextDisp1.src /main/3 1996/04/23 20:18:56 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script exercises the commands which enable and disable
XCOMM updating in a text widget. If the update is disabled, and the value of
XCOMM the text field is then changed, the text field will not update what is
XCOMM shown, until update is again enabled.
XCOMM
XCOMM Pushbutton Callback: enable update in the text widget
EnableUpdate()
{
XmTextEnableRedisplay $TEXT
}
XCOMM Pushbutton Callback: disable update in the text widget
DisableUpdate()
{
XmTextDisableRedisplay $TEXT
}
XCOMM Pushbutton Callback: changes the text value
ChangeValue1()
{
XmTextSetString $TEXT "line A
line B
line C
line D
line E
line F
line G"
}
XCOMM Pushbutton Callback: changes the text value
ChangeValue2()
{
XmTextSetString $TEXT "line a
line b
line c
line d
line e
line f
line g"
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL textDisp1 TextDisp1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XmCreateScrolledText TEXT $TOPLEVEL text \
columns:20 \
rows:5 \
editMode:MULTI_LINE_EDIT \
value:\
"line 1
line 2
line 3
line 4"
XtManageChild $TEXT
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 textDisp1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Disable Update"
XtAddCallback $PB1 activateCallback "DisableUpdate"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Enable Update"
XtAddCallback $PB2 activateCallback "EnableUpdate"
XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
labelString:"Change Value 1"
XtAddCallback $PB3 activateCallback "ChangeValue1"
XtCreateManagedWidget PB4 pb4 XmPushButton $RC \
labelString:"Change Value 2"
XtAddCallback $PB4 activateCallback "ChangeValue2"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,65 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: TextFXYPos1.src /main/3 1996/04/23 20:19:01 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script verifies that the XmTextFieldPosToXY command
XCOMM functions correctly.
XCOMM
XCOMM Pushbutton Callback: exercise the Text functions
RunTests()
{
XCOMM This position should not be visible
if XmTextFieldPosToXY $TEXT 90 X Y; then
echo "Text position 90 is at point ("$X","$Y")"
else
echo "Text position 90 is not currently visible"
fi
XCOMM This position should be visible
if XmTextFieldPosToXY $TEXT 3 X Y; then
echo "Text position 3 is at point ("$X","$Y")"
else
echo "Text position 3 is not currently visible"
fi
XmTextFieldXYToPos POS $TEXT $X $Y
echo "At point ("$X","$Y") is character position "$POS
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL textFXYPos1 TextFXYPos1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XmCreateTextField TEXT $TOPLEVEL text \
columns:20 \
value:"line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8"
XtManageChild $TEXT
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 textFXYPos1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Run XY Position Tests"
XtAddCallback $PB1 activateCallback "RunTests"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,80 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: TransEventTest.src /main/3 1996/04/23 20:19:07 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script verifies that the augment and override
XCOMM capabilities for translations work as expected. Since augmenting
XCOMM a translation does not replace an existing translation, the first
XCOMM pushbutton should only use our button3 translation. Since overriding
XCOMM a translation replaces an existing translation, the second pushbutton
XCOMM should use both our Enter and button1 translations.
XCOMM
XCOMM It also demonstrates access to the TRANSLATION_EVENT convenience
XCOMM environment variable.
XCOMM
XCOMM EnterNotify handler
Enter()
{
echo EnterNotify
echo "Event = "${TRANSLATION_EVENT}
echo "Event.type = "${TRANSLATION_EVENT.TYPE}
echo "Event.xany.window = "${TRANSLATION_EVENT.XANY.WINDOW}
}
XCOMM ButtonDown handler; $1 indicates which button
BtnDown()
{
echo "ButtonDown ("$1")"
echo "Event = "${TRANSLATION_EVENT}
echo "Event.type = "${TRANSLATION_EVENT.TYPE}
echo "Event.xany.window = "${TRANSLATION_EVENT.XANY.WINDOW}
echo "Event.xbutton.x = "${TRANSLATION_EVENT.XBUTTON.X}
echo "Event.xbutton.y = "${TRANSLATION_EVENT.XBUTTON.Y}
}
XCOMM Default activate callback for the pushbuttons; should only get called
XCOMM for the first pushbutton (augmented one).
Activate()
{
echo "Activate ("$1")"
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL transEventTest TransEventTest "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Augmented Button" \
translations:'#augment
<EnterNotify>:ksh_eval("Enter")
<Btn1Down>:ksh_eval("BtnDown 1")
<Btn3Down>:ksh_eval("BtnDown 3")'
XtAddCallback $PB1 activateCallback "Activate 1"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Overridden Button" \
translations:'#override
<EnterNotify>:ksh_eval("Enter")
<Btn1Down>:ksh_eval("BtnDown 1")'
XtAddCallback $PB2 activateCallback "Activate 2"
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,91 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: TransTest1.src /main/3 1996/04/23 20:19:11 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates the operation of augmented and
XCOMM overridden translations. If the translations are cleared, then both
XCOMM overriding and augmenting the translations will cause all of the new
XCOMM translations to take effect.
XCOMM
Enter()
{
echo "EnterNotify ("$1")"
}
BtnDown()
{
echo "ButtonDown ("$1")"
}
Activate()
{
echo "Activate"
}
Augment()
{
XtAugmentTranslations $PB \
'<EnterNotify>:ksh_eval("Enter augmented")
<Btn1Down>:ksh_eval("BtnDown 1")
<Btn3Down>:ksh_eval("BtnDown 3")'
}
Override()
{
XtOverrideTranslations $PB \
'<EnterNotify>:ksh_eval("Enter overridden")
<Btn1Down>:ksh_eval("BtnDown 1")'
}
Uninstall()
{
XtUninstallTranslations $PB
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL transTest1 TransTest1 "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XmCreateForm FORM $TOPLEVEL form
XtManageChild $FORM
XtCreateManagedWidget PB pb XmPushButton $FORM \
labelString:"Test Button"
XtAddCallback $PB activateCallback "Activate"
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 listAdd1a TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Augment Translations"
XtAddCallback $PB1 activateCallback "Augment"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Override Translations"
XtAddCallback $PB2 activateCallback "Override"
XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
labelString:"Uninstall Translations"
XtAddCallback $PB3 activateCallback "Uninstall"
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,40 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: WorkProcTest1.src /main/3 1996/04/23 20:19:16 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates the usage of an Xt workproc
XCOMM
integer count=5
XCOMM The work proc will be called five time, at which point it will return
XCOMM '1', which will cause it to be automatically unregistered.
function WorkProc1
{
count=$count-1
echo "WorkProc1 ("$count")"
if [ "$count" -eq 0 ]
then
return 1
else
return 0
fi
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL workProcTest1 WorkProcTest1 "$0" "$@"
XtAddWorkProc ID1 "WorkProc1"
XtMainLoop

View File

@@ -0,0 +1,63 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: XCursorTest1.src /main/3 1996/04/23 20:19:21 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates how the 'call' command can be used
XCOMM to obtain an 'X' cursor, and then how that cursor can be set for a
XCOMM widget hierarchy.
XCOMM
XCOMM Pushbutton Callback: set the cursor for the widget hierarchy
DefineCursor()
{
XDefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) $CURSOR
}
XCOMM Pushbutton Callback: unset the cursor for the widget hierarchy
UndefineCursor()
{
XUndefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL xCursorTest XCursorTest "$0" "$@"
XtSetValues $TOPLEVEL allowShellResize:True
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
XtSetValues $DA height:200 width:200
XtRealizeWidget $TOPLEVEL
XtCreateApplicationShell TOPLEVEL2 xCursorTesta TopLevelShell
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
orientation:HORIZONTAL \
numColumns:2 \
packing:PACK_COLUMN
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
labelString:"Define Cursor"
XtAddCallback $PB1 activateCallback "DefineCursor"
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
labelString:"Undefine Cursor"
XtAddCallback $PB2 activateCallback "UndefineCursor"
XCOMM Call the X function for getting a cursor
call XCreateFontCursor $(XtDisplay "-" $TOPLEVEL) 10
CURSOR=$RET
echo "Cursor = "$CURSOR
XtRealizeWidget $TOPLEVEL2
XtMainLoop

View File

@@ -0,0 +1,116 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: XdrawTest.src /main/3 1996/04/23 20:19:28 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This sample shell script demonstrates the calling sequence for most of
XCOMM the X drawing commands.
XCOMM
ExposeCallback()
{
XDrawRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
10 20 100 200 \
120 20 200 100
XFillRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-foreground red -background green 20 30 80 180
XClearArea $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
30 40 60 40 false
XDrawLine $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-foreground red -background white 130 22 130 117
XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
140 30 140 101 \
150 101 150 30
XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-CoordModePrevious -line_width 3 160 30 0 71 \
10 0 0 -71
XDrawPoint $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
180 30 180 101
XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
190 30 190 40 190 50 190 60 190 70 190 80 190 90 190 101
XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-CoordModePrevious \
200 30 0 10 0 10 0 10 0 10 0 10 0 10 0 10
XDrawSegments $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-function clear -foreground green -background red \
-line_width 3 \
210 30 210 40 210 50 210 60 210 70 210 80 210 90 210 100
XDrawArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-line_width 3 20 300 100 150 300 5760
XFillArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-line_width 3 20 270 100 150 11520 5760
XDrawString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-font fixed -foreground blue -background red 200 200 \
"XDrawString"
XDrawImageString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-foreground green -background red 200 250 \
"XDrawImageString"
XFillPolygon $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
-Convex -CoordModePrevious \
300 300 30 70 30 -140
XTextWidth "-" fixed "Hi Mom"
}
ClearWindow()
{
XClearWindow $(XtDisplay "-" $DRAWINGAREA) $(XtWindow "-" $DRAWINGAREA)
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL drawingArea DrawingArea "$0" "$@"
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
XtCreateManagedWidget DRAWINGAREA drawingArea XmDrawingArea $FORM \
topAttachment:ATTACH_FORM \
leftAttachment:ATTACH_FORM \
rightAttachment:ATTACH_FORM
XtAddCallback $DRAWINGAREA exposeCallback ExposeCallback
XtCreateManagedWidget SEP sep XmSeparator $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$DRAWINGAREA \
leftAttachment:ATTACH_FORM \
rightAttachment:ATTACH_FORM
XtCreateManagedWidget PB pb XmPushButton $FORM \
labelString:"Clear The Window" \
topAttachment:ATTACH_WIDGET \
topWidget:$SEP \
leftAttachment:ATTACH_FORM \
rightAttachment:ATTACH_FORM \
bottomAttachment:ATTACH_FORM
XtAddCallback $PB activateCallback ClearWindow
XtSetValues $DRAWINGAREA \
height:450 \
width:450
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,327 @@
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
XCOMM $XConsortium: crMovesText1.src /main/3 1996/04/23 20:19:33 drk $
XCOMM #########################################################################
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
XCOMM Novell, Inc.
XCOMM #########################################################################
XCOMM
XCOMM This advanced shell script demonstrates the code necessary for forcing
XCOMM the Return key to move the focus to the next text field in a dialog,
XCOMM instead of causing the default pushbutton to be activated. When the
XCOMM focus has moved to the last text field, then the Return key will activate
XCOMM the default pushbutton.
XCOMM
XCOMM This function modifies the text field indicated by $1, so that when
XCOMM the text field receives the focus, it clears the default button; when
XCOMM it loses the focus, it will reenable the default button. It also adds
XCOMM some translations for catching the Return key, so that it can force
XCOMM the focus to the next text widget, which is indicated by $2
SetCrControls()
{
XtAddCallback $1 focusCallback "ClearDftButton"
XtAddCallback $1 losingFocusCallback "SetDftButton $OK"
XtOverrideTranslations $1 \
"Ctrl<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")
<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")"
}
XCOMM FocusOut Callback: reenables the default button
SetDftButton()
{
XtSetValues $FORM defaultButton:$OK
}
XCOMM FocusIn Callback: disables the default button
ClearDftButton()
{
XtSetValues $FORM defaultButton:NULL
}
XCOMM If the 'Ok' button is activated, but the 'Name' field is empty, then
XCOMM this function will display an error dialog.
EmptyNameError()
{
XmCreateErrorDialog ERROR_DIALOG $TOPLEVEL noName \
okLabelString:Ok \
messageString:"You must supply a name...."
XmMessageBoxGetChild CANCEL_BTN $ERROR_DIALOG DIALOG_CANCEL_BUTTON
XmMessageBoxGetChild HELP_BTN $ERROR_DIALOG DIALOG_HELP_BUTTON
XtUnmanageChildren $CANCEL_BTN $HELP_BTN
XtSetValues $(XtParent "-" $ERROR_DIALOG) title:foo
XtManageChildren $ERROR_DIALOG
}
XCOMM Pushbutton Callback: attached to the 'Cancel' pushbutton
QuitCB()
{
exit 0
}
XCOMM Pushbutton Callback: attached to the default pushbutton. It extracts the
XCOMM fields within the dialog, and does some validation.
CheckActionValues()
{
XtGetValues $LARGEICON value:LARGEICON_VALUE
XtGetValues $SMALLICON value:SMALLICON_VALUE
XtGetValues $DESCRIPTION value:DESCRIPTION_VALUE
XtGetValues $COMMANDLINE value:COMMANDLINE_VALUE
XtGetValues $PROMPT value:PROMPT_VALUE
XtGetValues $COMMANDTYPE menuHistory:COMMANDTYPE_WIDGET
XmTextGetString NAME_VALUE $NAME
if [ "$NAME_VALUE" = "" ]
then
EmptyNameError
else
echo "Name: "$NAME_VALUE
echo "Large Icon: "$LARGEICON_VALUE
echo "Small Icon: "$SMALLICON_VALUE
echo "Description: "$DESCRIPTION_VALUE
echo "Command Line: "$COMMANDLINE_VALUE
echo "Prompt: "$PROMPT_VALUE
echo "Command Type: "$COMMANDTYPE_WIDGET
fi
}
XCOMM ###################### Create the Main UI ###############################
XtInitialize TOPLEVEL createAction CreateAction "$0" "$@"
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
XtCreateManagedWidget NAMELABEL nameLabel XmLabel $FORM \
topAttachment:ATTACH_FORM \
topOffset:20 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
labelString:"Name:"
XtCreateManagedWidget NAME name XmText $FORM \
topAttachment:ATTACH_OPPOSITE_WIDGET \
topWidget:$NAMELABEL \
topOffset:-7 \
leftAttachment:ATTACH_WIDGET \
leftWidget:$NAMELABEL \
leftOffset:10 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
navigationType:EXCLUSIVE_TAB_GROUP
XtCreateManagedWidget COMMANDLINELABEL commandLineLabel XmLabel $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$NAMELABEL \
topOffset:20 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
labelString:"Command Line:"
XtCreateManagedWidget COMMANDLINE commandLine XmText $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$COMMANDLINELABEL \
topOffset:5 \
leftAttachment:ATTACH_FORM \
leftOffset:40 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
navigationType:EXCLUSIVE_TAB_GROUP
XmCreatePulldownMenu PANE $FORM pane
XtCreateManagedWidget XWIN xwin XmPushButton $PANE \
labelString:"X Windows"
XtCreateManagedWidget NOOUT noOut XmPushButton $PANE \
labelString:"No Output"
XtCreateManagedWidget TERM term XmPushButton $PANE \
labelString:"Terminal"
XtCreateManagedWidget TERMCLOSE termClose XmPushButton $PANE \
labelString:"Terminal [auto-close]"
XmCreateOptionMenu COMMANDTYPE $FORM commandType \
topAttachment:ATTACH_WIDGET \
topWidget:$COMMANDLINE \
topOffset:20 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
labelString:"Window Type:" \
menuHistory:$TERM \
subMenuId:$PANE \
navigationType:EXCLUSIVE_TAB_GROUP
XtSetValues $COMMANDTYPE spacing:35
XtManageChildren $COMMANDTYPE
XtCreateManagedWidget OPTLABEL optLabel XmLabel $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$COMMANDTYPE \
topOffset:30 \
leftAttachment:ATTACH_FORM \
leftOffset:100 \
labelString:"Optional Fields"
XtCreateManagedWidget SEP1 sep1 XmSeparator $FORM \
topAttachment:ATTACH_OPPOSITE_WIDGET \
topWidget:$OPTLABEL \
topOffset:10 \
rightAttachment:ATTACH_WIDGET \
rightWidget:$OPTLABEL \
rightOffset:5 \
leftAttachment:ATTACH_FORM \
orientation:HORIZONTAL \
separatorType:SHADOW_ETCHED_OUT
XtCreateManagedWidget SEP2 sep2 XmSeparator $FORM \
topAttachment:ATTACH_OPPOSITE_WIDGET \
topWidget:$OPTLABEL \
topOffset:10 \
leftAttachment:ATTACH_WIDGET \
leftWidget:$OPTLABEL \
leftOffset:5 \
rightAttachment:ATTACH_FORM \
orientation:HORIZONTAL \
separatorType:SHADOW_ETCHED_OUT
XtCreateManagedWidget PROMPTLABEL promptLabel XmLabel $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$OPTLABEL \
topOffset:20 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
labelString:"Filename Prompt:"
XtCreateManagedWidget PROMPT prompt XmText $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$PROMPTLABEL \
topOffset:5 \
leftAttachment:ATTACH_FORM \
leftOffset:40 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
navigationType:EXCLUSIVE_TAB_GROUP
XtCreateManagedWidget LARGEICONLABEL largeIconLabel XmLabel $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$PROMPT \
topOffset:30 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
labelString:"Large Icon:"
XtCreateManagedWidget LARGEICON largeIcon XmText $FORM \
topAttachment:ATTACH_OPPOSITE_WIDGET \
topWidget:$LARGEICONLABEL \
topOffset:-7 \
leftAttachment:ATTACH_WIDGET \
leftWidget:$LARGEICONLABEL \
leftOffset:20 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
navigationType:EXCLUSIVE_TAB_GROUP
XtCreateManagedWidget SMALLICONLABEL smallIconLabel XmLabel $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$LARGEICONLABEL \
topOffset:20 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
labelString:"Small Icon:"
XtCreateManagedWidget SMALLICON smallIcon XmText $FORM \
topAttachment:ATTACH_OPPOSITE_WIDGET \
topWidget:$SMALLICONLABEL \
topOffset:-7 \
leftAttachment:ATTACH_OPPOSITE_WIDGET \
leftWidget:$LARGEICON \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
navigationType:EXCLUSIVE_TAB_GROUP
XtCreateManagedWidget DESCRIPTIONLABEL descriptionLabel XmLabel $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$SMALLICONLABEL \
topOffset:20 \
leftAttachment:ATTACH_FORM \
leftOffset:20 \
labelString:"Description:"
XmCreateScrolledText DESCRIPTION $FORM description \
topAttachment:ATTACH_WIDGET \
topWidget:$DESCRIPTIONLABEL \
topOffset:5 \
leftAttachment:ATTACH_FORM \
leftOffset:40 \
rightAttachment:ATTACH_FORM \
rightOffset:10 \
editMode:MULTI_LINE_EDIT \
rows:4 \
navigationType:EXCLUSIVE_TAB_GROUP
XtManageChildren $DESCRIPTION
XtCreateManagedWidget SEP sep XmSeparator $FORM \
topAttachment:ATTACH_WIDGET \
topWidget:$DESCRIPTION \
topOffset:20 \
rightAttachment:ATTACH_FORM \
leftAttachment:ATTACH_FORM
XtCreateManagedWidget OK ok XmPushButton $FORM \
labelString:Apply \
leftAttachment:ATTACH_POSITION \
leftPosition:10 \
rightAttachment:ATTACH_POSITION \
rightPosition:30 \
topAttachment:ATTACH_WIDGET \
topWidget:$SEP \
topOffset:20 \
bottomOffset:10 \
bottomAttachment:ATTACH_FORM
XtAddCallback $OK activateCallback CheckActionValues
XtCreateManagedWidget CLOSE close XmPushButton $FORM \
labelString:Close \
leftAttachment:ATTACH_POSITION \
leftPosition:40 \
rightAttachment:ATTACH_POSITION \
rightPosition:60 \
topAttachment:ATTACH_WIDGET \
topWidget:$SEP \
topOffset:20 \
bottomOffset:10 \
bottomAttachment:ATTACH_FORM
XtAddCallback $CLOSE activateCallback QuitCB
XtCreateManagedWidget HELP help XmPushButton $FORM \
labelString:Help \
leftAttachment:ATTACH_POSITION \
leftPosition:70 \
rightAttachment:ATTACH_POSITION \
rightPosition:90 \
topAttachment:ATTACH_WIDGET \
topWidget:$SEP \
topOffset:20 \
bottomOffset:10 \
bottomAttachment:ATTACH_FORM
XtSetValues $FORM \
defaultButton:$OK \
cancelButton:$CLOSE \
navigationType:EXCLUSIVE_TAB_GROUP \
initialFocus:$NAME
XCOMM Set up proper behavior for the Return key
SetCrControls $NAME $COMMANDLINE
SetCrControls $COMMANDLINE $PROMPT
SetCrControls $PROMPT $LARGEICON
SetCrControls $LARGEICON $SMALLICON
XtRealizeWidget $TOPLEVEL
XtMainLoop

View File

@@ -0,0 +1,38 @@
/* $XConsortium: exextra.h /main/3 1995/11/01 15:53:50 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ifndef _Dtksh_exextra_h
#define _Dtksh_exextra_h
#define EXKSH_EXTRA_TABLE \
{ "call", NV_BLTIN|BLT_ENV|BLT_SPC, do_call }, \
{ "field_comp", NV_BLTIN|BLT_ENV|BLT_SPC, do_field_comp }, \
{ "field_get", NV_BLTIN|BLT_ENV|BLT_SPC, do_field_get }, \
{ "sizeof", NV_BLTIN|BLT_ENV|BLT_SPC, do_sizeof }, \
{ "findsym", NV_BLTIN|BLT_ENV|BLT_SPC, do_findsym }, \
{ "finddef", NV_BLTIN|BLT_ENV|BLT_SPC, do_finddef }, \
{ "deflist", NV_BLTIN|BLT_ENV|BLT_SPC, do_deflist }, \
{ "define", NV_BLTIN|BLT_ENV|BLT_SPC, do_define }, \
{ "structlist", NV_BLTIN|BLT_ENV|BLT_SPC, do_structlist }, \
{ "deref", NV_BLTIN|BLT_ENV|BLT_SPC, do_deref }, \
{ "struct", NV_BLTIN|BLT_ENV|BLT_SPC, do_struct }, \
{ "typedef", NV_BLTIN|BLT_ENV|BLT_SPC, do_typedef }, \
{ "symbolic", NV_BLTIN|BLT_ENV|BLT_SPC, do_symbolic }, \
#define EXKSH_EXTRA_VAR \
"RET", NV_NOFREE|NV_RDONLY, (char*)(&xk_ret_buffer[0]), \
"PRDEBUG", NV_NOFREE|NV_INTEGER, (char*)(&xk_prdebug),
#define EXKSH_EXTRA_ALIAS \
"args", NV_NOFREE|NV_EXPORT, "setargs \"$@\"",
#endif /* _Dtksh_exextra_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

218
cde/programs/dtksh/exksh.h Normal file
View File

@@ -0,0 +1,218 @@
/* $XConsortium: exksh.h /main/3 1995/11/01 15:54:01 rswiston $ */
/* "%W%" */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ifndef _Dtksh_exksh_h
#define _Dtksh_exksh_h
#include <sys/types.h>
#ifndef SYMS_ONLY
#define SH_FAIL 1
#define SH_SUCC 0
#define PRSYMBOLIC 1
#define PRMIXED 2
#define PRDECIMAL 4
#define PRHEX 8
#define PRMIXED_SYMBOLIC 16
#define PRNAMES 32
#define UPP(CH) (islower(CH) ? toupper(CH) : (CH))
#define C_PAIR(STR, CH1, CH2) (((STR)[0] == (CH1)) && ((STR)[1] == (CH2)))
#define XK_USAGE(X) return(xk_usage(X), SH_FAIL);
/* In the future, this will require following pointers, unless we
** can always trace back types to typedefs. For example, unsigned long is
** a typedef, but it is simple because it is really just a long.
*/
#define IS_SIMPLE(TBL) ((TBL)->flags & F_SIMPLE)
#ifndef N_DEFAULT /* From name.h */
/* Stolen out of include/name.h, the problems of including things
** out of the ksh code is major. Hence, the copy rather than the
** include.
*/
struct Bfunction {
long (*f_vp)(); /* value function */
long (*f_ap)(); /* assignment function */
};
#endif /* N_DEFAULT: From name.h */
#define ALLDATA INT_MAX
#define BIGBUFSIZ (10 * BUFSIZ)
#define IN_BAND 1
#define OUT_BAND 2
#define NEW_PRIM 4
struct fd {
int vfd;
int flags;
char mode;
struct strbuf *lastrcv;
int rcvcount;
int sndcount;
int uflags;
};
struct vfd {
int fd;
};
extern struct fd *Fds;
extern struct vfd *Vfds;
struct libdesc {
char *name;
void *handle;
};
struct libstruct {
char *prefix;
int nlibs;
struct libdesc *libs;
};
#ifndef OSI_LIB_CODE
#define PARPEEK(b, s) (((b)[0][0] == s[0]) ? 1 : 0 )
#define PAREXPECT(b, s) (((b)[0][0] == s[0]) ? 0 : -1 )
#define OFFSET(T, M) ((int)(&((T)NULL)->M))
typedef char *string_t;
/*
* Structures for driving generic print/parse/copy/free routines
*/
typedef struct memtbl {
char *name; /* name of the member */
char *tname; /* name of the typedef */
char kind; /* kind of member, see #defines below */
char flags; /* flags for member, see #defines below */
short tbl; /* -1 or index into ASL_allmems[] array */
short ptr; /* number of "*" in front of member */
short subscr; /* 0 if no subscript, else max number of elems */
short delim; /* 0 if no length delim, +1 if next field, -1 if prev */
short id; /* Id of the ASL in which this def is made */
short offset; /* offset into the C structure */
short size; /* size of this member, for easy malloc'ing */
long choice; /* def of tag indicating field chosen for unions */
} memtbl_t;
struct envsymbols {
char *name;
int id;
int (*parsefunc)();
int (*printfunc)();
char *tname;
int intlike;
int string;
int topptr;
int valbits;
struct {
char *name;
unsigned long val;
int cover;
} vals[64];
};
/*
* Definitions for the kind field of the above structure
*/
#define K_CHAR (0) /* char or unchar */
#define K_SHORT (1) /* short or ushort */
#define K_INT (2) /* int or uint */
#define K_LONG (3) /* long, unsigned long, PRIM, etc. */
#define K_STRING (4) /* char * or char [] */
#define K_OBJID (5) /* objid_t *, note the star is included */
#define K_ANY (6) /* any_t */
#define K_STRUCT (7) /* struct { } */
#define K_UNION (8) /* union { } */
#define K_TYPEDEF (9) /* typedef */
#define K_DSHORT (10) /* short delimiter */
#define K_DINT (11) /* int delimiter */
#define K_DLONG (12) /* long delimiter */
/*
* Definitions for the flags field of the above structure, bitmask
*/
#define F_SIMPLE (1) /* simple, flat type */
#define F_FIELD (2) /* memtbl is a field of a structure, not the
name of a type */
#define F_TBL_IS_PTR (4) /* tbl field is pointer, not number; */
#define F_TYPE_IS_PTR (8) /* type is built-in, but is already a pointer, like K_STRING */
#define SUCCESS 0
#define FAIL (-1)
#define TRUE 1
#define FALSE 0
/* The following macro, RIF, stands for Return If Fail. Practically
* every line of encode/decode functions need to do this, so it aids
* in readability.
*/
#define RIF(X) do { if ((X) == FAIL) return(FAIL); } while(0)
#endif /* not OSI_LIB_CODE */
#if !defined(OSI_LIB_CODE) || defined(NEED_SYMLIST)
struct symlist {
struct memtbl tbl;
int isflag;
int nsyms;
struct symarray *syms;
};
#endif
#define DYNMEM_ID (1)
#define BASE_ID (2)
#define ALTPUTS(STR) puts(STR)
#ifndef NULL
#define NULL (0)
#endif
#ifdef SPRINTF_RET_LEN
#define lsprintf sprintf
#endif
#define MAX_CALL_ARGS 15
#define TREAT_SIMPLE(TBL) ((TBL)->ptr || IS_SIMPLE(TBL))
#ifdef EXKSH_INCLUDED
#define XK_PRINT(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) (_Delim = 0, xk_print(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7))
#define XK_PARSE(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) (_Delim = 0, xk_parse(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7))
#define XK_FREE(ARG1, ARG2, ARG3, ARG4, ARG5) (_Delim = 0, xk_free(ARG1, ARG2, ARG3, ARG4, ARG5))
#endif
#define NOHASH 1
#define TYPEONLY 2
#define STRUCTONLY 4
#endif /* not SYMS_ONLY */
struct symarray {
const char *str;
unsigned long addr;
};
#endif /* _Dtksh_exksh_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,640 @@
/* $XConsortium: exksh_prpar.c /main/4 1995/11/01 15:54:12 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "name.h"
#include "shell.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include "exksh.h"
#include "stdio.h"
#include "exksh_prpar.h"
#include "symbolic.h"
#include "msgs.h"
static int xk_uppercase(
char *s) ;
static int getsize(
int fd,
int *psize) ;
#define OBJ_END 100
struct symlist Val_list;
unsigned int Pr_format = PRSYMBOLIC|PRMIXED|PRNAMES;
/*
* Takes a pointer to a pointer to a character buffer, and skips any
* whitespace, as defined by isspace(section 3). Increments the
* buf parameter to the first non-whitespace character.
* Returns SUCCESS, there are no known ways for it to fail.
*/
int
xk_skipwhite(
char **buf )
{
while (isspace(**buf))
(*buf)++;
return(SUCCESS);
}
int
xk_backskip(
char **buf,
int *n )
{
*n = 0;
while (isspace(**buf)) {
(*buf)--;
*n++;
}
if ((*buf)[0] == '\\')
return(TRUE);
else
return(FALSE);
}
/*
* Takes a pointer to a character buffer and a string. Sees if
* the str is present as the first part of the buffer (minus any
* whitespace), and if so increments the buffer past the string.
* If not, returns FAIL without incrementing buffer (except perhaps
* by eating leading whitespace).
*/
int
xk_parexpect(
char **buf,
char *str )
{
RIF(xk_skipwhite(buf));
if (strncmp(*buf, str, strlen(str)) == 0) {
*buf += strlen(str);
} else {
return(FAIL);
}
return(SUCCESS);
}
/*
* Takes a pointer to a char buffer, and a string. Returns
* TRUE if the string appears immediately (after skipping whitespace).
* or FALSE otherwise.
*/
int
xk_parpeek(
char **buf,
char *str )
{
RIF(xk_skipwhite(buf));
if (strncmp(*buf, str, strlen(str)) == 0)
return(TRUE);
else
return(FALSE);
}
int
xk_prin_int(
memtbl_t *tbl,
char **buf,
unsigned long *old_v )
{
register int i, printed = 0;
struct symlist *sym;
unsigned long v;
switch (tbl->kind) {
case K_CHAR:
v = *((unsigned char *) old_v);
break;
case K_SHORT:
v = *((unsigned short *) old_v);
break;
case K_INT:
v = *((unsigned int *) old_v);
break;
default:
v = *old_v;
}
**buf = '\0';
if ((Pr_format & PRSYMBOLIC) && ((Val_list.syms != NULL) || ((sym = fsymbolic(tbl)) != NULL))) {
if (Val_list.syms != NULL)
sym = &Val_list;
if (sym->isflag) {
if (v == 0) {
*buf += lsprintf(*buf, "0");
return(SUCCESS);
}
for (i = 0; i < sym->nsyms; i++) {
if (sym->syms[i].addr & v) {
if (Pr_format & PRMIXED_SYMBOLIC) {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%s%s(%d)", printed ? "|" : "", sym->syms[i].str, sym->syms[i].addr);
else
*buf += lsprintf(*buf, "%s%s(0x%x)", printed ? "|" : "", sym->syms[i].str, sym->syms[i].addr);
}
else
*buf += lsprintf(*buf, "%s%s", printed ? "|" : "", sym->syms[i].str);
v &= ~(sym->syms[i].addr);
printed++;
}
}
if (v) {
if (Pr_format & PRMIXED_SYMBOLIC) {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%sNOSYMBOLIC(%d)", printed ? "|" : "", v);
else
*buf += lsprintf(*buf, "%sNOSYMBOLIC(0x%x)", printed ? "|" : "", v);
}
else {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%s%d", printed ? "|" : "", v);
else
*buf += lsprintf(*buf, "%s0x%x", printed ? "|" : "", v);
}
}
return(SUCCESS);
}
else {
for (i = 0; i < sym->nsyms; i++) {
if (sym->syms[i].addr == v) {
if (Pr_format & PRMIXED_SYMBOLIC) {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%s(%d)", sym->syms[i].str, v);
else
*buf += lsprintf(*buf, "%s(0x%x)", sym->syms[i].str, v);
}
else
*buf += lsprintf(*buf, "%s", sym->syms[i].str);
return(SUCCESS);
}
}
}
}
if (Pr_format & PRHEX)
*buf += lsprintf(*buf, "0x%x", v);
else if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%d", v);
else
*buf += lsprintf(*buf, "%d(0x%x)", v, v);
return(SUCCESS);
}
int
xk_par_int(
char **buf,
long *v,
struct envsymbols *env )
{
register int ret, base;
char *p, *q, *pp;
char nbuf[512];
xk_skipwhite(buf);
strncpy(nbuf, *buf, sizeof(nbuf)-1);
if (strchr(nbuf, '|') == NULL) {
for (p = nbuf; *p && *p != ' ' && *p != ',' && *p != ']'
&& *p != '{' && *p != '}' && *p != '/' && *p != '@'
&& *p != ':' && *p != '.' && *p != 13 && *p != 10 && *p != 11
&& *p != 12 && *p != 9; p++)
;
*p = '\0';
}
else {
for (p = nbuf; *p && *p != ','
&& *p != '{' && *p != '}' && *p != '/' && *p != '@'
&& *p != ':' && *p != '.' ; p++)
;
*p = '\0';
}
ret = strlen(nbuf);
if (ret == 0)
return(OBJ_END);
*v = 0;
if ((p = strchr(nbuf, '"')) != NULL) {
return(FAIL);
}
if ((p = strchr(nbuf, '+')) != NULL) {
char *qq;
long v1, v2;
*p = '\0';
v1 = v2 = 0;
qq = nbuf;
p++;
xk_par_int(&qq, &v1, env);
xk_par_int(&p, &v2, env);
*v = v1 + v2;
*buf += ret;
return(SUCCESS);
}
if ((p = strchr(&nbuf[1], '-')) != NULL) {
long v1, v2;
char *qq;
*p = '\0';
v1 = v2 = 0;
qq = nbuf;
p++;
xk_par_int(&qq, &v1, env);
xk_par_int(&p, &v2, env);
*v = v1 - v2;
*buf += ret;
return(SUCCESS);
}
for (p = strtok(nbuf, " |\t\n"); p; p = strtok(NULL, " |\t\n")) {
for (pp = p; *pp && *pp != ' ' && *pp != ','
&& *pp != '{' && *pp != '}' && *pp != '/' && *pp != '@'
&& *pp != ':' && *pp != '.' && *pp != 13 &&
*pp != 11 && *pp != 12 && *pp != 9; pp++)
;
*pp = '\0';
if ((pp = strchr(p, '#')) != NULL) {
base = strtol(p, &p, 10);
if (p != pp)
return(FAIL);
p++;
}
else
base = 0;
xk_skipwhite(&p);
if (*p == '\0')
continue;
if (isdigit(*p) || *p == '-') {
*v |= strtoul(p, (char **)NULL, base);
}
else {
unsigned long val;
/* knock out commentary parenthesized things */
if ((q = strchr(p, '(' /*)*/ )) != NULL)
*q = '\0';
/* Search through available names for partial match */
if (!fdef(p, &val)) {
return(FAIL);
}
else
*v |= val;
}
}
*buf += ret;
return(SUCCESS);
}
int
xk_prin_nts(
char **buf,
char *str )
{
return(xk_prin_charstr(buf, (unsigned char *)str,
str ? strlen(str) : 0));
}
int
xk_prin_charstr(
char **buf,
unsigned char *str,
int len )
{
register int i;
if (str == NULL)
*buf += lsprintf(*buf, "NULL");
else {
*buf += lsprintf(*buf, "\"");
for (i = 0; i < len; i++) {
if (str[i] == '"') {
*buf += lsprintf(*buf, "\\\"");
} else if (isprint(str[i])) {
*buf += lsprintf(*buf, "%c", str[i]);
} else {
switch (str[i]) {
case '\n':
*buf += lsprintf(*buf, "\\n");
break;
case '\t':
*buf += lsprintf(*buf, "\\t");
break;
case '\b':
*buf += lsprintf(*buf, "\\b");
break;
case '\v':
*buf += lsprintf(*buf, "\\v");
break;
case '\f':
*buf += lsprintf(*buf, "\\f");
break;
case '\r':
*buf += lsprintf(*buf, "\\r");
break;
case '\0':
*buf += lsprintf(*buf, "\\00");
break;
default:
*buf += lsprintf(*buf, "\\%x", (unsigned int)str[i]);
break;
}
}
}
*buf += lsprintf(*buf, "\"");
}
return(SUCCESS);
}
int
xk_prin_hexstr(
char **buf,
char *str,
int len )
{
register int i;
unsigned char tempc;
if (str == NULL)
*buf += lsprintf(*buf, "NULL");
else {
*buf += lsprintf(*buf, "%s", "0x");
for (i = 0; i < len; i++) {
tempc = str[i];
if (str[i] & 0xf0) {
*buf += lsprintf(*buf, "%x", tempc);
}
else
*buf += lsprintf(*buf, "0%x", tempc);
}
}
return(SUCCESS);
}
#define MALSIZ 16 /* initial size of string to malloc */
int
xk_par_chararr(
char **buf,
char *str,
int *len )
{
return(xk_par_charstr(buf, &str, len));
}
#define CHAR_QUOTED 0
#define CHAR_HEXSTR 1
#define CHAR_FILE 2
int
xk_par_nts(
char **buf,
char **str )
{
int temp = 0;
RIF(xk_par_charstr(buf, str, &temp));
if (temp >= 0)
str[0][temp] = '\0';
return(SUCCESS);
}
int
xk_par_charstr(
char **buf,
char **str,
int *len )
{
register int i;
char delim;
int didmalloc = FALSE, getmode;
char cbuf[3]; /* conversion buffer for hex strings */
char filename[128];
char * errmsg;
RIF(xk_skipwhite(buf));
if (xk_parpeek(buf, "NULL")) {
RIF(xk_parexpect(buf, "NULL"));
*str = NULL;
*len = -1;
return(SUCCESS);
}
/* this is pure internal feature, no error setting */
if (**buf == '<') {
char *p;
FILE *fp;
char gbuf[BUFSIZ];
int line;
int size;
(*buf)++;
xk_skipwhite(buf);
for (p = &filename[0];
**buf != ',' && **buf != /* { */ '}' && **buf != ' ' &&
**buf != '\t' && p < &filename[sizeof(filename)];
*p++ = *(*buf)++)
;
*p++ = '\0';
if ((fp = fopen(filename, "r")) == NULL) {
errmsg=strdup(GETMESSAGE(7,1,
"Unable to open the file '%s'; verify that it exists and is readable"));
lsprintf(gbuf, errmsg, filename);
fprintf(stderr, gbuf);
free(errmsg);
return(FAIL);
}
if (*len == 0) {
if (getsize(fileno(fp), &size) == FAIL) {
errmsg=strdup(GETMESSAGE(7,2,
"Unable to access the file '%s'; verify you have permission to access it"));
lsprintf(gbuf, errmsg, filename);
fprintf(stderr, gbuf);
free(errmsg);
return(FAIL);
}
*len = size/2 + 1;
if ((*str = malloc(*len)) == NULL) {
return(FAIL);
}
}
line = i = 0;
while (fgets(gbuf, sizeof(gbuf), fp) != NULL) {
line++;
p = gbuf;
/* eat any leading 0x */
if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
p += 2;
}
for ( ; *p && *p != '\n'; ) {
if (i > *len - 1) {
fclose(fp);
return(FAIL);
}
if (!isxdigit(*p)) {
p++;
continue;
}
if (!isxdigit(p[1])) {
fclose(fp);
return(FAIL);
}
cbuf[0] = p[0];
cbuf[1] = p[1];
cbuf[2] = '\0';
str[0][i++] = (char)strtol(cbuf, (char **)NULL, 16);
p += 2;
xk_skipwhite(&p);
}
}
*len = i;
fclose(fp);
return(SUCCESS);
} else if (!ispunct(**buf)) {
getmode = CHAR_HEXSTR;
if ((*buf)[0] == '0' && ((*buf)[1] == 'x' || (*buf)[1] == 'X'))
(*buf) += 2;
} else {
delim = *((*buf)++);
getmode = CHAR_QUOTED;
}
if (*len == 0) {
if ((*str = malloc(MALSIZ)) == NULL) {
return(FAIL);
}
didmalloc = TRUE;
*len = MALSIZ;
}
i = 0;
while ((*buf)[0] != '\0' && ((getmode == CHAR_QUOTED && (*buf)[0] != delim) ||
(getmode == CHAR_HEXSTR && (isxdigit((*buf)[0]))) ||
(getmode == CHAR_HEXSTR && (isspace((*buf)[0]))))) {
/* NOTE: must always leave 1 additional byte for a null
* termination, because could be called by xk_par_nts!
*/
if (i >= *len - 1) {
if (didmalloc == FALSE) {
return(FAIL);
} else {
if ((*str = realloc(*str, *len + MALSIZ)) == NULL) {
return(FAIL);
}
*len += MALSIZ;
}
}
if (getmode == CHAR_QUOTED) {
if ((*buf)[0] == '\\') {
(*buf)++;
switch ((*buf)[0]) {
case 't':
str[0][i++] = '\t';
(*buf)++;
break;
case 'v':
str[0][i++] = '\v';
(*buf)++;
break;
case 'f':
str[0][i++] = '\f';
(*buf)++;
break;
case 'n':
str[0][i++] = '\n';
(*buf)++;
break;
case 'r':
str[0][i++] = '\r';
(*buf)++;
break;
case 'b':
str[0][i++] = '\b';
(*buf)++;
break;
case '0':
str[0][i++] = (char)strtol(*buf, buf, 8);
break;
case 's':
(*buf)++;
break;
default:
str[0][i++] = *(*buf)++;
}
} else
str[0][i++] = *(*buf)++;
} else {
if (!isxdigit((*buf)[1])) {
return(FAIL);
}
cbuf[0] = (*buf)[0];
cbuf[1] = (*buf)[1];
cbuf[2] = '\0';
str[0][i++] = (char)strtol(cbuf, (char **)NULL, 16);
(*buf) += 2;
xk_skipwhite(buf);
}
}
if (getmode == CHAR_QUOTED)
(*buf)++; /* eat the trailing quote */
/*
* NOTE: We leave a malloced buffer the same size rather
* than realloc()'ing it to be the exact size in order
* to save time and avoid malloc arena fragmentation
*/
*len = i;
return(SUCCESS);
}
/* Case Ignoring String Functions. */
static int
xk_uppercase(
char *s )
{
while (*s) {
if (islower(*s))
*s = toupper(*s);
s++;
}
}
int
xk_Strncmp(
char *s1,
char *s2,
int len )
{
int diff, i;
for (i=0; i < len && s1[i] != '\0' && s2[i] != '\0'; i++)
if ((diff = tolower(s1[i]) - tolower(s2[i])) != 0)
return (diff);
return(i == len ? 0 : s1[i] - s2[i]);
}
static int
getsize(
int fd,
int *psize )
{
struct stat stat;
if (fstat(fd, &stat) == FAIL)
return(FAIL);
*psize = stat.st_size;
return(SUCCESS);
}

View File

@@ -0,0 +1,76 @@
/* $XConsortium: exksh_prpar.h /main/4 1995/11/01 15:54:23 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: exksh_prpar.h
**
** Project: CDE
**
** Description: Public include file for exksh_prpar.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_exksh_prpar_h
#define _Dtksh_exksh_prpar_h
extern unsigned int Pr_format;
extern int xk_skipwhite(
char **buf) ;
extern int xk_backskip(
char **buf,
int *n) ;
extern int xk_parexpect(
char **buf,
char *str) ;
extern int xk_parpeek(
char **buf,
char *str) ;
extern int xk_prin_int(
memtbl_t *tbl,
char **buf,
unsigned long *old_v) ;
extern int xk_par_int(
char **buf,
long *v,
struct envsymbols *env) ;
extern int xk_prin_nts(
char **buf,
char *str) ;
extern int xk_prin_charstr(
char **buf,
unsigned char *str,
int len) ;
extern int xk_prin_hexstr(
char **buf,
char *str,
int len) ;
extern int xk_par_chararr(
char **buf,
char *str,
int *len) ;
extern int xk_par_nts(
char **buf,
char **str) ;
extern int xk_par_charstr(
char **buf,
char **str,
int *len) ;
extern int xk_Strncmp(
char *s1,
char *s2,
int len) ;
#endif /* _Dtksh_exksh_prpar_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
/* $XConsortium: exksh_tbls.h /main/4 1995/11/01 15:54:45 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: exksh_tbls.h
**
** Project: CDE
**
** Description: Public include file for exksh_tbls.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_exksh_tbls_h
#define _Dtksh_exksh_tbls_h
extern int Pr_tmpnonames;
extern int _Delim;
extern int (*find_special(
int type,
char *name))() ;
extern int set_special(
char *name,
int (*free)(),
int (*parse)(),
int (*print)()) ;
extern int xk_parse(
memtbl_t *tbl,
char **buf,
char *p,
int nptr,
int sub,
void *pass,
memtbl_t *(*tbl_find)()) ;
extern int xk_get_delim(
memtbl_t *tbl,
char *p) ;
extern int xk_get_pardelim(
memtbl_t *tbl,
char *p) ;
extern int xk_print(
memtbl_t *tbl,
char **buf,
char *p,
int nptr,
int sub,
void *pass,
memtbl_t *(*tbl_find)()) ;
extern int xk_free(
memtbl_t *tbl,
char *p,
int nptr,
int sub,
memtbl_t *(*tbl_find)()) ;
#endif /* _Dtksh_exksh_tbls_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

167
cde/programs/dtksh/extra.c Normal file
View File

@@ -0,0 +1,167 @@
/* $XConsortium: extra.c /main/4 1995/11/01 15:54:55 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "defs.h"
#include "shell.h"
#include "name.h"
#include "stdio.h"
#include "msgs.h"
void
env_set(
char *var )
{
(void)nv_open(var, sh.var_tree, NV_ASSIGN);
}
void
env_set_gbl(
char *vareqval )
{
env_set(vareqval);
}
char *
env_get(
char *var )
{
Namval_t *np;
char *val;
np = nv_search(var,sh.var_tree,0);
if (np && (val = nv_getval(np)))
return(val);
return(NULL);
}
void *
xkhash_init(
int num )
{
return((void *) hashalloc(NULL,0));
}
void
xkhash_override(
Hash_table_t *tbl,
const char *name,
void *val )
{
hashput(tbl, name, val);
}
void *
xkhash_find(
Hash_table_t *tbl,
const char *name )
{
return(hashget(tbl, name));
}
void
xkhash_add(
Hash_table_t *tbl,
const char *name,
char *val )
{
hashput(tbl, name, val);
}
int
ksh_eval(
char *cmd )
{
sh_eval(sfopen(NIL(Sfile_t*),cmd,"s"),0);
sfsync(sh.outpool);
return(sh.exitval);
}
void
env_set_var(
char *var,
char *val )
{
register int len;
char tmp[512];
char *set = &tmp[0];
if ((len = strlen(var) + strlen(val?val:"") + 2) > sizeof(tmp)) /* 11/06 CHANGED */
set = malloc(len);
strcpy(set, var);
strcat(set, "=");
strcat(set, val?val:""); /* 11/06 CHANGED */
env_set(set);
if (set != &tmp[0])
free(set);
}
void
env_blank(
char *var )
{
env_set_var(var, "");
}
void
printerr(
char *cmd,
char *msg1,
char *msg2 )
{
if (msg1 == NULL)
msg1 = "";
if (msg2 == NULL)
msg2 = "";
if (cmd && (strlen(cmd) > 0))
printf( "%s: %s %s\n", cmd, msg1, msg2);
else
printf( "%s %s\n", msg1, msg2);
}
void
printerrf(
char *cmd,
char *fmt,
char *arg0,
char *arg1,
char *arg2,
char *arg3,
char *arg4,
char *arg5,
char *arg6,
char *arg7 )
{
char buf[2048];
if (arg0 == NULL)
arg0 = "";
if (arg1 == NULL)
arg1 = "";
if (arg2 == NULL)
arg2 = "";
if (arg3 == NULL)
arg3 = "";
if (arg4 == NULL)
arg4 = "";
if (arg5 == NULL)
arg5 = "";
if (arg6 == NULL)
arg6 = "";
if (arg7 == NULL)
arg7 = "";
sprintf(buf, fmt, arg0, arg1, arg2, arg3,arg4, arg5, arg6, arg7);
if (cmd && (strlen(cmd) > 0))
printf("%s: %s\n", cmd, buf);
else
printf("%s\n", buf);
}

View File

@@ -0,0 +1,70 @@
/* $XConsortium: extra.h /main/4 1995/11/01 15:55:04 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: extra.h
**
** Project: CDE
**
** Description: Public include file for extra.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_extra_h
#define _Dtksh_extra_h
extern void env_set(
char *var) ;
extern void env_set_gbl(
char *vareqval) ;
extern char * env_get(
char *var) ;
extern void * xkhash_init(
int num) ;
extern void xkhash_override(
Hash_table_t *tbl,
const char *name,
void *val) ;
extern void * xkhash_find(
Hash_table_t *tbl,
const char *name) ;
extern void xkhash_add(
Hash_table_t *tbl,
const char *name,
char *val) ;
extern int ksh_eval(
char *cmd) ;
extern void env_set_var(
char *var,
char *val) ;
extern void env_blank(
char *var) ;
extern void printerr(
char *cmd,
char *msg1,
char *msg2) ;
extern void printerrf(
char *cmd,
char *fmt,
char *arg0,
char *arg1,
char *arg2,
char *arg3,
char *arg4,
char *arg5,
char *arg6,
char *arg7) ;
#endif /* _Dtksh_extra_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,81 @@
/* $XConsortium: findsym.c /main/5 1995/11/09 09:32:59 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/types.h>
#ifdef DYNLIB
#ifdef __aix
#include <sys/ldr.h>
#else
#include <dlfcn.h>
#endif
/* from ksh93/include/ast/shell.h */
extern void **sh_getliblist(void);
#endif
#ifdef HPUX_DYNLIB
#include <dl.h>
#endif
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "xmdtksym.h"
#include "msgs.h"
/*
* This function is currently only used to locate a widget class record,
* as requested by a DtLoadWidget request. In the future, if the exksh
* commands are ever added back in, then it will also need to be able
* to locate any arbitrary symbol.
*/
unsigned long
fsym(
char *str,
int lib )
{
#ifdef DYNLIB
void ** liblist;
int i = 0;
long addr;
#endif
#ifdef HPUX_DYNLIB
void *found;
shl_t handle;
#endif
#ifdef DYNLIB
if ((liblist = sh_getliblist()) == NULL)
return(NULL);
while (liblist[i])
{
if (addr = dlsym(liblist[i], str))
return((unsigned long)addr);
i++;
}
#else
#ifdef HPUX_DYNLIB
handle = NULL;
if ((shl_findsym(&handle, str, TYPE_PROCEDURE, &found)) == 0)
return((unsigned long) found);
if ((shl_findsym(&handle, str, TYPE_DATA, &found)) == 0)
return((unsigned long) found);
handle = PROG_HANDLE;
if ((shl_findsym(&handle, str, TYPE_PROCEDURE, &found)) == 0)
return((unsigned long) found);
if ((shl_findsym(&handle, str, TYPE_DATA, &found)) == 0)
return((unsigned long) found);
#endif
#endif
return(NULL);
}

236
cde/programs/dtksh/genlib.c Normal file
View File

@@ -0,0 +1,236 @@
/* $XConsortium: genlib.c /main/5 1996/09/27 19:01:37 drk $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/types.h>
#ifdef DYNLIB
#include <dlfcn.h>
#endif
#ifdef HPUX_DYNLIB
#include <dl.h>
#endif
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "docall.h"
#include "exksh.h"
#include "misc.h"
#include "xmdtksym.h"
#include "msgs.h"
static char * ReturnUsageMsg(
int msgIndex);
struct libstruct *All_libs;
static int Nlibs;
int sh_errno;
static struct usage {
char *funcname;
int msgId;
} Xk_usage[] = {
"call", 0,
"define", 1,
"deflist", 2,
"deref", 3,
"field_comp", 4,
"field_get", 5,
"finddef", 6,
"findsym", 7,
"sizeof", 8,
"struct", 9,
"structlist", 10,
"symbolic", 11,
"typedef", 12,
};
static char *
ReturnUsageMsg(
int msgId )
{
char * errmsg;
switch (msgId)
{
case 0: errmsg = GETMESSAGE(9,1, "call [-F] [-n] [-r] function [arg] ... [++] [argModifier ...]");
return(errmsg);
case 1: errmsg = GETMESSAGE(9,2, "define [-R] name value");
return(errmsg);
case 2: errmsg = GETMESSAGE(9,3, "deflist [-p prefix] address");
return(errmsg);
case 3: errmsg = GETMESSAGE(9,4, "deref [-p] [-l] [-len] address [variable]");
return(errmsg);
case 4: errmsg = GETMESSAGE(9,5, "field_comp type address [criterion ...]");
return(errmsg);
case 5: errmsg = GETMESSAGE(9,6, "field_get [-v variable] type address [fieldName ...]");
return(errmsg);
case 6: errmsg = GETMESSAGE(9,7, "finddef definitionName [variable]");
return(errmsg);
case 7: errmsg = GETMESSAGE(9,8, "findsym symbolName [variable]");
return(errmsg);
case 8: errmsg = GETMESSAGE(9,9, "sizeof typeName [variable]");
return(errmsg);
case 9: errmsg = GETMESSAGE(9,10,"struct [-R] name fieldName[:type] ...");
return(errmsg);
case 10: errmsg = GETMESSAGE(9,11, "structlist [-i id] [-p prefix] address");
return(errmsg);
case 11: errmsg = GETMESSAGE(9,12, "symbolic [-m] -t type ... symbolic ...");
return(errmsg);
case 12: errmsg = GETMESSAGE(9,13,"typedef [-R] typeDescriptor typeName");
return(errmsg);
}
return("");
}
int
xk_usage(
char *funcname )
{
int i;
char * errhdr;
char * errmsg;
for (i = 0; i < sizeof(Xk_usage) / sizeof(struct usage); i++)
{
if (!funcname)
{
errmsg = strdup(ReturnUsageMsg(Xk_usage[i].msgId));
ALTPUTS(errmsg);
free(errmsg);
}
else if (!funcname || (strcmp(funcname, Xk_usage[i].funcname) == 0))
{
errhdr = strdup(GETMESSAGE(9,14, "Usage: %s"));
errmsg = strdup(ReturnUsageMsg(Xk_usage[i].msgId));
printerrf("", errhdr, errmsg, NULL, NULL, NULL, NULL, NULL, NULL,
NULL);
free(errhdr);
free(errmsg);
return(SH_SUCC);
}
}
return(funcname ? SH_FAIL : SH_SUCC);
}
unsigned long
fsym(
char *str,
int lib )
{
#if defined(STATICLIB) || ( !defined(DYNLIB) && !defined(HPUX_DYNLIB))
struct symarray dummy;
#endif
#if defined(DYNLIB)
int i, j;
#endif
void *found;
#if defined(STATICLIB) || (!defined(DYNLIB) && !defined(HPUX_DYNLIB))
dummy.str = str;
if ((found = (void *) bsearch((char *) &dummy, Symarray,
Symsize-1, sizeof(struct symarray), symcomp)) != NULL)
return(((struct symarray *) found)->addr);
#endif /* STATICLIB */
#ifdef DYNLIB
for (i = 0; i < Nlibs; i++)
for (j = 0; j < All_libs[i].nlibs; j++)
if ((found = dlsym(All_libs[i].libs[j].handle,
str)) != NULL)
return((unsigned long) found);
#endif /* DYNLIB */
#ifdef HPUX_DYNLIB
{
shl_t handle;
handle = NULL;
if ((shl_findsym(&handle, str, TYPE_PROCEDURE, &found)) == 0)
return((unsigned long) found);
if ((shl_findsym(&handle, str, TYPE_DATA, &found)) == 0)
return((unsigned long) found);
handle = PROG_HANDLE;
if ((shl_findsym(&handle, str, TYPE_PROCEDURE, &found)) == 0)
return((unsigned long) found);
if ((shl_findsym(&handle, str, TYPE_DATA, &found)) == 0)
return((unsigned long) found);
}
#endif /* HPUX_DYNLIB */
return(NULL);
}
int
do_findsym(
int argc,
char **argv )
{
unsigned long found;
struct symarray dummy;
char * errmsg;
if (argc == 1) {
XK_USAGE(argv[0]);
}
if ((found = fsym(argv[1], -1)) != NULL) {
if (argc >= 3) {
char buf[50];
sprintf(buf, "%s=0x%lx", argv[2], found);
env_set(buf);
}
else {
sprintf(xk_ret_buffer, "0x%lx", found);
xk_ret_buf = xk_ret_buffer;
}
}
else {
errmsg = strdup(GetSharedMsg(DT_UNDEF_SYMBOL));
printerrf(argv[0], errmsg, argv[1], NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
return(SH_SUCC);
}
#ifndef SPRINTF_RET_LEN
/*
* SYSTEM V sprintf() returns the length of the buffer, other versions
* of the UNIX System don't. So, if the SPRINTF_RET_LEN flag is not true,
* then we define an alternate function, lsprintf(), which has the SYSV
* behavior. Otherwise, lsprintf is #defined in exksh.h to be the
* same as sprintf.
*/
int
lsprintf(
char *buf,
char *fmt,
unsigned long arg1,
unsigned long arg2,
unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
unsigned long arg6,
unsigned long arg7 )
{
sprintf(buf, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
return(strlen(buf));
}
#endif

View File

@@ -0,0 +1,53 @@
/* $XConsortium: genlib.h /main/4 1995/11/01 15:55:32 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: genlib.h
**
** Project: CDE
**
** Description: Public include file for genlib.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_genlib_h
#define _Dtksh_genlib_h
#include "exksh.h"
extern struct libstruct *All_libs;
extern int xk_usage(
char *funcname) ;
extern unsigned long fsym(
char *str,
int lib) ;
extern int do_findsym(
int argc,
char **argv) ;
#ifndef SPRINTF_RET_LEN
extern int lsprintf(
char *buf,
char *fmt,
unsigned long arg1,
unsigned long arg2,
unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
unsigned long arg6,
unsigned long arg7) ;
#endif
#endif /* _Dtksh_genlib_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

5986
cde/programs/dtksh/ksh93.man Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
XCOMM $XConsortium: Imakefile /main/7 1996/05/09 17:33:38 drk $
LOCAL_LIBRARIES =
SRCS =
SUBCFLAGS = -O
UFLAGS = $(SUBCFLAGS)
ULDFLAGS =
#ifdef RsArchitecture
CCFLAGS = CCFLAGS=" "
#else
CCFLAGS =
#endif
#ifdef SunArchitecture
.NO_PARALLEL:
#endif /* SunArchitecture */
FORCE_SHIP = -E
MALLOCOBJ =
KSHSRC = ./src/cmd/ksh93
KSHLIBS = \
$(KSHSRC)/../../lib/libcmd/libcmd.a
KSH_OBJS = \
$(KSHSRC)/main.o \
$(KSHSRC)/timers.o \
$(KSHLIBS)
OBJS = $(KSH_OBJS) $(KSH_LIBS)
SUIDEXECDEFINES = \
-DPROFILEPATH=\"$(CDE_CONFIGURATION_TOP)/config/profile\" \
-DSUIDPROFILEPATH=\"$(CDE_CONFIGURATION_TOP)/config/suid_profile\" \
-DSUIDEXECPATH=\"$(CDE_INSTALLATION_TOP)/bin/suid_exec\" \
-DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\"
CCFLAGS = $(CDEBUGFLAGS) $(SUIDEXECDEFINES) $(STD_DEFINES) $(ANSI_DEFINES)
all:: ksh93src ksh93.o
XCOMM
XCOMM A temporary hack until we get Imakefiles in the base of ksh-93.
XCOMM
XCOMM We test for presense of /bin/ksh because on HP/UX there is a
XCOMM limitation in the size of environment variables that prevents the
XCOMM ksh-93 build scripts from functioning. That will be worked around
XCOMM in a near future release of ksh-93 as well, but then again this
XCOMM whole target will change anyway.
XCOMM
SHIP_DIR = ship
ALL_SUBS = *
ksh93src:
$(RM) $(SHIP_DIR)/$(ALL_SUBS)/$(ALL_SUBS)/BUILT; \
if [ -f /bin/ksh ]; \
then \
SHELL=/bin/ksh CC=$(CC) CCFLAGS="$(CCFLAGS)" /bin/ksh ship/shipin $(FORCE_SHIP); \
elif [ -f /bin/sh ]; \
then \
SHELL=/bin/sh CC=$(CC) CCFLAGS="$(CCFLAGS)" /bin/sh ship/shipin $(FORCE_SHIP); \
else \
SHELL="" CC=$(CC) CCFLAGS="$(CCFLAGS)" ship/shipin $(FORCE_SHIP); \
fi
ksh93.o: $(OBJS)
$(LD) -r -o $@ $(OBJS)
clobber:: clobmine
clobmine:
$(RM) -f libksh93.a
depend::
install::

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,351 @@
.\" $XConsortium: nval.3 /main/2 1995/07/17 14:27:24 drk $
.TH NVAL 3 "12 Nov 1992"
.PP
\fBNAME\fP
.PP
\fBnval\fR \- a \f5ksh\fP name/value library
.PP
\fBSYNOPSIS\fP
.ta .8i 1.6i 2.4i 3.2i 4.0i 4.8i
.PP
.nf
.ft 5
#include <nval.h>
Namval_t *nv_namset(const char *\fIname\fP, Hashtab_t *\fItable\fP, int \fItype\fP);
Namval_t *nv_search(const char *\fIname\fP, Hashtab_t *\fItable\fP, int \fItype\fP);
void nv_free(Namval_t *\fInp\fP);
char *nv_name(Namval_t *\fInp\fP);
char *nv_getval(Namval_t *\fInp\fP);
double nv_getnum(Namval_t *\fInp\fP);
void nv_putval(Namval_t *\fInp\fP, const char *\fIval\fP, int \fItype\fP);
Namfun_t *nv_stack(Namval_t *\fInp\fP, Namfun_t *\fIfp\fP);
char *nv_getv(Namval_t *\fInp\fP, Namfun_t *\fIfp\fP);
double nv_getn(Namval_t *\fInp\fP, Namfun_t *\fIfp\fP);
void nv_putv(Namval_t *\fInp\fP, const char *\fIval\fP, int \fItype\fP, Namfun_t *\fIfp\fP);
char *nv_settrap(Namval_t *\fInp\fP, const char *\fIe\fP, Namval_t *\fIa\fP, Namfun_t *\fIfp\fP);
Namval_t *nv_create(Namval_t *\fInp\fP, const char *\fIname\fP, Namfun_t *\fIfp\fP);
void nv_newtype(Namval_t *\fInp\fP, unsigned \fItype\fP, int \fIsize\fP);
unsigned nv_istype(Namval_t *\fInp\fP, unsigned \fItype\fP);
int nv_scan(Hashtab_t *\fItable\fP, void(*\fIfn\fP)(Namval_t*,int,int));
Namarr_t *nv_setarray(Namval_t *\fInp\fP,void*(*\fIfun\fP)(Namval_t*,const char*,int));
Namval_t *nv_putsub(Namval_t *\fInp\fP, char *\fIname\fP, long \fImode\fP);
char *nv_getsub(Namval_t *\fInp\fP);
int nv_nextsub(Namval_t *\fInp\fP);
int nv_aindex(Namval_t *\fInp\fP);
void nv_setref(Namval_t *\fInp\fP);
void nv_setvtree(Namval_t *\fInp\fP);
.fR
.fi
.PP
\fBDESCRIPTION\fP
.PP
\fINval\fP is a library of functions for interacting with name-value
pairs as used in \f5ksh\fP.
It is built on top an the extensible hashing library facility
in \f5libast\fP.
Each name-value pair is represented by a
type named \f5Namval_t\fP.
A \f5Namval_t\fP contains the name, value and
attributes of a variable.
The following attributes can be associated with a name-value pair:
.IP
\f5NV_EXPORT\fP:
The export attribute.
.IP
\f5NV_RDONLY\fP:
The readonly attribute.
.IP
\f5NV_LTOU\fP:
Lower case characters are converted to upper case characters.
.IP
\f5NV_UTOL\fP:
Upper case characters are converted to lower case characters.
.IP
\f5NV_RJUST\fP:
Right justify and blank fill.
This attribute has an associated size that defines the
string length of the value.
.IP
\f5NV_LJUST\fP:
Left justify and blank fill.
This attribute has an associated size that defines the
string length of the value.
.IP
\f5NV_ZFILL\fP:
Without \f5NV_LJUST\fP, right justifies and fills with leading zeros.
With \f5NV_LJUST\fP, left justify and strip leading zeros.
Left justify and blank fill.
This attribute has an associated size that defines the
string length of the value.
.IP
\f5NV_TAGGED\fP:
Indicates the tagged attribute.
.IP
\f5NV_INTEGER\fP:
Causes value to be represented by a number.
This attribute has an associated number that defines the
arithmetic base to be used when the value is expanded as a string.
.IP
\f5NV_DOUBLE\fP:
Used in conjunction with \f5NV_INTEGER\fP to cause value
to be stored as a double precision floating point number.
This attribute has an associated number that defines the
number of places after the decimal point to be used when
the value is expanded as a string.
.IP
\f5NV_EXPNOTE\fP:
Used in conjunction with \f5NV_INTEGER\fP and \f5NV_DOUBLE\fP to
cause the value to be represented in scientific notation when
expanded as a string.
This attribute has an associated number that defines the
the precision of the mantissa.
.IP
\f5NV_REF\fP:
The name-value pair is a name reference variable.
.PP
The function \f5nv_namset()\fP returns a pointer to a name-value
pair corresponding to the given \fIname\fP.
If a name-value pair by this name does not already exist, it is
created unless \fItype\fP contains the \f5NV_NOADD\fP flag.
If the first identifier in \fIname\fP is a reference and is not
preceded by a \fB.\fP,
it will be replaced by the value of the reference
to find the name of a variable.
Unless \fItype\fP contains the \f5NV_REF\fP flag,
if the name-value pair give by \fIname\fP has the \f5NV_REF\fP
attribute, it will be replaced by the variable whose name
is the value of this name-value pair.
Unless prohibited by the \fItype\fP argument,
the \f5name\fP variable can contain an \f5=\fP
and a value that will be assigned to the name-value pair.
The argument \fItable\fP defines the table to search.
A \f5NULL\fP value causes the shell variable table to be searched.
The \fItype\fP argument consists of the bitwise-or of zero or more
of the following and zero or more of the attributes listed above.
.IP
\f5NV_VARNAME\fP:
An invalid variable name causes an error.
.IP
\f5NV_IDENTIFIER\fP:
An variable name that is not an identifier causes an error.
.IP
\f5NV_NOASSIGN\fP:
The \f5name\fP argument cannot contain an assignment.
.IP
\f5NV_ARRAY\fP:
The \f5name\fP argument cannot contain a subscript.
.IP
\f5NV_REF\fP:
Do not follow references when finding the name-value pair.
.IP
\f5NV_NOADD\fP:
The name-value pair will not be added if it doesn't exist.
Instead a \f5NULL\fP pointer will be returned.
.IP
\f5NV_NOSCOPE\fP:
Only the top level scope is used.
.PP
The \f5nv_search()\fP function returns a pointer
pointer to the name-value pair corresponding to the given name.
The \fItable\fP argument must always be specified.
The \fItype\fP argument must either be \f50\fP or \f5NV_ADD\fP.
A value of \f50\fP causes a \f5NULL\fP pointer to be returned
if the name-value pair does not already exist, whereas the value
\f5NV_ADD\fP causes the name-value pair to be created if it
does not already exist.
There is no validity check performed on the \fIname\fP argument.
.PP
The \f5nv_name()\fP function returns the name of the given name-value
pair \fInp\fP.
The \f5nv_getval()\fP function returns the value of the given
name-value pair as a string. A \f5NULL\fP return value indicates
that the name-value pair is unset.
The \f5nv_getnum()\fP function returns the value of the given
name-value pair as a double precision number.
For name-value pairs without the \f5NV_INTEGER\fP attribute,
the string value is evaluated as an arithmetic expression to
arrive at a numerical value.
.PP
The \f5nv_putval()\fP function is used to assign a \fIvalue\fP to
the name-value pair \fInp\fP.
The \fItype\fP argument consists zero or more of the bitwise-or
of \f5NV_INTEGER\fP and \f5NV_RDONLY\fP.
The presence of \f5NV_RDONLY\fP allows the assignment to occur
even if the name-value pair has the \f5NV_RDONLY\fP attribute.
The presence of \f5NV_INTEGER\fP indicates that the \fIvalue\fP
argument is actually a pointer to a double precision number
containing the value for this name-value pair.
In all cases, a copy of the value is stored as the value for
\fInp\fP.
.PP
The \f5nv_istype()\fP function can test whether or not any of
the attributes given by \fItype\fP is set.
The attribute \f5NV_ARRAY\fP can be used to test whether
or not the given name-value pair is an array.
The \f5nv_newtype()\fP function can be used to change the
attributes of the given name-value pair.
The \fIsize\fP argument is needed for attributes that require
an additional argument.
Changing the attribute may require changing the value
to agree with the new type.
For an array variable, each of the values will be changed.
.PP
A user can intercept the lookup and assignment operations by
supplying their own discipline.
A discipline is a set of functions that override the getting
and putting of values to a name-value pair.
A discipline is defined by the type
\f5Namfun_t\fP which contains the following public fields:
.nf
\f5void (*putval)();\fP
\f5char *(*getval)();\fP
\f5double (*getnum)();\fP
\f5char (*settrap)();\fP
\f5Namval_t (*create)();\fP
.fi
To create a discipline, a user creates an instance of the type
\f5Namfun_t\fP and assigns functions to one or more of these
fields. The remaining fields must be \f50\fP.
The instance must be at the beginning of a structure that contains
additional fields that are used within the discipline functions.
The discipline is installed or removed with the
\f5nv_stack()\fP function.
The \fIgetval\fP\f5()\fP discipline function is called with a pointer
to the name-value pair, \fInp\fP, and a pointer to the discipline,
\fIfp\fP.
Inside the \fIgetval\fP\f5()\fP function, the \f5nv_get()\fP function
can be used to get the value of the name-value pair that
would have resulted if the discipline were not used.
The \fIgetnum()\fP discipline is called whenever a numerical
value is needed for the name-value pair \fInp\fP.
The \fIputval\fP\f5()\fP discipline function is used to
override the assignment of values
to a name-value pair. When a name-value pair is unset, \fIputval\fP\f5()\fP
is called with \fIvalue\fP set to \f5NULL\fP.
The \f5nv_putv()\fP function is used within the \fIputval\fP\f5()\fP
to perform the assignment that would have occurred
if the discipline has not been installed.
.PP
The \fIcreate\fP\f5()\fP discipline function is called from
\f5nv_namset\fP\f5()\fP when the name-value pair for name containing a
.B \s+2.\s-2
doesn't exist.
This function is passed the name-value pointer of the longest
parent name-value pair that exists, plus the remaining string.
The \fIcreate\fP\f5()\fP discipline function
must return the created name-value pair, otherwise the default action
will be taken.
The \f5nv_create()\fP function may be called within
the \fIcreate\fP\f5()\fP
discipline function
to perform the action that would have occurred
by an earlier discipline.
.PP
The \fIsettrap\fP\f5()\fP discipline function is used in conjunction with
user defined discipline shell functions whose are of the form
\fIvarname\fP\f5.\fP\fIevent\fP.
Whenever a function whose name is of the form \fIvarname\fP\f5.\fP\fIevent\fP,
is defined the \fIsettrap\fP\f5()\fP function is invoked with the same
argument format as \f5nv_settrap\fP\f5()\fP.
If the given event \fIe\fP is known by this discipline,
then the value of the action associated without the event should be returned.
Otherwise, this discipline function
should return the value of \f5nv_settrap()\fP. The \f5nv_settrap()\fP invokes
earlier disciplines to find the given event.
If the event \fIe\fP is NULL, the \fIsettrap\fP\f5()\fP must return the
name of the trap that follows the event name given by
\fIa\fP. If \fIa\fP is also NULL, the name of the first event
must be returned.
.PP
The \f5nv_scan()\fP function is used to walk through
all name-value pairs in the table given by \fItable\fP.
If \fIfn\fP is non-zero, then this function will be executed
for each name-value pair in the table.
The number of elements in the table will be returned.
.PP
The \f5nv_aindex()\fP function returns
the current index for
the indexed array given by the name-value pair pointer \fInp\fP.
The return value is negative if \fInp\fP refers to
an associative array.
.PP
The \f5nv_setarray()\fP function is used to create an associative array
from a name-value pair node.
The function \fIfun\fP defines the semantics of the associative
array.
Using \fIfun\fP equal to \f5nv_associative()\fP implements the default
associative array semantics
that is used with \f5typeset\ -A\fP.
This function \fIfun\fP will be called with third argument as follows:
.IP
\f5NV_AINIT\fP:
This will be called at initialization.
The function you supply must return a pointer to a structure
that contains the type \f5Namarr_t\fP as the first element.
All other calls receive this value as an argument.
.IP
\f5NV_AFREE\fP:
This will be called after all elements of the name-value pair have been
deleted and the array is to be freed.
.IP
\f5NV_ADELETE\fP:
The current element should be deleted.
.IP
\f5NV_ANEXT\fP:
This means that the array subscript should be advanced to the
next subscript. A \f5NULL\fP return indicates that there are
no more subscripts.
.IP
\f5NV_ANAME\fP:
The name of the current subscript must be returned.
.PP
If \fInp\fP refers to an array,
the \f5nv_getsub()\fP returns a pointer to
the name of the current subscript.
Otherwise, \f5nv_subscript()\fP
returns \f5NULL\fP.
.PP
The \f5nv_putsub()\fP function is used to
set the subscript for the next reference to \f5np\fP.
If the \f5name\fP argument is not \f5NULL\fP,
it defines the value of the next subscript.
The \f5mode\fP argument can contain one or more of the following flags:
.IP
\f5ARRAY_ADD\fP:
Add the subscript if not found.
Otherwise, \f5nv_putsub()\fP returns \f5NULL\fP if the
given subscript is not found.
.IP
\f5ARRAY_SCAN\fP:
Begin a walk through the subscripts starting at the subscript
given by \f5name\fP if given. Otherwise,
the walk is started from the beginning.
The \f5nv_nextsub()\fP function is used to advance to the
next subscript.
It returns 0 if there are no more subscripts or if called
when not in a scan.
.IP
\f5ARRAY_UNDEF\fP:
This causes any current scan to terminate and leaves the
subscript in an undefined state.
.PP
If \f5ARRAY_ADD\fP is not given and the subscript
does not exist, a \f5NULL\fP value is returned.
.PP
The \f5nv_setref()\fP function makes the name-value pair \f5np\fP
into a reference to the variable whose name is given by
the value of \f5np\fP.
.PP
The \f5nv_setvtree()\fP function makes the name-value pair \f5np\fP
into a tree structured variable so that \f5nv_getval()\fP
will return a string containing all the names and values of
children nodes in a format that can be used in
a shell compound assignment.
.PP
\fBAUTHOR\fP
David G. Korn (dgk@research.att.com).

View File

@@ -0,0 +1,154 @@
/* $XConsortium: README /main/2 1996/07/15 14:13:29 drk $ */
Software shipment information. [better documentation forthcoming ...]
All files and directories, except for those in /usr/spool/uucppublic,
are rooted at the shipment/installation directory named by
$INSTALLROOT. The $INSTALLROOT hierarchy is similar to the System V
/usr hierarchy.
The $INSTALLROOT/ship subdirectory is automatically maintained by
shipin and shipout. If you expect to receive future shipments then
do not change files in this directory.
pax is the Bell Labs implementation of the proposed POSIX (01/90)
portable archive interchange command. The default output format is
`cpio -c'. The pax delta format is a Bell Labs extension.
The following assumes:
INSTALLROOT=<path name of software installation root directory>
After each shipment:
<follow specific shipment instructions>
cd $INSTALLROOT
ship/shipin
`ship/shipin -n' shows actions but does not unbundle or build.
`ship/shipin -s <dir>' unbundles from <dir> rather than /usr/spool/uucppublic.
`ship/shipin -u' unbundles the shipment but does not build.
`ship/shipin -i' copies from spool area but does not unbundle or build.
`ship/shipin -E' rebuild components that failed last time (use after fixes).
Any non-option arguments to shipin are passed as arguments to the
generating make or shell script for each component.
To pass the shipment to another machine (requires ksh):
# rcp # TO=host:ship
# uucp # TO=machine!user
# list of files # TO=%list
# remote dk pull script # TO=%pull
cd $INSTALLROOT
ship/shipin -i # if not installed on this machine
cd ship
shipout $TO
{rcp,uucp} initiate copies whereas {list,pull} generate information on
stdout. {uucp} copies to an intermediate spool area on the other machine
whereas {rcp,list,pull} are relative to $INSTALLROOT on the other machine.
To copy a command <cmd> from $INSTALLROOT to a new root you must copy:
$INSTALLROOT/bin/<cmd>
$INSTALLROOT/lib/<cmd>
to the new root directory for all interdependent <cmd>'s. Depending on
<cmd>, only one of the above files/directories may exist.
Be sure to maintain a different $INSTALLROOT for each machine architecture.
If the same $INSTALLROOT/ship must be reused for a different architecture
then delete everything except ship from $INSTALLROOT and run ship/shipin -F.
An alternative would be to use nmake and optionally 3d to viewpath a new
architecture hierarchy on top of $INSTALLROOT. In this case nmake would
be run from within the $INSTALLROOT/src/(cmd|lib) hierarchy.
The files below may appear on the shipment side, the installation side,
or both. <installer-login> and <shipper-system> are defined in the
shipment mail announcement.
Each shipment is identified by a two part version number [R]YYMMDD
R release -- if specified then it must match for compatibility
YYMMDD shipment year, month and day number
/usr/spool/uucppublic/<installer-login>/<shipper-system> directory hierarchy:
<shipper-login>.<YYMMDD> shipment control directory
<shipper-login>.<YYMMDD>/manifest list of all files in shipment
$INSTALLROOT directory hierarchy:
bin/ executable binaries and scripts
include/ common header files
lib/ object archives a common data
man/ man page subtree
man1/ command man pages
man3/ library man pages
man8/ adminstration and maintenance man pages
src/ source subtree
cmd/ command source
lib/ library source
ship/ shipment and installation info
$INSTALLROOT/ship contents:
README installation info
!<mach_user> shipment installation message for machine!user
ship.body optional shipment announcement main body
ship.head optional shipment announcement header
ship.tail optional shipment announcement trailer
shipcost show relative cost of delta/update shipment
shipcrate crate all components for shipout
shipin unbundle, build and install shipment
shiplist shipout using name-tool list
shipop shipin/shipout support executable
shipout split and send shipment
shipslog shipment log and recipient address info
shipswab clean old stuff from the ship area
shipyard shipment support tools component name
lib* library components
* command components
$INSTALLROOT/ship/<component> contents:
<[R]YYMMDD> information for the <[R]YYMMDD> shipment
base link to the newest pax base archive
delta link to the newest pax delta archive
in.log shipin log
items required components (excluding this one)
list optional list of persons to send to
message optional message to include in shipment announcement
owner mail address for installation report
release the the current shipment release number
report optional list of $INSTALLROOT relative files to report
$INSTALLROOT/ship/<component>/<[R]YYMMDD> contents:
<[R]YYMMDD> pax delta archive for ../[R]YYMMDD/base
<[R]YYMMDD>.<NNN> delta archive split for uucp
BUILT present if release build succeeded
ERROR present if release build failed
GENERATED present if base archive was generated from a delta
UNCRATED present if release uncrate succeeded
base pax base archive
base.<NNN> base archive split for uucp
items items for this release
message message for this release
owner owner for this release
report report for this release
Each component $NAME is extracted into either $INSTALLROOT/src/lib/$NAME
or $INSTALLROOT/src/cmd/$NAME. The following are attempted, in order,
to build and install $NAME under $INSTALLROOT:
$INSTALLROOT/bin/nmake -f Makefile install
mamexec install < Mamfile # mamexec is built into ship/shipin
make -f makefile install
sh Makescript
where Mamfile, Makescript and makefile are usually generated from the
corresponding nmake Makefile.
Glenn Fowler ulysses!gsf
David Korn ulysses!dgk

View File

@@ -0,0 +1,5 @@
AT&T Bell Laboratories
Advanced Software Technology Department
{ulysses,attmail}!dgk
dgk@ulysses.att.com
David Korn 908-582-7975

View File

@@ -0,0 +1 @@
libcmd libast

View File

@@ -0,0 +1 @@
liszt!easy!liszt!easy!usl!att!gryphon!dgk

View File

@@ -0,0 +1,5 @@
AT&T Bell Laboratories
Advanced Software Technology Department
{ulysses,attmail}!dgk
dgk@ulysses.att.com
David Korn 908-582-7975

View File

@@ -0,0 +1 @@
libcmd libast

View File

@@ -0,0 +1 @@
liszt!easy!liszt!easy!usl!att!gryphon!dgk

View File

@@ -0,0 +1,5 @@
AT&T Bell Laboratories
Advanced Software Technology Department
{research,attmail}!dgk
dgk@research.att.com
David Korn 908-582-7975

View File

@@ -0,0 +1 @@
libcmd libast

View File

@@ -0,0 +1,32 @@
The is the fourth point release for ksh-93. The RELEASEa
file contains a list of changes since the first release for ksh-93.
The file RELEASE lists the major changes since ksh-88. I have updated
the man page, sh.1, and the introductory memo, sh.memo. I have also
started to write a guideline for adding runtime builtins, builtins.mm.
This release should correspond very closely to the information in the
New KornShell Command and Programming Language book, by Bolsky
and Korn.
This official release is being distributed and supported by the
Software Technology Center. They are the distributor of
ksh93 within AT&T and will provide support. I will only be
supplying ksh93 for research needs and for machine architectures
that are not supported by the Software Technology Center.
You can contact the STC by sending mail to ksh@mozart.att.com.
I have fixed most of the bugs that have been reported in
the previous release. Let me know about any remaining bugs.
There continues to be very few reports of compatibility
problems. The file COMPATIBILITY lists the known incompatibilities.
Please let me know about any script which runs under ksh-88 but
does not run under ksh-93.
Please look at the man page (troff -man) and the sh.memo
file (troff -mm) and let me know what problems you find.
I encourage you to run ksh -n script on each of your scripts
since the -n option produces warning messages for obsolete
features that you are using in the script. The file
OBSOLETE, written by Kevin Wall, contains a list of
obsolete features.

View File

@@ -0,0 +1 @@
dgk

View File

@@ -0,0 +1,146 @@
.SA 1
.sp 2
.H 1 "KSH-93 - The KornShell Command and Programming Language"
.sp 2
.al
.P
KSH-93 is the most recent version of the KornShell Language
described in
"The KornShell Command and Programming Language,"
by Morris Bolsky and David Korn of AT&T Bell Laboratories.
The KornShell is a shell programming language,
which is upward compatible with "sh" (the Bourne Shell),
and is intended to conform to the IEEE P1003.2/ISO 9945.2 Shell and
Utilities standard.
KSH-93 provides an enhanced programming environment in
addition to the major command-entry features of the BSD
shell "csh". With KSH-93, medium-sized programming tasks can be
performed at shell-level without a significant loss in performance.
In addition, "sh" scripts can be run on KSH-93 without modification.
.P
The code should conform to the IEEE POSIX 1003.1 standard and to the
proposed ANSI-C standard so that it should be portable to all
such systems. Like the previous version, KSH-88,
it is designed to accept eight bit character sets
transparently, thereby making it internationally compatible.
It can support multi-byte characters sets with some characteristics
of the character set given at run time.
.P
KSH-93 provides the following features, many of which were also inherent
in KSH-88:
.BL
.LI
Enhanced Command Re-entry Capability: The KSH-93 history
function records commands entered at any shell level and stores
them, up to a user-specified limit, even after you log off.
This allows you to re-enter long commands with a few keystrokes
- even those commands you entered yesterday.
The history file allows for eight bit characters in
commands and supports essentially unlimited size histories.
.LI
In-line Editing: In "sh", the only way to fix mistyped
commands is to backspace or retype the line. KSH-93 allows you
to edit a command line using a choice of EMACS-TC or "vi"
functions.
You can use the in-line editors to complete filenames as
you type them.
You may also use this editing feature when entering
command lines from your history file.
A user can capture keystrokes and rebind keys to customize the
editing interface.
.LI
Extended I/O Capabilities: KSH-93 provides several I/O
capabilities not available in "sh", including the ability to:
.BL
.LI
specify a file descriptor for input and output
.LI
start up and run co-processes
.LI
produce a prompt at the terminal before a read
.LI
easily format and interpret responses to a menu
.LI
echo lines exactly as output without escape processing
.LI
format output using printf formats.
.LI
read and echo lines ending in "\e".
.LE
.LI
Improved performance: KSH-93 executes many scripts faster
than the System V Bourne shell. A major reason for this is
that many of the standard utilities are built-in.
To reduce the time to initiate a command, KSH-93 allows
commands to be added as built-ins at run time
on systems that support dynamic loading such as System V Release 4.
.LI
Arithmetic: KSH-93 allows you to do integer arithmetic in any
base from two to sixty-four. You can also do double
precision floating point arithmetic.
Almost the complete set of C language operators are available
with the same syntax and precedence.
Arithmetic expressions can be used to as an argument expansion
or as a separate command.
In addition there is an arithmetic for command that works
like the for statement in C.
.LI
Arrays: KSH-93 supports both indexed and associative arrays.
The subscript for an indexed array is an arithmetic expression,
whereas, the subscript for an associative array is a string.
.LI
Shell Functions and Aliases: Two mechanisms - functions and
aliases - can be used to assign a user-selected identifier to
an existing command or shell script.
Functions allow local variables and provide scoping
for exception handling.
Functions can be searched for and loaded on first reference the
way scripts are.
.LI
Substring Capabilities: KSH-93 allows you to create a
substring of any given string either by specifying the starting
offset and length, or by stripping off leading
or trailing substrings during parameter substitution.
You can also specify attributes, such as upper and lower case,
field width, and justification to shell variables.
.LI
More pattern matching capabilities: KSH-93 allows you to specify
extended regular expressions for file and string matches.
.LI
KSH-93 uses a hierarchal name space for variables.
Compound variables can be defined and variables can
be passed by reference. In addition, each variable
can have one or more disciplines associated with
it to intercept assignments and references.
.LI
Improved debugging: KSH-93 can generate line numbers on execution
traces. Also, I/O redirections are now traced.
There is a DEBUG trap that gets evaluated after each command
so that errors can be localized.
.LI
Job Control: On systems that support job control, including
System V Release 4, KSH-93
provides a job-control mechanism almost identical to that of
the BSD "csh", version 4.1.
This feature allows you
to stop and restart programs, and to move programs between the
foreground and the background.
.LI
Added security:
KSH-93 can execute scripts which do not have read permission
and scripts which have the setuid and/or setgid set when
invoked by name, rather than as an argument to the shell.
It is possible to log or control the execution of setuid and/or
setgid scripts.
The noclobber option prevents you from accidentally erasing
a file by redirecting to an existing file.
.LI
KSH-93 can be extended by adding built-in commands at run time.
In addition, KSH-93 can be used as a library that can
be embedded into an application to allow scripting.
.LE
Documentation for KSH-93 consists of an "Introduction to KSH-93",
"Compatibility with the Bourne Shell" and a manual page and a
README file. In addition, the "New KornShell Command and Programming
Language," book is available from Prentice Hall.

View File

@@ -0,0 +1,5 @@
src/cmd/ksh93/FEATURE/options
src/cmd/ksh93/FEATURE/ttys
src/cmd/ksh93/FEATURE/dymamic
src/cmd/ksh93/FEATURE/externs
src/cmd/ksh93/FEATURE/poll

View File

@@ -0,0 +1,5 @@
AT&T Bell Laboratories
Advanced Software Technology Department
{ulysses,attmail}!dgk
dgk@ulysses.att.com
David Korn 908-582-7975

View File

@@ -0,0 +1,6 @@
type=proprietary
corporation=AT&T
company="Bell Laboratories"
organization="Software Engineering Research Department"
license=http://www.research.att.com/orgs/ssr/book/reuse
contact=gsf@research.att.com

View File

@@ -0,0 +1 @@
gsf

View File

@@ -0,0 +1,5 @@
AT&T Bell Laboratories
Software Engineering Research Department
advsoft@research.att.com
Randy Hackbarth 908-582-5245
Dave Belanger 908-582-7427

View File

@@ -0,0 +1 @@
liszt!easy!liszt!easy!usl!att!gryphon!gsf

Some files were not shown because too many files have changed in this diff Show More