21 #include "manage_local_proto.h" 26 static void format_error(
char *,
int,
char *);
65 env =
getenv(
"ELEMENT_LIST");
67 strcpy(element_list, env);
69 sprintf(element_list,
"%s/etc/element_list",
G_gisbase());
70 fd = fopen(element_list,
"r");
73 G_fatal_error(
_(
"Unable to open data base element list '%s'"), element_list);
76 while (
G_getl(buf,
sizeof(buf), fd)) {
80 if (*buf ==
' ' || *buf ==
'\t') {
82 if (sscanf(buf,
"%[^:]:%[^\n]", elem, desc) < 1)
87 format_error(element_list, line, buf);
96 (buf,
"%[^:]:%[^:]:%[^:]:%[^\n]", elem, alias, desc,
98 format_error(element_list, line, buf);
115 if (!check_if_empty || !
M__empty(elem)) {
132 void format_error(
char *element_list,
int line,
char *buf)
134 G_fatal_error(
_(
"Format error: file ('%s') line (%d) - %s"), element_list, line,
int G_getl(char *, int, FILE *)
Gets a line of text from a file.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void M__add_element(const char *, const char *)
Add element to the list.
void G_strip(char *)
Removes all leading and trailing white space from string.
int M__empty(char *)
Check if element is empty.
int M_read_list(int check_if_empty, int *num)
Read list of elements.
const char * G_gisbase(void)
Get full path name of the top level module directory.
char * G_store(const char *)
Copy string to allocated memory.