Drizzled Public API Documentation

mf_same.cc

00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 /* Kopierar biblioteksstrukturen och extensionen fr}n ett filnamn */
00017 
00018 #include <config.h>
00019 
00020 #include <drizzled/internal/my_sys.h>
00021 #include <drizzled/internal/m_string.h>
00022 
00023 namespace drizzled
00024 {
00025 namespace internal
00026 {
00027 
00028         /*
00029     Copy directory and/or extension between filenames.
00030     (For the meaning of 'flag', check mf_format.c)
00031     'to' may be equal to 'name'.
00032     Returns 'to'.
00033   */
00034 
00035 char * fn_same(char *to, const char *name, int flag)
00036 {
00037   char dev[FN_REFLEN];
00038   const char *ext;
00039   size_t dev_length;
00040 
00041   if ((ext=strrchr(name+dirname_part(dev, name, &dev_length),FN_EXTCHAR)) == 0)
00042     ext="";
00043 
00044   return(fn_format(to,to,dev,ext,flag));
00045 } /* fn_same */
00046 
00047 } /* namespace internal */
00048 } /* namespace drizzled */