watch: fix warning

getty: fix breakage; fix excessive stack usage
This commit is contained in:
Denis Vlasenko
2006-10-23 22:43:02 +00:00
parent 4e70bf4359
commit 703aa13ff5
2 changed files with 25 additions and 23 deletions

View File

@@ -58,8 +58,9 @@ int watch_main(int argc, char **argv)
time_t t;
get_terminal_width_height(STDOUT_FILENO, &width, 0);
if (width < 1) width = 1; // paranoia
header = xrealloc(header, width--);
// We pad with spaces entire length
// '%-*s' pads header with spaces to the full width
snprintf(header, width, "Every %ds: %-*s", period, width, cmd);
time(&t);
thyme = ctime(&t);
@@ -75,4 +76,5 @@ int watch_main(int argc, char **argv)
system(cmd);
sleep(period);
}
return 0; // gcc thinks we can reach this :)
}