Subject: Re: gets()
To: Chris G. Demetriou <cgd@postgres.berkeley.edu>
From: Alan Barrett <barrett@daisy.ee.und.ac.za>
List: current-users
Date: 03/11/1994 08:22:52
cgd said:
> the only problem is, gets(), as a function:
> (1) must exist,
> (2) must take the same arguments that it does now.
> given that, there's nothing that can be done...
Sure there is. I believe that a scenario like the following would
be more useful that what we have now, and would not be difficult to
implement.
fantasy% cat prog.c
#include <stdio.h>
int main (void) { char buff[80]; gets(buff); puts(buff); return 0; }
fantasy% cc -o prog prog.c
ld: warning: this program uses gets(), which is unsafe.
fantasy% echo foo | ./prog
this program uses gets(), which is unsafe.
foo
fantasy% cc -o prog -lgets_that_does_not_print_to_stderr prog.c
ld: warning: this program uses gets(), which is unsafe.
fantasy% echo foo | ./prog
foo
fantasy%
--apb (Alan Barrett)
------------------------------------------------------------------------------