usermode/library/mcore/src/files.c File Reference

#include "files.h"
#include <string.h>
#include <sys/stat.h>

Go to the source code of this file.

Functions

void mkdir_r (const char *dir, mode_t mode)
m_result_t path2file (char *path, char **file)


Detailed Description

Implements the utilities in files.h.

Author:
Andres Jaan Tack

Definition in file files.c.


Function Documentation

void mkdir_r ( const char *  dir,
mode_t  mode 
)

Creates a directory with the given path. This will create directories to satisfy the full path if necessary.

e.g. mkdir_r("/a/b/c", S_IRWXU), supposing none of a b or c exists, will create a, then a/b, then a/b/c.

Parameters:
dir is the path of the directory to be created. This may be relative or absolute.
mode is a permission setting to fix on the new directory(s). e.g. S_IRWXU

Definition at line 45 of file files.c.

m_result_t path2file ( char *  path,
char **  file 
)

Given a full path, finds the last component of it (which is the unqualified file name).

Parameters:
path is a path to a file, whether relative or not. This must not be NULL.
file is an output parameter, set to point to the beginning of the filename component of path. This must not be NULL.
Returns:
M_R_SUCCESS if the routine found a slash and set file. M_R_FAILURE if there was no slash in path; file was not set.

Definition at line 67 of file files.c.


Generated on Sat Apr 23 11:43:36 2011 for Mnemosyne by  doxygen 1.4.7