-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
78 lines (73 loc) · 2.07 KB
/
main.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
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
#ifndef SHELL_H
#define SHELL_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <ctype.h>
#include <fcntl.h>
extern char **environ;
/**
* struct pfunc_t - printing functions and their identifiers
* @spec: format specifier
* @func: print function
*/
typedef struct pfunc_t
{
char *spec;
int (*func)(va_list, char *);
} pfunc_t;
/**
* struct btin_t - shell built-in functions
* @name: name of the function
* @func: pointer to the function
*/
typedef struct btin_t
{
char *name;
int (*func)(char **cmd);
} btin_t;
int _printf(const char *format, ...);
char *_strcat(char *dest, char *src);
char *_strcpy(char *dest, char *src);
char *_strdup(char *str);
int _strcmp(char *s1, char *s2);
int _strlen(char *str);
int print_str(char *str, int len);
int ppstr(va_list ap, char *spec);
int ppchar(va_list ap, char *spec);
int put_char(char c);
int print_num(int n);
int ppnum(va_list ap, char *spec);
int execcmd(char **cmd);
int _printenv(char **cmd);
int _cd(char **cmd);
int _exitsh(char **cmd);
int _setenv(char **cmd);
int _unsetenv(char **cmd);
char **_strtok(char *line, int size, char *delim);
void free_toks(char **tokens);
char *findxpath(char *input);
int (*is_btin(char *cmd))(char **cmd);
int shelln_int(char *pname, char *filename);
int shell_int(char *pname, char *filename);
int statxcmd(char **toks);
char *_getenv(char *envkey);
int gettoksnum(char *line, int size, char *delim);
char **get_inputs(int *status, int fd);
int runcmds(char **lines, char *pname, int *status);
char *makexpath(char *input, char *curpath);
int _printerr(int status, char **cmd, char *pname, char *input);
int _pxiterr(char **cmd, char *pname);
int _plserr(char **cmd, char *input);
int _pcderr(char **cmd, char *pname);
char *_realloc(char *ptr, int old_size, int newsize);
int _pfilerr(int status, char *pname, char *filename);
int _preaderr(char *buffer, char *tmp);
char **filter_toks(char **toks, int *prevstatus);
char **shift_toks(char **toks, int pos);
int _pcmdisfolder(char *pname, char **cmd);
#endif