home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Networking / ncftp-2.4.2-MIHS / src / Cmdline.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-30  |  2.2 KB  |  89 lines

  1. /*     Cmdline.h */
  2.  
  3. #ifndef _cmdline_h_
  4. #define _cmdline_h_
  5.  
  6. /* If a command (like a transfer) took longer than this many seconds, beep
  7.  * at the user to notify them that it completed.
  8.  */
  9. #define kBeepAfterCmdTime 15
  10.  
  11. typedef int (*CmdProc)(int argc, char **argv);
  12.  
  13. /* These are used in the command table, to specify that a command
  14.  * doesn't require an exact number of parameters.
  15.  */
  16. #define kNoMax (-1)
  17. #define kNoMin (-1)
  18.  
  19. /* Maximum depth allowed for ExecCommandLine, which can run itself
  20.  * recursively.  This limit is in place to prevent infinite recursion.
  21.  */
  22. #define kRecursionLimit 8
  23.  
  24. /* Name of the script we run right before the interactive shell. */
  25. #define kStartupScript "init"
  26.  
  27. /* Structure of the command table.  We keep some extra stuff in the
  28.  * table, so each command doesn't have to check the number of
  29.  * arguments and print it's own usage messages if it doesn't want to.
  30.  */
  31. typedef struct Command {
  32.     char *name;
  33.     int flags;
  34.     CmdProc proc;
  35.     int minargs, maxargs;
  36.     char *usage, *help;
  37.     int complete;
  38. } Command, *CommandPtr;
  39.  
  40. /* Parameter to GetCommandOrMacro(). */
  41. #define kAbbreviatedMatchAllowed 0
  42. #define kExactMatchRequired 1
  43.  
  44. /* These can be returned by the GetCommand() routine. */
  45. #define kAmbiguousCommand ((CommandPtr) -1)
  46. #define kNoCommand ((CommandPtr) 0)
  47.  
  48. /* Command flag bits. */
  49. #define kCmdHidden                001
  50. #define kCmdMustBeConnected        002
  51. #define kCmdDelayPipe            004
  52. #define kCmdNoRedirect            010
  53. #define kCmdWaitMsg                020
  54. #define kCmdMustBeDisconnected    040
  55.  
  56. #ifndef _macro_h_
  57. #include "Macro.h"
  58. #endif
  59.  
  60. /* Structure of the name list.  Each name is either a CommandPtr or
  61.  * a MacroNodePtr.
  62.  */
  63. typedef struct CMName {
  64.     char *name;
  65.     union cm {
  66.         CommandPtr        cmd;
  67.         MacroNodePtr     mac;
  68.     } u;
  69.     int isCmd;
  70. } CMName, *CMNamePtr;
  71.  
  72. /* These can be returned by the GetCommandOrMacro() routine. */
  73. #define kAmbiguousName ((CMNamePtr) -1)
  74. #define kNoName ((CMNamePtr) 0)
  75.  
  76. int InitCommandAndMacroNameList(void);
  77. CMNamePtr GetCommandOrMacro(char *, int);
  78. CommandPtr GetCommand(char *name, int wantExactMatch);
  79. void PrintCmdHelp(CommandPtr);
  80. void PrintCmdUsage(CommandPtr);
  81. int ExecCommandLine(char *);
  82. void RunScript(FILE *);
  83. void RunStartupScript(void);
  84. void CommandShell(void);
  85.  
  86. #endif    /* _cmdline_h_ */
  87.  
  88. /* eof Cmdline.h */
  89.