-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.h
39 lines (33 loc) · 830 Bytes
/
tree.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
#ifndef TREE_H
#define TREE_H
#include <stdio.h>
#include <unistd.h>
#include <setjmp.h>
#include <string.h>
#include "word_list.h"
extern jmp_buf notree;
typedef enum {NXT, AND, OR} next_type;
struct Tree {
int argc;
char **argv;
char *infile;
char *outfile;
int backgrnd;
next_type type;
int append;
struct Tree *psubcmd;
struct Tree *pipe;
struct Tree *next;
};
typedef struct Tree *tree;
void add_argv(tree Node, char* str);
tree listToNode(tree node, Array *wordList, int start, int* newstart);
tree parseWordlist(tree Node, Array *wordList, int start, int opened);
tree createNode(tree Node);
void error(char *str);
void freeTree(tree t);
void freeTreeNoSub(tree t);
void print_tree(tree t, int shift);
int checkBrackets(Array* wordList);
int checkwordList(Array *wordList);
#endif