Deleted Added
sdiff udiff text old ( 148224 ) new ( 155894 )
full compact
1/*
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *
9 */
10
11#include <sys/cdefs.h>
12__FBSDID("$FreeBSD: head/usr.bin/ministat/ministat.c 148224 2005-07-21 08:32:56Z phk $");
13
14#include <stdio.h>
15#include <math.h>
16#include <err.h>
17#include <string.h>
18#include <stdlib.h>
19#include <unistd.h>
20#include <sys/queue.h>
21
22#define NSTUDENT 100
23#define NCONF 6
24double const studentpct[] = { 80, 90, 95, 98, 99, 99.5 };
25double student [NSTUDENT + 1][NCONF] = {
26/* inf */ { 1.282, 1.645, 1.960, 2.326, 2.576, 3.090 },
27/* 1. */ { 3.078, 6.314, 12.706, 31.821, 63.657, 318.313 },
28/* 2. */ { 1.886, 2.920, 4.303, 6.965, 9.925, 22.327 },

--- 469 unchanged lines hidden (view full) ---

498
499static void
500usage(char const *whine)
501{
502 int i;
503
504 fprintf(stderr, "%s\n", whine);
505 fprintf(stderr,
506 "Usage: ministat [ -c confidence ] [-ns] [file [file ...]]\n");
507 fprintf(stderr, "\tconfidence = {");
508 for (i = 0; i < NCONF; i++) {
509 fprintf(stderr, "%s%g%%",
510 i ? ", " : "",
511 studentpct[i]);
512 }
513 fprintf(stderr, "}\n");
514 fprintf(stderr, "\t-n : print summary statistics only, no graph/test\n");
515 fprintf(stderr, "\t-s : print avg/median/stddev bars on separate lines\n");
516 exit (2);
517}
518
519int
520main(int argc, char **argv)
521{
522 struct dataset *ds[7];
523 int nds;
524 double a;
525 char *p;
526 int c, i, ci;
527 int flag_s = 0;
528 int flag_n = 0;
529
530 ci = -1;
531 while ((c = getopt(argc, argv, "c:sn")) != -1)
532 switch (c) {
533 case 'c':
534 a = strtod(optarg, &p);
535 if (p != NULL && *p != '\0')
536 usage("Not a floating point number");
537 for (i = 0; i < NCONF; i++)
538 if (a == studentpct[i])
539 ci = i;
540 if (ci == -1)
541 usage("No support for confidence level");
542 break;
543 case 'n':
544 flag_n = 1;
545 break;
546 case 's':
547 flag_s = 1;
548 break;
549 default:
550 usage("Unknown option");
551 break;
552 }
553 if (ci == -1)
554 ci = 2;
555 argc -= optind;
556 argv += optind;

--- 8 unchanged lines hidden (view full) ---

565 nds = argc;
566 for (i = 0; i < nds; i++) {
567 ds[i] = ReadSet(argv[i]);
568 printf("%c %s\n", symbol[i+1], argv[i]);
569 }
570 }
571
572 if (!flag_n) {
573 SetupPlot(74, flag_s, nds);
574 for (i = 0; i < nds; i++)
575 DimPlot(ds[i]);
576 for (i = 0; i < nds; i++)
577 PlotSet(ds[i], i + 1);
578 DumpPlot();
579 }
580 VitalsHead();
581 Vitals(ds[0], 1);
582 for (i = 1; i < nds; i++) {
583 Vitals(ds[i], i + 1);
584 if (!flag_n)
585 Relative(ds[i], ds[0], ci);
586 }
587 exit(0);
588}