00001 #include "gis.h"
00002
00003
00004
00005
00006 G_open_support_old (element, name, mapset)
00007 char *element ;
00008 char *name ;
00009 char *mapset ;
00010 {
00011 char support[500];
00012 char xname[512], xmapset[512];
00013
00014 if (G__name_is_fully_qualified (name, xname, xmapset))
00015 {
00016 if (strcmp (xmapset, mapset) != 0)
00017 return -1;
00018 name = xname;
00019 }
00020
00021
00022
00023 sprintf (support,"support/%s/%s", element, mapset);
00024 if (G_find_file(support, name, G_mapset()))
00025 return G_open_old (support, name, G_mapset());
00026
00027
00028
00029 return G_open_old (element, name, mapset);
00030 }
00031
00032 FILE *
00033 G_fopen_support_old (element, name, mapset)
00034 char *element ;
00035 char *name ;
00036 char *mapset ;
00037 {
00038 int fd;
00039
00040 fd = G_open_support_old (element, name, mapset);
00041 if (fd < 0)
00042 return (FILE *) NULL ;
00043 return fdopen (fd, "r");
00044 }
00045
00046
00047
00048
00049
00050 G_open_support_new (element, name, mapset)
00051 char *element ;
00052 char *name ;
00053 char *mapset ;
00054 {
00055 char support[500];
00056 char xname[512], xmapset[512];
00057
00058 if (G__name_is_fully_qualified (name, xname, xmapset))
00059 {
00060 if (strcmp (xmapset, mapset) != 0)
00061 return -1;
00062 name = xname;
00063 }
00064
00065
00066 if (strcmp (mapset, G_mapset()) != 0)
00067 {
00068 sprintf (support,"support/%s/%s", element, mapset);
00069 element = support;
00070 }
00071 return (G_open_new (element, name));
00072 }
00073
00074 FILE *
00075 G_fopen_support_new (element, name, mapset)
00076 char *element ;
00077 char *name ;
00078 char *mapset ;
00079 {
00080 int fd;
00081
00082 fd = G_open_support_new (element, name, mapset);
00083 if (fd < 0)
00084 return (FILE *) NULL ;
00085 return fdopen (fd, "w");
00086 }