proc_view: fix man page string parse.
This commit is contained in:
parent
1532038b5d
commit
32ec3cc822
|
@ -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);
|
||||
|
|
|
@ -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], "<", 4);
|
||||
i += 4;
|
||||
}
|
||||
else if (*p == '>')
|
||||
{
|
||||
tmp = realloc(str, (len += 4));
|
||||
str = tmp;
|
||||
memcpy(&str[i], ">", 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;
|
||||
}
|
Loading…
Reference in New Issue