~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_path.c

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
                   ((prog=getenv("_")) != 0 &&
43
43
                    dirname_part(to, prog, &to_length))))
44
44
  {
45
 
    intern_filename(to,to);
 
45
    VOID(intern_filename(to,to));
46
46
    if (!test_if_hard_path(to))
47
47
    {
48
48
      if (!my_getwd(curr_dir,FN_REFLEN,MYF(0)))
49
 
        bchange((unsigned char*) to, 0, (unsigned char*) curr_dir, strlen(curr_dir), strlen(to)+1);
 
49
        bchange((uchar*) to, 0, (uchar*) curr_dir, strlen(curr_dir), strlen(to)+1);
50
50
    }
51
51
  }
52
52
  else
60
60
      end= (char*) "/my/";
61
61
#endif
62
62
    }
63
 
    intern_filename(to,end);
 
63
    VOID(intern_filename(to,end));
64
64
    to= strchr(to, '\0');
65
65
    if (to != start && to[-1] != FN_LIBCHAR)
66
66
      *to++ = FN_LIBCHAR;
67
 
    my_stpcpy(to,own_pathname_part);
 
67
    VOID(stpcpy(to,own_pathname_part));
68
68
  }
69
69
  return(start);
70
70
} /* my_path */
71
71
 
72
72
 
73
73
        /* test if file without filename is found in path */
74
 
        /* Returns to if found and to has dirpart if found, else NULL */
 
74
        /* Returns to if found and to has dirpart if found, else NullS */
75
75
 
76
76
#define PATH_SEP ':'
77
77
 
81
81
  const char *ext="";
82
82
 
83
83
  if (!(path=getenv("PATH")))
84
 
    return NULL;
 
84
    return NullS;
85
85
  dir[0]=FN_LIBCHAR; dir[1]=0;
86
86
#ifdef PROGRAM_EXTENSION
87
87
  if (!fn_ext(name)[0])
92
92
  {
93
93
    if (path != pos)
94
94
    {
95
 
      strxmov(my_stpncpy(to,path,(uint) (pos-path)),dir,name,ext,NULL);
 
95
      strxmov(stpncpy(to,path,(uint) (pos-path)),dir,name,ext,NullS);
96
96
      if (!access(to,F_OK))
97
97
      {
98
98
        to[(uint) (pos-path)+1]=0;      /* Return path only */
100
100
      }
101
101
    }
102
102
  }
103
 
  return NULL;                          /* File not found */
 
103
  return NullS;                         /* File not found */
104
104
}