1
static void run(char *c, int t)
{
char *redir_stdin = NULL, *redir_stdout = NULL;
int pipefds[2] = {0, 0}, outfd = 0;
char *v[99] = {0};
char **u = &v[98]; /* end of words */
for (;;) {
c--;
if (is_delim(*c)) /* if NULL (start of string) or pipe: break */
break;
if (!is_special(*c)) {
c++; /* Copy word of regular chars into previous u */
// XXXXX /* 在此提交你的程式碼 */
/****************************/
--u;
if (is_blank(*c))
*c = '\0';
while (!is_special(*--c))
*u = c;
/***************************/
}
if (is_redir(*c)) { /* If < or > */
if (*c == '<')
redir_stdin = *u;
else
redir_stdout = *u;
if ((u - v) != 98)
u++;
}
}
if ((u - v) == 98) /* empty input */
return;
輸出結果:
➜ quiz7 gcc picosh.c
➜ quiz7 ./a.out
$ mkdir dir
$ ls
a.out dir http picosh.c
$ echo hello world > x
$ cat < x | grep hello
hello world
$ ls /dev | wc -l
243
$
文字訊息不要用圖片展現!
:notes: jserv
2
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up