~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_copy.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-08-08 04:22:33 UTC
  • mto: (1115.3.4 captain)
  • mto: This revision was merged to the branch mainline in revision 1117.
  • Revision ID: osullivan.padraig@gmail.com-20090808042233-q0z88zc490z3f3r7
Renamed the Command class to be Statement. Renamed the command directory to
statement and also the command header file to statement. Updated various
source files to reflect this renaming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
 
20
 
#include <fcntl.h>
21
 
 
22
 
#include "drizzled/internal/m_string.h"
 
16
#include "mysys/mysys_priv.h"
 
17
 
 
18
#include <mystrings/m_string.h>
23
19
#if defined(HAVE_UTIME_H)
24
20
#include <utime.h>
25
21
#elif defined(HAVE_SYS_UTIME_H)
32
28
};
33
29
#endif
34
30
 
35
 
#ifdef HAVE_SYS_STAT_H
36
 
# include <sys/stat.h>
37
 
#endif
38
 
 
39
31
#include <drizzled/util/test.h>
40
32
 
41
 
namespace drizzled
42
 
{
43
 
namespace internal
44
 
{
45
 
 
46
33
/*
47
34
  int my_copy(const char *from, const char *to, myf MyFlags)
48
35
 
67
54
  uint32_t Count;
68
55
  bool new_file_stat= 0; /* 1 if we could stat "to" */
69
56
  int create_flag;
70
 
  int from_file,to_file;
 
57
  File from_file,to_file;
71
58
  unsigned char buff[IO_SIZE];
72
59
  struct stat stat_buff,new_stat_buff;
73
60
 
80
67
  {
81
68
    if (stat(from, &stat_buff))
82
69
    {
83
 
      errno=errno;
 
70
      my_errno=errno;
84
71
      goto err;
85
72
    }
86
73
    if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat)
92
79
                             MyFlags)) < 0)
93
80
      goto err;
94
81
 
95
 
    while ((Count= static_cast<uint32_t>(my_read(from_file, buff,
96
 
            sizeof(buff), MyFlags))) != 0)
 
82
    while ((Count=my_read(from_file, buff, sizeof(buff), MyFlags)) != 0)
97
83
    {
98
84
        if (Count == (uint32_t) -1 ||
99
85
            my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP)))
130
116
  }
131
117
  return(-1);
132
118
} /* my_copy */
133
 
 
134
 
} /* namespace internal */
135
 
} /* namespace drizzled */