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];
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";
char * Strncat(char *const, const char *const, const size_t)
char * Strncpy(char *const, const char *const, const size_t)
#define STRNCPY(dst, src, n)
void user(int argc, const char *argv[])
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
void CDECL perror(const char *str)
int CDECL fclose(FILE *file)
int WINAPIV fprintf(FILE *file, const char *format,...)
int CDECL rename(const char *oldpath, const char *newpath)
FILE *CDECL fopen(const char *path, const char *mode)
int CDECL _access(const char *filename, int mode)
_ACRTIMP int __cdecl system(const char *)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP size_t __cdecl strftime(char *, size_t, const char *, const struct tm *)
static struct tm * localtime(const time_t *t)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLint GLboolean GLint GLenum access
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
#define memcpy(s1, s2, n)
void ToBase64(void *dst0, const void *src0, size_t n, int terminate)
char * OurInstallationPath(char *const dst, const size_t siz, const char *const fname)
char * OurDirectoryPath(char *const dst, const size_t siz, const char *const fname)
#define kPasswordMagicLen
#define ERROR_FILE_NOT_FOUND
char * FTPGetLocalCWD(char *buf, size_t size)
int MkDirs(const char *const, int mode1)
static int PWrite(int sfd, const char *const buf0, size_t size)
char gOurInstallationPath[]
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)
void SpoolName(const char *const sdir, char *sp, size_t size, int flag, int serial, time_t when)
void CloseControlConnection(const FTPCIPtr)
void RunBatchIfNeeded(const FTPCIPtr cip)
int MkSpoolDir(char *sdir, size_t size)
void RunBatch(int Xstruct, const FTPCIPtr cip)
static PIXELFORMATDESCRIPTOR pfd
char defaultAnonPassword[80]
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define ERROR_PATH_NOT_FOUND