1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2003 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
1
by brian
clean slate |
15 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
16 |
#include <config.h> |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
17 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
18 |
#include <drizzled/internal/my_sys.h> |
1
by brian
clean slate |
19 |
#include "my_static.h" |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
20 |
#include <drizzled/error.h> |
21 |
#include <drizzled/internal/m_string.h> |
|
22 |
#include <drizzled/charset.h> |
|
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
23 |
#include <cstdio> |
24 |
#include <cstdlib> |
|
1
by brian
clean slate |
25 |
|
2281.4.5
by Olaf van der Spek
Prune & refactor |
26 |
namespace drizzled { |
27 |
namespace internal { |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
28 |
|
2241.4.20
by Stewart Smith
don't export my_init_done - it's only checked by my_init() and my_end(). Also use true/false not 1/0 |
29 |
static bool my_init_done= 0; |
1
by brian
clean slate |
30 |
|
298
by Brian Aker
ulong conversion. |
31 |
static uint32_t atoi_octal(const char *str) |
1
by brian
clean slate |
32 |
{
|
33 |
long int tmp; |
|
2445.1.3
by Olaf van der Spek
Refactor |
34 |
while (*str && my_charset_utf8_general_ci.isspace(*str)) |
1
by brian
clean slate |
35 |
str++; |
999.1.1
by Toru Maesaka
Removed str2int() from the original string library by MySQL. Use strtol(3) instead. |
36 |
tmp= strtol(str, NULL, (*str == '0' ? 8 : 10)); |
298
by Brian Aker
ulong conversion. |
37 |
return (uint32_t) tmp; |
1
by brian
clean slate |
38 |
}
|
39 |
||
40 |
||
41 |
/*
|
|
42 |
Init my_sys functions and my_sys variabels
|
|
43 |
||
44 |
SYNOPSIS
|
|
45 |
my_init()
|
|
46 |
||
47 |
RETURN
|
|
48 |
0 ok
|
|
49 |
1 Couldn't initialize environment
|
|
50 |
*/
|
|
51 |
||
2281.4.5
by Olaf van der Spek
Prune & refactor |
52 |
void my_init() |
1
by brian
clean slate |
53 |
{
|
54 |
if (my_init_done) |
|
2281.4.5
by Olaf van der Spek
Prune & refactor |
55 |
return; |
2241.4.20
by Stewart Smith
don't export my_init_done - it's only checked by my_init() and my_end(). Also use true/false not 1/0 |
56 |
my_init_done= true; |
1
by brian
clean slate |
57 |
my_umask= 0660; /* Default umask for new files */ |
58 |
my_umask_dir= 0700; /* Default umask for new directories */ |
|
59 |
#if defined(HAVE_PTHREAD_INIT)
|
|
51.3.17
by Jay Pipes
Phase 4 - Remove DBUG from mysys |
60 |
pthread_init(); |
1
by brian
clean slate |
61 |
#endif
|
2385.3.8
by Olaf van der Spek
Refactor |
62 |
my_thread_init(); |
1
by brian
clean slate |
63 |
sigfillset(&my_signals); /* signals blocked by mf_brkhant */ |
64 |
if (!home_dir) |
|
65 |
{ /* Don't initialize twice */ |
|
66 |
if ((home_dir=getenv("HOME")) != 0) |
|
67 |
home_dir=intern_filename(home_dir_buff,home_dir); |
|
68 |
/* Default creation of new files */
|
|
2281.4.5
by Olaf van der Spek
Prune & refactor |
69 |
if (const char* str= getenv("UMASK")) |
1
by brian
clean slate |
70 |
my_umask=(int) (atoi_octal(str) | 0600); |
71 |
/* Default creation of new dir's */
|
|
2281.4.5
by Olaf van der Spek
Prune & refactor |
72 |
if (const char* str= getenv("UMASK_DIR")) |
1
by brian
clean slate |
73 |
my_umask_dir=(int) (atoi_octal(str) | 0700); |
74 |
}
|
|
75 |
} /* my_init */ |
|
76 |
||
77 |
||
78 |
/* End my_sys */
|
|
79 |
||
1235.3.14
by Stewart Smith
my_end() no longer requires an argument (we removed them all) |
80 |
void my_end() |
1
by brian
clean slate |
81 |
{
|
82 |
free_charsets(); |
|
2241.4.20
by Stewart Smith
don't export my_init_done - it's only checked by my_init() and my_end(). Also use true/false not 1/0 |
83 |
my_init_done= false; |
1
by brian
clean slate |
84 |
} /* my_end */ |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
85 |
|
86 |
} /* namespace internal */ |
|
87 |
} /* namespace drizzled */ |