#-h- dspc.r 1578 asc 6-oct-80 07:36:59 #-h- defns 50 asc 6-oct-80 07:35:05 # include standard symbols # include ratdef #-h- dspc 989 asc 6-oct-80 07:35:06 ## dspc - show what's in a file, displaying control characters subroutine main character buf(MAXLINE) integer getarg, open integer i, files data files /NO/ for (i=1; getarg(i, buf, MAXLINE) != EOF; i=i+1) { if (buf(1) == QMARK & buf(2) == EOS) #user needs help call error ("usage: dspc [file].") else 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 return end #-h- showc 392 asc 6-oct-80 07:35:06 ## 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