summaryrefslogtreecommitdiffstats
path: root/usr.bin/tn3270
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-09-29 18:44:53 +0000
committerbde <bde@FreeBSD.org>1995-09-29 18:44:53 +0000
commit416532309a9e41611ce720ed3e292f6caa4bd445 (patch)
tree2ae99e61ff7ac2f738c1903838ef125afa4fe34d /usr.bin/tn3270
parent84945bf540e750dfdb69a50f78b7322c16035a8f (diff)
downloadFreeBSD-src-416532309a9e41611ce720ed3e292f6caa4bd445.zip
FreeBSD-src-416532309a9e41611ce720ed3e292f6caa4bd445.tar.gz
Don't use gets().
sys_curses/system.c: Don't use gets() better. Neither gets() nor fgets() is appropriate for discarding a line of input.
Diffstat (limited to 'usr.bin/tn3270')
-rw-r--r--usr.bin/tn3270/ctlr/api.c7
-rw-r--r--usr.bin/tn3270/distribution/sys_dos/system.c5
-rw-r--r--usr.bin/tn3270/sys_curses/system.c5
-rw-r--r--usr.bin/tn3270/tools/mkhits/dohits.c2
4 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/tn3270/ctlr/api.c b/usr.bin/tn3270/ctlr/api.c
index 8a9ea3e..801e0ee 100644
--- a/usr.bin/tn3270/ctlr/api.c
+++ b/usr.bin/tn3270/ctlr/api.c
@@ -749,7 +749,12 @@ struct SREGS *sregs;
Dump('>', (char *)regs, sizeof *regs);
Dump('>', (char *)sregs, sizeof *sregs);
#ifdef MSDOS
- { char buf[10]; gets(buf); }
+ {
+ int ch;
+
+ while ((ch = getchar()) != '\n' && ch != EOF)
+ ;
+ }
#endif /* MSDOS */
}
}
diff --git a/usr.bin/tn3270/distribution/sys_dos/system.c b/usr.bin/tn3270/distribution/sys_dos/system.c
index 864926b..06c2194 100644
--- a/usr.bin/tn3270/distribution/sys_dos/system.c
+++ b/usr.bin/tn3270/distribution/sys_dos/system.c
@@ -74,7 +74,7 @@ shell_continue()
handle_api(&spinted.regs, &spinted.sregs);
spint_continue(&spinted);
} else {
- char inputbuffer[100];
+ int ch;
if (spinted.rc != 0) {
fprintf(stderr, "Process generated a return code of 0x%x.\n",
@@ -82,7 +82,8 @@ shell_continue()
}
printf("[Hit return to continue]");
fflush(stdout);
- (void) gets(inputbuffer);
+ while ((ch = getchar()) != '\n' && ch != EOF)
+ ;
shell_active = 0;
setconnmode();
ConnectScreen();
diff --git a/usr.bin/tn3270/sys_curses/system.c b/usr.bin/tn3270/sys_curses/system.c
index 9e1be33..67b31af 100644
--- a/usr.bin/tn3270/sys_curses/system.c
+++ b/usr.bin/tn3270/sys_curses/system.c
@@ -593,7 +593,7 @@ child_died(code)
while ((pid = wait3((int *)&status, WNOHANG, (struct rusage *)0)) > 0) {
if (pid == shell_pid) {
- char inputbuffer[100];
+ int ch;
extern void setconnmode();
extern void ConnectScreen();
@@ -604,7 +604,8 @@ child_died(code)
}
printf("[Hit return to continue]");
fflush(stdout);
- (void) fgets(inputbuffer, sizeof(inputbuffer), stdin);
+ while ((ch = getchar()) != '\n' && ch != EOF)
+ ;
setconnmode();
ConnectScreen(); /* Turn screen on (if need be) */
(void) close(serversock);
diff --git a/usr.bin/tn3270/tools/mkhits/dohits.c b/usr.bin/tn3270/tools/mkhits/dohits.c
index d2d576e..afa36af 100644
--- a/usr.bin/tn3270/tools/mkhits/dohits.c
+++ b/usr.bin/tn3270/tools/mkhits/dohits.c
@@ -257,7 +257,7 @@ char *aidfile, *fcnfile;
}
scanwhite(fcnfile, "FCN_");
- while (gets(line) != NULL) {
+ while (fgets(line, sizeof line, stdin) != NULL) {
if (!isdigit(line[0])) {
continue;
}
OpenPOWER on IntegriCloud