Mercurial > hg > octave-avbm
changeset 6694:3d913ba36b75
[project @ 2007-06-06 06:08:25 by jwe]
author | jwe |
---|---|
date | Wed, 06 Jun 2007 06:08:26 +0000 |
parents | 768d3ad80bbf |
children | c45431c845f3 |
files | ChangeLog configure.in liboctave/ChangeLog liboctave/file-ops.cc src/ChangeLog src/utils.cc |
diffstat | 6 files changed, 81 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-06 Michael Goffioul <michael.goffioul@swing.be> + + * configure.in: Check for utime.h and sys/utime.h headers. + Check for utime, _chmod, _utime, and _utime32 functions. + 2007-06-03 David Bateman <dbateman@free.fr> * configure.in (AC_CONFIG_FILES): Add src/mxarray.h @@ -118,7 +123,7 @@ * octMakefile.in (DISTDIRS): Eliminate variable. -2007-02-26 From Michael Goffioul <michael.goffioul@swing.be> +2007-02-26 Michael Goffioul <michael.goffioul@swing.be> * octMakefile.in, dlfcn/Makefile.in, emacs/Makefile.in: Use $(LN_S) instead of ln or ln -s.
--- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.563 $) +AC_REVISION($Revision: 1.564 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1348,8 +1348,8 @@ floatingpoint.h grp.h ieeefp.h inttypes.h limits.h locale.h memory.h nan.h \ ncurses.h poll.h pwd.h stdint.h stdlib.h string.h sys/ioctl.h \ sys/param.h sys/poll.h sys/resource.h sys/select.h sys/stat.h \ - sys/time.h sys/times.h sys/types.h sys/utsname.h termcap.h \ - unistd.h varargs.h) + sys/time.h sys/times.h sys/types.h sys/utsname.h sys/utime.h termcap.h \ + unistd.h utime.h varargs.h) ### C++ headers @@ -1403,7 +1403,7 @@ ### Checks for functions and variables. -AC_CHECK_FUNCS(atexit basename bcopy bzero canonicalize_file_name \ +AC_CHECK_FUNCS(atexit basename bcopy bzero canonicalize_file_name chmod \ dup2 endgrent endpwent execvp fcntl fork getcwd getegid geteuid \ getgid getgrent getgrgid getgrnam getpgrp getpid getppid getpwent \ getpwuid gettimeofday getuid getwd _kbhit kill link localtime_r \ @@ -1412,7 +1412,8 @@ setlocale setpwent setvbuf sigaction siglongjmp sigpending sigprocmask \ sigsuspend stat strcasecmp strdup strerror stricmp \ strncasecmp strnicmp strsignal symlink tempnam umask \ - uname unlink usleep vfprintf vsprintf vsnprintf waitpid) + uname unlink usleep utime vfprintf vsprintf vsnprintf waitpid \ + _chmod _utime _utime32) case "$canonical_host_type" in *-*-msdosmsvc)
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,15 @@ 2007-06-06 Michael Goffioul <michael.goffioul@swing.be> + * file-ops.cc: Include sys/stat.h, fcntl.h, and utime.h or + sys/utime.h if they are available. + If _chmod is available but chmod is not, define chmod to _chmod + and define HAVE_CHMOD. Likewise for utime and utimbuf. + If _S_IFMT is defined but S_IFMT is not, define S_IFMT to _S_IFMT. + Likewise for _O_RDONLY, _O_WRONLY, _O_CREAT and _O_BINARY. + (tilde_find_suffix, isolate_tilde_prefix, tilde_expand_word): + Use file_ops::is_dir_sep instead of comparing with + file_ops::dir_sep_char. + * MArray-C.cc: Sprinkle with OCTINTERP_API as needed. 2007-06-04 David Bateman <dbateman@free.fr>
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -41,6 +41,20 @@ #include <unistd.h> #endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#if defined (HAVE_UTIME_H) +#include <utime.h> +#elif defined (HAVE_SYS_UTIME_H) +#include <sys/utime.h> +#endif + #include "dir-ops.h" #include "file-ops.h" #include "file-stat.h" @@ -63,13 +77,48 @@ std::string file_ops::dir_sep_str ("/"); #endif -#if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ - && defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) +#if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) std::string file_ops::dir_sep_chars ("/\\"); #else std::string file_ops::dir_sep_chars (file_ops::dir_sep_str); #endif +#if ! defined (HAVE_CHMOD) && defined (HAVE__CHMOD) +#define chmod _chmod +#define HAVE_CHMOD 1 +#endif + +#if ! defined (HAVE_UTIME) \ + && (defined (HAVE__UTIME) || defined (HAVE__UTIME32)) +#define utime _utime +#define utimbuf _utimbuf +#define HAVE_UTIME 1 +#endif + +#if ! defined (S_IFMT) && defined (_S_IFMT) +#define S_IFMT _S_IFMT +#endif + +#if ! defined (O_RDONLY) && defined (_O_RDONLY) +#define O_RDONLY _O_RDONLY +#endif + +#if ! defined (O_WRONLY) && defined (_O_WRONLY) +#define O_WRONLY _O_WRONLY +#endif + +#if ! defined (O_CREAT) && defined (_O_CREAT) +#define O_CREAT _O_CREAT +#endif + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 +#endif +#endif + // We provide a replacement for mkdir(). int @@ -644,7 +693,7 @@ for ( ; i < s_len; i++) { - if (s[i] == file_ops::dir_sep_char) + if (file_ops::is_dir_sep (s[i])) break; if (! suffixes.empty ()) @@ -671,7 +720,7 @@ size_t len = 1; - while (len < f_len && fname[len] != file_ops::dir_sep_char) + while (len < f_len && ! file_ops::is_dir_sep (fname[len])) len++; return fname.substr (1, len); @@ -692,7 +741,7 @@ // of $HOME or the home directory of the current user, regardless of // any preexpansion hook. - if (f_len == 1 || filename[1] == file_ops::dir_sep_char) + if (f_len == 1 || file_ops::is_dir_sep (filename[1])) return octave_env::get_home_directory () + filename.substr (1); std::string username = isolate_tilde_prefix (filename);