[ruby/strscan] jruby: Check if len++ walked off the end
[ruby.git] / main.c
blob525189db854292421b18aac3c8567a4d0a225515
1 /**********************************************************************
3 main.c -
5 $Author$
6 created at: Fri Aug 19 13:19:58 JST 1994
8 Copyright (C) 1993-2007 Yukihiro Matsumoto
10 **********************************************************************/
12 /*!
13 * \mainpage Developers' documentation for Ruby
15 * This documentation is produced by applying Doxygen to
16 * <a href="https://github.com/ruby/ruby">Ruby's source code</a>.
17 * It is still under construction (and even not well-maintained).
18 * If you are familiar with Ruby's source code, please improve the doc.
20 #undef RUBY_EXPORT
21 #include "ruby.h"
22 #include "vm_debug.h"
23 #include "internal/sanitizers.h"
24 #ifdef HAVE_LOCALE_H
25 #include <locale.h>
26 #endif
28 #if defined RUBY_DEVEL && !defined RUBY_DEBUG_ENV
29 # define RUBY_DEBUG_ENV 1
30 #endif
31 #if defined RUBY_DEBUG_ENV && !RUBY_DEBUG_ENV
32 # undef RUBY_DEBUG_ENV
33 #endif
35 RUBY_GLOBAL_SETUP
37 static int
38 rb_main(int argc, char **argv)
40 RUBY_INIT_STACK;
41 ruby_init();
42 return ruby_run_node(ruby_options(argc, argv));
45 #ifdef _WIN32
46 #define main(argc, argv) w32_main(argc, argv)
47 static int main(int argc, char **argv);
48 int wmain(void) {return main(0, NULL);}
49 #endif
51 int
52 main(int argc, char **argv)
54 #if defined(RUBY_DEBUG_ENV) || USE_RUBY_DEBUG_LOG
55 ruby_set_debug_option(getenv("RUBY_DEBUG"));
56 #endif
57 #ifdef HAVE_LOCALE_H
58 setlocale(LC_CTYPE, "");
59 #endif
61 ruby_sysinit(&argc, &argv);
62 return ruby_start_main(rb_main, argc, argv);