41 lines
582 B
C++
41 lines
582 B
C++
#include "everything.hpp"
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
// Check argument
|
|
if(argc <= 1) {
|
|
std::cerr << "No input filename\n";
|
|
return 1;
|
|
}
|
|
string filename = argv[1];
|
|
|
|
// Check existing file
|
|
std::ifstream infile(filename);
|
|
if(!infile.good()) {
|
|
std::cerr << "Bad input filename\n";
|
|
return 1;
|
|
}
|
|
|
|
// Load file
|
|
Treap file;
|
|
string line;
|
|
while (std::getline(infile, line))
|
|
file.append(line);
|
|
|
|
// Init
|
|
initscr();
|
|
refresh();
|
|
|
|
Editor ed(filename, file);
|
|
|
|
ed.print_file();
|
|
|
|
// Main loop
|
|
while(ed.take_action())
|
|
refresh();
|
|
|
|
// End
|
|
endwin();
|
|
return 0;
|
|
}
|