-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmd.c
More file actions
35 lines (35 loc) · 964 Bytes
/
Copy pathcmd.c
File metadata and controls
35 lines (35 loc) · 964 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
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <grp.h>
#include <pwd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <sys/utsname.h>
#include <signal.h>
#include<errno.h>
void execute(int cp, char **cmd_parts, int l, int pi[], int pp[], char buf[])
{
if (strcmp(cmd_parts[0], "pwd") == 0)
pwd();
else if (strcmp(cmd_parts[0], "echo") == 0)
echo(cp, cmd_parts);
else if (strcmp(cmd_parts[0], "cd") == 0)
cd(cp, cmd_parts, buf);
else if (strcmp(cmd_parts[0], "ls") == 0)
ls(cp, cmd_parts, buf);
else if (strcmp(cmd_parts[0], "pinfo") == 0)
pinfo(cp, cmd_parts);
else if (strcmp(cmd_parts[0], "history") == 0)
history(cp, cmd_parts);
else
syscmd(cp, cmd_parts, l, pi, pp);
}