diff options
Diffstat (limited to 'arm.c')
-rw-r--r-- | arm.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -122,12 +122,13 @@ static const char *ready_to_str (int i) -int show_state (int fd) +int show_state (int fd, int zone) { int i, l = SIA_MAX_DATA_LENGTH; unsigned char armed[SIA_MAX_DATA_LENGTH]; unsigned char state[SIA_MAX_DATA_LENGTH]; unsigned char ready[SIA_MAX_DATA_LENGTH]; + int s = 0; i = get_thing (fd, "SA", armed); @@ -161,12 +162,19 @@ int show_state (int fd) printf ("%-6s | %-15s | %-15s | %-15s\n", "Zone", "Armed", "State", "Ready"); printf ("-------+-----------------+-----------------+----------------\n"); - for (i = 0; i < l; ++i) + if (zone > 0) { + s = zone; + l = zone + 1; + } + + for (i = s; i < l; ++i) printf ("%6d | %-15s | %-15s | %-15s\n", i + 1, armed_to_str (armed[i]), state_to_str (state[i]), ready_to_str (ready[i])); printf ("\n"); - return armed[0] - '0'; + if (zone < 0) zone = 0; + + return armed[zone] - '0'; } |