Path: utzoo!attcan!uunet!lll-winken!lll-ncis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!rutgers!aramis.rutgers.edu!porthos.rutgers.edu!webber From: webber@porthos.rutgers.edu (Bob Webber) Newsgroups: comp.sources.d Subject: Re: Comments on INSERT.c Message-ID: Date: 12 Jan 89 10:48:20 GMT References: <308@twwells.uucp> <313@twwells.uucp> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 46 It turns out that the man page on open does claim to start the file pointer at the beginning. As far as I am concerned, the lseek is the equiv of initializing in the program text something that is already implicitly properly initialized. I see no reason to prefer the fopen(3) based routines over the open(2) based routines. Certainly the open(2) routines were quite adequate to the task at hand. Although a few people have mentioned to me that I could have written 0L instead (long) 0; no one has been able to show me why I should prefer to. This seems purely a matter of personal style (and naturally I prefer my own way of doing things which is why I do them that way). At the time I wrote the program, I only accessed BSD man pages and so was not aware that non-BSD systems lacked ftruncate (a function which really should be added to any system that has to contend with tight disk space). Besides mentioning the use of ftruncate, the 2nd version did mention that this was BSD dependent. People who want to run INSERT are strongly urged to get a BSD-based UNIX system. Since ftruncate expects an unsigned long parameter, READSIZE has been updated to be an unsigned long (hence, believe it or not, the 12Jan89 revision just posted for those people who want to stay on the cutting edge of INSERT development). The main motivation for the coding style was to make sure all errors were covered, so that the program wouldn't fail without the user knowing that it had. Lord knows that there are plenty of programs out there with pretty error messages that ignore many system error returns. The fact that the program cannot be conveniently used without easy access to its source seems to me a benefit rather than a drawback. Fortunately we live in a country where people are permitted to write code according to their own lights. If someone else wants to write a version by their own lights, I have but one word of advice: read carefully the man pages of all system routines used and test the program out on a file system that is 105% full -- pretty user interfaces on broken programs are of no use to anyone. --- BOB (webber@athos.rutgers.edu ; rutgers!athos.rutgers.edu!webber) p.s., all of the versions posted work fine on int==long BSD systems; only the 12Jan89 version is likely to work on int==short!=long BSD systems (i.e., PDP-11s and perhaps some microcomputers).