From c0e548d323c48bd59bd6443a0d0117b38b977d3f Mon Sep 17 00:00:00 2001 From: DTB Date: Mon, 25 Dec 2023 16:56:58 -0700 Subject: [PATCH] npc incorporated into bonsai --- npc/Makefile | 1 - npc/npc.1 | 51 --------------------------------------------------- npc/npc.c | 46 ---------------------------------------------- 3 files changed, 98 deletions(-) delete mode 100644 npc/Makefile delete mode 100644 npc/npc.1 delete mode 100644 npc/npc.c diff --git a/npc/Makefile b/npc/Makefile deleted file mode 100644 index fee0f8d..0000000 --- a/npc/Makefile +++ /dev/null @@ -1 +0,0 @@ -npc: npc.c diff --git a/npc/npc.1 b/npc/npc.1 deleted file mode 100644 index 8156be0..0000000 --- a/npc/npc.1 +++ /dev/null @@ -1,51 +0,0 @@ -.TH npc 1 - -.SH NAME - -npc \(en show non-printing characters - -.SH SYNOPSIS - -npc -.RB ( -eht ) - -.SH DESCRIPTION - -Npc reads from standard input and writes to standard output, replacing non- -printing characters with printable equivalents. Control characters print as a -carat ('^') followed by the character '@' through '_' corresponding to the -character replaced (e.g. control-X becomes "^X"). The delete character (0x7F) -becomes "^?". Characters with the high bit set (>127) are printed as "M-" -followed by the graphical representation for the same character without the -high bit set. -.PP -The -.B -e -option prints a currency sign ('$') before each line ending. -.PP -The -.B -t -option prints tab characters as "^I" rather than a literal horizontal tab. - -.SH DIAGNOSTICS - -Npc prints a debug message and exits with the appropriate sysexits(3) error -code in the event of an error, otherwise it exits successfully. - -.SH BUGS - -Npc operates in single-byte chunks regardless of intended encoding. - -.SH STANDARDS - -None. - -.SH COPYRIGHT - -Public domain. - -.SH SEE ALSO - -cat(1), cat-v(1) -.PP -"UNIX Style, or cat -v Considered Harmful" by Rob Pike diff --git a/npc/npc.c b/npc/npc.c deleted file mode 100644 index 3345d37..0000000 --- a/npc/npc.c +++ /dev/null @@ -1,46 +0,0 @@ -#include /* fprintf(3), fputs(3), getc(3), putc(3), stdin, stdout, - * EOF */ -#include /* getopt(3) */ -#if !defined EX_USAGE || !defined EX_OK -# include -#endif - -int main(int argc, char *argv[]){ - int c; - char showend; - char showtab; - - showend = 0; - showtab = 0; - - if(argc > 0) - while((c = getopt(argc, argv, "et")) != -1) - switch(c){ - case 'e': showend = 1; break; - case 't': showtab = 1; break; - default: goto usage; - } - - if(argc > optind){ -usage: fprintf(stderr, "Usage: %s (-eht)\n", argv[0]); - return EX_USAGE; - } - - while((c = getc(stdin)) != EOF){ - if((c & 0x80) != 0) - fputs("M-", stdout); - switch(c ^ 0x80 /* 0b 1000 0000 */){ - case 0x7f: fputs("^?", stdout); - break; - case '\n': if(showend) - putc('$', stdout); - default: - if(c >= ' ' || c == '\n' || (!showtab && c == '\t')) - putc(c, stdout); - else - fprintf(stdout, "^%c", c + '@'); - } - } - - return EX_OK; -}