summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/file.c b/file.c
index eacf06644b..60d5a94300 100644
--- a/file.c
+++ b/file.c
@@ -2320,6 +2320,10 @@ rb_file_s_umask(argc, argv)
#define USE_NTFS 0
#endif
+#ifdef DOSISH_DRIVE_LETTER
+#include <ctype.h>
+#endif
+
#if USE_NTFS
#define istrailinggabage(x) ((x) == '.' || (x) == ' ')
#else
@@ -2532,7 +2536,7 @@ file_expand_path(fname, dname, result)
if (s[0] == '~') {
if (isdirsep(s[1]) || s[1] == '\0') {
- char *dir = getenv("HOME");
+ const char *dir = getenv("HOME");
if (!dir) {
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `%s'", s);
@@ -2888,9 +2892,9 @@ rb_file_s_basename(argc, argv)
VALUE *argv;
{
VALUE fname, fext, basename;
- char *name, *p;
+ const char *name, *p;
#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
- char *root;
+ const char *root;
#endif
int f, n;
@@ -3100,7 +3104,7 @@ rb_file_join(ary, sep)
long len, i;
int taint = 0;
VALUE result, tmp;
- char *name, *tail;
+ const char *name, *tail;
if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
if (OBJ_TAINTED(ary)) taint = 1;
@@ -4285,7 +4289,7 @@ path_check_0(fpath, execpath)
int execpath;
{
struct stat st;
- char *p0 = StringValueCStr(fpath);
+ const char *p0 = StringValueCStr(fpath);
char *p = 0, *s;
if (!is_absolute_path(p0)) {
@@ -4324,7 +4328,7 @@ path_check_0(fpath, execpath)
static int
fpath_check(path)
- char *path;
+ const char *path;
{
#if ENABLE_PATH_CHECK
return path_check_0(rb_str_new2(path), Qfalse);
@@ -4335,10 +4339,10 @@ fpath_check(path)
int
rb_path_check(path)
- char *path;
+ const char *path;
{
#if ENABLE_PATH_CHECK
- char *p0, *p, *pend;
+ const char *p0, *p, *pend;
const char sep = PATH_SEP_CHAR;
if (!path) return 1;
@@ -4373,7 +4377,7 @@ is_macos_native_path(path)
static int
file_load_ok(file)
- char *file;
+ const char *file;
{
FILE *f;
@@ -4391,8 +4395,8 @@ rb_find_file_ext(filep, ext)
VALUE *filep;
const char * const *ext;
{
- char *path, *found;
- char *f = RSTRING(*filep)->ptr;
+ const char *path, *found;
+ const char *f = RSTRING(*filep)->ptr;
VALUE fname;
long i, j;
@@ -4447,8 +4451,8 @@ rb_find_file(path)
VALUE path;
{
VALUE tmp;
- char *f = StringValueCStr(path);
- char *lpath;
+ const char *f = StringValueCStr(path);
+ const char *lpath;
if (f[0] == '~') {
path = rb_file_expand_path(path, Qnil);