-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
53 lines (43 loc) · 1.24 KB
/
main.h
File metadata and controls
53 lines (43 loc) · 1.24 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
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
//change with values from xargs --show-limits
#define MAXLINESIZE 1000
#define MAXWORDS 300
#define WORDSIZE 100
#define MAXCMDS 100
extern char **environ;
struct Cmd {
// char argv[MAXWORDS][WORDSIZE];
char *argv[MAXWORDS];
int argc;
};
//sempahore for I/O
sem_t io_sem;
//empty Cmd struct for resetting values
static const struct Cmd ResetCmd;
//creates user manual file for the help command
int createUserManual();
int shellLoop(FILE *batchfile, int isBatch);
int parseLine(struct Cmd cmd[], FILE *input_filestream, int isBatch);
int parseCmd(char *cmd_str, struct Cmd *cmd);
int getOutputFile(struct Cmd *cmd);
int getBackgroundExecution(struct Cmd *cmd);
//concurrency function (return: int, arg: struct Cmd *)
void *execCmd(void *inputCmd);
int cmdCases(struct Cmd *cmd);
void cdCmd(struct Cmd *cmd);
void dirCmd(struct Cmd *cmd, int cmd_size);
void environCmd(struct Cmd *cmd);
void echoCmd(struct Cmd *cmd);
void helpCmd(struct Cmd *cmd, int cmd_size);
void pauseCmd(struct Cmd *cmd);
void extCmd(struct Cmd *cmd);