~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_dirname.cc

Merge Nathan

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
 
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
#include "drizzled/internal/m_string.h"
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#include "mysys/mysys_priv.h"
 
17
#include <mystrings/m_string.h>
20
18
 
21
19
#include <algorithm>
22
20
 
23
21
using namespace std;
24
22
 
25
 
namespace drizzled
26
 
{
27
 
namespace internal
28
 
{
29
23
 
30
24
        /* Functions definied in this file */
31
25
 
40
34
  gpos= pos++;
41
35
  for ( ; *pos ; pos++)                         /* Find last FN_LIBCHAR */
42
36
  {
43
 
    if (*pos == FN_LIBCHAR || *pos == '/')
 
37
    if (*pos == FN_LIBCHAR || *pos == '/'
 
38
#ifdef FN_C_AFTER_DIR
 
39
        || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
 
40
#endif
 
41
        )
44
42
      gpos=pos;
45
43
  }
46
44
  return gpos-name+1;
108
106
  if (!from_end || (from_end - from) > FN_REFLEN-2)
109
107
    from_end=from+FN_REFLEN -2;
110
108
 
111
 
#if FN_LIBCHAR != '/'
 
109
#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2)
112
110
  {
113
111
    for (; from != from_end && *from ; from++)
114
112
    {
115
113
      if (*from == '/')
116
114
        *to++= FN_LIBCHAR;
 
115
#ifdef FN_C_BEFORE_DIR_2
 
116
      else if (*from == FN_C_BEFORE_DIR_2)
 
117
        *to++= FN_C_BEFORE_DIR;
 
118
      else if (*from == FN_C_AFTER_DIR_2)
 
119
        *to++= FN_C_AFTER_DIR;
 
120
#endif
117
121
      else
118
122
      {
119
123
        *to++= *from;
124
128
#else
125
129
  /* This is ok even if to == from, becasue we need to cut the string */
126
130
  size_t len= min(strlen(from),(size_t)(from_end-from));
127
 
  void *ret= memmove(to, from, len);
128
 
  assert(ret != NULL);
 
131
  assert(memmove(to, from, len));
129
132
  to+= len;
130
133
  to[0]= '\0';
131
134
#endif
138
141
  }
139
142
  return(to);                              /* Pointer to end of dir */
140
143
} /* convert_dirname */
141
 
 
142
 
} /* namespace internal */
143
 
} /* namespace drizzled */