From 8dd118c0db80af4ff213265a2b2b475c73bb440a Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 4 Oct 2008 13:25:12 +0000 Subject: * djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp. * djgpp/README.djgpp: ditto. * djgpp/config.hin: ditto. * djgpp/config.sed: ditto. * djgpp/configure.bat: ditto. * djgpp/mkver.sed: ditto. * ext/Setup.dj: ditto. * dln.c: removed djgpp supports. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * process.c: ditto. * ruby.c: ditto. * signal.c: ditto. * util.c: ditto. * vm_core.h: ditto. * lib/fileutils.rb: ditto. * lib/mkmf.rb: ditto. * ext/socket/socket.c: ditto. * test/fileutils/test_fileutils.rb: ditto. * test/ruby/test_env.rb: ditto. * test/ruby/test_path.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- util.c | 136 +---------------------------------------------------------------- 1 file changed, 1 insertion(+), 135 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 24841d6bef..95e2c0bfe8 100644 --- a/util.c +++ b/util.c @@ -283,15 +283,11 @@ ruby_add_suffix(VALUE str, const char *suffix) rb_fatal("Cannot do inplace edit on long filename (%ld characters)", RSTRING_LEN(str)); -#if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32) +#if defined(__CYGWIN32__) || defined(_WIN32) /* Style 0 */ slen = RSTRING_LEN(str); rb_str_cat(str, suffix, extlen); -#if defined(DJGPP) - if (_USE_LFN) return; -#else if (valid_filename(RSTRING_PTR(str))) return; -#endif /* Fooey, style 0 failed. Fix str before continuing. */ rb_str_resize(str, slen); @@ -363,136 +359,6 @@ valid_filename(const char *s) #endif #endif -#if defined __DJGPP__ - -#include - -static char dbcs_table[256]; - -int -make_dbcs_table() -{ - __dpmi_regs r; - struct { - unsigned char start; - unsigned char end; - } vec; - int offset; - - memset(&r, 0, sizeof(r)); - r.x.ax = 0x6300; - __dpmi_int(0x21, &r); - offset = r.x.ds * 16 + r.x.si; - - for (;;) { - int i; - dosmemget(offset, sizeof vec, &vec); - if (!vec.start && !vec.end) - break; - for (i = vec.start; i <= vec.end; i++) - dbcs_table[i] = 1; - offset += 2; - } -} - -int -mblen(const char *s, size_t n) -{ - static int need_init = 1; - if (need_init) { - make_dbcs_table(); - need_init = 0; - } - if (s) { - if (n == 0 || *s == 0) - return 0; - else if (!s[1]) - return 1; - return dbcs_table[(unsigned char)*s] + 1; - } - else - return 1; -} - -struct PathList { - struct PathList *next; - char *path; -}; - -struct PathInfo { - struct PathList *head; - int count; -}; - -static int -push_element(const char *path, VALUE vinfo) -{ - struct PathList *p; - struct PathInfo *info = (struct PathInfo *)vinfo; - - p = ALLOC(struct PathList); - MEMZERO(p, struct PathList, 1); - p->path = ruby_strdup(path); - p->next = info->head; - info->head = p; - info->count++; - - return 0; -} - -#include -int __opendir_flags = __OPENDIR_PRESERVE_CASE; - -char ** -__crt0_glob_function(char *path) -{ - int len = strlen(path); - int i; - char **rv; - char path_buffer[PATH_MAX]; - char *buf = path_buffer; - char *p; - struct PathInfo info; - struct PathList *plist; - - if (PATH_MAX <= len) - buf = ruby_xmalloc(len + 1); - - strncpy(buf, path, len); - buf[len] = '\0'; - - for (p = buf; *p; p += mblen(p, RUBY_MBCHAR_MAXSIZE)) - if (*p == '\\') - *p = '/'; - - info.count = 0; - info.head = 0; - - ruby_glob(buf, 0, push_element, (VALUE)&info); - - if (buf != path_buffer) - ruby_xfree(buf); - - if (info.count == 0) - return 0; - - rv = ruby_xmalloc((info.count + 1) * sizeof (char *)); - - plist = info.head; - i = 0; - while (plist) { - struct PathList *cur; - rv[i] = plist->path; - cur = plist; - plist = plist->next; - ruby_xfree(cur); - i++; - } - rv[i] = 0; - return rv; -} - -#endif /* mm.c */ -- cgit v1.2.3