diff --git a/count/GNUmakefile b/count/GNUmakefile new file mode 100644 index 0000000..07c6747 --- /dev/null +++ b/count/GNUmakefile @@ -0,0 +1,22 @@ +include GNUmakerules +include GNUmakevars + +acctfix: + +install: $(ROOT)/usr/local/bin/count $(ROOT)/usr/local/man/man8/count.8 + +install_all: + $(MAKE) install ROOT=/nfs/wsrdb + $(MAKE) install ROOT=/nfs/wsrcom + $(MAKE) install ROOT=/nfs/wifosv + $(MAKE) install ROOT=/nfs/ihssv + $(MAKE) install ROOT=/nfs/wsrtest + +$(ROOT)/usr/local/bin/%: % + $(INSTALL) $< $@ + +$(ROOT)/usr/local/man/man8/%.8: %.man + $(INSTALL) $< $@ + +clean: + rm count diff --git a/count/count.c b/count/count.c new file mode 100644 index 0000000..b8246b5 --- /dev/null +++ b/count/count.c @@ -0,0 +1,30 @@ +#include +#include +#include + +int main(int argc, char **argv) { + unsigned long start = 0; + unsigned long stop = ULONG_MAX; + unsigned long i; + + switch (argc) { + case 0: + case 1: + break; + case 2: + stop = strtoul(argv[1], NULL, 0); + break; + case 3: + start = strtoul(argv[1], NULL, 0); + stop = strtoul(argv[2], NULL, 0); + break; + default: + fprintf(stderr, "Usage: %s [[start] stop]\n", argv[0]); + exit(1); + } + + for (i = start; i < stop; i++) { + printf("%d\n", i); + } + return 0; +}