[asterisk-commits] rmudgett: branch 1.8 r350075 - /branches/1.8/main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 9 11:02:29 CST 2012


Author: rmudgett
Date: Mon Jan  9 11:02:25 2012
New Revision: 350075

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=350075
Log:
Make Asterisk -x command line parameter imply -r parameter presence.

The Asterisk -x command line parameter is documented inconsistently.

* Made the -x documentation and behavior consistent.

* Since this is also a new year, updated the copyright notices while here.

(closes issue ASTERISK-19094)
Reported by: Eugene
Patches:
      issueA19094_correct_asterisk_option_x.patch (license #5674) patch uploaded by Walter Doekes (modified)
Tested by: Eugene

Modified:
    branches/1.8/main/asterisk.c

Modified: branches/1.8/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/asterisk.c?view=diff&rev=350075&r1=350074&r2=350075
==============================================================================
--- branches/1.8/main/asterisk.c (original)
+++ branches/1.8/main/asterisk.c Mon Jan  9 11:02:25 2012
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2010, Digium, Inc.
+ * Copyright (C) 1999 - 2012, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -39,7 +39,7 @@
  *
  * \section copyright Copyright and Author
  *
- * Copyright (C) 1999 - 2009, Digium, Inc.
+ * Copyright (C) 1999 - 2012, Digium, Inc.
  * Asterisk is a <a href="http://www.digium.com/en/company/view-policy.php?id=Trademark-Policy">registered trademark</a>
  * of <a href="http://www.digium.com">Digium, Inc</a>.
  *
@@ -156,7 +156,7 @@
 
 /*! \brief Welcome message when starting a CLI interface */
 #define WELCOME_MESSAGE \
-    ast_verbose("Asterisk %s, Copyright (C) 1999 - 2011 Digium, Inc. and others.\n" \
+    ast_verbose("Asterisk %s, Copyright (C) 1999 - 2012 Digium, Inc. and others.\n" \
                 "Created by Mark Spencer <markster at digium.com>\n" \
                 "Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n" \
                 "This is free software, with components licensed under the GNU General Public\n" \
@@ -979,7 +979,6 @@
 /*! \brief NULL handler so we can collect the child exit status */
 static void _null_sig_handler(int sig)
 {
-
 }
 
 static struct sigaction null_sig_handler = {
@@ -1104,7 +1103,8 @@
 /*!
  * \brief mute or unmute a console from logging
  */
-void ast_console_toggle_mute(int fd, int silent) {
+void ast_console_toggle_mute(int fd, int silent)
+{
 	int x;
 	for (x = 0;x < AST_MAX_CONNECTS; x++) {
 		if (fd == consoles[x].fd) {
@@ -2810,8 +2810,9 @@
 	return 0;
 }
 
-static int show_cli_help(void) {
-	printf("Asterisk %s, Copyright (C) 1999 - 2010, Digium, Inc. and others.\n", ast_get_version());
+static int show_cli_help(void)
+{
+	printf("Asterisk %s, Copyright (C) 1999 - 2012, Digium, Inc. and others.\n", ast_get_version());
 	printf("Usage: asterisk [OPTIONS]\n");
 	printf("Valid Options:\n");
 	printf("   -V              Display version number and exit\n");
@@ -2842,7 +2843,7 @@
 	printf("   -T              Display the time in [Mmm dd hh:mm:ss] format for each line\n");
 	printf("                   of output to the CLI\n");
 	printf("   -v              Increase verbosity (multiple v's = more verbose)\n");
-	printf("   -x <cmd>        Execute command <cmd> (only valid with -r)\n");
+	printf("   -x <cmd>        Execute command <cmd> (implies -r)\n");
 	printf("   -X              Execute includes by default (allows #exec in asterisk.conf)\n");
 	printf("   -W              Adjust terminal colors to compensate for a light background\n");
 	printf("\n");
@@ -3124,7 +3125,14 @@
 		stat(canary_filename, &canary_stat);
 		now = ast_tvnow();
 		if (now.tv_sec > canary_stat.st_mtime + 60) {
-			ast_log(LOG_WARNING, "The canary is no more.  He has ceased to be!  He's expired and gone to meet his maker!  He's a stiff!  Bereft of life, he rests in peace.  His metabolic processes are now history!  He's off the twig!  He's kicked the bucket.  He's shuffled off his mortal coil, run down the curtain, and joined the bleeding choir invisible!!  THIS is an EX-CANARY.  (Reducing priority)\n");
+			ast_log(LOG_WARNING,
+				"The canary is no more.  He has ceased to be!  "
+				"He's expired and gone to meet his maker!  "
+				"He's a stiff!  Bereft of life, he rests in peace.  "
+				"His metabolic processes are now history!  He's off the twig!  "
+				"He's kicked the bucket.  He's shuffled off his mortal coil, "
+				"run down the curtain, and joined the bleeding choir invisible!!  "
+				"THIS is an EX-CANARY.  (Reducing priority)\n");
 			ast_set_priority(0);
 			pthread_exit(NULL);
 		}
@@ -3336,6 +3344,9 @@
 			ast_clear_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
 			break;
 		case 'x':
+			/* -r is implied by -x so set the flags -r sets as well. */
+			ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
+
 			ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR);
 			xarg = ast_strdupa(optarg);
 			break;




More information about the asterisk-commits mailing list