[asterisk-commits] oej: branch group/pine-cdr-pgsql-status-trunk r287301 - /team/group/pine-cdr-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 17 05:50:09 CDT 2010


Author: oej
Date: Fri Sep 17 05:50:05 2010
New Revision: 287301

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287301
Log:
Updating to trunk

Modified:
    team/group/pine-cdr-pgsql-status-trunk/cdr/cdr_pgsql.c

Modified: team/group/pine-cdr-pgsql-status-trunk/cdr/cdr_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pine-cdr-pgsql-status-trunk/cdr/cdr_pgsql.c?view=diff&rev=287301&r1=287300&r2=287301
==============================================================================
--- team/group/pine-cdr-pgsql-status-trunk/cdr/cdr_pgsql.c (original)
+++ team/group/pine-cdr-pgsql-status-trunk/cdr/cdr_pgsql.c Fri Sep 17 05:50:05 2010
@@ -60,6 +60,7 @@
 static int totalrecords = 0;
 static int records = 0;
 
+static char *handle_cdr_pgsql_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static struct ast_cli_entry cdr_pgsql_status_cli[] = {
         AST_CLI_DEFINE(handle_cdr_pgsql_status, "Show connection status of the PostgreSQL CDR driver (cdr_pgsql)"),
 };
@@ -140,26 +141,25 @@
 			snprintf(status2, 99, " using table %s", table);
 		}
 		if (ctime > 31536000) {
-			ast_cli(fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 31536000, (ctime % 31536000) / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
+			ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 31536000, (ctime % 31536000) / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
 		} else if (ctime > 86400) {
-			ast_cli(fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
+			ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
 		} else if (ctime > 3600) {
-			ast_cli(fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 3600, (ctime % 3600) / 60, ctime % 60);
+			ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 3600, (ctime % 3600) / 60, ctime % 60);
 		} else if (ctime > 60) {
-			ast_cli(fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60, ctime % 60);
-		} else {
-			ast_cli(fd, "%s%s for %d seconds.\n", status, status2, ctime);
+			ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60, ctime % 60);
+		} else {
+			ast_cli(a->fd, "%s%s for %d seconds.\n", status, status2, ctime);
 		}
 		if (records == totalrecords) {
-			ast_cli(fd, "  Wrote %d records since last restart.\n", totalrecords);
-		} else {
-			ast_cli(fd, "  Wrote %d records since last restart and %d records since last reconnect.\n", totalrecords, records);
-		}
-		return RESULT_SUCCESS;
+			ast_cli(a->fd, "  Wrote %d records since last restart.\n", totalrecords);
+		} else {
+			ast_cli(a->fd, "  Wrote %d records since last restart and %d records since last reconnect.\n", totalrecords, records);
+		}
 	} else {
-		ast_cli(fd, "Not currently connected to a PgSQL server.\n");
-		return RESULT_FAILURE;
-	}
+		ast_cli(a->fd, "Not currently connected to a PgSQL server.\n");
+	}
+	return CLI_SUCCESS;
 }
 
 static int pgsql_log(struct ast_cdr *cdr)
@@ -409,7 +409,7 @@
 	struct columns *current;
 
 	ast_cdr_unregister(name);
-	ast_cli_unregister(&cdr_pgsql_status_cli);
+	ast_cli_unregister_multiple(cdr_pgsql_status_cli, sizeof(cdr_pgsql_status_cli) / sizeof(struct ast_cli_entry));
 
 	PQfinish(conn);
 
@@ -658,7 +658,7 @@
 
 static int load_module(void)
 {
-	ast_cli_register(&cdr_pgsql_status_cli);
+	ast_cli_register_multiple(cdr_pgsql_status_cli, sizeof(cdr_pgsql_status_cli) / sizeof(struct ast_cli_entry));
 	return config_module(0) ? AST_MODULE_LOAD_DECLINE : 0;
 }
 




More information about the asterisk-commits mailing list