GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
ask_cell.c
Go to the documentation of this file.
1
/*
2
*************************************************************************
3
* char *
4
* G_ask_cell_new(prompt, name))
5
* asks user to input name of a new cell file
6
*
7
* char *
8
* G_ask_cell_old(prompt, name)
9
* asks user to input name of an existing cell file
10
*
11
* char *
12
* G_ask_cell_in_mapset(prompt, name)
13
* asks user to input name of an existing cell file in current mapset
14
*
15
* char *
16
* G_ask_cell_any(prompt, name)
17
* asks user to input name of a new or existing cell file in
18
* the current mapset. Warns user about (possible) overwrite
19
* if cell file already exists
20
*
21
* parms:
22
* const char *prompt optional prompt for user
23
* char *name buffer to hold name of map found
24
*
25
* returns:
26
* char *pointer to a string with name of mapset
27
* where file was found, or NULL if not found
28
*
29
* note:
30
* rejects all names that begin with .
31
**********************************************************************/
32
#include <stdlib.h>
33
#include <string.h>
34
#include <grass/gis.h>
35
#include <grass/glocale.h>
36
37
static
int
lister(
char
*,
char
*,
char
*);
38
39
51
char
*
G_ask_cell_new
(
const
char
*prompt,
char
*
name
)
52
{
53
54
return
G_ask_new_ext
(prompt, name,
"cell"
,
"raster"
, _(
"with titles"
),
55
lister);
56
}
57
58
70
char
*
G_ask_cell_old
(
const
char
*prompt,
char
*
name
)
71
{
72
return
G_ask_old_ext
(prompt, name,
"cell"
,
"raster"
, _(
"with titles"
),
73
lister);
74
}
75
76
88
char
*
G_ask_cell_in_mapset
(
const
char
*prompt,
char
*
name
)
89
{
90
return
G_ask_in_mapset_ext
(prompt, name,
"cell"
,
"raster"
,
91
_(
"with titles"
), lister);
92
}
93
94
char
*
G_ask_cell_any
(
const
char
*prompt,
char
*
name
)
95
{
96
return
G_ask_any_ext
(prompt, name,
"cell"
,
"raster"
, 1, _(
"with titles"
),
97
lister);
98
}
99
100
static
int
lister(
char
*
name
,
char
*mapset,
char
*buf)
101
{
102
char
*title;
103
104
*buf = 0;
105
if
(*name == 0)
106
return
0;
107
108
strcpy(buf, title =
G_get_cell_title
(name, mapset));
109
if
(*buf == 0)
110
strcpy(buf, _(
"(no title)"
));
111
G_free
(title);
112
113
return
0;
114
}
lib
gis
ask_cell.c
Generated on Thu Sep 26 2013 09:47:58 for GRASS Programmer's Manual by
1.8.4