Beispiel #1
0
char *G_location_path(void)
{
    char *location;

    location = G__location_path();
    if (access(location, F_OK) != 0) {
	perror("access");
	G_fatal_error(_("LOCATION << %s >> not available"), location);
    }

    return location;
}
Beispiel #2
0
char *
G_location_path()
{
    char *location;

    location = G__location_path();
    if(access(location,0) != 0) 
    {
	char msg[400];

	sprintf(msg,"LOCATION  << %s >>  not available", location) ;
	G_fatal_error (msg);
    }

    return location;
}
Beispiel #3
0
char *G__file_name ( 
	char *path,
	char *element,
	char *name,
	char *mapset)
{
	char xname[512];
	char xmapset[512];
	char *location = G__location_path();

/*
 * if a name is given, build a file name
 * must split the name into name, mapset if it is
 * in the name@mapset format
 */
	if (name && *name && G__name_is_fully_qualified(name, xname, xmapset))
	{
		strcpy(name, xname);
		sprintf(path,"%s/%s", location, xmapset);
	}
	else if (mapset && *mapset)
		sprintf(path,"%s/%s", location, mapset);
	else
		sprintf(path,"%s/%s", location, G_mapset());

	G_free (location);
	
	if (element && *element)
	{
		strcat (path, "/");
		strcat (path, element);
	}

	if (name && *name)
	{
		strcat (path, "/");
		strcat (path, name);
	}

/*
 * return pointer to users 'path' buffer
 */
	return path;
}