All pastes #21070 Raw Edit

Mine

public text v1 · immutable
#21070 ·published 2005-08-25 04:43 UTC
rendered paste body
static 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;
}