Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need help explaining htop fix #100

Open
joe42 opened this issue Jan 9, 2023 · 0 comments
Open

need help explaining htop fix #100

joe42 opened this issue Jan 9, 2023 · 0 comments

Comments

@joe42
Copy link

joe42 commented Jan 9, 2023

Hi,
Could you help me understand how the htop fix works? I don't quite get the code.
I can't install aha on a server, but need to parse htop output and the only part I am still missing is how to replace the "newlines" in the output. I would love to have an example akin to `echo "weird htop newline"|sed command to replace with \n``

if (opts.htop_fix) //a little dirty ...
{
    elem=parseInsert(buffer);
    pelem second=elem->next;
    if (second==NULL)
	    second=elem;
    newline=second->digit[0]-1;
    if (second->digitcount>1)
	    newline=(newline+1)*10+second->digit[1]-1;
    if (second->digitcount>2)
	    newline=(newline+1)*10+second->digit[2]-1;
    deleteParse(elem);
    if (newline<line)
	    opts.line_break=1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant