33 lines
889 B
C
33 lines
889 B
C
#include "types.h"
|
|
#include "user.h"
|
|
|
|
// Simple user app to do a count from 0 to the given number (1000 by defaulf)
|
|
// for testing concurrency
|
|
int main(int argc, char *argv[]) {
|
|
int countto = 1000;
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
if (strcmp(argv[i], "-c") == 0) {
|
|
countto = atoi(argv[i + 1]);
|
|
}
|
|
else if (strcmp(argv[i], "-help") == 0)
|
|
{
|
|
printf(1, "Counts from 0 to the given number.\n");
|
|
printf(1, "Default: 1000\n");
|
|
printf(1, "Options:\n");
|
|
printf(1, "-c [Number] : Sets the value to count upto.\n");
|
|
exit();
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
cls();
|
|
printf(1, "Start Count\n");
|
|
for (int i = 0; i < countto; i++)
|
|
{
|
|
printf(1, "%d\n", i);
|
|
sleep(10);
|
|
}
|
|
printf(1, "Count Ended\n");
|
|
exit();
|
|
}
|