1*19718649SNathan Whitehorn#! /bin/sh
2*19718649SNathan Whitehorn# $Id: inputmenu-stdout,v 1.13 2012/07/06 18:11:12 tom Exp $
34c8945a0SNathan Whitehorn# 2002 - written by Tobias Rittweiler <[email protected]>
44c8945a0SNathan Whitehorn
54c8945a0SNathan Whitehorn. ./setup-vars
64c8945a0SNathan Whitehorn
7*19718649SNathan Whitehornuser="$USER"
8*19718649SNathan Whitehornuid=`id|sed -e 's/^uid=//' -e 's/(.*//'`
94c8945a0SNathan Whitehorngid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'`
104c8945a0SNathan Whitehornhome="$HOME"
11*19718649SNathan Whitehorn
124c8945a0SNathan Whitehornwhile [ ${returncode:-99} -ne 1 -a ${returncode:-99} -ne 250 ]; do
134c8945a0SNathan Whitehorn	value=`$DIALOG \
14*19718649SNathan Whitehorn		--stdout --clear --ok-label "Create" \
15*19718649SNathan Whitehorn		--backtitle "An Example for the use of --inputmenu:" "$@" \
164c8945a0SNathan Whitehorn		--inputmenu "Originally I designed --inputmenu for a \
174c8945a0SNathan Whitehornconfiguration purpose. Here is a possible piece of a configuration program. \
184c8945a0SNathan Whitehorn" 20 50 10 \
19*19718649SNathan Whitehorn"Username:" "$user" \
204c8945a0SNathan Whitehorn"UID:"      "$uid" \
214c8945a0SNathan Whitehorn"GID:"      "$gid" \
224c8945a0SNathan Whitehorn"HOME:"     "$home" \
234c8945a0SNathan Whitehorn`
244c8945a0SNathan Whitehorn	returncode=$?
254c8945a0SNathan Whitehorn	case $returncode in
264c8945a0SNathan Whitehorn	$DIALOG_CANCEL)
27*19718649SNathan Whitehorn		"$DIALOG" \
284c8945a0SNathan Whitehorn			--clear --backtitle "An Example for the use of --inputmenu:" \
294c8945a0SNathan Whitehorn			--yesno "Really quit?" 10 30
304c8945a0SNathan Whitehorn		case $? in
314c8945a0SNathan Whitehorn		$DIALOG_OK) break;;
324c8945a0SNathan Whitehorn		$DIALOG_CANCEL) returncode=99;;
334c8945a0SNathan Whitehorn		esac
344c8945a0SNathan Whitehorn		;;
35*19718649SNathan Whitehorn	$DIALOG_OK)
36*19718649SNathan Whitehorn		"$DIALOG" \
37*19718649SNathan Whitehorn			--clear --backtitle "An Example for the use of --inputmenu:"  \
384c8945a0SNathan Whitehorn			--msgbox "useradd \n\
394c8945a0SNathan Whitehorn				-d $home \n\
404c8945a0SNathan Whitehorn				-u $uid \n\
414c8945a0SNathan Whitehorn				-g $gid \n\
424c8945a0SNathan Whitehorn				$user" 10 40
434c8945a0SNathan Whitehorn		;;
444c8945a0SNathan Whitehorn	$DIALOG_EXTRA)
454c8945a0SNathan Whitehorn		value=`echo "$value" | sed -e 's/^RENAMED //'`
464c8945a0SNathan Whitehorn		tag=`echo "$value" | sed -e 's/:.*//'`
474c8945a0SNathan Whitehorn		item=`echo "$value" | sed -e 's/^[^:]*:[ 	][ 	]*//'`
484c8945a0SNathan Whitehorn
494c8945a0SNathan Whitehorn		case "$tag" in
504c8945a0SNathan Whitehorn		Username) user="$item" ;;
514c8945a0SNathan Whitehorn		UID)	  uid="$item"  ;;
524c8945a0SNathan Whitehorn		GID)	  gid="$item"  ;;
534c8945a0SNathan Whitehorn		HOME)	  home="$item" ;;
54		esac
55		;;
56
57	$DIALOG_ESC)
58		echo "ESC pressed."
59		break
60		;;
61
62	esac
63done
64