Revert "vfs_btrfs: fix compile on 32-bit platforms."
[Samba.git] / lib / ccan / tally / _info
blob6dab9b7dd6faabccd8cad6f222243b2f0e371436
1 #include <stdio.h>
2 #include <string.h>
3 #include "config.h"
5 /**
6  * tally - running tally of integers
7  *
8  * The tally module implements simple analysis of a stream of integers.
9  * Numbers are fed in via tally_add(), and then the mean, median, mode and
10  * a histogram can be read out.
11  *
12  * Example:
13  *      #include <stdio.h>
14  *      #include <err.h>
15  *      #include <ccan/tally/tally.h>
16  *
17  *      int main(int argc, char *argv[])
18  *      {
19  *              struct tally *t;
20  *              unsigned int i;
21  *              size_t err;
22  *              ssize_t val;
23  *              char *histogram;
24  *
25  *              if (argc < 2)
26  *                      errx(1, "Usage: %s <number>...\n", argv[0]);
27  *
28  *              t = tally_new(100);
29  *              for (i = 1; i < argc; i++)
30  *                      tally_add(t, atol(argv[i]));
31  *
32  *              printf("Mean = %zi\n", tally_mean(t));
33  *              val = tally_approx_median(t, &err);
34  *              printf("Median = %zi (+/- %zu)\n", val, err);
35  *              val = tally_approx_mode(t, &err);
36  *              printf("Mode = %zi (+/- %zu)\n", val, err);
37  *              histogram = tally_histogram(t, 50, 10);
38  *              printf("Histogram:\n%s", histogram);
39  *              free(histogram);
40  *              return 0;
41  *      }
42  *
43  * License: LGPL (v3 or any later version)
44  * Author: Rusty Russell <rusty@rustcorp.com.au>
45  */
46 int main(int argc, char *argv[])
48         if (argc != 2)
49                 return 1;
51         if (strcmp(argv[1], "depends") == 0) {
52                 printf("ccan/build_assert\n");
53                 printf("ccan/likely\n");
54                 return 0;
55         }
57         return 1;