Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit PR/30500: Paul Shupak: Inconsistent definition o...



details:   https://anonhg.NetBSD.org/src/rev/ac1848c52319
branches:  trunk
changeset: 581949:ac1848c52319
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 11 18:18:59 2005 +0000

description:
PR/30500: Paul Shupak: Inconsistent definition of tilde_expand().
Provide a layer of indirection between the readline compatibility functions
and our internal implementation, so that we have the freedom to change the
function signature.

diffstat:

 lib/libedit/filecomplete.c      |  14 +++++++-------
 lib/libedit/filecomplete.h      |   6 +++---
 lib/libedit/readline.c          |  16 ++++++++++++++--
 lib/libedit/readline/readline.h |   4 ++--
 4 files changed, 26 insertions(+), 14 deletions(-)

diffs (137 lines):

diff -r ef9de12ca517 -r ac1848c52319 lib/libedit/filecomplete.c
--- a/lib/libedit/filecomplete.c        Sat Jun 11 16:06:03 2005 +0000
+++ b/lib/libedit/filecomplete.c        Sat Jun 11 18:18:59 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecomplete.c,v 1.6 2005/06/10 20:21:00 christos Exp $        */
+/*     $NetBSD: filecomplete.c,v 1.7 2005/06/11 18:18:59 christos Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.6 2005/06/10 20:21:00 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.7 2005/06/11 18:18:59 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -81,7 +81,7 @@
  * it's callers's responsibility to free() returned string
  */
 char *
-tilde_expand(const char *txt)
+fn_tilde_expand(const char *txt)
 {
        struct passwd pwres, *pass;
        char *temp;
@@ -136,7 +136,7 @@
  * it's caller's responsibility to free returned string
  */
 char *
-filename_completion_function(const char *text, int state)
+fn_filename_completion_function(const char *text, int state)
 {
        static DIR *dir = NULL;
        static char *filename = NULL, *dirname = NULL, *dirpath = NULL;
@@ -189,7 +189,7 @@
                        return NULL;
 
                if (*dirname == '~')
-                       dirpath = tilde_expand(dirname);
+                       dirpath = fn_tilde_expand(dirname);
                else
                        dirpath = strdup(dirname);
 
@@ -251,7 +251,7 @@
 append_char_function(const char *name)
 {
        struct stat stbuf;
-       char *expname = *name == '~' ? tilde_expand(name) : NULL;
+       char *expname = *name == '~' ? fn_tilde_expand(name) : NULL;
        const char *rs = "";
 
        if (stat(expname ? expname : name, &stbuf) == -1)
@@ -407,7 +407,7 @@
                *completion_type = what_to_do;
 
        if (!complet_func)
-               complet_func = filename_completion_function;
+               complet_func = fn_filename_completion_function;
        if (!app_func)
                app_func = append_char_function;
 
diff -r ef9de12ca517 -r ac1848c52319 lib/libedit/filecomplete.h
--- a/lib/libedit/filecomplete.h        Sat Jun 11 16:06:03 2005 +0000
+++ b/lib/libedit/filecomplete.h        Sat Jun 11 18:18:59 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecomplete.h,v 1.3 2005/06/10 20:21:00 christos Exp $        */
+/*     $NetBSD: filecomplete.h,v 1.4 2005/06/11 18:18:59 christos Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
     int *, int *, int *, int *);
 
 void fn_display_match_list(EditLine *, char **, int, int);
-char *tilde_expand(const char *);
-char *filename_completion_function(const char *, int);
+char *fn_tilde_expand(const char *);
+char *fn_filename_completion_function(const char *, int);
 
 #endif
diff -r ef9de12ca517 -r ac1848c52319 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Sat Jun 11 16:06:03 2005 +0000
+++ b/lib/libedit/readline.c    Sat Jun 11 18:18:59 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.56 2005/06/10 20:21:00 christos Exp $   */
+/*     $NetBSD: readline.c,v 1.57 2005/06/11 18:18:59 christos Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.56 2005/06/10 20:21:00 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.57 2005/06/11 18:18:59 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -1351,6 +1351,18 @@
 /********************************/
 /* completion functions */
 
+char *
+tilde_expand(char *name)
+{
+       return fn_tilde_expand(name);
+}
+
+char *
+filename_completion_function(const char *name, int state)
+{
+       return fn_filename_completion_function(name, state);
+}
+
 /*
  * a completion generator for usernames; returns _first_ username
  * which starts with supplied text
diff -r ef9de12ca517 -r ac1848c52319 lib/libedit/readline/readline.h
--- a/lib/libedit/readline/readline.h   Sat Jun 11 16:06:03 2005 +0000
+++ b/lib/libedit/readline/readline.h   Sat Jun 11 18:18:59 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.h,v 1.15 2005/06/10 20:18:11 christos Exp $   */
+/*     $NetBSD: readline.h,v 1.16 2005/06/11 18:18:59 christos Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
 const char     *get_history_event(const char *, int *, int);
 char           *history_arg_extract(int, int, const char *);
 
-char           *tilde_expand(const char *);
+char           *tilde_expand(char *);
 char           *filename_completion_function(const char *, int);
 char           *username_completion_function(const char *, int);
 int             rl_complete(int, int);



Home | Main Index | Thread Index | Old Index