mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/readline/readline.c: use rb_f_notimplement for methods not
implemented. * ext/openssl/ossl_engine.c: ditto. * ext/openssl/ossl_config.c: ditto. * ext/openssl/ossl_cipher.c: ditto. * ext/openssl/ossl_pkcs5.c: ditto. * ext/openssl/ossl_x509ext.c: ditto. * ext/socket/socket.c: ditto. * ext/socket/basicsocket.c: ditto. * ext/socket/ancdata.c: ditto. * ext/socket/unixsocket.c: ditto. * ext/iconv/iconv.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
be2d3f5979
commit
05a278b4cd
13 changed files with 248 additions and 229 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
Sat Apr 18 23:07:18 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/readline/readline.c: use rb_f_notimplement for methods not
|
||||
implemented.
|
||||
|
||||
* ext/openssl/ossl_engine.c: ditto.
|
||||
|
||||
* ext/openssl/ossl_config.c: ditto.
|
||||
|
||||
* ext/openssl/ossl_cipher.c: ditto.
|
||||
|
||||
* ext/openssl/ossl_pkcs5.c: ditto.
|
||||
|
||||
* ext/openssl/ossl_x509ext.c: ditto.
|
||||
|
||||
* ext/socket/socket.c: ditto.
|
||||
|
||||
* ext/socket/basicsocket.c: ditto.
|
||||
|
||||
* ext/socket/ancdata.c: ditto.
|
||||
|
||||
* ext/socket/unixsocket.c: ditto.
|
||||
|
||||
* ext/iconv/iconv.c: ditto.
|
||||
|
||||
Sat Apr 18 21:07:34 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/curses/curses.c: use rb_f_notimplement for methods not
|
||||
|
|
|
@ -791,6 +791,7 @@ list_iconv(unsigned int namescount, const char *const *names, void *data)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ICONVLIST) || defined(HAVE___ICONV_FREE_LIST)
|
||||
static VALUE
|
||||
iconv_s_list(void)
|
||||
{
|
||||
|
@ -821,11 +822,12 @@ iconv_s_list(void)
|
|||
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
||||
rb_yield(RARRAY_PTR(ary)[i]);
|
||||
}
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
#else
|
||||
#define iconv_s_list rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Document-method: close
|
||||
|
@ -944,6 +946,7 @@ iconv_conv(int argc, VALUE *argv, VALUE self)
|
|||
return str;
|
||||
}
|
||||
|
||||
#ifdef ICONV_TRIVIALP
|
||||
/*
|
||||
* Document-method: trivial?
|
||||
* call-seq: trivial?
|
||||
|
@ -953,16 +956,16 @@ iconv_conv(int argc, VALUE *argv, VALUE self)
|
|||
static VALUE
|
||||
iconv_trivialp(VALUE self)
|
||||
{
|
||||
#ifdef ICONV_TRIVIALP
|
||||
int trivial = 0;
|
||||
iconv_ctl(self, ICONV_TRIVIALP, trivial);
|
||||
if (trivial) return Qtrue;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return Qfalse;
|
||||
}
|
||||
#else
|
||||
#define iconv_trivialp rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef ICONV_GET_TRANSLITERATE
|
||||
/*
|
||||
* Document-method: transliterate?
|
||||
* call-seq: transliterate?
|
||||
|
@ -972,16 +975,16 @@ iconv_trivialp(VALUE self)
|
|||
static VALUE
|
||||
iconv_get_transliterate(VALUE self)
|
||||
{
|
||||
#ifdef ICONV_GET_TRANSLITERATE
|
||||
int trans = 0;
|
||||
iconv_ctl(self, ICONV_GET_TRANSLITERATE, trans);
|
||||
if (trans) return Qtrue;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return Qfalse;
|
||||
}
|
||||
#else
|
||||
#define iconv_get_transliterate rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef ICONV_SET_TRANSLITERATE
|
||||
/*
|
||||
* Document-method: transliterate=
|
||||
* call-seq: cd.transliterate = flag
|
||||
|
@ -991,15 +994,15 @@ iconv_get_transliterate(VALUE self)
|
|||
static VALUE
|
||||
iconv_set_transliterate(VALUE self, VALUE transliterate)
|
||||
{
|
||||
#ifdef ICONV_SET_TRANSLITERATE
|
||||
int trans = RTEST(transliterate);
|
||||
iconv_ctl(self, ICONV_SET_TRANSLITERATE, trans);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
#else
|
||||
#define iconv_set_transliterate rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef ICONV_GET_DISCARD_ILSEQ
|
||||
/*
|
||||
* Document-method: discard_ilseq?
|
||||
* call-seq: discard_ilseq?
|
||||
|
@ -1009,16 +1012,16 @@ iconv_set_transliterate(VALUE self, VALUE transliterate)
|
|||
static VALUE
|
||||
iconv_get_discard_ilseq(VALUE self)
|
||||
{
|
||||
#ifdef ICONV_GET_DISCARD_ILSEQ
|
||||
int dis = 0;
|
||||
iconv_ctl(self, ICONV_GET_DISCARD_ILSEQ, dis);
|
||||
if (dis) return Qtrue;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return Qfalse;
|
||||
}
|
||||
#else
|
||||
#define iconv_get_discard_ilseq rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef ICONV_SET_DISCARD_ILSEQ
|
||||
/*
|
||||
* Document-method: discard_ilseq=
|
||||
* call-seq: cd.discard_ilseq = flag
|
||||
|
@ -1028,14 +1031,13 @@ iconv_get_discard_ilseq(VALUE self)
|
|||
static VALUE
|
||||
iconv_set_discard_ilseq(VALUE self, VALUE discard_ilseq)
|
||||
{
|
||||
#ifdef ICONV_SET_DISCARD_ILSEQ
|
||||
int dis = RTEST(discard_ilseq);
|
||||
iconv_ctl(self, ICONV_SET_DISCARD_ILSEQ, dis);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
#else
|
||||
#define iconv_set_discard_ilseq rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Document-method: ctlmethods
|
||||
|
|
|
@ -133,6 +133,7 @@ add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED
|
||||
/*
|
||||
* call-seq:
|
||||
* Cipher.ciphers -> array[string...]
|
||||
|
@ -142,7 +143,6 @@ add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary)
|
|||
static VALUE
|
||||
ossl_s_ciphers(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED
|
||||
VALUE ary;
|
||||
|
||||
ary = rb_ary_new();
|
||||
|
@ -151,10 +151,10 @@ ossl_s_ciphers(VALUE self)
|
|||
(void*)ary);
|
||||
|
||||
return ary;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ossl_s_ciphers rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
@ -453,6 +453,7 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length)
|
|||
return key_length;
|
||||
}
|
||||
|
||||
#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING)
|
||||
/*
|
||||
* call-seq:
|
||||
* cipher.padding = integer -> integer
|
||||
|
@ -466,18 +467,17 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length)
|
|||
static VALUE
|
||||
ossl_cipher_set_padding(VALUE self, VALUE padding)
|
||||
{
|
||||
#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING)
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
int pad = NUM2INT(padding);
|
||||
|
||||
GetCipher(self, ctx);
|
||||
if (EVP_CIPHER_CTX_set_padding(ctx, pad) != 1)
|
||||
ossl_raise(eCipherError, NULL);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
return padding;
|
||||
}
|
||||
#else
|
||||
#define ossl_cipher_set_padding rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#define CIPHER_0ARG_INT(func) \
|
||||
static VALUE \
|
||||
|
|
|
@ -192,6 +192,16 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(OSSL_NO_CONF_API)
|
||||
static VALUE
|
||||
ossl_config_add_value_m(VALUE self, VALUE section, VALUE name, VALUE value)
|
||||
{
|
||||
return ossl_config_add_value(self, section, name, value);
|
||||
}
|
||||
#else
|
||||
#define ossl_config_add_value_m rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
ossl_config_get_value(VALUE self, VALUE section, VALUE name)
|
||||
{
|
||||
|
@ -456,7 +466,7 @@ Init_ossl_config()
|
|||
rb_define_method(cConfig, "initialize", ossl_config_initialize, -1);
|
||||
rb_define_method(cConfig, "get_value", ossl_config_get_value, 2);
|
||||
rb_define_method(cConfig, "value", ossl_config_get_value_old, -1);
|
||||
rb_define_method(cConfig, "add_value", ossl_config_add_value, 3);
|
||||
rb_define_method(cConfig, "add_value", ossl_config_add_value_m, 3);
|
||||
rb_define_method(cConfig, "[]", ossl_config_get_section, 1);
|
||||
rb_define_method(cConfig, "section", ossl_config_get_section_old, 1);
|
||||
rb_define_method(cConfig, "[]=", ossl_config_set_section, 2);
|
||||
|
|
|
@ -166,10 +166,10 @@ ossl_engine_finish(VALUE self)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
#if defined(HAVE_ENGINE_GET_CIPHER)
|
||||
static VALUE
|
||||
ossl_engine_get_cipher(VALUE self, VALUE name)
|
||||
{
|
||||
#if defined(HAVE_ENGINE_GET_CIPHER)
|
||||
ENGINE *e;
|
||||
const EVP_CIPHER *ciph, *tmp;
|
||||
char *s;
|
||||
|
@ -184,15 +184,15 @@ ossl_engine_get_cipher(VALUE self, VALUE name)
|
|||
if(!ciph) ossl_raise(eEngineError, NULL);
|
||||
|
||||
return ossl_cipher_new(ciph);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ossl_engine_get_cipher rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ENGINE_GET_DIGEST)
|
||||
static VALUE
|
||||
ossl_engine_get_digest(VALUE self, VALUE name)
|
||||
{
|
||||
#if defined(HAVE_ENGINE_GET_DIGEST)
|
||||
ENGINE *e;
|
||||
const EVP_MD *md, *tmp;
|
||||
char *s;
|
||||
|
@ -207,10 +207,10 @@ ossl_engine_get_digest(VALUE self, VALUE name)
|
|||
if(!md) ossl_raise(eEngineError, NULL);
|
||||
|
||||
return ossl_digest_new(md);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ossl_engine_get_digest rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
VALUE mPKCS5;
|
||||
VALUE ePKCS5;
|
||||
|
||||
#ifdef HAVE_PKCS5_PBKDF2_HMAC
|
||||
/*
|
||||
* call-seq:
|
||||
* PKCS5.pbkdf2_hmac(pass, salt, iter, keylen, digest) => string
|
||||
|
@ -25,7 +26,6 @@ VALUE ePKCS5;
|
|||
static VALUE
|
||||
ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen, VALUE digest)
|
||||
{
|
||||
#ifdef HAVE_PKCS5_PBKDF2_HMAC
|
||||
VALUE str;
|
||||
const EVP_MD *md;
|
||||
int len = NUM2INT(keylen);
|
||||
|
@ -40,12 +40,13 @@ ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE key
|
|||
ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC");
|
||||
|
||||
return str;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ossl_pkcs5_pbkdf2_hmac rb_f_notimplement
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1
|
||||
/*
|
||||
* call-seq:
|
||||
* PKCS5.pbkdf2_hmac_sha1(pass, salt, iter, keylen) => string
|
||||
|
@ -63,7 +64,6 @@ ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE key
|
|||
static VALUE
|
||||
ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen)
|
||||
{
|
||||
#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1
|
||||
VALUE str;
|
||||
int len = NUM2INT(keylen);
|
||||
|
||||
|
@ -78,10 +78,10 @@ ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALU
|
|||
ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC_SHA1");
|
||||
|
||||
return str;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ossl_pkcs5_pbkdf2_hmac_sha1 rb_f_notimplement
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_ossl_pkcs5()
|
||||
|
|
|
@ -163,10 +163,10 @@ ossl_x509extfactory_set_crl(VALUE self, VALUE crl)
|
|||
return crl;
|
||||
}
|
||||
|
||||
#ifdef HAVE_X509V3_SET_NCONF
|
||||
static VALUE
|
||||
ossl_x509extfactory_set_config(VALUE self, VALUE config)
|
||||
{
|
||||
#ifdef HAVE_X509V3_SET_NCONF
|
||||
X509V3_CTX *ctx;
|
||||
CONF *conf;
|
||||
|
||||
|
@ -176,10 +176,10 @@ ossl_x509extfactory_set_config(VALUE self, VALUE config)
|
|||
X509V3_set_nconf(ctx, conf);
|
||||
|
||||
return config;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define rb_f_fork rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
|
||||
|
|
|
@ -436,6 +436,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef HAVE_RL_SET_SCREEN_SIZE
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.set_screen_size(rows, columns) -> self
|
||||
|
@ -451,16 +452,15 @@ readline_attempted_completion_function(const char *text, int start, int end)
|
|||
static VALUE
|
||||
readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns)
|
||||
{
|
||||
#ifdef HAVE_RL_SET_SCREEN_SIZE
|
||||
rb_secure(4);
|
||||
rl_set_screen_size(NUM2INT(rows), NUM2INT(columns));
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_SET_SCREEN_SIZE */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_screen_size rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_GET_SCREEN_SIZE
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.get_screen_size -> [rows, columns]
|
||||
|
@ -476,7 +476,6 @@ readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns)
|
|||
static VALUE
|
||||
readline_s_get_screen_size(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_RL_GET_SCREEN_SIZE
|
||||
int rows, columns;
|
||||
VALUE res;
|
||||
|
||||
|
@ -486,12 +485,12 @@ readline_s_get_screen_size(VALUE self)
|
|||
rb_ary_push(res, INT2NUM(rows));
|
||||
rb_ary_push(res, INT2NUM(columns));
|
||||
return res;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_GET_SCREEN_SIZE */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_screen_size rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_VI_EDITING_MODE
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.vi_editing_mode -> nil
|
||||
|
@ -506,16 +505,15 @@ readline_s_get_screen_size(VALUE self)
|
|||
static VALUE
|
||||
readline_s_vi_editing_mode(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_RL_VI_EDITING_MODE
|
||||
rb_secure(4);
|
||||
rl_vi_editing_mode(1,0);
|
||||
return Qnil;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_VI_EDITING_MODE */
|
||||
}
|
||||
#else
|
||||
#define readline_s_vi_editing_mode rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_EDITING_MODE
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.vi_editing_mode? -> bool
|
||||
|
@ -529,15 +527,14 @@ readline_s_vi_editing_mode(VALUE self)
|
|||
static VALUE
|
||||
readline_s_vi_editing_mode_p(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_RL_EDITING_MODE
|
||||
rb_secure(4);
|
||||
return rl_editing_mode == 0 ? Qtrue : Qfalse;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_EDITING_MODE */
|
||||
}
|
||||
#else
|
||||
#define readline_s_vi_editing_mode_p rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_EMACS_EDITING_MODE
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.emacs_editing_mode -> nil
|
||||
|
@ -552,16 +549,15 @@ readline_s_vi_editing_mode_p(VALUE self)
|
|||
static VALUE
|
||||
readline_s_emacs_editing_mode(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_RL_EMACS_EDITING_MODE
|
||||
rb_secure(4);
|
||||
rl_emacs_editing_mode(1,0);
|
||||
return Qnil;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_EMACS_EDITING_MODE */
|
||||
}
|
||||
#else
|
||||
#define readline_s_emacs_editing_mode rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_EDITING_MODE
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.emacs_editing_mode? -> bool
|
||||
|
@ -575,15 +571,14 @@ readline_s_emacs_editing_mode(VALUE self)
|
|||
static VALUE
|
||||
readline_s_emacs_editing_mode_p(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_RL_EDITING_MODE
|
||||
rb_secure(4);
|
||||
return rl_editing_mode == 1 ? Qtrue : Qfalse;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_EDITING_MODE */
|
||||
}
|
||||
#else
|
||||
#define readline_s_emacs_editing_mode_p rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.completion_append_character = char
|
||||
|
@ -625,7 +620,6 @@ readline_s_emacs_editing_mode_p(VALUE self)
|
|||
static VALUE
|
||||
readline_s_set_completion_append_character(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||
rb_secure(4);
|
||||
if (NIL_P(str)) {
|
||||
rl_completion_append_character = '\0';
|
||||
|
@ -639,12 +633,12 @@ readline_s_set_completion_append_character(VALUE self, VALUE str)
|
|||
}
|
||||
}
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_completion_append_character rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.completion_append_character -> char
|
||||
|
@ -659,7 +653,6 @@ readline_s_set_completion_append_character(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_get_completion_append_character(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||
char buf[1];
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -668,12 +661,12 @@ readline_s_get_completion_append_character(VALUE self)
|
|||
|
||||
buf[0] = (char) rl_completion_append_character;
|
||||
return rb_locale_str_new(buf, 1);
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_completion_append_character rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.basic_word_break_characters = string
|
||||
|
@ -689,7 +682,6 @@ readline_s_get_completion_append_character(VALUE self)
|
|||
static VALUE
|
||||
readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS
|
||||
static char *basic_word_break_characters = NULL;
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -706,12 +698,12 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
|
|||
basic_word_break_characters[RSTRING_LEN(str)] = '\0';
|
||||
rl_basic_word_break_characters = basic_word_break_characters;
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_basic_word_break_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.basic_word_break_characters -> string
|
||||
|
@ -726,17 +718,16 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_get_basic_word_break_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS
|
||||
rb_secure(4);
|
||||
if (rl_basic_word_break_characters == NULL)
|
||||
return Qnil;
|
||||
return rb_locale_str_new_cstr(rl_basic_word_break_characters);
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_basic_word_break_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.completer_word_break_characters = string
|
||||
|
@ -752,7 +743,6 @@ readline_s_get_basic_word_break_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS
|
||||
static char *completer_word_break_characters = NULL;
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -769,12 +759,12 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
|
|||
completer_word_break_characters[RSTRING_LEN(str)] = '\0';
|
||||
rl_completer_word_break_characters = completer_word_break_characters;
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_completer_word_break_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.completer_word_break_characters -> string
|
||||
|
@ -789,17 +779,16 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS
|
||||
rb_secure(4);
|
||||
if (rl_completer_word_break_characters == NULL)
|
||||
return Qnil;
|
||||
return rb_locale_str_new_cstr(rl_completer_word_break_characters);
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_completer_word_break_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.basic_quote_characters = string
|
||||
|
@ -813,7 +802,6 @@ readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_set_basic_quote_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
|
||||
static char *basic_quote_characters = NULL;
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -831,12 +819,12 @@ readline_s_set_basic_quote_characters(VALUE self, VALUE str)
|
|||
rl_basic_quote_characters = basic_quote_characters;
|
||||
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_basic_quote_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.basic_quote_characters -> string
|
||||
|
@ -850,17 +838,16 @@ readline_s_set_basic_quote_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_get_basic_quote_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
|
||||
rb_secure(4);
|
||||
if (rl_basic_quote_characters == NULL)
|
||||
return Qnil;
|
||||
return rb_locale_str_new_cstr(rl_basic_quote_characters);
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_basic_quote_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.completer_quote_characters = string
|
||||
|
@ -877,7 +864,6 @@ readline_s_get_basic_quote_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_set_completer_quote_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS
|
||||
static char *completer_quote_characters = NULL;
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -894,12 +880,12 @@ readline_s_set_completer_quote_characters(VALUE self, VALUE str)
|
|||
rl_completer_quote_characters = completer_quote_characters;
|
||||
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_completer_quote_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.completer_quote_characters -> string
|
||||
|
@ -914,17 +900,16 @@ readline_s_set_completer_quote_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_get_completer_quote_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS
|
||||
rb_secure(4);
|
||||
if (rl_completer_quote_characters == NULL)
|
||||
return Qnil;
|
||||
return rb_locale_str_new_cstr(rl_completer_quote_characters);
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_completer_quote_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.filename_quote_characters = string
|
||||
|
@ -939,7 +924,6 @@ readline_s_get_completer_quote_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_set_filename_quote_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS
|
||||
static char *filename_quote_characters = NULL;
|
||||
|
||||
rb_secure(4);
|
||||
|
@ -956,12 +940,12 @@ readline_s_set_filename_quote_characters(VALUE self, VALUE str)
|
|||
rl_filename_quote_characters = filename_quote_characters;
|
||||
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_set_filename_quote_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS
|
||||
/*
|
||||
* call-seq:
|
||||
* Readline.filename_quote_characters -> string
|
||||
|
@ -976,16 +960,14 @@ readline_s_set_filename_quote_characters(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
readline_s_get_filename_quote_characters(VALUE self, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS
|
||||
rb_secure(4);
|
||||
if (rl_filename_quote_characters == NULL)
|
||||
return Qnil;
|
||||
return rb_locale_str_new_cstr(rl_filename_quote_characters);
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */
|
||||
}
|
||||
#else
|
||||
#define readline_s_get_filename_quote_characters rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
hist_to_s(VALUE self)
|
||||
|
@ -1025,10 +1007,10 @@ hist_get(VALUE self, VALUE index)
|
|||
return rb_locale_str_new_cstr(entry->line);
|
||||
}
|
||||
|
||||
#ifdef HAVE_REPLACE_HISTORY_ENTRY
|
||||
static VALUE
|
||||
hist_set(VALUE self, VALUE index, VALUE str)
|
||||
{
|
||||
#ifdef HAVE_REPLACE_HISTORY_ENTRY
|
||||
HIST_ENTRY *entry = NULL;
|
||||
int i;
|
||||
|
||||
|
@ -1045,11 +1027,10 @@ hist_set(VALUE self, VALUE index, VALUE str)
|
|||
rb_raise(rb_eIndexError, "invalid index");
|
||||
}
|
||||
return str;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define hist_set rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
hist_push(VALUE self, VALUE str)
|
||||
|
@ -1165,18 +1146,17 @@ hist_delete_at(VALUE self, VALUE index)
|
|||
return rb_remove_history(i);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CLEAR_HISTORY
|
||||
static VALUE
|
||||
hist_clear(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_CLEAR_HISTORY
|
||||
rb_secure(4);
|
||||
clear_history();
|
||||
return self;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define hist_clear rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
filename_completion_proc_call(VALUE self, VALUE str)
|
||||
|
|
|
@ -176,6 +176,7 @@ ancillary_data(VALUE self)
|
|||
return v;
|
||||
}
|
||||
|
||||
#ifdef SCM_RIGHTS
|
||||
/*
|
||||
* call-seq:
|
||||
* Socket::AncillaryData.unix_rights(io1, io2, ...) => ancillarydata
|
||||
|
@ -188,7 +189,6 @@ ancillary_data(VALUE self)
|
|||
static VALUE
|
||||
ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
#ifdef SCM_RIGHTS
|
||||
VALUE result, str, ary;
|
||||
int i;
|
||||
|
||||
|
@ -216,11 +216,12 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
|
|||
result = ancdata_new(AF_UNIX, SOL_SOCKET, SCM_RIGHTS, str);
|
||||
rb_ivar_set(result, rb_intern("unix_rights"), ary);
|
||||
return result;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_s_unix_rights rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#ifdef SCM_RIGHTS
|
||||
/*
|
||||
* call-seq:
|
||||
* ancillarydata.unix_rights => array-of-IOs or nil
|
||||
|
@ -253,7 +254,6 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
|
|||
static VALUE
|
||||
ancillary_unix_rights(VALUE self)
|
||||
{
|
||||
#ifdef SCM_RIGHTS
|
||||
int level, type;
|
||||
|
||||
level = ancillary_level(self);
|
||||
|
@ -264,11 +264,12 @@ ancillary_unix_rights(VALUE self)
|
|||
|
||||
VALUE v = rb_attr_get(self, rb_intern("unix_rights"));
|
||||
return v;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_unix_rights rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(SCM_TIMESTAMP) || defined(SCM_TIMESTAMPNS) || defined(SCM_BINTIME)
|
||||
/*
|
||||
* call-seq:
|
||||
* ancillarydata.timestamp => time
|
||||
|
@ -300,7 +301,6 @@ ancillary_unix_rights(VALUE self)
|
|||
static VALUE
|
||||
ancillary_timestamp(VALUE self)
|
||||
{
|
||||
#if defined(SCM_TIMESTAMP) || defined(SCM_TIMESTAMPNS) || defined(SCM_BINTIME)
|
||||
int level, type;
|
||||
VALUE data;
|
||||
VALUE result = Qnil;
|
||||
|
@ -342,10 +342,10 @@ ancillary_timestamp(VALUE self)
|
|||
rb_raise(rb_eTypeError, "timestamp ancillary data expected");
|
||||
|
||||
return result;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_timestamp rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
@ -391,6 +391,7 @@ ancillary_int(VALUE self)
|
|||
return INT2NUM(i);
|
||||
}
|
||||
|
||||
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
|
||||
/*
|
||||
* call-seq:
|
||||
* Socket::AncillaryData.ip_pktinfo(addr, ifindex) => ancdata
|
||||
|
@ -414,7 +415,6 @@ ancillary_int(VALUE self)
|
|||
static VALUE
|
||||
ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
|
||||
VALUE v_addr, v_ifindex, v_spec_dst;
|
||||
unsigned int ifindex;
|
||||
struct sockaddr_in sa;
|
||||
|
@ -450,11 +450,12 @@ ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self)
|
|||
memcpy(&pktinfo.ipi_spec_dst, &sa.sin_addr, sizeof(pktinfo.ipi_spec_dst));
|
||||
|
||||
return ancdata_new(AF_INET, IPPROTO_IP, IP_PKTINFO, rb_str_new((char *)&pktinfo, sizeof(pktinfo)));
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_s_ip_pktinfo rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
|
||||
/*
|
||||
* call-seq:
|
||||
* ancdata.ip_pktinfo => [addr, ifindex, spec_dst]
|
||||
|
@ -477,7 +478,6 @@ ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self)
|
|||
static VALUE
|
||||
ancillary_ip_pktinfo(VALUE self)
|
||||
{
|
||||
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
|
||||
int level, type;
|
||||
VALUE data;
|
||||
struct in_pktinfo pktinfo;
|
||||
|
@ -505,11 +505,12 @@ ancillary_ip_pktinfo(VALUE self)
|
|||
v_spec_dst = rsock_addrinfo_new((struct sockaddr *)&sa, sizeof(sa), PF_INET, 0, 0, Qnil, Qnil);
|
||||
|
||||
return rb_ary_new3(3, v_addr, UINT2NUM(pktinfo.ipi_ifindex), v_spec_dst);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_ip_pktinfo rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
/*
|
||||
* call-seq:
|
||||
* Socket::AncillaryData.ipv6_pktinfo(addr, ifindex) => ancdata
|
||||
|
@ -527,7 +528,6 @@ ancillary_ip_pktinfo(VALUE self)
|
|||
static VALUE
|
||||
ancillary_s_ipv6_pktinfo(VALUE self, VALUE v_addr, VALUE v_ifindex)
|
||||
{
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
unsigned int ifindex;
|
||||
struct sockaddr_in6 sa;
|
||||
struct in6_pktinfo pktinfo;
|
||||
|
@ -548,10 +548,10 @@ ancillary_s_ipv6_pktinfo(VALUE self, VALUE v_addr, VALUE v_ifindex)
|
|||
pktinfo.ipi6_ifindex = ifindex;
|
||||
|
||||
return ancdata_new(AF_INET6, IPPROTO_IPV6, IPV6_PKTINFO, rb_str_new((char *)&pktinfo, sizeof(pktinfo)));
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_s_ipv6_pktinfo rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
static void
|
||||
|
@ -580,6 +580,7 @@ extract_ipv6_pktinfo(VALUE self, struct in6_pktinfo *pktinfo_ptr, struct sockadd
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
/*
|
||||
* call-seq:
|
||||
* ancdata.ipv6_pktinfo => [addr, ifindex]
|
||||
|
@ -597,7 +598,6 @@ extract_ipv6_pktinfo(VALUE self, struct in6_pktinfo *pktinfo_ptr, struct sockadd
|
|||
static VALUE
|
||||
ancillary_ipv6_pktinfo(VALUE self)
|
||||
{
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
struct in6_pktinfo pktinfo;
|
||||
struct sockaddr_in6 sa;
|
||||
VALUE v_addr;
|
||||
|
@ -605,11 +605,12 @@ ancillary_ipv6_pktinfo(VALUE self)
|
|||
extract_ipv6_pktinfo(self, &pktinfo, &sa);
|
||||
v_addr = rsock_addrinfo_new((struct sockaddr *)&sa, sizeof(sa), PF_INET6, 0, 0, Qnil, Qnil);
|
||||
return rb_ary_new3(2, v_addr, UINT2NUM(pktinfo.ipi6_ifindex));
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_ipv6_pktinfo rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
/*
|
||||
* call-seq:
|
||||
* ancdata.ipv6_pktinfo_addr => addr
|
||||
|
@ -627,16 +628,16 @@ ancillary_ipv6_pktinfo(VALUE self)
|
|||
static VALUE
|
||||
ancillary_ipv6_pktinfo_addr(VALUE self)
|
||||
{
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
struct in6_pktinfo pktinfo;
|
||||
struct sockaddr_in6 sa;
|
||||
extract_ipv6_pktinfo(self, &pktinfo, &sa);
|
||||
return rsock_addrinfo_new((struct sockaddr *)&sa, sizeof(sa), PF_INET6, 0, 0, Qnil, Qnil);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_ipv6_pktinfo_addr rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
/*
|
||||
* call-seq:
|
||||
* ancdata.ipv6_pktinfo_ifindex => addr
|
||||
|
@ -654,15 +655,14 @@ ancillary_ipv6_pktinfo_addr(VALUE self)
|
|||
static VALUE
|
||||
ancillary_ipv6_pktinfo_ifindex(VALUE self)
|
||||
{
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */
|
||||
struct in6_pktinfo pktinfo;
|
||||
struct sockaddr_in6 sa;
|
||||
extract_ipv6_pktinfo(self, &pktinfo, &sa);
|
||||
return UINT2NUM(pktinfo.ipi6_ifindex);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define ancillary_ipv6_pktinfo_ifindex rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(SOL_SOCKET) && defined(SCM_RIGHTS) /* 4.4BSD */
|
||||
static int
|
||||
|
@ -1286,14 +1286,9 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
|
||||
return SSIZET2NUM(ss);
|
||||
}
|
||||
#else
|
||||
static VALUE
|
||||
bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
||||
{
|
||||
rb_notimplement();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SENDMSG)
|
||||
/*
|
||||
* call-seq:
|
||||
* basicsocket.sendmsg(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent
|
||||
|
@ -1331,7 +1326,11 @@ bsock_sendmsg(int argc, VALUE *argv, VALUE sock)
|
|||
{
|
||||
return bsock_sendmsg_internal(argc, argv, sock, 0);
|
||||
}
|
||||
#else
|
||||
#define bsock_sendmsg rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SENDMSG)
|
||||
/*
|
||||
* call-seq:
|
||||
* basicsocket.sendmsg_nonblock(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent
|
||||
|
@ -1348,6 +1347,9 @@ bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock)
|
|||
{
|
||||
return bsock_sendmsg_internal(argc, argv, sock, 1);
|
||||
}
|
||||
#else
|
||||
#define bsock_sendmsg_nonblock rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_RECVMSG)
|
||||
struct recvmsg_args_struct {
|
||||
|
@ -1675,14 +1677,9 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static VALUE
|
||||
bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
||||
{
|
||||
rb_notimplement();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_RECVMSG)
|
||||
/*
|
||||
* call-seq:
|
||||
* basicsocket.recvmsg(maxmesglen=nil, flags=0, maxcontrollen=nil, opts={}) => [mesg, sender_addrinfo, rflags, *controls]
|
||||
|
@ -1741,7 +1738,11 @@ bsock_recvmsg(int argc, VALUE *argv, VALUE sock)
|
|||
{
|
||||
return bsock_recvmsg_internal(argc, argv, sock, 0);
|
||||
}
|
||||
#else
|
||||
#define bsock_recvmsg rb_f_notimplement
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_RECVMSG)
|
||||
/*
|
||||
* call-seq:
|
||||
* basicsocket.recvmsg_nonblock(maxdatalen=nil, flags=0, maxcontrollen=nil, opts={}) => [data, sender_addrinfo, rflags, *controls]
|
||||
|
@ -1758,6 +1759,9 @@ bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock)
|
|||
{
|
||||
return bsock_recvmsg_internal(argc, argv, sock, 1);
|
||||
}
|
||||
#else
|
||||
#define bsock_recvmsg_nonblock rb_f_notimplement
|
||||
#endif
|
||||
|
||||
void
|
||||
Init_ancdata(void)
|
||||
|
|
|
@ -244,6 +244,7 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
|
|||
return INT2FIX(0);
|
||||
}
|
||||
|
||||
#if !defined(__BEOS__)
|
||||
/*
|
||||
* Document-method: getsockopt
|
||||
* call-seq: getsockopt(level, optname)
|
||||
|
@ -287,7 +288,6 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
|
|||
static VALUE
|
||||
bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
|
||||
{
|
||||
#if !defined(__BEOS__)
|
||||
int level, option;
|
||||
socklen_t len;
|
||||
char *buf;
|
||||
|
@ -307,10 +307,10 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
|
|||
rb_sys_fail_path(fptr->pathv);
|
||||
|
||||
return rsock_sockopt_new(family, level, option, rb_str_new(buf, len));
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define bsock_getsockopt rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
@ -361,6 +361,7 @@ bsock_getpeername(VALUE sock)
|
|||
return rb_str_new((char*)&buf, len);
|
||||
}
|
||||
|
||||
#if defined(HAVE_GETPEEREID) || defined(SO_PEERCRED) || defined(HAVE_GETPEERUCRED)
|
||||
/*
|
||||
* call-seq:
|
||||
* basicsocket.getpeereid => [euid, egid]
|
||||
|
@ -412,10 +413,11 @@ bsock_getpeereid(VALUE self)
|
|||
ret = rb_assoc_new(UIDT2NUM(ucred_geteuid(uc)), GIDT2NUM(ucred_getegid(uc)));
|
||||
ucred_free(uc);
|
||||
return ret;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define bsock_getpeereid rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
|
|
@ -75,6 +75,7 @@ pair_yield(VALUE pair)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined HAVE_SOCKETPAIR
|
||||
/*
|
||||
* call-seq:
|
||||
* Socket.pair(domain, type, protocol) => [socket1, socket2]
|
||||
|
@ -99,7 +100,6 @@ pair_yield(VALUE pair)
|
|||
VALUE
|
||||
rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
#if defined HAVE_SOCKETPAIR
|
||||
VALUE domain, type, protocol;
|
||||
int d, t, p, sp[2];
|
||||
int ret;
|
||||
|
@ -127,10 +127,10 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
|
|||
return rb_ensure(pair_yield, r, io_close, s1);
|
||||
}
|
||||
return r;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define rsock_sock_s_socketpair rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
@ -867,11 +867,7 @@ sock_gethostname(VALUE obj)
|
|||
return rb_str_new2(un.nodename);
|
||||
}
|
||||
#else
|
||||
static VALUE
|
||||
sock_gethostname(VALUE obj)
|
||||
{
|
||||
rb_notimplement();
|
||||
}
|
||||
#define sock_gethostname rb_f_notimplement
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -1470,6 +1466,7 @@ sockaddr_obj(struct sockaddr *addr)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GETIFADDRS) || (defined(SIOCGLIFCONF) && defined(SIOCGLIFNUM) && !defined(__hpux)) || defined(SIOCGIFCONF) || defined(_WIN32)
|
||||
/*
|
||||
* call-seq:
|
||||
* Socket.ip_address_list => array
|
||||
|
@ -1748,10 +1745,11 @@ socket_s_ip_address_list(VALUE self)
|
|||
|
||||
CloseHandle(h);
|
||||
return list;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define socket_s_ip_address_list rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class +Socket+ provides access to the underlying operating system
|
||||
|
|
|
@ -171,6 +171,7 @@ sendmsg_blocking(void *data)
|
|||
return sendmsg(arg->fd, &arg->msg, 0);
|
||||
}
|
||||
|
||||
#if defined(HAVE_SENDMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
|
||||
/*
|
||||
* call-seq:
|
||||
* unixsocket.send_io(io) => nil
|
||||
|
@ -190,7 +191,6 @@ sendmsg_blocking(void *data)
|
|||
static VALUE
|
||||
unix_send_io(VALUE sock, VALUE val)
|
||||
{
|
||||
#if defined(HAVE_SENDMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
|
||||
int fd;
|
||||
rb_io_t *fptr;
|
||||
struct iomsg_arg arg;
|
||||
|
@ -248,11 +248,10 @@ unix_send_io(VALUE sock, VALUE val)
|
|||
rb_sys_fail("sendmsg(2)");
|
||||
|
||||
return Qnil;
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define unix_send_io rb_f_notimplement
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
recvmsg_blocking(void *data)
|
||||
|
@ -261,6 +260,7 @@ recvmsg_blocking(void *data)
|
|||
return recvmsg(arg->fd, &arg->msg, 0);
|
||||
}
|
||||
|
||||
#if defined(HAVE_RECVMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
|
||||
/*
|
||||
* call-seq:
|
||||
* unixsocket.recv_io([klass [, mode]]) => io
|
||||
|
@ -283,7 +283,6 @@ recvmsg_blocking(void *data)
|
|||
static VALUE
|
||||
unix_recv_io(int argc, VALUE *argv, VALUE sock)
|
||||
{
|
||||
#if defined(HAVE_RECVMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
|
||||
VALUE klass, mode;
|
||||
rb_io_t *fptr;
|
||||
struct iomsg_arg arg;
|
||||
|
@ -390,11 +389,10 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
|
|||
ff_argv[1] = mode;
|
||||
return rb_funcall2(klass, for_fd, ff_argc, ff_argv);
|
||||
}
|
||||
#else
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#define unix_recv_io rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
|
|
@ -3304,7 +3304,7 @@ proc_setpgrp(void)
|
|||
/* this confusion. */
|
||||
#ifdef HAVE_SETPGID
|
||||
if (setpgid(0,0) < 0) rb_sys_fail(0);
|
||||
#else /* defined(HAVE_SETPGRP) && defined(SETPGRP_VOID) */
|
||||
#elif defined(HAVE_SETPGRP) && defined(SETPGRP_VOID)
|
||||
if (setpgrp() < 0) rb_sys_fail(0);
|
||||
#endif
|
||||
return INT2FIX(0);
|
||||
|
@ -3388,7 +3388,7 @@ proc_setsid(void)
|
|||
pid = setsid();
|
||||
if (pid < 0) rb_sys_fail(0);
|
||||
return PIDT2NUM(pid);
|
||||
#else /* defined(HAVE_SETPGRP) && defined(TIOCNOTTY) */
|
||||
#elif defined(HAVE_SETPGRP) && defined(TIOCNOTTY)
|
||||
rb_pid_t pid;
|
||||
int ret;
|
||||
|
||||
|
@ -4538,7 +4538,7 @@ proc_daemon(int argc, VALUE *argv)
|
|||
after_fork();
|
||||
if (n < 0) rb_sys_fail("daemon");
|
||||
return INT2FIX(n);
|
||||
#else /* defined(HAVE_FORK) */
|
||||
#elif defined(HAVE_FORK)
|
||||
switch (rb_fork(0, 0, 0, Qnil)) {
|
||||
case -1:
|
||||
return (-1);
|
||||
|
|
Loading…
Reference in a new issue