ReactOS  0.4.14-dev-342-gdc047f9
shell.c File Reference
#include "syshdrs.h"
#include "shell.h"
#include "util.h"
#include "bookmark.h"
#include "cmds.h"
#include "readln.h"
#include "trace.h"
#include "main.h"
Include dependency graph for shell.c:

Go to the source code of this file.

Functions

static int CommandSortCmp (const CommandPtr a, const CommandPtr b)
 
void InitCommandList (void)
 
static int CommandExactSearchCmp (const char *const key, const CommandPtr b)
 
static int CommandSubSearchCmp (const char *const key, const CommandPtr a)
 
CommandPtr GetCommandByIndex (const int i)
 
CommandPtr GetCommandByName (const char *const name, int wantExactMatch)
 
void PrintCmdHelp (CommandPtr c)
 
void PrintCmdUsage (CommandPtr c)
 
int MakeArgv (char *line, int *cargc, const char **cargv, int cargcmax, char *dbuf, size_t dbufsize, int *noglobargv, int readlineHacks)
 
static int DoCommand (const ArgvInfoPtr aip)
 
void XferCanceller (int sigNum)
 
void BackToTop (int sigNum)
 
void Cancel (int sigNum)
 
void CommandShell (void)
 

Variables

int gDoneApplication = 0
 
int gNumInterruptions = 0
 
int gEventNumber = 0
 
jmp_buf gCancelJmp
 
jmp_buf gBackToTopJmp
 
int gMayCancelJmp = 0
 
int gMayBackToTopJmp = 0
 
int gGotSig = 0
 
int gRunningCommand = 0
 
int gCancelCtrl = 0
 
Command gCommands []
 
size_t gNumCommands
 
int gStartupUrlParameterGiven
 
FTPLibraryInfo gLib
 
FTPConnectionInfo gConn
 
LineList gStartupURLCdList
 
int gNumProgramRuns
 
char gCopyright []
 

Function Documentation

◆ BackToTop()

void BackToTop ( int  sigNum)

Definition at line 452 of file shell.c.

453 {
454  gGotSig = sigNum;
455  if (sigNum == SIGPIPE) {
456  if (gRunningCommand == 1) {
457  (void) fprintf(stderr, "Unexpected broken pipe.\n");
458  gRunningCommand = 0;
459  } else {
460  SetXtermTitle("RESTORE");
461  exit(1);
462  }
463  } else if (sigNum == SIGINT) {
464  if (gRunningCommand == 0)
465  gDoneApplication = 1;
466  }
467  if (gMayBackToTopJmp > 0) {
468 #ifdef HAVE_SIGSETJMP
470 #else /* HAVE_SIGSETJMP */
472 #endif /* HAVE_SIGSETJMP */
473  }
474 } /* BackToTop */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gDoneApplication
Definition: shell.c:21
int gGotSig
Definition: shell.c:60
int gRunningCommand
Definition: shell.c:63
#define SIGINT
Definition: signal.h:23
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void SetXtermTitle(const char *const fmt,...)
Definition: readln.c:718
int longjmp(jmp_buf buf, int retval)
void siglongjmp(sigjmp_buf buf, int val)
#define SIGPIPE
Definition: signal.h:35
jmp_buf gBackToTopJmp
Definition: shell.c:50
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33
int gMayBackToTopJmp
Definition: shell.c:57

Referenced by CommandShell().

◆ Cancel()

void Cancel ( int  sigNum)

Definition at line 481 of file shell.c.

482 {
483  if (gMayCancelJmp != 0) {
484  gGotSig = sigNum;
485  gMayCancelJmp = 0;
486 #ifdef HAVE_SIGSETJMP
488 #else /* HAVE_SIGSETJMP */
489  longjmp(gCancelJmp, 1);
490 #endif /* HAVE_SIGSETJMP */
491  }
492 } /* Cancel */
int gGotSig
Definition: shell.c:60
int longjmp(jmp_buf buf, int retval)
void siglongjmp(sigjmp_buf buf, int val)
int gMayCancelJmp
Definition: shell.c:54
jmp_buf gCancelJmp
Definition: shell.c:45

Referenced by CreateExtendedPartitionPage(), CreateLogicalPartitionPage(), CreatePrimaryPartitionPage(), DECLARE_INTERFACE_(), DECLSPEC_ALIGN(), ListCmd(), LocalListCmd(), PageCmd(), and ShowPartitionSizeInputBox().

◆ CommandExactSearchCmp()

static int CommandExactSearchCmp ( const char *const  key,
const CommandPtr  b 
)
static

Definition at line 102 of file shell.c.

103 {
104  return (strcmp(key, (*b).name));
105 } /* CommandExactSearchCmp */
WCHAR * name
Definition: path.c:44
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: path.c:42

Referenced by GetCommandByName().

◆ CommandShell()

void CommandShell ( void  )

Definition at line 499 of file shell.c.

500 {
501  int tUsed, bUsed;
502  ArgvInfo ai;
503  char prompt[64];
504  char *lineRead;
505 #if defined(WIN32) || defined(_WINDOWS)
506 #else
507  int sj;
508 #endif
510 
511  /* Execution may jump back to this point to restart the shell. */
512 #if defined(WIN32) || defined(_WINDOWS)
513 
514 #elif defined(HAVE_SIGSETJMP)
515  sj = sigsetjmp(gBackToTopJmp, 1);
516 #else /* HAVE_SIGSETJMP */
517  sj = setjmp(gBackToTopJmp);
518 #endif /* HAVE_SIGSETJMP */
519 
520 #if defined(WIN32) || defined(_WINDOWS)
521 #else
522  if (sj != 0) {
523  Trace(0, "Caught signal %d, back at top.\n", gGotSig);
524  if (gGotSig == SIGALRM) {
525  (void) printf("\nRemote host was not responding, closing down the session.");
527  } else{
528  (void) printf("\nInterrupted.\n");
529  if (gCancelCtrl != 0) {
530  gCancelCtrl = 0;
531  (void) printf("Closing down the current FTP session: ");
533  (void) sleep(1);
534  (void) printf("done.\n");
535  }
536  }
537  }
538 
539  gMayBackToTopJmp = 1;
540 #endif
541 
542 
543  ++gEventNumber;
544 
545  while (gDoneApplication == 0) {
546 #if defined(WIN32) || defined(_WINDOWS)
547 #else
550  (void) NcSignal(SIGALRM, BackToTop);
551 #endif
552 
553  MakePrompt(prompt, sizeof(prompt));
554 
555  if (gConn.connected == 0) {
556  SetXtermTitle("DEFAULT");
557  } else {
558  SetXtermTitle("%s - NcFTP", gConn.host);
559  }
560 
561  lineRead = Readline(prompt);
562  if (lineRead == NULL) {
563  /* EOF, Control-D */
564  (void) printf("\n");
565  break;
566  }
567  Trace(0, "> %s\n", lineRead);
568  AddHistory(lineRead);
569  for (tUsed = 0;;) {
570  (void) memset(&ai, 0, sizeof(ai));
571  bUsed = MakeArgv(lineRead + tUsed, &ai.cargc, ai.cargv,
572  (int) (sizeof(ai.cargv) / sizeof(char *)),
573  ai.argbuf, sizeof(ai.argbuf),
574  ai.noglobargv, 0);
575  if (bUsed <= 0)
576  break;
577  tUsed += bUsed;
578  if (ai.cargc == 0)
579  continue;
580  gRunningCommand = 1;
581  (void) time(&cmdStart);
582  if (DoCommand(&ai) < 0) {
583  (void) time(&cmdStop);
584  gRunningCommand = 0;
585  break;
586  }
587  (void) time(&cmdStop);
588  gRunningCommand = 0;
589  if ((cmdStop - cmdStart) > kBeepAfterCmdTime) {
590  /* Let the user know that a time-consuming
591  * operation has completed.
592  */
593 #if defined(WIN32) || defined(_WINDOWS)
595 #else
596  (void) fprintf(stderr, "\007");
597 #endif
598  }
599  ++gEventNumber;
600  }
601 
602  free(lineRead);
603  }
604 
605  CloseHost();
606  gMayBackToTopJmp = 0;
607 } /* Shell */
#define sleep
Definition: syshdrs.h:37
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int gDoneApplication
Definition: shell.c:21
char argbuf[256]
Definition: shell.h:12
int gEventNumber
Definition: shell.c:27
const char * cargv[64]
Definition: shell.h:9
int gCancelCtrl
Definition: shell.c:66
#define free
Definition: debug_ros.c:5
int gGotSig
Definition: shell.c:60
int gRunningCommand
Definition: shell.c:63
INT cmdStart(INT argc, WCHAR **argv)
Definition: cmdStart.c:163
#define SIGINT
Definition: signal.h:23
__u16 time
Definition: mkdosfs.c:366
void BackToTop(int sigNum)
Definition: shell.c:452
char host[64]
Definition: ncftp.h:136
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void SetXtermTitle(const char *const fmt,...)
Definition: readln.c:718
smooth NULL
Definition: ftsmooth.c:416
static int DoCommand(const ArgvInfoPtr aip)
Definition: shell.c:381
int noglobargv[64]
Definition: shell.h:10
#define kBeepAfterCmdTime
Definition: shell.h:26
int MakeArgv(char *line, int *cargc, const char **cargv, int cargcmax, char *dbuf, size_t dbufsize, int *noglobargv, int readlineHacks)
Definition: shell.c:221
int sigsetjmp(sigjmp_buf buf, int savesigs)
FTPConnectionInfo gConn
Definition: main.c:37
int cargc
Definition: shell.h:11
#define SIGPIPE
Definition: signal.h:35
jmp_buf gBackToTopJmp
Definition: shell.c:50
void MakePrompt(char *dst, size_t dsize)
Definition: readln.c:802
#define Trace(x)
Definition: zutil.h:197
Definition: shell.h:8
INT cmdStop(INT argc, WCHAR **argv)
Definition: cmdStop.c:12
#define NcSignal
Definition: ncftp.h:604
BOOL WINAPI MessageBeep(_In_ UINT)
void CloseHost(void)
Definition: main.c:153
__kernel_time_t time_t
Definition: linux.h:252
#define MB_OK
Definition: winuser.h:784
#define setjmp
Definition: setjmp.h:183
void AddHistory(char *line)
Definition: readln.c:699
FILE * stderr
#define memset(x, y, z)
Definition: compat.h:39
int gMayBackToTopJmp
Definition: shell.c:57
void FTPShutdownHost(const FTPCIPtr cip)
Definition: open.c:564
char * Readline(char *prompt)
Definition: readln.c:671
#define printf
Definition: config.h:203

Referenced by main().

◆ CommandSortCmp()

static int CommandSortCmp ( const CommandPtr  a,
const CommandPtr  b 
)
static

Definition at line 80 of file shell.c.

81 {
82  return (strcmp((*a).name, (*b).name));
83 } /* CommandSortCmp */
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by InitCommandList().

◆ CommandSubSearchCmp()

static int CommandSubSearchCmp ( const char *const  key,
const CommandPtr  a 
)
static

Definition at line 116 of file shell.c.

117 {
118  register const char *kcp, *cp;
119  int d;
120 
121  for (cp = (*a).name, kcp = key; ; ) {
122  if (*kcp == 0)
123  break;
124  d = *kcp++ - *cp++;
125  if (d)
126  return d;
127  }
128  return (0);
129 } /* CommandSubSearchCmp */
#define d
Definition: ke_i.h:81
POINT cp
Definition: magnifier.c:59
Definition: path.c:42

Referenced by GetCommandByName().

◆ DoCommand()

static int DoCommand ( const ArgvInfoPtr  aip)
static

Definition at line 381 of file shell.c.

382 {
383  CommandPtr cmdp;
384  int flags;
385  int cargc, cargcm1;
386 
387  cmdp = GetCommandByName(aip->cargv[0], 0);
388  if (cmdp == kAmbiguousCommand) {
389  (void) printf("%s: ambiguous command name.\n", aip->cargv[0]);
390  return (-1);
391  } else if (cmdp == kNoCommand) {
392  (void) printf("%s: no such command.\n", aip->cargv[0]);
393  return (-1);
394  }
395 
396  cargc = aip->cargc;
397  cargcm1 = cargc - 1;
398  flags = cmdp->flags;
399 
400  if (((flags & kCmdMustBeConnected) != 0) && (gConn.connected == 0)) {
401  (void) printf("%s: must be connected to do that.\n", aip->cargv[0]);
402  } else if (((flags & kCmdMustBeDisconnected) != 0) && (gConn.connected != 0)) {
403  (void) printf("%s: must be disconnected to do that.\n", aip->cargv[0]);
404  } else if ((cmdp->minargs != kNoMin) && (cmdp->minargs > cargcm1)) {
405  PrintCmdUsage(cmdp);
406  } else if ((cmdp->maxargs != kNoMax) && (cmdp->maxargs < cargcm1)) {
407  PrintCmdUsage(cmdp);
408  } else {
409  (*cmdp->proc)(cargc, aip->cargv, cmdp, aip);
410  }
411  return (0);
412 } /* DoCommand */
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
const char * cargv[64]
Definition: shell.h:9
#define kAmbiguousCommand
Definition: shell.h:54
void PrintCmdUsage(CommandPtr c)
Definition: shell.c:210
#define kNoCommand
Definition: shell.h:55
Definition: shell.h:41
#define kCmdMustBeConnected
Definition: shell.h:59
int minargs
Definition: shell.h:46
#define kCmdMustBeDisconnected
Definition: shell.h:60
FTPConnectionInfo gConn
Definition: main.c:37
int cargc
Definition: shell.h:11
GLbitfield flags
Definition: glext.h:7161
int maxargs
Definition: shell.h:46
CmdProc proc
Definition: shell.h:43
int flags
Definition: shell.h:45
#define kNoMin
Definition: shell.h:35
#define kNoMax
Definition: shell.h:34
#define printf
Definition: config.h:203

Referenced by CommandShell().

◆ GetCommandByIndex()

CommandPtr GetCommandByIndex ( const int  i)

Definition at line 140 of file shell.c.

141 {
142  if ((i < 0) || (i >= (int) gNumCommands))
143  return (kNoCommand);
144  return (&gCommands[i]);
145 } /* GetCommandByIndex */
#define kNoCommand
Definition: shell.h: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
Command gCommands[]
Definition: cmdlist.c:16
size_t gNumCommands
Definition: cmdlist.c:525

Referenced by CommandCompletionFunction().

◆ GetCommandByName()

CommandPtr GetCommandByName ( const char *const  name,
int  wantExactMatch 
)

Definition at line 156 of file shell.c.

157 {
158  CommandPtr canp, canp2;
159 
160  /* First check for an exact match. Otherwise if you if asked for
161  * 'cd', it would match both 'cd' and 'cdup' and return an
162  * ambiguous name error, despite having the exact name for 'cd.'
163  */
165 
166  if (canp == kNoCommand && !wantExactMatch) {
167  /* Now see if the user typed an abbreviation unique enough
168  * to match only one name in the list.
169  */
171 
172  if (canp != kNoCommand) {
173  /* Check the entry above us and see if the name we're looking
174  * for would match that, too.
175  */
176  if (canp != &gCommands[0]) {
177  canp2 = canp - 1;
178  if (CommandSubSearchCmp(name, canp2) == 0)
179  return kAmbiguousCommand;
180  }
181  /* Check the entry below us and see if the name we're looking
182  * for would match that one.
183  */
184  if (canp != &gCommands[gNumCommands - 1]) {
185  canp2 = canp + 1;
186  if (CommandSubSearchCmp(name, canp2) == 0)
187  return kAmbiguousCommand;
188  }
189  }
190  }
191  return canp;
192 } /* GetCommandByName */
#define kAmbiguousCommand
Definition: shell.h:54
#define kNoCommand
Definition: shell.h:55
Definition: shell.h:41
Command gCommands[]
Definition: cmdlist.c:16
static int CommandExactSearchCmp(const char *const key, const CommandPtr b)
Definition: shell.c:102
static int CommandSubSearchCmp(const char *const key, const CommandPtr a)
Definition: shell.c:116
int(* bsearch_proc_t)(const void *, const void *)
Definition: util.h:9
Definition: name.c:36
struct Command * CommandPtr
Definition: shell.h:28
size_t gNumCommands
Definition: cmdlist.c:525
#define bsearch

Referenced by CompletionFunction(), DoCommand(), and HelpCmd().

◆ InitCommandList()

void InitCommandList ( void  )

Definition at line 90 of file shell.c.

91 {
93 } /* InitCommandList */
Definition: shell.h:41
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
Command gCommands[]
Definition: cmdlist.c:16
int(* qsort_proc_t)(const void *, const void *)
Definition: util.h:8
static int CommandSortCmp(const CommandPtr a, const CommandPtr b)
Definition: shell.c:80
size_t gNumCommands
Definition: cmdlist.c:525

Referenced by PreInit().

◆ MakeArgv()

int MakeArgv ( char line,
int cargc,
const char **  cargv,
int  cargcmax,
char dbuf,
size_t  dbufsize,
int noglobargv,
int  readlineHacks 
)

Definition at line 221 of file shell.c.

222 {
223  int c;
224  int retval;
225  char *dlim;
226  char *dcp;
227  char *scp;
228  char *arg;
229 
230  *cargc = 0;
231  scp = line;
232  dlim = dbuf + dbufsize - 1;
233  dcp = dbuf;
234 
235  for (*cargc = 0; *cargc < cargcmax; ) {
236  /* Eat preceding junk. */
237  for ( ; ; scp++) {
238  c = *scp;
239  if (c == '\0')
240  goto done;
241  if (isspace(c))
242  continue;
243  if ((c == ';') || (c == '\n')) {
244  scp++;
245  goto done;
246  }
247  break;
248  }
249 
250  arg = dcp;
251  cargv[*cargc] = arg;
252  noglobargv[*cargc] = 0;
253  (*cargc)++;
254 
255  /* Special hack so that "!cmd" is always split into "!" "cmd" */
256  if ((*cargc == 1) && (*scp == '!')) {
257  if (scp[1] == '!') {
258  scp[1] = '\0';
259  } else if ((scp[1] != '\0') && (!isspace((int) scp[1]))) {
260  cargv[0] = "!";
261  scp++;
262  arg = dcp;
263  cargv[*cargc] = arg;
264  noglobargv[*cargc] = 0;
265  (*cargc)++;
266  }
267  }
268 
269  /* Add characters to the new argument. */
270  for ( ; ; ) {
271  c = *scp;
272  if (c == '\0')
273  break;
274  if (isspace(c))
275  break;
276  if ((c == ';') || (c == '\n')) {
277  break;
278  }
279 
280  scp++;
281 
282  if (c == '\'') {
283  for ( ; ; ) {
284  c = *scp++;
285  if (c == '\0') {
286  if (readlineHacks != 0)
287  break;
288  /* Syntax error */
289  (void) fprintf(stderr, "Error: Unbalanced quotes.\n");
290  return (-1);
291  }
292  if (c == '\'')
293  break;
294 
295  /* Add char. */
296  if (dcp >= dlim)
297  goto toolong;
298  *dcp++ = c;
299 
300  if (strchr(kGlobChars, c) != NULL) {
301  /* User quoted glob characters,
302  * so mark this argument for
303  * noglob.
304  */
305  noglobargv[*cargc - 1] = 1;
306  }
307  }
308  } else if (c == '"') {
309  for ( ; ; ) {
310  c = *scp++;
311  if (c == '\0') {
312  if (readlineHacks != 0)
313  break;
314  /* Syntax error */
315  (void) fprintf(stderr, "Error: Unbalanced quotes.\n");
316  return (-1);
317  }
318  if (c == '"')
319  break;
320 
321  /* Add char. */
322  if (dcp >= dlim)
323  goto toolong;
324  *dcp++ = c;
325 
326  if (strchr(kGlobChars, c) != NULL) {
327  /* User quoted glob characters,
328  * so mark this argument for
329  * noglob.
330  */
331  noglobargv[*cargc - 1] = 1;
332  }
333  }
334  } else
335 #if defined(WIN32) || defined(_WINDOWS)
336  if (c == '|') {
337 #else
338  if (c == '\\') {
339 #endif
340  /* Add next character, verbatim. */
341  c = *scp++;
342  if (c == '\0')
343  break;
344 
345  /* Add char. */
346  if (dcp >= dlim)
347  goto toolong;
348  *dcp++ = c;
349  } else {
350  /* Add char. */
351  if (dcp >= dlim)
352  goto toolong;
353  *dcp++ = c;
354  }
355  }
356 
357  *dcp++ = '\0';
358  }
359 
360  (void) fprintf(stderr, "Error: Argument list too long.\n");
361  *cargc = 0;
362  cargv[*cargc] = NULL;
363  return (-1);
364 
365 done:
366  retval = (int) (scp - line);
367  cargv[*cargc] = NULL;
368  return (retval);
369 
370 toolong:
371  (void) fprintf(stderr, "Error: Line too long.\n");
372  *cargc = 0;
373  cargv[*cargc] = NULL;
374  return (-1);
375 } /* MakeArgv */
#define isspace(c)
Definition: acclib.h:69
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void * arg
Definition: msvc.h:12
_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: parser.c:48
const GLubyte * c
Definition: glext.h:8905
char line[200]
Definition: main.c:97
#define kGlobChars
Definition: ncftp.h:357
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define c
Definition: ke_i.h:80
FILE * stderr
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by CommandShell(), and CompletionFunction().

◆ PrintCmdHelp()

void PrintCmdHelp ( CommandPtr  c)

Definition at line 200 of file shell.c.

201 {
202  (void) printf("%s: %s.\n", c->name, c->help);
203 } /* PrintCmdHelp */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
const GLubyte * c
Definition: glext.h:8905
#define printf
Definition: config.h:203

Referenced by HelpCmd().

◆ PrintCmdUsage()

void PrintCmdUsage ( CommandPtr  c)

Definition at line 210 of file shell.c.

211 {
212  if (c->usage != NULL)
213  (void) printf("Usage: %s %s\n", c->name, c->usage);
214 } /* PrintCmdUsage */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
smooth NULL
Definition: ftsmooth.c:416
const GLubyte * c
Definition: glext.h:8905
#define printf
Definition: config.h:203

Referenced by ChdirCmd(), DeleteCmd(), DoCommand(), GetCmd(), HelpCmd(), ListCmd(), LocalListCmd(), LookupCmd(), MkdirCmd(), MlsCmd(), OpenCmd(), PutCmd(), RmdirCmd(), SpoolGetCmd(), and SpoolPutCmd().

◆ XferCanceller()

void XferCanceller ( int  sigNum)

Definition at line 419 of file shell.c.

420 {
421  gGotSig = sigNum;
422  if (gConn.cancelXfer > 0) {
423 #if defined(WIN32) || defined(_WINDOWS)
425 #else
426  /* User already tried it once, they
427  * must think it's locked up.
428  *
429  * Jump back to the top, and
430  * close down the current session.
431  */
432  gCancelCtrl = 1;
433  if (gMayBackToTopJmp > 0) {
434 #ifdef HAVE_SIGSETJMP
436 #else /* HAVE_SIGSETJMP */
438 #endif /* HAVE_SIGSETJMP */
439  }
440 #endif
441  }
442  gConn.cancelXfer++;
443 } /* XferCanceller */
int gCancelCtrl
Definition: shell.c:66
int gGotSig
Definition: shell.c:60
#define SIGINT
Definition: signal.h:23
#define SIG_DFL
Definition: signal.h:47
int longjmp(jmp_buf buf, int retval)
void siglongjmp(sigjmp_buf buf, int val)
FTPConnectionInfo gConn
Definition: main.c:37
int signal
Definition: xcptfil.c:12
jmp_buf gBackToTopJmp
Definition: shell.c:50
int gMayBackToTopJmp
Definition: shell.c:57

Referenced by GetCmd(), and PutCmd().

Variable Documentation

◆ gBackToTopJmp

jmp_buf gBackToTopJmp

Definition at line 50 of file shell.c.

Referenced by BackToTop(), CommandShell(), and XferCanceller().

◆ gCancelCtrl

int gCancelCtrl = 0

Definition at line 66 of file shell.c.

Referenced by CommandShell(), and XferCanceller().

◆ gCancelJmp

jmp_buf gCancelJmp

Definition at line 45 of file shell.c.

Referenced by Cancel(), ListCmd(), LocalListCmd(), and PageCmd().

◆ gCommands

Command gCommands[]

Definition at line 16 of file cmdlist.c.

Referenced by GetCommandByIndex(), GetCommandByName(), and InitCommandList().

◆ gConn

Definition at line 37 of file main.c.

Referenced by CommandShell(), DoCommand(), and XferCanceller().

◆ gCopyright

char gCopyright[]

Definition at line 17 of file version.c.

◆ gDoneApplication

int gDoneApplication = 0

Definition at line 21 of file shell.c.

Referenced by BackToTop(), CommandShell(), and QuitCmd().

◆ gEventNumber

int gEventNumber = 0

Definition at line 27 of file shell.c.

Referenced by CommandShell().

◆ gGotSig

int gGotSig = 0

◆ gLib

Definition at line 36 of file main.c.

◆ gMayBackToTopJmp

int gMayBackToTopJmp = 0

Definition at line 57 of file shell.c.

Referenced by BackToTop(), CommandShell(), and XferCanceller().

◆ gMayCancelJmp

int gMayCancelJmp = 0

Definition at line 54 of file shell.c.

Referenced by Cancel(), ListCmd(), LocalListCmd(), and PageCmd().

◆ gNumCommands

size_t gNumCommands

Definition at line 525 of file cmdlist.c.

Referenced by GetCommandByIndex(), GetCommandByName(), and InitCommandList().

◆ gNumInterruptions

int gNumInterruptions = 0

Definition at line 24 of file shell.c.

◆ gNumProgramRuns

int gNumProgramRuns

Definition at line 14 of file preffw.c.

Referenced by LoadFirewallPrefs().

◆ gRunningCommand

int gRunningCommand = 0

Definition at line 63 of file shell.c.

Referenced by BackToTop(), and CommandShell().

◆ gStartupURLCdList

LineList gStartupURLCdList

Definition at line 38 of file main.c.

Referenced by OpenURL(), PreInit(), and SetStartupURL().

◆ gStartupUrlParameterGiven

int gStartupUrlParameterGiven

Definition at line 32 of file main.c.

Referenced by main().