-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.c
More file actions
38 lines (34 loc) · 879 Bytes
/
test.c
File metadata and controls
38 lines (34 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include "parser.h"
int main(void) {
char buf[1024];
tline * line;
int i,j;
printf("==> ");
while (fgets(buf, 1024, stdin)) {
line = tokenize(buf);
if (line==NULL) {
continue;
}
if (line->redirect_input != NULL) {
printf("redirección de entrada: %s\n", line->redirect_input);
}
if (line->redirect_output != NULL) {
printf("redirección de salida: %s\n", line->redirect_output);
}
if (line->redirect_error != NULL) {
printf("redirección de error: %s\n", line->redirect_error);
}
if (line->background) {
printf("comando a ejecutarse en background\n");
}
for (i=0; i<line->ncommands; i++) {
printf("orden %d (%s):\n", i, line->commands[i].filename);
for (j=0; j<line->commands[i].argc; j++) {
printf(" argumento %d: %s\n", j, line->commands[i].argv[j]);
}
}
printf("==> ");
}
return 0;
}