# HG changeset patch # User John W. Eaton # Date 1289446767 18000 # Node ID 6ccf1130f23c0b4d30df43e7e48c5610224c3dce # Parent 9900d375e5853b6984b3da91b0278f6ee408966a kpse cleanups diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,12 @@ +2010-11-10 John W. Eaton + + * kpse-xfns.c: Delete. + * kpse-xfns.h: Delete. Move defintions to kpse.cc. + * Makefile.am (INCS): Remove kpse-xfns.h from the list. + (LIBOCT_PATHSEARCH_SOURCES): Define to pathsearch.cc. + (LIBOCT_PATHSEARCH_CXX_SOURCES, LIBOCT_PATHSEARCH_C_SOURCES): + Delete variables. + 2010-11-10 John W. Eaton * lo-cieee.c Eliminate special cases for SCO. diff --git a/liboctave/Makefile.am b/liboctave/Makefile.am --- a/liboctave/Makefile.am +++ b/liboctave/Makefile.am @@ -201,7 +201,6 @@ functor.h \ glob-match.h \ idx-vector.h \ - kpse-xfns.h \ lo-array-gripes.h \ lo-ieee.h \ lo-macros.h \ @@ -498,8 +497,7 @@ LIBOCT_PATHSEARCH_C_SOURCES = kpse-xfns.c -LIBOCT_PATHSEARCH_SOURCES = \ - $(LIBOCT_PATHSEARCH_C_SOURCES) $(LIBOCT_PATHSEARCH_CXX_SOURCES) +LIBOCT_PATHSEARCH_SOURCES = pathsearch.cc LINK_DEPS = \ $(RLD_FLAG) \ diff --git a/liboctave/kpse-xfns.c b/liboctave/kpse-xfns.c deleted file mode 100644 --- a/liboctave/kpse-xfns.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -Copyright (C) 1993, 94, 95, 96, 97, 98 Karl Berry. -Copyright (C) 1994, 95, 96, 97 Karl Berry & Olaf Weber. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. */ - -#if defined (HAVE_CONFIG_H) -#include -#endif - -#include - -#include "kpse-xfns.h" - -/* Return the last element in a path. */ - -#ifndef HAVE_BASENAME - -/* Return NAME with any leading path stripped off. This returns a - pointer into NAME. For example, `basename ("/foo/bar.baz")' - returns "bar.baz". */ - -static const char * -basename (const char *name) -{ - const char *base = NULL; - unsigned len = strlen (name); - - for (len = strlen (name); len > 0; len--) { - if (IS_DIR_SEP (name[len - 1]) || IS_DEVICE_SEP (name[len - 1])) { - base = name + len; - break; - } - } - - if (!base) - base = name; - - return base; -} - -#endif - -const char * -octave_basename (const char *name) -{ - return (const char *) basename (name); -} diff --git a/liboctave/kpse-xfns.h b/liboctave/kpse-xfns.h --- a/liboctave/kpse-xfns.h +++ b/liboctave/kpse-xfns.h @@ -52,14 +52,4 @@ #define NAME_BEGINS_WITH_DEVICE(name) 0 #endif -#ifdef __cplusplus -extern "C" { #endif - -extern const char *octave_basename (const char *name); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/liboctave/kpse.cc b/liboctave/kpse.cc --- a/liboctave/kpse.cc +++ b/liboctave/kpse.cc @@ -88,7 +88,35 @@ #define stat ln_stat #endif /* OS2 */ -#include "kpse-xfns.h" +/* Define the characters which separate components of + filenames and environment variable paths. */ + +/* What separates filename components? */ +#ifndef DIR_SEP +#ifdef DOSISH +/* Either \'s or 's work. Wayne Sullivan's web2pc prefers /, so we'll + go with that. */ +#define DIR_SEP '/' +#define DIR_SEP_STRING "/" +#define IS_DEVICE_SEP(ch) ((ch) == ':') +#define NAME_BEGINS_WITH_DEVICE(name) ((name.length()>0) && IS_DEVICE_SEP((name)[1])) +/* On DOS, it's good to allow both \ and / between directories. */ +#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') +#else +#define DIR_SEP '/' +#define DIR_SEP_STRING "/" +#endif /* not DOSISH */ +#endif /* not DIR_SEP */ + +#ifndef IS_DIR_SEP +#define IS_DIR_SEP(ch) ((ch) == DIR_SEP) +#endif +#ifndef IS_DEVICE_SEP /* No `devices' on, e.g., Unix. */ +#define IS_DEVICE_SEP(ch) 0 +#endif +#ifndef NAME_BEGINS_WITH_DEVICE +#define NAME_BEGINS_WITH_DEVICE(name) 0 +#endif #include "lo-error.h" #include "oct-env.h"