retiring gets(3)
John Woods
john at frog.UUCP
Thu Nov 17 15:13:00 AEST 1988
In article <660023 at hpclscu.HP.COM>, shankar at hpclscu.HP.COM (Shankar Unni) writes:
> > gets() has legitimate uses. It is in the library Base Document.
> > It is widely used in existing code (sometimes safely, sometimes not).
> > It stays.
> Exactly how do you use gets "safely"?
The only case I can think of is when you have a process that fork()s, and the
parent feeds the child stuff which is guaranteed to fit into the buffer.
I used to think that parsing machine-generated output files was another case.
Then one day my program for analyzing /usr/spool/uucp/SYSLOG started blowing
out because I had run out of space during a uucp transfer...
gets. A clock-tick of convenience. A process-lifetime of regret. :-)
--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu
Science does not remove the TERROR of the Gods!
More information about the Comp.lang.c
mailing list