~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_format.cc

  • Committer: Monty Taylor
  • Date: 2009-04-17 21:06:07 UTC
  • mto: (997.2.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 997.
  • Revision ID: mordred@inaugust.com-20090417210607-hjglwsuki9i5ut5x
Fixed a stupid hardcoding in po.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#include "mysys/mysys_priv.h"
17
17
#include <mystrings/m_string.h>
18
18
 
19
 
#include <algorithm>
20
 
 
21
 
using namespace std;
22
 
 
23
19
/*
24
20
  Formats a filename with possible replace of directory of extension
25
21
  Function can handle the case where 'to' == 'name'
80
76
    size_t tmp_length;
81
77
    if (flag & MY_SAFE_PATH)
82
78
      return NULL;
83
 
    tmp_length= min(strlength(startpos), (size_t)(FN_REFLEN-1));
 
79
    tmp_length= cmin(strlength(startpos), FN_REFLEN-1);
84
80
    strncpy(to,startpos,tmp_length);
85
81
    to[tmp_length]= '\0';
86
82
  }
100
96
    realpath if the file is a symbolic link
101
97
  */
102
98
  if (flag & MY_RETURN_REAL_PATH)
103
 
  {
104
 
    struct stat stat_buff;
105
 
    char rp_buff[PATH_MAX];
106
 
    if ((!flag & MY_RESOLVE_SYMLINKS) || 
107
 
       (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
108
 
    {
109
 
      if (!realpath(to,rp_buff))
110
 
        my_load_path(rp_buff, to, NULL);
111
 
      rp_buff[FN_REFLEN-1]= '\0';
112
 
      strcpy(to,rp_buff);
113
 
    }
114
 
  }
 
99
    (void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
 
100
                                   MY_RESOLVE_LINK: 0));
115
101
  else if (flag & MY_RESOLVE_SYMLINKS)
116
102
  {
117
103
    strcpy(buff,to);
118
 
    ssize_t sym_link_size= readlink(buff,to,FN_REFLEN-1);
119
 
    if (sym_link_size >= 0)
120
 
      to[sym_link_size]= '\0';
 
104
    (void) my_readlink(to, buff, MYF(0));
121
105
  }
122
106
  return(to);
123
107
} /* fn_format */