#include <iostream>
#include <stdexcept>
#include <fstream>
#include "byteman.h"
#include "Common/str.h"
#include "Common/Coords.h"
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
| |
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Main function for byteman. Parses command line arguments and eventual streamed script files as individual commands (instructions) and feeds them into parse(). Catches any thrown exceptions by the subsystems in byteman.
argc argv[] Command line arguments
Definition at line 35 of file byteman.cpp.
40 bytemanInstance.
help(
"", 1);
42 bool readSTDIN =
false;
43 for(
int argi = 1 ; argi < argc ; argi++) {
44 if(argv[argi][0] ==
'-' && !command.empty()){
45 bytemanInstance.
parse(command);
49 command.append(argv[argi]);
51 command.append(
" ").append(argv[argi]);
52 if(command ==
"-stdin" || command ==
"-s"){
58 bytemanInstance.
parse(command);
60 getline(cin, command);
63 if(command !=
"" && command.at(command.find_first_not_of(
" \t")) !=
'#'){
64 if(string::npos != command.find(
"#"))
65 command = command.substr(0, command.find(
"#"));
66 bytemanInstance.
parse(command);
69 }
catch (
const exception &e){
70 cout <<
"The program was terminated with message: \n\t'" << e.what() <<
"'\nWhile trying to execute command: \n\t'" << command <<
"'" << endl;
void help(std::string, int)
References byteman::help(), and byteman::parse().