summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/scripts/install_prereq36
-rw-r--r--main/cli.c24
-rw-r--r--main/pbx_app.c27
3 files changed, 70 insertions, 17 deletions
diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq
index dae8dee68..e588d5cd1 100755
--- a/contrib/scripts/install_prereq
+++ b/contrib/scripts/install_prereq
@@ -67,6 +67,22 @@ PACKAGES_SUSE="$PACKAGES_SUSE wget subversion"
PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch python-devel"
# Basic build system:
+PACKAGES_ARCH="make gcc pkg-config"
+# Asterisk: basic requirements:
+PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite"
+# Asterisk: for addons:
+PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"
+PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc libtool neon gmime lua uriparser libxslt openssl"
+PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash"
+PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp"
+PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zlib libldap"
+PACKAGES_ARCH="$PACKAGES_ARCH fftw libsndfile unbound"
+# Asterisk: for the unpackaged below:
+PACKAGES_ARCH="$PACKAGES_ARCH wget subversion"
+# Asterisk: for ./configure --with-pjproject-bundled:
+PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch python2"
+
+# Basic build system:
PACKAGES_NBSD="gmake pkg-config"
# Asterisk: basic requirements:
PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2"
@@ -163,6 +179,15 @@ check_installed_rpms() {
done
}
+check_installed_pacman() {
+ for pack in "$@"
+ do
+ if ! pacman -Q --explicit $pack >/dev/null 2>/dev/null
+ then echo $pack
+ fi
+ done
+}
+
check_installed_pkgs() {
for pack in "$@"
do
@@ -208,6 +233,13 @@ handle_rh() {
fi
}
+handle_arch() {
+ extra_packs=`check_installed_pacman $PACKAGES_ARCH`
+ if [ x"$extra_packs" != "x" ] ; then
+ $testcmd pacman -S --asexplicit --noconfirm $extra_packs
+ fi
+}
+
handle_nbsd() {
extra_packs=`check_installed_pkgs $PACKAGES_NBSD`
if [ x"$extra_packs" != "x" ] ; then
@@ -334,6 +366,10 @@ elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then
handle_SUSE
elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "opensuse" ]; then
handle_SUSE
+elif [ -r /etc/arch-release ]; then
+ handle_arch
+elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID_LIKE" = "archlinux" ]; then
+ handle_arch # $ID=arch
elif [ "$OS" = 'NetBSD' ]; then
handle_nbsd
elif [ "$OS" = 'OpenBSD' ]; then
diff --git a/main/cli.c b/main/cli.c
index 80c184328..e46d3427c 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1655,8 +1655,15 @@ char *ast_cli_complete(const char *word, const char * const choices[], int state
len = ast_strlen_zero(word) ? 0 : strlen(word);
for (i = 0; choices[i]; i++) {
- if ((!len || !strncasecmp(word, choices[i], len)) && ++which > state)
- return ast_strdup(choices[i]);
+ if ((!len || !strncasecmp(word, choices[i], len)) && ++which > state) {
+ if (state != -1) {
+ return ast_strdup(choices[i]);
+ }
+
+ if (ast_cli_completion_add(ast_strdup(choices[i]))) {
+ return NULL;
+ }
+ }
}
return NULL;
}
@@ -1682,9 +1689,16 @@ char *ast_complete_channels(const char *line, const char *word, int pos, int sta
struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
if (!strncasecmp(word, snapshot->name, wordlen) && (++which > state)) {
- ret = ast_strdup(snapshot->name);
- ao2_ref(msg, -1);
- break;
+ if (state != -1) {
+ ret = ast_strdup(snapshot->name);
+ ao2_ref(msg, -1);
+ break;
+ }
+
+ if (ast_cli_completion_add(ast_strdup(snapshot->name))) {
+ ao2_ref(msg, -1);
+ break;
+ }
}
}
ao2_iterator_destroy(&iter);
diff --git a/main/pbx_app.c b/main/pbx_app.c
index ec6bc7589..df8126c7f 100644
--- a/main/pbx_app.c
+++ b/main/pbx_app.c
@@ -275,7 +275,7 @@ static char *handle_show_application(struct ast_cli_entry *e, int cmd, struct as
* application at one time. You can type 'show application Dial Echo' and
* you will see informations about these two applications ...
*/
- return ast_complete_applications(a->line, a->word, a->n);
+ return ast_complete_applications(a->line, a->word, -1);
}
if (a->argc < 4) {
@@ -437,20 +437,23 @@ char *ast_complete_applications(const char *line, const char *word, int state)
AST_RWLIST_RDLOCK(&apps);
AST_RWLIST_TRAVERSE(&apps, app, list) {
cmp = strncasecmp(word, app->name, wordlen);
- if (cmp > 0) {
- continue;
- }
- if (!cmp) {
+ if (cmp < 0) {
+ /* No more matches. */
+ break;
+ } else if (!cmp) {
/* Found match. */
- if (++which <= state) {
- /* Not enough matches. */
- continue;
+ if (state != -1) {
+ if (++which <= state) {
+ /* Not enough matches. */
+ continue;
+ }
+ ret = ast_strdup(app->name);
+ break;
+ }
+ if (ast_cli_completion_add(ast_strdup(app->name))) {
+ break;
}
- ret = ast_strdup(app->name);
- break;
}
- /* Not in container. */
- break;
}
AST_RWLIST_UNLOCK(&apps);