Listing 2. Simple DtKsh GUI Application
#!/usr/dt/bin/dtksh
editCB()
{
dtaction Compose $FILE
}
main()
{
XtInitialize TOPLEVEL dtSend DtSend "$@"
DtDbLoad
DtDtsFileToAttributeValue DESC $FILE \
"DESCRIPTION"
XmCreateMessageDialog SEND $TOPLEVEL motd \
dialogTitle:"DtSend" \
helpLabelString:"Email" \
messageString:"${DESC}"
XmMessageBoxGetChild CANCEL $SEND \
DIALOG_CANCEL_BUTTON
XtUnmanageChild $CANCEL
XtAddCallback $SEND okCallback exit
XtAddCallback $SEND helpCallback editCB
XtManageChild $SEND
XtMainLoop
}
if [ $# -eq 1 ]; then
FILE=$1
else
FILE="/etc/motd"
fi
Copyright © 1994 - 2018 Linux Journal. All rights reserved.