rendered paste bodystatic int handle_showmanagers(int fd, int argc, char *argv[]) {
struct ast_manager_user *tmp;
/* try to lock manager_user list ... */
if (ast_mutex_lock(&amulock)) {
ast_log(LOG_ERROR, "Unable to lock manager_user list\n");
return -1;
}
tmp=amus;
if (!tmp) {
ast_cli(fd, "There are no manager user.\n");
ast_mutex_unlock(&amulock);
return -1;
} else {
ast_log(LOG_WARNING, "amu2=%s\n",tmp);
}
int inc = 0;
while (tmp) {
if ( inc == 5 ) break;
ast_cli(fd, "username=%s\n",tmp->username);
tmp = tmp->next;
inc++;
}
ast_mutex_unlock(&amulock);
return RESULT_SUCCESS;
}