aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gqverify.x
blob: 7f081f3b2e59fb5639edf10cbbdb000464457a27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <fset.h>

define	QUERY	"Type `q' to verify quit, `return' to return to cursor loop:"

# GQVERIFY -- Print a message in the status line asking the user if they really
# want to quit, returning YES if they really want to quit, NO otherwise.

int procedure gqverify()

int	ch
int	getci()

begin
	call printf (QUERY)
	call flush (STDOUT)

	call fseti (STDIN, F_RAW, YES)
	while (getci (STDIN, ch) != EOF)
	    if (ch == 'q' || ch == '\r' || ch == '\n')
		break

	call printf ("\n\n")
	call flush (STDOUT)
	call fseti (STDIN, F_RAW, NO)

	if (ch == 'q')
	    return (YES)
	else
	    return (NO)
end