-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_shell.h
More file actions
29 lines (23 loc) · 913 Bytes
/
Copy pathsimple_shell.h
File metadata and controls
29 lines (23 loc) · 913 Bytes
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
#ifndef SIMPLE_SHELL_H
#define SIMPLE_SHELL_H
/* getline, fileno */
#define _POSIX_C_SOURCE 200809L
#include <inttypes.h> /* intmax_t */
#include <stdio.h> /* getline, perror, FILE, fileno */
#include <sys/wait.h> /* wait, waitpid */
#include <unistd.h> /* fork, getpid, execve */
#include <errno.h> /* errno */
#include "alloc.h"
#include "queue.h"
#include "env.h"
#define SIMPLE_SHELL_PROMPT "@s_s> "
#define GETLINE_EOF -2
/* print text of the specified length to stdout. */
#define ECHOL(echo_txt, echo_txt_len) \
write(STDOUT_FILENO, echo_txt, echo_txt_len)
/* print text to stdout. */
#define ECHO(echo_txt) write(STDOUT_FILENO, echo_txt, _strlen(echo_txt))
ssize_t _getline(char **const lineptr, size_t * const n, FILE * const stream);
queue *tokenise(const char *const command_str, intmax_t size);
int interprate(queue *const tokens, environment_vars *environ);
#endif /* SIMPLE_SHELL_H */