Xref: utzoo comp.bugs.4bsd:1689 comp.std.c:4215 comp.lang.c:35621 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!psuvax1!news From: schwartz@groucho.cs.psu.edu (Scott Schwartz) Newsgroups: comp.bugs.4bsd,comp.std.c,comp.lang.c Subject: Re: Safe coding practices (was Re: Bug in users command) Message-ID: <9k9G!#9a@cs.psu.edu> Date: 30 Jan 91 04:58:04 GMT References: <87681@tut.cis.ohio-state.edu> <22921@well.sf.ca.us> <87774@tut.cis.ohio-state.edu> <1991Jan29.203900.11987@Think.COM> Sender: news@cs.psu.edu (Usenet) Organization: penn state computer science Lines: 26 In-Reply-To: barmar@think.com's message of 29 Jan 91 20:39:00 GMT Nntp-Posting-Host: groucho.cs.psu.edu barmar@think.com (Barry Margolin) writes: | I agree with this most emphatically. The kind of software design Mr.Manson | is complaining about is rampant in the industry, and pervades Unix. Most | programmers learn software design by example. Sometimes this is good, when | a good programming style (e.g. programs that filter stdin to stdout) is | mimicked, but it also propogates poor programming practices. When I talk | about the "brokenness" of Unix, it's this kind of stuff I'm thinking of. Part of the problem is that the standard libraries most systems supply are flawed in various ways. In stdio, ``gets'' leaps to mind. Moreover, ``fgets'' imposes an upper bound on input length, so lots of programs inherit that flaw. In V10 the fast io library imposes a fixed length (not even user selectable) on lines that ``Frdline'' will return. Happily, Chris Torek's new 4.4BSD stdio provides a way to read lines of any length using ``fgetline''. The only problem with that is that there is no general mechanism to read arbitrarily long tokens -- fgetline should either take a user supplied delimiter, or there should be a separate routine (fgettoken?) to do the job. Now's that time to fix this, before 4.4BSD really hits the streets. | I'm biased, because I do much of my programming in Lisp, which | makes it easy to write programs with few arbitrary limits. I'd kill for a scheme compiler that was suitable for writing systems programs.