-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
103 lines (84 loc) · 2.95 KB
/
main.h
File metadata and controls
103 lines (84 loc) · 2.95 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef MAIN_H
#define MAIN_H
#include <stdarg.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
extern char **environ;
/**
* struct find_info - contains information about whether or not
* a command was found in PATH, and the directory it was found,
* if found.
* @find_status: 0 if file not found, 1 if found, -1 if error occured
* @dir_loc: directory file was found in PATH, NULL if file not found
* Description - used mainly by function find_command
*/
typedef struct find_info
{
int find_status;
char *dir_loc;
} find_info;
int is_path_is_exist(char *comm, char *argvo, int ii);
struct find_info find_command(char *command);
int find_file_in_dir(char *dir, char *file_name);
int _strcmp(char *s1, char *s2);
char **split_string(char *str);
int _strlen(char *str);
int _putchar(char c);
char *_memcpy(char *dest, char *src, unsigned int n);
void execute(char *comm_path, char **arr);
void exec_chdir(char *comm, char **arr, char *dir);
char *create_command_path(char *comm, char *dir);
char **create_new_array(char *comm_path, char **arr);
int is_exit_is_env(char **arr, char **envp, char *argvo, int ii);
void built_env(char **env_t);
int exit_shell(char **arr);
int _atoi(char *s);
int get_int(char c);
int get_start(char *str);
int get_end(char *str, int start);
int get_sign(char *str, int start);
/**
* not_builtin_for_path - handles non-built-in commands, for
* commands whose paths are specified
* @arr: array of arguments at command line
* @envp: environment. Not used in the body of function, just
* @argvo: argv[0] of main function;
* @ii: int count of main while loop repetitions.
* to be passed to next function.
* Description - Manages instructions of the form /bin/ls
* Return: void
*/
void not_builtin_for_path(char **arr, char **envp __attribute__((unused)),
char *argvo, int ii);
/**
* not_builtin_for_non_path - handles non-built-in commands, for
* commands whose paths are not specified
* @arr: array of arguments at command line
* @envp: environment. Not used in the body of function, just
* @argvo: argv[0] of main function;
* @ii: int count of main while loop repetitions.
*
* to be passed to next function.
* Description - Handles commands like ls
* Return: void
*/
void not_builtin_for_non_path(char **arr, char **envp __attribute__((unused)),
char *argvo, int ii);
void free_ctrlc(int signal);
int noninteractive_main(char *buffer, char **envp, char *argvo,
int ii);
int perror_command_not_found(char *argvo, int ii, char *comm, char *msg);
int _putchar_err(char c);
int _malloc_ii(int num);
int fill_buffer(char *buffer, long int num, int n, int base);
int print_rev_buffer(char *buffer, int n);
void print_prompt(void);
void exit_ieie(int ieie, char **arr, char *buffer);
void not_path_frees(char *comm_path, char **new_array, char *dir_loc);
void find_command_replace(char *path2);
int _strlen_env(char *str);
int _strcmp_env(char *s1, char *s2);
char *_getenv(char *var_name);
int find_envar_start(char *var);
#endif /*MAIN_H*/