Small tweaks to updatestatus to make it more intuitive

This commit is contained in:
Ashish Kumar Yadav 2020-07-22 19:14:53 +05:30
parent 510f8ff6dd
commit 06771d24e5

View file

@ -200,8 +200,11 @@ updatestatus()
for (current = blocks; current->pathu; current++) {
if (EMPTYCMDOUT(current)) {
if (current->cmdoutprv[0] != current->cmdoutcur[0])
goto updatestrstrt;
if (current->cmdoutprv[0] != current->cmdoutcur[0]) {
current->cmdoutprv[0] = current->cmdoutcur[0];
current++;
goto update0;
}
continue;
}
i = 0;
@ -211,7 +214,7 @@ updatestatus()
continue;
} else {
str += i;
goto updatestrmddl;
goto update1;
}
} while (NOTATCMDOUTEND(current, i));
str += i;
@ -220,15 +223,14 @@ updatestatus()
str += delimlength;
}
return 1;
updatestrstrt:
current->cmdoutprv[0] = current->cmdoutcur[0];
for (current++; current->pathu; current++) {
update0:
for (; current->pathu; current++) {
if (EMPTYCMDOUT(current)) {
current->cmdoutprv[0] = current->cmdoutcur[0];
continue;
}
i = 0;
updatestrmddl:
update1:
do {
*(str++) = current->cmdoutcur[i];
current->cmdoutprv[i] = current->cmdoutcur[i];
@ -240,6 +242,7 @@ updatestrmddl:
*(str++) = delim[i];
*(str++) = '\n';
}
/* remove delimiter at the end if not all blocks are empty */
if (str != statusstr)
*(str - delimlength) = '\0';
return 0;