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
ask_group.c
Go to the documentation of this file.
1
2
/*************************************************************
3
* I_ask_group_old (prompt,group)
4
*
5
* prompt the user for an imagery group file name
6
*************************************************************/
7
#include <string.h>
8
#include <grass/gis.h>
9
#include <grass/imagery.h>
10
static
int
ask_group(
char
*,
char
*);
11
12
24
int
I_ask_group_old
(
char
*prompt,
char
*group)
25
{
26
while
(1) {
27
if
(*prompt == 0)
28
prompt =
"Select an imagery group file"
;
29
if
(!ask_group(prompt, group))
30
return
0;
31
if
(
I_find_group
(group))
32
return
1;
33
fprintf(stderr,
"\n** %s - not found **\n\n"
, group);
34
}
35
}
36
37
static
int
ask_group(
char
*prompt,
char
*group)
38
{
39
char
buf[1024];
40
41
while
(1) {
42
fprintf(stderr,
"\n%s\n"
, prompt);
43
fprintf(stderr,
44
"Enter 'list' for a list of existing imagery groups\n"
);
45
fprintf(stderr,
"Enter 'list -f' for a verbose listing\n"
);
46
fprintf(stderr,
"Hit RETURN %s\n"
,
G_get_ask_return_msg
());
47
fprintf(stderr,
"> "
);
48
if
(!
G_gets
(buf))
49
continue
;
50
51
G_squeeze
(buf);
52
fprintf(stderr,
"<%s>\n"
, buf);
53
if
(*buf == 0)
54
return
0;
55
56
if
(strcmp(buf,
"list"
) == 0)
57
I_list_groups
(0);
58
else
if
(strcmp(buf,
"list -f"
) == 0)
59
I_list_groups
(1);
60
else
if
(
G_legal_filename
(buf) < 0)
61
fprintf(stderr,
"\n** <%s> - illegal name **\n\n"
, buf);
62
else
63
break
;
64
}
65
strcpy(group, buf);
66
return
1;
67
}
lib
imagery
ask_group.c
Generated on Sun Sep 9 2012 18:55:30 for GRASS Programmer's Manual by
1.8.1.2