diff options
Diffstat (limited to 'user/progY.c')
-rw-r--r-- | user/progY.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/user/progY.c b/user/progY.c index 194f188..43313bd 100644 --- a/user/progY.c +++ b/user/progY.c @@ -11,39 +11,42 @@ ** n is the iteration count (defaults to 10) */ -USERMAIN( main ) { - int count = 10; // default iteration count - char ch = 'y'; // default character to print +USERMAIN(main) +{ + int count = 10; // default iteration count + char ch = 'y'; // default character to print char buf[128]; // process the command-line arguments - switch( argc ) { - case 3: count = str2int( argv[2], 10 ); - // FALL THROUGH - case 2: ch = argv[1][0]; - break; + switch (argc) { + case 3: + count = str2int(argv[2], 10); + // FALL THROUGH + case 2: + ch = argv[1][0]; + break; default: - sprint( buf, "?: argc %d, args: ", argc ); - cwrites( buf ); - for( int i = 0; i <= argc; ++i ) { - sprint( buf, " %s", argv[argc] ? argv[argc] : "(null)" ); - cwrites( buf ); - } - cwrites( "\n" ); + sprint(buf, "?: argc %d, args: ", argc); + cwrites(buf); + for (int i = 0; i <= argc; ++i) { + sprint(buf, " %s", argv[argc] ? argv[argc] : "(null)"); + cwrites(buf); + } + cwrites("\n"); } // report our presence int pid = getpid(); - sprint( buf, " %c[%d]", ch, pid ); - swrites( buf ); + sprint(buf, " %c[%d]", ch, pid); + swrites(buf); - for( int i = 0; i < count ; ++i ) { - swrites( buf ); + for (int i = 0; i < count; ++i) { + swrites(buf); DELAY(STD); - sleep( SEC_TO_MS(1) ); + sleep(SEC_TO_MS(1)); } - exit( 0 ); + exit(0); - return( 42 ); // shut the compiler up! + return (42); // shut the compiler up! } |