diff --git a/yeeshell.c b/yeeshell.c index 8a1762a..1925923 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -160,7 +160,7 @@ int check_redirect(char **args, char *redirect_filename, char **redirect_args) strcpy(redirect_filename, args[i + 1]); for (j = 0; j < i; j++) { - strcpy(redirect_args[i], args[i]); + redirect_args[j] = args[j]; } } 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) { - strcpy(redirect_args[j++], args[i]); + redirect_args[j++] = args[i++]); } } return redirect_flag; @@ -187,7 +187,7 @@ int execute(char *cmdline, char **args) sigaddset(&mask_all, SIGCHLD); bg = parseline(cmdline, args); redirect_flag = check_redirect(args, redirect_filename, redirect_args); - printf("%d %s %s\n", redirect_flag, redirect_filename, redirect_args); + printf("%d %s %s %s %s\n", redirect_flag, redirect_filename, redirect_args[0], redirect_args[1], redirect_args[2]); if (args[0] == NULL) {