Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1exp 11/4/83; site ihuxl.UUCP Path: utzoo!linus!decvax!harpo!floyd!clyde!ihnp4!ihuxl!dcn From: dcn@ihuxl.UUCP (Dave Newkirk) Newsgroups: net.sources Subject: Aztec C source - show.c Message-ID: <736@ihuxl.UUCP> Date: Mon, 14-Nov-83 09:26:24 EST Article-I.D.: ihuxl.736 Posted: Mon Nov 14 09:26:24 1983 Date-Received: Tue, 15-Nov-83 06:28:09 EST Organization: AT&T Bell Labs, Naperville, Il Lines: 59 /* show - display non-printing chars */ #include "stdio.h" 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 */