annotate liboctave/system/file-stat.h @ 21244:1473547f50f5

include octave-config.h in public header files * mk-opts.pl, mkbuiltins, mk-ops.awk, sparse-mk-ops.awk: Emit "#include octave-config.h" statement for generated header files. * build-env.h, builtins.h, Cell.h, base-text-renderer.h, c-file-ptr-stream.h, cdisplay.h, comment-list.h, data.h, debug.h, defaults.in.h, defun-dld.h, defun-int.h, defun.h, dirfns.h, display.h, dynamic-ld.h, error.h, errwarn.h, event-queue.h, file-io.h, ft-text-renderer.h, gl-render.h, gl2ps-print.h, graphics.in.h, gripes.h, help.h, hook-fcn.h, input.h, jit-ir.h, jit-typeinfo.h, jit-util.h, load-path.h, load-save.h, ls-ascii-helper.h, ls-hdf5.h, ls-mat-ascii.h, ls-mat4.h, ls-mat5.h, ls-oct-binary.h, ls-oct-text.h, ls-utils.h, mex.h, mexproto.h, mxarray.in.h, oct-errno.h, oct-fstrm.h, oct-handle.h, oct-hdf5-types.h, oct-hdf5.h, oct-hist.h, oct-iostrm.h, oct-lvalue.h, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.h, oct-procbuf.h, oct-stdstrm.h, oct-stream.h, oct-strstrm.h, oct.h, octave-default-image.h, octave-link.h, octave-preserve-stream-state.h, pager.h, pr-output.h, procstream.h, profiler.h, pt-jit.h, sighandlers.h, siglist.h, sparse-xdiv.h, sparse-xpow.h, symtab.h, sysdep.h, text-renderer.h, toplev.h, txt-eng.h, utils.h, variables.h, workspace-element.h, xdiv.h, xnorm.h, xpow.h, zfstream.h, oct-qhull.h, ov-base-diag.h, ov-base-int.h, ov-base-mat.h, ov-base-scalar.h, ov-base-sparse.h, ov-base.h, ov-bool-mat.h, ov-bool-sparse.h, ov-bool.h, ov-builtin.h, ov-cell.h, ov-ch-mat.h, ov-class.h, ov-classdef.h, ov-colon.h, ov-complex.h, ov-cs-list.h, ov-cx-diag.h, ov-cx-mat.h, ov-cx-sparse.h, ov-dld-fcn.h, ov-fcn-handle.h, ov-fcn-inline.h, ov-fcn.h, ov-float.h, ov-flt-complex.h, ov-flt-cx-diag.h, ov-flt-cx-mat.h, ov-flt-re-diag.h, ov-flt-re-mat.h, ov-int-traits.h, ov-int16.h, ov-int32.h, ov-int64.h, ov-int8.h, ov-intx.h, ov-java.h, ov-lazy-idx.h, ov-mex-fcn.h, ov-null-mat.h, ov-oncleanup.h, ov-perm.h, ov-range.h, ov-re-diag.h, ov-re-mat.h, ov-re-sparse.h, ov-scalar.h, ov-str-mat.h, ov-struct.h, ov-type-conv.h, ov-typeinfo.h, ov-uint16.h, ov-uint32.h, ov-uint64.h, ov-uint8.h, ov-usr-fcn.h, ov.h, ovl.h, octave.h, op-int.h, ops.h, options-usage.h, lex.h, parse.h, pt-all.h, pt-arg-list.h, pt-array-list.h, pt-assign.h, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.h, pt-eval.h, pt-except.h, pt-exp.h, pt-fcn-handle.h, pt-funcall.h, pt-id.h, pt-idx.h, pt-jump.h, pt-loop.h, pt-mat.h, pt-misc.h, pt-pr-code.h, pt-select.h, pt-stmt.h, pt-unop.h, pt-walk.h, pt.h, token.h, version.in.h, Array-util.h, Array.h, CColVector.h, CDiagMatrix.h, CMatrix.h, CNDArray.h, CRowVector.h, CSparse.h, DiagArray2.h, MArray.h, MDiagArray2.h, MSparse.h, Matrix.h, MatrixType.h, PermMatrix.h, Range.h, Sparse.h, boolMatrix.h, boolNDArray.h, boolSparse.h, chMatrix.h, chNDArray.h, dColVector.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, dRowVector.h, dSparse.h, dim-vector.h, fCColVector.h, fCDiagMatrix.h, fCMatrix.h, fCNDArray.h, fCRowVector.h, fColVector.h, fDiagMatrix.h, fMatrix.h, fNDArray.h, fRowVector.h, idx-vector.h, int16NDArray.h, int32NDArray.h, int64NDArray.h, int8NDArray.h, intNDArray.h, uint16NDArray.h, uint32NDArray.h, uint64NDArray.h, uint8NDArray.h, f77-fcn.h, lo-error.h, quit.h, CmplxAEPBAL.h, CmplxCHOL.h, CmplxGEPBAL.h, CmplxHESS.h, CmplxLU.h, CmplxQR.h, CmplxQRP.h, CmplxSCHUR.h, CmplxSVD.h, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.h, DASRT.h, DASSL.h, DET.h, EIG.h, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, base-aepbal.h, base-dae.h, base-de.h, base-lu.h, base-min.h, base-qr.h, bsxfun-decl.h, bsxfun.h, dbleAEPBAL.h, dbleCHOL.h, dbleGEPBAL.h, dbleHESS.h, dbleLU.h, dbleQR.h, dbleQRP.h, dbleSCHUR.h, dbleSVD.h, eigs-base.h, fCmplxAEPBAL.h, fCmplxCHOL.h, fCmplxGEPBAL.h, fCmplxHESS.h, fCmplxLU.h, fCmplxQR.h, fCmplxQRP.h, fCmplxSCHUR.h, fCmplxSVD.h, fEIG.h, floatAEPBAL.h, floatCHOL.h, floatGEPBAL.h, floatHESS.h, floatLU.h, floatQR.h, floatQRP.h, floatSCHUR.h, floatSVD.h, lo-mappers.h, lo-specfun.h, oct-convn.h, oct-fftw.h, oct-norm.h, oct-rand.h, oct-spparms.h, randgamma.h, randmtzig.h, randpoisson.h, sparse-chol.h, sparse-dmsolve.h, sparse-lu.h, sparse-qr.h, Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h, Sparse-perm-op-defs.h, mx-base.h, mx-defs.h, mx-ext.h, mx-op-decl.h, mx-op-defs.h, dir-ops.h, file-ops.h, file-stat.h, lo-sysdep.h, mach-info.h, oct-env.h, oct-group.h, oct-openmp.h, oct-passwd.h, oct-syscalls.h, oct-time.h, oct-uname.h, pathlen.h, sysdir.h, syswait.h, action-container.h, base-list.h, byte-swap.h, caseless-str.h, cmd-edit.h, cmd-hist.h, data-conv.h, functor.h, glob-match.h, lo-array-errwarn.h, lo-array-gripes.h, lo-cutils.h, lo-ieee.h, lo-macros.h, lo-math.h, lo-regexp.h, lo-traits.h, lo-utils.h, oct-alloc.h, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.h, oct-inttypes.h, oct-locbuf.h, oct-mutex.h, oct-refcount.h, oct-rl-edit.h, oct-rl-hist.h, oct-shlib.h, oct-sort.h, oct-sparse.h, pathsearch.h, singleton-cleanup.h, sparse-sort.h, sparse-util.h, statdefs.h, str-vec.h, sun-utils.h, unwind-prot.h, url-transfer.h: Include octave-config.h.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2016 14:25:53 -0500
parents 93748bcaec17
children 30c53770f47e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1 /*
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17769
diff changeset
3 Copyright (C) 1996-2015 John W. Eaton
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
4
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
6
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
10 option) any later version.
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
11
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
15 for more details.
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
16
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
19 <http://www.gnu.org/licenses/>.
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
20
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
21 */
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #if ! defined (octave_file_stat_h)
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
24 #define octave_file_stat_h 1
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
27
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
28 #include <string>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
29
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
30 #include "oct-time.h"
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
31
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
32 #include <sys/types.h>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
33
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
34 class
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5476
diff changeset
35 OCTAVE_API
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
36 base_file_stat
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
37 {
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
38 public:
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
39
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
40 base_file_stat (void)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
41 : initialized (false), fail (false), errmsg (), fs_mode (),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
42 fs_ino (), fs_dev (), fs_nlink (), fs_uid (), fs_gid (),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
43 fs_size (), fs_atime (), fs_mtime (), fs_ctime (), fs_rdev (),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
44 fs_blksize (), fs_blocks () { }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
45
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
46 base_file_stat (const base_file_stat& fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
47 : initialized (fs.initialized), fail (fs.fail), errmsg (fs.errmsg),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
48 fs_mode (fs.fs_mode), fs_ino (fs.fs_ino), fs_dev (fs.fs_dev),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
49 fs_nlink (fs.fs_nlink), fs_uid (fs.fs_uid), fs_gid (fs.fs_gid),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
50 fs_size (fs.fs_size), fs_atime (fs.fs_atime), fs_mtime (fs.fs_mtime),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
51 fs_ctime (fs.fs_ctime), fs_rdev (fs.fs_rdev),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
52 fs_blksize (fs.fs_blksize), fs_blocks (fs.fs_blocks) { }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
53
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
54 base_file_stat& operator = (const base_file_stat& fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
55 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
56 if (this != &fs)
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
57 {
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
58 initialized = fs.initialized;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
59 fail = fs.fail;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
60 errmsg = fs.errmsg;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
61 fs_mode = fs.fs_mode;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
62 fs_ino = fs.fs_ino;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
63 fs_dev = fs.fs_dev;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
64 fs_nlink = fs.fs_nlink;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
65 fs_uid = fs.fs_uid;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
66 fs_gid = fs.fs_gid;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
67 fs_size = fs.fs_size;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
68 fs_atime = fs.fs_atime;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
69 fs_mtime = fs.fs_mtime;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
70 fs_ctime = fs.fs_ctime;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
71 fs_rdev = fs.fs_rdev;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
72 fs_blksize = fs.fs_blksize;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
73 fs_blocks = fs.fs_blocks;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
74 }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
75
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
76 return *this;
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
77 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
78
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
79 // The minimum difference in file time stamp values.
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
80 // FIXME: This value should come from the filesystem itself.
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
81 // How can we get that info?
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
82 octave_time time_resolution (void) const
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
83 {
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
84 static octave_time resolution (1.0);
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
85 return resolution;
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
86 }
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
87
8689
ddbe87599331 base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents: 8549
diff changeset
88 // File status and info. The is_XXX functions will return false for
ddbe87599331 base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents: 8549
diff changeset
89 // file_stat objects that are not properly initialized. The others
ddbe87599331 base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents: 8549
diff changeset
90 // should all return 0 (or the equivalent, for the given object)
ddbe87599331 base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents: 8549
diff changeset
91 // which is likely not meaningful.
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
92
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
93 bool is_blk (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
94 bool is_chr (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
95 bool is_dir (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
96 bool is_fifo (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
97 bool is_lnk (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
98 bool is_reg (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
99 bool is_sock (void) const;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
100
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
101 static bool is_blk (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
102 static bool is_chr (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
103 static bool is_dir (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
104 static bool is_fifo (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
105 static bool is_lnk (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
106 static bool is_reg (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
107 static bool is_sock (mode_t mode);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
108
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
109 ino_t ino (void) const { return fs_ino; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
110 dev_t dev (void) const { return fs_dev; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
111
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
112 nlink_t nlink (void) const { return fs_nlink; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
113
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
114 uid_t uid (void) const { return fs_uid; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
115 gid_t gid (void) const { return fs_gid; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
116
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
117 off_t size (void) const { return fs_size; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
118
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
119 octave_time atime (void) const { return fs_atime; }
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
120 octave_time mtime (void) const { return fs_mtime; }
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
121 octave_time ctime (void) const { return fs_ctime; }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
122
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
123 dev_t rdev (void) const { return fs_rdev; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
124
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
125 long blksize (void) const { return fs_blksize; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
126 long blocks (void) const { return fs_blocks; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
127
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
128 mode_t mode (void) const { return fs_mode; }
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
129
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3260
diff changeset
130 std::string mode_as_string (void) const;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
131
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
132 bool ok (void) const { return initialized && ! fail; }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
133
3145
0d640dc625c7 [project @ 1998-02-05 08:44:59 by jwe]
jwe
parents: 2926
diff changeset
134 operator bool () const { return ok (); }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
135
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
136 bool exists (void) const { return ok (); }
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
137
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20792
diff changeset
138 std::string error (void) const { return ok () ? "" : errmsg; }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
139
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
140 // Has the file referenced by this object been modified since TIME?
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
141 bool is_newer (const octave_time& time) const { return fs_mtime > time; }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
142
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
143 // It's nice to be able to hide the file_stat object if we don't
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
144 // really care about it.
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3260
diff changeset
145 static int is_newer (const std::string&, const octave_time&);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
146
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
147 protected:
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
148
11506
964b7fd379f1 more constructor/destructor fixes
John W. Eaton <jwe@octave.org>
parents: 10312
diff changeset
149 virtual ~base_file_stat (void) { }
964b7fd379f1 more constructor/destructor fixes
John W. Eaton <jwe@octave.org>
parents: 10312
diff changeset
150
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
151 // TRUE means we have already called stat.
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
152 bool initialized;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
153
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
154 // TRUE means the stat for this file failed.
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
155 bool fail;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
156
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
157 // If a failure occurs, this contains the system error text.
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3260
diff changeset
158 std::string errmsg;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
159
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
160 // file type and permissions
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
161 mode_t fs_mode;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
162
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
163 // serial number
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
164 ino_t fs_ino;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
165
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
166 // device number
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
167 dev_t fs_dev;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
168
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
169 // number of links
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
170 nlink_t fs_nlink;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
171
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
172 // user ID of owner
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
173 uid_t fs_uid;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
174
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
175 // group ID of owner
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
176 gid_t fs_gid;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
177
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
178 // size in bytes, for regular files
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
179 off_t fs_size;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
180
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
181 // time of last access
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
182 octave_time fs_atime;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
183
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
184 // time of last modification
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
185 octave_time fs_mtime;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
186
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
187 // time of last file status change
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3145
diff changeset
188 octave_time fs_ctime;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
189
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
190 // device number for special files
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
191 dev_t fs_rdev;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
192
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
193 // best I/O block size
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
194 long fs_blksize;
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
195
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
196 // number of 512-byte blocks allocated
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
197 long fs_blocks;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
198 };
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
199
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
200 class
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
201 OCTAVE_API
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
202 file_stat : public base_file_stat
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
203 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
204 public:
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
205
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20792
diff changeset
206 file_stat (const std::string& n = "", bool fl = true)
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
207 : base_file_stat (), file_name (n), follow_links (fl)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
208 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
209 if (! file_name.empty ())
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
210 update_internal ();
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
211 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
212
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
213 file_stat (const file_stat& fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
214 : base_file_stat (fs), file_name (fs.file_name),
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
215 follow_links (fs.follow_links) { }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
216
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
217 file_stat& operator = (const file_stat& fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
218 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
219 if (this != &fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
220 {
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
221 base_file_stat::operator = (fs);
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
222
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
223 file_name = fs.file_name;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
224 follow_links = fs.follow_links;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
225 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
226
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
227 return *this;
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
228 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
229
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
230 ~file_stat (void) { }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
231
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
232 void get_stats (bool force = false)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
233 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
234 if (! initialized || force)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
235 update_internal (force);
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
236 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
237
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
238 void get_stats (const std::string& n, bool force = false)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
239 {
20792
d0991cbd6141 maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents: 20791
diff changeset
240 if (n != file_name || ! initialized || force)
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
241 {
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
242 initialized = false;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
243
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
244 file_name = n;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
245
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
246 update_internal (force);
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
247 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
248 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
249
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
250 private:
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
251
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
252 // Name of the file.
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
253 std::string file_name;
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
254
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
255 // TRUE means follow symbolic links to the ultimate file (stat).
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
256 // FALSE means get information about the link itself (lstat).
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
257 bool follow_links;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
258
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
259 void update_internal (bool force = false);
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
260 };
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
261
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
262 class
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
263 OCTAVE_API
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
264 file_fstat : public base_file_stat
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
265 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
266 public:
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
267
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
268 file_fstat (int n) : base_file_stat (), fid (n)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
269 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
270 update_internal ();
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
271 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
272
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
273 file_fstat (const file_fstat& fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
274 : base_file_stat (fs), fid (fs.fid) { }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
275
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
276 file_fstat& operator = (const file_fstat& fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
277 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
278 if (this != &fs)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
279 {
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
280 base_file_stat::operator = (fs);
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
281
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
282 fid = fs.fid;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
283 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
284
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
285 return *this;
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
286 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
287
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
288 ~file_fstat (void) { }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
289
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
290 void get_stats (bool force = false)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
291 {
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
292 if (! initialized || force)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
293 update_internal (force);
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
294 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
295
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
296 void get_stats (int n, bool force = false)
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
297 {
20792
d0991cbd6141 maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents: 20791
diff changeset
298 if (n != fid || ! initialized || force)
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
299 {
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
300 initialized = false;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
301
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
302 fid = n;
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
303
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
304 update_internal (force);
8549
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
305 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
306 }
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
307
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
308 private:
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
309
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
310 // Open file descriptor.
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
311 int fid;
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
312
424ba638d8f1 [mq]: fstat
file-io.cc (Ffstat): new function
parents: 7017
diff changeset
313 void update_internal (bool force = false);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
314 };
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
315
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
316 #endif