~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2000 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>
1 by brian
clean slate
17
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
18
#include <drizzled/internal/my_sys.h>
19
#include <drizzled/internal/m_string.h>
1 by brian
clean slate
20
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
21
namespace drizzled
22
{
23
namespace internal
24
{
25
1 by brian
clean slate
26
/*
27
  Return a pointer to the extension of the filename.
28
29
  SYNOPSIS
30
    fn_ext()
31
    name		Name of file
32
33
  DESCRIPTION
34
    The extension is defined as everything after the first extension character
35
    (normally '.') after the directory name.
36
37
  RETURN VALUES
38
    Pointer to to the extension character. If there isn't any extension,
39
    points at the end ASCII(0) of the filename.
40
*/
41
42
char *fn_ext(const char *name)
43
{
2194.3.1 by Olaf van der Spek
Remove register keyword
44
  const char *pos, *gpos;
1 by brian
clean slate
45
1122.2.5 by Monty Taylor
Killed some dead code.
46
#if defined(FN_DEVCHAR)
1 by brian
clean slate
47
  {
48
    char buff[FN_REFLEN];
49
    size_t res_length;
50
    gpos= name+ dirname_part(buff,(char*) name, &res_length);
51
  }
52
#else
53
  if (!(gpos= strrchr(name, FN_LIBCHAR)))
54
    gpos= name;
55
#endif
56
  pos=strchr(gpos,FN_EXTCHAR);
376 by Brian Aker
strend remove
57
  return((char*) (pos ? pos : strchr(gpos, '\0')));
1 by brian
clean slate
58
} /* fn_ext */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
59
60
} /* namespace internal */
61
} /* namespace drizzled */