Add Makefile. Remove empty unfold.c.
This commit is contained in:
parent
a3a3b901a8
commit
8fdb8b090e
21
src/Makefile
Normal file
21
src/Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
.POSIX:
|
||||||
|
.SUFFIX:
|
||||||
|
|
||||||
|
PREFIX = /usr
|
||||||
|
|
||||||
|
BINS = \
|
||||||
|
overwrite \
|
||||||
|
strcmp \
|
||||||
|
vis
|
||||||
|
|
||||||
|
all: $(BINS)
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -Dm755 $(BINS) $(DESTDIR)/$(PREFIX)/bin/
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm *.o $(BINS) *~ a.out
|
||||||
|
|
||||||
|
.SUFFIX:
|
||||||
|
.c.o:
|
||||||
|
cc -c -o $< $(CFLAGS) $(LDFLAGS)
|
@ -44,17 +44,17 @@ void throw(long unsigned int condition, void *info)
|
|||||||
{
|
{
|
||||||
switch(condition)
|
switch(condition)
|
||||||
{
|
{
|
||||||
case UNKNOWN_FAIL: printf("unknown failure\n");
|
case UNKNOWN_FAIL: fprintf(stderr, "unknown failure\n");
|
||||||
exit(UNKNOWN_FAIL);
|
exit(UNKNOWN_FAIL);
|
||||||
case MALLOC_FAIL: printf("malloc failure\n");
|
case MALLOC_FAIL: fprintf(stderr, "malloc failure\n");
|
||||||
exit(MALLOC_FAIL);
|
exit(MALLOC_FAIL);
|
||||||
case NEEDARG_FAIL: printf("usage: %s\n", (char *) info);
|
case NEEDARG_FAIL: fprintf(stderr, "usage: %s\n", (char *) info);
|
||||||
exit(NEEDARG_FAIL);
|
exit(NEEDARG_FAIL);
|
||||||
case FOPEN_FAIL: printf("failed to open: %s\n", (char *) info);
|
case FOPEN_FAIL: fprintf(stderr, "failed to open: %s\n", (char *) info);
|
||||||
exit(FOPEN_FAIL);
|
exit(FOPEN_FAIL);
|
||||||
case WRITE_FAIL: printf("failed to write: %s\n", (char *) info);
|
case WRITE_FAIL: fprintf(stderr, "failed to write: %s\n", (char *) info);
|
||||||
exit(WRITE_FAIL);
|
exit(WRITE_FAIL);
|
||||||
default: printf("You shouldn't be seeing this.\nSomething is very wrong.\n");
|
default: fprintf(stderr, "You shouldn't be seeing this.\nSomething is very wrong.\n");
|
||||||
exit(-256);
|
exit(-256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#
|
|
13
src/vis.c
13
src/vis.c
@ -8,19 +8,18 @@
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, c;
|
int c;
|
||||||
FILE *fp;
|
c = 0;
|
||||||
i = c = 0;
|
|
||||||
|
|
||||||
for(;(c = getchar()) != EOF; i++)
|
for(;(c = getchar()) != EOF;)
|
||||||
{
|
{
|
||||||
if(isascii(c) && (c != ' ' && c != '\n' && c != '\t'))
|
if(isascii(c) && !(c == ' ' || c == '\n' || c == '\t'))
|
||||||
{
|
{
|
||||||
printf("%c", c);
|
putc(c, stdout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("%.3o", c);
|
fprintf(stdout, "%.3o", c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user