ReactOS  0.4.14-dev-376-gaedba84
rcopy.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Include dependency graph for rcopy.c:

Go to the source code of this file.

Macros

#define UNIX_PATHS
 
#define TRANSFER_SIZE   (65536)
 

Functions

charconvert_path (char *origpath)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ TRANSFER_SIZE

#define TRANSFER_SIZE   (65536)

Definition at line 39 of file rcopy.c.

◆ UNIX_PATHS

#define UNIX_PATHS

Definition at line 8 of file rcopy.c.

Function Documentation

◆ convert_path()

char* convert_path ( char origpath)

Definition at line 11 of file rcopy.c.

12 {
13  char* newpath;
14  int i;
15 
16  newpath = strdup(origpath);
17 
18  i = 0;
19  while (newpath[i] != 0)
20  {
21 #ifdef UNIX_PATHS
22  if (newpath[i] == '\\')
23  {
24  newpath[i] = '/';
25  }
26 #else
27 #ifdef DOS_PATHS
28  if (newpath[i] == '/')
29  {
30  newpath[i] = '\\';
31  }
32 #endif
33 #endif
34  i++;
35  }
36  return(newpath);
37 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)

Referenced by main(), and translate_file().

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 41 of file rcopy.c.

42 {
43  char* path1;
44  char* path2;
45  FILE* in;
46  FILE* out;
47  char* buf;
48  int n_in;
49  int n_out;
50 
51  if (argc != 3)
52  {
53  fprintf(stderr, "Too many arguments\n");
54  exit(1);
55  }
56 
57  path1 = convert_path(argv[1]);
58  path2 = convert_path(argv[2]);
59 
60  in = fopen(path1, "rb");
61  if (in == NULL)
62  {
63  perror("Cannot open input file");
64  exit(1);
65  }
66 
67 
68 
69  out = fopen(path2, "wb");
70  if (out == NULL)
71  {
72  perror("Cannot open output file");
73  fclose(in);
74  exit(1);
75  }
76 
78 
79  while (!feof(in))
80  {
81  n_in = fread(buf, 1, TRANSFER_SIZE, in);
82  n_out = fwrite(buf, 1, n_in, out);
83  if (n_in != n_out)
84  {
85  perror("Failed to write to output file\n");
86  free(buf);
87  fclose(in);
88  fclose(out);
89  exit(1);
90  }
91  }
92  exit(0);
93 }
static const WCHAR path2[]
Definition: path.c:29
static int argc
Definition: ServiceArgs.c:12
#define TRANSFER_SIZE
Definition: rcopy.c:39
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define free
Definition: debug_ros.c:5
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
#define argv
Definition: mplay32.c:18
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR path1[]
Definition: path.c:28
_Check_return_ _CRTIMP int __cdecl feof(_In_ FILE *_File)
static FILE * out
Definition: regtests2xml.c:44
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
GLuint in
Definition: glext.h:9616
char * convert_path(char *origpath)
Definition: rcopy.c:11
FILE * stderr
#define malloc
Definition: debug_ros.c:4
void exit(int exitcode)
Definition: _exit.c:33