Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Remove local getsn and use cngetsn.



details:   https://anonhg.NetBSD.org/src/rev/82dae0982371
branches:  trunk
changeset: 325414:82dae0982371
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Dec 23 15:34:16 2013 +0000

description:
Remove local getsn and use cngetsn.

diffstat:

 sys/kern/subr_userconf.c |  59 +++--------------------------------------------
 1 files changed, 4 insertions(+), 55 deletions(-)

diffs (96 lines):

diff -r f4b4849a43be -r 82dae0982371 sys/kern/subr_userconf.c
--- a/sys/kern/subr_userconf.c  Mon Dec 23 13:08:00 2013 +0000
+++ b/sys/kern/subr_userconf.c  Mon Dec 23 15:34:16 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_userconf.c,v 1.25 2011/08/01 10:33:26 drochner Exp $      */
+/*     $NetBSD: subr_userconf.c,v 1.26 2013/12/23 15:34:16 skrll Exp $ */
 
 /*
  * Copyright (c) 1996 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.25 2011/08/01 10:33:26 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.26 2013/12/23 15:34:16 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,8 +57,6 @@
 static char userconf_cmdbuf[40];               /* Command line             */
 static char userconf_histbuf[40];
 
-static int getsn(char *, int);
-
 #define UC_CHANGE 'c'
 #define UC_DISABLE 'd'
 #define UC_ENABLE 'e'
@@ -352,7 +350,7 @@
                        userconf_pnum(*val);
                printf("] ? ");
 
-               getsn(userconf_argbuf, sizeof(userconf_argbuf));
+               cngetsn(userconf_argbuf, sizeof(userconf_argbuf));
 
                c = userconf_argbuf;
                while (*c == ' ' || *c == '\t' || *c == '\n') c++;
@@ -813,58 +811,9 @@
 
        while (1) {
                printf(prompt);
-               if (getsn(userconf_cmdbuf, sizeof(userconf_cmdbuf)) > 0 &&
+               if (cngetsn(userconf_cmdbuf, sizeof(userconf_cmdbuf)) > 0 &&
                    userconf_parse(userconf_cmdbuf))
                        break;
        }
        printf("Continuing...\n");
 }
-
-/*
- * XXX shouldn't this be a common function?
- */
-static int
-getsn(char *cp, int size)
-{
-       char *lp;
-       int c, len;
-
-       cnpollc(1);
-
-       lp = cp;
-       len = 0;
-       for (;;) {
-               c = cngetc();
-               switch (c) {
-               case '\n':
-               case '\r':
-                       printf("\n");
-                       *lp++ = '\0';
-                       cnpollc(0);
-                       return (len);
-               case '\b':
-               case '\177':
-               case '#':
-                       if (len) {
-                               --len;
-                               --lp;
-                               printf("\b \b");
-                       }
-                       continue;
-               case '@':
-               case 'u'&037:
-                       len = 0;
-                       lp = cp;
-                       printf("\n");
-                       continue;
-               default:
-                       if (len + 1 >= size || c < ' ') {
-                               printf("\007");
-                               continue;
-                       }
-                       printf("%c", c);
-                       ++len;
-                       *lp++ = c;
-               }
-       }
-}



Home | Main Index | Thread Index | Old Index