[BusyBox] make_directory

Glenn McGrath bug1 at optushome.com.au
Thu Aug 1 09:21:34 UTC 2002


On Thu, 01 Aug 2002 18:43:22 +0400
"Vladimir N. Oleynik" <dzo at simtreas.ru> wrote:

> Glenn,
>  
> > I think the libbb make_directory function could be simpler, maybe
> > something like.
> > 
> > void make_recursive_directory(char *path, mode_t mode)
> > {
> >         const char *path_ptr = strrchr(path, '/');
> >         if (path_ptr) {
> 
> Not call mkdir() if not have '/'. Hmm, why?

Commonly a string will be of the form (directory)/file, so instead of
seperating the directory component from the file component before calling
make_recursive_directory, seeprate them after calling it.

Maybe this isnt an ideal approach, i will think about it some more.

> May be remove all const keyword for compile without warning? ;)

I was trying to be clever, but i forgot to compile with -Wall :(


Glenn



More information about the busybox mailing list