Skip to content

Commit

Permalink
quiet handled by --quiet
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60094 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
HamishB committed May 5, 2014
1 parent d332619 commit 6dfb2df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
3 changes: 2 additions & 1 deletion display/d.histogram/dhist.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ int draw_slice_filled(struct Colors *, DCELL, int, double, double, double,
double, double);
int draw_slice(struct Colors *, int, DCELL, DCELL, int, double, double,
double, double, double);

/* get_stats.c */
int get_stats(const char *, struct stat_list *, int);
int get_stats(const char *, struct stat_list *);

/* pie.c */
int pie(struct stat_list *, struct Colors *);
10 changes: 4 additions & 6 deletions display/d.histogram/get_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "options.h"
#include "dhist.h"

static void run_stats(const char *mapname, int quiet, const char *tempfile)
static void run_stats(const char *mapname, const char *tempfile)
{
char buf[32];
const char *argv[12];
Expand All @@ -19,8 +19,7 @@ static void run_stats(const char *mapname, int quiet, const char *tempfile)
argv[argc++] = "-r";
if (cat_ranges)
argv[argc++] = "-C";
if (quiet)
argv[argc++] = "-q";

argv[argc++] = type == COUNT
? "-c"
: "-a";
Expand All @@ -43,8 +42,7 @@ static void run_stats(const char *mapname, int quiet, const char *tempfile)
G_fatal_error("error running r.stats");
}

int get_stats(const char *mapname, struct stat_list *dist_stats, /* linked list of stats */
int quiet)
int get_stats(const char *mapname, struct stat_list *dist_stats) /* linked list of stats */
{
char buf[1024]; /* input buffer for reading stats */
int done = 0;
Expand Down Expand Up @@ -72,7 +70,7 @@ int get_stats(const char *mapname, struct stat_list *dist_stats, /* linked list
G_fatal_error("Can't read frange file");
}

run_stats(mapname, quiet, tempfile);
run_stats(mapname, tempfile);

/* open temp file and read the stats into a linked list */
fd = fopen(tempfile, "r");
Expand Down
8 changes: 1 addition & 7 deletions display/d.histogram/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ int main(int argc, char **argv)
char title[GNAME_MAX];
double tt, tb, tl, tr;
double t, b, l, r;
int quiet;
struct GModule *module;
struct Option *opt1;
struct Option *opt2, *bg_opt;
Expand Down Expand Up @@ -129,10 +128,6 @@ int main(int argc, char **argv)
flag1->key = 'n';
flag1->description = _("Display information for null cells");

flag2 = G_define_flag();
flag2->key = 'q';
flag2->description = _("Gather the histogram quietly");

flag3 = G_define_flag();
flag3->key = 'C';
flag3->description =
Expand Down Expand Up @@ -168,7 +163,6 @@ int main(int argc, char **argv)
G_warning(_("When -C flag is set, the nsteps argument is ignored"));

nodata = flag1->answer;
quiet = flag2->answer ? YES : NO;

if (Rast_read_colors(map_name, "", &pcolors) == -1)
G_fatal_error(_("Color file for <%s> not available"), map_name);
Expand All @@ -182,7 +176,7 @@ int main(int argc, char **argv)

/* get the distribution statistics */

get_stats(map_name, &dist_stats, quiet);
get_stats(map_name, &dist_stats);

/* set up the graphics driver and initialize its color-table */

Expand Down

0 comments on commit 6dfb2df

Please sign in to comment.