10 #ifdef HAVE_LONG_FILE_NAMES 64 if ((
stat(sdir, &st) < 0) && (
MkDirs(sdir, 00700) < 0)) {
91 (
void)
strftime(dstr,
sizeof(dstr),
"%Y%m%d-%H%M%S", ltp);
97 (
serial % (16 * 16 * 16 * 16)),
109 #if defined(WIN32) || defined(_WINDOWS) 110 char ncftpbatch[260];
119 #elif defined(BINDIR) 120 char ncftpbatch[256];
125 STRNCAT(ncftpbatch,
"ncftpbatch");
162 const char *
const op,
163 const char *
const rfile,
164 const char *
const rdir,
165 const char *
const lfile,
166 const char *
const ldir,
167 const char *
const host,
168 const char *
const ip,
169 const unsigned int port,
170 const char *
const user,
171 const char *
const passclear,
176 const char *
const precmd,
177 const char *
const perfilecmd,
178 const char *
const postcmd,
184 char spathname2[256];
187 #if defined(WIN32) || defined(_WINDOWS) 198 #if defined(WIN32) || defined(_WINDOWS) 208 if (
fprintf(fp,
"# This is a NcFTP spool file entry.\n# Run the \"ncftpbatch\" program to process the spool directory.\n#\n") < 0)
220 if ((
strcmp(
user,
"anonymous") != 0) && (passclear !=
NULL) && (passclear[0] !=
'\0')) {
229 if (
fprintf(fp,
"xtype=%c\n", xtype) < 0)
231 if ((recursive != 0) && (
fprintf(fp,
"recursive=%s\n",
YESNO(recursive)) < 0))
233 if ((
delete != 0) && (
fprintf(fp,
"delete=%s\n",
YESNO(
delete)) < 0))
235 if (
fprintf(fp,
"passive=%d\n", passive) < 0)
237 if (
fprintf(fp,
"remote-dir=%s\n", rdir) < 0)
239 if ((ldir ==
NULL) || (ldir[0] ==
'\0') || (
strcmp(ldir,
".") == 0)) {
242 if (
fprintf(fp,
"local-dir=%s\n", ldir2) < 0)
245 if (
fprintf(fp,
"local-dir=%s\n", ldir) < 0)
248 if (
fprintf(fp,
"remote-file=%s\n", rfile) < 0)
250 if (
fprintf(fp,
"local-file=%s\n", lfile) < 0)
252 if ((precmd !=
NULL) && (precmd[0] !=
'\0') && (
fprintf(fp,
"pre-command=%s\n", precmd) < 0))
254 if ((perfilecmd !=
NULL) && (perfilecmd[0] !=
'\0') && (
fprintf(fp,
"per-file-command=%s\n", perfilecmd) < 0))
256 if ((postcmd !=
NULL) && (postcmd[0] !=
'\0') && (
fprintf(fp,
"post-command=%s\n", postcmd) < 0))
263 if (
rename(spathname, spathname2) < 0) {
264 perror(
"rename spoolfile failed");
273 perror(
"write to spool file failed");
281 #if defined(WIN32) || defined(_WINDOWS) 287 const char *
buf = buf0;
320 #if defined(WIN32) || defined(_WINDOWS) 326 char ncftpbatch[256];
330 STRNCAT(ncftpbatch,
"ncftpbatch");
336 }
else if (
pid == 0) {
337 argv[0] = (
char *)
"ncftpbatch";
338 argv[1] = (
char *)
"-l";
366 #if defined(WIN32) || defined(_WINDOWS) 367 char ncftpbatch[260];
372 (
void)
fprintf(
stderr,
"Cannot find path to %s. Please re-run Setup.\n",
"ncftpbatch.exe");
379 if (winExecResult <= 31)
switch (winExecResult) {
384 fprintf(
stderr,
"Could not run %s: %s\n",
prog,
"The specified file was not found.");
387 fprintf(
stderr,
"Could not run %s: %s\n",
prog,
"The specified path was not found.");
399 char ncftpbatch[256];
403 STRNCAT(ncftpbatch,
"ncftpbatch");
417 }
else if (
pid == 0) {
419 argv[0] = (
char *)
"ncftpbatch";
420 #ifdef DEBUG_NCFTPBATCH 421 argv[1] = (
char *)
"-SD";
423 argv[1] = (
char *)
"-d";
425 argv[2] = (
char *)
"-|";
453 }
else if (
pid == 0) {
454 argv[0] = (
char *)
"ncftpbatch";
455 argv[1] = (
char *)
"-d";
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
int MkSpoolDir(char *sdir, size_t size)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
void SpoolName(const char *const sdir, char *sp, size_t size, int flag, int serial, time_t when)
ACPI_SIZE strlen(const char *String)
char gOurInstallationPath[]
#define kPasswordMagicLen
char * OurDirectoryPath(char *const dst, const size_t siz, const char *const fname)
#define STRNCPY(dst, src, n)
void CloseControlConnection(const FTPCIPtr)
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
char * Strncat(char *const, const char *const, const size_t)
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
_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,...)
int __cdecl system(_In_opt_z_ const char *_Command)
#define ERROR_FILE_NOT_FOUND
struct FTPConnectionInfo FTPConnectionInfo
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
void ToBase64(void *dst0, const void *src0, size_t n, int terminate)
_CRTIMP int __cdecl getpid(void)
_Check_return_ _CRTIMP int __cdecl _access(_In_z_ const char *_Filename, _In_ int _AccessMode)
int MkDirs(const char *const, int mode1)
char defaultAnonPassword[80]
_CRTIMP intptr_t __cdecl execvp(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[])
void RunBatch(int Xstruct, const FTPCIPtr cip)
static PIXELFORMATDESCRIPTOR pfd
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 flag
void RunBatchIfNeeded(const FTPCIPtr cip)
#define memcpy(s1, s2, n)
_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)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
int SpoolX(const char *const op, const char *const rfile, const char *const rdir, const char *const lfile, const char *const ldir, const char *const host, const char *const ip, const unsigned int port, const char *const user, const char *const passclear, int xtype, int recursive, int delete, int passive, const char *const precmd, const char *const perfilecmd, const char *const postcmd, time_t when)
GLuint GLint GLboolean GLint GLenum access
char * Strncpy(char *const, const char *const, const size_t)
char * OurInstallationPath(char *const dst, const size_t siz, const char *const fname)
static int PWrite(int sfd, const char *const buf0, size_t size)
int strcmp(const char *String1, const char *String2)
_CRTIMP intptr_t __cdecl execv(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[])
_CRTIMP int __cdecl umask(_In_ int _Mode)
#define ERROR_PATH_NOT_FOUND
void user(int argc, const char *argv[])
struct FTPLibraryInfo FTPLibraryInfo
char * FTPGetLocalCWD(char *buf, size_t size)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *