#!/bin/ksh # Description : set hpterm softkeys ################################################################ # This is an unpublished work containing 3M confidential and # proprietary information. disclosure, use or reproduction # without the written authorization of 3M is prohibited. If # publication occurs, the following notice applies: # # Copyright (C) 1992-1997, by 3M. All rights reserved. # # Program Name : $Source: /home/dam/glossary/RCS/ksh,v $ # Version : $Revision: 1.19 $ # Date Created : Thu Jul 7 10:16:24 CDT 1994 # Author : Dan A. Mercer # Last Modified : $Date: 99/06/28 10:19:32 $ # Modified By : $Author: dam $ # # Description : set hpterm softkeys ################################################################ X=${0##*/} F="Format: $X [" typeset -L${#F} sl=" " function help { msg="${@:-set hpterm softkeys} Format: $X [-hnvx] -k keyno -l label -s string ${sl}-h this message ${sl}-n don't activate keys ${sl}-v output version info ${sl}-x debug mode ${sl}-k keyno key to program - 1-16 ${sl}-l label label for key ${sl}-s string string to output " print -- "$msg" exit 1 } function die { print -- "$@" exit 1 } typeset -i10 activate=1 typeset -i10 key=0 typeset -L16 label while getopts :hnvxk:l:s: opt do case $opt in h) help;; n) activate=0;; v) ident $0;exit;; x) set -x;typeset -ft $(typeset +f);PS4='$LINENO: ';; k) [[ $OPTARG = +([[:digit:]]) ]] || die "-k $OPTARG non-numeric key" key=$OPTARG;; l) label=$OPTARG;; s) string=$OPTARG;; :) help "Option ${OPTARG} is missing it's argument";; ?) help "Invalid option ${OPTARG}";; esac done shift OPTIND-1 (((key < 1) || (key > 16))) && die "key value from 1 to 16 required" [[ -z $label ]] && die "key label required" [[ -z $string ]] && die "key string required" print -n -- "\033&f0a${key}k${#label}d${#string}L${label}${string}" ((activate)) && print -n -- "\033&jB"