Skip to content
Snippets Groups Projects
Select Git revision
  • 07dfb3d5f277d659878be1751640b96addbb4cf8
  • devel default protected
  • fix_crash_at_transport
  • wenpeng-1007
  • asterisk_rdkb
  • lk_debug_dialogs
  • lk_forking_revert
  • wenpeng-jul8
  • gyang-devel
  • gyang-devel1
  • wenpeng-jul9
  • asterisk_rdkb_ipv6
  • 16916_rdkb_merge
  • lk_disable_registrar
  • wenpeng-100rel-ippbx
  • fix_multiple_dns_lookup
  • dev_fxs_no_wb
  • fix_fallback
  • 14666_fxs_no_wideband_codec
  • fix_srv_records
  • fix_deadlock_in_bridge_peer_functions
  • 22.0.0-pre1
  • 21.4.2
  • 20.9.2
  • 18.24.2
  • certified-20.7-cert2
  • certified-18.9-cert11
  • 21.4.1
  • 20.9.1
  • 18.24.1
  • 21.4.0
  • 20.9.0
  • 18.24.0
  • certified-20.7-cert1
  • certified-18.9-cert10
  • 21.4.0-rc1
  • 20.9.0-rc1
  • 18.24.0-rc1
  • 21.3.1
  • 20.8.1
  • 18.23.1
41 results

cli.c

Blame
  • cli.c 23.54 KiB
    /*
     * Asterisk -- A telephony toolkit for Linux.
     *
     * Standard Command Line Interface
     * 
     * Copyright (C) 1999, Mark Spencer
     *
     * Mark Spencer <markster@linux-support.net>
     *
     * This program is free software, distributed under the terms of
     * the GNU General Public License
     */
    
    #include <unistd.h>
    #include <stdlib.h>
    #include <asterisk/logger.h>
    #include <asterisk/options.h>
    #include <asterisk/cli.h>
    #include <asterisk/module.h>
    #include <asterisk/channel.h>
    #include <asterisk/channel_pvt.h>
    #include <sys/signal.h>
    #include <stdio.h>
    #include <signal.h>
    #include <string.h>
    #include <pthread.h>
    /* For rl_filename_completion */
    #include "editline/readline/readline.h"
    /* For module directory */
    #include "asterisk.h"
    #include "build.h"
    #include "astconf.h"
    
    #define VERSION_INFO "Asterisk " ASTERISK_VERSION " built by " BUILD_USER "@" BUILD_HOSTNAME \
    	" on a " BUILD_MACHINE " running " BUILD_OS
    	
    void ast_cli(int fd, char *fmt, ...)
    {
    	char stuff[4096];
    	va_list ap;
    	va_start(ap, fmt);
    	vsnprintf(stuff, sizeof(stuff), fmt, ap);
    	va_end(ap);
    	write(fd, stuff, strlen(stuff));
    }
    
    pthread_mutex_t clilock = AST_MUTEX_INITIALIZER;
    
    
    struct ast_cli_entry *helpers = NULL;
    
    static char load_help[] = 
    "Usage: load <module name>\n"
    "       Loads the specified module into Asterisk.\n";
    
    static char unload_help[] = 
    "Usage: unload [-f|-h] <module name>\n"
    "       Unloads the specified module from Asterisk.  The -f\n"
    "       option causes the module to be unloaded even if it is\n"
    "       in use (may cause a crash) and the -h module causes the\n"
    "       module to be unloaded even if the module says it cannot, \n"
    "       which almost always will cause a crash.\n";
    
    static char help_help[] =
    "Usage: help [topic]\n"
    "       When called with a topic as an argument, displays usage\n"
    "       information on the given command.  If called without a\n"
    "       topic, it provides a list of commands.\n";
    
    static char chanlist_help[] =