GRASS Programmer's Manual 6.4.1(2011)
nme_in_mps.c File Reference

GIS Library - check map name. More...

#include <string.h>
#include <grass/gis.h>
Include dependency graph for nme_in_mps.c:

Go to the source code of this file.

Functions

int G__name_in_mapset (const char *name_in, char *name_out, char *mapset)
 Checks to see if 'name_in' is in the format: <name> in <mapset>
int G__name_is_fully_qualified (const char *fullname, char *name, char *mapset)
 Check if map name is fully qualified (map @ mapset)
char * G_fully_qualified_name (const char *name, const char *mapset)
 fully qualified file name

Detailed Description

GIS Library - check map name.

(C) 2001-2008 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author:
Original author CERL

Definition in file nme_in_mps.c.


Function Documentation

int G__name_in_mapset ( const char *  name_in,
char *  name_out,
char *  mapset 
)

Checks to see if 'name_in' is in the format: <name> in <mapset>

Parameters:
name_infull map name
[out]name_outmap name
[out]mapsetmapset name
Returns:
1 name_in is in this format. name_out will contain the simple <name> mapset will contain <mapset>
0 name_in is not in this format name_out and mapset are undefined (changed)

Definition at line 33 of file nme_in_mps.c.

int G__name_is_fully_qualified ( const char *  fullname,
char *  name,
char *  mapset 
)

Check if map name is fully qualified (map @ mapset)

Note:

  • name is char array of size GNAME_MAX
  • mapset is char array of size GMAPSET_MAX
Parameters:
fullnamefull map name
[out]namemap name
[out]mapsetmapset name
Returns:
1 if input map name is fully qualified
0 if input map name is not fully qualified

Definition at line 57 of file nme_in_mps.c.

References name.

Referenced by G__file_name(), G__file_name_misc(), G__open_cell_old(), G__quant_export(), G__quant_import(), G_check_input_output_name(), G_remove_colors(), G_rename(), and G_write_colors().

char* G_fully_qualified_name ( const char *  name,
const char *  mapset 
)

fully qualified file name

Returns a fully qualified name for the file name in mapset. Currently this string is in the form name @ mapset, but the programmer should pretend not to know this and always call this routine to get the fully qualified name. The following example shows how an interactive version of d.rast interfaces with the command-line version of d.rast:

   #include "gis.h"
   int main(char *argc, char **argv)
   {
   char name[GNAME_MAX], *mapset, *fqn;
   char command[1024];
   G_gisinit(argv[0]);
   mapset = G_ask_cell_old ("", name, "");
   if (mapset == NULL) exit(EXIT_SUCCESS);
   fqn = G_fully_qualified_name (name, mapset);
   sprintf (command, "d.rast map='%s'", fqn);
   system(command);
   }
Parameters:
namemap name
mapsetmapset name
Returns:
pointer to full map name (map @ mapset)

Definition at line 118 of file nme_in_mps.c.

References G_store().

Referenced by G_put_reclass().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines