summaryrefslogtreecommitdiff
path: root/channels/sig_pri.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2011-04-21 22:42:41 +0000
committerRichard Mudgett <rmudgett@digium.com>2011-04-21 22:42:41 +0000
commit13e925b276887c6a5593f77541ceb9161c4b0281 (patch)
tree39c942d93254d7849abae909e43d21ca63463e5f /channels/sig_pri.c
parentc2676dc9dce851bc186ee7e819543f920e4842f6 (diff)
Simplify sig_pri.c:build_status().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@314734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sig_pri.c')
-rw-r--r--channels/sig_pri.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index f3bf64670..49fb246be 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -8668,18 +8668,10 @@ static void build_status(char *s, size_t len, int status, int active)
if (!s || len < 1) {
return;
}
- s[0] = '\0';
- if (!(status & DCHAN_NOTINALARM))
- strncat(s, "In Alarm, ", len - strlen(s) - 1);
- if (status & DCHAN_UP)
- strncat(s, "Up", len - strlen(s) - 1);
- else
- strncat(s, "Down", len - strlen(s) - 1);
- if (active)
- strncat(s, ", Active", len - strlen(s) - 1);
- else
- strncat(s, ", Standby", len - strlen(s) - 1);
- s[len - 1] = '\0';
+ snprintf(s, len, "%s%s, %s",
+ (status & DCHAN_NOTINALARM) ? "" : "In Alarm, ",
+ (status & DCHAN_UP) ? "Up" : "Down",
+ (active) ? "Active" : "Standby");
}
void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri)