aboutsummaryrefslogtreecommitdiffstats
path: root/cli.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-06 20:27:51 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-06 20:27:51 +0000
commitb2cbb6a75dfc8ea70554192ea223c3bd5dd52ed8 (patch)
tree2caa31e5bbb676cf8588f73516608ecef258757b /cli.c
parent2d6a1fbb231a5e8e082a2172a31d8def4a6e9607 (diff)
remove experimental module version tags
add per-file revision tags and 'show version files' CLI command git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5864 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cli.c')
-rwxr-xr-xcli.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/cli.c b/cli.c
index 4f1ce103a..c844da82a 100755
--- a/cli.c
+++ b/cli.c
@@ -19,6 +19,10 @@
#include <string.h>
#include <ctype.h>
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/cli.h"
@@ -31,7 +35,6 @@
/* For rl_filename_completion */
#include "editline/readline/readline.h"
/* For module directory */
-#include "asterisk.h"
#include "asterisk/version.h"
#include "asterisk/build.h"
@@ -227,17 +230,17 @@ static int handle_unload(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-#define MODLIST_FORMAT "%-30s %-40.40s %-20.20s %-10d\n"
-#define MODLIST_FORMAT2 "%-30s %-40.40s %-20.20s %-10s\n"
+#define MODLIST_FORMAT "%-30s %-40.40s %-10d\n"
+#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s\n"
AST_MUTEX_DEFINE_STATIC(climodentrylock);
static int climodentryfd = -1;
-static int modlist_modentry(const char *module, const char *description, int usecnt, const char *version, const char *like)
+static int modlist_modentry(const char *module, const char *description, int usecnt, const char *like)
{
/* Comparing the like with the module */
if (strstr(module, like) != NULL) {
- ast_cli(climodentryfd, MODLIST_FORMAT, module, description, version, usecnt);
+ ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt);
return 1;
}
return 0;
@@ -384,7 +387,7 @@ static int handle_modlist(int fd, int argc, char *argv[])
ast_mutex_lock(&climodentrylock);
climodentryfd = fd;
- ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Version", "Use Count");
+ ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count");
ast_cli(fd,"%d modules loaded\n", ast_update_module_list(modlist_modentry, like));
climodentryfd = -1;
ast_mutex_unlock(&climodentrylock);
@@ -822,6 +825,22 @@ static struct ast_cli_entry *find_cli(char *cmds[], int exact)
int y;
int match;
struct ast_cli_entry *e=NULL;
+
+ for (e=helpers;e;e=e->next) {
+ match = 1;
+ for (y=0;match && cmds[y]; y++) {
+ if (!e->cmda[y] && !exact)
+ break;
+ if (!e->cmda[y] || strcasecmp(e->cmda[y], cmds[y]))
+ match = 0;
+ }
+ if ((exact > -1) && e->cmda[y])
+ match = 0;
+ if (match)
+ break;
+ }
+ if (e)
+ return e;
for (x=0;builtins[x].cmda[0];x++) {
/* start optimistic */
match = 1;
@@ -843,20 +862,7 @@ static struct ast_cli_entry *find_cli(char *cmds[], int exact)
if (match)
return &builtins[x];
}
- for (e=helpers;e;e=e->next) {
- match = 1;
- for (y=0;match && cmds[y]; y++) {
- if (!e->cmda[y] && !exact)
- break;
- if (!e->cmda[y] || strcasecmp(e->cmda[y], cmds[y]))
- match = 0;
- }
- if ((exact > -1) && e->cmda[y])
- match = 0;
- if (match)
- break;
- }
- return e;
+ return NULL;
}
static void join(char *dest, size_t destsize, char *w[])