diff --git a/yeeshell.c b/yeeshell.c index 2abac20..8a1762a 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -157,10 +157,10 @@ int check_redirect(char **args, char *redirect_filename, char **redirect_args) if (redirect_flag == 1) /* redirect output */ { - strcpy(redirect_filename, rgs[i + 1]); + strcpy(redirect_filename, args[i + 1]); for (j = 0; j < i; j++) { - redirect_args[i] = args[i]; + strcpy(redirect_args[i], args[i]); } } else if (redirect_flag == 2) /* redirect input */ @@ -169,7 +169,7 @@ int check_redirect(char **args, char *redirect_filename, char **redirect_args) i++; while (args[i] != NULL) { - redirect_args[j++] = args[i]; + strcpy(redirect_args[j++], args[i]); } } return redirect_flag; diff --git a/yeeshell.h b/yeeshell.h index 08c1bef..38d76df 100644 --- a/yeeshell.h +++ b/yeeshell.h @@ -8,6 +8,8 @@ #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 UNDF 0 /* undefined */ #define FG 1 /* running in foreground */