~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_format.c

  • Committer: Stewart Smith
  • Date: 2008-09-15 07:13:59 UTC
  • mfrom: (383.1.21 drizzle)
  • mto: This revision was merged to the branch mainline in revision 408.
  • Revision ID: stewart@flamingspork.com-20080915071359-f8bznznyaiqrtqxa
merged

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
char * fn_format(char * to, const char *name, const char *dir,
27
27
                    const char *extension, uint flag)
28
28
{
29
 
  char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos;
 
29
  char dev[FN_REFLEN], buff[FN_REFLEN], *pos;
 
30
  const char *startpos = name;
30
31
  const char *ext;
31
32
  register size_t length;
32
33
  size_t dev_length;
33
34
 
34
35
  /* Copy and skip directory */
35
 
  name+=(length=dirname_part(dev, (startpos=(char *) name), &dev_length));
 
36
  name+=(length=dirname_part(dev, startpos, &dev_length));
36
37
  if (length == 0 || (flag & MY_REPLACE_DIR))
37
38
  {
38
39
    /* Use given directory */
84
85
  {
85
86
    if (to == startpos)
86
87
    {
87
 
      memcpy(buff, (uchar*) name, length); /* Save name for last copy */
 
88
      memcpy(buff, name, length); /* Save name for last copy */
88
89
      name=buff;
89
90
    }
90
 
    pos=strmake(strmov(to,dev),name,length);
91
 
    (void) strmov(pos,ext);                     /* Don't convert extension */
 
91
    pos=strmake(stpcpy(to,dev),name,length);
 
92
    (void) stpcpy(pos,ext);                     /* Don't convert extension */
92
93
  }
93
94
  /*
94
95
    If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do
99
100
                                   MY_RESOLVE_LINK: 0));
100
101
  else if (flag & MY_RESOLVE_SYMLINKS)
101
102
  {
102
 
    strmov(buff,to);
 
103
    stpcpy(buff,to);
103
104
    (void) my_readlink(to, buff, MYF(0));
104
105
  }
105
106
  return(to);