23 static char *misc_read_line(
const char *,
const char *,
const char *);
24 static void misc_write_line(
const char *,
const char *,
const char *);
39 return misc_read_line(
"units", name, mapset);
52 misc_write_line(
"units", name, str);
68 return misc_read_line(
"vertical_datum", name, mapset);
82 misc_write_line(
"vertical_datum", name, str);
98 return misc_read_line(
"semantic_label", name, mapset);
115 return buff ? buff :
G_store(name);
131 misc_write_line(
"semantic_label", name, str);
157 if (strlen(semantic_label) >=
GNAME_MAX) {
167 if (!((*s >=
'A' && *s <=
'Z') || (*s >=
'a' && *s <=
'z') ||
168 (*s >=
'0' && *s <=
'9') || *s ==
'_' || *s ==
'-')) {
169 G_warning(
_(
"Character '%c' not allowed in a semantic label."), *s);
189 static char *misc_read_line(
const char *elem,
190 const char *
name,
const char *mapset)
202 G_warning(
_(
"Unable to read <%s> for raster map <%s@%s>"),
206 if (
G_getl2(buff,
sizeof(buff) - 1, fp) == 0) {
212 G_fatal_error(
_(
"Error closing <%s> metadata file for raster map <%s@%s>"),
229 static void misc_write_line(
const char *elem,
const char *
name,
const char *str)
235 G_fatal_error(
_(
"Unable to create <%s> metadata file for raster map <%s@%s>"),
239 fprintf(fp,
"%s\n", str);
242 G_fatal_error(
_(
"Error closing <%s> metadata file for raster map <%s@%s>"),
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
FILE * G_fopen_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
int G_legal_filename(const char *)
Check for legal database file name.
const char * G_find_file2_misc(const char *, const char *, const char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)...
FILE * G_fopen_new_misc(const char *, const char *, const char *)
open a new database misc file
const char * G_mapset(void)
Get current mapset name.
void G_warning(const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.