1
0

subtle bug fix

This commit is contained in:
dtb 2022-11-20 20:35:09 -05:00
parent 19f091eead
commit b484c81320
2 changed files with 6 additions and 17 deletions

View File

@ -5,7 +5,7 @@ TARGETS = pscat
all: $(TARGETS) all: $(TARGETS)
clean: clean:
$(RM) $(TARGETS) $(RM) $(TARGETS) *.o
debug: debug:
$(CC) $(DEBUG) -o pscat pscat.c $(CC) $(DEBUG) -o pscat pscat.c

View File

@ -1,33 +1,22 @@
#include <stdio.h> #include <stdio.h>
#include <sysexits.h>
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
#ifndef DONT_USE_SYSTEM_SYSEXITS
# include <sysexits.h>
#else
# include "../sysexits/sysexits.h"
#endif /* ifndef DONT_USE_SYSTEM_SYSEXITS */
#include "psargs.h" #include "psargs.h"
static char *program_name = "pscat"; static char *program_name = "pscat";
/* Originally designed to use parentheses but changed to brackets to escape the /* Originally designed to use parentheses but changed to brackets to escape the
* hassle of escaping them from the Bourne shell. */ * hassle of escaping them from the Bourne shell. */
#ifndef USE_ASCII_H
#define L_PAREN '[' #define L_PAREN '['
#define R_PAREN ']' #define R_PAREN ']'
#else
# include "../ascii/ascii.h"
# define L_PAREN ASCII_LEFT_SQUARE_BRACKET
# define R_PAREN ASCII_RIGHT_SQUARE_BRACKET
#endif /* ifndef USE_ASCII_H */
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
char **psstart; char **psstart;
int child; int child;
int i; int i;
int retval; unsigned int retval;
int terms; int terms;
retval = 0; retval = 0;
@ -35,7 +24,7 @@ int main(int argc, char *argv[]){
if((terms = check_arg(++argv, L_PAREN, R_PAREN)) == 0){ if((terms = check_arg(++argv, L_PAREN, R_PAREN)) == 0){
fprintf(stderr, fprintf(stderr,
"Usage: %s \"[\" [utility [argument...]] \"]\" ...\n", "Usage: %s \"[\" [utility [argument...]] \"]\" ...\n",
argv[0] == NULL ? program_name : argv[0] argv[-1] == NULL ? program_name : argv[-1]
); );
return EX_USAGE; return EX_USAGE;
} }