There are cases where chaining ternaries is reasonable, but the syslog code there would be clearer and more maintainable if the strings were extracted into constant arrays: something like (quick hack, may be buggy)
const char* on_off[2] = { "on", "off" };
const char* status[6] = { "Auto Reboot off",
"Pinging",
"Waiting for response",
"Rebooting",
"Waiting for reboot",
"Unknown" };
const char* get_status(int reboot) {
return reboot < 6 ? status[reboot] : status[5];
}
syslog(LOG_NOTICE, "WebRelay %s:%d Relay: %s Input: %s Reboot: %s",
inet_ntoa(sin->sin_addr.s_addr), ntohs(sin->sin_port),
on_off[relay], on_off[!input], get_status(reboot));