21 #include "manage_local_proto.h"
26 static void format_error(
char *,
int,
char *);
65 env = getenv(
"ELEMENT_LIST");
69 sprintf(element_list,
"%s/etc/element_list",
G_gisbase());
70 fd = fopen(element_list,
"r");
77 while (
G_getl(buf,
sizeof(buf), fd)) {
81 if (*buf ==
' ' || *buf ==
'\t') {
83 if (sscanf(buf,
"%[^:]:%[^\n]", elem,
desc) < 1)
88 format_error(element_list, line, buf);
96 if (sscanf(buf,
"%[^:]:%[^:]:%[^:]:%[^\n]", elem,
alias,
desc,
98 format_error(element_list, line, buf);
114 if (!check_if_empty || !
M__empty(elem)) {
131 void format_error(
char *element_list,
int line,
char *buf)
133 G_fatal_error(
_(
"Format error: file ('%s') line (%d) - %s"), element_list,
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_strip(char *)
Removes all leading and trailing white space from string.
int G_getl(char *, int, FILE *)
Gets a line of text from a file.
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.
int M__empty(char *)
Check if element is empty.
void M__add_element(const char *, const char *)
Add element to the list.
int M_read_list(int check_if_empty, int *num)
Read list of elements.