npc(1): specifies sysexits imports, formatting

This commit is contained in:
Emma Tebibyte 2024-07-13 17:03:41 -06:00
parent 8421f8be87
commit 35a20dca79
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -19,9 +19,9 @@
#include <stdio.h> /* fprintf(3), fputs(3), getc(3), putc(3), stdin, stdout, #include <stdio.h> /* fprintf(3), fputs(3), getc(3), putc(3), stdin, stdout,
* EOF */ * EOF */
#include <stdlib.h> /* EXIT_FAILURE, EXIT_SUCCESS */ #include <stdlib.h> /* EXIT_FAILURE */
#include <unistd.h> /* getopt(3) */ #include <unistd.h> /* getopt(3) */
#include <sysexits.h> #include <sysexits.h> /* EX_OK, EX_USAGE */
int usage(char *s) { int usage(char *s) {
fprintf(stderr, "Usage: %s [-et]\n", s); fprintf(stderr, "Usage: %s [-et]\n", s);
@ -36,8 +36,7 @@ int main(int argc, char *argv[]) {
showend = 0; showend = 0;
showtab = 0; showtab = 0;
if(!argc > 0) { usage(argv[0]); } if (argc > 0) {
while ((c = getopt(argc, argv, "et")) != -1) { while ((c = getopt(argc, argv, "et")) != -1) {
switch (c){ switch (c){
case 'e': showend = 1; break; case 'e': showend = 1; break;
@ -45,6 +44,7 @@ int main(int argc, char *argv[]) {
default: return usage(argv[0]); default: return usage(argv[0]);
} }
} }
}
if (argc > optind) { return usage(argv[0]); } if (argc > optind) { return usage(argv[0]); }