Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <string>
  4. #include <ruby.h>
  5.  
  6. using namespace std;
  7.  
  8. string RUBY_CODE =
  9. "";
  10.  
  11. /*
  12. * This method here loads the script file in RUBY_CODE then gets the DVOPT
  13. * Environment variable which then gets parsed onto the script. The script will
  14. * handle all the command line arguments and everything else, this is just here to
  15. * load the script so nobody else can see it.
  16. *
  17. */
  18. int load_script(string script_path)
  19. {
  20. return 0;
  21. }
  22.  
  23. int main(int argc, char *argv[])
  24. {
  25.  
  26. /*
  27. * Set the DVOPT ENV variable for the ruby script to use as ARGV(in a different variable)
  28. */
  29. if (setenv("DVOPT", (char*)&argv ,1) != 0)
  30. {
  31. cout << "Error: Failed to set environment variable 'DVOPT'" << endl;
  32. exit(-1);
  33. }
  34.  
  35. cout << getenv("DVOPT");
  36. return EXIT_SUCCESS;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement