Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <string>
- #include <ruby.h>
- using namespace std;
- string RUBY_CODE =
- "";
- /*
- * This method here loads the script file in RUBY_CODE then gets the DVOPT
- * Environment variable which then gets parsed onto the script. The script will
- * handle all the command line arguments and everything else, this is just here to
- * load the script so nobody else can see it.
- *
- */
- int load_script(string script_path)
- {
- return 0;
- }
- int main(int argc, char *argv[])
- {
- /*
- * Set the DVOPT ENV variable for the ruby script to use as ARGV(in a different variable)
- */
- if (setenv("DVOPT", (char*)&argv ,1) != 0)
- {
- cout << "Error: Failed to set environment variable 'DVOPT'" << endl;
- exit(-1);
- }
- cout << getenv("DVOPT");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement