Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys gets_s -> kgets.



details:   https://anonhg.NetBSD.org/src/rev/e336de9acff8
branches:  trunk
changeset: 345849:e336de9acff8
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Jun 11 06:20:11 2016 +0000

description:
gets_s -> kgets.

The exact name isn't that important; but it is important not to use
"gets_s" and thereby allow anyone to falsely get the impression we're
implementing Annex K. We aren't.

ok core.

diffstat:

 sys/arch/hp300/stand/common/netio.c  |  12 ++++++------
 sys/arch/hp300/stand/inst/inst.c     |  28 ++++++++++++++--------------
 sys/arch/i386/stand/lib/bootmenu.c   |   4 ++--
 sys/arch/i386/stand/lib/menuutils.c  |   4 ++--
 sys/arch/mvme68k/stand/bootst/boot.c |   4 ++--
 sys/lib/libsa/gets.c                 |   6 +++---
 sys/lib/libsa/stand.h                |   6 +++---
 7 files changed, 32 insertions(+), 32 deletions(-)

diffs (281 lines):

diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/arch/hp300/stand/common/netio.c
--- a/sys/arch/hp300/stand/common/netio.c       Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/arch/hp300/stand/common/netio.c       Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netio.c,v 1.15 2016/06/05 17:43:02 christos Exp $      */
+/*     $NetBSD: netio.c,v 1.16 2016/06/11 06:20:11 dholland Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -169,7 +169,7 @@
  get_my_ip:
                printf("My IP address? ");
                memset(input_line, 0, sizeof(input_line));
-               gets_s(input_line, sizeof(input_line));
+               kgets(input_line, sizeof(input_line));
                if ((myip.s_addr = inet_addr(input_line)) ==
                    htonl(INADDR_NONE)) {
                        printf("invalid IP address: %s\n", input_line);
@@ -179,7 +179,7 @@
  get_my_netmask:
                printf("My netmask? ");
                memset(input_line, 0, sizeof(input_line)); 
-               gets_s(input_line, sizeof(input_line));
+               kgets(input_line, sizeof(input_line));
                if ((netmask = inet_addr(input_line)) ==
                    htonl(INADDR_NONE)) {
                        printf("invalid netmask: %s\n", input_line);
@@ -189,7 +189,7 @@
  get_my_gateway:
                printf("My gateway? ");
                memset(input_line, 0, sizeof(input_line)); 
-               gets_s(input_line, sizeof(input_line));
+               kgets(input_line, sizeof(input_line));
                if ((gateip.s_addr = inet_addr(input_line)) ==
                    htonl(INADDR_NONE)) {
                        printf("invalid IP address: %s\n", input_line);
@@ -199,7 +199,7 @@
  get_server_ip:
                printf("Server IP address? ");
                memset(input_line, 0, sizeof(input_line)); 
-               gets_s(input_line, sizeof(input_line));
+               kgets(input_line, sizeof(input_line));
                if ((rootip.s_addr = inet_addr(input_line)) ==
                    htonl(INADDR_NONE)) {
                        printf("invalid IP address: %s\n", input_line);
@@ -209,7 +209,7 @@
  get_server_path:
                printf("Server path? ");
                memset(rootpath, 0, sizeof(rootpath)); 
-               gets_s(rootpath, sizeof(rootpath));
+               kgets(rootpath, sizeof(rootpath));
                if (rootpath[0] == '\0' || rootpath[0] == '\n')
                        goto get_server_path;
 
diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/arch/hp300/stand/inst/inst.c
--- a/sys/arch/hp300/stand/inst/inst.c  Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/arch/hp300/stand/inst/inst.c  Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inst.c,v 1.21 2016/06/05 17:44:40 christos Exp $       */
+/*     $NetBSD: inst.c,v 1.22 2016/06/11 06:20:11 dholland Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -131,7 +131,7 @@
        for (;;) {
                printf("sys_inst> ");
                memset(line, 0, sizeof(line));
-               gets_s(line, sizeof(line));
+               kgets(line, sizeof(line));
                if (line[0] == '\n' || line[0] == '\0')
                        continue;
 
@@ -200,7 +200,7 @@
  disklabel_loop:
        memset(line, 0, sizeof(line));
        printf("(z)ap, (e)dit, (s)how, (w)rite, (d)one > ");
-       gets_s(line, sizeof(line));
+       kgets(line, sizeof(line));
        if (line[0] == '\n' || line[0] == '\0')
                goto disklabel_loop;
 
@@ -259,28 +259,28 @@
 #define GETNUM(out, num)                                               \
        printf((out), (num));                                           \
        memset(line, 0, sizeof(line));                                  \
-       gets_s(line, sizeof(line));                                                     \
+       kgets(line, sizeof(line));                                                      \
        if (line[0])                                                    \
                (num) = atoi(line);
 
 #define GETNUM2(out, num1, num2)                                       \
        printf((out), (num1), (num2));                                  \
        memset(line, 0, sizeof(line));                                  \
-       gets_s(line, sizeof(line));                                                     \
+       kgets(line, sizeof(line));                                                      \
        if (line[0])                                                    \
                (num2) = atoi(line);
 
 #define GETSTR(out, str)                                               \
        printf((out), (str));                                           \
        memset(line, 0, sizeof(line));                                  \
-       gets_s(line, sizeof(line));                                                     \
+       kgets(line, sizeof(line));                                                      \
        if (line[0])                                                    \
                strcpy((str), line);
 
 #define FLAGS(out, flag)                                               \
        printf((out), lp->d_flags & (flag) ? 'y' : 'n');                \
        memset(line, 0, sizeof(line));                                  \
-       gets_s(line, sizeof(line));                                                     \
+       kgets(line, sizeof(line));                                                      \
        if (line[0] == 'y' || line[0] == 'Y')                           \
                lp->d_flags |= (flag);                                  \
        else                                                            \
@@ -514,7 +514,7 @@
        printf("%s ", question);
        memset(diskname, 0, len);
        memset(fulldiskname, 0, sizeof(fulldiskname));
-       gets_s(diskname, sizeof(diskname));
+       kgets(diskname, sizeof(diskname));
        if (diskname[0] == '\n' || diskname[0] == '\0')
                goto getdiskname;
 
@@ -570,7 +570,7 @@
  getsource:
        printf("Source? (N)FS, (t)ape, (d)one > ");
        memset(line, 0, sizeof(line));
-       gets_s(line, sizeof(line));
+       kgets(line, sizeof(line));
        if (line[0] == '\0')
                goto getsource;
 
@@ -581,7 +581,7 @@
                printf("Name of miniroot file? ");
                memset(line, 0, sizeof(line));
                memset(minirootname, 0, sizeof(minirootname));
-               gets_s(line, sizeof(line));
+               kgets(line, sizeof(line));
                if (line[0] == '\0')
                        goto name_of_nfs_miniroot;
                (void)strcat(minirootname, "le0a:");
@@ -613,7 +613,7 @@
                memset(line, 0, sizeof(line));
                memset(minirootname, 0, sizeof(minirootname));
                memset(tapename, 0, sizeof(tapename));
-               gets_s(line, sizeof(line));
+               kgets(line, sizeof(line));
                if (line[0] == '\0')
                        goto name_of_tape_miniroot;
                strcat(minirootname, line);
@@ -621,7 +621,7 @@
 
                printf("File number (first == 1)? ");
                memset(line, 0, sizeof(line));
-               gets_s(line, sizeof(line));
+               kgets(line, sizeof(line));
                fileno = a2int(line);
                if (fileno < 1 || fileno > 8) {
                        printf("Invalid file number: %s\n", line);
@@ -643,7 +643,7 @@
                ignoreshread = 0;
                printf("Copy how many %d byte blocks? ", DEV_BSIZE);
                memset(line, 0, sizeof(line));
-               gets_s(line, sizeof(line));
+               kgets(line, sizeof(line));
                nblks = a2int(line);
                if (nblks < 0) {
                        printf("Invalid block count: %s\n", line);
@@ -723,7 +723,7 @@
        printf("Disk to boot from? ");
        memset(diskname, 0, sizeof(diskname));
        memset(bootname, 0, sizeof(bootname));
-       gets_s(diskname, sizeof(diskname));
+       kgets(diskname, sizeof(diskname));
        if (diskname[0] == '\n' || diskname[0] == '\0')
                goto getdiskname;
 
diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/arch/i386/stand/lib/bootmenu.c
--- a/sys/arch/i386/stand/lib/bootmenu.c        Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/arch/i386/stand/lib/bootmenu.c        Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootmenu.c,v 1.15 2016/06/05 13:33:03 maxv Exp $       */
+/*     $NetBSD: bootmenu.c,v 1.16 2016/06/11 06:20:11 dholland Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -178,7 +178,7 @@
                                printf("\nOption: [%d]:",
                                    bootcfg_info.def + 1);
 
-                       gets_s(input, sizeof(input));
+                       kgets(input, sizeof(input));
                        choice = getchoicefrominput(input, bootcfg_info.def);
                } else if (bootcfg_info.timeout == 0)
                        choice = bootcfg_info.def;
diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/arch/i386/stand/lib/menuutils.c
--- a/sys/arch/i386/stand/lib/menuutils.c       Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/arch/i386/stand/lib/menuutils.c       Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menuutils.c,v 1.5 2016/06/05 13:33:03 maxv Exp $       */
+/*     $NetBSD: menuutils.c,v 1.6 2016/06/11 06:20:11 dholland Exp $   */
 
 /*
  * Copyright (c) 1996, 1997
@@ -71,7 +71,7 @@
 
                input[0] = '\0';
                printf("> ");
-               gets_s(input, sizeof(input));
+               kgets(input, sizeof(input));
 
                /*
                 * Skip leading whitespace.
diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/arch/mvme68k/stand/bootst/boot.c
--- a/sys/arch/mvme68k/stand/bootst/boot.c      Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/arch/mvme68k/stand/bootst/boot.c      Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.9 2016/06/05 17:37:36 christos Exp $ */
+/*     $NetBSD: boot.c,v 1.10 2016/06/11 06:20:11 dholland Exp $ */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -62,7 +62,7 @@
 
        if (flag & RB_ASKNAME) {
                printf("tapeboot: segment? [%s] ", defname);
-               gets_s(line, sizeof(line));
+               kgets(line, sizeof(line));
                if (line[0])
                        file = line;
        }
diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/lib/libsa/gets.c
--- a/sys/lib/libsa/gets.c      Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/lib/libsa/gets.c      Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gets.c,v 1.12 2016/06/05 15:05:49 christos Exp $       */
+/*     $NetBSD: gets.c,v 1.13 2016/06/11 06:20:11 dholland Exp $       */
 
 /*-
  * Copyright (c) 1993
@@ -36,11 +36,11 @@
 void
 gets(char *buf)
 {
-       gets_s(buf, (size_t)-1);
+       kgets(buf, (size_t)-1);
 }
 
 void
-gets_s(char *buf, size_t size)
+kgets(char *buf, size_t size)
 {
        int c;
        char *lp;
diff -r e3e3c1b2f0f6 -r e336de9acff8 sys/lib/libsa/stand.h
--- a/sys/lib/libsa/stand.h     Sat Jun 11 00:56:38 2016 +0000
+++ b/sys/lib/libsa/stand.h     Sat Jun 11 06:20:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stand.h,v 1.80 2016/06/05 13:33:03 maxv Exp $  */
+/*     $NetBSD: stand.h,v 1.81 2016/06/11 06:20:11 dholland Exp $      */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -78,7 +78,7 @@
 #ifdef LIBSA_RENAME_PRINTF
 #define getchar                libsa_getchar
 #define gets           libsa_gets
-#define gets_s         libsa_gets_s
+#define kgets          libsa_kgets
 #define printf         libsa_printf
 #define putchar                libsa_putchar
 #define vprintf                libsa_vprintf
@@ -259,7 +259,7 @@
     __attribute__((__format__(__printf__, 3, 0)));
 void   twiddle(void);
 void   gets(char *);
-void   gets_s(char *, size_t);
+void   kgets(char *, size_t);
 int    getfile(char *prompt, int mode);
 char   *strerror(int);
 __dead void    exit(int);



Home | Main Index | Thread Index | Old Index