bbfdm/test/files/usr/libexec/rpcd/ethernet
Amin Ben Ramdhane 080f7b4f85 Ticket refs #7333: fix warnings, code analysis and clean up the code
- Fix all errors catched by cppcheck threadsafety (cppcheck --error-exitcode=0 --addon=threadsafety bbf)
 - Fix some errors catched by cppcheck cert (cppcheck --error-exitcode=0 --addon=cert bbf)
 - Add new str-protected macros instead of using str functions directly to avoid crashes
2022-02-16 10:33:59 +00:00

30 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
. /usr/share/libubox/jshn.sh
case "$1" in
list)
echo '{ "rmonstats" : {"ifname":"str"} }'
;;
call)
case "$2" in
rmonstats)
read input;
json_load "$input"
json_get_var ifname ifname
if [ "$ifname" = "eth1" ]; then
cat /tmp/rmonstats_eth1.data 2>/dev/null
elif [ "$ifname" = "eth2" ]; then
cat /tmp/rmonstats_eth2.data 2>/dev/null
elif [ "$ifname" = "eth3" ]; then
cat /tmp/rmonstats_eth3.data 2>/dev/null
elif [ "$ifname" = "eth4" ]; then
cat /tmp/rmonstats_eth4.data 2>/dev/null
else
cat /tmp/rmonstats_eth0.data 2>/dev/null
fi
;;
esac
;;
esac