diff options
author | Freya Murphy <freya@freyacat.org> | 2025-03-27 11:39:12 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-03-27 11:39:12 -0400 |
commit | 0ff301cda68669c59351e5854ce98f2cf460543f (patch) | |
tree | cfe8f976261962420ada64b821559b9da0a56841 /user/progDE.c | |
parent | add compile_flags.txt for clangd lsp (diff) | |
download | comus-0ff301cda68669c59351e5854ce98f2cf460543f.tar.gz comus-0ff301cda68669c59351e5854ce98f2cf460543f.tar.bz2 comus-0ff301cda68669c59351e5854ce98f2cf460543f.zip |
pull upstream changes, add auto formatting
Diffstat (limited to 'user/progDE.c')
-rw-r--r-- | user/progDE.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/user/progDE.c b/user/progDE.c index a1aa0b3..be2dd1b 100644 --- a/user/progDE.c +++ b/user/progDE.c @@ -12,45 +12,48 @@ ** n is the iteration count */ -USERMAIN( main ) { +USERMAIN(main) +{ int n; - int count = 30; // default iteration count - char ch = '2'; // default character to print + int count = 30; // default iteration count + char ch = '2'; // 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, "main2: 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, "main2: 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"); } // announce our presence - n = swritech( ch ); - if( n != 1 ) { - sprint( buf, "== %c, write #1 returned %d\n", ch, n ); - cwrites( buf ); + n = swritech(ch); + if (n != 1) { + sprint(buf, "== %c, write #1 returned %d\n", ch, n); + cwrites(buf); } // iterate and print the required number of other characters - for( int i = 0; i < count; ++i ) { + for (int i = 0; i < count; ++i) { DELAY(STD); - n = swritech( ch ); - if( n != 1 ) { - sprint( buf, "== %c, write #2 returned %d\n", ch, n ); - cwrites( buf ); + n = swritech(ch); + if (n != 1) { + sprint(buf, "== %c, write #2 returned %d\n", ch, n); + cwrites(buf); } } // all done! - return( 0 ); + return (0); } |