diff options
author | 2016-05-06 15:14:16 +0200 | |
---|---|---|
committer | 2016-05-06 15:14:16 +0200 | |
commit | 729eb50738777d6dbc27f81d854c824b32bebb05 (patch) | |
tree | 814244efc5505d1d5096557c9cb65787dd3a3cd6 /shell | |
parent | 7f8d8aa7a9e542524e9edfcca1fe1220abbf8e40 (diff) |
ripe-atlas-fw: imported version 47304730
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index 10cab48..54d0c55 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -771,6 +771,7 @@ static int builtin_condmv(char **argv); static int builtin_dfrm(char **argv); static int builtin_rxtxrpt(char **argv); static int builtin_rptaddrs(char **argv); +static int builtin_rptuptime(char **argv); static int builtin_true(char **argv); static int builtin_set(char **argv); static int builtin_shift(char **argv); @@ -831,6 +832,7 @@ static const struct built_in_command bltins[] = { BLTIN("dfrm" , builtin_dfrm, "cleanup if free space gets too low"), BLTIN("rxtxrpt" , builtin_rxtxrpt, "report RX and TX"), BLTIN("rptaddrs" , builtin_rptaddrs, "report address(es), route(s), and dns"), + BLTIN("rptuptime" , builtin_rptuptime, "report uptime"), BLTIN("echo" , builtin_echo, "Write to stdout"), BLTIN("eval" , builtin_eval, "Construct and run shell command"), BLTIN("exec" , builtin_exec, "Execute command, don't return to shell"), @@ -4682,7 +4684,7 @@ static int builtin_rxtxrpt(char **argv) return rxtxrpt_main(argc, argv); } -int builitin_rptaddrs(int argc, char *argv[]); +int rptaddrs_main(int argc, char *argv[]); static int builtin_rptaddrs(char **argv) { @@ -4693,6 +4695,20 @@ static int builtin_rptaddrs(char **argv) return rptaddrs_main(argc, argv); } +#define DBQ(str) "\"" #str "\"" +static int builtin_rptuptime(char **argv __attribute((unused))) +{ + struct sysinfo info; + + printf("RESULT { " DBQ(id) ": " DBQ(7001) ", "); + printf(DBQ(fw) ": %d, ", get_atlas_fw_version()); + printf(DBQ(time) ": %ld, ", (long)time(NULL)); + printf(DBQ(lts) ": %d, ", get_timesync()); + sysinfo(&info); + printf(DBQ(uptime) ": %ld }\n", (long)info.uptime); + + return 0; +} static int builtin_rchoose(char **argv) { |