Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libsa dedup



details:   https://anonhg.NetBSD.org/src/rev/a24e0ffdf425
branches:  trunk
changeset: 345721:a24e0ffdf425
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 05 15:05:49 2016 +0000

description:
dedup

diffstat:

 sys/lib/libsa/gets.c |  51 ++-------------------------------------------------
 1 files changed, 2 insertions(+), 49 deletions(-)

diffs (65 lines):

diff -r e2c0161a16fc -r a24e0ffdf425 sys/lib/libsa/gets.c
--- a/sys/lib/libsa/gets.c      Sun Jun 05 15:04:31 2016 +0000
+++ b/sys/lib/libsa/gets.c      Sun Jun 05 15:05:49 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gets.c,v 1.11 2016/06/05 13:33:03 maxv Exp $   */
+/*     $NetBSD: gets.c,v 1.12 2016/06/05 15:05:49 christos Exp $       */
 
 /*-
  * Copyright (c) 1993
@@ -36,54 +36,7 @@
 void
 gets(char *buf)
 {
-       int c;
-       char *lp;
-
-       for (lp = buf;;) {
-               switch (c = getchar() & 0177) {
-               case '\n':
-               case '\r':
-                       *lp = '\0';
-                       putchar('\n');
-                       return;
-               case '\b':
-               case '\177':
-                       if (lp > buf) {
-                               lp--;
-                               putchar('\b');
-                               putchar(' ');
-                               putchar('\b');
-                       }
-                       break;
-#if HASH_ERASE
-               case '#':
-                       if (lp > buf)
-                               --lp;
-                       break;
-#endif
-               case 'r' & 037: {
-                       char *p;
-
-                       putchar('\n');
-                       for (p = buf; p < lp; ++p)
-                               putchar(*p);
-                       break;
-               }
-#if AT_ERASE
-               case '@':
-#endif
-               case 'u' & 037:
-               case 'w' & 037:
-                       lp = buf;
-                       putchar('\n');
-                       break;
-               default:
-                       *lp++ = c;
-                       putchar(c);
-                       break;
-               }
-       }
-       /*NOTREACHED*/
+       gets_s(buf, (size_t)-1);
 }
 
 void



Home | Main Index | Thread Index | Old Index