List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:March 8 2007 9:49pm
Subject:bk commit into 5.1 tree (guilhem:1.2470) BUG#26964
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of guilhem. When guilhem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-08 21:49:36+01:00, guilhem@stripped +1 -0
  Implementing the feature at BUG#26964 "option --no-beep for mysqladmin".
  Option --no-beep is added to mysqladmin like it already exists in
  the "mysql" command-line client (short option: -b; long: --no-beep).
  Default is to emit beeps like that "mysql" client.
  Can't test in the testsuite; but on my Linux I tested by hand:
  open a *xterm* and there do "mysqladmin shutdown" - I hear a beep;
  with --no-beep, no beep.

  client/mysqladmin.cc@stripped, 2007-03-08 21:49:34+01:00, guilhem@stripped +37 -32
    new option --no-beep like in mysql.cc: if used, no beeps (ASCII 7, BEL)
    are emitted upon errors. Default is to emit beeps, like mysql.cc.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	guilhem
# Host:	gbichot4.local
# Root:	/home/mysql_src/mysql-5.1-maint

--- 1.118/client/mysqladmin.cc	2006-12-31 01:06:32 +01:00
+++ 1.119/client/mysqladmin.cc	2007-03-08 21:49:34 +01:00
@@ -40,7 +40,7 @@
 static int interval=0;
 static my_bool option_force=0,interrupted=0,new_line=0,
                opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
-               tty_password= 0, info_flag= 0;
+               tty_password= 0, info_flag= 0, opt_nobeep;
 static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
             opt_count_iterations= 0;
 static ulong opt_connect_timeout, opt_shutdown_timeout;
@@ -54,6 +54,7 @@
 static char *shared_memory_base_name=0;
 #endif
 static uint opt_protocol=0;
+static myf bell_flag; /* whether a bell should be rung on error or not */
 
 /*
   When using extended-status relatively, ex_val_max_len is the estimated
@@ -154,6 +155,8 @@
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
+   (gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from
the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -352,6 +355,8 @@
 #endif
   if (default_charset)
     mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
+  bell_flag= (myf)(opt_nobeep ? 0 : ME_BELL);
+
   if (sql_connect(&mysql, option_wait))
   {
     unsigned int err= mysql_errno(&mysql);
@@ -450,7 +455,7 @@
 	if (!host)
 	  host= (char*) LOCAL_HOST;
 	my_printf_error(0,"connect to server at '%s' failed\nerror: '%s'",
-			MYF(ME_BELL), host, mysql_error(mysql));
+			bell_flag, host, mysql_error(mysql));
 	if (mysql_errno(mysql) == CR_CONNECTION_ERROR)
 	{
 	  fprintf(stderr,
@@ -525,14 +530,14 @@
       char buff[FN_REFLEN+20];
       if (argc < 2)
       {
-	my_printf_error(0,"Too few arguments to create",MYF(ME_BELL));
+	my_printf_error(0, "Too few arguments to create", bell_flag);
 	return 1;
       }
       sprintf(buff,"create database `%.*s`",FN_REFLEN,argv[1]);
       if (mysql_query(mysql,buff))
       {
 	my_printf_error(0,"CREATE DATABASE failed; error: '%-.200s'",
-			MYF(ME_BELL), mysql_error(mysql));
+			bell_flag, mysql_error(mysql));
 	return -1;
       }
       argc--; argv++;
@@ -542,7 +547,7 @@
     {
       if (argc < 2)
       {
-	my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL));
+	my_printf_error(0, "Too few arguments to drop", bell_flag);
 	return 1;
       }
       if (drop_db(mysql,argv[1]))
@@ -567,7 +572,7 @@
 
       if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT))
       {
-	my_printf_error(0,"shutdown failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "shutdown failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -588,7 +593,7 @@
     case ADMIN_RELOAD:
       if (mysql_query(mysql,"flush privileges"))
       {
-	my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "reload failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -599,7 +604,7 @@
 				 REFRESH_READ_LOCK | REFRESH_SLAVE |
 				 REFRESH_MASTER)))
       {
-	my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "refresh failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -607,7 +612,7 @@
     case ADMIN_FLUSH_THREADS:
       if (mysql_refresh(mysql,(uint) REFRESH_THREADS))
       {
-	my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "refresh failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -651,7 +656,7 @@
 			      "show processlist")) ||
 	  !(result = mysql_store_result(mysql)))
       {
-	my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "process list failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -674,7 +679,7 @@
 	char *pos;
 	if (argc < 2)
 	{
-	  my_printf_error(0,"Too few arguments to 'kill'",MYF(ME_BELL));
+	  my_printf_error(0, "Too few arguments to 'kill'", bell_flag);
 	  return 1;
 	}
 	pos=argv[1];
@@ -682,7 +687,7 @@
 	{
 	  if (mysql_kill(mysql,(ulong) atol(pos)))
 	  {
-	    my_printf_error(0,"kill failed on %ld; error: '%s'",MYF(ME_BELL),
+	    my_printf_error(0, "kill failed on %ld; error: '%s'", bell_flag,
 			    atol(pos), mysql_error(mysql));
 	    error=1;
 	  }
@@ -698,7 +703,7 @@
     case ADMIN_DEBUG:
       if (mysql_dump_debug_info(mysql))
       {
-	my_printf_error(0,"debug failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "debug failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -712,7 +717,7 @@
       if (mysql_query(mysql,"show /*!40003 GLOBAL */ variables") ||
 	  !(res=mysql_store_result(mysql)))
       {
-	my_printf_error(0,"unable to show variables; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "unable to show variables; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -734,7 +739,7 @@
       if (mysql_query(mysql, "show /*!50002 GLOBAL */ status") ||
 	  !(res = mysql_store_result(mysql)))
       {
-	my_printf_error(0, "unable to show status; error: '%s'", MYF(ME_BELL),
+	my_printf_error(0, "unable to show status; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -784,7 +789,7 @@
     {
       if (mysql_refresh(mysql,REFRESH_LOG))
       {
-	my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "refresh failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -794,7 +799,7 @@
     {
       if (mysql_query(mysql,"flush hosts"))
       {
-	my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "refresh failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -804,7 +809,7 @@
     {
       if (mysql_query(mysql,"flush tables"))
       {
-	my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "refresh failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -814,7 +819,7 @@
     {
       if (mysql_query(mysql,"flush status"))
       {
-	my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+	my_printf_error(0, "refresh failed; error: '%s'", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -831,7 +836,7 @@
 
       if (argc < 2)
       {
-	my_printf_error(0,"Too few arguments to change password",MYF(ME_BELL));
+	my_printf_error(0, "Too few arguments to change password", bell_flag);
 	return 1;
       }
       if (argv[1][0])
@@ -854,7 +859,7 @@
           if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'"))
           {
             my_printf_error(0, "Could not determine old_passwords setting from server;
error: '%s'",
-                	    MYF(ME_BELL),mysql_error(mysql));
+                	    bell_flag, mysql_error(mysql));
             return -1;
           }
           else
@@ -865,7 +870,7 @@
               my_printf_error(0,
                               "Could not get old_passwords setting from "
                               "server; error: '%s'",
-        		      MYF(ME_BELL),mysql_error(mysql));
+        		      bell_flag, mysql_error(mysql));
               return -1;
             }
             if (!mysql_num_rows(res))
@@ -890,7 +895,7 @@
       if (mysql_query(mysql,"set sql_log_off=1"))
       {
 	my_printf_error(0, "Can't turn off logging; error: '%s'",
-			MYF(ME_BELL),mysql_error(mysql));
+			bell_flag, mysql_error(mysql));
 	return -1;
       }
       if (mysql_query(mysql,buff))
@@ -898,7 +903,7 @@
 	if (mysql_errno(mysql)!=1290)
 	{
 	  my_printf_error(0,"unable to change password; error: '%s'",
-			  MYF(ME_BELL),mysql_error(mysql));
+			  bell_flag, mysql_error(mysql));
 	  return -1;
 	}
 	else
@@ -912,7 +917,7 @@
 			  " with grant tables disabled (was started with"
 			  " --skip-grant-tables).\n"
 			  "Use: \"mysqladmin flush-privileges password '*'\""
-			  " instead", MYF(ME_BELL));
+			  " instead", bell_flag);
 	  return -1;
 	}
       }
@@ -923,7 +928,7 @@
     case ADMIN_START_SLAVE:
       if (mysql_query(mysql, "START SLAVE"))
       {
-	my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL),
+	my_printf_error(0, "Error starting slave: %s", bell_flag,
 			mysql_error(mysql));
 	return -1;
       }
@@ -933,7 +938,7 @@
     case ADMIN_STOP_SLAVE:
       if (mysql_query(mysql, "STOP SLAVE"))
       {
-	  my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL),
+	  my_printf_error(0, "Error stopping slave: %s", bell_flag,
 			  mysql_error(mysql));
 	  return -1;
       }
@@ -959,7 +964,7 @@
 	else
 	{
 	  my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'",
-			  MYF(ME_BELL),mysql_error(mysql));
+			  bell_flag, mysql_error(mysql));
 	  return -1;
 	}
       }
@@ -970,7 +975,7 @@
     {
       if (argc < 2)
       {
-	my_printf_error(0,"Too few arguments to ndb-mgm",MYF(ME_BELL));
+	my_printf_error(0, "Too few arguments to ndb-mgm", bell_flag);
 	return 1;
       }
       {
@@ -984,7 +989,7 @@
     break;
 #endif
     default:
-      my_printf_error(0,"Unknown command: '%-.60s'",MYF(ME_BELL),argv[0]);
+      my_printf_error(0, "Unknown command: '%-.60s'", bell_flag, argv[0]);
       return 1;
     }
   }
@@ -1062,7 +1067,7 @@
   sprintf(name_buff,"drop database `%.*s`",FN_REFLEN,db);
   if (mysql_query(mysql,name_buff))
   {
-    my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL),
+    my_printf_error(0, "DROP DATABASE %s failed;\nerror: '%s'", bell_flag,
 		    db,mysql_error(mysql));
     return 1;
   }
@@ -1287,7 +1292,7 @@
 
   if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'"))
   {
-    my_printf_error(0,"query failed; error: '%s'",MYF(ME_BELL),
+    my_printf_error(0, "query failed; error: '%s'", bell_flag,
 		    mysql_error(mysql));
   }
   result = mysql_store_result(mysql);
Thread
bk commit into 5.1 tree (guilhem:1.2470) BUG#26964Guilhem Bichot8 Mar