Browse Source

check_redirect adjustment

master
10195501441 3 years ago
parent
commit
bdb1d443f5
2 changed files with 5 additions and 3 deletions
  1. +3
    -3
      yeeshell.c
  2. +2
    -0
      yeeshell.h

+ 3
- 3
yeeshell.c View File

@ -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;

+ 2
- 0
yeeshell.h View File

@ -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 */

Loading…
Cancel
Save