00001 #include <grass/gis.h> 00002 #include <grass/glocale.h> 00003 #include <unistd.h> 00004 00005 #define PERMANENT "PERMANENT" 00006 00007 struct Key_Value * 00008 G_get_projunits() 00009 { 00010 int stat; 00011 struct Key_Value *in_units_keys; 00012 char path[1024]; 00013 00014 G__file_name (path, "", UNIT_FILE, PERMANENT); 00015 if (access(path,0) != 0) 00016 { 00017 fprintf(stderr,_("%s file not found for location %s\n"), 00018 UNIT_FILE, G_location()); 00019 return NULL; 00020 } 00021 in_units_keys = G_read_key_value_file(path,&stat); 00022 if (stat != 0) 00023 { 00024 fprintf(stderr,_("ERROR in reading %s file for location %s\n"), 00025 UNIT_FILE, G_location()); 00026 return NULL; 00027 } 00028 00029 return in_units_keys; 00030 00031 } 00032 00033 00034 00035 struct Key_Value * 00036 G_get_projinfo() 00037 { 00038 int stat; 00039 struct Key_Value *in_proj_keys; 00040 char path[1024]; 00041 00042 G__file_name (path, "", PROJECTION_FILE, PERMANENT); 00043 if (access(path,0) != 0) 00044 { 00045 fprintf(stderr,_("%s file not found for location %s\n"), 00046 PROJECTION_FILE, G_location()); 00047 return NULL; 00048 } 00049 in_proj_keys = G_read_key_value_file(path,&stat); 00050 if (stat != 0) 00051 { 00052 fprintf(stderr,_("ERROR in reading %s file for location %s\n"), 00053 PROJECTION_FILE, G_location()); 00054 return NULL; 00055 } 00056 return in_proj_keys; 00057 }