independ pscat(1)
This commit is contained in:
parent
ec717feb5f
commit
97c96d1063
20
Makefile
20
Makefile
@ -93,11 +93,13 @@ nutshell.o: libio usefulmacros src/nutshell.c src/nutshell.h src/nutshell_builti
|
|||||||
nutshell: libio nutshell.o
|
nutshell: libio nutshell.o
|
||||||
$(CC) $(CFLAGS) -o bin/nutshell build/libio.o build/nutshell.o
|
$(CC) $(CFLAGS) -o bin/nutshell build/libio.o build/nutshell.o
|
||||||
|
|
||||||
pscat.o: libio src/pscat.c
|
pscat: bin/pscat
|
||||||
$(CC) $(CFLAGS) -c -o build/pscat.o src/pscat.c
|
|
||||||
|
|
||||||
pscat: libio pscat.o
|
bin/pscat: pscat/pscat
|
||||||
$(CC) $(CFLAGS) -o bin/pscat build/libio.o build/pscat.o
|
mv pscat/pscat bin/pscat
|
||||||
|
|
||||||
|
pscat/pscat: sysexits pscat/pscat.c pscat/Makefile
|
||||||
|
$(MAKE) -C pscat sane
|
||||||
|
|
||||||
retval.o: libio src/retval.c sysexits
|
retval.o: libio src/retval.c sysexits
|
||||||
$(CC) $(CFLAGS) -c -o build/retval.o src/retval.c
|
$(CC) $(CFLAGS) -c -o build/retval.o src/retval.c
|
||||||
@ -105,13 +107,17 @@ retval.o: libio src/retval.c sysexits
|
|||||||
retval: libio retval.o
|
retval: libio retval.o
|
||||||
$(CC) $(CFLAGS) -o bin/retval build/retval.o build/libio.o
|
$(CC) $(CFLAGS) -o bin/retval build/retval.o build/libio.o
|
||||||
|
|
||||||
roll: roll/roll
|
roll: bin/roll
|
||||||
|
|
||||||
|
bin/roll: roll/roll
|
||||||
mv roll/roll bin/roll
|
mv roll/roll bin/roll
|
||||||
|
|
||||||
roll/roll: sysexits roll/roll.c roll/Makefile
|
roll/roll: sysexits roll/roll.c roll/Makefile
|
||||||
$(MAKE) -C roll sane
|
$(MAKE) -C roll sane
|
||||||
|
|
||||||
rot13: rot13/rot13
|
rot13: bin/rot13
|
||||||
|
|
||||||
|
bin/rot13: rot13/rot13
|
||||||
mv rot13/rot13 bin/rot13
|
mv rot13/rot13 bin/rot13
|
||||||
|
|
||||||
rot13/rot13: sysexits rot13/rot13.c rot13/Makefile
|
rot13/rot13: sysexits rot13/rot13.c rot13/Makefile
|
||||||
@ -288,4 +294,4 @@ unscii-user:
|
|||||||
curl "http://viznut.fi/unscii/unscii-16-full.pcf" >"~/.fonts/unscii-16-full.pcf"
|
curl "http://viznut.fi/unscii/unscii-16-full.pcf" >"~/.fonts/unscii-16-full.pcf"
|
||||||
curl "http://viznut.fi/unscii/unscii-16-full.ttf" >"~/.fonts/unscii-16-full.ttf"
|
curl "http://viznut.fi/unscii/unscii-16-full.ttf" >"~/.fonts/unscii-16-full.ttf"
|
||||||
|
|
||||||
.PHONY: all clean cleanlibraries cleanprograms stdbool sysexits usefulmacros
|
.PHONY: all clean cleanlibraries cleanprograms pscat roll rot13 stdbool sysexits usefulmacros
|
||||||
|
28
pscat/Makefile
Normal file
28
pscat/Makefile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
all: pscat
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf ../dist/pscat ../dist/pscat.tar ../dist/pscat.tar.gz pscat
|
||||||
|
|
||||||
|
dist: ../dist/pscat.tar.gz
|
||||||
|
|
||||||
|
sane: pscat.c ../include/sysexits.h
|
||||||
|
$(CC) -DUSE_ASCII_H -DDONT_USE_SYSTEM_SYSEXITS -o pscat pscat.c
|
||||||
|
|
||||||
|
pscat: pscat.c
|
||||||
|
$(CC) -o pscat pscat.c
|
||||||
|
|
||||||
|
../dist/pscat: pscat
|
||||||
|
mkdir -p ../dist/pscat.tmp/bin/ ../dist/pscat.tmp/share/man/man1/
|
||||||
|
cp pscat ../dist/pscat.tmp/bin/pscat
|
||||||
|
cp pscat.1 ../dist/pscat.tmp/share/man/man1/pscat.1
|
||||||
|
mv ../dist/pscat.tmp ../dist/pscat
|
||||||
|
|
||||||
|
../dist/pscat.tar: ../dist/pscat
|
||||||
|
cd ../dist/pscat && pax -w -x ustar . >../pscat.tar.tmp
|
||||||
|
mv ../dist/pscat.tar.tmp ../dist/pscat.tar
|
||||||
|
|
||||||
|
../dist/pscat.tar.gz: ../dist/pscat.tar
|
||||||
|
gzip -c <../dist/pscat.tar >../dist/pscat.tar.gz.tmp
|
||||||
|
mv ../dist/pscat.tar.gz.tmp ../dist/pscat.tar.gz
|
||||||
|
|
||||||
|
.PHONY: all clean sane
|
@ -1,15 +1,25 @@
|
|||||||
#include <ascii.h>
|
#ifndef DONT_USE_SYSTEM_SYSEXITS
|
||||||
# include <sysexits.h>
|
# include <sysexits.h>
|
||||||
|
#else
|
||||||
|
# include "../include/sysexits.h"
|
||||||
|
#endif /* ifndef DONT_USE_SYSTEM_SYSEXITS */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "libio.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 R_PAREN ']'
|
||||||
|
#else
|
||||||
|
# include "../include/ascii.h"
|
||||||
# define L_PAREN ASCII_LEFT_SQUARE_BRACKET
|
# define L_PAREN ASCII_LEFT_SQUARE_BRACKET
|
||||||
# define R_PAREN ASCII_RIGHT_SQUARE_BRACKET
|
# define R_PAREN ASCII_RIGHT_SQUARE_BRACKET
|
||||||
|
#endif /* ifndef USE_ASCII_H */
|
||||||
|
|
||||||
/* Test string containing { c, '\0' } without iteration.
|
/* Test string containing { c, '\0' } without iteration.
|
||||||
* Theoretically saves a little bit of time compared to strcmp(3). */
|
* Theoretically saves a little bit of time compared to strcmp(3). */
|
||||||
@ -53,7 +63,6 @@ check_arg(char **argv){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
char *argv0;
|
|
||||||
char **psstart;
|
char **psstart;
|
||||||
int child;
|
int child;
|
||||||
int i;
|
int i;
|
||||||
@ -61,13 +70,13 @@ int main(int argc, char *argv[]){
|
|||||||
int retval;
|
int retval;
|
||||||
int terms;
|
int terms;
|
||||||
|
|
||||||
argv0 = argv[0] == NULL ? program_name : argv[0];
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
if((terms = check_arg(++argv)) == 0){
|
if((terms = check_arg(++argv)) == 0){
|
||||||
write(2, "Usage: ", 7);
|
fprintf(stderr,
|
||||||
fdprint(2, argv0);
|
"Usage: %s \"[\" [utility [argument...]] \"]\" ...\n",
|
||||||
write(2, " \"[\" [utility [argument...]] \"]\" ...\n", 37);
|
argv[0] == NULL ? program_name : argv[0]
|
||||||
|
);
|
||||||
return EX_USAGE;
|
return EX_USAGE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user