-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
50 lines (43 loc) · 1.43 KB
/
main.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
46
47
48
49
50
/************************************************************************
** RollNo:2018201033 Name : Darshan Kansagara **
************************************************************************/
/************************************************************************
** This is main file from where Program started and its **
** take either zero or one argument as path **
************************************************************************/
//**********************************************************************
// Header file
//**********************************************************************
#include "myheader.h"
//**********************************************************************
// Global variable Declaration area
//**********************************************************************
char *root;
stack<string> back_stack;
stack<string> forw_stack;
//**********************************************************************
// Main Method
//**********************************************************************
int main(int argc, char *argv[])
{
if (argc == 1)
{
string s = ".";
char *path = new char[s.length() + 1];
strcpy(path, s.c_str());
root = path;
openDirecoty(".");
}
else if (argc == 2)
{
root = argv[1];
openDirecoty(argv[1]);
}
else
{
cout << "Invalid Argument !!!" << endl;
}
//Start Navigating through Command prompt
navigate();
return 0;
}