Mercurial > hg > octave-lyh
changeset 6955:4aef2ca14cf9
[project @ 2007-10-04 16:38:11 by jwe]
author | jwe |
---|---|
date | Thu, 04 Oct 2007 16:40:17 +0000 |
parents | 9dabcb305dda |
children | cc712c417943 |
files | ChangeLog aclocal.m4 scripts/ChangeLog scripts/linear-algebra/Makefile.in scripts/miscellaneous/dir.m |
diffstat | 5 files changed, 37 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-03 John W. Eaton <jwe@octave.org> + + * aclocal.m4 (OCTAVE_PROG_SED): Also check for \(X\|Y\) style + regular expression alternation. + 2007-10-01 John W. Eaton <jwe@octave.org> * aclocal.m4 (OCTAVE_CHECK_STRPTIME): Delete.
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -806,9 +806,10 @@ # OCTAVE_PROG_SED # -------------- # Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. +# as few characters as possible and that supports "\(X\|Y\)" +# style regular expression alternation. Prefer GNU sed if found. AC_DEFUN([OCTAVE_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) +[AC_MSG_CHECKING([for a usable sed]) if test -z "$SED"; then AC_CACHE_VAL(ac_cv_path_sed, [ # Loop through the user's path and test for sed and gsed. @@ -837,6 +838,10 @@ octave_cv_path_sed=${_sed} break; fi + # Reject if RE alternation is not handled. + if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then + continue; + fi while true; do cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" mv "$tmp/sed.tmp" "$tmp/sed.in"
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,8 @@ 2007-10-03 John W. Eaton <jwe@octave.org> + * miscellaneous/dir.m: Handle symbolic links in compatible way. + Use S_ISDIR (st.mode) instead of checking st.modestr(1) == "d". + * linear-algebra/Makefile.in (SOURCES): Rename norm.m to __norm__.m. * linear-algebra/__norm__.m: Rename from norm.m. Eliminate special for __vnorm__.
--- a/scripts/linear-algebra/Makefile.in +++ b/scripts/linear-algebra/Makefile.in @@ -20,8 +20,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ -SOURCES = commutation_matrix.m cond.m cross.m dmult.m dot.m \ - duplication_matrix.m housh.m krylov.m krylovb.m logm.m norm.m \ +SOURCES = __norm__.m commutation_matrix.m cond.m cross.m dmult.m \ + dot.m duplication_matrix.m housh.m krylov.m krylovb.m logm.m \ null.m orth.m qzhess.m rank.m rref.m trace.m vec.m vech.m DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
--- a/scripts/miscellaneous/dir.m +++ b/scripts/miscellaneous/dir.m @@ -40,7 +40,12 @@ ## named @var{filename}. @var{directory} may be a list of directories ## specified either by name or with wildcard characters (like * and ?) ## which will be expanded with glob. -## @seealso{ls, stat, readdir, glob, filesep} +## +## Note that for symbolic links, @code{dir} returns information about +## the file that a symbolic link points to instead of the link itself. +## However, if the link points to a nonexisent file, @code{dir} returns +## information about the link. +## @seealso{ls, stat, lstat, readdir, glob, filesep} ## @end deftypefn ## Author: jwe @@ -78,11 +83,11 @@ ## specified. if (nf == 1) fn = flst{1}; - [st, err, msg] = lstat (fn); + [st, err, msg] = stat (fn); if (err < 0) - warning ("dir: `lstat (%s)' failed: %s", fn, msg); + warning ("dir: `stat (%s)' failed: %s", fn, msg); nf = 0; - elseif (st.modestr(1) == "d") + elseif (S_ISDIR (st.mode)) flst = readdir (flst{1}); nf = length (flst); for i = 1:nf @@ -99,13 +104,22 @@ if (err < 0) warning ("dir: `lstat (%s)' failed: %s", fn, msg); else + ## If we are looking at a link that points to something, + ## return info about the target of the link, otherwise, return + ## info about the link itself. + if (S_ISLNK (st.mode)) + [xst, err, msg] = stat (fn); + if (! err) + st = xst; + endif + endif [dummy, fn, ext] = fileparts (fn); fn = strcat (fn, ext); info(i,1).name = fn; - lt = localtime (st.mtime) + lt = localtime (st.mtime); info(i,1).date = strftime ("%d-%b-%Y %T", lt); info(i,1).bytes = st.size; - info(i,1).isdir = st.modestr(1) == "d"; + info(i,1).isdir = S_ISDIR (st.mode); info(i,1).datenum = datenum (lt.year + 1900, lt.mon, lt.mday, lt.hour, lt.min, lt.sec); info(i,1).statinfo = st;