Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses * Fix longname behaviour so it returns the las...



details:   https://anonhg.NetBSD.org/src/rev/0636dfcb05d1
branches:  trunk
changeset: 485136:0636dfcb05d1
user:      blymn <blymn%NetBSD.org@localhost>
date:      Thu Apr 20 09:36:11 2000 +0000

description:
* Fix longname behaviour so it returns the last alias for the terminal
  name which, by convention, is the verbose terminal description.
* Fix compile errors when DEBUG defined.

diffstat:

 lib/libcurses/bell.c     |   3 ++-
 lib/libcurses/ctrace.c   |   6 ++++--
 lib/libcurses/longname.c |  21 ++++++++++++++++-----
 lib/libcurses/putchar.c  |   5 +++--
 4 files changed, 25 insertions(+), 10 deletions(-)

diffs (113 lines):

diff -r 7d21bcf574b0 -r 0636dfcb05d1 lib/libcurses/bell.c
--- a/lib/libcurses/bell.c      Thu Apr 20 08:08:33 2000 +0000
+++ b/lib/libcurses/bell.c      Thu Apr 20 09:36:11 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bell.c,v 1.2 2000/04/12 21:33:12 jdc Exp $     */
+/*     $NetBSD: bell.c,v 1.3 2000/04/20 09:36:11 blymn Exp $   */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,6 +37,7 @@
  */
 
 #include "curses.h"
+#include "curses_private.h"
 
 /*
  * beep
diff -r 7d21bcf574b0 -r 0636dfcb05d1 lib/libcurses/ctrace.c
--- a/lib/libcurses/ctrace.c    Thu Apr 20 08:08:33 2000 +0000
+++ b/lib/libcurses/ctrace.c    Thu Apr 20 09:36:11 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctrace.c,v 1.9 2000/04/17 12:25:45 blymn Exp $ */
+/*     $NetBSD: ctrace.c,v 1.10 2000/04/20 09:36:11 blymn Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)ctrace.c   8.2 (Berkeley) 10/5/93";
 #else
-__RCSID("$NetBSD: ctrace.c,v 1.9 2000/04/17 12:25:45 blymn Exp $");
+__RCSID("$NetBSD: ctrace.c,v 1.10 2000/04/20 09:36:11 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -52,8 +52,10 @@
 #endif
 
 #include <sys/time.h>
+#include <string.h>
 
 #include "curses.h"
+#include "curses_private.h"
 
 #ifndef TFILE
 #define        TFILE   "__curses.out"
diff -r 7d21bcf574b0 -r 0636dfcb05d1 lib/libcurses/longname.c
--- a/lib/libcurses/longname.c  Thu Apr 20 08:08:33 2000 +0000
+++ b/lib/libcurses/longname.c  Thu Apr 20 09:36:11 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: longname.c,v 1.12 2000/04/15 13:17:04 blymn Exp $      */
+/*     $NetBSD: longname.c,v 1.13 2000/04/20 09:36:11 blymn Exp $      */
 
 /*
  * Copyright (c) 1981, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)longname.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: longname.c,v 1.12 2000/04/15 13:17:04 blymn Exp $");
+__RCSID("$NetBSD: longname.c,v 1.13 2000/04/20 09:36:11 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -54,11 +54,22 @@
 char   *
 __longname(char *bp, char *def)
 {
-       char   *cp;
+       char   *cp, *last_bp;
        int     i = 0;
 
-       while (*bp && *bp != ':' && *bp != '|')
-               bp++;
+       last_bp = NULL;
+       do {
+               while (*bp && *bp != ':' && *bp != '|')
+                       bp++;
+               if (*bp == '|') {
+                       last_bp = bp;
+                       bp++;
+               }
+       } while (*bp && *bp != ':');
+
+       if (last_bp != NULL)
+               bp = last_bp;
+
        if (*bp == '|') {
                for (cp = def, ++bp; *bp && *bp != ':' && *bp != '|' &&
                    i < 127;)
diff -r 7d21bcf574b0 -r 0636dfcb05d1 lib/libcurses/putchar.c
--- a/lib/libcurses/putchar.c   Thu Apr 20 08:08:33 2000 +0000
+++ b/lib/libcurses/putchar.c   Thu Apr 20 09:36:11 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: putchar.c,v 1.12 2000/04/15 13:17:04 blymn Exp $       */
+/*     $NetBSD: putchar.c,v 1.13 2000/04/20 09:36:11 blymn Exp $       */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -38,11 +38,12 @@
 #if 0
 static char sccsid[] = "@(#)putchar.c  8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: putchar.c,v 1.12 2000/04/15 13:17:04 blymn Exp $");
+__RCSID("$NetBSD: putchar.c,v 1.13 2000/04/20 09:36:11 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
 #include "curses.h"
+#include "curses_private.h"
 
 int
 __cputchar(int ch)



Home | Main Index | Thread Index | Old Index