#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#define NULLCHK(S) if ((S) != NULL)\
exit(1)
/*
* A basic implementation of seq(1). Supports neither floating-point bounds nor
* custom increment values.
*/
int
main(int argc, char **argv) {
if (argc < 2 || argc > 3)
exit(2);
long long lo, hi;
const char *errstr = NULL;
lo = (argc == 2) ? 1 : strtonum(argv[1], LLONG_MIN, LLONG_MAX, &errstr);
NULLCHK(errstr);
hi = strtonum(argv[argc - 1], LLONG_MIN, LLONG_MAX, &errstr);
NULLCHK(errstr);
for (long long i = lo; i <= hi; i++)
printf("%lld\n", i);
exit(0);
}
tech gripe, gnu Afficher plus
@KitRedgrave for comparison, busybox yes(1), which actually resembles something real human beings would write:
https://git.busybox.net/busybox/tree/coreutils/yes.c
but yes, the whole factor of not wanting to get sued by whoever got bells labs when bell was broken up was a factor in the gnu style