Testing to see if a file is ASCII

David England de at dcl-cs.UUCP
Wed Sep 11 01:14:39 AEST 1985


In the following piece of program to test for an ASCII file I know that
the commented values are magic numbers from a.out format files but I'm
curious to know what the other values represent ?

/* c is the first character in the file with descriptor f */
/* runs on UNIX 4.2 Vax or Sun */

switch ((c | *f->_ptr << 8) & 0177777) {
	case 0405:
	case 0407: /*magic number*/
	case 0410: /*magic number*/
	case 0411:
	case 0413: /*magic number*/
	case 0177545:
		printf("SomeErrorMessage");
	default:
	      break;
}

All flames to /dev/blackhole.


"I vomit when I see icons!"

-- 
UUCP    : ..!seismo!mcvax!ukc!dcl-cs!de DARPA : de%lancs.comp at ucl-cs		
JANET   : de at uk.ac.lancs.comp           PHONE : +44 524 65201 Ext. 4586
POST    : Univ. of Lancaster, Dept of Computing, Lancaster LA1 2YR, UK.
PROJECT : Alvey ECLIPSE User Interface



More information about the Comp.unix mailing list