Subject: tn3270 fix - remove use of gets()
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Luke Mewburn <lm@rmit.edu.au>
List: netbsd-bugs
Date: 02/08/1994 11:19:25
PROGRAM:
    usr.bin/tn3270

DESCRIPTION:
    I'm sick of seeing the gets() warning when I compile tn3270. Here's a
    suggested patch.

    Note that I have NOT tested nor compiled this, 'cause the netbsd box
    is at home, and I'm directly hacking the source at work. It looks
    correct tho. You get the idea...

PRIORITY:
    low



#
# static char rcsid[] = "$Id: dohits.c,v 1.2 1993/08/01 18:04:57 mycroft Exp $";
#

*** tools/mkhits/dohits.c.orig	Tue Feb  8 11:11:08 1994
--- tools/mkhits/dohits.c	Tue Feb  8 11:12:35 1994
***************
*** 258,264 ****
      }
      scanwhite(fcnfile, "FCN_");
  
!     while (gets(line) != NULL) {
  	if (!isdigit(line[0])) {
  	    continue;
  	}
--- 258,264 ----
      }
      scanwhite(fcnfile, "FCN_");
  
!     while (fgets(line, sizeof(line)-2, stdin) != NULL) {
  	if (!isdigit(line[0])) {
  	    continue;
  	}


#
# static char rcsid[] = "$Id: system.c,v 1.2 1993/08/01 18:05:21 mycroft Exp $";
#

*** sys_curses/system.c.orig	Tue Feb  8 11:09:24 1994
--- sys_curses/system.c	Tue Feb  8 11:14:13 1994
***************
*** 605,611 ****
  	    }
  	    printf("[Hit return to continue]");
  	    fflush(stdout);
! 	    (void) gets(inputbuffer);
  	    setconnmode();
  	    ConnectScreen();	/* Turn screen on (if need be) */
  	    (void) close(serversock);
--- 605,611 ----
  	    }
  	    printf("[Hit return to continue]");
  	    fflush(stdout);
! 	    (void) fgets(inputbuffer, sizeof(inputbuffer)-2, stdin);
  	    setconnmode();
  	    ConnectScreen();	/* Turn screen on (if need be) */
  	    (void) close(serversock);



-- 
``Concealment is never as hard as people think, you          Luke Mewburn
  must understand that. It's action while hiding that's    <lm@rmit.edu.au>
  the hard part''
        -- Coyote, in Kim Stanley Robinson's `Green Mars'

------------------------------------------------------------------------------