-
Notifications
You must be signed in to change notification settings - Fork 1
/
shell.h
48 lines (40 loc) · 1.17 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
#ifndef SHELL_H
#define SHELL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#define DELIM " \t\n"
extern char **environ;
char *read_line(void);
char **tokenizer(char *line);
int _execute(char **command, char **argv, int idx);
char *_getenv(char *variable);
char *_getpath(char *command);
/* ===== string.c ===== */
char *_strdup(const char *str);
int _strcmp(char *s1, char *s2);
int _strlen(char *s);
char *_strcat(char *dest, char *src);
char *_strcpy(char *dest, char *src);
/* ====== utils.c ======*/
void freearray2D(char **arr);
void print_error(char *name, char *cmd, int idx);
char *_itoa(int n);
char *convert_to_string(int n);
void reverse_string(char *str, int len);
/* ====== tools.c ====== */
int is_positive_number(char *str);
int _atoi(char *str);
/* ====== builtins.c ====== */
int is_builtin(char *command);
void handle_builtin(char **command, char **argv, int *status, int idx);
void exit_shell(char **command, char **argv, int *status, int idx);
void print_env(char **command, int *status);
#endif /* SHELL_H */