-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.h
43 lines (38 loc) · 938 Bytes
/
shell.h
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
#ifndef SHELL_H
#define SHELL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdbool.h>
extern int errno;
extern char **environ;
extern char *cmdline_copy;
extern char **argv;
extern int argc;
extern char *commandline;
extern char *prog;
extern int execution_count;
extern char *absolute_command;
/**
* struct builtin_s - defines builtin commands
* @name: The name of the builtin command.
* @f: A function pointer to the builtin command's function.
*/
typedef struct builtin_s
{
char *name;
int (*f)(char **argv, char **front);
} builtin_t;
int count_tokens(char *commandline);
void store_tokens(char *cmdline_copy, char **argv);
int execute_cmd(char **argv);
char *get_cmd_path(char *command);
void handle_env(void);
void handle_exit();
void changeDirectory(char **argv);
#endif /* end ifndef */