svn commit: r451623 - in head/net/tcpview: . files
Cy Schubert
Cy.Schubert at komquats.com
Mon Oct 9 17:34:08 UTC 2017
In message <20171009170719.GA89682 at FreeBSD.org>, Alexey Dokuchaev writes:
> On Mon, Oct 09, 2017 at 04:58:45PM +0000, Cy Schubert wrote:
> > New Revision: 451623
> > URL: https://svnweb.freebsd.org/changeset/ports/451623
> >
> > Log:
> > Use fgets() instead of gets().
> >
> > The approach I used was to create a "poor man's" gets macro as an example
> .
> > Though not the same as gets() it approximates gets() well enough. We migh
> t
> > want to consider this approach in base.
>
> I don't think I understand this comment, really.
Rather than replace gets() with fgets() directly I had a little fun with it
and created a macro, with the added benefit that maybe someone might want
to consider something like this to replace gets() when that happens. It's
not the same as gets() but close enough.
>
> > Added: head/net/tcpview/files/patch-hex.c
> > @@ -0,0 +1,10 @@
> > +--- hex.c.orig 1993-04-22 13:40:04.000000000 -0700
> > ++++ hex.c 2017-10-06 07:25:01.182767000 -0700
> > +@@ -85,6 +85,7 @@
> > + char *s;
> > +
> > + do {
> > ++#define gets(a) fgets(a,sizeof(a),stdin)
> > + if( gets(str) == NULL )
>
> gets(3) called only once in this port; why not simply patch that single
> call properly instead of bringing in a "poor man's" macro?
As an example. To open discussion of possibilities.
--
Cheers,
Cy Schubert <Cy.Schubert at cschubert.com>
FreeBSD UNIX: <cy at FreeBSD.org> Web: http://www.FreeBSD.org
The need of the many outweighs the greed of the few.
More information about the svn-ports-head
mailing list