-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse.h
41 lines (27 loc) · 955 Bytes
/
parse.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
#include <stdio.h>
#ifndef PARSE_H_
#define PARSE_H_
/* don’t test program with more than this many tokens for input */
#define MAXARGS 32
/* structure to hold input data */
struct PARAM
{
char *inputRedirect; /* file name or NULL */
char *outputRedirect; /* file name or NULL */
int background;/* either 0 (false) or 1 (true) */
int argumentCount;/* number of tokens in argument vector */
char *argumentVector[MAXARGS]; /* array of strings */
};
/* a typedef so we don’t need to use "struct PARAM" all the time */
typedef struct PARAM Param_t;
void parsestr(char*);
Param_t * createParam();
Param_t * clearParam(Param_t * param);
Param_t * deleteParam(Param_t * param);
Param_t * stringtokenizer(Param_t * param);
void prompt();
Param_t * stringbreaker(char*str, Param_t * param);
void printParams(Param_t * param);
Param_t *parseParams(char **strings, Param_t *param);
Param_t *parseStrings(char* str, Param_t param);
#endif