In 2003, a -s flag was added to ministat to separate the
avg/median/stddev bars onto separate lines for readability if the ranges overlapped. In 2005, ministat was extended to support more than 2 datasets, but the -s code was not updated. It will coredump if run with -s and >2 sets. PR: 82909 Submitted by: Dan Nelson <dnelson@allantgroup.com>
This commit is contained in:
parent
5138c36a1b
commit
4a7f3dcea5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148224
@ -12,3 +12,4 @@ test: ${PROG}
|
|||||||
./${PROG} ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
./${PROG} ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
||||||
./${PROG} -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
./${PROG} -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
||||||
./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
||||||
|
./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana ${.CURDIR}/iguana
|
||||||
|
@ -283,12 +283,13 @@ struct plot {
|
|||||||
char *data;
|
char *data;
|
||||||
char **bar;
|
char **bar;
|
||||||
int separate_bars;
|
int separate_bars;
|
||||||
|
int num_datasets;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct plot plot;
|
static struct plot plot;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetupPlot(int width, int separate)
|
SetupPlot(int width, int separate, int num_datasets)
|
||||||
{
|
{
|
||||||
struct plot *pl;
|
struct plot *pl;
|
||||||
|
|
||||||
@ -298,6 +299,7 @@ SetupPlot(int width, int separate)
|
|||||||
pl->data = NULL;
|
pl->data = NULL;
|
||||||
pl->bar = NULL;
|
pl->bar = NULL;
|
||||||
pl->separate_bars = separate;
|
pl->separate_bars = separate;
|
||||||
|
pl->num_datasets = num_datasets;
|
||||||
pl->min = 999e99;
|
pl->min = 999e99;
|
||||||
pl->max = -999e99;
|
pl->max = -999e99;
|
||||||
}
|
}
|
||||||
@ -344,8 +346,8 @@ PlotSet(struct dataset *ds, int val)
|
|||||||
bar = 0;
|
bar = 0;
|
||||||
|
|
||||||
if (pl->bar == NULL) {
|
if (pl->bar == NULL) {
|
||||||
pl->bar = malloc(sizeof(char *) * 2);
|
pl->bar = malloc(sizeof(char *) * pl->num_datasets);
|
||||||
memset(pl->bar, 0, sizeof(char*) * 2);
|
memset(pl->bar, 0, sizeof(char*) * pl->num_datasets);
|
||||||
}
|
}
|
||||||
if (pl->bar[bar] == NULL) {
|
if (pl->bar[bar] == NULL) {
|
||||||
pl->bar[bar] = malloc(pl->width);
|
pl->bar[bar] = malloc(pl->width);
|
||||||
@ -426,7 +428,7 @@ DumpPlot(void)
|
|||||||
putchar('|');
|
putchar('|');
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < pl->num_datasets; i++) {
|
||||||
if (pl->bar[i] == NULL)
|
if (pl->bar[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
putchar('|');
|
putchar('|');
|
||||||
@ -568,7 +570,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!flag_n) {
|
if (!flag_n) {
|
||||||
SetupPlot(74, flag_s);
|
SetupPlot(74, flag_s, nds);
|
||||||
for (i = 0; i < nds; i++)
|
for (i = 0; i < nds; i++)
|
||||||
DimPlot(ds[i]);
|
DimPlot(ds[i]);
|
||||||
for (i = 0; i < nds; i++)
|
for (i = 0; i < nds; i++)
|
||||||
|
@ -12,3 +12,4 @@ test: ${PROG}
|
|||||||
./${PROG} ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
./${PROG} ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
||||||
./${PROG} -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
./${PROG} -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
||||||
./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
|
||||||
|
./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana ${.CURDIR}/iguana
|
||||||
|
@ -283,12 +283,13 @@ struct plot {
|
|||||||
char *data;
|
char *data;
|
||||||
char **bar;
|
char **bar;
|
||||||
int separate_bars;
|
int separate_bars;
|
||||||
|
int num_datasets;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct plot plot;
|
static struct plot plot;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetupPlot(int width, int separate)
|
SetupPlot(int width, int separate, int num_datasets)
|
||||||
{
|
{
|
||||||
struct plot *pl;
|
struct plot *pl;
|
||||||
|
|
||||||
@ -298,6 +299,7 @@ SetupPlot(int width, int separate)
|
|||||||
pl->data = NULL;
|
pl->data = NULL;
|
||||||
pl->bar = NULL;
|
pl->bar = NULL;
|
||||||
pl->separate_bars = separate;
|
pl->separate_bars = separate;
|
||||||
|
pl->num_datasets = num_datasets;
|
||||||
pl->min = 999e99;
|
pl->min = 999e99;
|
||||||
pl->max = -999e99;
|
pl->max = -999e99;
|
||||||
}
|
}
|
||||||
@ -344,8 +346,8 @@ PlotSet(struct dataset *ds, int val)
|
|||||||
bar = 0;
|
bar = 0;
|
||||||
|
|
||||||
if (pl->bar == NULL) {
|
if (pl->bar == NULL) {
|
||||||
pl->bar = malloc(sizeof(char *) * 2);
|
pl->bar = malloc(sizeof(char *) * pl->num_datasets);
|
||||||
memset(pl->bar, 0, sizeof(char*) * 2);
|
memset(pl->bar, 0, sizeof(char*) * pl->num_datasets);
|
||||||
}
|
}
|
||||||
if (pl->bar[bar] == NULL) {
|
if (pl->bar[bar] == NULL) {
|
||||||
pl->bar[bar] = malloc(pl->width);
|
pl->bar[bar] = malloc(pl->width);
|
||||||
@ -426,7 +428,7 @@ DumpPlot(void)
|
|||||||
putchar('|');
|
putchar('|');
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < pl->num_datasets; i++) {
|
||||||
if (pl->bar[i] == NULL)
|
if (pl->bar[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
putchar('|');
|
putchar('|');
|
||||||
@ -568,7 +570,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!flag_n) {
|
if (!flag_n) {
|
||||||
SetupPlot(74, flag_s);
|
SetupPlot(74, flag_s, nds);
|
||||||
for (i = 0; i < nds; i++)
|
for (i = 0; i < nds; i++)
|
||||||
DimPlot(ds[i]);
|
DimPlot(ds[i]);
|
||||||
for (i = 0; i < nds; i++)
|
for (i = 0; i < nds; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user