-
Notifications
You must be signed in to change notification settings - Fork 0
/
IfCommand.cpp
45 lines (39 loc) · 920 Bytes
/
IfCommand.cpp
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
//
// Created by franckito on 12/19/18.
//
//
// Created by franckito on 12/18/18.
//
#include "Command.h"
#include "VarCommand.h"
#include "Parser.h"
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/in.h>
#include <string.h>
#include "ConnectCommand.h"
#include <sys/socket.h>
#include "LoopCommand.h"
#include "IfCommand.h"
int IfCommand::execute(vector<string> cmdTemp, int index){
Parser* p = new Parser();
int endLine = enterKey(cmdTemp, index), ret = 0;
conditionReader(cmdTemp, index);
if(check()) {
ret = p->strPrsTarget(cmdTemp, index + endLine, "}");
}
return ret;
}
int IfCommand::enterKey(vector<string> vector, int index){
int i = 0;
while(vector.at(index + i) != "\n") {
i++;
}
return i;
}
IfCommand::IfCommand() = default;
IfCommand::~IfCommand() = default;