-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheaderFile.h
More file actions
53 lines (42 loc) · 1.42 KB
/
Copy pathheaderFile.h
File metadata and controls
53 lines (42 loc) · 1.42 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
#ifndef HEADERFILE_H
#define HEADERFILE_H
#define MAX_TKNARG_SIZE 50
#define MAX_LEN 512
#define MAX_HISTORY_SIZE 20
#define DELIMITERS " \t\n;&><|"
#define DEBUG 0
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <limits.h>
#include <ctype.h>
#endif
typedef struct{
char name[20];
char tknArg[50][20];
} Alias;
int checkExit(char* string);
int checkInputLength(char* string);
char* flushInput(char* input);
int is_null_string(char *str);
char* getpath();
void setpath(char* new_path);
void restorePath(char* original_path);
int processFork(char* tknCmd,char* tknArg[50]);
void cd();
void cdArg(char* parameter);
void addAlias(Alias* aliases, int* size, char* name, char* args[], int numArgs);
void unAlias(char* str,Alias* aliases,int* arrLen);
void printAliases(Alias* aliases,int arrLen);
char** substituteAlias(Alias* aliases, int aliasesLen, char** input, int inputStringsLen,int *out);
void writeAliasToFile(Alias* aliases,int numAliases);
int posInAlias(Alias* aliases,char* str);
int countItemsOfArray(char** array);
void convertCharArr(char** char_ptr_ptr, int length, char** char_ptr_arr);
void printHistory(char history[][MAX_LEN+1], int history_count);
void writeHistoryToFile(char* historyPath, int history_count, char history[20][MAX_LEN+1]);
void readAliasesFromFile(char* aliasPath, Alias* aliases, int* num_aliases);