-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshell.h
More file actions
68 lines (57 loc) · 1.37 KB
/
Copy pathshell.h
File metadata and controls
68 lines (57 loc) · 1.37 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
#ifndef SHELL_H
#define SHELL_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <string.h>
#include <signal.h>
#include <dirent.h>
extern char **environ;
/**
* struct params - object with all variables
* @argv: arguments from user
* @loop: num of times prompt has been showed
* @found: used to find files with stat()
* @buff: used with getline()
* @cmd: command = path + argv[0]
* @name: name of executable used in errors
* @exit_value: int used for return
*/
typedef struct params
{
char **argv;
int *loop;
struct stat found;
char *buff;
char *cmd;
char *name;
int exit_value;
} params;
/* core_funs.c */
int check_builtin(params *p);
void not_found_error(params *p);
void simple_exec(params *p);
/* aux_funs.c */
void signal_exit(int a);
void *_calloc(unsigned int nmemb, unsigned int size);
/* path_funs.c */
char *_getenv(char *name);
char *cmd_path(char **argv);
/* string_funs.c */
char *_strcat(char *dest, char *src);
int _strlen(char *s);
void rev_string(char *s);
char *_itoa(unsigned int num);
int _strcmp(char *s1, char *s2);
/* string_funs_2.c */
char *_strchr(char *s, char c);
char *_strcpy(char *dest, char *src);
char *str_concat(char *s1, char *s2);
int _atoi(char *s);
/* buil-ins.c */
int check_word(char **argv);
int exit_built_in(params *p);
void env_built_in(params *p);
#endif /*SHELL_H*/