-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
39 lines (32 loc) · 1 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
/********************************************************************************/
/* Name: Priyendu Mori */
/* Roll no: 2018201103 */
/********************************************************************************/
#include "header.h"
#include "macro.h"
extern struct winsize w;
/*
main function that drives the entire application
*/
int main(int argc, char *argv[]){
printf("\033[?1049h\033[H"); //alternate buffer
extern string home,currentPath;
extern ofstream myfile;
extern stack<string> backstack;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
if(argc==1){
home=getpwd();
backstack.push(home);
currentPath=home;
listContent(".");
handleCommands(false);
}
else{
home=argv[1];
backstack.push(home);
currentPath=argv[1];
listContent(argv[1]);
handleCommands(false);
}
return 0;
}