|
#pragma once
|
|
|
|
#define CMDLINE_MAX_SIZE 1024 /* max length of a single command line */
|
|
#define ARGS_MAX_QUANTITY 128 /* max args on a command line */
|
|
#define BUFFER_MAX_SIZE 64 /* max size of a buffer which contains parsed arguments */
|
|
#define CMDLINE_DIV ' \t\r\n\a'
|
|
#define CMDLINE_HISTORY_MAX_QUANTITY 256
|
|
#define JOBS_MAX_QUANTITY 16
|
|
#define PATH_MAX_SIZE 256
|
|
#define LS_BUF_SIZE 1024
|
|
#define REDIRECT_FILENAME_MAX_SIZE 64 /* redirection filename */
|
|
#define REDIRECT_ARG_MAX_SIZE 16 /* redirection argument */
|
|
|
|
#define REDIRECT_NO 0 /* no redirection */
|
|
#define REDIRECT_OUT 1 /* redirect output */
|
|
#define REDIRECT_IN 2 /* redirect input */
|
|
|
|
/* readline - Get the command line */
|
|
char *readline();
|
|
|
|
/* parseline - Evaluate the command line that the user has just typed in */
|
|
int parseline(char *cmdline, char **args);
|
|
|
|
/* check_redirect - check if the command contains redirection */
|
|
int check_redirect(char **args, char *redirect_filename, char **redirect_args);
|
|
|
|
/* check_redirect - check if the command contains pipe */
|
|
int check_pipe(char **args, char **pipe_arg_1, char **pipe_arg_2);
|
|
|
|
/* execute - Execute the command line */
|
|
int execute(char *cmdline, char **args);
|
|
|
|
/* builtin functions - Handle built-in command */
|
|
int built_in(char **args);
|
|
int builtin_cd(char **args);
|
|
int builtin_history(char **args);
|
|
int builtin_mytop();
|