Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
wine
wine-winehq
Commits
35842ca7
Commit
35842ca7
authored
Feb 17, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: Added 'relpath' tool to compute relative Unix paths.
parent
dcdb0d0b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
0 deletions
+90
-0
Make.rules.in
Make.rules.in
+1
-0
.gitignore
tools/.gitignore
+1
-0
Makefile.in
tools/Makefile.in
+5
-0
relpath.c
tools/relpath.c
+83
-0
No files found.
Make.rules.in
View file @
35842ca7
...
...
@@ -72,6 +72,7 @@ BIN2RES = $(TOOLSDIR)/tools/bin2res
WMC = $(TOOLSDIR)/tools/wmc/wmc
WIDL = $(TOOLSDIR)/tools/widl/widl
WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc
RELPATH = $(TOOLSDIR)/tools/relpath
SFNT2FNT = $(TOOLSDIR)/tools/sfnt2fnt
FNT2FON = $(TOOLSDIR)/tools/fnt2fon
RC = $(WRC)
...
...
tools/.gitignore
View file @
35842ca7
...
...
@@ -4,6 +4,7 @@ fnt2bdf
fnt2fon
make_ctests
makedep
relpath
sfnt2fnt
winemaker.man
wineprefixcreate
tools/Makefile.in
View file @
35842ca7
...
...
@@ -14,6 +14,7 @@ PROGRAMS = \
fnt2fon
$(EXEEXT)
\
make_ctests
$(EXEEXT)
\
makedep
$(EXEEXT)
\
relpath
$(EXEEXT)
\
sfnt2fnt
$(EXEEXT)
\
wineprefixcreate
...
...
@@ -26,6 +27,7 @@ C_SRCS = \
fnt2fon.c
\
make_ctests.c
\
makedep.c
\
relpath.c
\
sfnt2fnt.c
\
INSTALLSUBDIRS
=
\
...
...
@@ -58,6 +60,9 @@ fnt2bdf$(EXEEXT): fnt2bdf.o
fnt2fon$(EXEEXT)
:
fnt2fon.o
$(CC)
$(CFLAGS)
-o
$@
fnt2fon.o
$(LIBPORT)
relpath$(EXEEXT)
:
relpath.o
$(CC)
$(CFLAGS)
-o
$@
relpath.o
$(LIBPORT)
sfnt2fnt$(EXEEXT)
:
sfnt2fnt.o
$(CC)
$(CFLAGS)
-o
$@
sfnt2fnt.o
$(LIBUNICODE)
$(LIBPORT)
$(FREETYPELIBS)
...
...
tools/relpath.c
0 → 100644
View file @
35842ca7
/*
* Compute the relative path needed to go from one Unix dir to another
*
* Copyright 2006 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* determine where the destination path is located relative to the 'from' path */
static
const
char
*
get_relative_path
(
const
char
*
from
,
const
char
*
dest
,
unsigned
int
*
dotdots
)
{
#define DIR_END(p) (*(p) == 0 || *(p) == '/')
const
char
*
start
;
*
dotdots
=
0
;
for
(;;)
{
while
(
*
from
==
'/'
)
from
++
;
while
(
*
dest
==
'/'
)
dest
++
;
start
=
dest
;
/* save start of next path element */
if
(
!*
from
)
break
;
while
(
!
DIR_END
(
from
)
&&
*
from
==
*
dest
)
{
from
++
;
dest
++
;
}
if
(
DIR_END
(
from
)
&&
DIR_END
(
dest
))
continue
;
/* count remaining elements in 'from' */
do
{
(
*
dotdots
)
++
;
while
(
!
DIR_END
(
from
))
from
++
;
while
(
*
from
==
'/'
)
from
++
;
}
while
(
*
from
);
break
;
}
return
start
;
#undef DIR_END
}
int
main
(
int
argc
,
char
*
argv
[]
)
{
const
char
*
start
;
unsigned
int
dotdots
=
0
;
if
(
argc
!=
3
)
{
fprintf
(
stderr
,
"Usage: %s fromdir todir
\n
"
,
argv
[
0
]
);
exit
(
1
);
}
start
=
get_relative_path
(
argv
[
1
],
argv
[
2
],
&
dotdots
);
if
(
!
start
[
0
]
&&
!
dotdots
)
printf
(
".
\n
"
);
else
{
while
(
dotdots
)
{
printf
(
".."
);
dotdots
--
;
if
(
dotdots
||
start
[
0
])
printf
(
"/"
);
}
printf
(
"%s
\n
"
,
start
);
}
exit
(
0
);
}
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