ministat.c (161692) | ministat.c (176106) |
---|---|
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> | 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 161692 2006-08-28 08:27:02Z phk $"); | 12__FBSDID("$FreeBSD: head/usr.bin/ministat/ministat.c 176106 2008-02-08 10:58:50Z dwmalone $"); |
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/ioctl.h> --- 223 unchanged lines hidden (view full) --- 244{ 245 246 printf(" N Min Max Median Avg Stddev\n"); 247} 248 249static void 250Vitals(struct dataset *ds, int flag) 251{ | 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/ioctl.h> --- 223 unchanged lines hidden (view full) --- 244{ 245 246 printf(" N Min Max Median Avg Stddev\n"); 247} 248 249static void 250Vitals(struct dataset *ds, int flag) 251{ |
252 double a; | |
253 254 printf("%c %3d %13.8g %13.8g %13.8g %13.8g %13.8g", symbol[flag], 255 ds->n, Min(ds), Max(ds), Median(ds), Avg(ds), Stddev(ds)); 256 printf("\n"); 257} 258 259static void 260Relative(struct dataset *ds, struct dataset *rs, int confidx) 261{ 262 double spool, s, d, e, t; | 252 253 printf("%c %3d %13.8g %13.8g %13.8g %13.8g %13.8g", symbol[flag], 254 ds->n, Min(ds), Max(ds), Median(ds), Avg(ds), Stddev(ds)); 255 printf("\n"); 256} 257 258static void 259Relative(struct dataset *ds, struct dataset *rs, int confidx) 260{ 261 double spool, s, d, e, t; |
263 int i, c; | 262 int i; |
264 265 i = ds->n + rs->n - 2; 266 if (i > NSTUDENT) 267 t = student[0][confidx]; 268 else 269 t = student[i][confidx]; 270 spool = (ds->n - 1) * Var(ds) + (rs->n - 1) * Var(rs); 271 spool /= ds->n + rs->n - 2; --- 189 unchanged lines hidden (view full) --- 461 for (i = 0; i < pl->width; i++) 462 putchar('-'); 463 putchar('+'); 464 putchar('\n'); 465} 466 467 468static struct dataset * | 263 264 i = ds->n + rs->n - 2; 265 if (i > NSTUDENT) 266 t = student[0][confidx]; 267 else 268 t = student[i][confidx]; 269 spool = (ds->n - 1) * Var(ds) + (rs->n - 1) * Var(rs); 270 spool /= ds->n + rs->n - 2; --- 189 unchanged lines hidden (view full) --- 460 for (i = 0; i < pl->width; i++) 461 putchar('-'); 462 putchar('+'); 463 putchar('\n'); 464} 465 466 467static struct dataset * |
469ReadSet(char *n, int column, char *delim) | 468ReadSet(const char *n, int column, const char *delim) |
470{ 471 FILE *f; 472 char buf[BUFSIZ], *p, *t; 473 struct dataset *s; 474 double d; 475 int line; 476 int i; 477 --- 65 unchanged lines hidden (view full) --- 543} 544 545int 546main(int argc, char **argv) 547{ 548 struct dataset *ds[7]; 549 int nds; 550 double a; | 469{ 470 FILE *f; 471 char buf[BUFSIZ], *p, *t; 472 struct dataset *s; 473 double d; 474 int line; 475 int i; 476 --- 65 unchanged lines hidden (view full) --- 542} 543 544int 545main(int argc, char **argv) 546{ 547 struct dataset *ds[7]; 548 int nds; 549 double a; |
551 char *delim = " \t"; | 550 const char *delim = " \t"; |
552 char *p; 553 int c, i, ci; 554 int column = 1; 555 int flag_s = 0; 556 int flag_n = 0; 557 int termwidth = 74; 558 559 if (isatty(STDOUT_FILENO)) { --- 87 unchanged lines hidden --- | 551 char *p; 552 int c, i, ci; 553 int column = 1; 554 int flag_s = 0; 555 int flag_n = 0; 556 int termwidth = 74; 557 558 if (isatty(STDOUT_FILENO)) { --- 87 unchanged lines hidden --- |