[asterisk-commits] kpfleming: branch kpfleming/system-libedit r370459 - in /team/kpfleming/syste...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 24 15:36:57 CDT 2012


Author: kpfleming
Date: Tue Jul 24 15:36:51 2012
New Revision: 370459

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370459
Log:
Push work-in-progress to a branch so I can test it on another system.


Added:
    team/kpfleming/system-libedit/
      - copied from r370452, trunk/
    team/kpfleming/system-libedit/main/editline/readline.h
      - copied unchanged from r370452, trunk/main/editline/readline/readline.h
Removed:
    team/kpfleming/system-libedit/main/editline/readline/
Modified:
    team/kpfleming/system-libedit/build_tools/menuselect-deps.in
    team/kpfleming/system-libedit/configure
    team/kpfleming/system-libedit/configure.ac
    team/kpfleming/system-libedit/include/asterisk/autoconfig.h.in
    team/kpfleming/system-libedit/main/Makefile
    team/kpfleming/system-libedit/main/asterisk.c
    team/kpfleming/system-libedit/main/cli.c
    team/kpfleming/system-libedit/main/editline/configure
    team/kpfleming/system-libedit/main/editline/configure.in
    team/kpfleming/system-libedit/main/editline/readline.c
    team/kpfleming/system-libedit/makeopts.in

Modified: team/kpfleming/system-libedit/build_tools/menuselect-deps.in
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/build_tools/menuselect-deps.in?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/build_tools/menuselect-deps.in (original)
+++ team/kpfleming/system-libedit/build_tools/menuselect-deps.in Tue Jul 24 15:36:51 2012
@@ -27,6 +27,7 @@
 JACK=@PBX_JACK@
 KQUEUE=@PBX_KQUEUE@
 LDAP=@PBX_LDAP@
+LIBEDIT=@PBX_LIBEDIT@
 LIBXML2=@PBX_LIBXML2@
 LTDL=@PBX_LTDL@
 LUA=@PBX_LUA@

Modified: team/kpfleming/system-libedit/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/configure.ac?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/configure.ac (original)
+++ team/kpfleming/system-libedit/configure.ac Tue Jul 24 15:36:51 2012
@@ -406,6 +406,7 @@
 AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
 AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
+AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit], [, use 'internal' Editline otherwise])
 AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
 AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
@@ -1263,11 +1264,31 @@
    if test "${ILBC_SYSTEM}" = "yes"; then
       AST_PKG_CONFIG_CHECK(ILBC, libilbc)
       if test "$PBX_ILBC" = '1'; then
-	 ILBC_INTERNAL='no'
+	 ILBC_INTERNAL="no"
       fi
    fi
    if test "${ILBC_INTERNAL}" = "yes"; then
       PBX_ILBC=1
+   fi
+fi
+
+LIBEDIT_INTERNAL="yes"
+AC_SUBST(LIBEDIT_INTERNAL)
+LIBEDIT_SYSTEM="yes"
+if test "${USE_LIBEDIT}" != "no"; then
+   if test "${LIBEDIT_DIR}" = "internal"; then
+      LIBEDIT_SYSTEM="no"
+   elif test "${LIBEDIT_DIR}" != ""; then
+      LIBEDIT_INTERNAL="no"
+   fi
+   if test "${LIBEDIT_SYSTEM}" = "yes"; then
+      AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
+      if test "$PBX_LIBEDIT" = '1'; then
+	 LIBEDIT_INTERNAL='no'
+      fi
+   fi
+   if test "${LIBEDIT_INTERNAL}" = "yes"; then
+      PBX_LIBEDIT=1
    fi
 fi
 

Modified: team/kpfleming/system-libedit/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/include/asterisk/autoconfig.h.in?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/include/asterisk/autoconfig.h.in (original)
+++ team/kpfleming/system-libedit/include/asterisk/autoconfig.h.in Tue Jul 24 15:36:51 2012
@@ -375,6 +375,9 @@
 
 /* Define to 1 if you have the OpenLDAP library. */
 #undef HAVE_LDAP
+
+/* Define if your system has the LIBEDIT libraries. */
+#undef HAVE_LIBEDIT
 
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H

Modified: team/kpfleming/system-libedit/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/main/Makefile?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/main/Makefile (original)
+++ team/kpfleming/system-libedit/main/Makefile Tue Jul 24 15:36:51 2012
@@ -144,7 +144,14 @@
 	$(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm
 	rm ast_expr2.o ast_expr2f.o
 
+ifneq ($(LIBEDIT_INTERNAL),no)
+LIBEDIT_OBJ=editline/libedit.a
+LIBEDIT_INCLUDE=-Ieditline
+endif
+
 db.o: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
+asterisk.o: _ASTCFLAGS+=$(LIBEDIT_INCLUDE)
+cli.o: _ASTCFLAGS+=$(LIBEDIT_INCLUDE)
 
 ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
 http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)
@@ -228,13 +235,13 @@
 
 endif
 
-$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) editline/libedit.a $(AST_EMBED_LDSCRIPTS)
+$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS)
 	@$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
-	$(ECHO_PREFIX) echo "   [LD] $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) -> $@"
+	$(ECHO_PREFIX) echo "   [LD] $(OBJS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
-	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
-else
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB)
+else
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB)
 endif
 
 ifeq ($(GNU_LD),1)

Modified: team/kpfleming/system-libedit/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/main/asterisk.c?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/main/asterisk.c (original)
+++ team/kpfleming/system-libedit/main/asterisk.c Tue Jul 24 15:36:51 2012
@@ -98,6 +98,7 @@
 #endif
 #endif
 #include <regex.h>
+#include <histedit.h>
 
 #if defined(SOLARIS)
 int daemon(int, int);  /* defined in libresolv of all places */
@@ -2704,7 +2705,7 @@
 			int mlen = 0, maxmbuf = 2048;
 			/* Start with a 2048 byte buffer */
 			if (!(mbuf = ast_malloc(maxmbuf))) {
-				lf->cursor[0] = savechr;
+				*((char *) lf->cursor) = savechr;
 				return (char *)(CC_ERROR);
 			}
 			snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
@@ -2716,7 +2717,7 @@
 					/* Every step increment buffer 1024 bytes */
 					maxmbuf += 1024;
 					if (!(mbuf = ast_realloc(mbuf, maxmbuf))) {
-						lf->cursor[0] = savechr;
+						*((char *) lf->cursor) = savechr;
 						return (char *)(CC_ERROR);
 					}
 				}
@@ -2778,7 +2779,7 @@
 		ast_free(matches);
 	}
 
-	lf->cursor[0] = savechr;
+	*((char *) lf->cursor) = savechr;
 
 	return (char *)(long)retval;
 }
@@ -2861,29 +2862,13 @@
 
 static int ast_el_read_history(char *filename)
 {
-	char buf[MAX_HISTORY_COMMAND_LENGTH];
-	FILE *f;
-	int ret = -1;
-
-	if (el_hist == NULL || el == NULL)
+	HistEvent ev;
+
+	if (el_hist == NULL || el == NULL) {
 		ast_el_initialize();
-
-	if ((f = fopen(filename, "r")) == NULL)
-		return ret;
-
-	while (!feof(f)) {
-		if (!fgets(buf, sizeof(buf), f))
-			break;
-		if (!strcmp(buf, "_HiStOrY_V2_\n"))
-			continue;
-		if (ast_all_zeros(buf))
-			continue;
-		if ((ret = ast_el_add_history(buf)) == -1)
-			break;
-	}
-	fclose(f);
-
-	return ret;
+	}
+
+	return history(el_hist, &ev, H_LOAD, filename);
 }
 
 static void ast_remotecontrol(char *data)

Modified: team/kpfleming/system-libedit/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/main/cli.c?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/main/cli.c (original)
+++ team/kpfleming/system-libedit/main/cli.c Tue Jul 24 15:36:51 2012
@@ -39,6 +39,7 @@
 #include <regex.h>
 #include <pwd.h>
 #include <grp.h>
+#include <editline/readline.h>
 
 #include "asterisk/cli.h"
 #include "asterisk/linkedlists.h"
@@ -48,7 +49,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
 #include "asterisk/lock.h"
-#include "editline/readline/readline.h"
 #include "asterisk/threadstorage.h"
 #include "asterisk/translate.h"
 

Modified: team/kpfleming/system-libedit/main/editline/configure.in
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/main/editline/configure.in?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/main/editline/configure.in (original)
+++ team/kpfleming/system-libedit/main/editline/configure.in Tue Jul 24 15:36:51 2012
@@ -235,7 +235,7 @@
 dnl Add files to the lists if readline compatibility is enabled.
 if test "x$enable_readline" = "xyes" ; then
   CCSRCS="$CCSRCS readline.c"
-  IHDRS="$IHDRS readline/readline.h"
+  IHDRS="$IHDRS readline.h"
   IHDR_LINKS="readline.h readline/history.h"
   HDR_DIRS="$HDR_DIRS include/readline"
   LIB_A_LINKS="$LIB_A_LINKS libedit.a libreadline.a"

Modified: team/kpfleming/system-libedit/main/editline/readline.c
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/main/editline/readline.c?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/main/editline/readline.c (original)
+++ team/kpfleming/system-libedit/main/editline/readline.c Tue Jul 24 15:36:51 2012
@@ -58,7 +58,7 @@
 #endif
 
 #include "histedit.h"
-#include "readline/readline.h"
+#include "readline.h"
 #include "el.h"
 #include "fcns.h"		/* for EL_NUM_FCNS */
 

Modified: team/kpfleming/system-libedit/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/system-libedit/makeopts.in?view=diff&rev=370459&r1=370452&r2=370459
==============================================================================
--- team/kpfleming/system-libedit/makeopts.in (original)
+++ team/kpfleming/system-libedit/makeopts.in Tue Jul 24 15:36:51 2012
@@ -169,6 +169,10 @@
 LDAP_INCLUDE=@LDAP_INCLUDE@
 LDAP_LIB=@LDAP_LIB@
 
+LIBEDIT_INTERNAL=@LIBEDIT_INTERNAL@
+LIBEDIT_INCLUDE=@LIBEDIT_INCLUDE@
+LIBEDIT_LIB=@LIBEDIT_LIB@
+
 LUA_INCLUDE=@LUA_INCLUDE@
 LUA_LIB=@LUA_LIB@
 




More information about the asterisk-commits mailing list