diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/uptime.c | 7 | ||||
-rw-r--r-- | src/uptime.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/uptime.c b/src/uptime.c index c9f1c8e..49161c9 100644 --- a/src/uptime.c +++ b/src/uptime.c @@ -21,11 +21,18 @@ void run_uptime_command(const char *command) { pclose(p); } +#ifndef __NetBSD__ void display_days() { run_uptime_command("uptime | awk '{print $3}' && echo \" days\""); } +#endif void display_time() { +#if defined(__NetBSD__) + run_uptime_command("uptime | awk '{print $3}' | sed 's/,//' | " + "sed 's/:/ hours, /' && echo \" mins\""); +#else run_uptime_command("uptime | awk '{print $5}' | sed 's/,//' | " "sed 's/:/ hours, /' && echo \" mins\""); +#endif } diff --git a/src/uptime.h b/src/uptime.h index 12ee668..74e0afe 100644 --- a/src/uptime.h +++ b/src/uptime.h @@ -1,7 +1,9 @@ #ifndef UPTIME_H #define UPTIME_H +#ifndef __NetBSD__ void display_days(); +#endif void display_time(); #endif |