-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloop.c
More file actions
41 lines (36 loc) · 718 Bytes
/
Copy pathloop.c
File metadata and controls
41 lines (36 loc) · 718 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
39
40
41
#include "lib.h"
#include "builtin.h"
#include "helper.h"
extern char home[100];
void yash_loop(void)
{
register struct passwd *pw;
register uid_t uid;
char hostname[1024];
char dirpath[1024];
uid = geteuid ();
pw = getpwuid (uid);
hostname[1023] = '\0';
gethostname(hostname, 1023);
char *lin,*rl;
char **arg;
int stat;
getcwd(home,100);
do {
char pwd[100];
getcwd(pwd,100);
printf("<%s@%s:%s>",pw->pw_name,hostname,replace_str(pwd,home,"~"));
rl=yash_read_line();
//printf("%s\n",rl);
while(rl)
{
lin= strsep(&rl,";");
//printf("%s\n",lin);
arg = yash_split_line(lin);
//printf("%s\n",arg[0]);
stat = yash_execute(arg);
}
free(rl);
free(arg);
} while (stat);
}