[GRASS5] DB default settings now defined in new mapset

Markus Neteler neteler at itc.it
Tue Oct 18 10:51:45 EDT 2005


On Tue, Oct 18, 2005 at 11:42:52AM +0200, Markus Neteler wrote:
> Hi,
> 
> I have fixed the lack of default DBF DB settings when
> creating a new mapset. Now both the text interface and the
> GUI create the dbf/ directory in a newly created mapset 
> and copy over the VAR file from PERMANENT which contains
> the default DB settings.

Radim suggested to me that it is better to not copy the
PERMANENT/VAR settings, but to generate the VAR file
with DBF settings from scratch.

Unfortunately, I don't manage to program it:
In file lib/init/mke_mapset.c

/* generate DB settings file in new mapset */
        sprintf(buffer,"'%s'/'%s'/VAR", location, mapset);
        if ((fd = creat (buffer, O_RDWR)) < 0) {
                perror (buffer);
                G_fatal_error("Cannot create VAR file in new mapset");
        }

        fprintf (fd, "DB_DRIVER: dbf\n");
        fprintf (fd, "DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n");
        fclose (fd);

mke_mapset.c: In function `make_mapset':
mke_mapset.c:33: warning: assignment makes pointer from integer without a cast

My usual string problems... Then it happily segfaults.
Any idea?

 Markus




More information about the grass-dev mailing list