1217309Snwhitehorn#! /bin/sh 2217309Snwhitehorn# $Id: form6,v 1.5 2010/01/13 10:49:52 tom Exp $ 3217309Snwhitehorn# form4 with --help-status 4217309Snwhitehorn 5217309Snwhitehorn. ./setup-vars 6217309Snwhitehorn 7217309Snwhitehornbacktitle="An Example for the use of --form:" 8217309Snwhitehorn 9217309Snwhitehornids=`id|sed -e 's/([^)]*)//g'` 10217309Snwhitehornuid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` 11217309Snwhitehorngid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` 12217309Snwhitehorn 13217309Snwhitehornuser="$USER" 14217309Snwhitehornhome="$HOME" 15217309Snwhitehorn 16217309Snwhitehornreturncode=0 17217309Snwhitehornwhile test $returncode != 1 && test $returncode != 250 18217309Snwhitehorndo 19217309Snwhitehornexec 3>&1 20217309Snwhitehornvalue=`$DIALOG --ok-label "Submit" \ 21217309Snwhitehorn --help-status \ 22217309Snwhitehorn --help-button \ 23217309Snwhitehorn --item-help \ 24217309Snwhitehorn --backtitle "$backtitle" "$@" \ 25217309Snwhitehorn --form "Here is a possible piece of a configuration program." \ 26217309Snwhitehorn20 50 0 \ 27217309Snwhitehorn "Username:" 1 1 "$user" 1 10 -9 9 "Login name" \ 28217309Snwhitehorn "UID:" 2 1 "$uid" 2 10 8 0 "User ID" \ 29217309Snwhitehorn "GID:" 3 1 "$gid" 3 10 8 0 "Group ID" \ 30217309Snwhitehorn "HOME:" 4 1 "$home" 4 10 40 0 "User's home-directory" \ 31217309Snwhitehorn2>&1 1>&3` 32217309Snwhitehornreturncode=$? 33217309Snwhitehornexec 3>&- 34217309Snwhitehorn 35217309Snwhitehornshow=`echo "$value" |sed -e 's/^/ /'` 36217309Snwhitehorn 37217309Snwhitehorn case $returncode in 38217309Snwhitehorn $DIALOG_CANCEL) 39217309Snwhitehorn "$DIALOG" \ 40217309Snwhitehorn --clear \ 41217309Snwhitehorn --backtitle "$backtitle" \ 42217309Snwhitehorn --yesno "Really quit?" 10 30 43217309Snwhitehorn case $? in 44217309Snwhitehorn $DIALOG_OK) 45217309Snwhitehorn break 46217309Snwhitehorn ;; 47217309Snwhitehorn $DIALOG_CANCEL) 48217309Snwhitehorn returncode=99 49217309Snwhitehorn ;; 50217309Snwhitehorn esac 51217309Snwhitehorn ;; 52217309Snwhitehorn $DIALOG_OK) 53217309Snwhitehorn "$DIALOG" \ 54217309Snwhitehorn --clear \ 55217309Snwhitehorn --backtitle "$backtitle" --no-collapse --cr-wrap \ 56217309Snwhitehorn --msgbox "Resulting data:\n\ 57217309Snwhitehorn$show" 10 40 58217309Snwhitehorn ;; 59217309Snwhitehorn $DIALOG_HELP) 60217309Snwhitehorn "$DIALOG" \ 61217309Snwhitehorn --clear \ 62217309Snwhitehorn --backtitle "$backtitle" --no-collapse --cr-wrap \ 63217309Snwhitehorn --msgbox "Help data:\n\ 64217309Snwhitehorn$show" 10 40 65217309Snwhitehorn ;; 66217309Snwhitehorn *) 67217309Snwhitehorn echo "Return code was $returncode" 68217309Snwhitehorn exit 69217309Snwhitehorn ;; 70217309Snwhitehorn esac 71217309Snwhitehorndone 72