Mercurial > hg > octave-lojdl
changeset 1773:5215571ea783
[project @ 1996-01-23 08:10:26 by jwe]
author | jwe |
---|---|
date | Tue, 23 Jan 1996 08:11:08 +0000 |
parents | 95c4c5705909 |
children | 635d28024664 |
files | liboctave/Makefile.in liboctave/file-ops.cc liboctave/file-ops.h src/Makefile.in src/dirfns.cc src/file-io.cc |
diffstat | 6 files changed, 83 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -29,9 +29,10 @@ INCLUDES := Bounds.h CollocWt.h DAE.h DAEFunc.h FEGrid.h FSQP.h \ LinConst.h LP.h LPsolve.h NLConst.h NLEqn.h NLFunc.h NLP.h \ - NPSOL.h ODE.h ODEFunc.h Objective.h QP.h QPSOL.h \ - Quad.h Range.h base-min.h f77-uscore.h idx-vector.h \ - lo-error.h oct-cmplx.h oct-math.h str-vec.h sun-utils.h \ + NPSOL.h ODE.h ODEFunc.h Objective.h QP.h QPSOL.h Quad.h \ + Range.h base-min.h file-ops.h f77-uscore.h idx-vector.h \ + lo-error.h oct-cmplx.h oct-math.h statdefs.h str-vec.h \ + sun-utils.h \ $(MATRIX_INC) TEMPLATE_SRC := Array.cc MArray.cc @@ -50,15 +51,17 @@ SOURCES := Bounds.cc CollocWt.cc DAE.cc FEGrid.cc FSQP.cc LinConst.cc \ LPsolve.cc NLEqn.cc NPSOL.cc ODE.cc QPSOL.cc Quad.cc \ - Range.cc acosh.c asinh.c atanh.c erf.c erfc.c gamma.c \ - idx-vector.cc lo-error.cc lgamma.c sun-utils.cc \ + Range.cc acosh.c asinh.c atanh.c erf.c erfc.c file-ops.cc \ + filemode.c gamma.c idx-vector.cc lo-error.cc lgamma.c mkdir.c \ + rename.c rmdir.c sun-utils.cc \ $(TEMPLATE_SRC) \ $(TI_SRC) \ $(MATRIX_SRC) EXTRAS := mx-inlines.cc -DISTFILES := Makefile.in $(SOURCES) $(INCLUDES) $(EXTRAS) +DISTFILES := Makefile.in safe-xstat.cin safe-xstat.hin \ + $(SOURCES) $(INCLUDES) $(EXTRAS) MAKEDEPS_1 := $(patsubst %.cc, %.d, $(SOURCES)) MAKEDEPS := $(patsubst %.c, %.d, $(MAKEDEPS_1)) @@ -76,7 +79,7 @@ LIBOCTAVE_DEPEND := $(patsubst %, liboctave.a(%), $(OBJECTS)) -all: stamp-picdir liboctave.a stamp-shared +all: safe-stat.h safe-lstat.h stamp-picdir liboctave.a stamp-shared .PHONY: all stamp-picdir: @@ -96,6 +99,32 @@ else true; fi touch stamp-shared +extract_stat = sed 's/@l@//g; s/@L@//g; /@LSTAT_ONLY@/d' +extract_lstat = sed 's/@l@/l/g; s/@L@/L/g; s/ *@LSTAT_ONLY@//' + +safe-lstat.c: safe-xstat.cin + @echo "making $@ from $<" + @$(extract_lstat) $< > $@.tmp + @$(top_srcdir)/move-if-change $@.tmp $@ + +safe-lstat.h: safe-xstat.hin + @echo "making $@ from $<" + @$(extract_lstat) $< > $@.tmp + @$(top_srcdir)/move-if-change $@.tmp $@ + +safe-stat.c: safe-xstat.cin + @echo "making $@ from $<" + @$(extract_stat) $< > $@.tmp + @$(top_srcdir)/move-if-change $@.tmp $@ + +safe-stat.h: safe-xstat.hin + @echo "making $@ from $<" + @$(extract_stat) $< > $@.tmp + @$(top_srcdir)/move-if-change $@.tmp $@ + +safe-stat.o: safe-stat.h +safe-lstat.o: safe-lstat.h safe-stat.h + check: all .PHONY: check @@ -126,7 +155,7 @@ etags $(SOURCES) clean: - rm -f *.a *.o *.d pic/*.o + rm -f safe-stat.h safe-lstat.h *.a *.o *.d pic/*.o if $(SHARED_LIBS); then rm -f *.$(SHLEXT); fi .PHONY: clean
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -34,6 +34,8 @@ #endif #include "file-ops.h" +#include "safe-lstat.h" +#include "safe-stat.h" #include "statdefs.h" // XXX FIXME XXX -- the is_* and mode_as_string functions are only valid @@ -111,7 +113,7 @@ struct stat buf; int status = follow_links - ? stat (cname, &buf) : lstat (cname, &buf); + ? safe_stat (cname, &buf) : safe_lstat (cname, &buf); if (status < 0) { @@ -167,9 +169,9 @@ } int -oct_rmdir (const string& name) +oct_mkfifo (const string& name, mode_t mode) { - return rmdir (name.c_str ()); + return mkfifo (name.c_str (), mode); } int @@ -179,9 +181,9 @@ } int -oct_mkfifo (const string& name, mode_t mode) +oct_rmdir (const string& name) { - return mkfifo (name.c_str (), mode); + return rmdir (name.c_str ()); } int @@ -194,6 +196,12 @@ #endif } +int +oct_unlink (const string& name) +{ + return unlink (name.c_str ()); +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/liboctave/file-ops.h +++ b/liboctave/file-ops.h @@ -190,10 +190,11 @@ extern int is_newer (const string&, time_t); extern int oct_mkdir (const string&, mode_t); -extern int oct_rmdir (const string&); +extern int oct_mkfifo (const string&, mode_t); extern int oct_rename (const string&, const string&); -extern int oct_mkfifo (const string&, mode_t); +extern int oct_rmdir (const string&); extern int oct_umask (mode_t); +extern int oct_unlink (const string&); #endif
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -83,15 +83,16 @@ INCLUDES := arith-ops.h builtins.h defaults.h.in defun.h defun-dld.h \ defun-int.h dirfns.h dynamic-ld.h error.h file-info.h \ - file-io.h fnmatch.h getopt.h gripes.h help.h input.h lex.h \ - load-save.h mappers.h missing-math.h oct-gperf.h \ - oct-hist.h oct-map.h oct-obj.h pager.h parse.h pathlen.h \ - pathsearch.h pr-output.h procstream.h pt-base.h pt-cmd.h \ - pt-const.h pt-exp-base.h pt-exp.h pt-fcn.h pt-fvc-base.h \ - pt-fvc.h pt-mat.h pt-misc.h pt-mvr-base.h pt-mvr.h pt-plot.h \ - sighandlers.h statdefs.h symtab.h sysdep.h sysdir.h systime.h \ - syswait.h token.h toplev.h unwind-prot.h user-prefs.h utils.h \ - variables.h version.h xdiv.h xpow.h Map.h SLStack.h Stack.h + file-io.h fnmatch.h getopt.h gripes.h help.h \ + input.h lex.h load-save.h mappers.h \ + oct-gperf.h oct-hist.h oct-map.h oct-obj.h pager.h parse.h \ + pathlen.h pathsearch.h pr-output.h procstream.h pt-base.h \ + pt-cmd.h pt-const.h pt-exp-base.h pt-exp.h pt-fcn.h \ + pt-fvc-base.h pt-fvc.h pt-mat.h pt-misc.h pt-mvr-base.h \ + pt-mvr.h pt-plot.h sighandlers.h statdefs.h symtab.h sysdep.h \ + sysdir.h systime.h syswait.h token.h toplev.h unwind-prot.h \ + user-prefs.h utils.h variables.h version.h xdiv.h xpow.h Map.h \ + SLStack.h Stack.h TI_SRC := Array-tc.cc Map-tc.cc DLList-fi.cc \ SLList-expr.cc SLList-misc.cc SLList-plot.cc SLList-str.cc \ @@ -106,17 +107,17 @@ TI_PICOBJ := $(addprefix pic/, $(TI_OBJ)) endif -SOURCES := acosh.c arith-ops.cc asinh.c atanh.c data.cc dirfns.cc \ - dynamic-ld.cc erf.c erfc.c error.cc file-info.cc file-io.cc \ - filemode.c fnmatch.c getopt.c getopt1.c gripes.cc help.cc \ - input.cc lex.l load-save.cc mappers.cc mkdir.c oct-hist.cc \ - oct-map.cc oct-obj.cc pager.cc parse.y pathsearch.cc \ - pr-output.cc procstream.cc pt-base.cc pt-cmd.cc pt-const.cc \ - pt-exp-base.cc pt-exp.cc pt-fcn.cc pt-fvc-base.cc pt-fvc.cc \ - pt-mat.cc pt-misc.cc pt-mvr-base.cc pt-mvr.cc pt-plot.cc \ - rename.c resource.cc rmdir.c sighandlers.cc strcasecmp.c \ - strncase.c strfns.cc strftime.c symtab.cc sysdep.cc \ - tempname.c timefns.cc tempnam.c token.cc toplev.cc \ +SOURCES := arith-ops.cc data.cc dirfns.cc \ + dynamic-ld.cc error.cc file-info.cc file-io.cc \ + fnmatch.c getopt.c getopt1.c \ + gripes.cc help.cc input.cc lex.l load-save.cc mappers.cc \ + oct-hist.cc oct-map.cc oct-obj.cc pager.cc parse.y \ + pathsearch.cc pr-output.cc procstream.cc pt-base.cc pt-cmd.cc \ + pt-const.cc pt-exp-base.cc pt-exp.cc pt-fcn.cc pt-fvc-base.cc \ + pt-fvc.cc pt-mat.cc pt-misc.cc pt-mvr-base.cc pt-mvr.cc \ + pt-plot.cc resource.cc sighandlers.cc \ + strcasecmp.c strncase.c strfns.cc strftime.c symtab.cc \ + sysdep.cc tempname.c timefns.cc tempnam.c token.cc toplev.cc \ unwind-prot.cc user-prefs.cc utils.cc variables.cc xdiv.cc \ xpow.cc @@ -165,10 +166,10 @@ LIBS = @LIBS@ DISTFILES = Makefile.in mkdefs mkbuiltins octave.gperf octave.cc \ - parse.cc lex.cc y.tab.h safe-xstat.cin safe-xstat.hin \ + parse.cc lex.cc y.tab.h \ $(INCLUDES) $(DLD_SRC) $(SOURCES) $(TEMPLATE_SRC) $(TI_SRC) -all: defaults.h safe-stat.h safe-lstat.h stamp-picdir libraries \ +all: defaults.h stamp-picdir libraries \ $(OCT_FILES) octave .PHONY: all @@ -261,7 +262,7 @@ etags $(SOURCES) $(DLD_SRC) $(TI_SRC) clean: - rm -f *.a *.o builtins.cc safe-stat.h safe-lstat.h \ + rm -f *.a *.o builtins.cc \ defaults.h *.d *.def if $(SHARED_LIBS); then rm -f *.$(SHLEXT); fi .PHONY: clean @@ -323,32 +324,6 @@ $< > $@.tmp @$(top_srcdir)/move-if-change $@.tmp $@ -extract_stat = sed 's/@l@//g; s/@L@//g; /@LSTAT_ONLY@/d' -extract_lstat = sed 's/@l@/l/g; s/@L@/L/g; s/ *@LSTAT_ONLY@//' - -safe-lstat.c: safe-xstat.cin - @echo "making $@ from $<" - @$(extract_lstat) $< > $@.tmp - @$(top_srcdir)/move-if-change $@.tmp $@ - -safe-lstat.h: safe-xstat.hin - @echo "making $@ from $<" - @$(extract_lstat) $< > $@.tmp - @$(top_srcdir)/move-if-change $@.tmp $@ - -safe-stat.c: safe-xstat.cin - @echo "making $@ from $<" - @$(extract_stat) $< > $@.tmp - @$(top_srcdir)/move-if-change $@.tmp $@ - -safe-stat.h: safe-xstat.hin - @echo "making $@ from $<" - @$(extract_stat) $< > $@.tmp - @$(top_srcdir)/move-if-change $@.tmp $@ - -safe-stat.o: safe-stat.h -safe-lstat.o: safe-lstat.h safe-stat.h - check: all .PHONY: check
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -544,7 +544,7 @@ gripe_wrong_type_arg ("mkdir", args(0)); else { - int mkdir_retval = xmkdir (oct_tilde_expand (dirname), 0777); + int mkdir_retval = oct_mkdir (oct_tilde_expand (dirname), 0777); if (mkdir_retval < 0) { @@ -580,7 +580,7 @@ gripe_wrong_type_arg ("rmdir", args(0)); else { - int rmdir_retval = xrmdir (oct_tilde_expand (dirname)); + int rmdir_retval = oct_rmdir (oct_tilde_expand (dirname)); if (rmdir_retval < 0) { @@ -620,7 +620,7 @@ if (error_state) gripe_wrong_type_arg ("rename", args(1)); - else if (xrename (from, to) < 0) + else if (oct_rename (from, to) < 0) { status = -1; error ("%s", strerror (errno));
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -2345,7 +2345,7 @@ long mode = (long) args(1).double_value (); - retval (0) = (double) xmkfifo (name, mode); + retval (0) = (double) oct_mkfifo (name, mode); return retval; } @@ -2386,7 +2386,7 @@ string name = args(0).string_value (); - retval (0) = (double) unlink (name.c_str ()); + retval (0) = (double) oct_unlink (name); return retval; } @@ -2578,7 +2578,7 @@ int oct_mask = convert (mask, 8, 10); if (! error_state) - status = convert (xumask (oct_mask), 10, 8); + status = convert (oct_umask (oct_mask), 10, 8); } } }