Path: utzoo!attcan!uunet!cs.utexas.edu!usc!ginosko!xanth!mcnc!decvax!ima!esegue!johnl From: johnl@esegue.uucp (John Levine) Newsgroups: comp.sys.ibm.pc Subject: Re: ^Z in files (was: Unix-like cat for MS-DOS) Message-ID: <1989Aug14.173607.10610@esegue.uucp> Date: 14 Aug 89 17:36:07 GMT References: <380@wjh12.harvard.edu> <1436@mks.UUCP> <1129@gtx.com> Reply-To: johnl@esegue.UUCP (John Levine) Distribution: na Organization: Segue Software, Cambridge MA Lines: 32 In article <1129@gtx.com> sue@gtx.UUCP (Sue Miller) writes: >In article <1436@mks.UUCP> andy@mks.waterloo.edu (Andy Toy) writes: >>Why, oh why, do programmes insist on putting ^Z in files? ... > ... >The reason I assume that MS-DOS 1.0 might have used ^Z is because I >remember that CP/M used it, and MS-DOS is quite heavily based on CP/M. >My next question is: Why the heck was ^Z used for EOF? That seems a very >strange choice. CP/M stored files as a set of 128 byte records (which usually corresponded directly to 128 byte floppy disk blocks) and the ^Z was important because there was no other way to tell where in the last block the text ended. MS-DOS has aways kept an actual file length in the directory, so there has never been a compelling reason for DOS programs to use ^Z. An uncompelling reason is that many early DOS programs were translated more or less mechanically from CP/M and so padded files out to a multiple of 128 and put in the ^Z, just like they did on CP/M. DOS 1.x was a direct clone of CP/M, and legend says that IBM required that it be "100% compatible with CP/M-80," even though nobody knew what that meant on the 8088, which of course can't run any kind of 8080 code, CP/M or otherwise. One presumes that an IBMer asked whether it was 100% compatible, and Bill Gates said yes, thereby making himself a billion dollars. If you're wondering why ^Z, it's because PDP-10 TOPS-10, from which CP/M borrowed much of its interface style, used it to signal EOF from the keyboard, and occasionally in old programs as an end of text indicator in a file. -- John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 492 3869 {ima|lotus}!esegue!johnl, johnl@ima.isc.com, Levine@YALE.something Massachusetts has 64 licensed drivers who are over 100 years old. -The Globe