List:Commits« Previous MessageNext Message »
From:pkarthick Date:January 25 2006 2:44pm
Subject:bk commit into 5.1 tree (pkarthick:1.2088)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of prem. When prem 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
  1.2088 06/01/25 20:14:11 pkarthick@stripped +1 -0
  NetWare specific change, to make multiple mysqld_safe instances work when called in quick successions through a NCF file.

  netware/mysqld_safe.c
    1.11 06/01/25 20:14:04 pkarthick@stripped +315 -343
    NetWare specific change, to make multiple mysqld_safe instances work when called in quick successions through a NCF file.

# 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:	pkarthick
# Host:	blr-naas-nwl04.blr.novell.com
# Root:	/home/prem/bk/mysql-5.1

--- 1.10/netware/mysqld_safe.c	2006-01-12 23:37:03 +05:30
+++ 1.11/netware/mysqld_safe.c	2006-01-25 20:14:04 +05:30
@@ -1,20 +1,39 @@
 /*
-  Copyright (c) 2003 Novell, Inc. All Rights Reserved.
+  Copyright (c) 2003 Novell, Inc. All Rights Reserved.  */
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-  GNU General Public License for more details.
+  This program is free software; you can redistribute it and/or modify 
+  it under the terms of the GNU General Public License as published by 
+  the Free Software Foundation; either version 2 of the License, or 
+  (at your option) any later version. 
+
+  This program is distributed in the hope that it will be useful, 
+  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+  GNU General Public License for more details. 
 
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
+  You should have received a copy of the GNU General Public License 
+  along with this program; if not, write to the Free Software 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+*/ 
+
+/*
+  Copyright © 2004 Unpublished Work of Novell, Inc. All Rights Reserved.
+ 
+  THIS WORK IS AN UNPUBLISHED WORK OF NOVELL, INC. NO PART OF THIS WORK 
+  MAY BE USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, REVISED, MODIFIED, 
+  TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, 
+  RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 
+  NOVELL, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION 
+  COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
+ 
+  AS BETWEEN MYSQL AND NOVELL, MYSQL HAS THE RIGHT, AND NOVELL HAS PROVIDED 
+  PRIOR WRITTEN CONSENT, TO REPUBLISH THIS WORK UNDER THE GPL GNU GENERAL PUBLIC 
+  LICENSE) WITH ALL RIGHTS AND LICENSES THEREUNDER. IF YOU HAVE RECEIVED THIS 
+  WORK DIRECTLY OR INDIRECTLY FROM MYSQL AS PART OF SUCH A REPUBLICATION, YOU 
+  HAVE ALL RIGHTS AND LICENSES GRANTED BY MYSQL UNDER THE GPL. IN CONNECTION WITH 
+  SUCH A REPUBLICATION, IF ANYTHING IN THIS NOTICE CONFLICTS WITH THE TERMS OF 
+  THE GPL, SUCH TERMS PREVAIL.
+*/ 
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -29,11 +48,11 @@
 #include "my_config.h"
 #include "my_manage.h"
 
-/******************************************************************************
+/*
 
-	global variables
+  global variables
 
-******************************************************************************/
+*/
 char autoclose;
 char basedir[PATH_MAX];
 char checktables;
@@ -49,11 +68,11 @@
 
 FILE *log_fd= NULL;
 
-/******************************************************************************
+/*
 
-	prototypes
+  prototypes
 
-******************************************************************************/
+*/
 
 void usage(void);
 void vlog(char *, va_list);
@@ -69,24 +88,23 @@
 void mysql_start(int, char *[]);
 void parse_setvar(char *arg);
 
-/******************************************************************************
+/*
 
-	functions
+  functions
 
-******************************************************************************/
+*/
 
-/******************************************************************************
+/*
 
   usage()
-
+  
   Show usage.
 
-******************************************************************************/
+*/
 void usage(void)
 {
-  // keep the screen up
-  setscreenmode(SCR_NO_MODE);
-
+  setscreenmode(SCR_NO_MODE);                   /* keep the screen up */
+  
   puts("\
 \n\
 usage: mysqld_safe [options]\n\
@@ -107,22 +125,23 @@
 --mysqld=<file>             Use the <file> MySQL daemon.\n\
 \n\
   ");
-
+  
   exit(-1);
 }
 
-/******************************************************************************
 
-  vlog()
+/*
 
+  vlog()
+  
   Log the message.
 
-******************************************************************************/
+*/
 void vlog(char *format, va_list ap)
 {
   vfprintf(stdout, format, ap);
   fflush(stdout);
-
+  
   if (log_fd)
   {
     vfprintf(log_fd, format, ap);
@@ -130,69 +149,58 @@
   }
 }
 
-/******************************************************************************
 
-  log()
+/*
 
+  log()
+  
   Log the message.
 
-******************************************************************************/
+*/
 void log(char *format, ...)
 {
   va_list ap;
-
+  
   va_start(ap, format);
 
   vlog(format, ap);
-
+  
   va_end(ap);
 }
 
-/******************************************************************************
 
-	start_defaults()
+/*
+
+  start_defaults()
 
-	Start setting the defaults.
+  Start setting the defaults.
 
-******************************************************************************/
+*/
 void start_defaults(int argc, char *argv[])
 {
   struct stat buf;
-  int i;
-
-  // default options
-  static char *default_options[]=
+  int         i;
+  
+  static char *default_options[]=               /* default options */
   {
     "--no-defaults",
     "--defaults-file=",
     "--defaults-extra-file=",
     NULL
   };
-
-  // autoclose
-  autoclose= FALSE;
-
-  // basedir
-  get_basedir(argv[0], basedir);
-
-  // check-tables
-  checktables= FALSE;
-
-  // hostname
-  if (gethostname(hostname, PATH_MAX) < 0)
-  {
-    // default
-    strcpy(hostname, "mysql");
-  }
-
-  // address
-  snprintf(address, PATH_MAX, "0.0.0.0");
-
-  // port
-  snprintf(port, PATH_MAX, "3306");
-
-  // default option
-  default_option[0]= NULL;
+  
+  autoclose= FALSE;                             /* autoclose */
+  get_basedir(argv[0], basedir);                /* basedir */
+  checktables= FALSE;                           /* check-tables */
+
+  if (gethostname(hostname, PATH_MAX) < 0)      /* hostname */
+  {
+    strcpy(hostname, "mysql");                  /* default */
+  }
+  snprintf(address, PATH_MAX, "0.0.0.0");       /* address */
+  snprintf(port, PATH_MAX, "3306");             /* port */
+  
+  default_option[0]= NULL;                      /* default option */
   for (i= 0; (argc > 1) && default_options[i]; i++)
   {
     if (!strnicmp(argv[1], default_options[i], strlen(default_options[i])))
@@ -201,8 +209,8 @@
       break;
     }
   }
-
-  // set after basedir is established
+  
+  /* set after basedir is established */
   datadir[0]= NULL;
   pid_file[0]= NULL;
   err_log[0]= NULL;
@@ -210,115 +218,101 @@
   mysqld[0]= NULL;
 }
 
-/******************************************************************************
 
-	finish_defaults()
+/*
 
-	Finish settig the defaults.
+  finish_defaults()
 
-******************************************************************************/
+  Finish settig the defaults.
+
+*/
 void finish_defaults()
 {
   struct stat buf;
-  int i;
-
-  // datadir
-  if (!datadir[0])
+  int         i;
+  
+  if (!datadir[0])                              /* datadir */
     snprintf(datadir, PATH_MAX, "%s/data", basedir);
-
-  // pid-file
-  if (!pid_file[0])
+  
+  if (!pid_file[0])                             /* pid-file */
     snprintf(pid_file, PATH_MAX, "%s/%s.pid", datadir, hostname);
-
-  // err-log
-  if (!err_log[0])
+  
+  if (!err_log[0])                              /* err-log */
     snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname);
 
-  // safe-log
-  if (!safe_log[0])
+  if (!safe_log[0])                             /* safe-log */
     snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname);
 
-  // mysqld
-  if (!mysqld[0])
+  if (!mysqld[0])                               /* mysqld */
     snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir);
-
+  
   if (stat(mysqld, &buf))
   {
     snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir);
   }
 }
 
-/******************************************************************************
 
-	read_defaults()
+/*
+
+  read_defaults()
 
-	Read the defaults.
+  Read the defaults.
 
-******************************************************************************/
+*/
 void read_defaults(arg_list_t *pal)
 {
-  arg_list_t al;
-  char defaults_file[PATH_MAX];
   char mydefaults[PATH_MAX];
+  char mydefaults_command[3*PATH_MAX];
   char line[PATH_MAX];
   FILE *fp;
-
-  // defaults output file
-  snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir);
-  remove(defaults_file);
-
-  // mysqladmin file
+  
+  /* my_print_defaults file */
   snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
 
-  // args
-  init_args(&al);
-  add_arg(&al, mydefaults);
-  if (default_option[0])
-    add_arg(&al, default_option);
-  add_arg(&al, "mysqld");
-  add_arg(&al, "server");
-  add_arg(&al, "mysqld_safe");
-  add_arg(&al, "safe_mysqld");
-
-  spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
-
-  free_args(&al);
-
-  // gather defaults
-  if ((fp= fopen(defaults_file, "r")) != NULL)
+  /* args to my_print_defaults */
+  if (default_option[0]) 
+  {
+    snprintf(mydefaults_command, 3*PATH_MAX, "%s %s mysqld server" 
+             " mysqld_safe safe_mysqld", mydefaults, default_option);
+  }
+  else
+  {
+    snprintf(mydefaults_command, 3*PATH_MAX, "%s mysqld server mysqld_safe"
+            " safe_mysqld", mydefaults);
+  }
+  /* gather defaults */
+  if((fp= popen(mydefaults_command, "r")) != NULL)
   {
     while (fgets(line, PATH_MAX, fp))
     {
       char *p;
-
-      // remove end-of-line character
-      if ((p= strrchr(line, '\n')) != NULL)
-	*p= '\0';
-
-      // add the option as an argument
+      
+      /* remove end-of-line character */
+      if ((p= strrchr(line, '\n')) != NULL) 
+        *p= '\0';
+      
+      /* add the option as an argument */
       add_arg(pal, line);
     }
-
-    fclose(fp);
+    pclose(fp);
   }
-
-  // remove file
-  remove(defaults_file);
 }
 
-/******************************************************************************
 
-	parse_args()
+/*
+
+  parse_args()
 
-	Get the options.
+  Get the options.
 
-******************************************************************************/
+*/
 void parse_args(int argc, char *argv[])
 {
   int index= 0;
   int c;
-
-  // parse options
+  
+  /* parse options */
   enum opts
   {
     OPT_BASEDIR= 0xFF,
@@ -332,30 +326,30 @@
     OPT_HELP,
     OPT_SETVAR
   };
-
-  static struct option options[]=
+  
+  static struct option options[]= 
   {
-    {"autoclose", no_argument, &autoclose, TRUE},
-    {"basedir", required_argument, 0, OPT_BASEDIR},
-    {"check-tables", no_argument, &checktables, TRUE},
-    {"datadir", required_argument, 0, OPT_DATADIR},
-    {"pid-file", required_argument, 0, OPT_PID_FILE},
-    {"bind-address", required_argument, 0, OPT_BIND_ADDRESS},
-    {"port", required_argument, 0, OPT_PORT},
-    {"err-log", required_argument, 0, OPT_ERR_LOG},
-    {"safe-log", required_argument, 0, OPT_SAFE_LOG},
-    {"mysqld", required_argument, 0, OPT_MYSQLD},
-    {"help", no_argument, 0, OPT_HELP},
-    {"set-variable", required_argument, 0, OPT_SETVAR},
-    {0, 0, 0, 0}
+    {"autoclose",     no_argument,        &autoclose,   TRUE},
+    {"basedir",       required_argument,  0,            OPT_BASEDIR},
+    {"check-tables",  no_argument,        &checktables, TRUE},
+    {"datadir",       required_argument,  0,            OPT_DATADIR},
+    {"pid-file",      required_argument,  0,            OPT_PID_FILE},
+    {"bind-address",  required_argument,  0,            OPT_BIND_ADDRESS},
+    {"port",          required_argument,  0,            OPT_PORT},
+    {"err-log",       required_argument,  0,            OPT_ERR_LOG},
+    {"safe-log",      required_argument,  0,            OPT_SAFE_LOG},
+    {"mysqld",        required_argument,  0,            OPT_MYSQLD},
+    {"help",          no_argument,        0,            OPT_HELP},
+    {"set-variable",  required_argument,  0,            OPT_SETVAR},
+    {0,               0,                  0,            0}
   };
-
-  // we have to reset getopt_long because we use it multiple times
+  
+  /* we have to reset getopt_long because we use it multiple times */
   optind= 1;
-
-  // turn off error reporting
+  
+  /* turn off error reporting */
   opterr= 0;
-
+  
   while ((c= getopt_long(argc, argv, "b:h:P:", options, &index)) >= 0)
   {
     switch (c) {
@@ -363,33 +357,33 @@
     case 'b':
       strcpy(basedir, optarg);
       break;
-
+      
     case OPT_DATADIR:
     case 'h':
       strcpy(datadir, optarg);
       break;
-
+      
     case OPT_PID_FILE:
       strcpy(pid_file, optarg);
       break;
-
+      
     case OPT_BIND_ADDRESS:
       strcpy(address, optarg);
       break;
-
+      
     case OPT_PORT:
     case 'P':
       strcpy(port, optarg);
       break;
-
+      
     case OPT_ERR_LOG:
       strcpy(err_log, optarg);
       break;
-
+      
     case OPT_SAFE_LOG:
       strcpy(safe_log, optarg);
       break;
-
+      
     case OPT_MYSQLD:
       strcpy(mysqld, optarg);
       break;
@@ -397,18 +391,18 @@
     case OPT_SETVAR:
       parse_setvar(optarg);
       break;
-
+ 
     case OPT_HELP:
       usage();
       break;
-
+      
     default:
-      // ignore
-      break;
+      break;                                    /* ignore */
     }
   }
 }
 
+
 /*
   parse_setvar(char *arg)
   Pasrsing for port just to display the port num on the mysqld_safe screen
@@ -416,110 +410,103 @@
 void parse_setvar(char *arg)
 {
   char *pos;
-
+  
   if ((pos= strindex(arg, "port")))
   {
-    for (; *pos && *pos != '='; pos++);
+    for (; *pos && *pos != '='; pos++) ;
     if (*pos)
       strcpy(port, pos + 1);
   }
 }
 
-/******************************************************************************
 
+/*
 
+  get_options()
 
-/******************************************************************************
-
-	get_options()
-
-	Get the options.
+  Get the options.
 
-******************************************************************************/
+*/
 void get_options(int argc, char *argv[])
 {
   arg_list_t al;
+  
+  start_defaults(argc, argv);                   /* start defaults */
 
-  // start defaults
-  start_defaults(argc, argv);
-
-  // default file arguments
+  /* default file arguments */
   init_args(&al);
   add_arg(&al, "ignore");
   read_defaults(&al);
   parse_args(al.argc, al.argv);
   free_args(&al);
-
-  // command-line arguments
+  
+  /* command-line arguments */
   parse_args(argc, argv);
-
-  // finish defaults
+  
+  /* finish defaults */
   finish_defaults();
 }
 
-/******************************************************************************
 
-	check_data_vol()
+/*
+
+  check_data_vol()
 
-	Check the database volume.
+  Check the database volume.
 
-******************************************************************************/
+*/
 void check_data_vol()
 {
-  // warn if the data is on a Traditional volume
+  /* warn if the data is on a Traditional volume */
   struct volume_info vol;
-  char buff[PATH_MAX];
-  char *p;
-
-  // clear struct
-  memset(&vol, 0, sizeof(vol));
-
-  // find volume name
-  strcpy(buff, datadir);
+  char               buff[PATH_MAX];
+  char              *p;
+  
+  
+  memset(&vol, 0, sizeof(vol));                 /* clear struct */
+  strcpy(buff, datadir);                        /* find volume name */
   if (p= strchr(buff, ':'))
   {
-    // terminate after volume name
-    *p= 0;
+    *p= 0;                                      /* terminate after volume name */
   }
   else
   {
-    // assume SYS volume
-    strcpy(buff, "SYS");
+    strcpy(buff, "SYS");                        /* assume SYS volume */
   }
-
-  // retrieve information
-  netware_vol_info_from_name(&vol, buff);
+  
+  netware_vol_info_from_name(&vol, buff);       /* retrieve information */
 
   if ((vol.flags & VOL_NSS_PRESENT) == 0)
   {
-    log("Error: Either the data directory does not exist or is not on an NSS volume!\n\n");
+    log("Error: Either the data directory does not exist or is not on an NSS"
+       " volume!\n\n");
     exit(-1);
   }
 }
 
-/******************************************************************************
 
-	check_setup()
+/*
+
+  check_setup()
 
-	Check the current setup.
+  Check the current setup.
 
-******************************************************************************/
+*/
 void check_setup()
 {
   struct stat info;
-  char temp[PATH_MAX];
+  char        temp[PATH_MAX];
 
-  // remove any current pid_file
+  /* remove any current pid_file */
   if (!stat(pid_file, &info) && (remove(pid_file) < 0))
   {
     log("ERROR: Unable to remove current pid file!\n\n");
     exit(-1);
   }
 
-  // check the data volume
-  check_data_vol();
-
-  // check for a database
+  check_data_vol();                             /* check the data volume */
+  
+  /* check for a database */
   snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir);
   if (stat(temp, &info))
   {
@@ -528,120 +515,113 @@
   }
 }
 
-/******************************************************************************
 
-	check_tables()
+/*
+
+  check_tables()
 
-	Check the database tables.
+  Check the database tables.
 
-******************************************************************************/
+*/
 void check_tables()
 {
   arg_list_t al;
-  char mycheck[PATH_MAX];
-  char table[PATH_MAX];
-  char db[PATH_MAX];
-  DIR *datadir_entry, *db_entry, *table_entry;
-
-  // status
-  log("checking tables...\n");
+  char       mycheck[PATH_MAX];
+  char       table[PATH_MAX];
+  char       db[PATH_MAX];
+  DIR       *datadir_entry, *db_entry, *table_entry;
+  
+  log("checking tables...\n");                  /* status */
 
-  // list databases
+  /* list databases */
   if ((datadir_entry= opendir(datadir)) == NULL)
   {
     return;
   }
 
-  while ((db_entry= readdir(datadir_entry)) != NULL)
+  while((db_entry= readdir(datadir_entry)) != NULL)
   {
     if (db_entry->d_name[0] == '.')
-    {
-      // Skip
-    }
+    {}
     else if (S_ISDIR(db_entry->d_type))
     {
-      // create long db name
+      /* create long db name */
       snprintf(db, PATH_MAX, "%s/%s", datadir, db_entry->d_name);
-
-      // list tables
-      if ((db_entry= opendir(db)) == NULL)
+      if ((db_entry= opendir(db)) == NULL)      /* list tables */
       {
-	continue;
+        continue;
       }
-
-      while ((table_entry= readdir(db_entry)) != NULL)
+      
+      while((table_entry= readdir(db_entry)) != NULL)
       {
-	// create long table name
-	snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name));
+        /* create long table name */
+        snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name));
+        
+        if (strindex(table, ".myi"))            /* myisamchk */
+        {
+          /* mysqladmin file */
+          snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir);
+
+          /* args */
+          init_args(&al);
+          add_arg(&al, mycheck);
+          add_arg(&al, "--silent");
+          add_arg(&al, "--force");
+          add_arg(&al, "--fast");
+          add_arg(&al, "--medium-check");
+          add_arg(&al, "-O");
+          add_arg(&al, "key_buffer=64M");
+          add_arg(&al, "-O");
+          add_arg(&al, "sort_buffer=64M");
+          add_arg(&al, table);
+
+          spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
+
+          free_args(&al);
+        }
+        else if (strindex(table, ".ism"))       /* isamchk */
+        {
+          /* mysqladmin file */
+          snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir);
+
+          /* args */
+          init_args(&al);
+          add_arg(&al, mycheck);
+          add_arg(&al, "--silent");
+          add_arg(&al, "--force");
+          add_arg(&al, "-O");
+          add_arg(&al, "sort_buffer=64M");
+          add_arg(&al, table);
 
-	if (strindex(table, ".myi"))
-	{
-	  // ** myisamchk
-
-	  // mysqladmin file
-	  snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir);
-
-	  // args
-	  init_args(&al);
-	  add_arg(&al, mycheck);
-	  add_arg(&al, "--silent");
-	  add_arg(&al, "--force");
-	  add_arg(&al, "--fast");
-	  add_arg(&al, "--medium-check");
-	  add_arg(&al, "-O");
-	  add_arg(&al, "key_buffer=64M");
-	  add_arg(&al, "-O");
-	  add_arg(&al, "sort_buffer=64M");
-	  add_arg(&al, table);
-
-	  spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
-
-	  free_args(&al);
-	}
-	else if (strindex(table, ".ism"))
-	{
-	  // ** isamchk
-
-	  // mysqladmin file
-	  snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir);
-
-	  // args
-	  init_args(&al);
-	  add_arg(&al, mycheck);
-	  add_arg(&al, "--silent");
-	  add_arg(&al, "--force");
-	  add_arg(&al, "-O");
-	  add_arg(&al, "sort_buffer=64M");
-	  add_arg(&al, table);
+          spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
 
-	  spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
-
-	  free_args(&al);
-	}
+          free_args(&al);
+        }
       }
     }
   }
 }
 
-/******************************************************************************
 
-	mysql_start()
+/*
+
+  mysql_start()
 
-	Start the mysql server.
+  Start the mysql server.
 
-******************************************************************************/
+*/
 void mysql_start(int argc, char *argv[])
 {
-  arg_list_t al;
-  int i, j, err;
+  arg_list_t  al;
+  int         i, j, err;
   struct stat info;
-  time_t cal;
-  struct tm lt;
-  char stamp[PATH_MAX];
-  char skip;
-
-  // private options
-  static char *private_options[]=
+  time_t      cal;
+  struct      tm lt;
+  char        stamp[PATH_MAX];
+  char        skip;
+  
+  /* private options */
+  static char *private_options[]= 
   {
     "--autoclose",
     "--check-tables",
@@ -650,82 +630,76 @@
     "--mysqld=",
     NULL
   };
-
-  // args
+  
+  /* args */
   init_args(&al);
   add_arg(&al, "%s", mysqld);
-
-  // parent args
-  for (i= 1; i < argc; i++)
+  
+  for(i= 1; i < argc; i++)                      /* parent args */
   {
     skip= FALSE;
-
-    // skip private arguments
+    
+    /* skip private arguments */
     for (j= 0; private_options[j]; j++)
     {
-      if (!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
+      if(!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
       {
-	skip= TRUE;
-	break;
+        skip= TRUE;
+        break;
       }
     }
-
+    
     if (!skip)
     {
       add_arg(&al, "%s", argv[i]);
     }
   }
-  // spawn
+  /* spawn */
   do
   {
-    // check the database tables
-    if (checktables)
+    if (checktables)                            /* check the database tables */
       check_tables();
-
-    // status
+    
+    /* status */
     time(&cal);
     localtime_r(&cal, &lt);
     strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt);
     log("mysql started    : %s\n", stamp);
-
-    // spawn mysqld
+    
+    /* spawn mysqld */
     spawn(mysqld, &al, TRUE, NULL, NULL, err_log);
   }
   while (!stat(pid_file, &info));
-
-  // status
+  
+  /* status */
   time(&cal);
   localtime_r(&cal, &lt);
   strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt);
   log("mysql stopped    : %s\n\n", stamp);
 
-  // free args
-  free_args(&al);
+  free_args(&al);                               /* free args */
 }
 
-/******************************************************************************
 
-	main()
+/*
+
+  main()
 
-******************************************************************************/
+*/
 int main(int argc, char **argv)
 {
   char temp[PATH_MAX];
-
-  // get the options
-  get_options(argc, argv);
-
-  // keep the screen up
-  if (!autoclose)
+  
+  get_options(argc, argv);                      /* get the options */
+  if (!autoclose)                               /* keep the screen up */
     setscreenmode(SCR_NO_MODE);
-
-  // create log file
-  log_fd= fopen(safe_log, "w+");
-
-  // header
+  
+  log_fd= fopen(safe_log, "w+");                /* create log file */
+  
+  /* header */
   log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-
-  // status
+  
+  /* status */
   log("address          : %s\n", address);
   log("port             : %s\n", port);
   log("daemon           : %s\n", mysqld);
@@ -735,16 +709,14 @@
   log("error file       : %s\n", err_log);
   log("log file         : %s\n", safe_log);
   log("\n");
+  
+  
+  check_setup();                                /* check setup */
+  mysql_start(argc, argv);                      /* start the MySQL server */
 
-  // check setup
-  check_setup();
-
-  // start the MySQL server
-  mysql_start(argc, argv);
-
-  // close log file
+  /* close log file */
   if (log_fd)
     fclose(log_fd);
-
+  
   return 0;
 }
Thread
bk commit into 5.1 tree (pkarthick:1.2088)pkarthick25 Jan