OSSP CVS Repository

ossp - Check-in [2495]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2495
Date: 2002-Aug-03 12:23:41 (local)
2002-Aug-03 10:23:41 (UTC)
User:rse
Branch:
Comment: source tree cleanups
Tickets:
Inspections:
Files:
ossp-pkg/path/.cvsignore      added-> 1.1
ossp-pkg/path/Makefile.in      1.1 -> 1.2     8 inserted, 8 deleted
ossp-pkg/path/aclocal.m4      added-> 1.2
ossp-pkg/path/configure.ac      1.2 -> 1.3     6 inserted, 10 deleted
ossp-pkg/path/devtool.conf      1.2 -> 1.3     1 inserted, 1 deleted
ossp-pkg/path/devtool.func      1.1 -> 1.2     2 inserted, 1 deleted
ossp-pkg/path/path-config.in      1.1 -> 1.2     2 inserted, 2 deleted
ossp-pkg/path/path.h      added-> 1.2
ossp-pkg/path/path.pod      added-> 1.2
ossp-pkg/path/path_abs2rel.c      added-> 1.2
ossp-pkg/path/path_basename.c      1.1 -> 1.2     29 inserted, 0 deleted
ossp-pkg/path/path_dirname.c      1.1 -> 1.2     29 inserted, 0 deleted
ossp-pkg/path/path_rel2abs.c      added-> 1.2
ossp-pkg/path/path_resolve.c      1.1 -> 1.2     29 inserted, 0 deleted
ossp-pkg/path/path_test.c      1.1 -> 1.2     29 inserted, 0 deleted

ossp-pkg/path/.cvsignore -> 1.1

*** /dev/null    Sun Apr 28 10:45:35 2024
--- -    Sun Apr 28 10:51:21 2024
***************
*** 0 ****
--- 1,11 ----
+ Makefile
+ config.guess
+ config.h
+ config.h.in
+ config.sub
+ configure
+ libtool.m4
+ ltmain.sh
+ path-config
+ path_test
+ shtool


ossp-pkg/path/Makefile.in 1.1 -> 1.2

--- Makefile.in  2002/01/21 13:32:35     1.1
+++ Makefile.in  2002/08/03 10:23:41     1.2
@@ -1,11 +1,11 @@
 ##
-##  path - OSSP Path Library
+##  OSSP path - Filesystem Path Manipulation
 ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
 ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
 ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
 ##
 ##  This file is part of OSSP path, a filesystem path manipulation library
-##  which can be found at http://www.ossp.org/pkg/path/.
+##  which can be found at http://www.ossp.org/pkg/lib/path/.
 ##
 ##  Permission to use, copy, modify, and distribute this software for
 ##  any purpose with or without fee is hereby granted, provided that
@@ -64,17 +64,17 @@
         $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 
 .c.lo:
-        @$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
+        $(LIBTOOL) --quiet --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 
 $(LIB_NAME): $(LIB_OBJS)
-        @$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) \
+        $(LIBTOOL) --quiet --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) \
             -version-info `$(SHTOOL) version -l txt -d libtool VERSION`
 
 $(TST_NAME): $(TST_OBJS) $(LIB_NAME)
-        @$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(TST_NAME) $(TST_OBJS) $(LIB_NAME) $(LIBS)
+        $(LIBTOOL) --quiet --mode=link $(CC) $(LDFLAGS) -o $(TST_NAME) $(TST_OBJS) $(LIB_NAME) $(LIBS)
 
 check: $(TST_NAME)
-        @$(LIBTOOL) --mode=execute ./$(TST_NAME)
+        $(LIBTOOL) --quiet --mode=execute ./$(TST_NAME)
 
 install:
         $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix)
@@ -83,10 +83,10 @@
         $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(libdir)
         $(SHTOOL) install -c -m 755 path-config $(DESTDIR)$(bindir)/
         $(SHTOOL) install -c -m 644 path.h $(DESTDIR)$(includedir)/
-        @$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libpath.la $(DESTDIR)$(libdir)/
+        $(LIBTOOL) --quiet --mode=install $(SHTOOL) install -c -m 644 libpath.la $(DESTDIR)$(libdir)/
 
 uninstall:
-        @$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libpath.la
+        $(LIBTOOL) --quiet --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libpath.la
         -$(RM) $(DESTDIR)$(includedir)/path.h
         -$(RM) $(DESTDIR)$(bindir)/path-config
         -$(RMDIR) $(DESTDIR)$(libdir) >/dev/null 2>&1 || $(TRUE)


ossp-pkg/path/aclocal.m4 -> 1.2

*** /dev/null    Sun Apr 28 10:45:35 2024
--- -    Sun Apr 28 10:51:21 2024
***************
*** 0 ****
--- 1,228 ----
+ dnl ##
+ dnl ##  OSSP fsl - Faking/Flexible Syslog Library
+ dnl ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ dnl ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ dnl ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ dnl ##
+ dnl ##  This file is part of OSSP path, a filesystem path manipulation library
+ dnl ##  which can be found at http://www.ossp.org/pkg/lib/path/.
+ dnl ##
+ dnl ##  Permission to use, copy, modify, and distribute this software for
+ dnl ##  any purpose with or without fee is hereby granted, provided that
+ dnl ##  the above copyright notice and this permission notice appear in all
+ dnl ##  copies.
+ dnl ##
+ dnl ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ dnl ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ dnl ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ dnl ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ dnl ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ dnl ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ dnl ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ dnl ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ dnl ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ dnl ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ dnl ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ dnl ##  SUCH DAMAGE.
+ dnl ##
+ dnl ##  aclocal.m4: GNU Autoconf local macro definitions
+ dnl ##
+ 
+ dnl ##
+ dnl ##  Check whether compiler option works
+ dnl ##
+ dnl ##  configure.in:
+ dnl ##    AC_COMPILER_OPTION(<name>, <display>, <option>,
+ dnl ##                       <action-success>, <action-failure>)
+ dnl ##
+ 
+ AC_DEFUN(AC_COMPILER_OPTION,[dnl
+ AC_MSG_CHECKING(whether compiler option(s) $2 work)
+ AC_CACHE_VAL(ac_cv_compiler_option_$1,[
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $3"
+ AC_TRY_COMPILE([],[], ac_cv_compiler_option_$1=yes, ac_cv_compiler_option_$1=no)
+ CFLAGS="$SAVE_CFLAGS"
+ ])dnl
+ if test ".$ac_cv_compiler_option_$1" = .yes; then
+     ifelse([$4], , :, [$4])
+ else
+     ifelse([$5], , :, [$5])
+ fi
+ AC_MSG_RESULT([$ac_cv_compiler_option_$1])
+ ])dnl
+ 
+ dnl ##
+ dnl ##  Debugging Support
+ dnl ##
+ dnl ##  configure.in:
+ dnl ##    AC_CHECK_DEBUGGING
+ dnl ##
+ 
+ AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
+ AC_ARG_ENABLE(debug,dnl
+ [  --enable-debug          build for debugging (default=no)],
+ [dnl
+ if test ".$ac_cv_prog_gcc" = ".yes"; then
+     case "$CFLAGS" in
+         *-O* ) ;;
+            * ) CFLAGS="$CFLAGS -O2" ;;
+     esac
+     case "$CFLAGS" in
+         *-g* ) ;;
+            * ) CFLAGS="$CFLAGS -g" ;;
+     esac
+     case "$CFLAGS" in
+         *-pipe* ) ;;
+               * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
+     esac
+     AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CFLAGS="$CFLAGS -DDEBUG")
+     CFLAGS="$CFLAGS -pedantic"
+     CFLAGS="$CFLAGS -Wall"
+     WMORE="-Wshadow -Wpointer-arith -Wcast-align -Winline"
+     WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
+     AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CFLAGS="$CFLAGS $WMORE")
+     AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CFLAGS="$CFLAGS -Wno-long-long")
+ else
+     case "$CFLAGS" in
+         *-g* ) ;;
+            * ) CFLAGS="$CFLAGS -g" ;;
+     esac
+ fi
+ msg="enabled"
+ ],[
+ if test ".$ac_cv_prog_gcc" = ".yes"; then
+ case "$CFLAGS" in
+     *-pipe* ) ;;
+           * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
+ esac
+ fi
+ case "$CFLAGS" in
+     *-g* ) CFLAGS=`echo "$CFLAGS" |\
+                    sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
+ esac
+ case "$CXXFLAGS" in
+     *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
+                      sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
+ esac
+ msg=disabled
+ ])dnl
+ AC_MSG_CHECKING(for compilation debug mode)
+ AC_MSG_RESULT([$msg])
+ if test ".$msg" = .enabled; then
+     enable_shared=no
+ fi
+ ])
+ 
+ dnl ##
+ dnl ##  Check for an external/extension library.
+ dnl ##  - is aware of <libname>-config style scripts
+ dnl ##  - searches under standard paths include, lib, etc.
+ dnl ##  - searches under subareas like .libs, etc.
+ dnl ##
+ dnl ##  configure.in:
+ dnl ##      AC_CHECK_EXTLIB(<realname>, <libname>, <func>, <header>,
+ dnl ##                      [<success-action> [, <fail-action>]])
+ dnl ##  Makefile.in:
+ dnl ##      CFLAGS  = @CFLAGS@
+ dnl ##      LDFLAGS = @LDFLAGS@
+ dnl ##      LIBS    = @LIBS@
+ dnl ##  shell:
+ dnl ##      $ ./configure --with-<libname>[=DIR]
+ dnl ##
+ 
+ AC_DEFUN(AC_CHECK_EXTLIB,[dnl
+ AC_ARG_WITH($2, [dnl
+ [  --with-]m4_substr([$2[[=DIR]]                     ], 0, 19)[build with external $1 library (default=no)]], [dnl
+     if test ".$with_$2" = .yes; then
+         #   via config script in PATH
+         $2_version=`($2-config --version) 2>/dev/null`
+         if test ".$$2_version" != .; then
+             CPPFLAGS="$CPPFLAGS `$2-config --cflags`"
+             CFLAGS="$CFLAGS `$2-config --cflags`"
+             LDFLAGS="$LDFLAGS `$2-config --ldflags`"
+         fi
+     else
+         if test -d "$with_$2"; then
+             found=0
+             #   via config script
+             for dir in $with_$2/bin $with_$2; do
+                 if test -f "$dir/$2-config" && test ! -f "$dir/$2-config.in"; then
+                     $2_version=`($dir/$2-config --version) 2>/dev/null`
+                     if test ".$$2_version" != .; then
+                         CPPFLAGS="$CPPFLAGS `$dir/$2-config --cflags`"
+                         CFLAGS="$CFLAGS `$dir/$2-config --cflags`"
+                         LDFLAGS="$LDFLAGS `$dir/$2-config --ldflags`"
+                         found=1
+                         break
+                     fi
+                 fi
+             done
+             #   in standard sub-areas
+             if test ".$found" = .0; then
+                 for dir in $with_$2/include/$2 $with_$2/include $with_$2; do
+                     if test -f "$dir/$4"; then
+                         CPPFLAGS="$CPPFLAGS -I$dir"
+                         CFLAGS="$CFLAGS -I$dir"
+                         found=1
+                         break
+                     fi
+                 done
+                 for dir in $with_$2/lib/$2 $with_$2/lib $with_$2; do
+                     if test -f "$dir/lib$2.la" && test -d "$dir/.libs"; then
+                         LDFLAGS="$LDFLAGS -L$dir -L$dir/.libs"
+                         found=1
+                         break
+                     elif test -f "$dir/lib$2.a" || test -f "$dir/lib$2.so"; then
+                         LDFLAGS="$LDFLAGS -L$dir"
+                         found=1
+                         break
+                     fi
+                 done
+             fi
+             #   in any sub-area
+             if test ".$found" = .0; then
+ changequote(, )dnl
+                 for file in x `find $with_$2 -name "$4" -type f -print`; do
+                     test .$file = .x && continue
+                     dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
+                     CPPFLAGS="$CPPFLAGS -I$dir"
+                     CFLAGS="$CFLAGS -I$dir"
+                 done
+                 for file in x `find $with_$2 -name "lib$2.[aso]" -type f -print`; do
+                     test .$file = .x && continue
+                     dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
+                     LDFLAGS="$LDFLAGS -L$dir"
+                 done
+ changequote([, ])dnl
+             fi
+         fi
+     fi
+     AC_HAVE_HEADERS($4)
+     AC_CHECK_LIB($2, $3)
+     with_$2=yes
+     ac_var="ac_cv_header_`echo $4 | sed 'y%./+-%__p_%'`"
+     eval "ac_val=\$$ac_var"
+     if test ".$ac_val" != .yes; then
+         with_$2=no
+     fi
+     if test ".$ac_cv_lib_$2_$3" != .yes; then
+         with_$2=no
+     fi
+     if test ".$with_$2" = .no; then
+         AC_ERROR([Unable to find $1 library])
+     fi
+     ], [dnl
+ if test ".$with_$2" = .; then
+     with_$2=no
+ fi
+     ])dnl
+ AC_MSG_CHECKING(whether to build against external $1 library)
+ if test ".$with_$2" = .yes; then
+     ifelse([$5], , :, [$5])
+ else
+     ifelse([$6], , :, [$6])
+ fi
+ AC_MSG_RESULT([$with_$2])
+ ])dnl
+ 


ossp-pkg/path/configure.ac 1.2 -> 1.3

--- configure.ac 2002/01/31 09:10:05     1.2
+++ configure.ac 2002/08/03 10:23:41     1.3
@@ -1,11 +1,11 @@
 dnl ##
-dnl ##  path - OSSP Path Library
+dnl ##  OSSP path - Filesystem Path Manipulation
 dnl ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
 dnl ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
 dnl ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
 dnl ##
 dnl ##  This file is part of OSSP path, a filesystem path manipulation library
-dnl ##  which can be found at http://www.ossp.org/pkg/path/.
+dnl ##  which can be found at http://www.ossp.org/pkg/lib/path/.
 dnl ##
 dnl ##  Permission to use, copy, modify, and distribute this software for
 dnl ##  any purpose with or without fee is hereby granted, provided that
@@ -28,14 +28,11 @@
 dnl ##  configure.ac: GNU Autoconf source script
 dnl ##
 
-AC_PREREQ(2.52)
-AC_REVISION(1.0)
-AC_INIT(README)
+AC_PREREQ(2.53)
+AC_INIT
 
-AC_DIVERT_PUSH(NOTICE)
 V=`./shtool version -l txt -d long VERSION`
 ./shtool echo -e "Configuring %BOSSP path%b (Filesystem Path Manipulations), Version %B${V}%b"
-AC_DIVERT_POP()
 
 AC_SET_MAKE
 AC_PROG_CC
@@ -45,8 +42,7 @@
 AC_PROG_LIBTOOL
 
 AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_FILES(Makefile path-config)
+AC_CONFIG_FILES([Makefile path-config])
+AC_CONFIG_COMMANDS([adjustment], [chmod a+x path-config])
 AC_OUTPUT
 
-chmod a+x path-config
-


ossp-pkg/path/devtool.conf 1.2 -> 1.3

--- devtool.conf 2002/07/28 08:06:10     1.2
+++ devtool.conf 2002/08/03 10:23:41     1.3
@@ -5,7 +5,7 @@
 %autogen
     @autogen shtool   1.6.1 "1.6.*" all
     @autogen libtool  1.4.2 "1.4*"
-    @autogen autoconf 2.52  "2.5.*"
+    @autogen autoconf 2.53  "2.5.*"
 
 %autoclean
     @autoclean shtool


ossp-pkg/path/devtool.func 1.1 -> 1.2

--- devtool.func 2002/01/21 13:32:35     1.1
+++ devtool.func 2002/08/03 10:23:41     1.2
@@ -1,6 +1,6 @@
 ##
 ##  devtool.func -- Development Tool Functions
-##  Copyright (c) 2001 Ralf S. Engelschall <rse@engelschall.com> 
+##  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com> 
 ##
 
 devtool_require () {
@@ -33,6 +33,7 @@
             echo "generating (GNU Autoconf $autoconf_version): configure config.h.in"
             autoconf
             autoheader 2>&1 | grep -v "is unchanged"
+            rm -rf autom4te.cache >/dev/null 2>&1
             ;;
         libtool )
             libtoolize_version=`devtool_require libtoolize --version 4 "$1" "$2"`


ossp-pkg/path/path-config.in 1.1 -> 1.2

--- path-config.in       2002/01/21 13:32:35     1.1
+++ path-config.in       2002/08/03 10:23:41     1.2
@@ -1,12 +1,12 @@
 #!/bin/sh
 ##
-##  path - OSSP Path Library
+##  OSSP path - Filesystem Path Manipulation
 ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
 ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
 ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
 ##
 ##  This file is part of OSSP path, a filesystem path manipulation library
-##  which can be found at http://www.ossp.org/pkg/path/.
+##  which can be found at http://www.ossp.org/pkg/lib/path/.
 ##
 ##  Permission to use, copy, modify, and distribute this software for
 ##  any purpose with or without fee is hereby granted, provided that


ossp-pkg/path/path.h -> 1.2

*** /dev/null    Sun Apr 28 10:45:35 2024
--- -    Sun Apr 28 10:51:21 2024
***************
*** 0 ****
--- 1,41 ----
+ /*
+ **  OSSP path - Filesystem Path Manipulation
+ **  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP path, a filesystem path manipulation library
+ **  which can be found at http://www.ossp.org/pkg/lib/path/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  path.h: API definition
+ */
+ 
+ #ifndef __PATH_H__
+ #define __PATH_H__
+ 
+ char *path_abs2rel  (char *, size_t, const char *, const char *);
+ char *path_rel2abs  (char *, size_t, const char *, const char *);
+ char *path_resolve  (char *, size_t, const char *);
+ char *path_dirname  (char *, size_t, const char *);
+ char *path_basename (char *, size_t, const char *);
+ 
+ #endif /* __PATH_H__ */
+ 


ossp-pkg/path/path.pod -> 1.2

*** /dev/null    Sun Apr 28 10:45:35 2024
--- -    Sun Apr 28 10:51:21 2024
***************
*** 0 ****
--- 1,205 ----
+ ##
+ ##  OSSP path - Filesystem Path Manipulation
+ ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ ##
+ ##  This file is part of OSSP path, a filesystem path manipulation library
+ ##  which can be found at http://www.ossp.org/pkg/lib/path/.
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  path.pod: manual page
+ ##
+ 
+ =pod
+ 
+ =head1 NAME
+ 
+ B<path> - Filesystem Path Manipulation
+ 
+ =head1 SYNOPSIS
+ 
+ #include "path.h"
+ 
+ char *B<path_abs2rel>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>, const char *I<base>);
+ 
+ char *B<path_rel2abs>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>, const char *I<base>);
+ 
+ char *B<path_resolve>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>);
+ 
+ char *B<path_dirname>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>);
+ 
+ char *B<path_basename>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>);
+ 
+ =head1 DESCRIPTION
+ 
+ B<Path> is a filesystem path conversion library. It allows one to
+ convert between absolute and relative paths and to resolve symlinks in a
+ path. The following Application Programming Interface (API) is provided
+ for this:
+ 
+ =over 4
+ 
+ =item char *B<path_abs2rel>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>, const char *I<base>);
+ 
+ This function make a relative path name from an absolute path name
+ I<path> based on a reference directory I<base>. The generated relative
+ path name is stored into the caller supplied buffer at I<outbuf>, but
+ never more than I<outsize> bytes are written. The resulting path name
+ may include symbolic links. The function doesn't check whether or not
+ any path exists. The function returns a pointer to I<outbuf> (the
+ relative path name) on success, and C<NULL> on error.
+ 
+ The function may fail with the following errors and set the external
+ variable C<errno> to indicate the particular error: C<EINVAL> (the
+ I<base> directory isn't an absolute path name or the I<outsize> argument
+ is zero) or C<ERANGE> (the I<outsize> argument is greater than zero but
+ smaller than the length of the pathname plus 1).
+ 
+ =item char *B<path_rel2abs>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>, const char *I<base>);
+ 
+ This function make an absolute path name from a relative path name
+ I<path> based on a reference directory I<base>. The generated absolute
+ path name is stored into the caller supplied buffer at I<outbuf>, but
+ never more than I<outsize> bytes are written. The resulting path name
+ may include symbolic links. The function doesn't check whether or not
+ any path exists. The function returns a pointer to I<outbuf> (the
+ absolute path name) on success, and C<NULL> on error.
+ 
+ The function may fail with the following errors and set the external
+ variable C<errno> to indicate the particular error: C<EINVAL> (the
+ I<base> directory isn't an absolute path name or the I<outsize> argument
+ is zero) or C<ERANGE> (the I<outsize> argument is greater than zero but
+ smaller than the length of the pathname plus 1).
+ 
+ =item char *B<path_resolve>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>);
+ 
+ This function resolves a path name I<path> into the corresponding
+ canonicalized absolute pathname. The generated absolute path name is
+ stored into the caller supplied buffer at I<outbuf>, but never more
+ than I<outsize> bytes are written. The function is capable to resolve
+ symbolic links, extra "C</>" characters and references to "C</./>" and
+ "C</../>". The function returns a pointer to I<outbuf> (the resolved
+ path name) on success, and C<NULL> on error.
+ 
+ The function may fail with an error and set the external variable
+ C<errno> for any of the errors specified for the library functions
+ chdir(2), close(2), fchdir(2), lstat(2), open(2), readlink(2) and
+ getcwd(3).
+ 
+ =item char *B<path_dirname>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>);
+ 
+ This function extracts the directory filename part from I<path> and stores it
+ into the caller supplied buffer at I<outbuf>, but never more than I<outsize>
+ bytes are written.  The function returns a pointer to I<outbuf> on success,
+ and C<NULL> on error.
+ 
+ =item char *B<path_basename>(char *I<outbuf>, const size_t I<outsize>, const char *I<path>);
+ 
+ This function extracts the base filename part from I<path> and stores it into
+ the caller supplied buffer at I<outbuf>, but never more than I<outsize> bytes
+ are written.  The function returns a pointer to I<outbuf> on success, and
+ C<NULL> on error.
+ 
+ =back
+ 
+ =head1 EXAMPLE
+ 
+  char result[MAXPATHLEN];
+  char *path = path_abs2rel(result, sizeof(result), "/usr/src/sys", "/usr/local/lib");
+ 
+ yields:
+ 
+  path == "../../src/sys"
+ 
+ Similarly,
+ 
+  path1 = path_abs2rel(result, sizeof(result), "/usr/src/sys", "/usr");
+  path2 = path_abs2rel(result, sizeof(result), "/usr/src/sys", "/usr/src/sys");
+ 
+ yields:
+ 
+  path1 == "src/sys"
+  path2 == "."
+ 
+ And
+ 
+  char *path = path_rel2abs(result, sizeof(result), "../../src/sys", "/usr/local/lib");
+ 
+ yields:
+ 
+  path == "/usr/src/sys"
+ 
+ Similarly,
+ 
+  path1 = rel2abs(result, sizeof(result), "src/sys", "/usr");
+  path2 = rel2abs(result, sizeof(result), ".", "/usr/src/sys");
+ 
+ yields:
+ 
+  path1 == "/usr/src/sys"
+  path2 == "/usr/src/sys"
+ 
+ =head1 BUGS
+ 
+ If the base directory includes symbolic links, the abs2rel(3) function
+ produces the wrong path. For example, if 'C</sys>' is a symbolic link to
+ 'C</usr/src/sys>',
+ 
+  char *path = path_abs2rel(result, sizeof(result), "/usr/local/lib", "/sys");
+ 
+ yields:
+ 
+  path == "../usr/local/lib" /* It's wrong!! */
+ 
+ You should convert the base directory into a real path in advance.
+ 
+  path = path_abs2rel(result, sizeof(result),
+                      "/sys/kern", 
+                      path_resolve(result2, sizeof(result2), "/sys"));
+ 
+ This then yields:
+ 
+  path == "../../../sys/kern"  /* It's correct but ... */
+ 
+ That is correct, but a little redundant. If you wish get the simple an-
+ swer 'C<kern>', do the following.
+ 
+  path = path_abs2rel(r0, sizeof(r0), 
+                      path_resolve(r1, sizeof(r1), "/sys/kern"), 
+                      path_resolve(r2, sizeof(r2), "/sys"));
+ 
+ The path_resolve(3) function assures correct result, but don't forget
+ that path_resolve(3) requires that all but the last component of the
+ path exist.
+ 
+ =head1 SEE ALSO
+ 
+ =head1 AUTHORS
+ 
+ The path_abs2rel() and path_rel2abs() function was originally written in
+ December 1997 by I<Shigio Yamaguchi> for his I<PathConvert> project. The
+ path_resolve() function is derived from FreeBSD's realpath(3) function
+ which was written in February 1994 by I<Jan-Simon Pendry>. The work off
+ of this code and the B<Path> library as a whole was written in January
+ 2000 by I<Ralf S. Engelschall>.
+ 
+ =cut
+ 


ossp-pkg/path/path_abs2rel.c -> 1.2

*** /dev/null    Sun Apr 28 10:45:35 2024
--- -    Sun Apr 28 10:51:21 2024
***************
*** 0 ****
--- 1,158 ----
+ /*
+ **  OSSP path - Filesystem Path Manipulation
+ **  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP path, a filesystem path manipulation library
+ **  which can be found at http://www.ossp.org/pkg/lib/path/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  path_abs2rel.c: absolute to relative path translation
+ */
+ 
+ /*
+  * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
+  * Copyright (c) 1999 Tama Communications Corporation. All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *      This product includes software developed by Tama Communications
+  *      Corporation.
+  * 4. Neither the name of the author nor the names of any co-contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ 
+ #include "path.h"
+ 
+ /*
+  * abs2rel: convert an absolute path name into relative.
+  */
+ char *
+ path_abs2rel(
+     char *result,
+     size_t size,
+     const char *path,
+     const char *base)
+ {
+     const char *pp, *bp, *branch;
+     const char *endp;
+     char *rp;
+ 
+     /* endp points the last position which is safe in the result buffer. */
+     endp = result + size - 1;
+ 
+     if (*path != '/') {
+         if (strlen(path) >= size)
+             goto erange;
+         strcpy(result, path);
+         goto finish;
+     } 
+     else if (*base != '/' || !size) {
+         errno = EINVAL;
+         return NULL;
+     } 
+     else if (size == 1) {
+         goto erange;
+     }
+ 
+     /*
+      * seek to branched point.
+      */
+     branch = path;
+     for (pp = path, bp = base; *pp && *bp && *pp == *bp; pp++, bp++)
+         if (*pp == '/')
+             branch = pp;
+     if ((*pp == 0 || (*pp == '/' && *(pp + 1) == 0)) &&
+         (*bp == 0 || (*bp == '/' && *(bp + 1) == 0))) {
+         rp = result;
+         *rp++ = '.';
+         if (*pp == '/' || *(pp - 1) == '/')
+             *rp++ = '/';
+         if (rp > endp)
+             goto erange;
+         *rp = 0;
+         goto finish;
+     }
+     if ((*pp == 0 && *bp == '/') || (*pp == '/' && *bp == 0))
+         branch = pp;
+ 
+     /*
+      * up to root.
+      */
+     rp = result;
+     for (bp = base + (branch - path); *bp; bp++) {
+         if (*bp == '/' && *(bp + 1) != 0) {
+             if (rp + 3 > endp)
+                 goto erange;
+             *rp++ = '.';
+             *rp++ = '.';
+             *rp++ = '/';
+         }
+     }
+     if (rp > endp)
+         goto erange;
+     *rp = 0;
+ 
+     /*
+      * down to leaf.
+      */
+     if (*branch) {
+         if (rp + strlen(branch + 1) > endp)
+             goto erange;
+         strcpy(rp, branch + 1);
+     } 
+     else {
+         *--rp = 0;
+     }
+ 
+ finish:
+     return result;
+ 
+ erange:
+     errno = ERANGE;
+     return NULL;
+ }
+ 


ossp-pkg/path/path_basename.c 1.1 -> 1.2

--- path_basename.c      2002/01/21 13:32:35     1.1
+++ path_basename.c      2002/08/03 10:23:41     1.2
@@ -1,3 +1,32 @@
+/*
+**  OSSP path - Filesystem Path Manipulation
+**  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+**
+**  This file is part of OSSP path, a filesystem path manipulation library
+**  which can be found at http://www.ossp.org/pkg/lib/path/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+**  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+**  SUCH DAMAGE.
+**
+**  path_basename.c: base filename extraction
+*/
 
 /*-
  * Copyright (c) 2000 Chris Costello <chris@FreeBSD.org>


ossp-pkg/path/path_dirname.c 1.1 -> 1.2

--- path_dirname.c       2002/01/21 13:32:35     1.1
+++ path_dirname.c       2002/08/03 10:23:41     1.2
@@ -1,3 +1,32 @@
+/*
+**  OSSP path - Filesystem Path Manipulation
+**  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+**
+**  This file is part of OSSP path, a filesystem path manipulation library
+**  which can be found at http://www.ossp.org/pkg/lib/path/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+**  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+**  SUCH DAMAGE.
+**
+**  path_dirname.c: directory name extraction
+*/
 
 /*-
  * Copyright (c) 2000 Chris Costello <chris@FreeBSD.org>


ossp-pkg/path/path_rel2abs.c -> 1.2

*** /dev/null    Sun Apr 28 10:45:35 2024
--- -    Sun Apr 28 10:51:21 2024
***************
*** 0 ****
--- 1,170 ----
+ /*
+ **  OSSP path - Filesystem Path Manipulation
+ **  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP path, a filesystem path manipulation library
+ **  which can be found at http://www.ossp.org/pkg/lib/path/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  path_rel2abs.c: relative to absolute path translation
+ */
+ 
+ /*
+  * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
+  * Copyright (c) 1999 Tama Communications Corporation. All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *      This product includes software developed by Tama Communications
+  *      Corporation.
+  * 4. Neither the name of the author nor the names of any co-contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ 
+ #include "path.h"
+ 
+ /*
+  * rel2abs: convert an relative path name into absolute.
+  */
+ char *
+ path_rel2abs(
+     char *result,
+     size_t size,
+     const char *path,
+     const char *base)
+ {
+     const char *pp, *bp;
+     const char *endp;
+     char *rp;
+     int length;
+ 
+     /* endp points the last position which is safe in the result buffer. */
+     endp = result + size - 1;
+ 
+     if (*path == '/') {
+         if (strlen(path) >= size)
+             goto erange;
+         strcpy(result, path);
+         goto finish;
+     } 
+     else if (*base != '/' || !size) {
+         errno = EINVAL;
+         return (NULL);
+     } 
+     else if (size == 1) {
+         goto erange;
+     }
+ 
+     if (!strcmp(path, ".") || !strcmp(path, "./")) {
+         if (strlen(base) >= size)
+             goto erange;
+         strcpy(result, base);
+ 
+         /* rp points the last char. */
+         rp = result + strlen(base) - 1;
+         if (*rp == '/')
+             *rp = 0;
+         else
+             rp++;
+ 
+         /* rp point NULL char */
+         if (*++path == '/') {
+             /* Append '/' to the tail of path name. */
+             *rp++ = '/';
+             if (rp > endp)
+                 goto erange;
+             *rp = 0;
+         }
+         goto finish;
+     }
+     bp = base + strlen(base);
+     if (*(bp - 1) == '/')
+         --bp;
+ 
+     /*
+      * up to root.
+      */
+     for (pp = path; *pp && *pp == '.'; ) {
+         if (!strncmp(pp, "../", 3)) {
+             pp += 3;
+             while (bp > base && *--bp != '/')
+                 ;
+         } 
+         else if (!strncmp(pp, "./", 2)) {
+             pp += 2;
+         } 
+         else if (!strncmp(pp, "..\0", 3)) {
+             pp += 2;
+             while (bp > base && *--bp != '/')
+                 ;
+         } 
+         else
+             break;
+     }
+ 
+     /*
+      * down to leaf.
+      */
+     length = bp - base;
+     if (length >= size)
+         goto erange;
+     strncpy(result, base, length);
+     rp = result + length;
+     if (*pp || *(pp - 1) == '/' || length == 0)
+         *rp++ = '/';
+     if (rp + strlen(pp) > endp)
+         goto erange;
+     strcpy(rp, pp);
+ 
+ finish:
+     return result;
+ 
+ erange:
+     errno = ERANGE;
+     return (NULL);
+ }
+ 


ossp-pkg/path/path_resolve.c 1.1 -> 1.2

--- path_resolve.c       2002/01/21 13:32:35     1.1
+++ path_resolve.c       2002/08/03 10:23:41     1.2
@@ -1,3 +1,32 @@
+/*
+**  OSSP path - Filesystem Path Manipulation
+**  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+**
+**  This file is part of OSSP path, a filesystem path manipulation library
+**  which can be found at http://www.ossp.org/pkg/lib/path/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+**  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+**  SUCH DAMAGE.
+**
+**  path_resolve.c: pathname resolving
+*/
 
 /*
  * Copyright (c) 1994


ossp-pkg/path/path_test.c 1.1 -> 1.2

--- path_test.c  2002/01/21 13:32:35     1.1
+++ path_test.c  2002/08/03 10:23:41     1.2
@@ -1,3 +1,32 @@
+/*
+**  OSSP path - Filesystem Path Manipulation
+**  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+**
+**  This file is part of OSSP path, a filesystem path manipulation library
+**  which can be found at http://www.ossp.org/pkg/lib/path/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+**  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+**  SUCH DAMAGE.
+**
+**  path_test.c: test suite
+*/
 
 #include <stdio.h>
 #include <stdlib.h>

CVSTrac 2.0.1