-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshell.h
More file actions
80 lines (69 loc) · 1.74 KB
/
Copy pathshell.h
File metadata and controls
80 lines (69 loc) · 1.74 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef SHELL_H
#define SHELL_H
extern char **environ;
/* header files */
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <signal.h>
/**
* struct shell_env - stores address for pointer to free.
* @path_values: pointer to path values
* @input: pointer to buffer that getline creates.
* @input_token: pointers for input token.
* @modify_path: pointer to the path after it has been modified
*
* Description: provides a storage for all elements that are malloced.
*/
typedef struct shell_env
{
char **path_values;
char *input;
char **input_token;
char *modify_path;
} shell_t;
/**
* struct built_in_cmd - struct for different built in commands.
* @cmd_name: name of the cmd
* @cmd: function pointer to run the cmd
*
* Description: struct for different built in commands in our shell
*/
typedef struct built_in_cmd
{
char *cmd_name;
void (*cmd)(shell_t *);
} built_t;
/* main.c */
int run_build_in(shell_t *, char *);
int run_command(shell_t *, char *, char **);
int run_path(shell_t *, char *);
int check_slash(char *);
/* string.c */
size_t _strlen(char *);
char *_strdup(char *);
char **tokenize_str(char *, char *);
int _strcmp(char *, char *);
/* prompt_util.c */
void print_ps1(int);
char *find_pathname(char **, char *);
char *_getenv(const char *);
char *make_pathname(char *, char *);
char **get_path(char **);
/* prompt_util2.c */
void free_shell_t(shell_t *);
void p_commanderr(char *, char *);
/* buildin.c */
void my_exit(shell_t *);
void print_env(shell_t *);
/* function prototypes */
char *_strtok(char *, const char *);
ssize_t getline(char **, size_t *, FILE *);
#endif