1 /* shell.h 2 * 3 * Copyright (c) 1992-2001 by Mike Gleason. 4 * All rights reserved. 5 * 6 */ 7 8 typedef struct ArgvInfo { 9 const char *cargv[64]; 10 int noglobargv[64]; 11 int cargc; 12 char argbuf[256]; 13 } ArgvInfo, *ArgvInfoPtr; 14 15 /* How often to no-op the remote site if the user is idle, in seconds. */ 16 #define kIdleInterval 20 17 18 /* If the user has been idle this many seconds, start their background 19 * jobs. 20 */ 21 #define kIdleBatchLaunch 180 22 23 /* If a command (like a transfer) took longer than this many seconds, beep 24 * at the user to notify them that it completed. 25 */ 26 #define kBeepAfterCmdTime 15 27 28 typedef struct Command *CommandPtr; 29 typedef void (*CmdProc)(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip); 30 31 /* These are used in the command table, to specify that a command 32 * doesn't require an exact number of parameters. 33 */ 34 #define kNoMax (-1) 35 #define kNoMin (-1) 36 37 /* Structure of the command table. We keep some extra stuff in the 38 * table, so each command doesn't have to check the number of 39 * arguments and print it's own usage messages if it doesn't want to. 40 */ 41 typedef struct Command { 42 const char *name; 43 CmdProc proc; 44 const char *usage, *help; 45 int flags; 46 int minargs, maxargs; 47 } Command; 48 49 /* Parameter to GetCommandOrMacro(). */ 50 #define kAbbreviatedMatchAllowed 0 51 #define kExactMatchRequired 1 52 53 /* These can be returned by the GetCommand() routine. */ 54 #define kAmbiguousCommand ((CommandPtr) -1) 55 #define kNoCommand ((CommandPtr) 0) 56 57 /* Command flag bits. */ 58 #define kCmdHidden 00001 59 #define kCmdMustBeConnected 00002 60 #define kCmdMustBeDisconnected 00004 61 #define kCompleteRemoteFile 00010 62 #define kCompleteRemoteDir 00020 63 #define kCompleteLocalFile 00040 64 #define kCompleteLocalDir 00100 65 #define kCompleteBookmark 00200 66 #define kCompletePrefOpt 00400 67 68 /* shell.c */ 69 void InitCommandList(void); 70 CommandPtr GetCommandByIndex(const int); 71 CommandPtr GetCommandByName(const char *const, int); 72 void PrintCmdHelp(CommandPtr); 73 void PrintCmdUsage(CommandPtr); 74 int MakeArgv(char *, int *, const char **, int, char *, size_t, int *, int); 75 void XferCanceller(int); 76 void BackToTop(int); 77 void Cancel(int); 78 void CommandShell(void); 79