summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
Diffstat (limited to 'extra')
-rw-r--r--extra/Makefile.am4
-rw-r--r--extra/my_print_defaults.c13
-rw-r--r--extra/mysql_install.c258
-rw-r--r--extra/perror.c4
-rw-r--r--extra/replace.c2
-rw-r--r--extra/resolve_stack_dump.c13
-rw-r--r--extra/resolveip.c4
7 files changed, 21 insertions, 277 deletions
diff --git a/extra/Makefile.am b/extra/Makefile.am
index 8e4491969b5..0276355ef65 100644
--- a/extra/Makefile.am
+++ b/extra/Makefile.am
@@ -14,11 +14,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include -I..
+INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
- resolve_stack_dump mysql_install mysql_waitpid
+ resolve_stack_dump mysql_waitpid
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index c0f8a54f432..a5ce489c0fd 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -29,21 +29,21 @@ const char *config_file="my"; /* Default config file */
static struct my_option my_long_options[] =
{
- {"config-file", 'c', "The config file to be used",
+ {"config-file", 'c', "The config file to be used.",
(gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
- {"defaults-file", 'c', "Synonym for --config-file",
+ {"defaults-file", 'c', "Synonym for --config-file.",
(gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
- {"defaults-extra-file", 'e',
+ {"defaults-extra-file", 'e',
"Read this file after the global /etc config file and before the config file in the users home directory.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"extra-file", 'e',
- "Synonym for --defaults-extra-file",
+ {"extra-file", 'e',
+ "Synonym for --defaults-extra-file.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"no-defaults", 'n', "Return an empty string (useful for scripts)",
+ {"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -52,7 +52,6 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-
static void usage(my_bool version)
{
printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
diff --git a/extra/mysql_install.c b/extra/mysql_install.c
deleted file mode 100644
index e2783f906b9..00000000000
--- a/extra/mysql_install.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
-
-/* Install or upgrade MySQL server. By Sasha Pachev <sasha@mysql.com>
- */
-
-#define INSTALL_VERSION "1.2"
-
-#define DONT_USE_RAID
-#include <my_global.h>
-#include <m_ctype.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include <mysql_version.h>
-#include <errno.h>
-#include <my_getopt.h>
-
-#define ANSWERS_CHUNCK 32
-
-int have_gui=0;
-
-static struct my_option my_long_options[] =
-{
- {"help", '?', "Display this help and exit.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"version", 'V', "Output version information and exit.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
-};
-
-/* For now, not much exciting here, but we'll add more once
- we add GUI support
- */
-typedef struct
-{
- FILE* out;
- FILE* in;
- const char* question;
- int default_ind;
- DYNAMIC_ARRAY answers;
-} QUESTION_WIDGET;
-
-static void usage();
-static void die(const char* fmt, ...);
-static void print_version(void);
-static char get_answer_char(int ans_ind);
-static int ask_user(const char* question,int default_ind, ...);
-static void add_answer(QUESTION_WIDGET* w, const char* ans);
-static void display_question(QUESTION_WIDGET* w);
-static int init_question_widget(QUESTION_WIDGET* w, const char* question,
- int default_ind);
-static void end_question_widget(QUESTION_WIDGET* w);
-static int get_answer(QUESTION_WIDGET* w);
-static char answer_from_char(char c);
-static void invalid_answer(QUESTION_WIDGET* w);
-
-enum {IMODE_STANDARD=0,IMODE_CUSTOM,IMODE_UPGRAGE} install_mode
- = IMODE_STANDARD;
-
-static char get_answer_char(int ans_ind)
-{
- return 'a' + ans_ind;
-}
-
-static void invalid_answer(QUESTION_WIDGET* w)
-{
- if (!have_gui)
- {
- fprintf(w->out, "ERROR: invalid answer, try again...\a\n");
- }
-}
-
-static char answer_from_char(char c)
-{
- return c - 'a';
-}
-
-static void die(const char* fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stderr, "%s: ", my_progname);
- vfprintf(stderr, fmt, args);
- fprintf(stderr, "\n");
- va_end(args);
- exit(1);
-}
-
-static void display_question(QUESTION_WIDGET* w)
-{
- if (!have_gui)
- {
- uint i,num_answers=w->answers.elements;
- DYNAMIC_ARRAY* answers = &w->answers;
- fprintf(w->out,"\n%s\n\n",w->question);
-
- for (i=0; i<num_answers; i++)
- {
- char* ans;
- get_dynamic(answers,(gptr)&ans,i);
- fprintf(w->out,"%c - %s\n",get_answer_char(i),ans);
- }
- fprintf(w->out,"q - Abort Install/Upgrade\n\n");
- }
-}
-
-static void add_answer(QUESTION_WIDGET* w, const char* ans)
-{
- insert_dynamic(&w->answers,(gptr)&ans);
-}
-
-static int init_question_widget(QUESTION_WIDGET* w, const char* question,
- int default_ind)
-{
- if (have_gui)
- {
- w->in = w->out = 0;
- }
- else
- {
- w->out = stdout;
- w->in = stdin;
- }
- w->question = question;
- w->default_ind = default_ind;
- if (my_init_dynamic_array(&w->answers,sizeof(char*),
- ANSWERS_CHUNCK,ANSWERS_CHUNCK))
- die("Out of memory");
- return 0;
-}
-
-static void end_question_widget(QUESTION_WIDGET* w)
-{
- delete_dynamic(&w->answers);
-}
-
-static int get_answer(QUESTION_WIDGET* w)
-{
- if (!have_gui)
- {
- char buf[32];
- int ind;
- char c;
- if (!fgets(buf,sizeof(buf),w->in))
- die("Failed fgets on input stream");
- switch ((c=tolower(*buf)))
- {
- case '\n':
- return w->default_ind;
- case 'q':
- die("Install/Upgrade aborted");
- default:
- ind = answer_from_char(c);
- if (ind >= 0 && ind < (int)w->answers.elements)
- return ind;
- }
- }
- return -1;
-}
-
-static int ask_user(const char* question,int default_ind, ...)
-{
- va_list args;
- char* opt;
- QUESTION_WIDGET w;
- int ans;
-
- va_start(args,default_ind);
- init_question_widget(&w,question,default_ind);
- for (;(opt=va_arg(args,char*));)
- {
- add_answer(&w,opt);
- }
- for (;;)
- {
- display_question(&w);
- if ((ans = get_answer(&w)) >= 0)
- break;
- invalid_answer(&w);
- }
- end_question_widget(&w);
- va_end(args);
- return ans;
-}
-
-
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- char *argument __attribute__((unused)))
-{
- switch(optid) {
- case 'V':
- print_version();
- exit(0);
- case '?':
- usage();
- exit(0);
- }
- return 0;
-}
-
-
-static int parse_args(int argc, char **argv)
-{
- int ho_error;
-
- if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- exit(ho_error);
-
- return 0;
-}
-
-static void print_version(void)
-{
- printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,INSTALL_VERSION,
- MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
-}
-
-static void usage()
-{
- print_version();
- printf("MySQL AB, by Sasha Pachev\n");
- printf("This software comes with ABSOLUTELY NO WARRANTY\n\n");
- printf("Install or upgrade MySQL server.\n\n");
- printf("Usage: %s [OPTIONS] \n", my_progname);
- my_print_help(my_long_options);
- my_print_variables(my_long_options);
-}
-
-int main(int argc, char** argv)
-{
- MY_INIT(argv[0]);
- parse_args(argc,argv);
- install_mode = ask_user("Please select install/upgrade mode",
- install_mode, "Standard Install",
- "Custom Install", "Upgrade",0);
- printf("mode=%d\n", install_mode);
- return 0;
-}
-
-
-
-
-
diff --git a/extra/perror.c b/extra/perror.c
index ca6bbfb54f9..d05fa2492de 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -30,14 +30,14 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"info", 'I', "Synonym for --help", 0, 0, 0, GET_NO_ARG,
+ {"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
(gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
- {"silent", 's', "Only print the error message", 0, 0, 0, GET_NO_ARG, NO_ARG,
+ {"silent", 's', "Only print the error message.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Print error code and message (default).", (gptr*) &verbose,
(gptr*) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
diff --git a/extra/replace.c b/extra/replace.c
index 41312f5e3d4..8e007e3a971 100644
--- a/extra/replace.c
+++ b/extra/replace.c
@@ -113,7 +113,7 @@ char *argv[];
exit(1);
for (i=1,pos=word_end_chars ; i < 256 ; i++)
- if (isspace(i))
+ if (my_isspace(&my_charset_latin1,i))
*pos++=i;
*pos=0;
if (!(replace=init_replace((char**) from.typelib.type_names,
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index c54f17a186e..06a670b935d 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -175,9 +175,9 @@ trace dump and specify the path to it with -s or --symbols-file");
static uchar hex_val(char c)
{
uchar l;
- if (isdigit(c))
+ if (my_isdigit(&my_charset_latin1,c))
return c - '0';
- l = tolower(c);
+ l = my_tolower(&my_charset_latin1,c);
if (l < 'a' || l > 'f')
return HEX_INVALID;
return (uchar)10 + ((uchar)c - (uchar)'a');
@@ -203,9 +203,11 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf)
if (!se->addr)
return -1;
- while (isspace(*buf++)) ;
+ while (my_isspace(&my_charset_latin1,*buf++))
+ /* empty */;
- while (isspace(*buf++)) ; /* skip more space */
+ while (my_isspace(&my_charset_latin1,*buf++))
+ /* empty - skip more space */;
--buf;
/* now we are on the symbol */
for (p = se->symbol, p_end = se->symbol + sizeof(se->symbol) - 1;
@@ -285,7 +287,8 @@ static void do_resolve()
while (fgets(buf, sizeof(buf), fp_dump))
{
p = buf;
- while(isspace(*p))
+ /* skip space */
+ while (my_isspace(&my_charset_latin1,*p))
++p;
if (*p++ == '0' && *p++ == 'x')
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 52d71d40a64..cef79180720 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -43,7 +43,7 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"info", 'I', "Synonym for --help",
+ {"info", 'I', "Synonym for --help.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
{
ip = *argv++;
- if (isdigit(ip[0]))
+ if (my_isdigit(&my_charset_latin1,ip[0]))
{
taddr = inet_addr(ip);
if (taddr == htonl(INADDR_BROADCAST))