ftp.nice.ch/pub/next/unix/hack/hackkit.2.N.bs.tar.gz#/freebies/source/see.c

This is see.c in view mode; [Download] [Up]

/*	see.c	*/

#include <ansi.h>

main(int argc,char **argv) {
    FILE *f;
    int c;
    if (argc < 2) {
	printf("Type a file with control characters expanded:\n"
	       "see <filename>\n");
	exit(1);
	}
    if (!(f=fopen(argv[1],"r"))) {
	printf("Unable to open '%s'\n",argv[1]);
	exit(1);
	}
    while ((c=getc(f)) >= 0) {
	if (c&128) printf("\\%03o",c);
	else switch(c) {
	case '\n': printf("\\n\n"); break;
	case '\r': printf("\\r\n"); break;
	case '\t': printf("\\t"); break;
	case '\\': printf("\\\\"); break;
	case '^': printf("\\^"); break;
	default:
	    if (c < 32 || c == 127) {putchar('^'); c ^= 64;}
	    putchar(c);
	    }
	}
    }

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.