🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.apple2
Article #20

v001SRC016: show -- Display Non-Printing Characters

#20
From: Jonathan A. Chandross
Date: Sat, 01 Dec 1990 21:56
99 lines
2181 bytes
Submitted-by: NONE
Posting-number: Volume 1, Source:16
Archive-name: util/show
Architecture: ANY_2
Version-number: 1.00

This utility displays non-rpinting characters in a file.

Enjoy.


=show.c
-
-/*
- * show.c
- *
- * Display non-printing chars in a file.
- *	Non-printing character mappings:
- *		CHARACTER	DISPLAYED AS
- * 		tab 		>
- * 		newline 	$
- * 		control X 	~X	where X is any control character
- * 		delete 		~~
- * 	Newlines and tabs are also echoed to output as control characters.
- *
- * Usage:
- * 	show [file_1] [file_2] [file_3] [...]
- *
- * 	If no file is specified, show reads from standard in. 
- *
- * Contributed Anonymously.  Written: November 1983
- *
- * Version 1.00
- *
- */
-
-#include "stdio.h"
-
-#define BLANK ' '
-#define TAB   '\t'
-#define NL    '\n'
-
-main(argc, argv)
-int argc ;
-char *argv[] ;
-{
-	FILE *input ;
-
-
-	argc-- ; argv++ ;
-
-	if( argc == 0 )
-		show( stdin ) ;
-
-	else
-		for( ; argc>0 ; argc--,argv++)
-			if( (input=fopen(*argv,"r")) == NULL ) {
-				fprintf(stderr, "show: can't open %s\n", *argv) ;
-				exit(1) ;
-			}
-			else {
-				show(input) ;
-				fclose( input ) ;
-			}
-
-	exit(0) ;
-
-} /* end main */
-
-/* show - print invisible chars */
-
-show( in )
-FILE *in ;
-{
-	int c ;
-
-
-	while( (c=agetc(in)) != EOF )
-		if( c == NL ) {
-			aputc( '$', stdout ) ;
-			aputc( NL, stdout ) ;
-		}
-		else if( c == TAB )
-			aputc( '>', stdout ) ;
-		else if( c < BLANK ) {
-			aputc( '~', stdout ) ;
-			aputc( c+'@', stdout ) ;
-		}
-		else if( c == 0x7f ) {
-			aputc( '~', stdout ) ;
-			aputc( '~', stdout ) ;
-		}
-		else
-			aputc( c, stdout ) ;
-
-} /* end show */
-
+ END OF ARCHIVE
Technical Details
Message-ID: <Dec.1.16.56.01.1990.24824@yoko.rutgers.edu>
Path: arc1-ca.pugleaf.net!wuarchive!uwm.edu!rutgers!aramis.rutgers.edu!paul.rutgers.edu!yoko.rutgers.edu!jac

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wuarchive!uwm.edu!rutgers!aramis.rutgers.edu!paul.rutgers.edu!yoko.rutgers.edu!jac
From: jac@yoko.rutgers.edu (Jonathan A. Chandross)
Newsgroups: comp.sources.apple2
Subject: v001SRC016:  show -- Display Non-Printing Characters
Message-ID: <Dec.1.16.56.01.1990.24824@yoko.rutgers.edu>
Date: 1 Dec 90 21:56:01 GMT
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 99
Approved: jac@paul.rutgers.edu