Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!ames!ucbcad!ucbvax!levy@ucbvax.Berkeley.EDU@ttrdc.UUCP From: levy@ucbvax.Berkeley.EDU@ttrdc.UUCP Newsgroups: mod.computers.vax Subject: (none) Message-ID: <8701251759.AA15198@ucbvax.Berkeley.EDU> Date: Sun, 25-Jan-87 12:59:19 EST Article-I.D.: ucbvax.8701251759.AA15198 Posted: Sun Jan 25 12:59:19 1987 Date-Received: Wed, 28-Jan-87 06:51:32 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 32 Approved: info-vax@sri-kl.arpa In article <870120220430.0a4@CitHex.Caltech.Edu>, carl@CITHEX.CALTECH.EDU.UUCP writes: >Now, "text" files tend to: > 1) Not be directories; > 2) Have a record format of either variable length or some sort of > stream records; > 3) Belong to files organized sequentially; > 4) Have PRINT, FORTRAN, or IMPLIED (CARRIAGE-RETURN) carriage control > attributes, and the blocks are generally allowed to cross block > boundaries. >Checking these fields in the stat structure will come about as close as >you can come to deciding whether you're dealing with a "text" file or a >binary file without resorting to something like: > 1) Checking a few of the leading records of the file to discover > whether they conform to the formats of, say executable, object, > or library files; or > 2) Running the thing through a dictionary so see if it has may > recognizable words in it. Why look for "words"? Simply checking for non-ASCII characters would suffice, which could even be done on the fly while reading the file into the applica- ion program (editor, I believe it was). This is presuming, as you suggest, that the file attributes support the plausibility of the file being a text file. (Note--an overly long maximum record length could be used to rule out the possibility of a "text file" too.) ------------------------------- Disclaimer: The views contained herein are | dan levy | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, allegra,ulysses,vax135}!ttrdc!levy