16 #include <sys/cygwin.h> 24 #include <sys/types.h> 28 #include <sys/pstat.h> 30 #if defined(LOAD_RELATIVE) && defined(HAVE_DLADDR) 37 #if defined(HAVE_FCNTL_H) 39 #elif defined(HAVE_SYS_FCNTL_H) 40 #include <sys/fcntl.h> 42 #ifdef HAVE_SYS_PARAM_H 43 # include <sys/param.h> 46 # define MAXPATHLEN 1024 55 #define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) 57 #if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS 58 #define DEFAULT_RUBYGEMS_ENABLED "disabled" 60 #define DEFAULT_RUBYGEMS_ENABLED "enabled" 63 #define DISABLE_BIT(bit) (1U << disable_##bit) 70 #define DUMP_BIT(bit) (1U << dump_##bit) 109 #define src_encoding_index GET_VM()->src_encoding_index 119 #if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS 127 #define forbid_setid(s) forbid_setid((s), opt) 142 unsigned short namelen, secondlen;
144 #define M(shortopt, longopt, desc) { \ 145 shortopt " " longopt " " desc, \ 146 (unsigned short)sizeof(shortopt), \ 147 (unsigned short)sizeof(longopt), \ 149 static const struct message usage_msg[] = {
150 M(
"-0[octal]",
"",
"specify record separator (\\0, if no argument)"),
151 M(
"-a",
"",
"autosplit mode with -n or -p (splits $_ into $F)"),
152 M(
"-c",
"",
"check syntax only"),
153 M(
"-Cdirectory",
"",
"cd to directory before executing your script"),
154 M(
"-d",
", --debug",
"set debugging flags (set $DEBUG to true)"),
155 M(
"-e 'command'",
"",
"one line of script. Several -e's allowed. Omit [programfile]"),
156 M(
"-Eex[:in]",
", --encoding=ex[:in]",
"specify the default external and internal character encodings"),
157 M(
"-Fpattern",
"",
"split() pattern for autosplit (-a)"),
158 M(
"-i[extension]",
"",
"edit ARGV files in place (make backup if extension supplied)"),
159 M(
"-Idirectory",
"",
"specify $LOAD_PATH directory (may be used more than once)"),
160 M(
"-l",
"",
"enable line ending processing"),
161 M(
"-n",
"",
"assume 'while gets(); ... end' loop around your script"),
162 M(
"-p",
"",
"assume loop like -n but print line also like sed"),
163 M(
"-rlibrary",
"",
"require the library before executing your script"),
164 M(
"-s",
"",
"enable some switch parsing for switches after script name"),
165 M(
"-S",
"",
"look for the script using PATH environment variable"),
166 M(
"-T[level=1]",
"",
"turn on tainting checks"),
167 M(
"-v",
", --verbose",
"print version number, then turn on verbose mode"),
168 M(
"-w",
"",
"turn warnings on for your script"),
169 M(
"-W[level=2]",
"",
"set warning level; 0=silence, 1=medium, 2=verbose"),
170 M(
"-x[directory]",
"",
"strip off text before #!ruby line and perhaps cd to directory"),
171 M(
"-h",
"",
"show this message, --help for more info"),
173 static const struct message help_msg[] = {
174 M(
"--copyright",
"",
"print the copyright"),
175 M(
"--enable=feature[,...]",
", --disable=feature[,...]",
176 "enable or disable features"),
177 M(
"--external-encoding=encoding",
", --internal-encoding=encoding",
178 "specify the default external or internal character encoding"),
179 M(
"--version",
"",
"print the version"),
180 M(
"--help",
"",
"show this message, -h for short message"),
182 static const struct message features[] = {
184 M(
"rubyopt",
"",
"RUBYOPT environment variable (default: enabled)"),
186 int i, w = 16, num =
numberof(usage_msg) - (help ? 1 : 0);
187 #define SHOW(m) do { \ 188 int wrap = help && (m).namelen + (m).secondlen - 2 > w; \ 189 printf(" %.*s%-*.*s%-*s%s\n", (m).namelen-1, (m).str, \ 190 (wrap ? 0 : w - (m).namelen + 1), \ 191 (help ? (m).secondlen-1 : 0), (m).str + (m).namelen, \ 192 (wrap ? w + 3 : 0), (wrap ? "\n" : ""), \ 193 (m).str + (m).namelen + (m).secondlen); \ 196 printf(
"Usage: %s [switches] [--] [programfile] [arguments]\n",
name);
197 for (
i = 0;
i < num; ++
i)
213 static char *newp, *oldp;
214 static int newl, oldl, notfound;
218 if (!newp && !notfound) {
219 newp =
getenv(
"RUBYLIB_PREFIX");
221 oldp = newp =
strdup(newp);
222 while (*newp && !
ISSPACE(*newp) && *newp !=
';') {
226 while (*newp && (
ISSPACE(*newp) || *newp ==
';')) {
230 if (newl == 0 || oldl == 0) {
231 rb_fatal(
"malformed RUBYLIB_PREFIX");
233 translit_char(newp,
'\\',
'/');
239 if (!newp || l < oldl ||
STRNCASECMP(oldp, s, oldl) != 0) {
244 memcpy(ptr, newp, newl);
245 memcpy(ptr + newl, s + oldl, l - oldl);
246 ptr[l + newl - oldl] = 0;
250 #define rubylib_mangled_path rb_str_new 265 for (s =
p; *s && *s != sep; s =
CharNext(s));
273 push_include_cygwin(
const char *path,
VALUE (*filter)(
VALUE))
276 char rubylib[FILENAME_MAX];
285 for (s =
p; *s && *s !=
';'; s =
CharNext(s));
297 #ifdef HAVE_CYGWIN_CONV_PATH 298 #define CONV_TO_POSIX_PATH(p, lib) \ 299 cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, (p), (lib), sizeof(lib)) 301 #define CONV_TO_POSIX_PATH(p, lib) \ 302 cygwin_conv_to_posix_path((p), (lib)) 304 if (CONV_TO_POSIX_PATH(
p, rubylib) == 0)
312 #define push_include push_include_cygwin 347 if (*
p ==
'.' &&
p[1] ==
'/')
358 #if defined _WIN32 || defined __CYGWIN__ 359 static HMODULE libruby;
362 DllMain(HINSTANCE dll,
DWORD reason, LPVOID reserved)
364 if (reason == DLL_PROCESS_ATTACH)
370 rb_libruby_handle(
void)
388 ID id_initial_load_path_mark;
391 #if defined LOAD_RELATIVE 392 # if defined HAVE_DLADDR || defined HAVE_CYGWIN_CONV_PATH 393 # define VARIABLE_LIBPATH 1 395 # define VARIABLE_LIBPATH 0 397 # if VARIABLE_LIBPATH 406 #if defined _WIN32 || defined __CYGWIN__ 407 # if VARIABLE_LIBPATH 410 GetModuleFileName(libruby, libpath,
MAXPATHLEN);
412 GetModuleFileName(libruby, libpath,
sizeof libpath);
414 #elif defined(__EMX__) 415 _execname(libpath,
sizeof(libpath) - 1);
416 #elif defined(HAVE_DLADDR) 431 #if !VARIABLE_LIBPATH 432 libpath[
sizeof(libpath) - 1] =
'\0';
435 translit_char(libpath,
'\\',
'/');
436 #elif defined __CYGWIN__ 438 # if VARIABLE_LIBPATH 439 const int win_to_posix = CCP_WIN_A_TO_POSIX | CCP_RELATIVE;
440 size_t newsize = cygwin_conv_path(win_to_posix, libpath, 0, 0);
444 if (cygwin_conv_path(win_to_posix, libpath,
p, newsize) == 0) {
451 char rubylib[FILENAME_MAX];
452 cygwin_conv_to_posix_path(libpath, rubylib);
453 strncpy(libpath, rubylib,
sizeof(libpath));
459 static const char bindir[] =
"/bin";
460 #ifdef LIBDIR_BASENAME 461 static const char libdir[] =
"/"LIBDIR_BASENAME;
463 static const char libdir[] =
"/lib";
465 const ptrdiff_t bindir_len = (ptrdiff_t)
sizeof(bindir) - 1;
466 const ptrdiff_t libdir_len = (ptrdiff_t)
sizeof(libdir) - 1;
468 if (
p - libpath >= bindir_len && !
STRCASECMP(
p - bindir_len, bindir)) {
472 else if (
p - libpath >= libdir_len && !strcmp(
p - libdir_len, libdir)) {
477 #if !VARIABLE_LIBPATH 479 strlcpy(libpath,
".",
sizeof(libpath));
482 baselen =
p - libpath;
483 #define PREFIX_PATH() rb_str_new(libpath, baselen) 485 baselen =
p - libpath;
488 #define PREFIX_PATH() sopath 491 #define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen) 493 #define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), (path), (len)) 495 static const char exec_prefix[] = RUBY_EXEC_PREFIX;
496 #define RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len)) 497 #define PREFIX_PATH() RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1) 499 load_path =
GET_VM()->load_path;
501 if (safe_level == 0) {
510 size_t len =
strlen(paths);
512 rb_ivar_set(path, id_initial_load_path_mark, path);
532 RBASIC(feature)->klass = 0;
591 if (s[1] ==
'-' && s[2] ==
'\0')
596 for (
p = s + 1; *
p;
p++) {
608 rb_str_new2(
"invalid name for global variable - ");
615 name_error[1] =
args[-1];
621 for (
p = s + 1; *
p; ++
p) {
644 VALUE argstr, argary;
653 memcpy(
p, s, len + 1);
685 #define NAME_MATCH_P(name, str, len) \ 686 ((len) < (int)sizeof(name) && strncmp((str), (name), (len)) == 0) 688 #define UNSET_WHEN(name, bit, str, len) \ 689 if (NAME_MATCH_P((name), (str), (len))) { \ 690 *(unsigned int *)arg &= ~(bit); \ 694 #define SET_WHEN(name, bit, str, len) \ 695 if (NAME_MATCH_P((name), (str), (len))) { \ 696 *(unsigned int *)arg |= (bit); \ 703 #define UNSET_WHEN_DISABLE(bit) UNSET_WHEN(#bit, DISABLE_BIT(bit), str, len) 707 *(
unsigned int *)arg = 0
U;
710 rb_warn(
"unknown argument for --enable: `%.*s'", len, str);
716 #define SET_WHEN_DISABLE(bit) SET_WHEN(#bit, DISABLE_BIT(bit), str, len) 720 *(
unsigned int *)arg = ~0
U;
723 rb_warn(
"unknown argument for --disable: `%.*s'", len, str);
729 #define SET_WHEN_DUMP(bit) SET_WHEN(#bit, DUMP_BIT(bit), str, len) 739 rb_warn(
"don't know how to dump `%.*s',", len, str);
740 rb_warn(
"but only [version, copyright, usage, yydebug, syntax, parsetree, parsetree_with_comment, insns].");
748 if (!elen) elen =
strlen(e);
759 #define set_internal_encoding_once(opt, e, elen) \ 760 set_option_encoding_once("default_internal", &(opt)->intern.enc.name, (e), (elen)) 761 #define set_external_encoding_once(opt, e, elen) \ 762 set_option_encoding_once("default_external", &(opt)->ext.enc.name, (e), (elen)) 763 #define set_source_encoding_once(opt, e, elen) \ 764 set_option_encoding_once("source", &(opt)->src.enc.name, (e), (elen)) 769 long n, argc0 =
argc;
776 const char *
const arg =
argv[0];
777 if (!arg || arg[0] !=
'-' || !arg[1])
784 if (envopt)
goto noenvopt;
790 if (envopt)
goto noenvopt;
794 if (envopt)
goto noenvopt;
806 if (envopt)
goto noenvopt;
849 if (envopt)
goto noenvopt;
855 if (envopt)
goto noenvopt;
862 if (envopt)
goto noenvopt;
867 if (envopt)
goto noenvopt;
874 if (envopt)
goto noenvopt;
881 if (envopt)
goto noenvopt;
911 if (envopt)
goto noenvopt;
917 if (envopt)
goto noenvopt;
920 if (*s && chdir(s) < 0) {
927 if (envopt)
goto noenvopt;
942 if (envopt)
goto noenvopt;
949 if (!*++s && (!--
argc || !(s = *++
argv))) {
972 case 'N':
case 'n':
case 'A':
case 'a':
1011 if (envopt)
goto noenvopt;
1021 else if (
v == 0 && numlen >= 2) {
1032 if (!s[1] || (s[1] ==
'\r' && !s[2])) {
1038 # define is_option_end(c, allow_hyphen) \ 1039 (!(c) || ((allow_hyphen) && (c) == '-') || (c) == '=') 1040 # define check_envopt(name, allow_envopt) \ 1041 (((allow_envopt) || !envopt) ? (void)0 : \ 1042 rb_raise(rb_eRuntimeError, "invalid switch in RUBYOPT: --" name)) 1043 # define need_argument(name, s) \ 1044 ((*(s)++ ? !*(s) : (!--argc || !((s) = *++argv))) ? \ 1045 rb_raise(rb_eRuntimeError, "missing argument for --" name) \ 1047 # define is_option_with_arg(name, allow_hyphen, allow_envopt) \ 1048 (strncmp((name), s, n = sizeof(name) - 1) == 0 && is_option_end(s[n], (allow_hyphen)) ? \ 1049 (check_envopt(name, (allow_envopt)), s += n, need_argument(name, s), 1) : 0) 1051 if (strcmp(
"copyright", s) == 0) {
1052 if (envopt)
goto noenvopt_long;
1055 else if (strcmp(
"debug", s) == 0) {
1069 # define set_encoding_part(type) \ 1070 if (!(p = strchr(s, ':'))) { \ 1071 set_##type##_encoding_once(opt, s, 0); \ 1075 set_##type##_encoding_once(opt, s, p-s); \ 1078 if (!*(s = ++
p))
break;
1080 if (!*(s = ++
p))
break;
1081 #if defined ALLOW_DEFAULT_SOURCE_ENCODING && ALLOW_DEFAULT_SOURCE_ENCODING 1083 if (!*(s = ++
p))
break;
1086 (arg[1] ==
'-' ?
"--encoding" :
"-E"), s);
1087 # undef set_encoding_part 1096 #if defined ALLOW_DEFAULT_SOURCE_ENCODING && ALLOW_DEFAULT_SOURCE_ENCODING 1101 else if (strcmp(
"version", s) == 0) {
1102 if (envopt)
goto noenvopt_long;
1105 else if (strcmp(
"verbose", s) == 0) {
1109 else if (strcmp(
"yydebug", s) == 0) {
1110 if (envopt)
goto noenvopt_long;
1116 else if (strcmp(
"help", s) == 0) {
1117 if (envopt)
goto noenvopt_long;
1123 "invalid option --%s (-h will show valid options)", s);
1135 "invalid option -%c (-h will show valid options)",
1136 (
int)(
unsigned char)*s);
1140 "invalid option -\\x%02X (-h will show valid options)",
1141 (
int)(
unsigned char)*s);
1157 # undef is_option_end 1158 # undef check_envopt 1159 # undef need_argument 1160 # undef is_option_with_arg 1165 return argc0 -
argc;
1190 #define rb_progname (GET_VM()->progname) 1205 #define rb_define_readonly_boolean(name, val) \ 1206 rb_define_virtual_variable((name), (val) ? true_value : false_value, 0) 1329 opt->
src.
enc.name = src_enc_name;
1331 opt->
ext.
enc.name = ext_enc_name;
1337 rb_warning(
"-K is specified; it is for 1.8 compatibility and may cause odd behavior");
1364 char *path =
getenv(
"RUBYPATH");
1383 #if defined DOSISH || defined __CYGWIN__ 1397 if (opt->
ext.
enc.name != 0) {
1403 if (opt->
src.
enc.name != 0) {
1407 if (opt->
ext.
enc.index >= 0) {
1430 #if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS 1442 #define PREPARE_PARSE_MAIN(expr) do { \ 1443 rb_env_t *env = toplevel_context(toplevel_binding); \ 1444 th->parse_in_eval--; \ 1445 th->base_block = &env->block; \ 1447 th->parse_in_eval++; \ 1448 th->base_block = 0; \ 1454 if (opt->
src.
enc.index >= 0) {
1481 if (opt->
ext.
enc.index >= 0) {
1498 if (!tree)
return Qfalse;
1509 printf(
"Syntax OK\n");
1537 path = rb_realpath_internal(Qnil, opt->script_name, 1);
1583 if (strcmp(fname,
"-") == 0) {
1587 int fd, mode = O_RDONLY;
1588 #if defined DOSISH || defined __CYGWIN__ 1601 #if !defined DOSISH && !defined __CYGWIN__ 1604 if (
fstat(fd, &st) != 0)
1615 CONST_ID(set_encoding,
"set_encoding");
1620 int no_src_enc = !opt->
src.
enc.name;
1621 int no_ext_enc = !opt->
ext.
enc.name;
1627 if (xflag || opt->
xflag) {
1655 goto search_shebang;
1670 else if (!
NIL_P(c)) {
1674 if (no_src_enc && opt->
src.
enc.name) {
1678 if (no_ext_enc && opt->
ext.
enc.name) {
1681 if (no_int_enc && opt->
intern.
enc.name) {
1685 else if (!
NIL_P(c)) {
1695 if (opt->
src.
enc.index >= 0) {
1809 if (uid != euid) opt->
setids |= 1;
1810 if (egid != gid) opt->
setids |= 2;
1811 if (uid && opt->
setids) {
1831 VALUE *variable = data;
1838 VALUE *variable = data;
1839 switch (*variable) {
1881 #if defined(USE_DLN_A_OUT) 1885 dln_argv0 =
argv[0];
1908 #ifndef HAVE_SETPROCTITLE 1910 extern void ruby_init_setproctitle(
int argc,
char *
argv[]);
1911 ruby_init_setproctitle(
argc,
argv);
1915 return (
void*)(
struct RData*)iseq;
1921 int f0, f1, f2, fds[2];
1927 if (pipe(fds) == 0) {
1936 if (pipe(fds) == 0) {
1938 if (f1 && fds[1] != 1)
1940 if (f2 && fds[1] != 2)
1942 if (fds[1] != 1 && fds[1] != 2)
1963 #if defined(USE_DLN_A_OUT) #define STRNCASECMP(s1, s2, n)
RUBY_EXTERN VALUE rb_cString
void rb_define_global_const(const char *, VALUE)
static void ruby_init_prelude(void)
static void process_sflag(int *sflag)
VALUE rb_parser_dump_tree(NODE *node, int comment)
static VALUE load_file_internal(VALUE arg)
static VALUE restore_lineno(VALUE lineno)
static void dump_option(const char *str, int len, void *arg)
NODE * rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int start)
size_t strlen(const char *)
void rb_update_max_fd(int fd)
#define scan_oct(s, l, e)
struct cmdline_options::@114 ext
void ruby_set_inplace_mode(const char *)
int rb_cloexec_open(const char *pathname, int flags, mode_t mode)
VALUE rb_str_cat(VALUE, const char *, long)
void ruby_each_words(const char *, void(*)(const char *, int, void *), void *)
void ruby_show_version(void)
Prints the version information of the CRuby interpreter to stdout.
VALUE rb_ary_shift(VALUE ary)
VALUE rb_parser_end_seen_p(VALUE vparser)
char * dln_find_file_r(const char *, const char *, char *, size_t)
VALUE rb_enc_from_encoding(rb_encoding *encoding)
static VALUE rb_f_chop(void)
RUBY_EXTERN VALUE rb_stdin
void ruby_show_copyright(void)
Prints the copyright notice of the CRuby interpreter to stdout and exits this process successfully...
rb_encoding * rb_default_internal_encoding(void)
VALUE rb_ary_push(VALUE ary, VALUE item)
struct cmdline_options::@114 intern
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
static void add_modules(VALUE *req_list, const char *mod)
void rb_raise(VALUE exc, const char *fmt,...)
void ruby_init_loadpath_safe(int safe_level)
static VALUE expand_include_path(VALUE path)
void rb_enc_set_default_external(VALUE encoding)
VALUE rb_enc_associate(VALUE obj, rb_encoding *enc)
VALUE rb_io_getbyte(VALUE)
VALUE rb_ary_clear(VALUE ary)
static void require_libraries(VALUE *req_list)
#define M(shortopt, longopt, desc)
static void disable_option(const char *str, int len, void *arg)
static struct @113 origarg
#define PREPARE_PARSE_MAIN(expr)
#define GetEnvPtr(obj, ptr)
static void verbose_setter(VALUE val, ID id, void *data)
VALUE rb_io_write(VALUE, VALUE)
static VALUE rb_f_sub(int argc, VALUE *argv)
void rb_define_global_function(const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a global function.
rb_encoding * rb_utf8_encoding(void)
void rb_load_fail(VALUE path, const char *err)
VALUE rb_str_tmp_new(long)
void rb_loaderror(const char *fmt,...)
struct cmdline_options * opt
static void set_option_encoding_once(const char *type, VALUE *name, const char *e, long elen)
VALUE rb_external_str_new_cstr(const char *)
VALUE rb_parser_set_yydebug(VALUE self, VALUE flag)
const char * rb_obj_classname(VALUE)
static rb_env_t * toplevel_context(VALUE toplevel_binding)
VALUE rb_gv_set(const char *, VALUE)
void ruby_incpush(const char *path)
void rb_exc_raise(VALUE mesg)
#define RB_TYPE_P(obj, type)
#define set_external_encoding_once(opt, e, elen)
static void fill_standard_fds(void)
VALUE rb_gv_get(const char *)
#define MEMZERO(p, type, n)
void rb_set_safe_level(int)
static void enable_option(const char *str, int len, void *arg)
VALUE rb_require(const char *)
VALUE rb_lastline_get(void)
rb_encoding * rb_default_external_encoding(void)
RUBY_EXTERN VALUE rb_output_rs
static NODE * load_file(VALUE, VALUE, int, struct cmdline_options *)
NODE * rb_parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
static void push_include(const char *path, VALUE(*filter)(VALUE))
VALUE rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path)
VALUE rb_class_new_instance(int, VALUE *, VALUE)
VALUE rb_str_encode_ospath(VALUE path)
#define is_option_with_arg(name, allow_hyphen, allow_envopt)
static void init_ids(struct cmdline_options *)
#define RUBY_RELATIVE(path, len)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_parser_encoding(VALUE vparser)
#define SET_WHEN_DUMP(bit)
RUBY_EXTERN char * strstr(const char *, const char *)
#define GetBindingPtr(obj, ptr)
static VALUE false_value(void)
VALUE rb_str_cat2(VALUE, const char *)
static void moreswitches(const char *s, struct cmdline_options *opt, int envopt)
static void usage(const char *name, int help)
static VALUE enc_name(VALUE self)
void ruby_incpush_expand(const char *path)
#define UNSET_WHEN_DISABLE(bit)
#define DEFAULT_RUBYGEMS_ENABLED
void rb_lastline_set(VALUE)
NODE * rb_parser_append_print(VALUE vparser, NODE *node)
VALUE rb_external_str_new(const char *, long)
void rb_gc_register_mark_object(VALUE obj)
void ruby_push_include(const char *path, VALUE(*filter)(VALUE))
NODE * rb_parser_while_loop(VALUE vparser, NODE *node, int chop, int split)
VALUE rb_str_resize(VALUE, long)
void ruby_set_script_name(VALUE name)
Sets the current script name to this value.
VALUE rb_const_get(VALUE, ID)
VALUE rb_io_fdopen(int, int, const char *)
VALUE rb_reg_new(const char *, long, int)
VALUE rb_funcall2(VALUE, ID, int, const VALUE *)
Calls a method.
void rb_w32_sysinit(int *argc, char ***argv)
void rb_fatal(const char *fmt,...)
void ruby_prog_init(void)
Defines built-in variables.
#define rubylib_mangled_path
VALUE rb_ivar_set(VALUE, ID, VALUE)
unsigned char buf[MIME_BUF_SIZE]
void rb_const_set(VALUE, ID, VALUE)
#define set_encoding_part(type)
rb_encoding * rb_locale_encoding(void)
char * strchr(char *, char)
struct cmdline_options::@114 src
static int opt_enc_index(VALUE enc_name)
#define NAME_MATCH_P(name, str, len)
static int rb_enc_dummy_p(rb_encoding *enc)
RUBY_EXTERN size_t strlcpy(char *, const char *, size_t)
VALUE rb_ensure(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*e_proc)(ANYARGS), VALUE data2)
VALUE rb_str_new_cstr(const char *)
static VALUE uscore_get(void)
VALUE rb_io_ungetbyte(VALUE, VALUE)
static struct cmdline_options * cmdline_options_init(struct cmdline_options *opt)
void rb_define_hooked_variable(const char *, VALUE *, VALUE(*)(ANYARGS), void(*)(ANYARGS))
VALUE rb_str_freeze(VALUE)
void rb_gc_set_params(void)
static VALUE opt_W_getter(ID id, void *data)
#define StringValueCStr(v)
static VALUE identical_path(VALUE path)
#define set_source_encoding_once(opt, e, elen)
VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE *)
#define SET_WHEN_DISABLE(bit)
void * ruby_process_options(int argc, char **argv)
void ruby_script(const char *name)
Sets the current script name to this value.
struct cmdline_options::@114::@115 enc
VALUE rb_file_expand_path(VALUE fname, VALUE dname)
static VALUE rb_f_gsub(int argc, VALUE *argv)
void ruby_init_loadpath(void)
void rb_enc_set_default_internal(VALUE encoding)
void rb_gvar_readonly_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
RUBY_EXTERN char * strerror(int)
void ruby_set_argv(int argc, char **argv)
struct rb_encoding_entry * list
void rb_define_variable(const char *, VALUE *)
#define set_internal_encoding_once(opt, e, elen)
#define src_encoding_index
void rb_vm_set_progname(VALUE filename)
const char ruby_initial_load_paths[]
VALUE rb_parser_new(void)
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict)
#define StringValuePtr(v)
void ruby_sysinit(int *argc, char ***argv)
Initializes the process for ruby(1).
static char fbuf[MAXPATHLEN]
RUBY_EXTERN int dup2(int, int)
#define STRCASECMP(s1, s2)
rb_encoding * rb_ascii8bit_encoding(void)
void rb_warning(const char *fmt,...)
int rb_enc_find_index(const char *name)
#define CONST_ID(var, str)
RUBY_EXTERN VALUE rb_stdout
static void version(void)
#define rb_intern_const(str)
VALUE rb_obj_freeze(VALUE)
static VALUE true_value(void)
static VALUE rb_f_chomp(int argc, VALUE *argv)
VALUE rb_define_module(const char *name)
void rb_stdio_set_default_encoding(void)
VALUE rb_const_remove(VALUE, ID)
#define rb_define_readonly_boolean(name, val)
static VALUE locale_path(VALUE path)
RUBY_EXTERN void setproctitle(const char *fmt,...)
static VALUE process_options(int argc, char **argv, struct cmdline_options *opt)
static rb_thread_t * GET_THREAD(void)
VALUE rb_iseq_disasm(VALUE self)
VALUE rb_str_new2(const char *)
void rb_warn(const char *fmt,...)
char * strrchr(const char *, const char)
int parse_in_eval
Thread-local state of evaluation context.
rb_encoding * rb_enc_from_index(int index)
static long proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
void * rb_load_file(const char *fname)
VALUE rb_str_new(const char *, long)
static void set_arg0(VALUE val, ID id)