We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4831b2 commit 5482b33Copy full SHA for 5482b33
src/shell.c
@@ -11,11 +11,12 @@
11
12
int main()
13
{
14
- pid_t pid;
15
- int status;
16
while (1) {
17
struct cmdline *l;
18
int i, j;
+ pid_t pid;
+ int status;
19
+ int out=1;
20
21
printf("shell> ");
22
l = readcmd();
@@ -33,7 +34,10 @@ int main()
33
34
}
35
36
if (l->in) printf("in: %s\n", l->in);
- if (l->out) printf("out: %s\n", l->out);
37
+ if (l->out) {
38
+ printf("out: %s\n", l->out);
39
+ out=open(l->out,O_WRONLY|O_CREAT);//on peut rajouter des choses
40
+ }
41
42
/* Display each command of the pipe */
43
for (i=0; l->seq[i]!=0; i++) {
@@ -53,8 +57,12 @@ int main()
53
57
exit(-1);
54
58
55
59
60
+
61
62
+ if (out){
63
+ dup2(1,out);
64
+ close(out);
56
65
- //printf("\n");
66
67
68
0 commit comments