29 lines
533 B
C++
29 lines
533 B
C++
|
/**
|
||
|
builtin commands
|
||
|
*/
|
||
|
|
||
|
#include "cmds.h"
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int Cmds::cdExecute(const vector<string>* args, CommandExecutor*){
|
||
|
if (args->operator[](1) == "\0") {
|
||
|
cerr << "expected argument to \"cd\"\n";
|
||
|
} else {
|
||
|
if (chdir(args->operator[](1).c_str()) != 0) {
|
||
|
cerr << "error";
|
||
|
}
|
||
|
}
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
int Cmds::exitExecute(const vector<string>*, CommandExecutor*){
|
||
|
std::exit(EXIT_SUCCESS);
|
||
|
}
|
||
|
|
||
|
int Cmds::helpExecute(const vector<string>*, CommandExecutor*){
|
||
|
cout << " info" << endl;
|
||
|
return 1;
|
||
|
}
|
||
|
|