Lines Matching +full:s +full:- +full:mode
1 /*-
4 * SPDX-License-Identifier: BSD-2-Clause
22 fprintf(stderr, "usage: %s [-b bytes | -c lines | -e] [-s buffer-size]\n", in usage()
34 enum { MODE_BYTES, MODE_COUNT, MODE_EOF } mode; in main() local
38 * -b specifies number of bytes. in main()
39 * -c specifies number of read() calls. in main()
40 * -e specifies eof (default) in main()
41 * -s to pass a buffer size in main()
43 * Reading N lines is the same as -c with a high buffer size. in main()
45 mode = MODE_EOF; in main()
46 while ((ch = getopt(argc, argv, "b:c:es:")) != -1) { in main()
49 mode = MODE_BYTES; in main()
52 errx(1, "strtonum: %s", errstr); in main()
55 mode = MODE_COUNT; in main()
58 errx(1, "strtonum: %s", errstr); in main()
61 mode = MODE_EOF; in main()
63 case 's': in main()
66 errx(1, "strtonum: %s", errstr); in main()
74 if (mode == MODE_BYTES) in main()
88 * Be careful not to over-read if we're in byte-mode. In every other in main()
89 * mode, we'll read as much as we can. in main()
91 if (mode == MODE_BYTES) in main()
97 if (ret == -1 && errno == EINTR) in main()
99 if (ret == -1) in main()
102 if (mode == MODE_EOF) in main()
111 * Bail out if we've hit our metric (byte mode / count mode). in main()
113 switch (mode) { in main()
115 reps -= ret; in main()
120 reps--; in main()