-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec.c
More file actions
52 lines (39 loc) · 1.02 KB
/
Copy pathexec.c
File metadata and controls
52 lines (39 loc) · 1.02 KB
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
48
49
50
51
52
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/wait.h>
#include <string.h>
#include "utils.h"
void bashBuiltins(char** args, char *line_copy){
add_to_history(line_copy);
__pid_t value = fork();
if (value < 0) {
perror("fork failed");
}
if (value == 0){
execvp(args[0], args);
perror("execvp failed");
exit(EXIT_FAILURE);
}
else{
int status;
waitpid(value, &status, 0);
}
}
void commonWebApps(char *arg) {
if (strcmp(arg, "youtube") == 0) {
system("explorer.exe https://www.youtube.com");
}
else if (strcmp(arg, "gmail") == 0) {
system("explorer.exe https://mail.google.com");
}
else if (strcmp(arg, "chatgpt") == 0) {
system("explorer.exe https://chat.openai.com");
}
else if (strcmp(arg, "eksi") == 0) {
system("explorer.exe https://eksisozluk.com/basliklar/gundem");
}
else {
printf("Unknown web app: %s\n", arg);
}
}