ask_cell.c

Go to the documentation of this file.
00001 /*
00002  *************************************************************************
00003  *   char *
00004  *   G_ask_cell_new(prompt, name)) 
00005  *       asks user to input name of a new cell file
00006  *
00007  *   char *
00008  *   G_ask_cell_old(prompt, name) 
00009  *       asks user to input name of an existing cell file
00010  *
00011  *   char *
00012  *   G_ask_cell_in_mapset(prompt, name)
00013  *       asks user to input name of an existing cell file in current mapset
00014  *
00015  *   char *
00016  *   G_ask_cell_any(prompt, name)
00017  *       asks user to input name of a new or existing cell file in
00018  *       the current mapset. Warns user about (possible) overwrite
00019  *       if cell file already exists
00020  *
00021  *   parms:
00022  *      char *prompt    optional prompt for user
00023  *      char *name      buffer to hold name of map found
00024  *
00025  *   returns:
00026  *      char *pointer to a string with name of mapset
00027  *       where file was found, or NULL if not found
00028  *
00029  *   note:
00030  *      rejects all names that begin with .
00031  **********************************************************************/
00032 #include <stdlib.h>
00033 #include <string.h>
00034 #include "gis.h"
00035 #include "glocale.h"
00036 
00037 static int lister(char *,char *,char *);
00038 
00039 
00051 char *
00052 G_ask_cell_new (prompt,name)
00053 
00054         char *prompt;
00055         char *name;
00056 {
00057 
00058         return G_ask_new_ext (prompt, name, "cell", "raster", _("with titles"), lister);
00059 }
00060 
00061 
00073 char *
00074 G_ask_cell_old (prompt,name)
00075 
00076         char *prompt;
00077         char *name;
00078 {
00079         return G_ask_old_ext (prompt, name, "cell", "raster", _("with titles"), lister);
00080 }
00081 
00082 
00094 char *
00095 G_ask_cell_in_mapset (prompt,name)
00096 
00097         char *prompt;
00098         char *name;
00099 {
00100         return G_ask_in_mapset_ext (prompt, name, "cell", "raster", _("with titles"), lister);
00101 }
00102 
00103 char *
00104 G_ask_cell_any (prompt,name)
00105 
00106         char *prompt;
00107         char *name;
00108 {
00109         return G_ask_any_ext (prompt, name, "cell", "raster", 1, _("with titles"), lister);
00110 }
00111 
00112 static int lister(char *name,char *mapset,char *buf)
00113 {
00114     char *title;
00115 
00116     *buf = 0;
00117     if (*name == 0) return 0;
00118 
00119     strcpy (buf, title = G_get_cell_title (name, mapset));
00120     if (*buf == 0)
00121         strcpy (buf, _("(no title)"));
00122     free (title);
00123 
00124     return 0;
00125 }

Generated on Mon Jan 1 19:49:25 2007 for GRASS by  doxygen 1.5.1