ReactOS  0.4.15-dev-1018-g0695ecb
cmds.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int PromptForBookmarkName (BookmarkPtr)
 
void CurrentURL (char *, size_t, int)
 
void FillBookmarkInfo (BookmarkPtr)
 
void SaveCurrentAsBookmark (void)
 
void SaveUnsavedBookmark (void)
 
void BookmarkCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void CatCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void PrintResp (LineListPtr)
 
int nFTPChdirAndGetCWD (const FTPCIPtr, const char *, const int)
 
int Chdirs (FTPCIPtr cip, const char *const cdCwd)
 
void BGStartCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void ChdirCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void ChmodCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void CloseCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void DebugCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void DeleteCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void EchoCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void InitTransferType (void)
 
void GetCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void HelpCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void HostsCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void JobsCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void ListCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalChdirCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalListCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalChmodCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalMkdirCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalPageCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalRenameCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalRmCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalRmdirCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LocalPwdCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void LookupCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void MkdirCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void MlsCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
int DoOpen (void)
 
void OpenCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void PageCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void PutCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void PwdCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void QuitCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void QuoteCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void RGlobCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void RenameCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void RmdirCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void RmtHelpCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void SetCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void ShellCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void SiteCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void SpoolGetCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void SpoolPutCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void SymlinkCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void TypeCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void UmaskCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 
void VersionCmd (const int, const char **const, const CommandPtr, const ArgvInfoPtr)
 

Function Documentation

◆ BGStartCmd()

void BGStartCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 3266 of file cmds.c.

3267 {
3268  int i, n;
3269 
3271  if (SpoolCheck() < 0)
3272  return;
3273 
3274  if ((argc < 2) || ((n = atoi(argv[1])) < 2)) {
3275  RunBatch(0, &gConn);
3276  (void) printf("Background process started.\n");
3277 #if defined(WIN32) || defined(_WINDOWS)
3278 #else
3279  (void) printf("Watch the \"%s/batchlog\" file to see how it is progressing.\n", gOurDirectoryPath);
3280 #endif
3281  } else {
3282  for (i=0; i<n; i++)
3283  RunBatch(0, &gConn);
3284  (void) printf("Background processes started.\n");
3285 #if defined(WIN32) || defined(_WINDOWS)
3286 #else
3287  (void) printf("Watch the \"%s/batchlog\" file to see how it is progressing.\n", gOurDirectoryPath);
3288 #endif
3289  }
3290 } /* BGStart */
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static int SpoolCheck(void)
Definition: cmds.c:3240
GLdouble n
Definition: glext.h:7729
#define argv
Definition: mplay32.c:18
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
int gUnusedArg
Definition: cmds.c:46
void RunBatch(int Xstruct, const FTPCIPtr cip)
Definition: spool.c:364
FTPConnectionInfo gConn
Definition: main.c:37
#define ARGSUSED(x)
Definition: cmds.c:47
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
char gOurDirectoryPath[]
Definition: util.c:17
#define printf
Definition: config.h:203

◆ BookmarkCmd()

void BookmarkCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 323 of file cmds.c.

324 {
325  /* The only reason we do this is to get gcc/lint to shut up
326  * about unused parameters.
327  */
329 
330  if (gOurDirectoryPath[0] == '\0') {
331  (void) printf("Sorry, configuration information is not saved for this user.\n");
332  } else if ((argc <= 1) || (argv[1][0] == '\0')) {
333  /* No name specified on the command line. */
334  if (gBm.bookmarkName[0] == '\0') {
335  /* Not previously bookmarked. */
336  if (PromptForBookmarkName(&gBm) < 0) {
337  (void) printf("Nevermind.\n");
338  } else {
340  }
341  } else {
342  /* User wants to update an existing bookmark. */
344  }
345  } else {
348  }
349 } /* BookmarkCmd */
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define argv
Definition: mplay32.c:18
char bookmarkName[16]
Definition: bookmark.h:10
int gUnusedArg
Definition: cmds.c:46
int PromptForBookmarkName(BookmarkPtr bmp)
Definition: cmds.c:135
Bookmark gBm
Definition: bookmark.c:24
void SaveCurrentAsBookmark(void)
Definition: cmds.c:231
#define ARGSUSED(x)
Definition: cmds.c:47
char gOurDirectoryPath[]
Definition: util.c:17
#define printf
Definition: config.h:203

◆ CatCmd()

void CatCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 356 of file cmds.c.

357 {
358  int result;
359  int i;
360 
362  for (i=1; i<argc; i++) {
365  }
366 } /* CatCmd */
static int argc
Definition: ServiceArgs.c:12
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
#define argv
Definition: mplay32.c:18
int FTPGetOneFile2(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int resumeflag, const int appendflag)
Definition: io.c:2721
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
smooth NULL
Definition: ftsmooth.c:416
#define STDOUT_FILENO
Definition: syshdrs.h:89
int gUnusedArg
Definition: cmds.c:46
#define kTypeAscii
Definition: ncftp.h:353
FTPConnectionInfo gConn
Definition: main.c:37
#define kResumeNo
Definition: ncftp.h:367
#define ARGSUSED(x)
Definition: cmds.c:47
#define kErrCouldNotStartDataTransfer
Definition: ncftp_errno.h:77
GLuint64EXT * result
Definition: glext.h:11304
#define kAppendNo
Definition: ncftp.h:365

◆ ChdirCmd()

void ChdirCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 558 of file cmds.c.

559 {
560  int result;
561  LineList ll;
562  LinePtr lp;
563 
565 
566  if (argc <= 1) {
567  if (gStartDir[0] != '\0') {
570  if (result != kNoErr) {
571  /* State is incoherent if this happens! */
572  FTPPerror(&gConn, result, kErrCWDFailed, "Could not chdir to", gStartDir);
573  }
574  } else {
575  PrintCmdUsage(cmdp);
576  }
577  } else {
578  InitLineList(&ll);
579  result = FTPRemoteGlob(&gConn, &ll, argv[1], (aip->noglobargv[1] != 0) ? kGlobNo: kGlobYes);
580  if (result < 0) {
582  } else {
583  lp = ll.first;
584  if ((lp != NULL) && (lp->line != NULL)) {
585  if ((strcmp(lp->line, "-") == 0) && (gPrevRemoteCWD[0] != '\0')) {
586  free(lp->line);
587  lp->line = StrDup(gPrevRemoteCWD);
588  if (lp->line == NULL) {
591  } else {
593  result = Chdirs(&gConn, lp->line);
594  }
595  } else {
597  result = Chdirs(&gConn, lp->line);
598  }
599  if (result != kNoErr)
600  FTPPerror(&gConn, result, kErrCWDFailed, "Could not chdir to", lp->line);
601  }
602  }
604  }
605 } /* ChdirCmd */
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
#define free
Definition: debug_ros.c:5
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define kErrMallocFailed
Definition: ncftp_errno.h:40
#define kErrGlobFailed
Definition: ncftp_errno.h:68
#define argv
Definition: mplay32.c:18
#define StrDup
Definition: shlwapi.h:1533
int Chdirs(FTPCIPtr cip, const char *const cdCwd)
Definition: cmds.c:504
char gStartDir[512]
Definition: cmds.c:28
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
char gPrevRemoteCWD[512]
Definition: cmds.c:38
#define kGlobYes
Definition: ncftp.h:360
Definition: ncftp.h:79
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
char gRemoteCWD[512]
Definition: cmds.c:33
int FTPRemoteGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
Definition: glob.c:1341
void InitLineList(LineListPtr list)
Definition: linelist.c:54
w ll
Definition: byte_order.h:166
#define ARGSUSED(x)
Definition: cmds.c:47
#define kNoErr
Definition: ncftp_errno.h:9
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81
#define kErrCWDFailed
Definition: ncftp_errno.h:42

◆ Chdirs()

int Chdirs ( FTPCIPtr  cip,
const char *const  cdCwd 
)

Definition at line 504 of file cmds.c.

505 {
506  char *cp, *startcp;
507  int result;
508  int lastSubDir;
509 
510  if (cip == NULL)
511  return (kErrBadParameter);
512  if (strcmp(cip->magic, kLibraryMagic))
513  return (kErrBadMagic);
514 
515  if (cdCwd == NULL) {
517  cip->errNo = kErrInvalidDirParam;
518  return result;
519  }
520 
521  if ((cdCwd[0] == '\0') || (strcmp(cdCwd, ".") == 0)) {
522  result = 0;
523  return (result);
524  }
525 
526  cp = cip->buf;
527  cp[cip->bufSize - 2] = '\0';
528  if ((cdCwd[0] == '.') && (cdCwd[1] == '.') && ((cdCwd[2] == '\0') || IsLocalPathDelim(cdCwd[2]))) {
529  PathCat(cip->buf, cip->bufSize, gRemoteCWD, cdCwd);
530  } else {
531  (void) Strncpy(cip->buf, cdCwd, cip->bufSize);
532  }
533  if (cp[cip->bufSize - 2] != '\0')
534  return (kErrBadParameter);
535 
537  do {
538  startcp = cp;
539  cp = StrFindLocalPathDelim(cp + 0);
540  if (cp != NULL) {
541  *cp++ = '\0';
542  }
543  lastSubDir = (cp == NULL);
544  result = nFTPChdirAndGetCWD(cip, (*startcp != '\0') ? startcp : "/", lastSubDir ? 0 : 1);
545  if (result < 0) {
546  cip->errNo = result;
547  }
548  } while ((!lastSubDir) && (result == 0));
549 
550  return (result);
551 } /* Chdirs */
#define IsLocalPathDelim(c)
Definition: ncftp.h:497
#define kErrInvalidDirParam
Definition: ncftp_errno.h:39
#define kErrBadParameter
Definition: ncftp_errno.h:56
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char * buf
Definition: ncftp.h:186
char magic[16]
Definition: ncftp.h:135
#define StrRemoveTrailingLocalPathDelim
Definition: ncftp.h:496
void PathCat(char *const dst, const size_t dsize, const char *const cwd, const char *const src)
Definition: util.c:368
smooth NULL
Definition: ftsmooth.c:416
#define kErrBadMagic
Definition: ncftp_errno.h:55
int nFTPChdirAndGetCWD(const FTPCIPtr cip, const char *cdCwd, const int quietMode)
Definition: cmds.c:417
char gRemoteCWD[512]
Definition: cmds.c:33
char * Strncpy(char *const, const char *const, const size_t)
Definition: Strncpy.c:11
size_t bufSize
Definition: ncftp.h:187
POINT cp
Definition: magnifier.c:59
#define kLibraryMagic
Definition: ncftp.h:65
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint64EXT * result
Definition: glext.h:11304
#define StrFindLocalPathDelim(a)
Definition: ncftp.h:494

Referenced by ChdirCmd(), and DoOpen().

◆ ChmodCmd()

void ChmodCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 612 of file cmds.c.

613 {
614  int i, result;
615 
617  for (i=2; i<argc; i++) {
618  result = FTPChmod(
619  &gConn, argv[i], argv[1],
620  (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes
621  );
622  if (result < 0) {
623  FTPPerror(&gConn, result, kErrChmodFailed, "chmod", argv[i]);
624  /* but continue */
625  }
626  }
627 
628  /* Really should just flush only the modified directories... */
629  FlushLsCache();
630 } /* ChmodCmd */
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
int FTPChmod(const FTPCIPtr cip, const char *const pattern, const char *const mode, const int doGlob)
Definition: cmds.c:46
#define argv
Definition: mplay32.c:18
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
int gUnusedArg
Definition: cmds.c:46
#define kGlobYes
Definition: ncftp.h:360
#define kErrChmodFailed
Definition: ncftp_errno.h:59
FTPConnectionInfo gConn
Definition: main.c:37
void FlushLsCache(void)
Definition: ls.c:94
#define ARGSUSED(x)
Definition: cmds.c:47
GLuint64EXT * result
Definition: glext.h:11304

◆ CloseCmd()

void CloseCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 637 of file cmds.c.

638 {
640  if (gConn.connected == 0)
641  (void) printf("Already closed.\n");
642  else
643  CloseHost();
644 } /* CloseCmd */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gUnusedArg
Definition: cmds.c:46
FTPConnectionInfo gConn
Definition: main.c:37
void CloseHost(void)
Definition: main.c:153
#define ARGSUSED(x)
Definition: cmds.c:47
#define printf
Definition: config.h:203

◆ CurrentURL()

void CurrentURL ( char ,
size_t  ,
int   
)

Definition at line 161 of file cmds.c.

162 {
163  Bookmark bm;
164  char dir[160];
165 
166  memset(&bm, 0, sizeof(bm));
167  (void) STRNCPY(bm.name, gConn.host);
168  if ((gConn.user[0] != '\0') && (! STREQ(gConn.user, "anonymous")) && (! STREQ(gConn.user, "ftp"))) {
169  (void) STRNCPY(bm.user, gConn.user);
170  (void) STRNCPY(bm.pass, (showpass == 0) ? "PASSWORD" : gConn.pass);
171  (void) STRNCPY(bm.acct, gConn.acct);
172  }
173 
174  bm.port = gConn.port;
175 
176  /* We now save relative paths, because the pathname in URLs are
177  * relative by nature. This makes non-anonymous FTP URLs shorter
178  * because it doesn't have to include the pathname of their
179  * home directory.
180  */
182  AbsoluteToRelative(bm.dir, sizeof(bm.dir), dir, gStartDir, strlen(gStartDir));
183 
184  BookmarkToURL(&bm, dst, dsize);
185 } /* CurrentURL */
char dir[160]
Definition: bookmark.h:15
unsigned int port
Definition: ncftp.h:140
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char pass[64]
Definition: ncftp.h:138
char user[64]
Definition: ncftp.h:137
char name[64]
Definition: bookmark.h:11
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
void AbsoluteToRelative(char *const dst, const size_t dsize, const char *const dir, const char *const root, const size_t rootlen)
Definition: util.c:785
char host[64]
Definition: ncftp.h:136
unsigned int port
Definition: bookmark.h:18
void BookmarkToURL(BookmarkPtr bmp, char *url, size_t urlsize)
Definition: bookmark.c:36
char gStartDir[512]
Definition: cmds.c:28
char pass[64]
Definition: bookmark.h:13
unsigned int dir
Definition: maze.c:112
#define STREQ(a, b)
Definition: util.h:20
char user[64]
Definition: bookmark.h:12
char acct[64]
Definition: ncftp.h:139
FTPConnectionInfo gConn
Definition: main.c:37
char gRemoteCWD[512]
Definition: cmds.c:33
GLenum GLenum dst
Definition: glext.h:6340
char acct[64]
Definition: bookmark.h:14
#define memset(x, y, z)
Definition: compat.h:39

Referenced by PwdCmd().

◆ DebugCmd()

void DebugCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 650 of file cmds.c.

651 {
653  if (argc > 1)
654  SetDebug(atoi(argv[1]));
655  else
656  SetDebug(!gDebug);
657 } /* DebugCmd */
static int argc
Definition: ServiceArgs.c:12
void SetDebug(int i)
Definition: trace.c:88
#define argv
Definition: mplay32.c:18
int gUnusedArg
Definition: cmds.c:46
#define ARGSUSED(x)
Definition: cmds.c:47
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
int gDebug
Definition: trace.c:19

◆ DeleteCmd()

void DeleteCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 664 of file cmds.c.

665 {
666  int result;
667  int i, c;
668  int recursive = kRecursiveNo;
669 
671  GetoptReset();
672  while ((c = Getopt(argc, argv, "rf")) > 0) switch(c) {
673  case 'r':
674  recursive = kRecursiveYes;
675  break;
676  case 'f':
677  /* ignore */
678  break;
679  default:
680  PrintCmdUsage(cmdp);
681  return;
682  }
683 
684  for (i=gOptInd; i<argc; i++) {
685  result = FTPDelete(
686  &gConn, argv[i], recursive,
687  (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes
688  );
689  if (result < 0) {
690  FTPPerror(&gConn, result, kErrDELEFailed, "delete", argv[i]);
691  /* but continue */
692  }
693  }
694 
695  /* Really should just flush only the modified directories... */
696  FlushLsCache();
697 } /* DeleteCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
int FTPDelete(const FTPCIPtr cip, const char *const pattern, const int recurse, const int doGlob)
Definition: cmds.c:195
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
#define argv
Definition: mplay32.c:18
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
void GetoptReset(void)
Definition: getopt.c:21
#define kRecursiveYes
Definition: ncftp.h:362
#define kRecursiveNo
Definition: ncftp.h:363
int gUnusedArg
Definition: cmds.c:46
const GLubyte * c
Definition: glext.h:8905
#define kGlobYes
Definition: ncftp.h:360
FTPConnectionInfo gConn
Definition: main.c:37
void FlushLsCache(void)
Definition: ls.c:94
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
#define ARGSUSED(x)
Definition: cmds.c:47
#define c
Definition: ke_i.h:80
#define kErrDELEFailed
Definition: ncftp_errno.h:61
GLuint64EXT * result
Definition: glext.h:11304

◆ DoOpen()

int DoOpen ( void  )

Definition at line 2168 of file cmds.c.

2169 {
2170  int result;
2171  char ipstr[128];
2172  char ohost[128];
2173 #ifdef SIGALRM
2174  sigproc_t osigalrm;
2175 #endif
2176  char prompt[256];
2177 
2179  (void) STRNCPY(ohost, gConn.host);
2180  OpenMsg("Resolving %s...", ohost);
2181  if ((gLoadedBm != 0) && (gBm.lastIP[0] != '\0')) {
2182  result = GetHostByName(ipstr, sizeof(ipstr), ohost, 3);
2183  if (result < 0) {
2184  (void) STRNCPY(ipstr, gBm.lastIP);
2185  result = 0;
2186  } else {
2187  result = GetHostByName(ipstr, sizeof(ipstr), ohost, 7);
2188  }
2189  } else {
2190  result = GetHostByName(ipstr, sizeof(ipstr), ohost, 10);
2191  }
2192  if (result < 0) {
2193  (void) printf("\n");
2194  (void) printf("Unknown host \"%s\".\n", ohost);
2195  return (-1);
2196  }
2197  (void) STRNCPY(gConn.host, ipstr);
2198  OpenMsg("Connecting to %s...", ipstr);
2199  } else {
2200  OpenMsg("Connecting to %s via %s...", gConn.host, gConn.firewallHost);
2201  Trace(0, "Fw: %s Type: %d User: %s Pass: %s Port: %u\n",
2205  (gConn.firewallPass[0] == '\0') ? "(none)" : "********",
2207  );
2208  Trace(0, "FwExceptions: %s\n", gFirewallExceptionList);
2209  if (strchr(gLib.ourHostName, '.') == NULL) {
2210  Trace(0, "NOTE: Your domain name could not be detected.\n");
2212  Trace(0, " Make sure you manually add your domain name to firewall-exception-list.\n");
2213  }
2214  }
2215  }
2216 
2217  if (gConn.firewallPass[0] == '\0') {
2218  switch (gConn.firewallType) {
2219  case kFirewallNotInUse:
2220  break;
2221  case kFirewallUserAtSite:
2222  break;
2224  case kFirewallSiteSite:
2225  case kFirewallOpenSite:
2229  (void) printf("\n");
2230  (void) STRNCPY(prompt, "Password for firewall user \"");
2231  (void) STRNCAT(prompt, gConn.firewallUser);
2232  (void) STRNCAT(prompt, "\" at ");
2233  (void) STRNCAT(prompt, gConn.firewallHost);
2234  (void) STRNCAT(prompt, ": ");
2235  (void) gl_getpass(prompt, gConn.firewallPass, sizeof(gConn.firewallPass));
2236  break;
2237  }
2238  }
2239 
2240  if ((gConn.user[0] != '\0') && (strcmp(gConn.user, "anonymous") != 0) && (strcmp(gConn.user, "ftp") != 0)) {
2242  }
2243 
2244  /* Register our callbacks. */
2249 
2250 #ifdef SIGALRM
2251  osigalrm = NcSignal(SIGALRM, (FTPSigProc) SIG_IGN);
2252  result = FTPOpenHost(&gConn);
2253  (void) NcSignal(SIGALRM, osigalrm);
2254 #else
2255  result = FTPOpenHost(&gConn);
2256 #endif
2257 
2259  (void) STRNCPY(gConn.host, ohost); /* Put it back. */
2260  if (result >= 0) {
2261  (void) time(&gBm.lastCall);
2262  LogOpen(gConn.host);
2263  OpenMsg("Logged in to %s.", gConn.host);
2264  (void) printf("\n");
2265 
2266  /* Remove callback. */
2268 
2269  /* Need to note what our "root" was before we change it. */
2271  (void) STRNCPY(gRemoteCWD, "/"); /* Guess! */
2272  } else {
2274  }
2276 
2277  /* If the bookmark specified a remote directory, change to it now. */
2278  if ((gLoadedBm != 0) && (gBm.dir[0] != '\0')) {
2279  result = Chdirs(&gConn, gBm.dir);
2280  if (result < 0) {
2281  FTPPerror(&gConn, result, kErrCWDFailed, "Could not chdir to previous directory", gBm.dir);
2282  }
2283  Trace(-1, "Current remote directory is %s.\n", gRemoteCWD);
2284  }
2285 
2286  /* If the bookmark specified a local directory, change to it now. */
2287  if ((gLoadedBm != 0) && (gBm.ldir[0] != '\0')) {
2288  (void) chdir(gBm.ldir);
2290  if (FTPGetLocalCWD(gLocalCWD, sizeof(gLocalCWD)) != NULL) {
2291  Trace(-1, "Current local directory is %s.\n", gLocalCWD);
2292  }
2293  }
2294 
2295  /* Identify the FTP client type to the server. Most don't understand this yet. */
2297  (void) FTPCmd(&gConn, "CLNT NcFTP %.5s %s", gVersion + 11, gOS);
2298  return (0);
2299  } else {
2300  FTPPerror(&gConn, result, 0, "Could not open host", gConn.host);
2301  }
2302 
2303  /* Remove callback. */
2305  (void) printf("\n");
2306  return (-1);
2307 } /* Open */
#define kFirewallSiteSite
Definition: ncftp.h:391
char gVersion[]
Definition: init.c:22
char dir[160]
Definition: bookmark.h:15
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
#define kFirewallUserAtSite
Definition: ncftp.h:389
FTPLoginMessageProc onLoginMsgProc
Definition: ncftp.h:227
char gFirewallExceptionList[]
Definition: preffw.c:21
char ourHostName[64]
Definition: ncftp.h:118
char user[64]
Definition: ncftp.h:137
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
__u16 time
Definition: mkdosfs.c:366
#define kFirewallNotInUse
Definition: ncftp.h:388
static void OpenMsg(const char *const fmt,...)
Definition: cmds.c:2050
int FTPCmd(const FTPCIPtr cip, const char *const cmdspec,...)
Definition: rcmd.c:603
FTPLibraryInfo gLib
Definition: main.c:36
static void NcFTPGetPassphraseProc(const FTPCIPtr cip, LineListPtr pwPrompt, char *pass, size_t dsize)
Definition: cmds.c:2147
static void NcFTPRedialStatusProc(const FTPCIPtr cipUNUSED, int mode, int val)
Definition: cmds.c:2130
static void NcFTPOnLoginMessageProc(const FTPCIPtr cipUNUSED, ResponsePtr rp)
Definition: cmds.c:2118
char host[64]
Definition: ncftp.h:136
#define chdir
Definition: syshdrs.h:69
FTPRedialStatusProc redialStatusProc
Definition: ncftp.h:225
char gLocalCWD[512]
Definition: main.c:43
int Chdirs(FTPCIPtr cip, const char *const cdCwd)
Definition: cmds.c:504
#define kFirewallUserAtSiteFwuPassFwp
Definition: ncftp.h:395
char gStartDir[512]
Definition: cmds.c:28
char firewallHost[64]
Definition: ncftp.h:217
char lastIP[32]
Definition: bookmark.h:24
char * gl_getpass(const char *const prompt, char *const pass, int dsize)
Definition: getline.c:2051
FTPConnectMessageProc onConnectMsgProc
Definition: ncftp.h:224
smooth NULL
Definition: ftsmooth.c:416
int firewallType
Definition: ncftp.h:221
char firewallPass[64]
Definition: ncftp.h:219
#define STRNCAT(d, s)
Definition: Strn.h:48
char * startingWorkingDirectory
Definition: ncftp.h:158
#define kFirewallLoginThenUserAtSite
Definition: ncftp.h:390
char gOS[]
Definition: version.c:12
int GetHostByName(char *const volatile dst, size_t dsize, const char *const hn, int t)
Definition: util.c:826
char ldir[160]
Definition: bookmark.h:16
static void NcFTPOnConnectMessageProc(const FTPCIPtr cipUNUSED, ResponsePtr rp)
Definition: cmds.c:2107
#define kFirewallFwuAtSiteFwpUserPass
Definition: ncftp.h:394
void(* FTPSigProc)(int)
Definition: ncftp.h:76
Bookmark gBm
Definition: bookmark.c:24
char firewallUser[64]
Definition: ncftp.h:218
FTPConnectionInfo gConn
Definition: main.c:37
char gRemoteCWD[512]
Definition: cmds.c:33
#define Trace(x)
Definition: inflate.c:42
#define kCommandNotAvailable
Definition: ncftp.h:381
#define NcSignal
Definition: ncftp.h:604
void(* sigproc_t)(int)
Definition: util.h:10
void LogOpen(const char *const host)
Definition: log.c:45
#define kFirewallOpenSite
Definition: ncftp.h:392
FTPPrintResponseProc printResponseProc
Definition: ncftp.h:226
unsigned int firewallPort
Definition: ncftp.h:220
static void NcFTPOpenPrintResponseProc(const FTPCIPtr cipUNUSED, ResponsePtr rp)
Definition: cmds.c:2088
#define kFirewallUserAtUserPassAtPass
Definition: ncftp.h:393
char * strchr(const char *String, int ch)
Definition: utclib.c:501
int FTPOpenHost(const FTPCIPtr cip)
Definition: open.c:818
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
time_t lastCall
Definition: bookmark.h:19
int gLoadedBm
Definition: bookmark.c:25
#define SIG_IGN
Definition: signal.h:48
GLuint64EXT * result
Definition: glext.h:11304
char gPrevLocalCWD[512]
Definition: main.c:43
#define kErrCWDFailed
Definition: ncftp_errno.h:42
char * FTPGetLocalCWD(char *buf, size_t size)
Definition: util.c:29
FTPGetPassphraseProc passphraseProc
Definition: ncftp.h:242
#define printf
Definition: config.h:203

Referenced by MapDefaultKey(), OpenCmd(), and OpenURL().

◆ EchoCmd()

void EchoCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 706 of file cmds.c.

707 {
708  int i;
709  int result;
710  int np = 0;
711  LineList ll;
712  LinePtr lp;
713 
715  for (i=1; i<argc; i++) {
716  InitLineList(&ll);
717  result = FTPLocalGlob(&gConn, &ll, argv[i], (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes);
718  if (result < 0) {
719  FTPPerror(&gConn, result, kErrGlobFailed, "local glob", argv[i]);
720  } else {
721  for (lp = ll.first; lp != NULL; lp = lp->next) {
722  if (lp->line != NULL) {
723  if (np > 0)
724  (void) printf(" ");
725  (void) printf("%s", lp->line);
726  np++;
727  }
728  }
729  }
731  }
732  (void) printf("\n");
733 } /* EchoCmd */
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
LinePtr next
Definition: ncftp.h:80
#define kErrGlobFailed
Definition: ncftp_errno.h:68
#define argv
Definition: mplay32.c:18
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
int FTPLocalGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
Definition: glob.c:1580
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
#define kGlobYes
Definition: ncftp.h:360
Definition: ncftp.h:79
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
void InitLineList(LineListPtr list)
Definition: linelist.c:54
w ll
Definition: byte_order.h:166
#define ARGSUSED(x)
Definition: cmds.c:47
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81
#define printf
Definition: config.h:203

◆ FillBookmarkInfo()

void FillBookmarkInfo ( BookmarkPtr  )

Definition at line 194 of file cmds.c.

195 {
196  char dir[160];
197 
198  (void) STRNCPY(bmp->name, gConn.host);
199  if ((STREQ(gConn.user, "anonymous")) || (STREQ(gConn.user, "ftp"))) {
200  bmp->user[0] = '\0';
201  bmp->pass[0] = '\0';
202  bmp->acct[0] = '\0';
203  } else {
204  (void) STRNCPY(bmp->user, gConn.user);
205  (void) STRNCPY(bmp->pass, gConn.pass);
206  (void) STRNCPY(bmp->acct, gConn.acct);
207  }
208 
209  /* We now save relative paths, because the pathname in URLs are
210  * relative by nature. This makes non-anonymous FTP URLs shorter
211  * because it doesn't have to include the pathname of their
212  * home directory.
213  */
215  AbsoluteToRelative(bmp->dir, sizeof(bmp->dir), dir, gStartDir, strlen(gStartDir));
216  bmp->port = gConn.port;
217  (void) time(&bmp->lastCall);
218  bmp->hasSIZE = gConn.hasSIZE;
219  bmp->hasMDTM = gConn.hasMDTM;
220  bmp->hasPASV = gConn.hasPASV;
221  bmp->hasUTIME = gConn.hasUTIME;
223  (void) STRNCPY(bmp->lastIP, gConn.ip);
224 } /* FillBookmarkInfo */
unsigned int port
Definition: ncftp.h:140
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char pass[64]
Definition: ncftp.h:138
char user[64]
Definition: ncftp.h:137
int gFirewallType
Definition: preffw.c:17
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
__u16 time
Definition: mkdosfs.c:366
#define kFirewallNotInUse
Definition: ncftp.h:388
void AbsoluteToRelative(char *const dst, const size_t dsize, const char *const dir, const char *const root, const size_t rootlen)
Definition: util.c:785
char host[64]
Definition: ncftp.h:136
char gStartDir[512]
Definition: cmds.c:28
unsigned int dir
Definition: maze.c:112
#define STREQ(a, b)
Definition: util.h:20
char acct[64]
Definition: ncftp.h:139
char ip[32]
Definition: ncftp.h:154
BITMAP bmp
Definition: alphablend.c:62
FTPConnectionInfo gConn
Definition: main.c:37
char gRemoteCWD[512]
Definition: cmds.c:33

Referenced by SaveCurrentAsBookmark(), and SaveUnsavedBookmark().

◆ GetCmd()

void GetCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 916 of file cmds.c.

917 {
918  int opt;
919  int renameMode = 0;
920  int recurseFlag = kRecursiveNo;
921  int appendFlag = kAppendNo;
922  int resumeFlag = kResumeYes;
923  int tarflag = kTarYes;
924  const char *dstdir = NULL;
925  int rc;
926  int i;
927  int doGlob;
928  int xtype = gBm.xferType;
929  int nD = 0;
930  int deleteFlag = kDeleteNo;
931  char pattern[256];
932  vsigproc_t osigint;
933  ConfirmResumeDownloadProc confirmProc;
934 
935  confirmProc = NcFTPConfirmResumeDownloadProc;
936  gResumeAnswerAll = kConfirmResumeProcNotUsed; /* Ask at least once each time */
938  GetoptReset();
939  while ((opt = Getopt(argc, argv, "aAzfrRTD")) >= 0) switch (opt) {
940  case 'a':
941  xtype = kTypeAscii;
942  break;
943  case 'A':
944  /* Append to local files, instead of truncating
945  * them first.
946  */
947  appendFlag = kAppendYes;
948  break;
949  case 'f':
950  case 'Z':
951  /* Do not try to resume a download, even if it
952  * appeared that some of the file was transferred
953  * already.
954  */
955  resumeFlag = kResumeNo;
956  confirmProc = NoConfirmResumeDownloadProc;
957  break;
958  case 'z':
959  /* Special flag that lets you specify the
960  * destination file. Normally a "get" will
961  * write the file by the same name as the
962  * remote file's basename.
963  */
964  renameMode = 1;
965  break;
966  case 'r':
967  case 'R':
968  /* If the item is a directory, get the
969  * directory and all its contents.
970  */
971  recurseFlag = kRecursiveYes;
972  break;
973  case 'T':
974  /* If they said "-R", they may want to
975  * turn off TAR mode if they are trying
976  * to resume the whole directory.
977  * The disadvantage to TAR mode is that
978  * it always downloads the whole thing,
979  * which is why there is a flag to
980  * disable this.
981  */
982  tarflag = kTarNo;
983  break;
984  case 'D':
985  /* You can delete the remote file after
986  * you downloaded it successfully by using
987  * the -DD option. It requires two -D's
988  * to minimize the odds of accidentally
989  * using a single -D.
990  */
991  nD++;
992  break;
993  default:
994  PrintCmdUsage(cmdp);
995  return;
996  }
997 
998  if (nD >= 2)
999  deleteFlag = kDeleteYes;
1000 
1001  if (renameMode != 0) {
1002  if (gOptInd > argc - 2) {
1003  PrintCmdUsage(cmdp);
1004  (void) fprintf(stderr, "\nFor get with rename, try \"get -z remote-path-name local-path-name\".\n");
1005  return;
1006  }
1007  osigint = NcSignal(SIGINT, XferCanceller);
1008  rc = FTPGetOneFile3(&gConn, argv[gOptInd], argv[gOptInd + 1], xtype, (-1), resumeFlag, appendFlag, deleteFlag, NoConfirmResumeDownloadProc, 0);
1009  if (rc < 0)
1011  } else {
1012  osigint = NcSignal(SIGINT, XferCanceller);
1013  for (i=gOptInd; i<argc; i++) {
1014  doGlob = (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes;
1015  STRNCPY(pattern, argv[i]);
1017  rc = FTPGetFiles3(&gConn, pattern, dstdir, recurseFlag, doGlob, xtype, resumeFlag, appendFlag, deleteFlag, tarflag, confirmProc, 0);
1018  if (rc < 0)
1020  }
1021  }
1022  (void) NcSignal(SIGINT, osigint);
1023  (void) fflush(stdin);
1024 
1025  if (deleteFlag == kDeleteYes) {
1026  /* Directory is now out of date */
1027  FlushLsCache();
1028  }
1029 } /* GetCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define kTarYes
Definition: ncftp.h:370
int FTPGetFiles3(const FTPCIPtr cip, const char *pattern1, const char *const dstdir1, const int recurse, int doGlob, const int xtype, const int resumeflag, int appendflag, const int deleteflag, const int tarflag, const ConfirmResumeDownloadProc resumeProc, int UNUSED(reserved))
Definition: io.c:2486
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
volatile sigproc_t vsigproc_t
Definition: util.h:11
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
FILE * stdin
#define SIGINT
Definition: signal.h:23
#define argv
Definition: mplay32.c:18
static int NcFTPConfirmResumeDownloadProc(const char *volatile *localpath, volatile longest_int localsize, volatile time_t localmtime, const char *volatile remotepath, volatile longest_int remotesize, volatile time_t remotemtime, volatile longest_int *volatile startPoint)
Definition: cmds.c:739
int(* ConfirmResumeDownloadProc)(const char *volatile *localpath, volatile longest_int localsize, volatile time_t localmtime, const char *volatile remotepath, volatile longest_int remotesize, volatile time_t remotetime, volatile longest_int *volatile startPoint)
Definition: ncftp.h:431
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void GetoptReset(void)
Definition: getopt.c:21
smooth NULL
Definition: ftsmooth.c:416
#define kRecursiveYes
Definition: ncftp.h:362
#define kRecursiveNo
Definition: ncftp.h:363
#define kDeleteNo
Definition: ncftp.h:369
#define kResumeYes
Definition: ncftp.h:366
int gUnusedArg
Definition: cmds.c:46
#define kTarNo
Definition: ncftp.h:371
#define kGlobYes
Definition: ncftp.h:360
Bookmark gBm
Definition: bookmark.c:24
#define kTypeAscii
Definition: ncftp.h:353
#define kDeleteYes
Definition: ncftp.h:368
FTPConnectionInfo gConn
Definition: main.c:37
#define NoConfirmResumeDownloadProc
Definition: ncftp.h:451
int FTPGetOneFile3(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int resumeflag, const int appendflag, const int deleteflag, const ConfirmResumeDownloadProc resumeProc, int UNUSED(reserved))
Definition: io.c:2451
#define kResumeNo
Definition: ncftp.h:367
void FlushLsCache(void)
Definition: ls.c:94
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
#define NcSignal
Definition: ncftp.h:604
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
int gResumeAnswerAll
Definition: cmds.c:55
#define kConfirmResumeProcNotUsed
Definition: ncftp.h:423
void XferCanceller(int sigNum)
Definition: shell.c:419
void StrRemoveTrailingSlashes(char *dst)
Definition: util.c:768
#define ARGSUSED(x)
Definition: cmds.c:47
#define kErrCouldNotStartDataTransfer
Definition: ncftp_errno.h:77
FILE * stderr
#define kAppendYes
Definition: ncftp.h:364
int xferType
Definition: bookmark.h:17
#define kAppendNo
Definition: ncftp.h:365
GLubyte * pattern
Definition: glext.h:7787

◆ HelpCmd()

void HelpCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1036 of file cmds.c.

1037 {
1038  CommandPtr c;
1039  int showall = 0, helpall = 0;
1040  int i, j, k, n;
1041  int nRows, nCols;
1042  int nCmds2Print;
1043  int screenColumns;
1044  int len, widestName;
1045  char *cp, spec[16];
1046  const char *cmdnames[64];
1047 
1049  assert(gNumCommands < (sizeof(cmdnames) / sizeof(char *)));
1050  if (argc == 2) {
1051  showall = (strcmp(argv[1], "showall") == 0);
1052  helpall = (strcmp(argv[1], "helpall") == 0);
1053  }
1054  if (argc == 1 || showall) {
1055  (void) printf("\
1056 Commands may be abbreviated. 'help showall' shows hidden and unsupported \n\
1057 commands. 'help <command>' gives a brief description of <command>.\n\n");
1058 
1059  /* First, see how many commands we will be printing to the screen.
1060  * Unless 'showall' was given, we won't be printing the hidden
1061  * (i.e. not very useful to the end-user) commands.
1062  */
1063  c = gCommands;
1064  nCmds2Print = 0;
1065  for (n = 0; n < (int) gNumCommands; c++, n++)
1066  if ((!iscntrl((int) c->name[0])) && (!(c->flags & kCmdHidden) || showall))
1067  nCmds2Print++;
1068 
1069  (void) memset((char *) cmdnames, 0, sizeof(cmdnames));
1070 
1071  /* Now form the list we'll be printing, and noting what the maximum
1072  * length of a command name was, so we can use that when determining
1073  * how to print in columns.
1074  */
1075  c = gCommands;
1076  i = 0;
1077  widestName = 0;
1078  for (n = 0; n < (int) gNumCommands; c++, n++) {
1079  if ((!iscntrl((int) c->name[0])) && (!(c->flags & kCmdHidden) || showall)) {
1080  cmdnames[i++] = c->name;
1081  len = (int) strlen(c->name);
1082  if (len > widestName)
1083  widestName = len;
1084  }
1085  }
1086 
1087  if ((cp = (char *) getenv("COLUMNS")) == NULL)
1088  screenColumns = 80;
1089  else
1090  screenColumns = atoi(cp);
1091 
1092  /* Leave an extra bit of whitespace for the margins between columns. */
1093  widestName += 2;
1094 
1095  nCols = (screenColumns + 0) / widestName;
1096  nRows = nCmds2Print / nCols;
1097  if ((nCmds2Print % nCols) > 0)
1098  nRows++;
1099 
1100  for (i = 0; i < nRows; i++) {
1101  for (j = 0; j < nCols; j++) {
1102  k = nRows * j + i;
1103  if (k < nCmds2Print) {
1104  (void) sprintf(spec, "%%-%ds",
1105  (j < nCols - 1) ? widestName : widestName - 2
1106  );
1107  (void) printf(spec, cmdnames[k]);
1108  }
1109  }
1110  (void) printf("\n");
1111  }
1112  } else if (helpall) {
1113  /* Really intended for me, so I can debug the help strings. */
1114  for (c = gCommands, n = 0; n < (int) gNumCommands; c++, n++) {
1115  PrintCmdHelp(c);
1116  PrintCmdUsage(c);
1117  }
1118  } else {
1119  /* For each command name specified, print its help stuff. */
1120  for (i=1; i<argc; i++) {
1121  c = GetCommandByName(argv[i], 0);
1122  if (c == kAmbiguousCommand) {
1123  (void) printf("%s: ambiguous command name.\n", argv[i]);
1124  } else if (c == kNoCommand) {
1125  (void) printf("%s: no such command.\n", argv[i]);
1126  } else {
1127  if (i > 1)
1128  (void) printf("\n");
1129  PrintCmdHelp(c);
1130  PrintCmdUsage(c);
1131  }
1132  }
1133  }
1134 } /* HelpCmd */
static int argc
Definition: ServiceArgs.c:12
CommandPtr GetCommandByName(const char *const name, int wantExactMatch)
Definition: shell.c:156
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int nCols
Definition: appswitch.c:56
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define kAmbiguousCommand
Definition: shell.h:54
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
#define kNoCommand
Definition: shell.h:55
GLdouble n
Definition: glext.h:7729
#define assert(x)
Definition: debug.h:53
Definition: shell.h:41
#define argv
Definition: mplay32.c:18
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
smooth NULL
Definition: ftsmooth.c:416
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 GLint GLint j
Definition: glfuncs.h:250
int gUnusedArg
Definition: cmds.c:46
const GLubyte * c
Definition: glext.h:8905
#define kCmdHidden
Definition: shell.h:58
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_ _CRTIMP int __cdecl iscntrl(_In_ int _C)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define ARGSUSED(x)
Definition: cmds.c:47
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
POINT cp
Definition: magnifier.c:59
int nRows
Definition: appswitch.c:56
#define c
Definition: ke_i.h:80
Command gCommands[]
Definition: cmdlist.c:16
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
size_t gNumCommands
Definition: cmdlist.c:525
#define memset(x, y, z)
Definition: compat.h:39
int k
Definition: mpi.c:3369
void PrintCmdHelp(CommandPtr c)
Definition: shell.c:200
#define printf
Definition: config.h:203
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ HostsCmd()

void HostsCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1329 of file cmds.c.

1330 {
1331  const char *av[3];
1332  char bm[128];
1333 
1335  /* Skip visual mode if "-l". */
1336  if ((argc == 1) && (RunBookmarkEditor(bm, sizeof(bm)) == 0)) {
1337  if (bm[0] != '\0') {
1338  av[0] = "open";
1339  av[1] = bm;
1340  av[2] = NULL;
1341  OpenCmd(2, av, (CommandPtr) 0, (ArgvInfoPtr) 0);
1342  }
1343  return;
1344  }
1345  if (PrintHosts() <= 0) {
1346  (void) printf("You haven't bookmarked any FTP sites.\n");
1347  (void) printf("Before closing a site, you can use the \"bookmark\" command to save the current\nhost and directory for next time.\n");
1348  } else {
1349  (void) printf("\nTo use a bookmark, use the \"open\" command with the name of the bookmark.\n");
1350  }
1351 } /* HostsCmd */
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static int PrintHosts(void)
Definition: cmds.c:1143
Definition: shell.h:41
static int RunBookmarkEditor(char *selectedBmName, size_t dsize)
Definition: cmds.c:1187
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
void OpenCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2317
Definition: shell.h:8
#define ARGSUSED(x)
Definition: cmds.c:47
#define printf
Definition: config.h:203

◆ InitTransferType()

void InitTransferType ( void  )

◆ JobsCmd()

void JobsCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1358 of file cmds.c.

1359 {
1361  Jobs();
1362 } /* JobsCmd */
int gUnusedArg
Definition: cmds.c:46
void Jobs(void)
Definition: spool.c:318
#define ARGSUSED(x)
Definition: cmds.c:47

◆ ListCmd()

void ListCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1371 of file cmds.c.

1372 {
1373  volatile int i;
1374  int j;
1375  char options[32];
1376  char option[2];
1377  volatile int listmode;
1378  FILE *stream;
1379  volatile int paging;
1380 #if defined(WIN32) || defined(_WINDOWS)
1381 #else
1382  int sj;
1383  vsigproc_t osigpipe, osigint;
1384 #endif
1385 
1387  stream = stdout;
1388  paging = 0;
1389 
1390  if (argv[0][0] == 'd') {
1391  /* dir */
1392  listmode = 'l';
1393  } else if (argv[0][0] == 'n') {
1394  /* nlist */
1395  listmode = '1';
1396  } else if (argv[0][0] == 'p') {
1397  /* pager */
1398  paging = 1;
1399 
1400  if (argv[0][1] == 'd') {
1401  /* dir */
1402  listmode = 'l';
1403  } else if (argv[0][1] == 'n') {
1404  /* nlist */
1405  listmode = '1';
1406  } else {
1407  /* ls */
1408  listmode = 'C';
1409  }
1410  } else {
1411  /* ls */
1412  listmode = 'C';
1413  }
1414  options[0] = '\0';
1415  option[1] = '\0';
1416 
1417  for (i=1; i<argc; i++) {
1418  if (argv[i][0] != '-')
1419  break;
1420  if (argv[i][1] == '-') {
1421  if (argv[i][2] == '\0') {
1422  /* end of options. */
1423  ++i;
1424  break;
1425  } else {
1426  /* GNU-esque long --option? */
1427  PrintCmdUsage(cmdp);
1428  }
1429  } else {
1430  for (j=1; ; j++) {
1431  option[0] = argv[i][j];
1432  if (argv[i][j] == '\0')
1433  break;
1434  switch (argv[i][j]) {
1435  case 'l':
1436  listmode = 'l';
1437  break;
1438  case '1':
1439  listmode = '1';
1440  break;
1441  case 'C':
1442  listmode = 'C';
1443  break;
1444  default:
1445  (void) STRNCAT(options, option);
1446  break;
1447  }
1448  }
1449  }
1450  }
1451 
1452 
1453  if (paging != 0) {
1454  stream = OpenPager();
1455  if (stream == NULL) {
1456  return;
1457  }
1458 
1459 #if defined(WIN32) || defined(_WINDOWS)
1460 #elif defined(HAVE_SIGSETJMP)
1461  osigpipe = osigint = (sigproc_t) 0;
1462  sj = sigsetjmp(gCancelJmp, 1);
1463 #else /* HAVE_SIGSETJMP */
1464  osigpipe = osigint = (sigproc_t) 0;
1465  sj = setjmp(gCancelJmp);
1466 #endif /* HAVE_SIGSETJMP */
1467 
1468 #if defined(WIN32) || defined(_WINDOWS)
1469 #else
1470  if (sj != 0) {
1471  /* Caught a signal. */
1473  ClosePager(stream);
1474  (void) NcSignal(SIGPIPE, osigpipe);
1475  (void) NcSignal(SIGINT, osigint);
1476  Trace(0, "Canceled because of signal %d.\n", gGotSig);
1477  (void) fprintf(stderr, "Canceled.\n");
1478  gMayCancelJmp = 0;
1479  return;
1480  } else {
1481  osigpipe = NcSignal(SIGPIPE, Cancel);
1482  osigint = NcSignal(SIGINT, Cancel);
1483  gMayCancelJmp = 1;
1484  }
1485 #endif
1486  }
1487 
1488  if (argv[i] == NULL) {
1489  /* No directory specified, use cwd. */
1490  Ls(NULL, listmode, options, stream);
1491  } else {
1492  /* List each item. */
1493  for ( ; i<argc; i++) {
1494  Ls(argv[i], listmode, options, stream);
1495  }
1496  }
1497 
1498  if (paging != 0) {
1499  ClosePager(stream);
1500 #if defined(WIN32) || defined(_WINDOWS)
1501 #else
1502  (void) NcSignal(SIGPIPE, osigpipe);
1503  (void) NcSignal(SIGINT, osigint);
1504 #endif
1505  }
1506  gMayCancelJmp = 0;
1507 } /* ListCmd */
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gGotSig
Definition: shell.c:60
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
volatile sigproc_t vsigproc_t
Definition: util.h:11
int gMayCancelJmp
Definition: shell.c:54
#define SIGINT
Definition: signal.h:23
#define argv
Definition: mplay32.c:18
static void ClosePager(FILE *pagerfp)
Definition: cmds.c:113
FILE * stdout
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: getopt.h:108
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 GLint GLint j
Definition: glfuncs.h:250
#define STRNCAT(d, s)
Definition: Strn.h:48
int gUnusedArg
Definition: cmds.c:46
void Cancel(int sigNum)
Definition: shell.c:481
jmp_buf gCancelJmp
Definition: shell.c:45
int sigsetjmp(sigjmp_buf buf, int savesigs)
void(* FTPSigProc)(int)
Definition: ncftp.h:76
#define SIGPIPE
Definition: signal.h:35
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define Trace(x)
Definition: inflate.c:42
#define NcSignal
Definition: ncftp.h:604
void Ls(const char *const item, int listmode, const char *const options, FILE *stream)
Definition: ls.c:465
void(* sigproc_t)(int)
Definition: util.h:10
#define setjmp
Definition: setjmp.h:183
#define ARGSUSED(x)
Definition: cmds.c:47
FILE * stderr
static FILE * OpenPager(void)
Definition: cmds.c:95
#define SIG_IGN
Definition: signal.h:48

◆ LocalChdirCmd()

void LocalChdirCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1514 of file cmds.c.

1515 {
1516  int result;
1517  const char *dir;
1518  char buf[512];
1519 
1521  dir = ((argc < 2) ? gHome : argv[1]);
1522  if ((dir[0] == '-') && (dir[1] == '\0')) {
1523  if (gPrevLocalCWD[0] == '\0') {
1524  (void) fprintf(stderr, "No previous local working directory to switch to.\n");
1525  return;
1526  } else {
1527  dir = gPrevLocalCWD;
1528  }
1529  } else if (dir[0] == '~') {
1530  if (dir[1] == '\0') {
1531  dir = gHome;
1532  } else if (dir[1] == '/') {
1533  (void) STRNCPY(buf, gHome);
1534  dir = STRNCAT(buf, dir + 1);
1535  }
1536  }
1537  result = chdir(dir);
1538  if (result < 0) {
1539  perror(dir);
1540  } else {
1542  (void) FTPGetLocalCWD(gLocalCWD, sizeof(gLocalCWD));
1543 
1544  }
1545 } /* LocalChdirCmd */
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define argv
Definition: mplay32.c:18
#define chdir
Definition: syshdrs.h:69
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
char gLocalCWD[512]
Definition: main.c:43
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
unsigned int dir
Definition: maze.c:112
#define STRNCAT(d, s)
Definition: Strn.h:48
char gHome[]
Definition: util.c:15
int gUnusedArg
Definition: cmds.c:46
#define ARGSUSED(x)
Definition: cmds.c:47
FILE * stderr
GLuint64EXT * result
Definition: glext.h:11304
char gPrevLocalCWD[512]
Definition: main.c:43
char * FTPGetLocalCWD(char *buf, size_t size)
Definition: util.c:29

◆ LocalChmodCmd()

void LocalChmodCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1741 of file cmds.c.

1742 {
1744  Sys(argc, argv, aip, "/bin/chmod", 1);
1745 } /* LocalChmodCmd */
static int argc
Definition: ServiceArgs.c:12
#define argv
Definition: mplay32.c:18
int gUnusedArg
Definition: cmds.c:46
#define ARGSUSED(x)
Definition: cmds.c:47

◆ LocalListCmd()

void LocalListCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1552 of file cmds.c.

1553 {
1554 #if defined(WIN32) || defined(_WINDOWS)
1555  volatile int i;
1556  int j;
1557  char options[32];
1558  char option[2];
1559  volatile int listmode;
1560  FILE *stream;
1561  volatile int paging;
1562 
1563 
1565  stream = stdout;
1566  paging = 0;
1567 
1568  if (argv[0][1] == 'd') {
1569  /* dir */
1570  listmode = 'l';
1571  } else if (argv[0][1] == 'n') {
1572  /* nlist */
1573  listmode = '1';
1574  } else {
1575  /* ls */
1576  listmode = 'C';
1577  }
1578  options[0] = '\0';
1579  option[1] = '\0';
1580 
1581  for (i=1; i<argc; i++) {
1582  if (argv[i][0] != '-')
1583  break;
1584  if (argv[i][1] == '-') {
1585  if (argv[i][2] == '\0') {
1586  /* end of options. */
1587  ++i;
1588  break;
1589  } else {
1590  /* GNU-esque long --option? */
1591  PrintCmdUsage(cmdp);
1592  }
1593  } else {
1594  for (j=1; ; j++) {
1595  option[0] = argv[i][j];
1596  if (argv[i][j] == '\0')
1597  break;
1598  switch (argv[i][j]) {
1599  case 'l':
1600  listmode = 'l';
1601  break;
1602  case '1':
1603  listmode = '1';
1604  break;
1605  case 'C':
1606  listmode = 'C';
1607  break;
1608  default:
1609  (void) STRNCAT(options, option);
1610  break;
1611  }
1612  }
1613  }
1614  }
1615 
1616 
1617  if (argv[i] == NULL) {
1618  /* No directory specified, use cwd. */
1619  LLs(NULL, listmode, options, stream);
1620  } else {
1621  /* List each item. */
1622  for ( ; i<argc; i++) {
1623  LLs(argv[i], listmode, options, stream);
1624  }
1625  }
1626 
1627 #else
1628  FILE *volatile outfp;
1629  FILE *volatile infp;
1630  int i;
1631  int sj;
1632  int dashopts;
1633  char incmd[256];
1634  char line[256];
1635  vsigproc_t osigpipe, osigint;
1636 
1638  (void) fflush(stdin);
1639  outfp = OpenPager();
1640 
1641  (void) STRNCPY(incmd, "/bin/ls");
1642  for (i=1, dashopts=0; i<argc; i++) {
1643  (void) STRNCAT(incmd, " ");
1644  if (argv[i][0] == '-')
1645  dashopts++;
1646  (void) STRNCAT(incmd, argv[i]);
1647  }
1648 
1649  if (dashopts == 0) {
1650  (void) STRNCPY(incmd, "/bin/ls -CF");
1651  for (i=1; i<argc; i++) {
1652  (void) STRNCAT(incmd, " ");
1653  (void) STRNCAT(incmd, argv[i]);
1654  }
1655  }
1656 
1657  infp = popen(incmd, "r");
1658  if (infp == NULL) {
1659  ClosePager(outfp);
1660  return;
1661  }
1662 
1663 
1664 #ifdef HAVE_SIGSETJMP
1665  sj = sigsetjmp(gCancelJmp, 1);
1666 #else /* HAVE_SIGSETJMP */
1667  sj = setjmp(gCancelJmp);
1668 #endif /* HAVE_SIGSETJMP */
1669 
1670  if (sj != 0) {
1671  /* Caught a signal. */
1673  ClosePager(outfp);
1674  if (infp != NULL)
1675  (void) pclose(infp);
1676  (void) NcSignal(SIGPIPE, osigpipe);
1677  (void) NcSignal(SIGINT, osigint);
1678  (void) fprintf(stderr, "Canceled.\n");
1679  Trace(0, "Canceled because of signal %d.\n", gGotSig);
1680  gMayCancelJmp = 0;
1681  return;
1682  } else {
1683  osigpipe = NcSignal(SIGPIPE, Cancel);
1684  osigint = NcSignal(SIGINT, Cancel);
1685  gMayCancelJmp = 1;
1686  }
1687 
1688  while (fgets(line, sizeof(line) - 1, infp) != NULL)
1689  (void) fputs(line, outfp);
1690  (void) fflush(outfp);
1691 
1692  (void) pclose(infp);
1693  infp = NULL;
1694  ClosePager(outfp);
1695  outfp = NULL;
1696 
1697  (void) NcSignal(SIGPIPE, osigpipe);
1698  (void) NcSignal(SIGINT, osigint);
1699  gMayCancelJmp = 0;
1700 #endif
1701 } /* LocalListCmd */
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gGotSig
Definition: shell.c:60
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
volatile sigproc_t vsigproc_t
Definition: util.h:11
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
void LLs(const char *const, int, const char *const, FILE *)
FILE * stdin
int gMayCancelJmp
Definition: shell.c:54
#define SIGINT
Definition: signal.h:23
#define argv
Definition: mplay32.c:18
static void ClosePager(FILE *pagerfp)
Definition: cmds.c:113
FILE * stdout
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: getopt.h:108
Definition: parser.c:48
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 GLint GLint j
Definition: glfuncs.h:250
#define STRNCAT(d, s)
Definition: Strn.h:48
int gUnusedArg
Definition: cmds.c:46
void Cancel(int sigNum)
Definition: shell.c:481
jmp_buf gCancelJmp
Definition: shell.c:45
int sigsetjmp(sigjmp_buf buf, int savesigs)
void(* FTPSigProc)(int)
Definition: ncftp.h:76
#define SIGPIPE
Definition: signal.h:35
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define Trace(x)
Definition: inflate.c:42
#define pclose
Definition: syshdrs.h:73
#define NcSignal
Definition: ncftp.h:604
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
#define popen
Definition: syshdrs.h:72
#define setjmp
Definition: setjmp.h:183
#define ARGSUSED(x)
Definition: cmds.c:47
FILE * stderr
static FILE * OpenPager(void)
Definition: cmds.c:95
#define SIG_IGN
Definition: signal.h:48
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)

◆ LocalMkdirCmd()

void LocalMkdirCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1751 of file cmds.c.

1752 {
1753 #if defined(WIN32) || defined(_WINDOWS)
1754  const char *arg;
1755  int i;
1756 
1757  for (i = 1; i < argc; i++) {
1758  arg = argv[i];
1759  if (MkDirs(arg, 00755) < 0) {
1760  perror(arg);
1761  }
1762  }
1763 #else
1765  Sys(argc, argv, aip, "/bin/mkdir", 0);
1766 #endif
1767 } /* LocalMkdirCmd */
static int argc
Definition: ServiceArgs.c:12
void * arg
Definition: msvc.h:10
#define argv
Definition: mplay32.c:18
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
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
int gUnusedArg
Definition: cmds.c:46
int MkDirs(const char *const, int mode1)
Definition: util.c:785
#define ARGSUSED(x)
Definition: cmds.c:47

◆ LocalPageCmd()

void LocalPageCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1775 of file cmds.c.

1776 {
1778  Sys(argc, argv, aip, gPager, 0);
1779 } /* LocalPageCmd */
static int argc
Definition: ServiceArgs.c:12
#define argv
Definition: mplay32.c:18
int gUnusedArg
Definition: cmds.c:46
char gPager[]
Definition: pref.c:21
#define ARGSUSED(x)
Definition: cmds.c:47

◆ LocalPwdCmd()

void LocalPwdCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1871 of file cmds.c.

1872 {
1874  if (FTPGetLocalCWD(gLocalCWD, sizeof(gLocalCWD)) != NULL) {
1875  Trace(-1, "%s\n", gLocalCWD);
1876  }
1877 } /* LocalPwdCmd */
char gLocalCWD[512]
Definition: main.c:43
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
#define Trace(x)
Definition: inflate.c:42
#define ARGSUSED(x)
Definition: cmds.c:47
char * FTPGetLocalCWD(char *buf, size_t size)
Definition: util.c:29

◆ LocalRenameCmd()

void LocalRenameCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1786 of file cmds.c.

1787 {
1788 #if defined(WIN32) || defined(_WINDOWS)
1789  if (rename(argv[1], argv[2]) < 0) {
1790  perror("rename");
1791  }
1792 #else
1794  Sys(argc, argv, aip, "/bin/mv", 1);
1795 #endif
1796 } /* LocalRenameCmd */
static int argc
Definition: ServiceArgs.c:12
#define argv
Definition: mplay32.c:18
_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)
int gUnusedArg
Definition: cmds.c:46
#define ARGSUSED(x)
Definition: cmds.c:47

◆ LocalRmCmd()

void LocalRmCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1802 of file cmds.c.

1803 {
1804 #if defined(WIN32) || defined(_WINDOWS)
1805  int i;
1806  int result;
1807  LineList ll;
1808  LinePtr lp;
1809 
1811  for (i=1; i<argc; i++) {
1812  InitLineList(&ll);
1813  result = FTPLocalGlob(&gConn, &ll, argv[i], (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes);
1814  if (result < 0) {
1815  FTPPerror(&gConn, result, kErrGlobFailed, "local glob", argv[i]);
1816  } else {
1817  for (lp = ll.first; lp != NULL; lp = lp->next) {
1818  if (lp->line != NULL) {
1819  if (remove(lp->line) < 0)
1820  perror(lp->line);
1821  }
1822  }
1823  }
1825  }
1826 #else
1828  Sys(argc, argv, aip, "/bin/rm", 1);
1829 #endif
1830 } /* LocalRmCmd */
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
LinePtr next
Definition: ncftp.h:80
#define kErrGlobFailed
Definition: ncftp_errno.h:68
#define argv
Definition: mplay32.c:18
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
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
int FTPLocalGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
Definition: glob.c:1580
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
#define kGlobYes
Definition: ncftp.h:360
Definition: ncftp.h:79
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
void InitLineList(LineListPtr list)
Definition: linelist.c:54
w ll
Definition: byte_order.h:166
#define ARGSUSED(x)
Definition: cmds.c:47
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
int remove
Definition: msacm.c:1365
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81

◆ LocalRmdirCmd()

void LocalRmdirCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1836 of file cmds.c.

1837 {
1838 #if defined(WIN32) || defined(_WINDOWS)
1839  int i;
1840  int result;
1841  LineList ll;
1842  LinePtr lp;
1843 
1845  for (i=1; i<argc; i++) {
1846  InitLineList(&ll);
1847  result = FTPLocalGlob(&gConn, &ll, argv[i], (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes);
1848  if (result < 0) {
1849  FTPPerror(&gConn, result, kErrGlobFailed, "local glob", argv[i]);
1850  } else {
1851  for (lp = ll.first; lp != NULL; lp = lp->next) {
1852  if (lp->line != NULL) {
1853  if (rmdir(lp->line) < 0)
1854  perror(lp->line);
1855  }
1856  }
1857  }
1859  }
1860 #else
1862  Sys(argc, argv, aip, "/bin/rmdir", 1);
1863 #endif
1864 } /* LocalRmdirCmd */
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
LinePtr next
Definition: ncftp.h:80
#define kErrGlobFailed
Definition: ncftp_errno.h:68
#define argv
Definition: mplay32.c:18
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
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
int FTPLocalGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
Definition: glob.c:1580
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
#define kGlobYes
Definition: ncftp.h:360
Definition: ncftp.h:79
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
void InitLineList(LineListPtr list)
Definition: linelist.c:54
w ll
Definition: byte_order.h:166
#define ARGSUSED(x)
Definition: cmds.c:47
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
#define rmdir
Definition: syshdrs.h:70
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81

◆ LookupCmd()

void LookupCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1886 of file cmds.c.

1887 {
1888  int i, j;
1889  struct hostent *hp;
1890  const char *host;
1891  char **cpp;
1892  struct in_addr ip_address;
1893  int shortMode, opt;
1894  char ipStr[16];
1895 
1897  shortMode = 1;
1898 
1899  GetoptReset();
1900  while ((opt = Getopt(argc, argv, "v")) >= 0) {
1901  if (opt == 'v')
1902  shortMode = 0;
1903  else {
1904  PrintCmdUsage(cmdp);
1905  return;
1906  }
1907  }
1908 
1909  for (i=gOptInd; i<argc; i++) {
1910  hp = GetHostEntry((host = argv[i]), &ip_address);
1911  if ((i > gOptInd) && (shortMode == 0))
1912  Trace(-1, "\n");
1913  if (hp == NULL) {
1914  Trace(-1, "Unable to get information about site %s.\n", host);
1915  } else if (shortMode) {
1916  MyInetAddr(ipStr, sizeof(ipStr), hp->h_addr_list, 0);
1917  Trace(-1, "%-40s %s\n", hp->h_name, ipStr);
1918  } else {
1919  Trace(-1, "%s:\n", host);
1920  Trace(-1, " Name: %s\n", hp->h_name);
1921  for (cpp = hp->h_aliases; *cpp != NULL; cpp++)
1922  Trace(-1, " Alias: %s\n", *cpp);
1923  for (j = 0, cpp = hp->h_addr_list; *cpp != NULL; cpp++, ++j) {
1924  MyInetAddr(ipStr, sizeof(ipStr), hp->h_addr_list, j);
1925  Trace(-1, " Address: %s\n", ipStr);
1926  }
1927  }
1928  }
1929 } /* LookupCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
char ** h_addr_list
Definition: winsock.h:138
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
char * h_name
Definition: winsock.h:134
char * host
Definition: whois.c:55
char ** h_aliases
Definition: winsock.h:135
#define argv
Definition: mplay32.c:18
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
void GetoptReset(void)
Definition: getopt.c:21
smooth NULL
Definition: ftsmooth.c:416
static struct hostent * GetHostEntry(char *host, struct in_addr *ip_address)
Definition: ftp.c:53
void MyInetAddr(char *, size_t, char **, int)
Definition: util.c:185
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 GLint GLint j
Definition: glfuncs.h:250
int gUnusedArg
Definition: cmds.c:46
Definition: tcpip.h:125
#define Trace(x)
Definition: inflate.c:42
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
#define ARGSUSED(x)
Definition: cmds.c:47

◆ MkdirCmd()

void MkdirCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2011 of file cmds.c.

2012 {
2013  int i;
2014  int opt;
2015  int result;
2016  int recurseFlag = kRecursiveNo;
2017 
2019  GetoptReset();
2020  while ((opt = Getopt(argc, argv, "p")) >= 0) {
2021  if (opt == 'p') {
2022  /* Try creating intermediate directories if they
2023  * don't exist.
2024  *
2025  * For example if only /pub/stuff existed, and you
2026  * do a "mkdir -p /pub/stuff/a/b/c", the "a" and "b"
2027  * directories would also be created.
2028  */
2029  recurseFlag = kRecursiveYes;
2030  } else {
2031  PrintCmdUsage(cmdp);
2032  return;
2033  }
2034  }
2035 
2036  for (i=gOptInd; i<argc; i++) {
2037  result = FTPMkdir(&gConn, argv[i], recurseFlag);
2038  if (result < 0)
2039  FTPPerror(&gConn, result, kErrMKDFailed, "Could not mkdir", argv[i]);
2040  }
2041 
2042  /* Really should just flush only the modified directories... */
2043  FlushLsCache();
2044 } /* MkdirCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
#define kErrMKDFailed
Definition: ncftp_errno.h:57
int FTPMkdir(const FTPCIPtr cip, const char *const newDir, const int recurse)
Definition: cmds.c:641
#define argv
Definition: mplay32.c:18
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
void GetoptReset(void)
Definition: getopt.c:21
#define kRecursiveYes
Definition: ncftp.h:362
#define kRecursiveNo
Definition: ncftp.h:363
int gUnusedArg
Definition: cmds.c:46
FTPConnectionInfo gConn
Definition: main.c:37
void FlushLsCache(void)
Definition: ls.c:94
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
#define ARGSUSED(x)
Definition: cmds.c:47
GLuint64EXT * result
Definition: glext.h:11304

◆ MlsCmd()

void MlsCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 1937 of file cmds.c.

1938 {
1939  int i;
1940  int opt;
1941  LinePtr linePtr, nextLinePtr;
1942  int result;
1943  LineList dirContents;
1944  int mlsd = 1, x;
1945  const char *item;
1946 
1948  GetoptReset();
1949  while ((opt = Getopt(argc, argv, "dt")) >= 0) {
1950  if ((opt == 'd') || (opt == 't')) {
1951  /* Use MLST instead of MLSD,
1952  * which is similar to using "ls -d" instead of "ls".
1953  */
1954  mlsd = 0;
1955  } else {
1956  PrintCmdUsage(cmdp);
1957  return;
1958  }
1959  }
1960 
1961  i = gOptInd;
1962  if (i == argc) {
1963  /* No args, do current directory. */
1964  x = 1;
1965  item = "";
1966  if ((result = FTPListToMemory2(&gConn, item, &dirContents, (mlsd == 0) ? "-d" : "", 1, &x)) < 0) {
1967  if (mlsd != 0) {
1968  FTPPerror(&gConn, result, 0, "Could not MLSD", item);
1969  } else {
1970  FTPPerror(&gConn, result, 0, "Could not MLST", item);
1971  }
1972  } else {
1973  for (linePtr = dirContents.first;
1974  linePtr != NULL;
1975  linePtr = nextLinePtr)
1976  {
1977  nextLinePtr = linePtr->next;
1978  (void) fprintf(stdout, "%s\n", linePtr->line);
1979  Trace(0, "%s\n", linePtr->line);
1980  }
1981  }
1982  }
1983 
1984  for ( ; i<argc; i++) {
1985  x = 1;
1986  item = argv[i];
1987  if ((result = FTPListToMemory2(&gConn, item, &dirContents, (mlsd == 0) ? "-d" : "", 1, &x)) < 0) {
1988  if (mlsd != 0) {
1989  FTPPerror(&gConn, result, 0, "Could not MLSD", item);
1990  } else {
1991  FTPPerror(&gConn, result, 0, "Could not MLST", item);
1992  }
1993  } else {
1994  for (linePtr = dirContents.first;
1995  linePtr != NULL;
1996  linePtr = nextLinePtr)
1997  {
1998  nextLinePtr = linePtr->next;
1999  (void) fprintf(stdout, "%s\n", linePtr->line);
2000  Trace(0, "%s\n", linePtr->line);
2001  }
2002  }
2003  }
2004 } /* MlsCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
LinePtr next
Definition: ncftp.h:80
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define argv
Definition: mplay32.c:18
FILE * stdout
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void GetoptReset(void)
Definition: getopt.c:21
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
Definition: ncftp.h:79
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
#define Trace(x)
Definition: inflate.c:42
LinePtr first
Definition: ncftp.h:85
int FTPListToMemory2(const FTPCIPtr cip, const char *const pattern, const LineListPtr llines, const char *const lsflags, const int blankLines, int *const tryMLSD)
Definition: io.c:366
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
static ATOM item
Definition: dde.c:856
#define ARGSUSED(x)
Definition: cmds.c:47
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81

◆ nFTPChdirAndGetCWD()

int nFTPChdirAndGetCWD ( const  FTPCIPtr,
const char ,
const int   
)

Definition at line 417 of file cmds.c.

418 {
419  ResponsePtr rp;
420  size_t cdCwdLen;
421  int result;
422 #ifdef USE_WHAT_SERVER_SAYS_IS_CWD
423  int foundcwd;
424  char *l, *r;
425 #endif
426 
427  if (cip == NULL)
428  return (kErrBadParameter);
429  if (strcmp(cip->magic, kLibraryMagic))
430  return (kErrBadMagic);
431 
432  if ((cdCwd == NULL) || (cdCwd[0] == '\0')) {
434  cip->errNo = kErrInvalidDirParam;
435  } else {
436  rp = InitResponse();
437  if (rp == NULL) {
439  cip->errNo = kErrMallocFailed;
440  /* Error(cip, kDontPerror, "Malloc failed.\n"); */
441  } else {
442  cdCwdLen = strlen(cdCwd);
443  if (strcmp(cdCwd, "..") == 0) {
444  result = RCmd(cip, rp, "CDUP");
445  } else {
446  result = RCmd(cip, rp, "CWD %s", cdCwd);
447  }
448  if (result == 2) {
449 #ifdef USE_WHAT_SERVER_SAYS_IS_CWD
451  foundcwd = 0;
452  if ((r = strrchr(rp->msg.first->line, '"')) != NULL) {
453  /* "xxxx" is current directory.
454  * Strip out just the xxxx to copy into the remote cwd.
455  *
456  * This is nice because we didn't have to do a PWD.
457  */
458  l = strchr(rp->msg.first->line, '"');
459  if ((l != NULL) && (l != r) && (l == rp->msg.first->line)) {
460  *r = '\0';
461  ++l;
462  (void) Strncpy(gRemoteCWD, l, sizeof(gRemoteCWD));
463  *r = '"'; /* Restore, so response prints correctly. */
464  foundcwd = 1;
465  result = kNoErr;
466  }
467  }
468  if (quietMode)
470  NcFTPCdResponseProc(cip, rp);
471  DoneWithResponse(cip, rp);
472  if (foundcwd == 0) {
473  result = FTPGetCWD(cip, gRemoteCWD, sizeof(gRemoteCWD));
474  if (result != kNoErr) {
475  PathCat(gRemoteCWD, sizeof(gRemoteCWD), gScratchCWD, cdCwd);
476  result = kNoErr;
477  }
478  }
479 #else /* USE_CLIENT_SIDE_CALCULATED_CWD */
480  if (quietMode)
482  NcFTPCdResponseProc(cip, rp);
483  DoneWithResponse(cip, rp);
485  PathCat(gRemoteCWD, sizeof(gRemoteCWD), gScratchCWD, cdCwd);
486  result = kNoErr;
487 #endif
488  } else if (result > 0) {
490  cip->errNo = kErrCWDFailed;
491  DoneWithResponse(cip, rp);
492  } else {
493  DoneWithResponse(cip, rp);
494  }
495  }
496  }
497  return (result);
498 } /* nFTPChdirAndGetCWD */
int printMode
Definition: ncftp.h:93
#define kErrInvalidDirParam
Definition: ncftp_errno.h:39
static void NcFTPCdResponseProc(const FTPCIPtr cipUNUSED, ResponsePtr rp)
Definition: cmds.c:371
#define kErrBadParameter
Definition: ncftp_errno.h:56
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int RCmd(const FTPCIPtr, ResponsePtr, const char *,...)
Definition: rcmd.c:718
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
void DoneWithResponse(const FTPCIPtr, ResponsePtr)
Definition: rcmd.c:114
char gScratchCWD[512]
Definition: cmds.c:41
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define kErrMallocFailed
Definition: ncftp_errno.h:40
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
void PathCat(char *const dst, const size_t dsize, const char *const cwd, const char *const src)
Definition: util.c:368
smooth NULL
Definition: ftsmooth.c:416
r l[0]
Definition: byte_order.h:167
#define kErrBadMagic
Definition: ncftp_errno.h:55
Definition: ncftp.h:89
char gRemoteCWD[512]
Definition: cmds.c:33
LinePtr first
Definition: ncftp.h:85
LineList msg
Definition: ncftp.h:90
#define kResponseNoPrint
Definition: ncftp.h:308
char * Strncpy(char *const, const char *const, const size_t)
Definition: Strncpy.c:11
int FTPGetCWD(const FTPCIPtr cip, char *const newCwd, const size_t newCwdSize)
Definition: cmds.c:254
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define kLibraryMagic
Definition: ncftp.h:65
#define kNoErr
Definition: ncftp_errno.h:9
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ResponsePtr InitResponse(void)
Definition: rcmd.c:38
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81
#define kErrCWDFailed
Definition: ncftp_errno.h:42

Referenced by Chdirs().

◆ OpenCmd()

void OpenCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2317 of file cmds.c.

2318 {
2319  int c;
2320  int opts = 0;
2321  int uOptInd = 0;
2322  int n;
2323  int rc;
2324  char url[256];
2325  char urlfile[128];
2326  int directoryURL = 0;
2327  LineList cdlist;
2328  LinePtr lp;
2329  char prompt[256];
2330 
2332  FlushLsCache();
2333  CloseHost();
2334  gLoadedBm = 0;
2336 
2337  /* Need to find the host argument first. */
2338  GetoptReset();
2339  while ((c = Getopt(argc, argv, "aP:u:p:J:rd:g:")) > 0) switch(c) {
2340  case 'u':
2341  uOptInd = gOptInd + 1;
2342  opts++;
2343  break;
2344  default:
2345  opts++;
2346  }
2347  if (gOptInd < argc) {
2349  (void) STRNCPY(url, argv[gOptInd]);
2350  } else if (uOptInd > argc) {
2351  /* Special hack for v2.4.2 compatibility */
2352  (void) STRNCPY(gConn.host, argv[argc - 1]);
2353  (void) STRNCPY(url, argv[argc - 1]);
2354  } else {
2355  /* No host arg */
2356  if (opts > 0) {
2357  PrintCmdUsage(cmdp);
2358  } else if (RunBookmarkEditor(gConn.host, sizeof(gConn.host)) == 0) {
2359  if (gConn.host[0] != '\0') {
2360  gLoadedBm = 1;
2361  /* okay, now fall through */
2362  } else {
2363  return;
2364  }
2365  } else if (PrintHosts() <= 0) {
2366  (void) printf("You haven't bookmarked any FTP sites.\n");
2367  (void) printf("Before closing a site, you can use the \"bookmark\" command to save the current\nhost and directory for next time.\n");
2368  return;
2369  } else {
2370  (void) printf("\nTo use a bookmark, use the \"open\" command with the name of the bookmark.\n");
2371  return;
2372  }
2373  }
2374 
2375  InitLineList(&cdlist);
2376 
2377  if (GetBookmark(gConn.host, &gBm) >= 0) {
2378  gLoadedBm = 1;
2379  (void) STRNCPY(gConn.host, gBm.name);
2380  (void) STRNCPY(gConn.user, gBm.user);
2381  (void) STRNCPY(gConn.pass, gBm.pass);
2382  (void) STRNCPY(gConn.acct, gBm.acct);
2386  gConn.port = gBm.port;
2387 
2388  /* Note: Version 3 only goes off of the
2389  * global "gDataPortMode" setting instead of
2390  * setting the dataPortMode on a per-site
2391  * basis.
2392  */
2394  } else {
2396 
2397  memcpy(&gTmpURLConn, &gConn, sizeof(gTmpURLConn));
2398  rc = DecodeDirectoryURL(&gTmpURLConn, url, &cdlist, urlfile, sizeof(urlfile));
2399  if (rc == kMalformedURL) {
2400  (void) fprintf(stdout, "Malformed URL: %s\n", url);
2401  DisposeLineListContents(&cdlist);
2402  return;
2403  } else if (rc == kNotURL) {
2404  directoryURL = 0;
2405  } else {
2406  /* It was a URL. */
2407  if (urlfile[0] != '\0') {
2408  /* It was obviously not a directory */
2409  (void) fprintf(stdout, "Use ncftpget or ncftpput to handle file URLs.\n");
2410  DisposeLineListContents(&cdlist);
2411  return;
2412  }
2413  memcpy(&gConn, &gTmpURLConn, sizeof(gConn));
2414  directoryURL = 1;
2415  }
2416  }
2417 
2424  }
2425 
2426  GetoptReset();
2427  while ((c = Getopt(argc, argv, "aP:u:p:J:j:rd:g:")) > 0) switch(c) {
2428  case 'J':
2429  case 'j':
2431  break;
2432  case 'a':
2433  (void) STRNCPY(gConn.user, "anonymous");
2434  (void) STRNCPY(gConn.pass, "");
2435  (void) STRNCPY(gConn.acct, "");
2436  break;
2437  case 'P':
2438  gConn.port = atoi(gOptArg);
2439  break;
2440  case 'u':
2441  if (uOptInd <= argc)
2443  break;
2444  case 'p':
2445  (void) STRNCPY(gConn.pass, gOptArg); /* Don't recommend doing this! */
2446  break;
2447  case 'r':
2448  /* redial is on by default */
2449  break;
2450  case 'g':
2451  n = atoi(gOptArg);
2452  gConn.maxDials = n;
2453  break;
2454  case 'd':
2455  n = atoi(gOptArg);
2456  if (n >= 10)
2457  gConn.redialDelay = n;
2458  break;
2459  default:
2460  PrintCmdUsage(cmdp);
2461  DisposeLineListContents(&cdlist);
2462  return;
2463  }
2464 
2465  if (uOptInd > argc) {
2466  (void) STRNCPY(prompt, "Username at ");
2467  (void) STRNCAT(prompt, gConn.host);
2468  (void) STRNCAT(prompt, ": ");
2469  (void) gl_getpass(prompt, gConn.user, sizeof(gConn.user));
2470  }
2471 
2472  rc = DoOpen();
2473  if ((rc >= 0) && (directoryURL != 0)) {
2474  for (lp = cdlist.first; lp != NULL; lp = lp->next) {
2475  rc = FTPChdir(&gConn, lp->line);
2476  if (rc != kNoErr) {
2477  FTPPerror(&gConn, rc, kErrCWDFailed, "Could not chdir to", lp->line);
2478  break;
2479  }
2480  }
2481  rc = FTPGetCWD(&gConn, gRemoteCWD, sizeof(gRemoteCWD));
2482  if (rc != kNoErr) {
2484  } else {
2485  (void) printf("Current remote directory is %s.\n", gRemoteCWD);
2486  }
2487  }
2488  DisposeLineListContents(&cdlist);
2489 } /* OpenCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
unsigned int port
Definition: ncftp.h:140
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static int PrintHosts(void)
Definition: cmds.c:1143
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
char pass[64]
Definition: ncftp.h:138
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
char gFirewallExceptionList[]
Definition: preffw.c:21
char user[64]
Definition: ncftp.h:137
GLdouble n
Definition: glext.h:7729
int gFirewallType
Definition: preffw.c:17
char name[64]
Definition: bookmark.h:11
LinePtr next
Definition: ncftp.h:80
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
char gFirewallPass[32]
Definition: preffw.c:20
int hasMDTM
Definition: bookmark.h:21
#define argv
Definition: mplay32.c:18
int hasPASV
Definition: bookmark.h:22
int hasSIZE
Definition: bookmark.h:20
char * gOptArg
Definition: getopt.c:16
unsigned int gFirewallPort
Definition: preffw.c:22
FILE * stdout
#define kErrPWDFailed
Definition: ncftp_errno.h:41
char host[64]
Definition: ncftp.h:136
static int RunBookmarkEditor(char *selectedBmName, size_t dsize)
Definition: cmds.c:1187
unsigned int port
Definition: bookmark.h:18
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void GetoptReset(void)
Definition: getopt.c:21
char firewallHost[64]
Definition: ncftp.h:217
char * gl_getpass(const char *const prompt, char *const pass, int dsize)
Definition: getline.c:2051
#define kMalformedURL
Definition: ncftp.h:385
smooth NULL
Definition: ftsmooth.c:416
char pass[64]
Definition: bookmark.h:13
int firewallType
Definition: ncftp.h:221
char gFirewallHost[64]
Definition: preffw.c:18
void InitConnectionInfo(void)
Definition: main.c:109
char firewallPass[64]
Definition: ncftp.h:219
#define STRNCAT(d, s)
Definition: Strn.h:48
char user[64]
Definition: bookmark.h:12
int GetBookmark(const char *const bmabbr, Bookmark *bmp)
Definition: bookmark.c:387
int gUnusedArg
Definition: cmds.c:46
char acct[64]
Definition: ncftp.h:139
static const WCHAR url[]
Definition: encode.c:1432
#define kNotURL
Definition: ncftp.h:384
const GLubyte * c
Definition: glext.h:8905
Bookmark gBm
Definition: bookmark.c:24
Definition: ncftp.h:79
char firewallUser[64]
Definition: ncftp.h:218
char gFirewallUser[32]
Definition: preffw.c:19
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
char gRemoteCWD[512]
Definition: cmds.c:33
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int DecodeDirectoryURL(const FTPCIPtr cip, char *url, LineListPtr cdlist, char *fn, size_t fnsize)
Definition: util.c:1086
LinePtr first
Definition: ncftp.h:85
void FlushLsCache(void)
Definition: ls.c:94
int FTPChdir(const FTPCIPtr cip, const char *const cdCwd)
Definition: cmds.c:11
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
void SetBookmarkDefaults(BookmarkPtr bmp)
Definition: bookmark.c:74
void CloseHost(void)
Definition: main.c:153
void InitLineList(LineListPtr list)
Definition: linelist.c:54
int FTPGetCWD(const FTPCIPtr cip, char *const newCwd, const size_t newCwdSize)
Definition: cmds.c:254
int hasUTIME
Definition: bookmark.h:27
unsigned int firewallPort
Definition: ncftp.h:220
#define ARGSUSED(x)
Definition: cmds.c:47
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define c
Definition: ke_i.h:80
#define kNoErr
Definition: ncftp_errno.h:9
char acct[64]
Definition: bookmark.h:14
int DoOpen(void)
Definition: cmds.c:2168
int gLoadedBm
Definition: bookmark.c:25
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
int MayUseFirewall(const char *const hn, int firewallType, const char *const firewallExceptionList)
Definition: util.c:695
char * line
Definition: ncftp.h:81
#define kErrCWDFailed
Definition: ncftp_errno.h:42
FTPConnectionInfo gTmpURLConn
Definition: cmds.c:50
#define printf
Definition: config.h:203

Referenced by HostsCmd().

◆ PageCmd()

void PageCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2496 of file cmds.c.

2497 {
2498  int result;
2499  int i;
2500  FILE *volatile stream;
2501 #if defined(WIN32) || defined(_WINDOWS)
2502 #else
2503  int sj;
2504  vsigproc_t osigpipe, osigint;
2505 #endif
2506 
2508  stream = OpenPager();
2509  if (stream == NULL) {
2510  return;
2511  }
2512 
2513 #if defined(WIN32) || defined(_WINDOWS)
2514 #else
2515 
2516 #ifdef HAVE_SIGSETJMP
2517  osigpipe = osigint = (sigproc_t) 0;
2518  sj = sigsetjmp(gCancelJmp, 1);
2519 #else /* HAVE_SIGSETJMP */
2520  osigpipe = osigint = (sigproc_t) 0;
2521  sj = setjmp(gCancelJmp);
2522 #endif /* HAVE_SIGSETJMP */
2523 
2524  if (sj != 0) {
2525  /* Caught a signal. */
2527  ClosePager(stream);
2528  (void) NcSignal(SIGPIPE, osigpipe);
2529  (void) NcSignal(SIGINT, osigint);
2530  (void) fprintf(stderr, "Canceled.\n");
2531  Trace(0, "Canceled because of signal %d.\n", gGotSig);
2532  gMayCancelJmp = 0;
2533  return;
2534  } else {
2535  osigpipe = NcSignal(SIGPIPE, Cancel);
2536  osigint = NcSignal(SIGINT, Cancel);
2537  gMayCancelJmp = 1;
2538  }
2539 
2540 #endif
2541 
2542  for (i=1; i<argc; i++) {
2544  if (result < 0) {
2545  if (errno != EPIPE) {
2546  ClosePager(stream);
2547  stream = NULL;
2549  }
2550  break;
2551  }
2552  }
2553 
2554 #if defined(WIN32) || defined(_WINDOWS)
2555  ClosePager(stream);
2556 #else
2558  ClosePager(stream);
2559  (void) NcSignal(SIGPIPE, osigpipe);
2560  (void) NcSignal(SIGINT, osigint);
2561 #endif
2562  gMayCancelJmp = 0;
2563 } /* PageCmd */
#define EPIPE
Definition: acclib.h:91
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gGotSig
Definition: shell.c:60
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
volatile sigproc_t vsigproc_t
Definition: util.h:11
int gMayCancelJmp
Definition: shell.c:54
#define SIGINT
Definition: signal.h:23
int errno
#define argv
Definition: mplay32.c:18
static void ClosePager(FILE *pagerfp)
Definition: cmds.c:113
int FTPGetOneFile2(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int resumeflag, const int appendflag)
Definition: io.c:2721
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
void Cancel(int sigNum)
Definition: shell.c:481
jmp_buf gCancelJmp
Definition: shell.c:45
int sigsetjmp(sigjmp_buf buf, int savesigs)
void(* FTPSigProc)(int)
Definition: ncftp.h:76
#define kTypeAscii
Definition: ncftp.h:353
#define SIGPIPE
Definition: signal.h:35
FTPConnectionInfo gConn
Definition: main.c:37
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define Trace(x)
Definition: inflate.c:42
#define kResumeNo
Definition: ncftp.h:367
#define NcSignal
Definition: ncftp.h:604
void(* sigproc_t)(int)
Definition: util.h:10
#define setjmp
Definition: setjmp.h:183
#define ARGSUSED(x)
Definition: cmds.c:47
#define kErrCouldNotStartDataTransfer
Definition: ncftp_errno.h:77
FILE * stderr
static FILE * OpenPager(void)
Definition: cmds.c:95
_Check_return_ _CRTIMP int __cdecl _fileno(_In_ FILE *_File)
#define SIG_IGN
Definition: signal.h:48
GLuint64EXT * result
Definition: glext.h:11304
#define kAppendNo
Definition: ncftp.h:365

◆ PrintResp()

void PrintResp ( LineListPtr  )

Definition at line 396 of file cmds.c.

397 {
398  LinePtr lp;
399 
400  if (llp != NULL) {
401  for (lp = llp->first; lp != NULL; lp = lp->next) {
402  if ((lp == llp->first) && (ISTRNCMP(lp->line, "CWD command", 11) == 0))
403  continue;
404  (void) printf("%s\n", lp->line);
405  }
406  }
407 } /* PrintResp */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
LinePtr next
Definition: ncftp.h:80
smooth NULL
Definition: ftsmooth.c:416
Definition: ncftp.h:79
#define ISTRNCMP
Definition: util.h:29
char * line
Definition: ncftp.h:81
#define printf
Definition: config.h:203

Referenced by NcFTPOnConnectMessageProc(), NcFTPOnLoginMessageProc(), NcFTPOpenPrintResponseProc(), QuoteCmd(), and SiteCmd().

◆ PromptForBookmarkName()

int PromptForBookmarkName ( BookmarkPtr  )

Definition at line 135 of file cmds.c.

136 {
137  char dfltname[64];
138  char bmname[64];
139 
140  DefaultBookmarkName(dfltname, sizeof(dfltname), gConn.host);
141  if (dfltname[0] == '\0') {
142  (void) printf("Enter a name for this bookmark: ");
143  } else {
144  (void) printf("Enter a name for this bookmark, or hit enter for \"%s\": ", dfltname);
145  }
146  fflush(stdin);
147  (void) FGets(bmname, sizeof(bmname), stdin);
148  if (bmname[0] != '\0') {
149  (void) STRNCPY(bmp->bookmarkName, bmname);
150  return (0);
151  } else if (dfltname[0] != '\0') {
152  (void) STRNCPY(bmp->bookmarkName, dfltname);
153  return (0);
154  }
155  return (-1);
156 } /* PromptForBookmarkName */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
FILE * stdin
char host[64]
Definition: ncftp.h:136
char * FGets(char *, size_t, FILE *)
Definition: util.c:111
BITMAP bmp
Definition: alphablend.c:62
FTPConnectionInfo gConn
Definition: main.c:37
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
void DefaultBookmarkName(char *dst, size_t siz, char *src)
Definition: bookmark.c:817
#define printf
Definition: config.h:203

Referenced by BookmarkCmd(), and SaveUnsavedBookmark().

◆ PutCmd()

void PutCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2768 of file cmds.c.

2769 {
2770  int opt;
2771  int renameMode = 0;
2772  int recurseFlag = kRecursiveNo;
2773  int appendFlag = kAppendNo;
2774  const char *dstdir = NULL;
2775  int rc;
2776  int i;
2777  int doGlob;
2778  int xtype = gBm.xferType;
2779  int nD = 0;
2780  int deleteFlag = kDeleteNo;
2781  int resumeFlag = kResumeYes;
2782  char pattern[256];
2783  vsigproc_t osigint;
2784  ConfirmResumeUploadProc confirmProc;
2785 
2786  confirmProc = NcFTPConfirmResumeUploadProc;
2787  gResumeAnswerAll = kConfirmResumeProcNotUsed; /* Ask at least once each time */
2789  GetoptReset();
2790  while ((opt = Getopt(argc, argv, "AafZzrRD")) >= 0) switch (opt) {
2791  case 'a':
2792  xtype = kTypeAscii;
2793  break;
2794  case 'A':
2795  /* Append to remote files, instead of truncating
2796  * them first.
2797  */
2798  appendFlag = kAppendYes;
2799  break;
2800  case 'f':
2801  case 'Z':
2802  /* Do not try to resume a download, even if it
2803  * appeared that some of the file was transferred
2804  * already.
2805  */
2806  resumeFlag = kResumeNo;
2807  confirmProc = NoConfirmResumeUploadProc;
2808  break;
2809  case 'z':
2810  /* Special flag that lets you specify the
2811  * destination file. Normally a "put" will
2812  * write the file by the same name as the
2813  * local file's basename.
2814  */
2815  renameMode = 1;
2816  break;
2817  case 'r':
2818  case 'R':
2819  recurseFlag = kRecursiveYes;
2820  /* If the item is a directory, get the
2821  * directory and all its contents.
2822  */
2823  recurseFlag = kRecursiveYes;
2824  break;
2825  case 'D':
2826  /* You can delete the local file after
2827  * you uploaded it successfully by using
2828  * the -DD option. It requires two -D's
2829  * to minimize the odds of accidentally
2830  * using a single -D.
2831  */
2832  nD++;
2833  break;
2834  default:
2835  PrintCmdUsage(cmdp);
2836  return;
2837  }
2838 
2839  if (nD >= 2)
2840  deleteFlag = kDeleteYes;
2841 
2842  if (renameMode != 0) {
2843  if (gOptInd > (argc - 2)) {
2844  PrintCmdUsage(cmdp);
2845  (void) fprintf(stderr, "\nFor put with rename, try \"put -z local-path-name remote-path-name\".\n");
2846  return;
2847  }
2848  osigint = NcSignal(SIGINT, XferCanceller);
2849  rc = FTPPutOneFile3(&gConn, argv[gOptInd], argv[gOptInd + 1], xtype, (-1), appendFlag, NULL, NULL, resumeFlag, deleteFlag, confirmProc, 0);
2850  if (rc < 0)
2852  } else {
2853  osigint = NcSignal(SIGINT, XferCanceller);
2854  for (i=gOptInd; i<argc; i++) {
2855  doGlob = (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes;
2856  STRNCPY(pattern, argv[i]);
2858  rc = FTPPutFiles3(&gConn, pattern, dstdir, recurseFlag, doGlob, xtype, appendFlag, NULL, NULL, resumeFlag, deleteFlag, confirmProc, 0);
2859  if (rc < 0)
2861  }
2862  }
2863 
2864  /* Really should just flush only the modified directories... */
2865  FlushLsCache();
2866 
2867  (void) NcSignal(SIGINT, osigint);
2868  (void) fflush(stdin);
2869 } /* PutCmd */
int gOptInd
Definition: getopt.c:14
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
volatile sigproc_t vsigproc_t
Definition: util.h:11
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
FILE * stdin
#define SIGINT
Definition: signal.h:23
#define argv
Definition: mplay32.c:18
int FTPPutOneFile3(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const ConfirmResumeUploadProc resumeProc, int UNUSED(reserved))
Definition: io.c:1262
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void GetoptReset(void)
Definition: getopt.c:21
smooth NULL
Definition: ftsmooth.c:416
#define kRecursiveYes
Definition: ncftp.h:362
#define kRecursiveNo
Definition: ncftp.h:363
#define kDeleteNo
Definition: ncftp.h:369
#define kResumeYes
Definition: ncftp.h:366
int gUnusedArg
Definition: cmds.c:46
#define NoConfirmResumeUploadProc
Definition: ncftp.h:452
int FTPPutFiles3(const FTPCIPtr cip, const char *const pattern, const char *const dstdir1, const int recurse, const int doGlob, const int xtype, int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const ConfirmResumeUploadProc resumeProc, int UNUSED(reserved))
Definition: io.c:1298
int(* ConfirmResumeUploadProc)(const char *volatile localpath, volatile longest_int localsize, volatile time_t localmtime, const char *volatile *remotepath, volatile longest_int remotesize, volatile time_t remotetime, volatile longest_int *volatile startPoint)
Definition: ncftp.h:441
#define kGlobYes
Definition: ncftp.h:360
static int NcFTPConfirmResumeUploadProc(const char *volatile localpath, volatile longest_int localsize, volatile time_t localmtime, const char *volatile *remotepath, volatile longest_int remotesize, volatile time_t remotemtime, volatile longest_int *volatile startPoint)
Definition: cmds.c:2569
Bookmark gBm
Definition: bookmark.c:24
#define kTypeAscii
Definition: ncftp.h:353
#define kDeleteYes
Definition: ncftp.h:368
FTPConnectionInfo gConn
Definition: main.c:37
#define kResumeNo
Definition: ncftp.h:367
void FlushLsCache(void)
Definition: ls.c:94
int Getopt(int nargc, const char **const nargv, const char *const ostr)
Definition: getopt.c:42
#define NcSignal
Definition: ncftp.h:604
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
int gResumeAnswerAll
Definition: cmds.c:55
#define kConfirmResumeProcNotUsed
Definition: ncftp.h:423
void XferCanceller(int sigNum)
Definition: shell.c:419
void StrRemoveTrailingSlashes(char *dst)
Definition: util.c:768
#define ARGSUSED(x)
Definition: cmds.c:47
#define kErrCouldNotStartDataTransfer
Definition: ncftp_errno.h:77
FILE * stderr
#define kAppendYes
Definition: ncftp.h:364
int xferType
Definition: bookmark.h:17
#define kAppendNo
Definition: ncftp.h:365
GLubyte * pattern
Definition: glext.h:7787

◆ PwdCmd()

void PwdCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2876 of file cmds.c.

2877 {
2878  int result;
2879  char url[256];
2880  char olddir[256];
2881 
2883 #ifdef USE_WHAT_SERVER_SAYS_IS_CWD
2884  result = FTPGetCWD(&gConn, gRemoteCWD, sizeof(gRemoteCWD));
2885  CurrentURL(url, sizeof(url), 0);
2886  if (result < 0) {
2887  FTPPerror(&gConn, result, kErrPWDFailed, "Could not get remote working directory", NULL);
2888  } else {
2889  Trace(-1, "%s\n", url);
2890  }
2891 #else /* USE_CLIENT_SIDE_CALCULATED_CWD */
2892 
2893  /* Display the current working directory, as
2894  * maintained by us.
2895  */
2896  CurrentURL(url, sizeof(url), 0);
2897  Trace(-1, " %s\n", url);
2898  olddir[sizeof(olddir) - 2] = '\0';
2899  STRNCPY(olddir, gRemoteCWD);
2900 
2901  /* Now see what the server reports as the CWD.
2902  * Because of symlinks, it could be different
2903  * from what we are using.
2904  */
2905  result = FTPGetCWD(&gConn, gRemoteCWD, sizeof(gRemoteCWD));
2906  if ((result == kNoErr) && (strcmp(gRemoteCWD, olddir) != 0)) {
2907  Trace(-1, "This URL is also valid on this server:\n");
2908  CurrentURL(url, sizeof(url), 0);
2909  Trace(-1, " %s\n", url);
2910  if (olddir[sizeof(olddir) - 2] == '\0') {
2911  /* Go back to using the non-resolved version. */
2912  STRNCPY(gRemoteCWD, olddir);
2913  }
2914  }
2915 #endif
2916 } /* PwdCmd */
void CurrentURL(char *dst, size_t dsize, int showpass)
Definition: cmds.c:161
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define kErrPWDFailed
Definition: ncftp_errno.h:41
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
static const WCHAR url[]
Definition: encode.c:1432
FTPConnectionInfo gConn
Definition: main.c:37
char gRemoteCWD[512]
Definition: cmds.c:33
#define Trace(x)
Definition: inflate.c:42
int FTPGetCWD(const FTPCIPtr cip, char *const newCwd, const size_t newCwdSize)
Definition: cmds.c:254
#define ARGSUSED(x)
Definition: cmds.c:47
#define kNoErr
Definition: ncftp_errno.h:9
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint64EXT * result
Definition: glext.h:11304

◆ QuitCmd()

void QuitCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2923 of file cmds.c.

2924 {
2926  gDoneApplication = 1;
2927 } /* QuitCmd */
int gUnusedArg
Definition: cmds.c:46
#define ARGSUSED(x)
Definition: cmds.c:47
int gDoneApplication
Definition: shell.c:21

◆ QuoteCmd()

void QuoteCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2934 of file cmds.c.

2935 {
2936  char cmdbuf[256];
2937  int i;
2938 
2940  (void) STRNCPY(cmdbuf, argv[1]);
2941  for (i=2; i<argc; i++) {
2942  (void) STRNCAT(cmdbuf, " ");
2943  (void) STRNCAT(cmdbuf, argv[i]);
2944  }
2945  (void) FTPCmd(&gConn, "%s", cmdbuf);
2947 } /* QuoteCmd */
LineList lastFTPCmdResultLL
Definition: ncftp.h:215
static int argc
Definition: ServiceArgs.c:12
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
#define argv
Definition: mplay32.c:18
void PrintResp(LineListPtr llp)
Definition: cmds.c:396
int FTPCmd(const FTPCIPtr cip, const char *const cmdspec,...)
Definition: rcmd.c:603
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
#define STRNCAT(d, s)
Definition: Strn.h:48
int gUnusedArg
Definition: cmds.c:46
FTPConnectionInfo gConn
Definition: main.c:37
#define ARGSUSED(x)
Definition: cmds.c:47

◆ RenameCmd()

void RenameCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2988 of file cmds.c.

2989 {
2990  int result;
2991 
2993  result = FTPRename(&gConn, argv[1], argv[2]);
2994  if (result < 0)
2995  FTPPerror(&gConn, result, kErrRenameFailed, "rename", argv[1]);
2996  else {
2997  /* Really should just flush only the modified directories... */
2998  FlushLsCache();
2999  }
3000 } /* RenameCmd */
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
#define argv
Definition: mplay32.c:18
int gUnusedArg
Definition: cmds.c:46
int FTPRename(const FTPCIPtr cip, const char *const oldname, const char *const newname)
Definition: cmds.c:703
FTPConnectionInfo gConn
Definition: main.c:37
void FlushLsCache(void)
Definition: ls.c:94
#define ARGSUSED(x)
Definition: cmds.c:47
GLuint64EXT * result
Definition: glext.h:11304
#define kErrRenameFailed
Definition: ncftp_errno.h:67

◆ RGlobCmd()

void RGlobCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 2954 of file cmds.c.

2955 {
2956  int i;
2957  int result;
2958  int np = 0;
2959  LineList ll;
2960  LinePtr lp;
2961 
2963  for (i=1; i<argc; i++) {
2964  InitLineList(&ll);
2965  result = FTPRemoteGlob(&gConn, &ll, argv[i], (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes);
2966  if (result < 0) {
2967  FTPPerror(&gConn, result, kErrGlobFailed, "remote glob", argv[i]);
2968  } else {
2969  for (lp = ll.first; lp != NULL; lp = lp->next) {
2970  if (lp->line != NULL) {
2971  if (np > 0)
2972  (void) printf(" ");
2973  (void) printf("%s", lp->line);
2974  np++;
2975  }
2976  }
2977  }
2979  }
2980  (void) printf("\n");
2981 } /* RGlobCmd */
static int argc
Definition: ServiceArgs.c:12
#define kGlobNo
Definition: ncftp.h:361
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2)
Definition: errno.c:134
LinePtr next
Definition: ncftp.h:80
#define kErrGlobFailed
Definition: ncftp_errno.h:68
#define argv
Definition: mplay32.c:18
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
smooth NULL
Definition: ftsmooth.c:416
int gUnusedArg
Definition: cmds.c:46
#define kGlobYes
Definition: ncftp.h:360
Definition: ncftp.h:79
Definition: ncftp.h:84
FTPConnectionInfo gConn
Definition: main.c:37
int FTPRemoteGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
Definition: glob.c:1341
void InitLineList(LineListPtr list)
Definition: linelist.c:54
w ll
Definition: byte_order.h:166
#define ARGSUSED(x)
Definition: cmds.c:47
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
GLuint64EXT * result
Definition: glext.h:11304
char * line
Definition: ncftp.h:81
#define printf
Definition: config.h:203

◆ RmdirCmd()

void RmdirCmd ( const int  ,
const char ** const  ,
const  CommandPtr,
const  ArgvInfoPtr 
)

Definition at line 3007 of file cmds.c.

3008 {
3009  int result;
3010  int i, c;
3011  int recursive = kRecursiveNo;
3012 
3014  GetoptReset();
3015  while ((c = Getopt(argc, argv, "rf")) > 0) switch(c) {
3016  case 'r':
3017  recursive = kRecursiveYes;
3018  break;
3019  case 'f':
3020  /* ignore */
3021  break;
3022  default:
3023  PrintCmdUsage(cmdp);
3024  return;
3025  }
3026  for (i=gOptInd; i<argc; i++) {
3027  result = FTPRmdir(&gConn, argv[i], recursive, (aip->noglobargv[i] != 0) ? kGlobNo: kGlobYes);
3028  if (result < 0)
3029