[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.276,
1.277 chan_sip.c, 1.716, 1.717
kpfleming at lists.digium.com
kpfleming at lists.digium.com
Sun May 1 21:27:24 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv24115/channels
Modified Files:
chan_iax2.c chan_sip.c
Log Message:
change (iax2,sip) show (peers,users) to use 'like <pattern>' for pattern-matching to be consistent with other CLI commands
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.276
retrieving revision 1.277
diff -u -d -r1.276 -r1.277
--- chan_iax2.c 29 Apr 2005 17:00:33 -0000 1.276
+++ chan_iax2.c 2 May 2005 01:34:21 -0000 1.277
@@ -3980,14 +3980,18 @@
char auth[90] = "";
char *pstr = "";
- if (argc < 3 || argc > 4)
- return RESULT_SHOWUSAGE;
-
- if (argc == 4) {
- if (regcomp(®exbuf, argv[3], REG_EXTENDED | REG_NOSUB))
+ switch (argc) {
+ case 5:
+ if (!strcasecmp(argv[3], "like")) {
+ if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB))
+ return RESULT_SHOWUSAGE;
+ havepattern = 1;
+ } else
return RESULT_SHOWUSAGE;
-
- havepattern = 1;
+ case 3:
+ break;
+ default:
+ return RESULT_SHOWUSAGE;
}
ast_mutex_lock(&userl.lock);
@@ -4042,36 +4046,38 @@
char iabuf[INET_ADDRSTRLEN];
int registeredonly=0;
- if (argc > 5)
- return RESULT_SHOWUSAGE;
-
- if (argc > 3) {
- if (!strcasecmp(argv[3], "registered")) {
+ switch (argc) {
+ case 6:
+ if (!strcasecmp(argv[3], "registered"))
registeredonly = 1;
- } else {
- if (regcomp(®exbuf, argv[3], REG_EXTENDED | REG_NOSUB))
+ else
+ return RESULT_SHOWUSAGE;
+ if (!strcasecmp(argv[4], "like")) {
+ if (regcomp(®exbuf, argv[5], REG_EXTENDED | REG_NOSUB))
return RESULT_SHOWUSAGE;
-
havepattern = 1;
- }
- }
-
- if (argc > 4) {
- if (!strcasecmp(argv[4], "registered")) {
- if (registeredonly)
- return RESULT_SHOWUSAGE;
-
- registeredonly = 1;
- } else {
- if (havepattern)
- return RESULT_SHOWUSAGE;
-
+ } else
+ return RESULT_SHOWUSAGE;
+ break;
+ case 5:
+ if (!strcasecmp(argv[3], "like")) {
if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB))
return RESULT_SHOWUSAGE;
-
havepattern = 1;
- }
- }
+ } else
+ return RESULT_SHOWUSAGE;
+ break;
+ case 4:
+ if (!strcasecmp(argv[3], "registered"))
+ registeredonly = 1;
+ else
+ return RESULT_SHOWUSAGE;
+ break;
+ case 3:
+ break;
+ default:
+ return RESULT_SHOWUSAGE;
+ }
ast_mutex_lock(&peerl.lock);
ast_cli(fd, FORMAT2, "Name/Username", "Host", " ", "Mask", "Port", " ", "Status");
@@ -4416,7 +4422,7 @@
static char show_users_usage[] =
-"Usage: iax2 show users [pattern]\n"
+"Usage: iax2 show users [like <pattern>]\n"
" Lists all known IAX2 users.\n"
" Optional regular expression pattern is used to filter the user list.\n";
@@ -4429,9 +4435,9 @@
" Lists network status for all currently active IAX channels.\n";
static char show_peers_usage[] =
-"Usage: iax2 show peers [registered] [pattern]\n"
+"Usage: iax2 show peers [registered] [like <pattern>]\n"
" Lists all known IAX2 peers.\n"
-" Optional 'registered' argument lists only peers with known addresses.\n"
+" Optional 'registered' argument lists only peers with known addresses.\n"
" Optional regular expression pattern is used to filter the peer list.\n";
static char show_firmware_usage[] =
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.716
retrieving revision 1.717
diff -u -d -r1.716 -r1.717
--- chan_sip.c 2 May 2005 01:15:23 -0000 1.716
+++ chan_sip.c 2 May 2005 01:34:21 -0000 1.717
@@ -6205,14 +6205,18 @@
#define FORMAT "%-25.25s %-15.15s %-15.15s %-15.15s %-5.5s%-10.10s\n"
- if (argc > 4)
- return RESULT_SHOWUSAGE;
-
- if (argc == 4) {
- if (regcomp(®exbuf, argv[3], REG_EXTENDED | REG_NOSUB))
+ switch (argc) {
+ case 5:
+ if (!strcasecmp(argv[3], "like")) {
+ if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB))
+ return RESULT_SHOWUSAGE;
+ havepattern = 1;
+ } else
return RESULT_SHOWUSAGE;
-
- havepattern = 1;
+ case 3:
+ break;
+ default:
+ return RESULT_SHOWUSAGE;
}
ast_cli(fd, FORMAT, "Username", "Secret", "Accountcode", "Def.Context", "ACL", "NAT");
@@ -6303,14 +6307,18 @@
snprintf(idtext,256,"ActionID: %s\r\n",id);
}
- if (argc > 4)
- return RESULT_SHOWUSAGE;
-
- if (argc == 4) {
- if (regcomp(®exbuf, argv[3], REG_EXTENDED | REG_NOSUB))
+ switch (argc) {
+ case 5:
+ if (!strcasecmp(argv[3], "like")) {
+ if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB))
+ return RESULT_SHOWUSAGE;
+ havepattern = 1;
+ } else
return RESULT_SHOWUSAGE;
-
- havepattern = 1;
+ case 3:
+ break;
+ default:
+ return RESULT_SHOWUSAGE;
}
if (!s) { /* Normal list */
@@ -7707,7 +7715,7 @@
" Message types are defined in sip_notify.conf\n";
static char show_users_usage[] =
-"Usage: sip show users [pattern]\n"
+"Usage: sip show users [like <pattern>]\n"
" Lists all known SIP users.\n"
" Optional regular expression pattern is used to filter the user list.\n";
@@ -7734,7 +7742,7 @@
" Provides detailed dialog history on a given SIP channel.\n";
static char show_peers_usage[] =
-"Usage: sip show peers [pattern]\n"
+"Usage: sip show peers [like <pattern>]\n"
" Lists all known SIP peers.\n"
" Optional regular expression pattern is used to filter the peer list.\n";
More information about the svn-commits
mailing list