[asterisk-commits] junky: branch junky/cli-tls r204619 - /team/junky/cli-tls/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 30 22:56:25 CDT 2009


Author: junky
Date: Tue Jun 30 22:56:20 2009
New Revision: 204619

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204619
Log:
after Mark's review:
fix indentation.
replace AST_RWLIST_INSERT_HEAD => AST_LIST_INSERT_HEAD


Modified:
    team/junky/cli-tls/main/pbx.c

Modified: team/junky/cli-tls/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/pbx.c?view=diff&rev=204619&r1=204618&r2=204619
==============================================================================
--- team/junky/cli-tls/main/pbx.c (original)
+++ team/junky/cli-tls/main/pbx.c Tue Jun 30 22:56:20 2009
@@ -3207,53 +3207,53 @@
 static char *handle_show_filters(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_cli_filter *c;
-        int count = 0;
-
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "core show filters";
-                e->usage =
-                        "Usage: core show filters\n"
-                        "       List All CLI filters\n";
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-        }
-
-        if (a->argc != 3) {
-                return CLI_SHOWUSAGE;
-        }
-
-        ast_cli(a->fd, "Active CLI Filters:\n---------------------------------------------------------------------\n");
-
-        AST_LIST_TRAVERSE(&ast_cli_filters, c, filter_list) {
-        	ast_cli(a->fd, "%s\t%d\t\n", c->name, c->type);
+	int count = 0;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "core show filters";
+		e->usage =
+			"Usage: core show filters\n"
+			"       List All CLI filters\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3) {
+		return CLI_SHOWUSAGE;
+	}
+
+	ast_cli(a->fd, "Active CLI Filters:\n---------------------------------------------------------------------\n");
+
+	AST_LIST_TRAVERSE(&ast_cli_filters, c, filter_list) {
+		ast_cli(a->fd, "%s\t%d\t\n", c->name, c->type);
 		count++;
-        }
-
-        ast_cli(a->fd, "%d active CLI filters.\n", count);
-
-        return CLI_SUCCESS;
+	}
+
+	ast_cli(a->fd, "%d active CLI filters.\n", count);
+
+	return CLI_SUCCESS;
 }
 
 static char *handle_add_filter(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_cli_filter *c = NULL;
 
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "core add filter";
-                e->usage =
-                        "Usage: core add filter\n"
-                        "       Add a new CLI filter\n";
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-        }
-
-        if (a->argc != 4) {
-                return CLI_SHOWUSAGE;
-        }
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "core add filter";
+		e->usage =
+			"Usage: core add filter\n"
+			"       Add a new CLI filter\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 4) {
+		return CLI_SHOWUSAGE;
+	}
 
 	//TODO use ast_filter_alloc(name,type) instead
 	c = ast_malloc(sizeof(*c));
@@ -3265,32 +3265,32 @@
 	c->type = 1;
 
 	/* TODO search it that filter already exists */
-	AST_RWLIST_INSERT_HEAD(&ast_cli_filters, c, filter_list);
-
-        ast_cli(a->fd, "%s sucessfully added to CLI filters.\n", c->name);
-
-        return CLI_SUCCESS;
+	AST_LIST_INSERT_HEAD(&ast_cli_filters, c, filter_list);
+
+	ast_cli(a->fd, "%s sucessfully added to CLI filters.\n", c->name);
+
+	return CLI_SUCCESS;
 }
 
 
 static char *handle_remove_filter(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-        struct ast_cli_filter *c;
-
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "core remove filter";
-                e->usage =
-                        "Usage: core show filters\n"
-                        "       List All CLI filters\n";
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-        }
-
-        if (a->argc != 4) {
-                return CLI_SHOWUSAGE;
-        }
+	struct ast_cli_filter *c;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "core remove filter";
+		e->usage =
+			"Usage: core show filters\n"
+			"       List All CLI filters\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 4) {
+		return CLI_SHOWUSAGE;
+	}
  	
 	/* TODO write ast_filter_get_by_name(name )*/
 	if (0) {
@@ -3299,20 +3299,20 @@
 	} else {
 		ast_cli(a->fd, "ive to remove %s from the list\n", a->argv[3]);
 			
-	                AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_cli_filters, c, filter_list) {
-                        	if (!strcmp(c->name, a->argv[3])) {
-                                	AST_LIST_REMOVE_CURRENT(filter_list);
+		AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_cli_filters, c, filter_list) {
+			if (!strcmp(c->name, a->argv[3])) {
+				AST_LIST_REMOVE_CURRENT(filter_list);
 					ast_cli(a->fd, "%s has been sucessfully removed from CLI filter list.\n", a->argv[3]);
 					ast_free(c->name); /* since I ast_strdup it */
 					ast_free(c);
-                                	break;
-                        	}
+					break;
+			}
 			AST_LIST_TRAVERSE_SAFE_END;
                 }	
 	}
 
 	//ast_cli(a->fd,"%s cant be removed.", a->argv[3]);
-        return CLI_SUCCESS;
+	return CLI_SUCCESS;
 }
 
 




More information about the asterisk-commits mailing list