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