GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
yes.c
Go to the documentation of this file.
1
17
#include <stdio.h>
18
#include <grass/gis.h>
19
20
39
int
G_yes
(
const
char
*question,
int
dflt)
40
{
41
fflush(stdout);
42
43
while
(1) {
44
char
answer[100];
45
46
fprintf(stderr,
"%s"
, question);
47
48
while
(1) {
49
fprintf(stderr,
"(y/n) "
);
50
if
(dflt >= 0)
51
fprintf(stderr, dflt == 0 ?
"[n] "
:
"[y] "
);
52
53
fflush(stderr);
54
if
(!
G_gets
(answer))
55
break
;
56
G_strip
(answer);
57
58
switch
(*answer) {
59
case
'y'
:
60
case
'Y'
:
61
return
(1);
62
case
'n'
:
63
case
'N'
:
64
return
(0);
65
case
0:
66
if
(dflt >= 0)
67
return
(dflt);
68
}
69
}
70
}
71
}
lib
gis
yes.c
Generated on Sun Sep 9 2012 18:55:35 for GRASS Programmer's Manual by
1.8.1.2