path.c File Reference

Path manipulation helper functions. More...

#include <string.h>
#include <ctype.h>
#include "path.h"

Go to the source code of this file.

Functions

bool_t pathIsAbsolute (const char_t *path)
 Test if the path is absolute. More...
 
bool_t pathIsRelative (const char_t *path)
 Test if the path is relative. More...
 
const char_tpathFindFileName (const char_t *path)
 Search a path for a file name. More...
 
void pathCanonicalize (char_t *path)
 Simplify a path. More...
 
void pathAddSlash (char_t *path, size_t maxLen)
 Add a slash to the end of a string. More...
 
void pathRemoveSlash (char_t *path)
 Remove the trailing slash from a given path. More...
 
void pathCombine (char_t *path, const char_t *more, size_t maxLen)
 Concatenate two paths. More...
 
bool_t pathMatch (const char_t *path, const char_t *pattern)
 Check whether a file name matches the specified pattern. More...
 

Detailed Description

Path manipulation helper functions.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

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. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file path.c.

Function Documentation

◆ pathAddSlash()

void pathAddSlash ( char_t path,
size_t  maxLen 
)

Add a slash to the end of a string.

Parameters
[in,out]pathNULL-terminated string that represents the path
[in]maxLenMaximum pathname length

Definition at line 272 of file path.c.

◆ pathCanonicalize()

void pathCanonicalize ( char_t path)

Simplify a path.

Parameters
[in]pathNULL-terminated string containing the path to be canonicalized

Definition at line 110 of file path.c.

◆ pathCombine()

void pathCombine ( char_t path,
const char_t more,
size_t  maxLen 
)

Concatenate two paths.

Parameters
[in,out]pathNULL-terminated string containing the first path
[in]moreNULL-terminated string containing the second path
[in]maxLenMaximum pathname length

Definition at line 330 of file path.c.

◆ pathFindFileName()

const char_t* pathFindFileName ( const char_t path)

Search a path for a file name.

Parameters
[in]pathNULL-terminated string that contains the path to search
Returns
Pointer to the file name

Definition at line 71 of file path.c.

◆ pathIsAbsolute()

bool_t pathIsAbsolute ( const char_t path)

Test if the path is absolute.

Parameters
[in]pathNULL-terminated string that contains the path
Returns
TRUE is the path is absolute, else FALSE

Definition at line 39 of file path.c.

◆ pathIsRelative()

bool_t pathIsRelative ( const char_t path)

Test if the path is relative.

Parameters
[in]pathNULL-terminated string that contains the path
Returns
TRUE is the path is relative, else FALSE

Definition at line 55 of file path.c.

◆ pathMatch()

bool_t pathMatch ( const char_t path,
const char_t pattern 
)

Check whether a file name matches the specified pattern.

Parameters
[in]pathNULL-terminated string that contains the path to be matched
[in]patternNULL-terminated string that contains the pattern for which to search. The pattern may contain wildcard characters
Returns
TRUE if the path matches the specified pattern, else FALSE

Definition at line 368 of file path.c.

◆ pathRemoveSlash()

void pathRemoveSlash ( char_t path)

Remove the trailing slash from a given path.

Parameters
[in,out]pathNULL-terminated string that contains the path

Definition at line 300 of file path.c.