mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 12:34:26 +01:00
count: generalize max
This commit is contained in:
@@ -1,11 +1,18 @@
|
|||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(int argc, char **argv) {
|
||||||
int i = 0;
|
unsigned long i = 0, max;
|
||||||
while (1) {
|
if (argc > 1) {
|
||||||
printf("%d\n", i);
|
max = strtoul(argv[1], NULL, 10);
|
||||||
i++;
|
} else {
|
||||||
sleep(1);
|
max = ULONG_MAX;
|
||||||
}
|
}
|
||||||
|
while (i < max) {
|
||||||
|
printf("%lu\n", i);
|
||||||
|
i++;
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user