-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.h
More file actions
69 lines (64 loc) · 1.77 KB
/
header.h
File metadata and controls
69 lines (64 loc) · 1.77 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
#ifndef HEADER_SHELL
#define HEADER_SHELL
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <stdarg.h>
/* global variables */
extern char **environ;
/* Macros */
#define BUFF_SIZE 32
/**
* struct builtins - struct for built-in commands
* @str: command
* @f: function pointer to respective command
*/
typedef struct builtins
{
char *str;
int (*f)(char **args, char *prgm, int count);
} builtin_t;
/**
* struct func_e - struct to store specifier w respective fn
* @c: format specifier
* @f: fn ptr that takes param of type va_list
*/
typedef struct func_e
{
char c;
int (*f)(va_list);
} func_f;
/* print prompt, getline and tokenize */
void _getprompt(void);
/* ssize_t _getline(char *buff); */
char *_strcpy(char *dest, char *src);
char *my_strtok(char *src, char *delims);
char *_getenv(const char *name);
int get_index(const char *name);
char *_strcat(char *dest, char *src);
int check_slash(char *arg);
int _strcmp(char *s1, char *s2);
size_t _strlen(char *s);
int my_exit(char **args, char *prgm, int count);
char *copy_path(void);
void sig_handler(int signum);
int print_env(char **args, char *prgm, int count);
int my_cd(char **args, char *prgm, int count);
int _unsetenv(char **args, char *prgm, int count);
void *_realloc(void *ptr, unsigned int old_size, unsigned int new_size);
char **create_env(void);
void free_env(void);
int _setenv(char **args, char *prgm, int count);
void check_comment(char **line);
int print_str(va_list ap);
int print_count(va_list ap);
int _putchar(const char c);
int handle_specifiers(va_list args, char c);
int print_error(const char *format, ...);
void change_pwd(char *name, char *prgm, int count);
void change_oldpwd(char *prgm, int count);
#endif