-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
47 lines (38 loc) · 1.04 KB
/
main.c
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
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <pwd.h>
#include "shell_fct.h"
int main(int argc, char** argv)
{
//..........
int ret = MYSHELL_CMD_OK;
cmd mycmd;
char* readlineptr;
struct passwd* infos;
char str[1024];
char hostname[256];
char workingdirectory[256];
//..........
while(ret != MYSHELL_FCT_EXIT)
{
infos=getpwuid(getuid());
gethostname(hostname, 256);
getcwd(workingdirectory, 256);
sprintf(str, "\n{myshell}%s@%s:%s$ ", infos->pw_name, hostname, workingdirectory);
readlineptr = readline(str);
//..........
//parse_membres(readlineptr, &mycmd);
//parse_args(&mycmd);
//parse_redirection(mycmd.nb_cmd_membres,&mycmd);
//..........
//..........
lire_cmd(&mycmd,readlineptr);
aff_cmd(&mycmd);
ret=exec_commande(&mycmd);
free_elements_cmd(&mycmd);
free(readlineptr);
}
//..........
return 0;
}