Hi,

I'm not sure if I'm the only one having a problem with the cli history
written to and read back from history file.
The lines written are encoded like

set\134040verbose\1340405\012

but when read back, it is not decoded and when using <cursor-up>
the line like above is shown.
I noticed in corelib/openpbx.c that the function opbx_el_read_history()
does not use the provided history-H_LOAD mechanism.
Anybody know why?

When I change that function to use H_LOAD (see patch below) it works
perfectly for me.

Any ideas?
If there are no objections, I will add this patch to trunk.

Armin


diff -ur OpenPBX.orig/corelib/openpbx.c OpenPBX/corelib/openpbx.c
--- OpenPBX.orig/corelib/openpbx.c      2005-12-11 19:26:58.330325502 +0100
+++ OpenPBX/corelib/openpbx.c   2005-12-11 20:17:21.298651968 +0100
@@ -1622,28 +1622,12 @@
 
 static int opbx_el_read_history(char *filename)
 {
-       char buf[256];
-       FILE *f;
-       int ret = -1;
+       HistEvent ev;
 
        if (el_hist == NULL || el == NULL)
                opbx_el_initialize();
 
-       if ((f = fopen(filename, "r")) == NULL)
-               return ret;
-
-       while (!feof(f)) {
-               fgets(buf, sizeof(buf), f);
-               if (!strcmp(buf, "_HiStOrY_V2_\n"))
-                       continue;
-               if (opbx_all_zeros(buf))
-                       continue;
-               if ((ret = opbx_el_add_history(buf)) == -1)
-                       break;
-       }
-       fclose(f);
-
-       return ret;
+       return (history(el_hist, &ev, H_LOAD, filename));
 }
 
 static void opbx_remotecontrol(char * data)

_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev

Reply via email to