# HG changeset patch # User jwe # Date 942423497 0 # Node ID 729ad2b6a052da83227bf42474ea1484811e6eae # Parent a007eb407ff54b4ab63a958e4801121a893e6a42 [project @ 1999-11-12 16:18:16 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +1999-11-12 John W. Eaton + + * utils.cc (jump_to_top_level): No longer declared extern "C". + + * cutils.c (octave_strcasecmp, octave_strncasecmp): New functions. + * utils.cc (almost_match): Call octave_strncasecmp instead of + calling strncasecmp directly. + 1999-11-10 John W. Eaton * parse.y: Don't define warn_reload_forces_clear here. diff --git a/src/cutils.c b/src/cutils.c --- a/src/cutils.c +++ b/src/cutils.c @@ -39,6 +39,8 @@ #include #endif +#include + static void do_octave_usleep (unsigned int useconds) { @@ -78,6 +80,18 @@ do_octave_usleep (usec); } +int +octave_strcasecmp (const char *s1, const char *s2) +{ + return strcasecmp (s1, s2); +} + +int +octave_strncasecmp (const char *s1, const char *s2, size_t n) +{ + return strncasecmp (s1, s2, n); +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/utils.cc b/src/utils.cc --- a/src/utils.cc +++ b/src/utils.cc @@ -51,10 +51,6 @@ LOSE! LOSE! #endif -#ifndef HAVE_STRNCASECMP -extern "C" int strncasecmp (const char*, const char*, size_t); -#endif - #include "SLStack.h" #include "dir-ops.h" @@ -85,7 +81,7 @@ // Return to the main command loop in octave.cc. -extern "C" void +void jump_to_top_level (void) { unwind_protect::run_all (); @@ -104,7 +100,7 @@ && slen >= min_match_len && (case_sens ? (strncmp (std.c_str (), s.c_str (), slen) == 0) - : (strncasecmp (std.c_str (), s.c_str (), slen) == 0))); + : (octave_strncasecmp (std.c_str (), s.c_str (), slen) == 0))); } // Ugh. diff --git a/src/utils.h b/src/utils.h --- a/src/utils.h +++ b/src/utils.h @@ -38,7 +38,7 @@ extern string fcn_file_in_path (const string&); extern string oct_file_in_path (const string&); -extern "C" void jump_to_top_level (void) GCC_ATTR_NORETURN; +extern void jump_to_top_level (void) GCC_ATTR_NORETURN; extern int almost_match (const string& std, const string& s, int min_match_len = 1, int case_sens = 1); @@ -60,6 +60,10 @@ extern "C" void octave_usleep (unsigned int useconds); +extern "C" int octave_strcasecmp (const char *s1, const char *s2); + +extern "C" int octave_strncasecmp (const char *s1, const char *s2, size_t n); + #endif /*