Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Oct 2017 10:34:03 -0700
From:      Cy Schubert <Cy.Schubert@komquats.com>
To:        Alexey Dokuchaev <danfe@FreeBSD.org>
Cc:        Cy Schubert <cy@FreeBSD.org>, ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   Re: svn commit: r451623 - in head/net/tcpview: . files
Message-ID:  <201710091734.v99HY3YM011289@slippy.cwsent.com>
In-Reply-To: Message from Alexey Dokuchaev <danfe@FreeBSD.org> of "Mon, 09 Oct 2017 17:07:19 -0000." <20171009170719.GA89682@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20171009170719.GA89682@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@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710091734.v99HY3YM011289>