|
@@ -14,6 +14,9 @@
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
#include <stdio.h>
|
|
|
+#include <dirent.h>
|
|
|
+#include <string.h>
|
|
|
+
|
|
|
#include <grass/gis.h>
|
|
|
#include <grass/display.h>
|
|
|
#include <grass/glocale.h>
|
|
@@ -21,7 +24,7 @@
|
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
|
struct GModule *module;
|
|
|
- struct Flag *rflag, *dflag, *fflag, *bflag, *gflag;
|
|
|
+ struct Flag *rflag, *dflag, *fflag, *bflag, *gflag, *sflag;
|
|
|
double t, b, l, r;
|
|
|
double n, s, e, w;
|
|
|
|
|
@@ -58,7 +61,12 @@ int main(int argc, char *argv[])
|
|
|
gflag->description =
|
|
|
_("Display geographic coordinates and resolution of entire screen");
|
|
|
|
|
|
- G_option_required(rflag, dflag, fflag, bflag, gflag, NULL);
|
|
|
+ sflag = G_define_flag();
|
|
|
+ sflag->key = 's';
|
|
|
+ sflag->description =
|
|
|
+ _("Print path to support files of currently selected monitor");
|
|
|
+
|
|
|
+ G_option_required(rflag, dflag, fflag, bflag, gflag, sflag, NULL);
|
|
|
|
|
|
if (G_parser(argc, argv))
|
|
|
exit(EXIT_FAILURE);
|
|
@@ -106,6 +114,48 @@ int main(int argc, char *argv[])
|
|
|
fprintf(stdout, "nsres=%.15g\n", (n-s)/(b-t) );
|
|
|
}
|
|
|
|
|
|
+ if (sflag->answer) {
|
|
|
+ const char *curr_mon;
|
|
|
+
|
|
|
+ curr_mon = G_getenv_nofatal("MONITOR");
|
|
|
+ if (!curr_mon) {
|
|
|
+ G_warning(_("No monitor is currently selected"));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char *p;
|
|
|
+ char tmpdir[GPATH_MAX], mon_path[GPATH_MAX];
|
|
|
+ struct dirent *dp;
|
|
|
+ DIR *dirp;
|
|
|
+
|
|
|
+ G_temp_element(tmpdir);
|
|
|
+ strcat(tmpdir, "/");
|
|
|
+ strcat(tmpdir, "MONITORS");
|
|
|
+ strcat(tmpdir, "/");
|
|
|
+ strcat(tmpdir, curr_mon);
|
|
|
+
|
|
|
+ G_file_name(mon_path, tmpdir, NULL, G_mapset());
|
|
|
+
|
|
|
+ dirp = opendir(mon_path);
|
|
|
+ if (!dirp) {
|
|
|
+ G_warning(_("No support files found for monitor <%s>"), curr_mon);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ while ((dp = readdir(dirp)) != NULL) {
|
|
|
+ if (!dp->d_name || dp->d_type != DT_REG)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ p = strrchr(dp->d_name, '.');
|
|
|
+ if (!p)
|
|
|
+ p = dp->d_name;
|
|
|
+ else
|
|
|
+ p++; /* skip '.' */
|
|
|
+
|
|
|
+ fprintf(stdout, "%s=%s%c%s\n", p,
|
|
|
+ mon_path, HOST_DIRSEP, dp->d_name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
D_close_driver();
|
|
|
|