Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit Make this compile under linux



details:   https://anonhg.NetBSD.org/src/rev/7ca64be0887d
branches:  trunk
changeset: 473656:7ca64be0887d
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 12 18:58:05 1999 +0000

description:
Make this compile under linux

diffstat:

 lib/libedit/readline.c |   16 +++---
 lib/libedit/refresh.c  |  102 ++++++++++++++++++++++++------------------------
 2 files changed, 59 insertions(+), 59 deletions(-)

diffs (truncated from 412 to 300 lines):

diff -r 4108546b7114 -r 7ca64be0887d lib/libedit/readline.c
--- a/lib/libedit/readline.c    Sat Jun 12 18:19:53 1999 +0000
+++ b/lib/libedit/readline.c    Sat Jun 12 18:58:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.5 1998/12/12 19:54:16 christos Exp $    */
+/*     $NetBSD: readline.c,v 1.6 1999/06/12 18:58:05 christos Exp $    */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.5 1998/12/12 19:54:16 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.6 1999/06/12 18:58:05 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -1169,10 +1169,10 @@
                /* otherwise, get first entry where first */
                /* filename_len characters are equal      */
                if (entry->d_name[0] == filename[0]
-#ifndef __SVR4
+#if defined(__SVR4) || defined(__linux__)
+                   && strlen(entry->d_name) >= filename_len
+#else
                    && entry->d_namlen >= filename_len
-#else
-                   && strlen(entry->d_name) >= filename_len
 #endif
                    && strncmp(entry->d_name, filename,
                               filename_len) == 0)
@@ -1182,10 +1182,10 @@
        if (entry) {            /* match found */
 
                struct stat     stbuf;
-#ifndef __SVR4
+#if defined(__SVR4) || defined(__linux__)
+               len = strlen(entry->d_name) +
+#else
                len = entry->d_namlen +
-#else
-               len = strlen(entry->d_name) +
 #endif
                        ((dirname) ? strlen(dirname) : 0) + 1 + 1;
                temp = malloc(len);
diff -r 4108546b7114 -r 7ca64be0887d lib/libedit/refresh.c
--- a/lib/libedit/refresh.c     Sat Jun 12 18:19:53 1999 +0000
+++ b/lib/libedit/refresh.c     Sat Jun 12 18:58:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: refresh.c,v 1.6 1999/02/05 20:53:50 christos Exp $     */
+/*     $NetBSD: refresh.c,v 1.7 1999/06/12 18:58:05 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.6 1999/02/05 20:53:50 christos Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.7 1999/06/12 18:58:05 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -71,7 +71,7 @@
 private        void    re_printstr             __P((EditLine *, char *, char *, 
                                             char *));
 # define __F el->el_errfile
-# define RE_DEBUG(a, b, c)     do                              \
+# define ELRE_DEBUG(a, b, c)   do                              \
                                    if (a) {                    \
                                        (void) fprintf b;       \
                                        c;                      \
@@ -86,13 +86,13 @@
     char *str;
     char *f, *t;
 {
-    RE_DEBUG(1,(__F, "%s:\"", str),);
+    ELRE_DEBUG(1,(__F, "%s:\"", str),);
     while (f < t)
-       RE_DEBUG(1,(__F, "%c", *f++ & 0177),);
-    RE_DEBUG(1,(__F, "\"\r\n"),);
+       ELRE_DEBUG(1,(__F, "%c", *f++ & 0177),);
+    ELRE_DEBUG(1,(__F, "\"\r\n"),);
 } 
 #else
-# define RE_DEBUG(a, b, c)
+# define ELRE_DEBUG(a, b, c)
 #endif
 
 
@@ -146,7 +146,7 @@
     EditLine *el;
     int c;
 {
-    RE_DEBUG(1,(__F, "printing %3.3o '%c'\r\n", c, c),);
+    ELRE_DEBUG(1,(__F, "printing %3.3o '%c'\r\n", c, c),);
 
     el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c;
     el->el_refresh.r_cursor.h++;                               /* advance to next place */
@@ -155,7 +155,7 @@
                                                /* assure end of line */
        el->el_refresh.r_cursor.h = 0;                          /* reset it. */
        el->el_refresh.r_cursor.v++;
-       RE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, 
+       ELRE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, 
                 (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n",
                  el->el_refresh.r_cursor.v, el->el_term.t_size.v), abort());
     }
@@ -176,7 +176,7 @@
     char *cp;
     coord_t     cur;
 
-    RE_DEBUG(1,(__F, "el->el_line.buffer = :%s:\r\n", el->el_line.buffer),);
+    ELRE_DEBUG(1,(__F, "el->el_line.buffer = :%s:\r\n", el->el_line.buffer),);
 
     /* reset the Drawing cursor */
     el->el_refresh.r_cursor.h = 0;
@@ -204,12 +204,12 @@
     el->el_refresh.r_newcv = el->el_refresh.r_cursor.v;        
     re_putc(el, '\0');         /* put NUL on end */
 
-    RE_DEBUG(1,(__F, 
+    ELRE_DEBUG(1,(__F, 
             "term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n",
             el->el_term.t_size.h, el->el_refresh.r_cursor.h, 
             el->el_refresh.r_cursor.v, el->el_vdisplay[0]),);
 
-    RE_DEBUG(1,(__F, "updating %d lines.\r\n", el->el_refresh.r_newcv),);
+    ELRE_DEBUG(1,(__F, "updating %d lines.\r\n", el->el_refresh.r_newcv),);
     for (i = 0; i <= el->el_refresh.r_newcv; i++) {
        /* NOTE THAT re_update_line MAY CHANGE el_display[i] */
        re_update_line(el, el->el_display[i], el->el_vdisplay[i], i);
@@ -223,7 +223,7 @@
        re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], 
                        (size_t)el->el_term.t_size.h);
     }
-    RE_DEBUG(1,(__F,
+    ELRE_DEBUG(1,(__F,
         "\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n",
         el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i),);
 
@@ -239,7 +239,7 @@
        }
     
     el->el_refresh.r_oldcv = el->el_refresh.r_newcv;   /* set for next time */
-    RE_DEBUG(1,(__F, 
+    ELRE_DEBUG(1,(__F, 
                "\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n",
                el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, 
                cur.h, cur.v),);
@@ -283,9 +283,9 @@
     if (num > dlen - dat)
        num = dlen - dat;
 
-    RE_DEBUG(1,(__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
+    ELRE_DEBUG(1,(__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
            num, dat, dlen, d),);
-    RE_DEBUG(1,(__F, "s == \"%s\"n", s),);
+    ELRE_DEBUG(1,(__F, "s == \"%s\"n", s),);
 
     /* open up the space for num chars */
     if (num > 0) {
@@ -295,18 +295,18 @@
            *b-- = *a--;
        d[dlen] = '\0';         /* just in case */
     }
-    RE_DEBUG(1,(__F, 
+    ELRE_DEBUG(1,(__F, 
                "re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
                num, dat, dlen, d),);
-    RE_DEBUG(1,(__F, "s == \"%s\"n", s),);
+    ELRE_DEBUG(1,(__F, "s == \"%s\"n", s),);
 
     /* copy the characters */
     for (a = d + dat; (a < d + dlen) && (num > 0); num--)
        *a++ = *s++;
 
-    RE_DEBUG(1,(__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
+    ELRE_DEBUG(1,(__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
             num, dat, dlen, d, s),);
-    RE_DEBUG(1,(__F, "s == \"%s\"n", s),);
+    ELRE_DEBUG(1,(__F, "s == \"%s\"n", s),);
 } /* end re_insert */
 
 
@@ -329,7 +329,7 @@
        return;
     }
 
-    RE_DEBUG(1,(__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n",
+    ELRE_DEBUG(1,(__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n",
            num, dat, dlen, d),);
 
     /* open up the space for num chars */
@@ -340,7 +340,7 @@
            *b++ = *a++;
        d[dlen] = '\0';         /* just in case */
     }
-    RE_DEBUG(1,(__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n",
+    ELRE_DEBUG(1,(__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n",
            num, dat, dlen, d),);
 } /* end re_delete */
 
@@ -434,7 +434,7 @@
      * if no diff, continue to next line of redraw
      */
     if (*ofd == '\0' && *nfd == '\0') {
-       RE_DEBUG(1,(__F, "no difference.\r\n"),);
+       ELRE_DEBUG(1,(__F, "no difference.\r\n"),);
        return;
     }
 
@@ -575,14 +575,14 @@
     fx = (nsb - nfd) - (osb - ofd);
     sx = (nls - nse) - (ols - ose);
 
-    RE_DEBUG(1,(__F, "\n"),);
-    RE_DEBUG(1,(__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
+    ELRE_DEBUG(1,(__F, "\n"),);
+    ELRE_DEBUG(1,(__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
            ofd - old, osb - old, ose - old, ols - old, oe - old),);
-    RE_DEBUG(1,(__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
+    ELRE_DEBUG(1,(__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
            nfd - new, nsb - new, nse - new, nls - new, ne - new),);
-    RE_DEBUG(1,(__F, 
+    ELRE_DEBUG(1,(__F, 
                "xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n"),);
-    RE_DEBUG(1,(__F,
+    ELRE_DEBUG(1,(__F,
                "xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n"),);
 #ifdef DEBUG_REFRESH
     re_printstr(el, "old- oe", old, oe);
@@ -646,7 +646,7 @@
      * We need to delete characters! else No insert or delete
      */
     if ((nsb != nfd) && fx > 0 && ((p - old) + fx <= el->el_term.t_size.h)) {
-       RE_DEBUG(1,(__F, "first diff insert at %d...\r\n", nfd - new),);
+       ELRE_DEBUG(1,(__F, "first diff insert at %d...\r\n", nfd - new),);
        /*
         * Move to the first char to insert, where the first diff is.
         */
@@ -655,12 +655,12 @@
         * Check if we have stuff to keep at end
         */
        if (nsb != ne) {
-           RE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
+           ELRE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),);
            /*
             * insert fx chars of new starting at nfd
             */
            if (fx > 0) {
-               RE_DEBUG(!EL_CAN_INSERT,
+               ELRE_DEBUG(!EL_CAN_INSERT,
                         (__F, "ERROR: cannot insert in early first diff\n"),);
                term_insertwrite(el, nfd, fx);
                re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx);
@@ -672,7 +672,7 @@
            re__strncopy(ofd + fx, nfd + fx, (size_t)((nsb - nfd) - fx));
        }
        else {
-           RE_DEBUG(1,(__F, "without anything to save\r\n"),);
+           ELRE_DEBUG(1,(__F, "without anything to save\r\n"),);
            term_overwrite(el, nfd, (nsb - nfd));
            re__strncopy(ofd, nfd, (size_t)(nsb - nfd));
            /*
@@ -682,7 +682,7 @@
        }
     }
     else if (fx < 0) {
-       RE_DEBUG(1,(__F, "first diff delete at %d...\r\n", ofd - old),);
+       ELRE_DEBUG(1,(__F, "first diff delete at %d...\r\n", ofd - old),);
        /*
         * move to the first char to delete where the first diff is
         */
@@ -691,13 +691,13 @@
         * Check if we have stuff to save
         */
        if (osb != oe) {
-           RE_DEBUG(1,(__F, "with stuff to save at end\r\n"),);
+           ELRE_DEBUG(1,(__F, "with stuff to save at end\r\n"),);
            /*
             * fx is less than zero *always* here but we check for code
             * symmetry
             */
            if (fx < 0) {
-               RE_DEBUG(!EL_CAN_DELETE,
+               ELRE_DEBUG(!EL_CAN_DELETE,
                         (__F, "ERROR: cannot delete in first diff\n"),);
                term_deletechars(el, -fx);
                re_delete(el, old, ofd - old, el->el_term.t_size.h, -fx);
@@ -710,12 +710,12 @@
 
        }
        else {
-           RE_DEBUG(1,(__F, "but with nothing left to save\r\n"),);
+           ELRE_DEBUG(1,(__F, "but with nothing left to save\r\n"),);
            /*
             * write (nsb-nfd) chars of new starting at nfd
             */



Home | Main Index | Thread Index | Old Index