updateblock - nullterminate
This commit is contained in:
parent
452d7850c2
commit
161e0f5615
1
blocks.h
1
blocks.h
|
@ -23,7 +23,6 @@
|
|||
delivered first. */
|
||||
|
||||
/* pathu - path of the program whose output is used as status text of the block
|
||||
(output of the program should end in a null or newline character)
|
||||
* pathc - path of the program used for handling clicks on the block */
|
||||
|
||||
/* 1 interval = INTERVALs seconds, INTERVALn nanoseconds */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
ICON=""
|
||||
read -r capacity </sys/class/power_supply/BAT0/capacity
|
||||
printf "$ICON%s%%\n" "$capacity"
|
||||
printf "$ICON%s%%" "$capacity"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
ICON=""
|
||||
printf "$ICON%s\n" "$(date '+%a, %b %d, %R')"
|
||||
printf "$ICON%s" "$(date '+%a, %b %d, %R')"
|
||||
|
|
|
@ -9,7 +9,7 @@ read -r temp </sys/class/thermal/thermal_zone0/temp
|
|||
temp=${temp%???}
|
||||
|
||||
if [ "$temp" -lt "$crit" ] ; then
|
||||
printf "$ICONn%s°C\n" "$temp"
|
||||
printf "$ICONn%s°C" "$temp"
|
||||
else
|
||||
printf "$ICONc%s°C\n" "$temp"
|
||||
printf "$ICONc%s°C" "$temp"
|
||||
fi
|
||||
|
|
|
@ -234,6 +234,7 @@ updateblock(Block *block, int sigval)
|
|||
exit(1);
|
||||
}
|
||||
close(fd[0]);
|
||||
block->curcmdout[block->curcmdout[trd - 1] == '\n' ? trd - 1 : trd] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +250,7 @@ updatestatus()
|
|||
/* checking half of the function */
|
||||
for (; block->pathu; block++) {
|
||||
c = block->curcmdout, p = block->prvcmdout;
|
||||
for (; *c == *p && *c != '\n' && *c != '\0'; c++, p++);
|
||||
for (; *c != '\0' && *c == *p; c++, p++);
|
||||
s += c - block->curcmdout;
|
||||
if (*c != *p)
|
||||
goto update;
|
||||
|
@ -265,7 +266,7 @@ updatestatus()
|
|||
for (; block->pathu; block++) {
|
||||
c = block->curcmdout, p = block->prvcmdout;
|
||||
update:
|
||||
for (; *p = *c, *c != '\n' && *c != '\0'; c++, p++)
|
||||
for (; (*p = *c) != '\0'; c++, p++)
|
||||
*(s++) = *c;
|
||||
if (c == block->curcmdout)
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue