aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-02-07 17:19:44 -0600
committerRob Landley <rob@landley.net>2021-02-07 17:19:44 -0600
commit664c417af5d16e217557468ba747a369e8e1ab6b (patch)
tree028aacc085207ef347fdaa9eb1ccf86d06257208 /toys/other
parent9f7f62615f3963591af33fcc7582867f7063efd2 (diff)
downloadtoybox-664c417af5d16e217557468ba747a369e8e1ab6b.tar.gz
Add lots of "static" annotations, make a couple things use FLAG() macros, etc.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/timeout.c2
-rw-r--r--toys/other/watch.c10
-rw-r--r--toys/other/watchdog.c3
3 files changed, 8 insertions, 7 deletions
diff --git a/toys/other/timeout.c b/toys/other/timeout.c
index 55b3dca1..1e125300 100644
--- a/toys/other/timeout.c
+++ b/toys/other/timeout.c
@@ -55,7 +55,7 @@ static void handler(int i)
// timeval inexplicably makes up a new type for microseconds, despite timespec's
// nanoseconds field (needing to store 1000* the range) using "long". Bravo.
-void xparsetimeval(char *s, struct timeval *tv)
+static void xparsetimeval(char *s, struct timeval *tv)
{
long ll;
diff --git a/toys/other/watch.c b/toys/other/watch.c
index fa5e71c5..af650045 100644
--- a/toys/other/watch.c
+++ b/toys/other/watch.c
@@ -33,7 +33,7 @@ GLOBALS(
)
// When a child process exits, stop tracking them. Handle errors for -be
-void watch_child(int sig)
+static void watch_child(int sig)
{
int status;
pid_t pid = wait(&status);
@@ -41,8 +41,8 @@ void watch_child(int sig)
status = WIFEXITED(status) ? WEXITSTATUS(status) : WTERMSIG(status)+127;
if (status) {
// TODO should this be beep()?
- if (toys.optflags&FLAG_b) putchar('\b');
- if (toys.optflags&FLAG_e) {
+ if (FLAG(b)) putchar('\b');
+ if (FLAG(e)) {
printf("Exit status %d\r\n", status);
tty_reset();
_exit(status);
@@ -55,7 +55,7 @@ void watch_child(int sig)
// Return early for low-ascii characters with special behavior,
// discard remaining low ascii, escape other unprintable chars normally
-int watch_escape(FILE *out, int cols, int wc)
+static int watch_escape(FILE *out, int cols, int wc)
{
if (wc==27 || (wc>=7 && wc<=13)) return -1;
if (wc < 32) return 0;
@@ -99,7 +99,7 @@ void watch_main(void)
start_redraw(&width, &height);
// redraw the header
- if (!(toys.optflags&FLAG_t)) {
+ if (!FLAG(t)) {
time_t t = time(0);
int pad, ctimelen;
diff --git a/toys/other/watchdog.c b/toys/other/watchdog.c
index 232d82c0..0402d3ee 100644
--- a/toys/other/watchdog.c
+++ b/toys/other/watchdog.c
@@ -29,7 +29,8 @@ GLOBALS(
int fd;
)
-void safe_shutdown(int ignored) {
+static void safe_shutdown(int ignored)
+{
write(TT.fd, "V", 1);
close(TT.fd);
error_exit("safely exited watchdog.");