~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_redel.c

  • Committer: Monty Taylor
  • Date: 2008-07-05 18:10:38 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: monty@inaugust.com-20080705181038-0ih0nnamu5qrut0y
Fixed prototypes. Cleaned define a little bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "mysys_priv.h"
17
17
#include <my_dir.h>
18
 
#include <mystrings/m_string.h>
 
18
#include <m_string.h>
19
19
#include "mysys_err.h"
20
20
#if defined(HAVE_UTIME_H)
21
21
#include <utime.h>
42
42
int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
43
43
{
44
44
  int error=1;
 
45
  DBUG_ENTER("my_redel");
 
46
  DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s'  MyFlags: %d",
 
47
                   org_name,tmp_name,MyFlags));
45
48
 
46
49
  if (my_copystat(org_name,tmp_name,MyFlags) < 0)
47
50
    goto end;
51
54
    char ext[20];
52
55
    ext[0]='-';
53
56
    get_date(ext+1,2+4,(time_t) 0);
54
 
    my_stpcpy(strchr(ext, '\0'),REDEL_EXT);
 
57
    strmov(strend(ext),REDEL_EXT);
55
58
    if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2),
56
59
                  MyFlags))
57
60
      goto end;
63
66
 
64
67
  error=0;
65
68
end:
66
 
  return(error);
 
69
  DBUG_RETURN(error);
67
70
} /* my_redel */
68
71
 
69
72
 
83
86
  }
84
87
  if ((statbuf.st_mode & S_IFMT) != S_IFREG)
85
88
    return 1;
86
 
  chmod(to, statbuf.st_mode & 07777);           /* Copy modes */
 
89
  VOID(chmod(to, statbuf.st_mode & 07777));             /* Copy modes */
87
90
 
88
91
  if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
89
92
  {
90
93
    if (MyFlags & MY_LINK_WARNING)
91
94
      my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
92
95
  }
93
 
  chown(to, statbuf.st_uid, statbuf.st_gid);    /* Copy ownership */
 
96
  VOID(chown(to, statbuf.st_uid, statbuf.st_gid));      /* Copy ownership */
94
97
 
95
98
#ifndef __ZTC__
96
99
  if (MyFlags & MY_COPYTIME)
98
101
    struct utimbuf timep;
99
102
    timep.actime  = statbuf.st_atime;
100
103
    timep.modtime = statbuf.st_mtime;
101
 
    utime((char*) to, &timep);/* Update last accessed and modified times */
 
104
    VOID(utime((char*) to, &timep));/* Update last accessed and modified times */
102
105
  }
103
106
#else
104
107
  if (MyFlags & MY_COPYTIME)
106
109
    time_t time[2];
107
110
    time[0]= statbuf.st_atime;
108
111
    time[1]= statbuf.st_mtime;
109
 
    utime((char*) to, time);/* Update last accessed and modified times */
 
112
    VOID(utime((char*) to, time));/* Update last accessed and modified times */
110
113
  }
111
114
#endif
112
115
  return 0;