00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <stdio.h>
00020 #include <string.h>
00021 #include <unistd.h>
00022 #include <sys/types.h>
00023 #include <grass/gis.h>
00024 #include <grass/glocale.h>
00025
00026
00040 char *
00041 G_location_path()
00042 {
00043 char *location;
00044
00045 location = G__location_path();
00046 if(access(location,0) != 0)
00047 {
00048 perror("access");
00049 G_fatal_error (_("LOCATION << %s >> not available"), location);
00050 }
00051
00052 return location;
00053 }
00054
00055
00068 char *
00069 G_location()
00070 {
00071 return G_getenv ("LOCATION_NAME");
00072 }
00073
00074 char *
00075 G__location_path()
00076 {
00077 char *location = 0;
00078 char *base;
00079 char *name;
00080
00081 name = G_location();
00082 base = G_gisdbase();
00083 location = G_malloc (strlen (base) + strlen (name) + 2);
00084
00085
00086
00087
00088
00089
00090
00091 sprintf (location, "%s/%s", base, name);
00092
00093
00094 return location;
00095 }