xref: /freebsd/contrib/dialog/samples/report-string (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
12a3e3873SBaptiste Daroussin#!/bin/sh
2*a96ef450SBaptiste Daroussin# $Id: report-string,v 1.8 2020/11/26 00:18:32 tom Exp $
3*a96ef450SBaptiste Daroussin# Report result passed in a string $returntext
44c8945a0SNathan Whitehorn# vile:shmode
54c8945a0SNathan Whitehorn
6*a96ef450SBaptiste Daroussincase ${returncode:-0} in
74c8945a0SNathan Whitehorn  $DIALOG_OK)
8*a96ef450SBaptiste Daroussin    echo "Result is $returntext";;
94c8945a0SNathan Whitehorn  $DIALOG_CANCEL)
104c8945a0SNathan Whitehorn    echo "Cancel pressed.";;
114c8945a0SNathan Whitehorn  $DIALOG_HELP)
12*a96ef450SBaptiste Daroussin    echo "Help pressed ($returntext).";;
134c8945a0SNathan Whitehorn  $DIALOG_EXTRA)
144c8945a0SNathan Whitehorn    echo "Extra button pressed.";;
154c8945a0SNathan Whitehorn  $DIALOG_ITEM_HELP)
164c8945a0SNathan Whitehorn    echo "Item-help button pressed.";;
17*a96ef450SBaptiste Daroussin  $DIALOG_TIMEOUT)
18*a96ef450SBaptiste Daroussin    echo "Timeout expired.";;
194c8945a0SNathan Whitehorn  $DIALOG_ESC)
20*a96ef450SBaptiste Daroussin    if test -n "$returntext" ; then
21*a96ef450SBaptiste Daroussin      echo "$returntext"
224c8945a0SNathan Whitehorn    else
234c8945a0SNathan Whitehorn      echo "ESC pressed."
244c8945a0SNathan Whitehorn    fi
254c8945a0SNathan Whitehorn    ;;
26*a96ef450SBaptiste Daroussin  *)
27*a96ef450SBaptiste Daroussin    echo "Return code was $returncode";;
284c8945a0SNathan Whitehornesac
29