/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include	<sys/types.h>
#include	<sys/stat.h>
#include	"memory_debug.h"
#include	"utils.h"
#include	"machine/include.h"

int
u_mkdir(char * str,int mode)
{
char * s, * _s;
int p;
int ret;
	p = strlen(str)-1;
	if ( p <= 0 )
		return -1;
	s = copy_str(str);
	if ( s[p] == '/' ) {
		s[p] = 0;
	}
	_s = change_delim_str(s);
	ret = m_mkdir(_s,mode);
	if ( _s != s )
		d_f_ree(_s);
	d_f_ree(s);
	return ret;
}

