diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-03 00:51:57 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-03 00:51:57 +0000 |
commit | 48cae2ce726e032c1ebb1a1711cb812cc51ee2a3 (patch) | |
tree | bfc40c837271ee2d04cb23e1aa173b290a8eb5d0 /utils.c | |
parent | 7270663abbf68aeacd97ee28ff277d9fdc946fc9 (diff) |
Merge OEJ's print groups feature (bug #3228, with changes)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4636 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rwxr-xr-x | utils.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -430,3 +430,29 @@ char *ast_strcasestr(const char *haystack, const char *needle) } #endif + +/*--- ast_print_group: Print call group and pickup group ---*/ +char *ast_print_group(char *buf, int buflen, unsigned int group) +{ + unsigned int i; + int first=1; + char num[3]; + + buf[0] = '\0'; + + if (!group) /* Return empty string if no group */ + return(buf); + + for (i=0; i<=31; i++) { /* Max group is 31 */ + if (group & (1 << i)) { + if (!first) { + strncat(buf, ", ", buflen); + } else { + first=0; + } + snprintf(num, sizeof(num), "%u", i); + strncat(buf, num, buflen); + } + } + return(buf); +} |