2013-04-16 23:57:27 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
2013-04-16 23:57:30 -04:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2013-04-16 23:57:27 -04:00
|
|
|
|
|
|
|
int verbose;
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i=1; i<argc; i++) {
|
|
|
|
char *arg = argv[i];
|
|
|
|
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0)
|
|
|
|
verbose++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<10; i++) {
|
|
|
|
if (verbose) {
|
|
|
|
printf("sleep %d\n", i); fflush(stdout);
|
|
|
|
}
|
|
|
|
sleep(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<10*1000000; i += 1000000) {
|
|
|
|
if (verbose) {
|
|
|
|
printf("usleep %d\n", i); fflush(stdout);
|
|
|
|
}
|
|
|
|
usleep(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|