14c8945a0SNathan Whitehorn#! /bin/sh 2*a96ef450SBaptiste Daroussin# $Id: form2,v 1.12 2020/11/26 00:33:02 tom Exp $ 34c8945a0SNathan Whitehorn 44c8945a0SNathan Whitehorn. ./setup-vars 54c8945a0SNathan Whitehorn 64c8945a0SNathan Whitehornbacktitle="An Example for the use of --form:" 74c8945a0SNathan Whitehorn 84c8945a0SNathan Whitehornids=`id|sed -e 's/([^)]*)//g'` 94c8945a0SNathan Whitehornuid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` 104c8945a0SNathan Whitehorngid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` 114c8945a0SNathan Whitehorn 124c8945a0SNathan Whitehornuser="$USER" 134c8945a0SNathan Whitehornhome="$HOME" 144c8945a0SNathan Whitehorn 154c8945a0SNathan Whitehornreturncode=0 164c8945a0SNathan Whitehornwhile test $returncode != 1 && test $returncode != 250 174c8945a0SNathan Whitehorndo 184c8945a0SNathan Whitehornexec 3>&1 19*a96ef450SBaptiste Daroussinreturntext=`$DIALOG --ok-label "Submit" \ 204c8945a0SNathan Whitehorn --backtitle "$backtitle" "$@" \ 214c8945a0SNathan Whitehorn --form "Here is a possible piece of a configuration program." \ 224c8945a0SNathan Whitehorn0 0 10 \ 234c8945a0SNathan Whitehorn "1 Username:" 1 1 "$user" 1 12 10 10 \ 244c8945a0SNathan Whitehorn "1 UID:" 2 1 "$uid" 2 12 10 10 \ 254c8945a0SNathan Whitehorn "1 GID:" 3 1 "$gid" 3 12 10 10 \ 264c8945a0SNathan Whitehorn "1 HOME:" 4 1 "$home" 4 12 10 10 \ 274c8945a0SNathan Whitehorn "2 Username:" 5 1 "$user" 5 12 10 10 \ 284c8945a0SNathan Whitehorn "2 UID:" 6 1 "$uid" 6 12 10 10 \ 294c8945a0SNathan Whitehorn "2 GID:" 7 1 "$gid" 7 12 10 10 \ 304c8945a0SNathan Whitehorn "2 HOME:" 8 1 "$home" 8 12 10 10 \ 314c8945a0SNathan Whitehorn "3 Username:" 9 1 "$user" 9 12 10 10 \ 324c8945a0SNathan Whitehorn "3 UID:" 10 1 "$uid" 10 12 10 10 \ 334c8945a0SNathan Whitehorn "3 GID:" 11 1 "$gid" 11 12 10 10 \ 344c8945a0SNathan Whitehorn "3 HOME:" 12 1 "$home" 12 12 10 10 \ 354c8945a0SNathan Whitehorn "4 Username:" 13 1 "$user" 13 12 10 10 \ 364c8945a0SNathan Whitehorn "4 UID:" 14 1 "$uid" 14 12 10 10 \ 374c8945a0SNathan Whitehorn "4 GID:" 15 1 "$gid" 15 12 10 10 \ 384c8945a0SNathan Whitehorn "4 HOME:" 16 1 "$home" 16 12 10 10 \ 394c8945a0SNathan Whitehorn "5 Username:" 17 1 "$user" 17 12 10 10 \ 404c8945a0SNathan Whitehorn "5 UID:" 18 1 "$uid" 18 12 10 10 \ 414c8945a0SNathan Whitehorn "5 GID:" 19 1 "$gid" 19 12 10 10 \ 424c8945a0SNathan Whitehorn "5 HOME:" 20 1 "$home" 20 12 10 10 \ 434c8945a0SNathan Whitehorn "6 Username:" 21 1 "$user" 21 12 10 10 \ 444c8945a0SNathan Whitehorn "6 UID:" 22 1 "$uid" 22 12 10 10 \ 454c8945a0SNathan Whitehorn "6 GID:" 23 1 "$gid" 23 12 10 10 \ 464c8945a0SNathan Whitehorn "6 HOME:" 24 1 "$home" 24 12 10 10 \ 474c8945a0SNathan Whitehorn "7 Username:" 25 1 "$user" 25 12 10 10 \ 484c8945a0SNathan Whitehorn "7 UID:" 26 1 "$uid" 26 12 10 10 \ 494c8945a0SNathan Whitehorn "7 GID:" 27 1 "$gid" 27 12 10 10 \ 504c8945a0SNathan Whitehorn "7 HOME:" 28 1 "$home" 28 12 10 10 \ 514c8945a0SNathan Whitehorn2>&1 1>&3` 524c8945a0SNathan Whitehornreturncode=$? 534c8945a0SNathan Whitehornexec 3>&- 544c8945a0SNathan Whitehorn 55*a96ef450SBaptiste Daroussinshow=`echo "$returntext" |sed -e 's/^/ /'` 564c8945a0SNathan Whitehorn 574c8945a0SNathan Whitehorn case $returncode in 584c8945a0SNathan Whitehorn $DIALOG_CANCEL) 594c8945a0SNathan Whitehorn "$DIALOG" \ 604c8945a0SNathan Whitehorn --clear \ 614c8945a0SNathan Whitehorn --backtitle "$backtitle" \ 624c8945a0SNathan Whitehorn --yesno "Really quit?" 10 30 634c8945a0SNathan Whitehorn case $? in 644c8945a0SNathan Whitehorn $DIALOG_OK) 654c8945a0SNathan Whitehorn break 664c8945a0SNathan Whitehorn ;; 674c8945a0SNathan Whitehorn $DIALOG_CANCEL) 684c8945a0SNathan Whitehorn returncode=99 694c8945a0SNathan Whitehorn ;; 704c8945a0SNathan Whitehorn esac 714c8945a0SNathan Whitehorn ;; 724c8945a0SNathan Whitehorn $DIALOG_OK) 734c8945a0SNathan Whitehorn "$DIALOG" \ 744c8945a0SNathan Whitehorn --clear \ 754c8945a0SNathan Whitehorn --backtitle "$backtitle" --no-collapse --cr-wrap \ 764c8945a0SNathan Whitehorn --msgbox "Resulting data:\n\ 774c8945a0SNathan Whitehorn$show" 0 0 784c8945a0SNathan Whitehorn ;; 794c8945a0SNathan Whitehorn *) 80*a96ef450SBaptiste Daroussin . ./report-button 814c8945a0SNathan Whitehorn exit 824c8945a0SNathan Whitehorn ;; 834c8945a0SNathan Whitehorn esac 844c8945a0SNathan Whitehorndone 85