1
0

sysexits(1) working

This commit is contained in:
dtb 2022-06-04 20:26:12 -04:00
parent e564d62bf6
commit adafc55a05
2 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,8 @@ CC=cc
CFLAGS=-I include/ -I lib/ -Wall CFLAGS=-I include/ -I lib/ -Wall
RM=rm -f RM=rm -f
working: id
all: libraries programs all: libraries programs
cleanall: clean cleanlibraries cleanprograms cleanall: clean cleanlibraries cleanprograms

View File

@ -119,14 +119,13 @@ static int findbyint(int status){
for(i = 0; i < ARRAYLEN(sysexits); ++i) for(i = 0; i < ARRAYLEN(sysexits); ++i)
if(sysexits[i].status == status) if(sysexits[i].status == status)
return i; return i;
return -1;
} }
static void output_comment(int fd, int indentation, int width, char *comment){ static void output_comment(int fd, int indentation, int width, char *comment){
size_t word_start; size_t word_start;
size_t line_start; size_t line_start;
return;
for(i = 0, line_start = 0, word_start = 0; ; ++i) for(i = 0, line_start = 0, word_start = 0; ; ++i)
switch(comment[i]){ switch(comment[i]){
case '\0': case '\0':
@ -154,7 +153,7 @@ static void output_comment(int fd, int indentation, int width, char *comment){
static void output_header(void){ static void output_header(void){
write(1, header_prefix, ARRAYLEN(header_prefix) - 1); write(1, header_prefix, ARRAYLEN(header_prefix) - 1);
for(i = 0; i < ARRAYLEN(sysexits); ++i){ for(i = 0; i < ARRAYLEN(sysexits); ++i){
output_comment(1, 1 * TAB_WIDTH, 80, sysexits[i].desc); //output_comment(1, 1 * TAB_WIDTH, 80, sysexits[i].desc);
#ifdef ENUM #ifdef ENUM
fprintf(stdout, "\t%s = %d%s", fprintf(stdout, "\t%s = %d%s",
sysexits[i].name, sysexits[i].name,
@ -169,6 +168,7 @@ static void output_header(void){
); );
#endif /* ifdef DEFINE */ #endif /* ifdef DEFINE */
} }
fflush(stdout); /* Fixes actual issue. */
write(1, header_suffix, ARRAYLEN(header_suffix) - 1); write(1, header_suffix, ARRAYLEN(header_suffix) - 1);
} }