netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=32ec3cc8222b5f3741cbfefd990d273a85bf2f9f

commit 32ec3cc8222b5f3741cbfefd990d273a85bf2f9f
Author: Alastair Poole <[email protected]>
Date:   Mon May 18 18:48:53 2020 +0100

    proc_view: fix man page string parse.
---
 src/bin/ui/ui_process_view.c |  3 ++-
 src/bin/ui/util.c            | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/src/bin/ui/ui_process_view.c b/src/bin/ui/ui_process_view.c
index 531cb29..9aa172b 100644
--- a/src/bin/ui/ui_process_view.c
+++ b/src/bin/ui/ui_process_view.c
@@ -1,5 +1,6 @@
 #include "ui_process_view.h"
 #include "../system/process.h"
+#include "util.c"
 
 typedef struct {
    int     tid;
@@ -39,7 +40,7 @@ _exe_response(const char *command)
 
    while ((fgets(buf, sizeof(buf), p)) != NULL)
      {
-        lines = eina_list_append(lines, elm_entry_markup_to_utf8(buf));
+        lines = eina_list_append(lines, _man2entry(buf));
      }
 
    pclose(p);
diff --git a/src/bin/ui/util.c b/src/bin/ui/util.c
new file mode 100644
index 0000000..5289598
--- /dev/null
+++ b/src/bin/ui/util.c
@@ -0,0 +1,44 @@
+static char *
+_man2entry(const char *text)
+{
+   const char *p;
+   char *str;
+   void *tmp;
+   int i = 0, len = strlen(text) + 1;
+
+   str = malloc(len);
+   p = text;
+
+   while (*p)
+     {
+        if (*p == '<')
+          {
+             tmp = realloc(str, (len += 4));
+             str = tmp;
+             memcpy(&str[i], "&lt;", 4);
+             i += 4;
+          }
+        else if (*p == '>')
+          {
+             tmp = realloc(str, (len += 4));
+             str = tmp;
+             memcpy(&str[i], "&gt;", 4);
+             i += 4;
+          }
+        else if (*p == '\t')
+          {
+             tmp = realloc(str, (len += 8));
+             str = tmp;
+             memcpy(&str[i], "        ", 8);
+             i += 8;
+          }
+        else
+          {
+             str[i++] = *p;
+          }
+        p++;
+     }
+   str[i] = '\0';
+
+   return str;
+}

-- 


Reply via email to