GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ask.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Include dependency graph for ask.c:

Go to the source code of this file.

Macros

#define OLD   0
 
#define NEW   1
 
#define PRJ   2
 
#define ANY   3
 
#define ANY_NW   4
 
#define OLD_FILE   5
 
#define NEW_FILE   6
 

Functions

char * G_ask_new (const char *prompt, char *name, char *element, char *desc)
 prompt for new database file More...
 
char * G_ask_new_ext (const char *prompt, char *name, char *element, char *desc, char *option, int(*lister)())
 
char * G_ask_old (const char *prompt, char *name, char *element, char *desc)
 prompt for existing database file More...
 
char * G_ask_old_ext (const char *prompt, char *name, char *element, char *desc, char *option, int(*lister)())
 
char * G_ask_any (const char *prompt, char *name, char *element, char *desc, int warn)
 prompt for any valid file name More...
 
char * G_ask_any_ext (const char *prompt, char *name, char *element, char *desc, int warn, char *option, int(*lister)())
 
char * G_ask_in_mapset (const char *prompt, char *name, char *element, char *desc)
 prompt for existing database file More...
 
char * G_ask_in_mapset_ext (const char *prompt, char *name, char *element, char *desc, char *option, int(*lister)())
 
char * G_ask_new_file (const char *prompt, char *name, char *element, char *desc)
 prompt for new file More...
 
char * G_ask_old_file (const char *prompt, char *name, char *element, char *desc)
 prompt for existing file More...
 
int G_set_ask_return_msg (const char *msg)
 set Hit RETURN msg More...
 
char * G_get_ask_return_msg ()
 get Hit RETURN msg More...
 

Macro Definition Documentation

#define ANY   3

Definition at line 102 of file ask.c.

Referenced by G_ask_any(), and G_ask_any_ext().

#define ANY_NW   4

Definition at line 103 of file ask.c.

Referenced by G_ask_any(), and G_ask_any_ext().

#define NEW   1

Definition at line 100 of file ask.c.

#define NEW_FILE   6

Definition at line 105 of file ask.c.

Referenced by G_ask_new_file().

#define OLD   0

Definition at line 99 of file ask.c.

Referenced by G_ask_old(), and G_ask_old_ext().

#define OLD_FILE   5

Definition at line 104 of file ask.c.

Referenced by G_ask_old_file().

#define PRJ   2

Definition at line 101 of file ask.c.

Referenced by G_ask_in_mapset(), and G_ask_in_mapset_ext().

Function Documentation

char* G_ask_any ( const char *  prompt,
char *  name,
char *  element,
char *  desc,
int  warn 
)

prompt for any valid file name

The user is asked to enter any leg al file name. If warn is 1 and the file chosen exists in the current mapset, then the user is asked if it is ok to overwrite the file. If warn is 0, then any leg al name is accepted and no warning is issued to the user if the file exists.

Parameters
prompt
name
element
label
warn
Returns
char *

Definition at line 190 of file ask.c.

References ANY, ANY_NW, and NULL.

Referenced by G_ask_sites_any(), and G_ask_vector_any().

char* G_ask_any_ext ( const char *  prompt,
char *  name,
char *  element,
char *  desc,
int  warn,
char *  option,
int(*)()  lister 
)

Definition at line 197 of file ask.c.

References ANY, and ANY_NW.

Referenced by G_ask_cell_any().

char* G_ask_in_mapset ( const char *  prompt,
char *  name,
char *  element,
char *  desc 
)

prompt for existing database file

The user is asked to enter the name of an file which exists in the current mapset. Note. The file chosen by the user may or may not exist in other mapsets. This routine does not look in other mapsets, since the assumption is that name will be used to modify a file. GRASS only permits users to modify files in the current mapset.

Parameters
prompt
name
element
label
Returns
char *

Definition at line 222 of file ask.c.

References NULL, and PRJ.

Referenced by G_ask_sites_in_mapset(), and G_ask_vector_in_mapset().

char* G_ask_in_mapset_ext ( const char *  prompt,
char *  name,
char *  element,
char *  desc,
char *  option,
int(*)()  lister 
)

Definition at line 228 of file ask.c.

References PRJ.

Referenced by G_ask_cell_in_mapset().

char* G_ask_new ( const char *  prompt,
char *  name,
char *  element,
char *  desc 
)

prompt for new database file

The user is asked to enter the name of a new file which does not exist in the current mapset. Note. The file chosen by the user may exist in other mapsets. This routine does not look in other mapsets, since the assumption is that name will be used to create a new file. New files are always created in the current mapset.

Parameters
prompt
name
element
desc
Returns
char *

Definition at line 132 of file ask.c.

References NULL.

Referenced by G_ask_sites_new(), and G_ask_vector_new().

char* G_ask_new_ext ( const char *  prompt,
char *  name,
char *  element,
char *  desc,
char *  option,
int(*)()  lister 
)

Definition at line 137 of file ask.c.

Referenced by G_ask_cell_new().

char* G_ask_new_file ( const char *  prompt,
char *  name,
char *  element,
char *  desc 
)

prompt for new file

The user is asked to enter the name of an file which doesn't exist.

Parameters
prompt
name
element
label
Returns
char *

Definition at line 247 of file ask.c.

References NEW_FILE, and NULL.

char* G_ask_old ( const char *  prompt,
char *  name,
char *  element,
char *  desc 
)

prompt for existing database file

The user is asked to enter the name of an existing database file. Note. This routine looks for the file in the current mapset as well as other mapsets. The mapsets that are searched are determined from the user's mapset search path. See Mapset_Search_Path for some more details about the search path.

Parameters
prompt
name
element
label
Returns
char *

Definition at line 161 of file ask.c.

References NULL, and OLD.

Referenced by G_ask_sites_old(), and G_ask_vector_old().

char* G_ask_old_ext ( const char *  prompt,
char *  name,
char *  element,
char *  desc,
char *  option,
int(*)()  lister 
)

Definition at line 166 of file ask.c.

References OLD.

Referenced by G_ask_cell_old().

char* G_ask_old_file ( const char *  prompt,
char *  name,
char *  element,
char *  desc 
)

prompt for existing file

The user is asked to enter the name of an file which exists.

Parameters
prompt
name
element
label
Returns
char *

Definition at line 282 of file ask.c.

References NULL, and OLD_FILE.

char* G_get_ask_return_msg ( )

get Hit RETURN msg

The current msg (as set by G_set_ask_return_msg) is returned.

Parameters
void
Returns
char *

Definition at line 337 of file ask.c.

References NULL.

int G_set_ask_return_msg ( const char *  msg)

set Hit RETURN msg

The "Hit RETURN to cancel request" part of the prompt in the prompting routines described above, is modified to "Hit RETURN <b>msg.</b>"

Parameters
msg
Returns
int

Definition at line 316 of file ask.c.

References G_free(), and G_store().