Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b1cdf8da
Commit
b1cdf8da
authored
Jan 03, 2008
by
Eric Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
document parent_path()
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7128
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
b7091203
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
path.c
src/path.c
+10
-0
path.h
src/path.h
+10
-3
No files found.
src/path.c
View file @
b1cdf8da
...
...
@@ -225,13 +225,23 @@ void pathcpy_trunc(char *dest, const char *src)
char
*
parent_path
(
char
*
path_max_tmp
,
const
char
*
path
)
{
char
*
c
;
static
const
int
handle_trailing_slashes
=
0
;
pathcpy_trunc
(
path_max_tmp
,
path
);
if
(
handle_trailing_slashes
)
{
size_t
last_char
=
strlen
(
path_max_tmp
)
-
1
;
while
(
last_char
>
0
&&
path_max_tmp
[
last_char
]
==
'/'
)
path_max_tmp
[
last_char
--
]
=
'\0'
;
}
c
=
strrchr
(
path_max_tmp
,
'/'
);
if
(
c
==
NULL
)
path_max_tmp
[
0
]
=
'\0'
;
else
{
/* strip redundant slashes: */
while
((
path_max_tmp
<=
c
)
&&
*
(
--
c
)
==
'/'
)
/* nothing */
;
c
[
1
]
=
'\0'
;
...
...
src/path.h
View file @
b1cdf8da
...
...
@@ -60,13 +60,20 @@ char *pfx_dir(char *dst,
const
char
*
path
,
const
size_t
path_len
,
const
char
*
pfx
,
const
size_t
pfx_len
);
/* relative music path to absolute music path
* char * passed is a static variable, so don't free it
*/
/* relative music path to absolute music path */
char
*
rmp2amp_r
(
char
*
dst
,
const
char
*
rel_path
);
/* relative playlist path to absolute playlist path */
char
*
rpp2app_r
(
char
*
dst
,
const
char
*
rel_path
);
/*
* parent_path - saner version of dirname(3) with slightly different semantics
* - we will return "" instead of "." or "/" if we have no parent
* this is because we only deal with internal paths
* - we always skip over redundant slashes in the middle, if there are any
* - we will never get meaningful paths with trailing slashes in our callers
* (set handle_trailing_slashes to true if we do)
*/
char
*
parent_path
(
char
*
path_max_tmp
,
const
char
*
path
);
/* strips extra "///" and leading "/" and trailing "/" */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment