#-h- dspc.r 1420 asc 09-apr-81 09:36:11 [002,101] #-h- main 904 asc 09-apr-81 09:36:04 [002,101] ## dspc - show what's in a file, displaying control characters DRIVER(dspc) character buf(MAXLINE) integer getarg, open integer i, files data files /NO/ call query("usage: dspc [file] ...") for (i=1; getarg(i, buf, MAXLINE) != EOF; i=i+1) { if (buf(1) == MINUS & buf(2) == EOS) #read from STDIN int = STDIN else if (buf(1) == MINUS) #process flags { call remark ('ignoring invalid argument.') next } else { int = open(buf, READ) if (int == ERR) call cant(buf) } call showc (int) files = YES if (int != STDIN) call close(int) } if (files == NO) call showc (STDIN) #no files specified; read from STDIN DRETURN end #-h- showc 392 asc 09-apr-81 09:36:06 [002,101] ## showc - display all characters in file 'int' # This routine assumes all characters are ASCII--it won't # work if you have subverted this convention subroutine showc (int) character c, getch integer int while (getch(c, int) ^= EOF) { if (c ^= NEWLINE & c < BLANK) { call putc(CARET) c = c + ATSIGN } call putc(c) } return end #-h- dspc.rof 871 asc 03-may-81 01:07:13 [002,100] .pl 60 .bp 1 .in 0 .he 'DSPC (1)'7/1/79'DSPC (1)' .sp 2 .in +3 .fi .ti -3 NAME .br dspc - display all characters in a file .nf .sp .ti -3 SYNOPSIS .br dspc [files ...] .fi .sp .ti -3 DESCRIPTION .br Dspc copies the named files to the standard output, replacing control characters by "^c", where c is the ascii character used to enter the control character when depressing the "control" key on most terminals. More precisely, c is the ascii character whose value is 100 (octal) plus the value of the control character. .sp Control characters are those ascii characters with values between 0 and 31, inclusive. Newline characters are displayed as usual, however. .sp If no filenames are given, or the name '-' is specified, dspc will read from the standard input. .fi .sp .ne 2 .ti -3 SEE ALSO .br cat, page .sp .ti -3 AUTHORS .br David Hanson and friends (U. of Arizona)