OS2021_Project1.Shell

45 rader
1.7 KiB

3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
  1. #pragma once
  2. #define CMDLINE_MAX_SIZE 1024 /* max length of a single command line */
  3. #define ARGS_MAX_QUANTITY 128 /* max args on a command line */
  4. #define BUFFER_MAX_SIZE 64 /* max size of a buffer which contains parsed arguments */
  5. #define CMDLINE_DIV ' \t\r\n\a'
  6. #define CMDLINE_HISTORY_MAX_QUANTITY 256
  7. #define JOBS_MAX_QUANTITY 16
  8. #define PATH_MAX_SIZE 256
  9. #define LS_BUF_SIZE 1024
  10. #define REDIRECT_FILENAME_MAX_SIZE 64 /* redirection filename */
  11. #define REDIRECT_ARG_MAX_SIZE 16 /* redirection argument */
  12. #define REDIRECT_NO 0 /* no redirection */
  13. #define REDIRECT_OUT 1 /* redirect output */
  14. #define REDIRECT_IN 2 /* redirect input */
  15. /* readline - Get the command line */
  16. char *readline();
  17. /* parseline - Evaluate the command line that the user has just typed in */
  18. int parseline(char *cmdline, char **args);
  19. /* check_redirect - check if the command contains redirection */
  20. int check_redirect(char **args, char *redirect_filename, char **redirect_args);
  21. /* do_redirect - execute redirection command */
  22. int do_redirect(int redirect_flag, char *redirect_filename, char **redirect_args);
  23. /* check_redirect - check if the command contains pipe */
  24. int check_pipe(char **args, char **pipe_arg_1, char **pipe_arg_2);
  25. /* do_pipe - execute pipe command */
  26. int do_pipe(char **pipe_arg_1, char **pipe_arg_2);
  27. /* do_bgfg - fork and execute background/foreground tasks */
  28. int do_bg_fg(char **args, int bg);
  29. /* execute - Execute the command line */
  30. int execute(char *cmdline, char **args);
  31. /* builtin functions - Handle built-in command */
  32. int built_in(char **args);
  33. int builtin_cd(char **args);
  34. int builtin_history(char **args);
  35. int builtin_mytop();