find_vect.c

Go to the documentation of this file.
00001 /*
00002  **********************************************************************
00003  *  char *
00004  *  G_find_vector (name, mapset)
00005  *        char *name       file name to look for
00006  *        char *mapset     mapset to search. if mapset is ""
00007  *                         will search in mapset search list
00008  *
00009  *      searches for a vector file from the mapset search list
00010  *      or in a specified mapset.
00011  *      returns the mapset name where the vector file was found.
00012  *
00013  *  returns:
00014  *      char *  pointer to a string with name of mapset
00015  *              where vector file was found, or NULL if not found
00016  *  note:
00017  *      rejects all names that begin with .
00018  *
00019  *      if name is of the form nnn in ppp then 
00020  *      name = nnn and mapset = ppp
00021  **********************************************************************/
00022 
00023 #include "gis.h"
00024 #include "vect/dig_defines.h"
00025 
00026 char *
00027 G_find_vector (name, mapset)
00028         char *name;
00029         char *mapset;
00030 {
00031         char buf[200], buf2[200], xname[512], xmapset[512];
00032 
00033         if (G__name_is_fully_qualified (name, xname, xmapset)) {
00034             sprintf (buf, "%s/%s", GRASS_VECT_DIRECTORY, xname);
00035             sprintf (buf2, "%s@%s", GRASS_VECT_HEAD_ELEMENT, xmapset);
00036         } else {
00037             sprintf (buf, "%s/%s", GRASS_VECT_DIRECTORY, name);
00038             sprintf (buf2, "%s", GRASS_VECT_HEAD_ELEMENT);
00039         }
00040         
00041         return G_find_file (buf, buf2, mapset);
00042 }
00043 
00044 char *
00045 G_find_vector2 (name, mapset)
00046         char *name;
00047         char *mapset;
00048 {
00049         char buf[200], buf2[200], xname[512], xmapset[512];
00050 
00051         if (G__name_is_fully_qualified (name, xname, xmapset)) {
00052             sprintf (buf, "%s/%s", GRASS_VECT_DIRECTORY, xname);
00053             sprintf (buf2, "%s@%s", GRASS_VECT_HEAD_ELEMENT, xmapset);
00054         } else {
00055             sprintf (buf, "%s/%s", GRASS_VECT_DIRECTORY, name);
00056             sprintf (buf2, "%s", GRASS_VECT_HEAD_ELEMENT);
00057         }
00058         
00059         return G_find_file2 (buf, buf2, mapset);
00060 }

Generated on Sat Jul 22 22:06:14 2006 for GRASS by  doxygen 1.4.7