10 #include <grass/imagery.h>
11 #include <grass/spawn.h>
13 static char *tempfile =
NULL;
33 temp = fopen(tempfile,
"w");
36 fprintf(temp,
"Available groups\n");
37 fprintf(temp,
"---------------------------------\n");
46 if ((ls = popen(buf,
"r"))) {
47 while (
G_getl2(buf,
sizeof(buf), ls)) {
49 fprintf(temp,
"%s", buf);
53 fprintf(temp,
" (%s)", title);
56 for (i = 0; i < ref.nfiles; i++)
57 fprintf(temp,
"\t%s in %s\n", ref.file[i].name,
60 fprintf(temp,
"\t** empty **\n");
69 fprintf(temp,
"no group files available\n");
70 fprintf(temp,
"---------------------------------\n");
74 fprintf(stdout,
"hit RETURN to continue -->");
83 char element[GNAME_MAX + 15];
94 sprintf(element,
"group/%s/subgroup", group);
97 temp = fopen(tempfile,
"w");
100 fprintf(temp,
"Available subgroups in group %s\n", group);
101 fprintf(temp,
"---------------------------------\n");
110 if ((ls = popen(buf,
"r"))) {
111 while (
G_getl2(buf,
sizeof(buf), ls)) {
113 fprintf(temp,
"%s\n", buf);
116 for (i = 0; i < ref.nfiles; i++)
117 fprintf(temp,
"\t%s in %s\n", ref.file[i].name,
120 fprintf(temp,
"\t** empty **\n");
127 fprintf(temp,
"no subgroup files available\n");
128 fprintf(temp,
"---------------------------------\n");
132 fprintf(stdout,
"hit RETURN to continue -->");
char * G_mapset(void)
current mapset name
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
int I_get_group_title(const char *group, char *title, int n)
char * G_tempfile(void)
Returns a temporary file name.
int G_getl2(char *buf, int n, FILE *fd)
gets a line of text from a file of any pedigree
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
int I_list_groups(int full)
int I_list_subgroups(const char *group, int full)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int I_get_group_ref(const char *group, struct Ref *ref)
read group REF file
int I_free_group_ref(struct Ref *ref)
free Ref structure
int G__make_mapset_element(const char *p_element)
Create element in the current mapset.
int I_get_subgroup_ref(const char *group, const char *subgroup, struct Ref *ref)
read subgroup REF file
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int G_spawn(const char *command,...)
Spawn new process based on command.