home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilsp / psh / h / builtins next >
Text File  |  1994-04-08  |  1KB  |  55 lines

  1. /* vi:tabstop=4:shiftwidth=4:smartindent
  2.  *
  3.  * builtins.h - Struct and entries in the builtin functions list.
  4.  *
  5.  */
  6.  
  7. typedef struct
  8. {
  9.     char    *cmd_name;
  10.     char    *cmd_help;
  11.     int        (*cmd_fun)(int, char **);
  12. } builtin;
  13.  
  14. extern int do_builtin(char *cmd_line, int (*cmd_fun)(int argc, char **argv));
  15.  
  16. #define CMD(fun)    extern int fun(int argc, char **argv)
  17.  
  18. CMD(sh_cd);
  19. CMD(sh_exec);
  20. CMD(sh_history);
  21. CMD(sh_pwd);
  22. CMD(sh_exit);
  23. CMD(sh_read);
  24. CMD(sh_dirs);
  25. CMD(sh_pushd);
  26. CMD(sh_popd);
  27. CMD(sh_help);
  28. CMD(sh_dbg);
  29. CMD(sh_autoconv);
  30. CMD(sh_source);
  31.  
  32. #ifdef MAIN
  33. builtin    builtins[] = 
  34. {
  35.     ".",        "Execute commands from a file",                sh_source,
  36.     "autoconv",    "Add a command name for uname conversion",    sh_autoconv,
  37.     "bye",        "Same as exit",                                sh_exit,
  38.     "cd",        "Change directory, using CDPATH",            sh_cd,
  39.     "dirs",        "Show the directory stack",                    sh_dirs,
  40.     "exec",        "Replace this shell with a command",        sh_exec,
  41.     "exit",        "Same as bye",                                sh_exit,
  42.     "help",        "Show help on a command",                    sh_help,
  43.     "history",    "Show the history list",                    sh_history,
  44.     "popd",        "Pop a directory from the stack",            sh_popd,
  45.     "pushd",    "Push a directory onto the stack",            sh_pushd,
  46.     "pwd",        "Show the current directory",                sh_pwd,
  47.     "read",        "Read a line into a variable",                sh_read,
  48.     "source",    "Execute commands from a file",                sh_source,
  49.     "xyzzy",    "Toggle debugging flag",                    sh_dbg,
  50.     NULL,        NULL,                                        NULL
  51. };
  52. #else
  53. extern builtin builtins[];
  54. #endif
  55.