-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshell.h
50 lines (40 loc) · 1.22 KB
/
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
44
45
46
47
48
49
50
#ifndef SHELL_H
#define SHELL_H
#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include<stddef.h>
#include<string.h>
#include<sys/wait.h>
#include <limits.h>
extern char **environ;
/* built function*/
void debut_shell(void);
void non_interactive_mode(char *token, int *status);
ssize_t read_command(char **line, size_t *size_line);
void handle_exit_status(int my_status, char **single_command,
char **token, int *status);
void handle_custom_exit(int my_status, char **commands,
char *line, int *status);
/* execute command*/
void _execvep(char **commands, char **envp, int *status);
int search_path(char *command, char **full_path);
void wait_child_process(int *status);
char *mygetenv(const char *path);
int _atoi(char *s);
/* handle line and delimiters(/n...)*/
char **tokenize_string(char *str, char *delimiters);
/* write messages */
void write_error(char *command);
void write_exit_error(char *number);
void print_env_var(void);
void handle_getline_error(char *line);
/* string fucntion*/
char *_strdup(const char *src);
int _strlen(char *str);
int _strcmp(char *s1, char *s2);
char *_strncpy(char *dest, char *src, int n);
char *_strncat(char *dest, char *src, int n);
/* free memory leak*/
void free_array(char **array);
#endif