Mercurial > octave
annotate libinterp/corefcn/syscalls.cc @ 24534:194eb4bd202b
maint: Update punctuation for GPL v3 license text.
* COPYING, Makefile.am, README,
bootstrap, bootstrap.conf, OctJavaQry.java, changelog.tmpl,
check-subst-vars.in.sh, find-defun-files.sh, find-files-with-tests.sh,
get-source-mtime.sh, mk-hg-id.sh, mk-octave-config-h.sh, mk-opts.pl,
stl_algo.h-fixed, subst-config-vals.in.sh, subst-cross-config-vals.in.sh,
subst-default-vals.in.sh, subst-script-vals.in.sh, configure.ac,
Doxyfile.in, arith.txi, audio.txi, basics.txi, bugs.txi, config-images.sh,
container.txi, cp-idx.txi, data.txi, debug.txi, diagperm.txi, diffeq.txi,
add_to_aspell_dict, mk_undocumented_list, spellcheck, errors.txi, eval.txi,
expr.txi, external.txi, fn-idx.txi, func.txi, genpropdoc.m, geometry.txi,
geometryimages.m, grammar.txi, gui.txi, image.txi, images.awk, install.txi,
interp.txi, interpimages.m, intro.txi, io.txi, linalg.txi, macros.texi,
matrix.txi, mk-doc-cache.pl, mkcontrib.awk, mkoctfile.1, munge-texi.pl,
nonlin.txi, numbers.txi, obsolete.txi, octave-cli.1, octave-config.1, octave.1,
octave.css, octave.texi, oop.txi, op-idx.txi, optim.txi, package.txi, plot.txi,
plotimages.m, poly.txi, preface.txi, quad.txi, set.txi, signal.txi, sparse.txi,
sparseimages.m, splineimages.m, stats.txi, stmt.txi, strings.txi, system.txi,
testfun.txi, var.txi, vectorize.txi, array.texi, bugs.texi, cp-idx.texi,
dae.texi, diffeq.texi, error.texi, factor.texi, fn-idx.texi, gpl.texi,
install.texi, intro.texi, liboctave.texi, matvec.texi, nleqn.texi, nlfunc.texi,
ode.texi, optim.texi, preface.texi, quad.texi, range.texi, refcard-a4.tex,
refcard-legal.tex, refcard-letter.tex, refcard.tex, HACKING.md,
octave.appdata.xml.in, Backend.cc, Backend.h, BaseControl.cc, BaseControl.h,
ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc,
Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc,
Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h,
GenericEventNotify.h, KeyMap.cc, KeyMap.h, ListBoxControl.cc, ListBoxControl.h,
Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc,
MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h,
ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc,
PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc,
RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc,
TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h,
ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h,
annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h,
liboctgui-build-info.h, liboctgui-build-info.in.cc,
mk-default-qt-settings.in.sh, QTerminal.cc, QTerminal.h, BlockArray.cpp,
BlockArray.h, Character.h, CharacterColor.h, Emulation.cpp, Emulation.h,
Filter.cpp, Filter.h, History.cpp, History.h, KeyboardTranslator.cpp,
KeyboardTranslator.h, QUnixTerminalImpl.cpp, QUnixTerminalImpl.h, Screen.cpp,
Screen.h, ScreenWindow.cpp, ScreenWindow.h, SelfListener.cpp, SelfListener.h,
TerminalCharacterDecoder.cpp, TerminalCharacterDecoder.h, TerminalModel.cpp,
TerminalModel.h, TerminalView.cpp, TerminalView.h, Vt102Emulation.cpp,
Vt102Emulation.h, kpty.cpp, kpty.h, kpty_p.h, QTerminalColors.cpp,
QTerminalColors.h, QWinTerminalImpl.cpp, QWinTerminalImpl.h, main.cpp,
color-picker.cc, color-picker.h, dialog.cc, dialog.h,
documentation-dock-widget.cc, documentation-dock-widget.h,
external-editor-interface.cc, external-editor-interface.h,
files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
history-dock-widget.cc, history-dock-widget.h, file-editor-interface.h,
file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h,
find-dialog.cc, find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc,
octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc,
main-window.h, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc,
octave-dock-widget.h, octave-gui.cc, octave-gui.h, octave-qt-link.cc,
octave-qt-link.h, octave-settings.h, texinfo-parser.cc, texinfo-parser.h,
webinfo.cc, webinfo.h, resource-manager.cc, resource-manager.h,
settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, shortcut-manager.h,
terminal-dock-widget.cc, terminal-dock-widget.h, thread-manager.cc,
thread-manager.h, variable-editor-model.cc, variable-editor-model.h,
variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h,
workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h,
build-env.h, build-env.in.cc, builtins.h, Cell.cc, Cell.h, __contourc__.cc,
__dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc,
base-text-renderer.h, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc,
c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h,
cdisplay.c, cdisplay.h, cellfun.cc, coct-hdf5-types.c, colloc.cc, conv2.cc,
daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, default-defs.in.h,
defaults.cc, defaults.h, defun-dld.h, defun-int.h, defun.cc, defun.h, det.cc,
dirfns.cc, dirfns.h, display.cc, display.h, dlmread.cc, dot.cc, dynamic-ld.cc,
dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc,
error.h, errwarn.cc, errwarn.h, event-queue.cc, event-queue.h, fcn-info.cc,
fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, file-io.h, filter.cc,
find.cc, ft-text-renderer.cc, ft-text-renderer.h, gammainc.cc, gcd.cc,
genprops.awk, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc,
gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-handle.h,
graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gripes.cc,
gripes.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h,
hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, kron.cc, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-hdf5.cc, ls-hdf5.h,
ls-mat-ascii.cc, ls-mat-ascii.h, ls-mat4.cc, ls-mat4.h, ls-mat5.cc, ls-mat5.h,
ls-oct-binary.cc, ls-oct-binary.h, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mex.h,
mexproto.h, mgorth.cc, mk-errno-list.sh, mk-mxarray-h.in.sh, mxarray.in.h,
nproc.cc, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h,
oct-handle.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hdf5.h, oct-hist.cc,
oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-obj.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h,
oct-tex-lexer.in.ll, oct-tex-parser.in.yy, oct.h, octave-default-image.h,
octave-link.cc, octave-link.h, ordschur.cc, pager.cc, pager.h, pinv.cc,
pr-output.cc, pr-output.h, procstream.cc, procstream.h, psi.cc, quad.cc,
quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc,
sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h,
sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc,
sub2ind.cc, svd.cc, sylvester.cc, symrec.cc, symrec.h, symscope.cc, symscope.h,
symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-renderer.cc,
text-renderer.h, time.cc, toplev.cc, toplev.h, tril.cc, tsearch.cc, txt-eng.cc,
txt-eng.h, typecast.cc, url-handle-manager.cc, url-handle-manager.h,
urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, workspace-element.h,
xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, zfstream.cc, zfstream.h,
deprecated-config.h, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc,
__glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc,
__osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc,
ccolamd.cc, chol.cc, colamd.cc, config-module.awk, config-module.sh,
convhulln.cc, dmperm.cc, fftw.cc, gzip.cc, oct-qhull.h, qr.cc, symbfact.cc,
symrcm.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc,
mk-build-env-features.sh, mk-builtins.pl, mk-doc.pl, mk-pkg-add.sh,
mk-version-h.in.sh, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc,
ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc,
ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h,
ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc,
ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h,
ov-colon.cc, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc,
ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h,
ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h,
ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h,
ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h,
ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h,
ov-int-traits.h, ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc,
ov-int64.h, ov-int8.cc, ov-int8.h, ov-intx.h, ov-java.cc, ov-java.h,
ov-lazy-idx.cc, ov-lazy-idx.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc,
ov-null-mat.h, ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h,
ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc,
ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h,
ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc,
ov-typeinfo.h, ov-uint16.cc, ov-uint16.h, ov-uint32.cc, ov-uint32.h,
ov-uint64.cc, ov-uint64.h, ov-uint8.cc, ov-uint8.h, ov-usr-fcn.cc,
ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, op-kw-docs,
mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc,
op-bm-sbm.cc, op-cdm-cdm.cc, op-cdm-cm.cc, op-cdm-cs.cc, op-cdm-dm.cc,
op-cdm-m.cc, op-cdm-s.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cdm.cc,
op-cm-cm.cc, op-cm-cs.cc, op-cm-dm.cc, op-cm-m.cc, op-cm-pm.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-cdm.cc, op-dm-cm.cc, op-dm-cs.cc, op-dm-dm.cc,
op-dm-m.cc, op-dm-s.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc,
op-dms-template.cc, op-fcdm-fcdm.cc, op-fcdm-fcm.cc, op-fcdm-fcs.cc,
op-fcdm-fdm.cc, op-fcdm-fm.cc, op-fcdm-fs.cc, op-fcm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fdm.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcm-pm.cc,
op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc,
op-fdm-fcdm.cc, op-fdm-fcm.cc, op-fdm-fcs.cc, op-fdm-fdm.cc, op-fdm-fm.cc,
op-fdm-fs.cc, op-fm-fcdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fdm.cc,
op-fm-fm.cc, op-fm-fs.cc, op-fm-pm.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc,
op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc,
op-int-concat.cc, op-int.h, op-m-cdm.cc, op-m-cm.cc, op-m-cs.cc, op-m-dm.cc,
op-m-m.cc, op-m-pm.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-cm.cc,
op-pm-fcm.cc, op-pm-fm.cc, op-pm-m.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h,
options-usage.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h,
jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc, jit-util.h,
lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.in.yy, octave.gperf,
parse.h, profiler.cc, profiler.h, pt-all.h, pt-arg-list.cc, pt-arg-list.h,
pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc,
pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc,
pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h,
pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h,
pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h,
pt-fcn-handle.cc, pt-fcn-handle.h, pt-funcall.cc, pt-funcall.h, pt-id.cc,
pt-id.h, pt-idx.cc, pt-idx.h, pt-jit.cc, pt-jit.h, pt-jump.cc, pt-jump.h,
pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h,
pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-stmt.cc, pt-stmt.h,
pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.cc, pt-walk.h,
pt.cc, pt.h, token.cc, token.h, Array-jit.cc, Array-tc.cc, version.cc,
version.in.h, Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc,
Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc,
Array-util.cc, Array-util.h, Array-voidp.cc, Array.cc, Array.h, CColVector.cc,
CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, CMatrix.h,
CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc, CSparse.h,
DiagArray2.cc, DiagArray2.h, MArray-C.cc, MArray-d.cc, MArray-f.cc,
MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc, MArray.h, MDiagArray2.cc,
MDiagArray2.h, MSparse-C.cc, MSparse-d.cc, MSparse.cc, MSparse.h, Matrix.h,
MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h,
Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, Sparse.h, boolMatrix.cc,
boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h,
chMatrix.cc, chMatrix.h, chNDArray.cc, chNDArray.h, dColVector.cc,
dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h,
dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, dSparse.cc, dSparse.h,
dim-vector.cc, dim-vector.h, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc,
fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, fCNDArray.h,
fCRowVector.cc, fCRowVector.h, fColVector.cc, fColVector.h, fDiagMatrix.cc,
fDiagMatrix.h, fMatrix.cc, fMatrix.h, fNDArray.cc, fNDArray.h, fRowVector.cc,
fRowVector.h, idx-vector.cc, idx-vector.h, int16NDArray.cc, int16NDArray.h,
int32NDArray.cc, int32NDArray.h, int64NDArray.cc, int64NDArray.h,
int8NDArray.cc, int8NDArray.h, intNDArray.cc, intNDArray.h, uint16NDArray.cc,
uint16NDArray.h, uint32NDArray.cc, uint32NDArray.h, uint64NDArray.cc,
uint64NDArray.h, uint8NDArray.cc, uint8NDArray.h, cconv2.f, cdotc3.f, cmatm3.f,
csconv2.f, dconv2.f, ddot3.f, dmatm3.f, sconv2.f, sdot3.f, smatm3.f, zconv2.f,
zdconv2.f, zdotc3.f, zmatm3.f, crsf2csf.f, zrsf2csf.f, mk-f77-def.in.sh,
liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h,
DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK-opts.in, DASPK.cc, DASPK.h,
DASRT-opts.in, DASRT.cc, DASRT.h, DASSL-opts.in, DASSL.cc, DASSL.h, DET.h,
EIG.cc, EIG.h, LSODE-opts.in, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.cc,
ODES.h, ODESFunc.h, Quad-opts.in, Quad.cc, Quad.h, aepbalance.cc, aepbalance.h,
base-dae.h, base-de.h, base-min.h, bsxfun-decl.h, bsxfun-defs.cc, bsxfun.h,
chol.cc, chol.h, eigs-base.cc, eigs-base.h, fEIG.cc, fEIG.h, gepbalance.cc,
gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-amos-proto.h,
lo-arpack-proto.h, lo-blas-proto.h, lo-fftpack-proto.h, lo-lapack-proto.h,
lo-mappers.cc, lo-mappers.h, lo-qrupdate-proto.h, lo-ranlib-proto.h,
lo-slatec-proto.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc,
oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc,
oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h,
randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc,
randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h,
sparse-dmsolve.cc, sparse-dmsolve.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h, Sparse-diag-op-defs.h, Sparse-op-decls.h,
Sparse-op-defs.h, Sparse-perm-op-defs.h, config-ops.sh, mk-ops.awk, mx-base.h,
mx-defs.h, mx-ext.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h, mx-ops,
smx-ops, vx-ops, child-list.cc, child-list.h, cmach-info.c, cmach-info.h,
dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h,
lo-sysdep.cc, lo-sysdep.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h,
oct-group.cc, oct-group.h, oct-passwd.cc, oct-passwd.h, oct-syscalls.cc,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h,
action-container.h, base-list.h, blaswrap.c, byte-swap.h, caseless-str.h,
cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, cquit.c, data-conv.cc,
data-conv.h, f2c-main.c, f77-fcn.c, f77-fcn.h, file-info.cc, file-info.h,
functor.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc,
lo-array-errwarn.h, lo-array-gripes.cc, lo-array-gripes.h, lo-cutils.c,
lo-cutils.h, lo-error.c, lo-error.h, lo-hash.cc, lo-hash.h, lo-ieee.cc,
lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-traits.h, lo-utils.cc, lo-utils.h,
oct-base64.cc, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.cc,
oct-glob.h, oct-inttypes-fwd.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-rl-edit.c, oct-rl-edit.h,
oct-rl-hist.c, oct-rl-hist.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc,
oct-sort.h, oct-sparse.cc, oct-sparse.h, oct-string.cc, oct-string.h,
octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h,
singleton-cleanup.cc, singleton-cleanup.h, sparse-sort.cc, sparse-sort.h,
sparse-util.cc, sparse-util.h, str-vec.cc, str-vec.h, sun-utils.h,
unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h,
areadlink-wrapper.c, areadlink-wrapper.h, async-system-wrapper.c,
async-system-wrapper.h, base64-wrappers.c, base64-wrappers.h,
canonicalize-file-name-wrapper.c, canonicalize-file-name-wrapper.h,
dirent-wrappers.c, dirent-wrappers.h, fcntl-wrappers.c, fcntl-wrappers.h,
filepos-wrappers.c, filepos-wrappers.h, fpucw-wrappers.c, fpucw-wrappers.h,
gen-tempname-wrapper.c, gen-tempname-wrapper.h, getopt-wrapper.c,
getopt-wrapper.h, glob-wrappers.c, glob-wrappers.h, hash-wrappers.c,
hash-wrappers.h, localcharset-wrapper.c, localcharset-wrapper.h,
math-wrappers.c, math-wrappers.h, mkostemp-wrapper.c, mkostemp-wrapper.h,
nanosleep-wrapper.c, nanosleep-wrapper.h, nproc-wrapper.c, nproc-wrapper.h,
octave-popen2.c, octave-popen2.h, putenv-wrapper.c, putenv-wrapper.h,
set-program-name-wrapper.c, set-program-name-wrapper.h, signal-wrappers.c,
signal-wrappers.h, stat-wrappers.c, stat-wrappers.h, strdup-wrapper.c,
strdup-wrapper.h, strftime-wrapper.c, strftime-wrapper.h, strmode-wrapper.c,
strmode-wrapper.h, strptime-wrapper.c, strptime-wrapper.h, time-wrappers.c,
time-wrappers.h, tmpfile-wrapper.c, tmpfile-wrapper.h, uname-wrapper.c,
uname-wrapper.h, uniconv-wrappers.c, uniconv-wrappers.h, unistd-wrappers.c,
unistd-wrappers.h, unsetenv-wrapper.c, unsetenv-wrapper.h, vasprintf-wrapper.c,
vasprintf-wrapper.h, wait-for-input.c, wait-for-input.h, wait-wrappers.c,
wait-wrappers.h, acinclude.m4, ax_blas.m4, ax_lapack.m4, ax_openmp.m4,
ax_pthread.m4, octave_blas_f77_func.m4, pkg.m4, oct-conf-post.in.h,
run-octave.in, Map.m, ascii.m, binary.m, cd.m, close.m, delete.m,
dir.m, disp.m, ftp.m, loadobj.m, mget.m, mkdir.m, mput.m, rename.m, rmdir.m,
saveobj.m, __get_properties__.m, audioplayer.m, disp.m, get.m, isplaying.m,
pause.m, play.m, playblocking.m, resume.m, set.m, stop.m, subsasgn.m,
subsref.m, __get_properties__.m, audiorecorder.m, disp.m, get.m,
getaudiodata.m, getplayer.m, isrecording.m, pause.m, play.m, record.m,
recordblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, lin2mu.m,
mu2lin.m, record.m, sound.m, soundsc.m, bitmax.m, chop.m, comma.m, isstr.m,
mahalanobis.m, md5sum.m, octave_config_info.m, onenormest.m, paren.m,
semicolon.m, sleep.m, usleep.m, wavread.m, wavwrite.m, acosd.m, acot.m,
acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m, asech.m, asind.m,
atan2d.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m, csch.m, sec.m,
secd.m, sech.m, sind.m, tand.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m,
bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m, cell2mat.m, celldisp.m,
circshift.m, common_size.m, cplxpair.m, cumtrapz.m, curl.m, dblquad.m, deal.m,
deg2rad.m, del2.m, divergence.m, flip.m, flipdim.m, fliplr.m, flipud.m,
gradient.m, idivide.m, int2str.m, integral.m, integral2.m, integral3.m,
interp1.m, interp2.m, interp3.m, interpft.m, interpn.m, isequal.m, isequaln.m,
logspace.m, nextpow2.m, num2str.m, pol2cart.m, polyarea.m, postpad.m, prepad.m,
__splinen__.m, quad2d.m, quadgk.m, quadl.m, quadv.m, rad2deg.m, randi.m, rat.m,
repelem.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sortrows.m,
sph2cart.m, structfun.m, subsindex.m, trapz.m, triplequad.m, xor.m, convhull.m,
delaunay.m, delaunayn.m, dsearch.m, dsearchn.m, griddata.m, griddata3.m,
griddatan.m, inpolygon.m, rectint.m, tsearchn.m, voronoi.m, voronoin.m,
dialog.m, errordlg.m, getappdata.m, guidata.m, guihandles.m, helpdlg.m,
inputdlg.m, isappdata.m, listdlg.m, msgbox.m, __file_filter__.m,
__fltk_file_filter__.m, __get_funcname__.m, __is_function__.m,
__uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiobject_split_args__.m,
__uiputfile_fltk__.m, questdlg.m, rmappdata.m, setappdata.m, uibuttongroup.m,
uicontextmenu.m, uicontrol.m, uigetdir.m, uigetfile.m, uimenu.m, uipanel.m,
uipushtool.m, uiputfile.m, uiresume.m, uitoggletool.m, uitoolbar.m, uiwait.m,
waitbar.m, waitforbuttonpress.m, warndlg.m, __gripe_missing_component__.m,
__makeinfo__.m, __unimplemented__.m, ans.m, debug.m, doc.m, doc_cache_create.m,
error_ids.m, get_first_help_sentence.m, help.m, lookfor.m, print_usage.m,
__additional_help_message__.m, __strip_html_tags__.m, slash.m, type.m,
warning_ids.m, which.m, autumn.m, bone.m, brighten.m, cmpermute.m, cmunique.m,
colorcube.m, colormap.m, contrast.m, cool.m, copper.m, cubehelix.m, flag.m,
frame2im.m, getframe.m, gray.m, gray2ind.m, hot.m, hsv.m, hsv2rgb.m,
im2double.m, im2frame.m, image.m, imagesc.m, imfinfo.m, imformats.m, imread.m,
imshow.m, imwrite.m, ind2gray.m, ind2rgb.m, iscolormap.m, jet.m, lines.m,
ntsc2rgb.m, ocean.m, pink.m, prism.m, __imfinfo__.m, __imread__.m,
__imwrite__.m, colorspace_conversion_input_check.m,
colorspace_conversion_revert.m, imageIO.m, imwrite_filename.m, ind2x.m,
rainbow.m, rgb2hsv.m, rgb2ind.m, rgb2ntsc.m, rgbplot.m, spinmap.m, spring.m,
summer.m, viridis.m, white.m, winter.m, beep.m, csvread.m, csvwrite.m,
dlmwrite.m, fileread.m, importdata.m, is_valid_file_id.m, strread.m,
textread.m, javaArray.m, java_get.m, java_set.m, javaaddpath.m, javachk.m,
javaclasspath.m, javamem.m, javarmpath.m, ClassHelper.java, Matrix.java,
OctClassLoader.java, Octave.java, OctaveReference.java, usejava.m, bandwidth.m,
commutation_matrix.m, cond.m, condeig.m, condest.m, cross.m,
duplication_matrix.m, expm.m, gls.m, housh.m, isbanded.m, isdefinite.m,
isdiag.m, ishermitian.m, issymmetric.m, istril.m, istriu.m, krylov.m,
linsolve.m, logm.m, lscov.m, normest.m, normest1.m, null.m, ols.m, orth.m,
planerot.m, qzhess.m, rank.m, rref.m, subspace.m, trace.m, vech.m, vecnorm.m,
bug_report.m, bunzip2.m, cast.m, citation.m, compare_versions.m, computer.m,
copyfile.m, delete.m, desktop.m, dir.m, dos.m, edit.m, fact.m, fieldnames.m,
fileattrib.m, fileparts.m, fullfile.m, genvarname.m, getfield.m, grabcode.m,
gunzip.m, info.m, inputParser.m, inputname.m, isdeployed.m, isdir.m, ismac.m,
ispc.m, isunix.m, license.m, list_primes.m, loadobj.m, ls.m, ls_command.m,
menu.m, methods.m, mex.m, mexext.m, mkdir.m, mkoctfile.m, movefile.m,
namelengthmax.m, nargchk.m, narginchk.m, nargoutchk.m, news.m, nthargout.m,
open.m, orderfields.m, pack.m, parseparams.m, perl.m,
__publish_html_output__.m, __publish_latex_output__.m, __w2mpth__.m,
display_info_file.m, publish.m, python.m, recycle.m, run.m, saveobj.m,
setfield.m, substruct.m, swapbytes.m, symvar.m, tar.m, tempdir.m, tmpnam.m,
unix.m, unpack.m, untar.m, unzip.m, validateattributes.m, ver.m, version.m,
what.m, zip.m, mk-doc.pl, mk-pkg-add.sh, decic.m, ode15i.m, ode15s.m, ode23.m,
ode45.m, odeget.m, odeplot.m, odeset.m, AbsRel_norm.m, check_default_input.m,
integrate_adaptive.m, kahan.m, ode_event_handler.m, odedefaults.m,
odemergeopts.m, runge_kutta_23.m, runge_kutta_45_dorpri.m,
runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m,
fminsearch.m, fminunc.m, fsolve.m, fzero.m, glpk.m, humps.m, lsqnonneg.m,
optimget.m, optimset.m, pqpnonneg.m, __fdjac__.m, qp.m, sqp.m, import.m,
matlabroot.m, pathdef.m, getsavepath.m, savepath.m, pkg.m, build.m,
configure_make.m, default_prefix.m, describe.m, dirempty.m, get_description.m,
get_forge_download.m, get_forge_pkg.m, get_unsatisfied_deps.m, getarch.m,
getarchdir.m, install.m, installed_packages.m, list_forge_packages.m,
load_packages.m, load_packages_and_dependencies.m, rebuild.m, save_order.m,
uninstall.m, unload_packages.m, __clabel__.m, __getlegenddata__.m,
__rotate_around_axis__.m, annotation.m, axis.m, box.m, camlookat.m, camorbit.m,
campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, caxis.m,
clabel.m, daspect.m, datetick.m, diffuse.m, grid.m, gtext.m, hidden.m,
legend.m, lighting.m, material.m, orient.m, pbaspect.m, __axis_label__.m,
__axis_limits__.m, rticks.m, shading.m, specular.m, text.m, thetaticks.m,
title.m, view.m, whitebg.m, xlabel.m, xlim.m, xticklabels.m, xticks.m,
ylabel.m, ylim.m, yticklabels.m, yticks.m, zlabel.m, zlim.m, zticklabels.m,
zticks.m, area.m, bar.m, barh.m, camlight.m, colorbar.m, comet.m, comet3.m,
compass.m, contour.m, contour3.m, contourc.m, contourf.m, cylinder.m,
ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m,
ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m,
fplot.m, hist.m, isocaps.m, isocolors.m, isonormals.m, isosurface.m, light.m,
line.m, loglog.m, loglogerr.m, mesh.m, meshc.m, meshz.m, pareto.m, patch.m,
pcolor.m, peaks.m, pie.m, pie3.m, plot.m, plot3.m, plotmatrix.m, plotyy.m,
polar.m, __add_datasource__.m, __bar__.m, __calc_isovalue_from_data__.m,
__contour__.m, __errplot__.m, __ezplot__.m, __interp_cube__.m, __line__.m,
__marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __quiver__.m,
__scatter__.m, __stem__.m, __unite_shared_vertices__.m, quiver.m, quiver3.m,
rectangle.m, reducepatch.m, reducevolume.m, ribbon.m, rose.m, scatter.m,
scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m,
shrinkfaces.m, slice.m, smooth3.m, sombrero.m, sphere.m, stairs.m, stem.m,
stem3.m, stemleaf.m, surf.m, surface.m, surfc.m, surfl.m, surfnorm.m,
tetramesh.m, trimesh.m, triplot.m, trisurf.m, waterfall.m,
__actual_axis_position__.m, __default_plot_options__.m, __gnuplot_drawnow__.m,
__next_line_color__.m, __next_line_style__.m, __opengl_info__.m,
__plt_get_axis_arg__.m, __pltopt__.m, allchild.m, ancestor.m, axes.m, cla.m,
clf.m, close.m, closereq.m, colstyle.m, copyobj.m, figure.m, findall.m,
findfigs.m, findobj.m, gca.m, gcbf.m, gcbo.m, gcf.m, gco.m, ginput.m,
gnuplot_binary.in.m, graphics_toolkit.m, groot.m, hdl2struct.m, hggroup.m,
hgload.m, hgsave.m, hgtransform.m, hold.m, isaxes.m, isfigure.m, isgraphics.m,
ishandle.m, ishold.m, isprop.m, linkaxes.m, linkprop.m, meshgrid.m, ndgrid.m,
newplot.m, pan.m, print.m, printd.m, __add_default_menu__.m, __ghostscript__.m,
__gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m, __gnuplot_get_var__.m,
__gnuplot_ginput__.m, __gnuplot_has_feature__.m, __gnuplot_has_terminal__.m,
__gnuplot_open_stream__.m, __gnuplot_print__.m, __gnuplot_version__.m,
__opengl_print__.m, __print_parse_opts__.m, __set_default_mouse_modes__.m,
refresh.m, refreshdata.m, rotate.m, rotate3d.m, saveas.m, shg.m, struct2hdl.m,
subplot.m, zoom.m, compan.m, conv.m, deconv.m, mkpp.m, mpoles.m, padecoef.m,
pchip.m, poly.m, polyaffine.m, polyder.m, polyeig.m, polyfit.m, polygcd.m,
polyint.m, polyout.m, polyreduce.m, polyval.m, polyvalm.m, ppder.m, ppint.m,
ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, unmkpp.m,
addpref.m, getpref.m, ispref.m, prefdir.m, preferences.m, loadprefs.m,
prefsfile.m, saveprefs.m, rmpref.m, setpref.m, style.css, profexplore.m,
profexport.m, profile.m, profshow.m, intersect.m, ismember.m, powerset.m,
validsetargs.m, setdiff.m, setxor.m, union.m, unique.m, arch_fit.m, arch_rnd.m,
arch_test.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m,
diffpara.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, filter2.m,
fractdiff.m, freqz.m, freqz_plot.m, hamming.m, hanning.m, hurst.m, ifftshift.m,
periodogram.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, triangle_sw.m,
sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m,
stft.m, synthesis.m, unwrap.m, yulewalker.m, bicg.m, bicgstab.m, cgs.m,
colperm.m, eigs.m, etreeplot.m, gmres.m, gplot.m, ichol.m, ilu.m, nonzeros.m,
pcg.m, pcr.m, __sprand__.m, qmr.m, spaugment.m, spconvert.m, spdiags.m,
speye.m, spfun.m, spones.m, sprand.m, sprandn.m, sprandsym.m, spstats.m, spy.m,
svds.m, treelayout.m, treeplot.m, bessel.m, beta.m, betaln.m, ellipke.m,
expint.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m, nchoosek.m,
nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m, realsqrt.m,
gallery.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m,
rosser.m, toeplitz.m, vander.m, wilkinson.m, __finish__.m, center.m, cloglog.m,
corr.m, corrcoef.m, cov.m, crosstab.m, histc.m, iqr.m, kendall.m, kurtosis.m,
logit.m, mean.m, meansq.m, median.m, mode.m, moment.m, ppplot.m, prctile.m,
probit.m, qqplot.m, quantile.m, range.m, ranks.m, run_count.m, runlength.m,
skewness.m, spearman.m, statistics.m, std.m, var.m, zscore.m, betacdf.m,
betainv.m, betapdf.m, betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m,
cauchy_cdf.m, cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m,
chi2pdf.m, chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m,
discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m,
empirical_rnd.m, expcdf.m, expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m,
fpdf.m, frnd.m, gamcdf.m, gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m,
geopdf.m, geornd.m, hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m,
kolmogorov_smirnov_cdf.m, laplace_cdf.m, laplace_inv.m, laplace_pdf.m,
laplace_rnd.m, logistic_cdf.m, logistic_inv.m, logistic_pdf.m, logistic_rnd.m,
logncdf.m, logninv.m, lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m,
nbinrnd.m, normcdf.m, norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m,
poisspdf.m, poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m,
stdnormal_rnd.m, tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m,
unidpdf.m, unidrnd.m, unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m,
wblinv.m, wblpdf.m, wblrnd.m, wienrnd.m, logistic_regression.m,
logistic_regression_derivatives.m, logistic_regression_likelihood.m, anova.m,
bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m,
cor_test.m, f_test_regression.m, hotelling_test.m, hotelling_test_2.m,
kolmogorov_smirnov_test.m, kolmogorov_smirnov_test_2.m, kruskal_wallis_test.m,
manova.m, mcnemar_test.m, prop_test_2.m, run_test.m, sign_test.m, t_test.m,
t_test_2.m, t_test_regression.m, u_test.m, var_test.m, welch_test.m,
wilcoxon_test.m, z_test.m, z_test_2.m, base2dec.m, bin2dec.m, blanks.m,
cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, erase.m, findstr.m,
hex2dec.m, index.m, isletter.m, isstring.m, isstrprop.m, mat2str.m,
native2unicode.m, ostrsplit.m, regexptranslate.m, rindex.m, str2num.m,
strcat.m, strchr.m, strjoin.m, strjust.m, strmatch.m, strsplit.m, strtok.m,
strtrim.m, strtrunc.m, substr.m, unicode2native.m, untabify.m,
validatestring.m, __have_feature__.m, __printf_assert__.m,
__prog_output_assert__.m, __run_test_suite__.m, assert.m, demo.m, example.m,
fail.m, compare_plot_demos.m, dump_demos.m, html_compare_plot_demos.m,
rundemos.m, runtests.m, speed.m, test.m, addtodate.m, asctime.m, calendar.m,
clock.m, ctime.m, date.m, datenum.m, datestr.m, datevec.m, eomday.m, etime.m,
is_leap_year.m, now.m, weekday.m, display-available.c, display-available.h,
main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.h,
octave-build-info.in.cc, octave-config.in.cc, shared-fcns.h, args.tst,
bug-31371.tst, bug-35448.tst, bug-35881.tst, bug-36025.tst, bug-38236.tst,
bug-38565.tst, bug-38576.tst, bug-38691.tst, bug-41723.tst, bug-44940.tst,
bug-46330.tst, bug-46660.tst, bug-50014.tst, bug-50035.tst, bug-50716.tst,
bug-51192.tst, bug-51532.tst, bug-51534.tst, bug-51599.tst, bug-52075.tst,
class-concat.tst, classdef-multiple-inheritance.tst, classdef.tst, classes.tst,
colormaps.tst, command.tst, complex.tst, ctor-vs-method.tst,
deprecate-props.tst, diag-perm.tst, error.tst, eval-catch.tst,
fcn-handle-derived-resolution.tst, fntests.m, for.tst, func.tst, global.tst,
if.tst, index.tst, io.tst, jit.tst, leftdiv.tst, line-continue.tst,
logical-index.tst, mk-bc-overloads-tst.sh, mk-conv-tst.sh, mk-sparse-tst.sh,
nest.tst, null-assign.tst, parser.tst, prefer.tst, publish.tst, range.tst,
recursion.tst, return.tst, show-failures.awk, single-index.tst, slice.tst,
struct.tst, switch.tst, system.tst, transpose.tst, try.tst, unwind.tst,
while.tst:
Changed punctuation of GPL license text to match that suggested by FSF.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 06 Jan 2018 07:57:19 -0800 |
parents | 0052d47ddc3e |
children | 2365c2661b3c |
rev | line source |
---|---|
2075 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1996-2017 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10336
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
2075 | 5 |
6 This file is part of Octave. | |
7 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24082
diff
changeset
|
8 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22713
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24082
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22713
diff
changeset
|
11 (at your option) any later version. |
2075 | 12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22713
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22713
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22713
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22713
diff
changeset
|
16 GNU General Public License for more details. |
2075 | 17 |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24082
diff
changeset
|
20 <https://www.gnu.org/licenses/>. |
2075 | 21 |
22 */ | |
23 | |
24 // Thomas Baier <baier@ci.tuwien.ac.at> added the original versions of | |
25 // the following functions: | |
26 // | |
27 // mkfifo unlink waitpid | |
28 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21672
diff
changeset
|
29 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
30 # include "config.h" |
2075 | 31 #endif |
32 | |
21949
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21937
diff
changeset
|
33 #include <ctime> |
2075 | 34 #include <cstdio> |
2669 | 35 #include <cstring> |
2075 | 36 |
17236
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
37 #include "cmd-hist.h" |
21911 | 38 #include "fcntl-wrappers.h" |
2926 | 39 #include "file-ops.h" |
40 #include "file-stat.h" | |
22087
7f79c716876c
eliminate unused parameter from octave::sys::popen2
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
41 #include "lo-utils.h" |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
42 #include "oct-env.h" |
2937 | 43 #include "oct-syscalls.h" |
5547 | 44 #include "oct-uname.h" |
24082
0052d47ddc3e
Backed out changeset ba164db1c4a4
Torsten <mttl@mailbox.org>
parents:
24048
diff
changeset
|
45 |
2075 | 46 #include "defun.h" |
47 #include "error.h" | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
48 #include "errwarn.h" |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
49 #include "interpreter.h" |
17236
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
50 #include "oct-hist.h" |
2075 | 51 #include "oct-map.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20939
diff
changeset
|
52 #include "ovl.h" |
2075 | 53 #include "oct-stdstrm.h" |
54 #include "oct-stream.h" | |
55 #include "sysdep.h" | |
56 #include "utils.h" | |
2366 | 57 #include "variables.h" |
6321 | 58 #include "input.h" |
2075 | 59 |
10762
d53eb6249892
use scalar map in some syscalls
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
60 static octave_scalar_map |
21737
ab6c639f0678
finish previous changeset (0504351a45e6).
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
61 mk_stat_map (const octave::sys::base_file_stat& fs) |
2075 | 62 { |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
63 static bool have_rdev = |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
64 octave::sys::base_file_stat::have_struct_stat_st_rdev (); |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
65 static bool have_blksize = |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
66 octave::sys::base_file_stat::have_struct_stat_st_blksize (); |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
67 static bool have_blocks = |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
68 octave::sys::base_file_stat::have_struct_stat_st_blocks (); |
21935 | 69 |
70 static double nan = octave::numeric_limits<double>::NaN (); | |
71 | |
10762
d53eb6249892
use scalar map in some syscalls
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
72 octave_scalar_map m; |
2075 | 73 |
4675 | 74 m.assign ("dev", static_cast<double> (fs.dev ())); |
75 m.assign ("ino", fs.ino ()); | |
5476 | 76 m.assign ("mode", fs.mode ()); |
4675 | 77 m.assign ("modestr", fs.mode_as_string ()); |
78 m.assign ("nlink", fs.nlink ()); | |
79 m.assign ("uid", fs.uid ()); | |
80 m.assign ("gid", fs.gid ()); | |
21935 | 81 m.assign ("rdev", have_rdev ? static_cast<double> (fs.rdev ()) : nan); |
4675 | 82 m.assign ("size", fs.size ()); |
83 m.assign ("atime", fs.atime ()); | |
84 m.assign ("mtime", fs.mtime ()); | |
85 m.assign ("ctime", fs.ctime ()); | |
21935 | 86 |
87 if (have_blksize) | |
88 m.assign ("blksize", fs.blksize ()); | |
89 else | |
90 m.assign ("blksize", nan); | |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21935
diff
changeset
|
91 |
21935 | 92 if (have_blocks) |
93 m.assign ("blocks", fs.blocks ()); | |
94 else | |
95 m.assign ("blocks", nan); | |
2075 | 96 |
97 return m; | |
98 } | |
99 | |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
100 static octave_value_list |
21737
ab6c639f0678
finish previous changeset (0504351a45e6).
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
101 mk_stat_result (const octave::sys::base_file_stat& fs) |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
102 { |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
103 if (fs) |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
104 return ovl (octave_value (mk_stat_map (fs)), 0, ""); |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
105 else |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
106 return ovl (Matrix (), -1, fs.error ()); |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
107 } |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
108 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
109 DEFMETHODX ("dup2", Fdup2, interp, args, , |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
110 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
111 @deftypefn {} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
112 Duplicate a file descriptor. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
113 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
114 If successful, @var{fid} is greater than zero and contains the new file ID@. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
115 Otherwise, @var{fid} is negative and @var{msg} contains a system-dependent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
116 error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
117 @seealso{fopen, fclose, fcntl} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
118 @end deftypefn */) |
2075 | 119 { |
20819
f428cbe7576f
eliminate unnecessary uses of nargin
John W. Eaton <jwe@octave.org>
parents:
20800
diff
changeset
|
120 if (args.length () != 2) |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
121 print_usage (); |
2075 | 122 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
123 octave::stream_list& streams = interp.get_stream_list (); |
2075 | 124 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
125 octave::stream old_stream = streams.lookup (args(0), "dup2"); |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
126 |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
127 octave::stream new_stream = streams.lookup (args(1), "dup2"); |
2075 | 128 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
129 int i_old = old_stream.file_number (); |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
130 int i_new = new_stream.file_number (); |
2669 | 131 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
132 if (i_old >= 0 && i_new >= 0) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
133 { |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
134 std::string msg; |
3341 | 135 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
136 int status = octave::sys::dup2 (i_old, i_new, msg); |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
137 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
138 return ovl (status, msg); |
2075 | 139 } |
140 else | |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
141 return ovl (-1, ""); |
2075 | 142 } |
143 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
144 DEFUNX ("exec", Fexec, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
145 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
146 @deftypefn {} {[@var{err}, @var{msg}] =} exec (@var{file}, @var{args}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
147 Replace current process with a new process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
148 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
149 Calling @code{exec} without first calling @code{fork} will terminate your |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
150 current Octave process and replace it with the program named by @var{file}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
151 For example, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
152 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
153 @example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
154 exec ("ls", "-l") |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
155 @end example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
156 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
157 @noindent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
158 will run @code{ls} and return you to your shell prompt. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
159 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
160 If successful, @code{exec} does not return. If @code{exec} does return, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
161 @var{err} will be nonzero, and @var{msg} will contain a system-dependent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
162 error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
163 @end deftypefn */) |
2075 | 164 { |
165 int nargin = args.length (); | |
166 | |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
167 if (nargin < 1 || nargin > 2) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
168 print_usage (); |
2075 | 169 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
170 std::string exec_file = args(0).xstring_value ("exec: FILE must be a string"); |
2075 | 171 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
172 string_vector exec_args; |
2075 | 173 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
174 if (nargin == 2) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
175 { |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
176 string_vector tmp = args(1).xstring_vector_value ("exec: all arguments must be strings"); |
2075 | 177 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
178 int len = tmp.numel (); |
2075 | 179 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
180 exec_args.resize (len + 1); |
2937 | 181 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
182 exec_args[0] = exec_file; |
2669 | 183 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
184 for (int i = 0; i < len; i++) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
185 exec_args[i+1] = tmp[i]; |
2075 | 186 } |
187 else | |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
188 { |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
189 exec_args.resize (1); |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
190 |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
191 exec_args[0] = exec_file; |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
192 } |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
193 |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
194 octave_history_write_timestamp (); |
2075 | 195 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21737
diff
changeset
|
196 if (! octave::command_history::ignoring_entries ()) |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21737
diff
changeset
|
197 octave::command_history::clean_up_and_save (); |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
198 |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
199 std::string msg; |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
200 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
201 int status = octave::sys::execvp (exec_file, exec_args, msg); |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
202 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
203 return ovl (status, msg); |
2075 | 204 } |
205 | |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
206 DEFMETHODX ("popen2", Fpopen2, interp, args, , |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
207 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
208 @deftypefn {} {[@var{in}, @var{out}, @var{pid}] =} popen2 (@var{command}, @var{args}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
209 Start a subprocess with two-way communication. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
210 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
211 The name of the process is given by @var{command}, and @var{args} is an |
22713
9e415e57a6a7
doc: Clarify docstring for popen2 (bug #49524).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
212 array or cell array of strings containing options for the command. |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
213 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
214 The file identifiers for the input and output streams of the subprocess are |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
215 returned in @var{in} and @var{out}. If execution of the command is |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
216 successful, @var{pid} contains the process ID of the subprocess. Otherwise, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
217 @var{pid} is @minus{}1. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
218 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
219 For example: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
220 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
221 @example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
222 [in, out, pid] = popen2 ("sort", "-r"); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
223 fputs (in, "these\nare\nsome\nstrings\n"); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
224 fclose (in); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
225 EAGAIN = errno ("EAGAIN"); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
226 done = false; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
227 do |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
228 s = fgets (out); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
229 if (ischar (s)) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
230 fputs (stdout, s); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
231 elseif (errno () == EAGAIN) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
232 pause (0.1); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
233 fclear (out); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
234 else |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
235 done = true; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
236 endif |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
237 until (done) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
238 fclose (out); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
239 waitpid (pid); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
240 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
241 @print{} these |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
242 @print{} strings |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
243 @print{} some |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
244 @print{} are |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
245 @end example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
246 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
247 Note that @code{popen2}, unlike @code{popen}, will not @nospell{"reap"} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
248 the child process. If you don't use @code{waitpid} to check the child's |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
249 exit status, it will linger until Octave exits. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
250 @seealso{popen, waitpid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
251 @end deftypefn */) |
6321 | 252 { |
253 int nargin = args.length (); | |
254 | |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
255 if (nargin < 1 || nargin > 3) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
256 print_usage (); |
6321 | 257 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
258 std::string exec_file = args(0).xstring_value ("popen2: COMMAND argument must be a string"); |
6321 | 259 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
260 string_vector arg_list; |
6321 | 261 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
262 if (nargin >= 2) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
263 { |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
264 string_vector tmp = args(1).xstring_vector_value ("popen2: all arguments must be strings"); |
6321 | 265 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
266 int len = tmp.numel (); |
6321 | 267 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
268 arg_list.resize (len + 1); |
6321 | 269 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
270 arg_list[0] = exec_file; |
20704
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
271 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
272 for (int i = 0; i < len; i++) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
273 arg_list[i+1] = tmp[i]; |
6321 | 274 } |
275 else | |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
276 { |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
277 arg_list.resize (1); |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
278 |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
279 arg_list[0] = exec_file; |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
280 } |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
281 |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
282 bool sync_mode = (nargin == 3 ? args(2).bool_value () : false); |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
283 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
284 int filedesc[2]; |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
285 std::string msg; |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
286 pid_t pid; |
6321 | 287 |
22087
7f79c716876c
eliminate unused parameter from octave::sys::popen2
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
288 pid = octave::sys::popen2 (exec_file, arg_list, sync_mode, filedesc, msg); |
7f79c716876c
eliminate unused parameter from octave::sys::popen2
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
289 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
290 if (pid < 0) |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
291 error (msg.c_str ()); |
6321 | 292 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
293 FILE *ifile = fdopen (filedesc[1], "r"); |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
294 FILE *ofile = fdopen (filedesc[0], "w"); |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
295 |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
296 octave::stream is |
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
297 = octave_stdiostream::create (exec_file + "-in", ifile, std::ios::in); |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
298 |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
299 octave::stream os |
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
300 = octave_stdiostream::create (exec_file + "-out", ofile, std::ios::out); |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
301 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
302 octave::stream_list& streams = interp.get_stream_list (); |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
303 |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
304 return ovl (streams.insert (os), streams.insert (is), pid); |
6321 | 305 } |
306 | |
307 /* | |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
308 |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
309 %!test # UNIX-style test |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
310 %! if (isunix () || ismac ()) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
311 %! [in, out, pid] = popen2 ("sort", "-r"); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
312 %! EAGAIN = errno ("EAGAIN"); |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
313 %! fputs (in, "these\nare\nsome\nstrings\n"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
314 %! fclose (in); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
315 %! done = false; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
316 %! str = {}; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
317 %! idx = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
318 %! errs = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
319 %! do |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
320 %! if (ismac ()) # FIXME: Is this necessary? |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
321 %! errno (0); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
322 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
323 %! s = fgets (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
324 %! if (ischar (s)) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
325 %! idx++; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
326 %! str{idx} = s; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
327 %! elseif (errno () == EAGAIN) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
328 %! fclear (out); |
20923
58263bea2fdf
Unified "sleep" functions to "octave_sleep" in C++ and "pause" in Octave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20898
diff
changeset
|
329 %! pause (0.1); |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
330 %! if (++errs == 100) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
331 %! done = true; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
332 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
333 %! else |
6321 | 334 %! done = true; |
335 %! endif | |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
336 %! until (done) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
337 %! fclose (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
338 %! waitpid (pid); |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
339 %! assert (str, {"these\n","strings\n","some\n","are\n"}); |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
340 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
341 |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
342 %!test # Windows-style test |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
343 %! if (ispc () && ! isunix ()) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
344 %! [in, out, pid] = popen2 ('C:\Windows\system32\sort.exe', "/R"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
345 %! EAGAIN = errno ("EINVAL"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
346 %! fputs (in, "these\r\nare\r\nsome\r\nstrings\r\n"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
347 %! fclose (in); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
348 %! done = false; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
349 %! str = {}; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
350 %! idx = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
351 %! errs = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
352 %! do |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
353 %! errno (0); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
354 %! s = fgets (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
355 %! if (ischar (s)) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
356 %! idx++; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
357 %! str{idx} = s; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
358 %! elseif (errno () == EAGAIN) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
359 %! fclear (out); |
20923
58263bea2fdf
Unified "sleep" functions to "octave_sleep" in C++ and "pause" in Octave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20898
diff
changeset
|
360 %! pause (0.1); |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
361 %! if (++errs == 100) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
362 %! done = true; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
363 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
364 %! else |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
365 %! done = true; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
366 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
367 %! until (done) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
368 %! fclose (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
369 %! waitpid (pid); |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
370 %! assert (str, {"these\r\n","strings\r\n","some\r\n","are\r\n"}); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
371 %! endif |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
372 |
6321 | 373 */ |
374 | |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
375 DEFMETHODX ("fcntl", Ffcntl, interp, args, , |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
376 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
377 @deftypefn {} {[@var{err}, @var{msg}] =} fcntl (@var{fid}, @var{request}, @var{arg}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
378 Change the properties of the open file @var{fid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
379 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
380 The following values may be passed as @var{request}: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
381 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
382 @vtable @code |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
383 @item F_DUPFD |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
384 Return a duplicate file descriptor. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
385 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
386 @item F_GETFD |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
387 Return the file descriptor flags for @var{fid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
388 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
389 @item F_SETFD |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
390 Set the file descriptor flags for @var{fid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
391 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
392 @item F_GETFL |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
393 Return the file status flags for @var{fid}. The following codes may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
394 returned (some of the flags may be undefined on some systems). |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
395 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
396 @vtable @code |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
397 @item O_RDONLY |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
398 Open for reading only. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
399 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
400 @item O_WRONLY |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
401 Open for writing only. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
402 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
403 @item O_RDWR |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
404 Open for reading and writing. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
405 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
406 @item O_APPEND |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
407 Append on each write. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
408 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
409 @item O_CREAT |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
410 Create the file if it does not exist. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
411 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
412 @item O_NONBLOCK |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
413 Non-blocking mode. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
414 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
415 @item O_SYNC |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
416 Wait for writes to complete. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
417 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
418 @item O_ASYNC |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
419 Asynchronous I/O. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
420 @end vtable |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
421 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
422 @item F_SETFL |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
423 Set the file status flags for @var{fid} to the value specified by @var{arg}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
424 The only flags that can be changed are @w{@code{O_APPEND}} and |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
425 @w{@code{O_NONBLOCK}}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
426 @end vtable |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
427 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
428 If successful, @var{err} is 0 and @var{msg} is an empty string. Otherwise, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
429 @var{err} is nonzero and @var{msg} contains a system-dependent error |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
430 message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
431 @seealso{fopen, dup2} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
432 @end deftypefn */) |
2075 | 433 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
434 if (args.length () != 3) |
5823 | 435 print_usage (); |
2075 | 436 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
437 octave::stream_list& streams = interp.get_stream_list (); |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
438 |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
439 octave::stream strm = streams.lookup (args(0), "fcntl"); |
2075 | 440 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
441 int fid = strm.file_number (); |
3715 | 442 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
443 // FIXME: Do we want to use xint_value and throw a warning message |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
444 // if input validation fails? |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
445 int req = args(1).int_value (true); |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
446 int arg = args(2).int_value (true); |
3715 | 447 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
448 // FIXME: Need better checking here? |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
449 if (fid < 0) |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
450 error ("fcntl: invalid file id"); |
2937 | 451 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
452 std::string msg; |
2669 | 453 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
454 int status = octave::sys::fcntl (fid, req, arg, msg); |
2075 | 455 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
456 return ovl (status, msg); |
2075 | 457 } |
458 | |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
459 DEFMETHODX ("fork", Ffork, interp, args, , |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
460 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
461 @deftypefn {} {[@var{pid}, @var{msg}] =} fork () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
462 Create a copy of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
463 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
464 Fork can return one of the following values: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
465 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
466 @table @asis |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
467 @item > 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
468 You are in the parent process. The value returned from @code{fork} is the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
469 process id of the child process. You should probably arrange to wait for |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
470 any child processes to exit. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
471 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
472 @item 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
473 You are in the child process. You can call @code{exec} to start another |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
474 process. If that fails, you should probably call @code{exit}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
475 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
476 @item < 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
477 The call to @code{fork} failed for some reason. You must take evasive |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
478 action. A system dependent error message will be waiting in @var{msg}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
479 @end table |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
480 @end deftypefn */) |
2075 | 481 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
482 if (args.length () != 0) |
5823 | 483 print_usage (); |
2075 | 484 |
23693
b9378eff6d13
move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23599
diff
changeset
|
485 octave::symbol_table& symtab = interp.get_symbol_table (); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
486 |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
487 if (symtab.at_top_level ()) |
21604
d7a268e68e69
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21547
diff
changeset
|
488 error ("fork: cannot be called from command line"); |
21343
980abb267014
Emit error if fork called directly from command line.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
489 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
490 std::string msg; |
2669 | 491 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
492 pid_t pid = octave::sys::fork (msg); |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
493 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
494 return ovl (pid, msg); |
2075 | 495 } |
496 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
497 DEFUNX ("getpgrp", Fgetpgrp, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
498 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
499 @deftypefn {} {pgid =} getpgrp () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
500 Return the process group id of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
501 @end deftypefn */) |
2075 | 502 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
503 if (args.length () != 0) |
5823 | 504 print_usage (); |
2075 | 505 |
20800
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
506 std::string msg; |
fb128aafc322
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
507 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
508 pid_t pid = octave::sys::getpgrp (msg); |
2075 | 509 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
510 return ovl (pid, msg); |
2075 | 511 } |
512 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
513 DEFUNX ("getpid", Fgetpid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
514 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
515 @deftypefn {} {pid =} getpid () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
516 Return the process id of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
517 @seealso{getppid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
518 @end deftypefn */) |
2075 | 519 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
520 if (args.length () != 0) |
5823 | 521 print_usage (); |
2075 | 522 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
523 return ovl (octave::sys::getpid ()); |
2075 | 524 } |
525 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
526 DEFUNX ("getppid", Fgetppid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
527 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
528 @deftypefn {} {pid =} getppid () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
529 Return the process id of the parent process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
530 @seealso{getpid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
531 @end deftypefn */) |
2075 | 532 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
533 if (args.length () != 0) |
5823 | 534 print_usage (); |
2475 | 535 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
536 return ovl (octave::sys::getppid ()); |
2475 | 537 } |
538 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
539 DEFUNX ("getegid", Fgetegid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
540 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
541 @deftypefn {} {egid =} getegid () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
542 Return the effective group id of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
543 @seealso{getgid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
544 @end deftypefn */) |
2475 | 545 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
546 if (args.length () != 0) |
5823 | 547 print_usage (); |
2475 | 548 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
549 return ovl (octave::sys::getegid ()); |
2475 | 550 } |
551 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
552 DEFUNX ("getgid", Fgetgid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
553 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
554 @deftypefn {} {gid =} getgid () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
555 Return the real group id of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
556 @seealso{getegid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
557 @end deftypefn */) |
2475 | 558 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
559 if (args.length () != 0) |
5823 | 560 print_usage (); |
2075 | 561 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
562 return ovl (octave::sys::getgid ()); |
2075 | 563 } |
564 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
565 DEFUNX ("geteuid", Fgeteuid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
566 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
567 @deftypefn {} {euid =} geteuid () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
568 Return the effective user id of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
569 @seealso{getuid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
570 @end deftypefn */) |
2472 | 571 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
572 if (args.length () != 0) |
5823 | 573 print_usage (); |
2473 | 574 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
575 return ovl (octave::sys::geteuid ()); |
2472 | 576 } |
577 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
578 DEFUNX ("getuid", Fgetuid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
579 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
580 @deftypefn {} {uid =} getuid () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
581 Return the real user id of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
582 @seealso{geteuid} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
583 @end deftypefn */) |
2472 | 584 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
585 if (args.length () != 0) |
5823 | 586 print_usage (); |
2473 | 587 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
588 return ovl (octave::sys::getuid ()); |
2472 | 589 } |
590 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
591 DEFUNX ("kill", Fkill, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
592 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
593 @deftypefn {} {[@var{err}, @var{msg}] =} kill (@var{pid}, @var{sig}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
594 Send signal @var{sig} to process @var{pid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
595 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
596 If @var{pid} is positive, then signal @var{sig} is sent to @var{pid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
597 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
598 If @var{pid} is 0, then signal @var{sig} is sent to every process |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
599 in the process group of the current process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
600 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
601 If @var{pid} is -1, then signal @var{sig} is sent to every process |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
602 except process 1. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
603 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
604 If @var{pid} is less than -1, then signal @var{sig} is sent to every |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
605 process in the process group @var{-pid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
606 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
607 If @var{sig} is 0, then no signal is sent, but error checking is still |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
608 performed. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
609 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
610 Return 0 if successful, otherwise return -1. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
611 @end deftypefn */) |
4294 | 612 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
613 if (args.length () != 2) |
5823 | 614 print_usage (); |
4294 | 615 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
616 pid_t pid = args(0).int_value (true); |
20560
56fee8f84fe7
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
617 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
618 int sig = args(1).int_value (true); |
4294 | 619 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
620 std::string msg; |
4294 | 621 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
622 int status = octave::sys::kill (pid, sig, msg); |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
623 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
624 return ovl (status, msg); |
4294 | 625 } |
626 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
627 DEFUNX ("lstat", Flstat, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
628 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
629 @deftypefn {} {@var{info} =} lstat (@var{symlink}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
630 @deftypefnx {} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{symlink}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
631 Return a structure @var{info} containing information about the symbolic link |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
632 @var{symlink}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
633 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
634 The function outputs are described in the documentation for @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
635 @seealso{stat, symlink} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
636 @end deftypefn */) |
2075 | 637 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
638 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
639 print_usage (); |
2075 | 640 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
641 std::string fname = args(0).xstring_value ("lstat: NAME must be a string"); |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
642 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
643 octave::sys::file_stat fs (fname, false); |
2075 | 644 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
645 return mk_stat_result (fs); |
2075 | 646 } |
647 | |
20200
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
648 // FIXME: This routine also exists verbatim in file-io.cc. |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
649 // Maybe change to be a general utility routine. |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
650 static int |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
651 convert (int x, int ibase, int obase) |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
652 { |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
653 int retval = 0; |
2075 | 654 |
20200
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
655 int tmp = x % obase; |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
656 |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
657 if (tmp > ibase - 1) |
20428
7ac907da9fba
Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
658 error ("mkfifo: invalid digit"); |
2075 | 659 |
21055
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
660 retval = tmp; |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
661 int mult = ibase; |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
662 while ((x = (x - tmp) / obase)) |
20200
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
663 { |
21055
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
664 tmp = x % obase; |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
665 |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
666 if (tmp > ibase - 1) |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
667 error ("mkfifo: invalid digit"); |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
668 |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
669 retval += mult * tmp; |
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
670 mult *= ibase; |
2075 | 671 } |
672 | |
673 return retval; | |
674 } | |
675 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
676 DEFUNX ("mkfifo", Fmkfifo, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
677 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
678 @deftypefn {} {@var{err} =} mkfifo (@var{name}, @var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
679 @deftypefnx {} {[@var{err}, @var{msg}] =} mkfifo (@var{name}, @var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
680 Create a FIFO special file named @var{name} with file mode @var{mode}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
681 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
682 @var{mode} is interpreted as an octal number and is subject to umask |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
683 processing. The final calculated mode is @code{@var{mode} - @var{umask}}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
684 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
685 If successful, @var{err} is 0 and @var{msg} is an empty string. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
686 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
687 error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
688 @seealso{pipe, umask} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
689 @end deftypefn */) |
2075 | 690 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
691 if (args.length () != 2) |
5823 | 692 print_usage (); |
2075 | 693 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
694 std::string name = args(0).xstring_value ("mkfifo: FILE must be a string"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
695 |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
696 int octal_mode = args(1).xint_value ("mkfifo: MODE must be an integer"); |
4254 | 697 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
698 if (octal_mode < 0) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
699 error ("mkfifo: MODE must be a positive integer value"); |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
700 |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
701 int mode = convert (octal_mode, 8, 10); |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
702 |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
703 std::string msg; |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
704 |
21733
cb0fdd941d84
use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents:
21732
diff
changeset
|
705 int status = octave::sys::mkfifo (name, mode, msg); |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
706 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
707 return ovl (status, msg); |
2075 | 708 } |
709 | |
20200
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
710 /* |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
711 |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
712 ## Test input validation |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
713 %!error mkfifo () |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
714 %!error mkfifo ("abc") |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
715 %!error mkfifo ("abc", 777, 123) |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
716 %!error <FILE must be a string> mkfifo (123, 456) |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
717 ## FIXME: These tests should work, but lasterr is not being set correctly. |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
718 #%!error <MODE must be an integer> mkfifo ("abc", {456}) |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
719 #%!error <MODE must be a positive integer value> mkfifo ("abc", -1) |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
720 |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
721 */ |
d9f35ceff9e1
Change mkfifo to use an octal argument for MODE (bug #45054).
Rik <rik@octave.org>
parents:
20198
diff
changeset
|
722 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
723 DEFMETHODX ("pipe", Fpipe, interp, args, , |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
724 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
725 @deftypefn {} {[@var{read_fd}, @var{write_fd}, @var{err}, @var{msg}] =} pipe () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
726 Create a pipe and return the reading and writing ends of the pipe into |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
727 @var{read_fd} and @var{write_fd} respectively. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
728 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
729 If successful, @var{err} is 0 and @var{msg} is an empty string. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
730 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
731 error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
732 @seealso{mkfifo} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
733 @end deftypefn */) |
2075 | 734 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
735 if (args.length () != 0) |
5823 | 736 print_usage (); |
2075 | 737 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
738 int fid[2]; |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
739 std::string msg; |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
740 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
741 int status = octave::sys::pipe (fid, msg); |
2669 | 742 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
743 if (status < 0) |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
744 return ovl (-1, -1, -1, msg); |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
745 else |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
746 { |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
747 FILE *ifile = fdopen (fid[0], "r"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
748 FILE *ofile = fdopen (fid[1], "w"); |
4327 | 749 |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
750 octave::stream is |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
751 = octave_stdiostream::create ("pipe-in", ifile, std::ios::in); |
2075 | 752 |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
753 octave::stream os |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
754 = octave_stdiostream::create ("pipe-out", ofile, std::ios::out); |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
755 |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
756 octave::stream_list& streams = interp.get_stream_list (); |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
757 |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
758 return ovl (streams.insert (is), streams.insert (os), status, msg); |
2075 | 759 } |
760 } | |
761 | |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
762 DEFMETHODX ("stat", Fstat, interp, args, , |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
763 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
764 @deftypefn {} {[@var{info}, @var{err}, @var{msg}] =} stat (@var{file}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
765 @deftypefnx {} {[@var{info}, @var{err}, @var{msg}] =} stat (@var{fid}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
766 @deftypefnx {} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{file}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
767 @deftypefnx {} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{fid}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
768 Return a structure @var{info} containing the following information about |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
769 @var{file} or file identifier @var{fid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
770 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
771 @table @code |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
772 @item dev |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
773 ID of device containing a directory entry for this file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
774 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
775 @item ino |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
776 File number of the file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
777 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
778 @item mode |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
779 File mode, as an integer. Use the functions @w{@code{S_ISREG}}, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
780 @w{@code{S_ISDIR}}, @w{@code{S_ISCHR}}, @w{@code{S_ISBLK}}, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
781 @w{@code{S_ISFIFO}}, @w{@code{S_ISLNK}}, or @w{@code{S_ISSOCK}} to extract |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
782 information from this value. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
783 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
784 @item modestr |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
785 File mode, as a string of ten letters or dashes as would be returned by |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
786 @kbd{ls -l}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
787 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
788 @item nlink |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
789 Number of links. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
790 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
791 @item uid |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
792 User ID of file's owner. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
793 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
794 @item gid |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
795 Group ID of file's group. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
796 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
797 @item rdev |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
798 ID of device for block or character special files. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
799 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
800 @item size |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
801 Size in bytes. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
802 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
803 @item atime |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
804 Time of last access in the same form as time values returned from |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
805 @code{time}. @xref{Timing Utilities}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
806 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
807 @item mtime |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
808 Time of last modification in the same form as time values returned from |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
809 @code{time}. @xref{Timing Utilities}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
810 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
811 @item ctime |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
812 Time of last file status change in the same form as time values |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
813 returned from @code{time}. @xref{Timing Utilities}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
814 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
815 @item blksize |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
816 Size of blocks in the file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
817 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
818 @item blocks |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
819 Number of blocks allocated for file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
820 @end table |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
821 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
822 If the call is successful @var{err} is 0 and @var{msg} is an empty string. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
823 If the file does not exist, or some other error occurs, @var{info} is an |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
824 empty matrix, @var{err} is @minus{}1, and @var{msg} contains the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
825 corresponding system error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
826 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
827 If @var{file} is a symbolic link, @code{stat} will return information about |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
828 the actual file that is referenced by the link. Use @code{lstat} if you |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
829 want information about the symbolic link itself. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
830 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
831 For example: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
832 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
833 @example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
834 [info, err, msg] = stat ("/vmlinuz") |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
835 @result{} info = |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
836 @{ |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
837 atime = 855399756 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
838 rdev = 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
839 ctime = 847219094 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
840 uid = 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
841 size = 389218 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
842 blksize = 4096 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
843 mtime = 847219094 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
844 gid = 6 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
845 nlink = 1 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
846 blocks = 768 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
847 mode = -rw-r--r-- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
848 modestr = -rw-r--r-- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
849 ino = 9316 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
850 dev = 2049 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
851 @} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
852 @result{} err = 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
853 @result{} msg = |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
854 @end example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
855 @seealso{lstat, ls, dir} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
856 @end deftypefn */) |
2075 | 857 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
858 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
859 print_usage (); |
2075 | 860 |
2262 | 861 octave_value_list retval; |
2075 | 862 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
863 if (args(0).is_scalar_type ()) |
2075 | 864 { |
23738
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
865 octave::stream_list& streams = interp.get_stream_list (); |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
866 |
8acd390d16c9
don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
867 int fid = streams.get_file_number (args(0)); |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
868 |
21737
ab6c639f0678
finish previous changeset (0504351a45e6).
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
869 octave::sys::file_fstat fs (fid); |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
870 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
871 retval = mk_stat_result (fs); |
2075 | 872 } |
873 else | |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
874 { |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
875 std::string fname = args(0).xstring_value ("stat: NAME must be a string"); |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
876 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
877 octave::sys::file_stat fs (fname); |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
878 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
879 retval = mk_stat_result (fs); |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
880 } |
2075 | 881 |
882 return retval; | |
883 } | |
884 | |
5476 | 885 DEFUNX ("S_ISREG", FS_ISREG, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
886 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
887 @deftypefn {} {} S_ISREG (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
888 Return true if @var{mode} corresponds to a regular file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
889 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
890 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
891 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
892 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
893 @end deftypefn */) |
5476 | 894 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
895 if (args.length () != 1) |
5823 | 896 print_usage (); |
5476 | 897 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
898 double mode = args(0).xdouble_value ("S_ISREG: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
899 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
900 return ovl (octave::sys::file_stat::is_reg (static_cast<mode_t> (mode))); |
5476 | 901 } |
902 | |
903 DEFUNX ("S_ISDIR", FS_ISDIR, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
904 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
905 @deftypefn {} {} S_ISDIR (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
906 Return true if @var{mode} corresponds to a directory. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
907 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
908 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
909 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
910 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
911 @end deftypefn */) |
5476 | 912 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
913 if (args.length () != 1) |
5823 | 914 print_usage (); |
5476 | 915 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
916 double mode = args(0).xdouble_value ("S_ISDIR: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
917 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
918 return ovl (octave::sys::file_stat::is_dir (static_cast<mode_t> (mode))); |
5476 | 919 } |
920 | |
921 DEFUNX ("S_ISCHR", FS_ISCHR, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
922 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
923 @deftypefn {} {} S_ISCHR (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
924 Return true if @var{mode} corresponds to a character device. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
925 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
926 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
927 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
928 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
929 @end deftypefn */) |
5476 | 930 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
931 if (args.length () != 1) |
5823 | 932 print_usage (); |
5476 | 933 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
934 double mode = args(0).xdouble_value ("S_ISCHR: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
935 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
936 return ovl (octave::sys::file_stat::is_chr (static_cast<mode_t> (mode))); |
5476 | 937 } |
938 | |
939 DEFUNX ("S_ISBLK", FS_ISBLK, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
940 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
941 @deftypefn {} {} S_ISBLK (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
942 Return true if @var{mode} corresponds to a block device. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
943 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
944 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
945 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
946 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
947 @end deftypefn */) |
5476 | 948 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
949 if (args.length () != 1) |
5823 | 950 print_usage (); |
5476 | 951 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
952 double mode = args(0).xdouble_value ("S_ISBLK: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
953 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
954 return ovl (octave::sys::file_stat::is_blk (static_cast<mode_t> (mode))); |
5476 | 955 } |
956 | |
957 DEFUNX ("S_ISFIFO", FS_ISFIFO, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
958 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
959 @deftypefn {} {} S_ISFIFO (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
960 Return true if @var{mode} corresponds to a fifo. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
961 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
962 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
963 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
964 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
965 @end deftypefn */) |
5476 | 966 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
967 if (args.length () != 1) |
5823 | 968 print_usage (); |
5476 | 969 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
970 double mode = args(0).xdouble_value ("S_ISFIFO: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
971 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
972 return ovl (octave::sys::file_stat::is_fifo (static_cast<mode_t> (mode))); |
5476 | 973 } |
974 | |
975 DEFUNX ("S_ISLNK", FS_ISLNK, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
976 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
977 @deftypefn {} {} S_ISLNK (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
978 Return true if @var{mode} corresponds to a symbolic link. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
979 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
980 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
981 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
982 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
983 @end deftypefn */) |
5476 | 984 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
985 if (args.length () != 1) |
5823 | 986 print_usage (); |
5476 | 987 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
988 double mode = args(0).xdouble_value ("S_ISLNK: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
989 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
990 return ovl (octave::sys::file_stat::is_lnk (static_cast<mode_t> (mode))); |
5476 | 991 } |
992 | |
993 DEFUNX ("S_ISSOCK", FS_ISSOCK, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
994 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
995 @deftypefn {} {} S_ISSOCK (@var{mode}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
996 Return true if @var{mode} corresponds to a socket. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
997 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
998 The value of @var{mode} is assumed to be returned from a call to |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
999 @code{stat}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1000 @seealso{stat, lstat} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1001 @end deftypefn */) |
5476 | 1002 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1003 if (args.length () != 1) |
5823 | 1004 print_usage (); |
5476 | 1005 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1006 double mode = args(0).xdouble_value ("S_ISSOCK: invalid MODE value"); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1007 |
21736
0504351a45e6
use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents:
21733
diff
changeset
|
1008 return ovl (octave::sys::file_stat::is_sock (static_cast<mode_t> (mode))); |
5476 | 1009 } |
1010 | |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1011 DEFUN (gethostname, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1012 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1013 @deftypefn {} {} gethostname () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1014 Return the hostname of the system where Octave is running. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1015 @end deftypefn */) |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1016 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1017 if (args.length () != 0) |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1018 print_usage (); |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1019 |
21732
6a1eded90355
use namespace for system env class
John W. Eaton <jwe@octave.org>
parents:
21731
diff
changeset
|
1020 return ovl (octave::sys::env::get_host_name ()); |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1021 } |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1022 |
5547 | 1023 DEFUN (uname, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1024 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1025 @deftypefn {} {[@var{uts}, @var{err}, @var{msg}] =} uname () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1026 Return system information in the structure. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1027 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1028 For example: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1029 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1030 @example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1031 @group |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1032 uname () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1033 @result{} @{ |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1034 sysname = x86_64 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1035 nodename = segfault |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1036 release = 2.6.15-1-amd64-k8-smp |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1037 version = Linux |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1038 machine = #2 SMP Thu Feb 23 04:57:49 UTC 2006 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1039 @} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1040 @end group |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1041 @end example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1042 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1043 If successful, @var{err} is 0 and @var{msg} is an empty string. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1044 Otherwise, @var{err} is nonzero and @var{msg} contains a |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1045 system-dependent error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1046 @end deftypefn */) |
5547 | 1047 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1048 if (args.length () != 0) |
5823 | 1049 print_usage (); |
5547 | 1050 |
21731
3dfec4c1eb8b
use namespace for system uname class
John W. Eaton <jwe@octave.org>
parents:
21727
diff
changeset
|
1051 octave::sys::uname sysinfo; |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1052 |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1053 octave_scalar_map m; |
5547 | 1054 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1055 m.assign ("sysname", sysinfo.sysname ()); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1056 m.assign ("nodename", sysinfo.nodename ()); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1057 m.assign ("release", sysinfo.release ()); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1058 m.assign ("version", sysinfo.version ()); |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1059 m.assign ("machine", sysinfo.machine ()); |
5547 | 1060 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1061 return ovl (m, sysinfo.error (), sysinfo.message ()); |
5547 | 1062 } |
1063 | |
23957
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1064 /* |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1065 %!test <51869> |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1066 %! [info, status, msg] = uname (); |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1067 %! if (status == 0) |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1068 %! assert (isstruct (info)) |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1069 %! assert (ischar (msg) && isempty (msg)) |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1070 %! endif |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1071 */ |
382cc01a60e1
uname: Return empty message on success (bug #51869)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23738
diff
changeset
|
1072 |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
1073 DEFUNX ("unlink", Funlink, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1074 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1075 @deftypefn {} {[@var{err}, @var{msg}] =} unlink (@var{file}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1076 Delete the file named @var{file}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1077 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1078 If successful, @var{err} is 0 and @var{msg} is an empty string. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1079 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1080 error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1081 @seealso{delete, rmdir} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1082 @end deftypefn */) |
2075 | 1083 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1084 if (args.length () != 1) |
5823 | 1085 print_usage (); |
2075 | 1086 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1087 std::string name = args(0).xstring_value ("unlink: FILE must be a string"); |
2669 | 1088 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1089 std::string msg; |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1090 |
21733
cb0fdd941d84
use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents:
21732
diff
changeset
|
1091 int status = octave::sys::unlink (name, msg); |
2669 | 1092 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1093 return ovl (status, msg); |
2075 | 1094 } |
1095 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
1096 DEFUNX ("waitpid", Fwaitpid, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1097 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1098 @deftypefn {} {[@var{pid}, @var{status}, @var{msg}] =} waitpid (@var{pid}, @var{options}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1099 Wait for process @var{pid} to terminate. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1100 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1101 The @var{pid} argument can be: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1102 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1103 @table @asis |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1104 @item @minus{}1 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1105 Wait for any child process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1106 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1107 @item 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1108 Wait for any child process whose process group ID is equal to that of the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1109 Octave interpreter process. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1110 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1111 @item > 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1112 Wait for termination of the child process with ID @var{pid}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1113 @end table |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1114 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1115 The @var{options} argument can be a bitwise OR of zero or more of the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1116 following constants: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1117 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1118 @table @code |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1119 @item 0 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1120 Wait until signal is received or a child process exits (this is the default |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1121 if the @var{options} argument is missing). |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1122 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1123 @item WNOHANG |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1124 Do not hang if status is not immediately available. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1125 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1126 @item WUNTRACED |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1127 Report the status of any child processes that are stopped, and whose status |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1128 has not yet been reported since they stopped. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1129 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1130 @item WCONTINUE |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1131 Return if a stopped child has been resumed by delivery of @code{SIGCONT}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1132 This value may not be meaningful on all systems. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1133 @end table |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1134 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1135 If the returned value of @var{pid} is greater than 0, it is the process ID |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1136 of the child process that exited. If an error occurs, @var{pid} will be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1137 less than zero and @var{msg} will contain a system-dependent error message. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1138 The value of @var{status} contains additional system-dependent information |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1139 about the subprocess that exited. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1140 @seealso{WCONTINUE, WCOREDUMP, WEXITSTATUS, WIFCONTINUED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG, WTERMSIG, WUNTRACED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1141 @end deftypefn */) |
2075 | 1142 { |
1143 int nargin = args.length (); | |
1144 | |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1145 if (nargin != 1 && nargin != 2) |
5823 | 1146 print_usage (); |
2075 | 1147 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1148 pid_t pid = args(0).xint_value ("waitpid: OPTIONS must be an integer"); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11572
diff
changeset
|
1149 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1150 int options = 0; |
2075 | 1151 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1152 if (nargin == 2) |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1153 options = args(1).xint_value ("waitpid: PID must be an integer value"); |
2669 | 1154 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1155 std::string msg; |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1156 int status; |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1157 |
21727
e0da98857c19
rename octave::syscalls namespace to octave::sys
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
1158 pid_t result = octave::sys::waitpid (pid, &status, options, msg); |
2075 | 1159 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1160 return ovl (result, status, msg); |
2075 | 1161 } |
1162 | |
5453 | 1163 DEFUNX ("WIFEXITED", FWIFEXITED, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1164 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1165 @deftypefn {} {} WIFEXITED (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1166 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1167 true if the child terminated normally. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1168 @seealso{waitpid, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1169 @end deftypefn */) |
5453 | 1170 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1171 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1172 print_usage (); |
5453 | 1173 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1174 int status = args(0).xint_value ("WIFEXITED: STATUS must be an integer"); |
5453 | 1175 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1176 return ovl (octave::sys::wifexited (status)); |
5453 | 1177 } |
1178 | |
1179 DEFUNX ("WEXITSTATUS", FWEXITSTATUS, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1180 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1181 @deftypefn {} {} WEXITSTATUS (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1182 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1183 the exit status of the child. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1184 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1185 This function should only be employed if @code{WIFEXITED} returned true. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1186 @seealso{waitpid, WIFEXITED, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1187 @end deftypefn */) |
5453 | 1188 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1189 if (args.length () != 1) |
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1190 print_usage (); |
5453 | 1191 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1192 int status = args(0).xint_value ("WEXITSTATUS: STATUS must be an integer"); |
5453 | 1193 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1194 return ovl (octave::sys::wexitstatus (status)); |
5453 | 1195 } |
1196 | |
1197 DEFUNX ("WIFSIGNALED", FWIFSIGNALED, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1198 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1199 @deftypefn {} {} WIFSIGNALED (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1200 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1201 true if the child process was terminated by a signal. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1202 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1203 @end deftypefn */) |
5453 | 1204 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1205 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1206 print_usage (); |
5453 | 1207 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1208 int status = args(0).xint_value ("WIFSIGNALED: STATUS must be an integer"); |
5453 | 1209 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1210 return ovl (octave::sys::wifsignaled (status)); |
5453 | 1211 } |
1212 | |
1213 DEFUNX ("WTERMSIG", FWTERMSIG, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1214 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1215 @deftypefn {} {} WTERMSIG (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1216 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1217 the number of the signal that caused the child process to terminate. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1218 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1219 This function should only be employed if @code{WIFSIGNALED} returned true. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1220 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1221 @end deftypefn */) |
5453 | 1222 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1223 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1224 print_usage (); |
5453 | 1225 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1226 int status = args(0).xint_value ("WTERMSIG: STATUS must be an integer"); |
5453 | 1227 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1228 return ovl (octave::sys::wtermsig (status)); |
5453 | 1229 } |
1230 | |
1231 DEFUNX ("WCOREDUMP", FWCOREDUMP, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1232 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1233 @deftypefn {} {} WCOREDUMP (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1234 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1235 true if the child produced a core dump. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1236 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1237 This function should only be employed if @code{WIFSIGNALED} returned true. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1238 The macro used to implement this function is not specified in POSIX.1-2001 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1239 and is not available on some Unix implementations (e.g., AIX, SunOS). |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1240 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED, WSTOPSIG, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1241 @end deftypefn */) |
5453 | 1242 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1243 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1244 print_usage (); |
5453 | 1245 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1246 int status = args(0).xint_value ("WCOREDUMP: STATUS must be an integer"); |
5453 | 1247 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1248 return ovl (octave::sys::wcoredump (status)); |
5453 | 1249 } |
1250 | |
1251 DEFUNX ("WIFSTOPPED", FWIFSTOPPED, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1252 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1253 @deftypefn {} {} WIFSTOPPED (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1254 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1255 true if the child process was stopped by delivery of a signal. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1256 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1257 This is only possible if the call was done using @code{WUNTRACED} or when |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1258 the child is being traced (see ptrace(2)). |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1259 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WSTOPSIG, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1260 @end deftypefn */) |
5453 | 1261 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1262 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1263 print_usage (); |
5453 | 1264 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1265 int status = args(0).xint_value ("WIFSTOPPED: STATUS must be an integer"); |
5453 | 1266 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1267 return ovl (octave::sys::wifstopped (status)); |
5453 | 1268 } |
1269 | |
1270 DEFUNX ("WSTOPSIG", FWSTOPSIG, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1271 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1272 @deftypefn {} {} WSTOPSIG (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1273 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1274 the number of the signal which caused the child to stop. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1275 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1276 This function should only be employed if @code{WIFSTOPPED} returned true. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1277 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WIFCONTINUED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1278 @end deftypefn */) |
5453 | 1279 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1280 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1281 print_usage (); |
5453 | 1282 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1283 int status = args(0).xint_value ("WSTOPSIG: STATUS must be an integer"); |
5453 | 1284 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1285 return ovl (octave::sys::wstopsig (status)); |
5453 | 1286 } |
1287 | |
1288 DEFUNX ("WIFCONTINUED", FWIFCONTINUED, args, , | |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1289 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1290 @deftypefn {} {} WIFCONTINUED (@var{status}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1291 Given @var{status} from a call to @code{waitpid}, return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1292 true if the child process was resumed by delivery of @code{SIGCONT}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1293 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1294 @end deftypefn */) |
5453 | 1295 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1296 if (args.length () != 1) |
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1297 print_usage (); |
5453 | 1298 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1299 int status = args(0).xint_value ("WIFCONTINUED: STATUS must be an integer"); |
5453 | 1300 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1301 return ovl (octave::sys::wifcontinued (status)); |
5453 | 1302 } |
1303 | |
10249
14eba566f9f0
use DEFUNX instead of DEFUN for canonicalize_file_name
John W. Eaton <jwe@octave.org>
parents:
10197
diff
changeset
|
1304 DEFUNX ("canonicalize_file_name", Fcanonicalize_file_name, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1305 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1306 @deftypefn {} {[@var{cname}, @var{status}, @var{msg}] =} canonicalize_file_name (@var{fname}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1307 Return the canonical name of file @var{fname}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1308 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1309 If the file does not exist the empty string ("") is returned. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1310 @seealso{make_absolute_filename, is_absolute_filename, is_rooted_relative_filename} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1311 @end deftypefn */) |
5138 | 1312 { |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1313 if (args.length () != 1) |
5823 | 1314 print_usage (); |
5138 | 1315 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1316 std::string name = args(0).xstring_value ("canonicalize_file_name: NAME must be a string"); |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1317 |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1318 std::string msg; |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20560
diff
changeset
|
1319 |
21733
cb0fdd941d84
use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents:
21732
diff
changeset
|
1320 std::string result = octave::sys::canonicalize_file_name (name, msg); |
20856
b3a18c764161
Code sprint 2015: Refactor print_usage() in syscalls.cc to resemble m-files
Yu Liu <yul.liuiyu@gmail.com>
parents:
20853
diff
changeset
|
1321 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1322 return ovl (result, msg.empty () ? 0 : -1, msg); |
5138 | 1323 } |
1324 | |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1325 static inline octave_value |
7924 | 1326 const_value (const octave_value_list& args, int val) |
5749 | 1327 { |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1328 if (args.length () != 0) |
5823 | 1329 print_usage (); |
5749 | 1330 |
20887
05125a9eb9c6
2015 Code Sprint: syscalls.cc: use ovl (), move print_usage to top of fcn.
Rik <rik@octave.org>
parents:
20856
diff
changeset
|
1331 return octave_value (val); |
5749 | 1332 } |
1333 | |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1334 DEFUNX ("F_DUPFD", FF_DUPFD, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1335 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1336 @deftypefn {} {} F_DUPFD () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1337 Return the numerical value to pass to @code{fcntl} to return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1338 a duplicate file descriptor. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1339 @seealso{fcntl, F_GETFD, F_GETFL, F_SETFD, F_SETFL} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1340 @end deftypefn */) |
2075 | 1341 { |
21911 | 1342 static int val = octave_f_dupfd_wrapper (); |
1343 | |
1344 if (val < 0) | |
1345 err_disabled_feature ("F_DUPFD", "F_DUPFD"); | |
1346 | |
1347 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1348 } |
2075 | 1349 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1350 DEFUNX ("F_GETFD", FF_GETFD, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1351 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1352 @deftypefn {} {} F_GETFD () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1353 Return the numerical value to pass to @code{fcntl} to return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1354 the file descriptor flags. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1355 @seealso{fcntl, F_DUPFD, F_GETFL, F_SETFD, F_SETFL} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1356 @end deftypefn */) |
5749 | 1357 { |
21911 | 1358 static int val = octave_f_getfd_wrapper (); |
1359 | |
1360 if (val < 0) | |
1361 err_disabled_feature ("F_GETFD", "F_GETFD"); | |
1362 | |
1363 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1364 } |
2075 | 1365 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1366 DEFUNX ("F_GETFL", FF_GETFL, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1367 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1368 @deftypefn {} {} F_GETFL () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1369 Return the numerical value to pass to @code{fcntl} to return |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1370 the file status flags. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1371 @seealso{fcntl, F_DUPFD, F_GETFD, F_SETFD, F_SETFL} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1372 @end deftypefn */) |
5749 | 1373 { |
21911 | 1374 static int val = octave_f_getfl_wrapper (); |
1375 | |
1376 if (val < 0) | |
1377 err_disabled_feature ("F_GETFL", "F_GETFL"); | |
1378 | |
1379 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1380 } |
2075 | 1381 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1382 DEFUNX ("F_SETFD", FF_SETFD, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1383 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1384 @deftypefn {} {} F_SETFD () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1385 Return the numerical value to pass to @code{fcntl} to set the file |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1386 descriptor flags. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1387 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFL} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1388 @end deftypefn */) |
5749 | 1389 { |
21911 | 1390 static int val = octave_f_setfd_wrapper (); |
1391 | |
1392 if (val < 0) | |
1393 err_disabled_feature ("F_SETFD", "F_SETFD"); | |
1394 | |
1395 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1396 } |
2075 | 1397 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1398 DEFUNX ("F_SETFL", FF_SETFL, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1399 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1400 @deftypefn {} {} F_SETFL () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1401 Return the numerical value to pass to @code{fcntl} to set the file |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1402 status flags. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1403 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFD} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1404 @end deftypefn */) |
5749 | 1405 { |
21911 | 1406 static int val = octave_f_setfl_wrapper (); |
1407 | |
1408 if (val < 0) | |
1409 err_disabled_feature ("F_SETFL", "F_SETFL"); | |
1410 | |
1411 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1412 } |
2075 | 1413 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1414 DEFUNX ("O_APPEND", FO_APPEND, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1415 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1416 @deftypefn {} {} O_APPEND () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1417 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1418 returned by @code{fcntl} to indicate each write operation appends, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1419 or that may be passed to @code{fcntl} to set the write mode to append. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1420 @seealso{fcntl, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1421 @end deftypefn */) |
5749 | 1422 { |
21911 | 1423 static int val = octave_o_append_wrapper (); |
1424 | |
1425 if (val < 0) | |
1426 err_disabled_feature ("O_APPEND", "O_APPEND"); | |
1427 | |
1428 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1429 } |
2075 | 1430 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1431 DEFUNX ("O_ASYNC", FO_ASYNC, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1432 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1433 @deftypefn {} {} O_ASYNC () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1434 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1435 returned by @code{fcntl} to indicate asynchronous I/O. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1436 @seealso{fcntl, O_APPEND, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1437 @end deftypefn */) |
5749 | 1438 { |
21911 | 1439 static int val = octave_o_async_wrapper (); |
1440 | |
1441 if (val < 0) | |
1442 err_disabled_feature ("O_ASYNC", "O_ASYNC"); | |
1443 | |
1444 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1445 } |
2669 | 1446 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1447 DEFUNX ("O_CREAT", FO_CREAT, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1448 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1449 @deftypefn {} {} O_CREAT () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1450 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1451 returned by @code{fcntl} to indicate that a file should be created if it |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1452 does not exist. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1453 @seealso{fcntl, O_APPEND, O_ASYNC, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1454 @end deftypefn */) |
5749 | 1455 { |
21911 | 1456 static int val = octave_o_creat_wrapper (); |
1457 | |
1458 if (val < 0) | |
1459 err_disabled_feature ("O_CREAT", "O_CREAT"); | |
1460 | |
1461 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1462 } |
2075 | 1463 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1464 DEFUNX ("O_EXCL", FO_EXCL, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1465 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1466 @deftypefn {} {} O_EXCL () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1467 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1468 returned by @code{fcntl} to indicate that file locking is used. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1469 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1470 @end deftypefn */) |
5749 | 1471 { |
21911 | 1472 static int val = octave_o_excl_wrapper (); |
1473 | |
1474 if (val < 0) | |
1475 err_disabled_feature ("O_EXCL", "O_EXCL"); | |
1476 | |
1477 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1478 } |
2075 | 1479 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1480 DEFUNX ("O_NONBLOCK", FO_NONBLOCK, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1481 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1482 @deftypefn {} {} O_NONBLOCK () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1483 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1484 returned by @code{fcntl} to indicate that non-blocking I/O is in use, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1485 or that may be passsed to @code{fcntl} to set non-blocking I/O. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1486 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1487 @end deftypefn */) |
5749 | 1488 { |
21911 | 1489 static int val = octave_o_nonblock_wrapper (); |
1490 | |
1491 if (val < 0) | |
1492 err_disabled_feature ("O_NONBLOCK", "O_NONBLOCK"); | |
1493 | |
1494 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1495 } |
2075 | 1496 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1497 DEFUNX ("O_RDONLY", FO_RDONLY, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1498 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1499 @deftypefn {} {} O_RDONLY () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1500 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1501 returned by @code{fcntl} to indicate that a file is open for reading only. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1502 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1503 @end deftypefn */) |
5749 | 1504 { |
21911 | 1505 static int val = octave_o_rdonly_wrapper (); |
1506 | |
1507 if (val < 0) | |
1508 err_disabled_feature ("O_RDONLY", "O_RDONLY"); | |
1509 | |
1510 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1511 } |
2075 | 1512 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1513 DEFUNX ("O_RDWR", FO_RDWR, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1514 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1515 @deftypefn {} {} O_RDWR () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1516 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1517 returned by @code{fcntl} to indicate that a file is open for both reading |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1518 and writing. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1519 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_SYNC, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1520 @end deftypefn */) |
5749 | 1521 { |
21911 | 1522 static int val = octave_o_rdwr_wrapper (); |
1523 | |
1524 if (val < 0) | |
1525 err_disabled_feature ("O_RDWR", "O_RDWR"); | |
1526 | |
1527 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1528 } |
2075 | 1529 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1530 DEFUNX ("O_SYNC", FO_SYNC, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1531 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1532 @deftypefn {} {} O_SYNC () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1533 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1534 returned by @code{fcntl} to indicate that a file is open for synchronous |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1535 I/O. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1536 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1537 @end deftypefn */) |
5749 | 1538 { |
21911 | 1539 static int val = octave_o_sync_wrapper (); |
1540 | |
1541 if (val < 0) | |
1542 err_disabled_feature ("O_SYNC", "O_SYNC"); | |
1543 | |
1544 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1545 } |
2669 | 1546 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1547 DEFUNX ("O_TRUNC", FO_TRUNC, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1548 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1549 @deftypefn {} {} O_TRUNC () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1550 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1551 returned by @code{fcntl} to indicate that if file exists, it should be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1552 truncated when writing. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1553 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_WRONLY} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1554 @end deftypefn */) |
5749 | 1555 { |
21911 | 1556 static int val = octave_o_trunc_wrapper (); |
1557 | |
1558 if (val < 0) | |
1559 err_disabled_feature ("O_TRUNC", "O_TRUNC"); | |
1560 | |
1561 return const_value (args, val); | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1562 } |
2075 | 1563 |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1564 DEFUNX ("O_WRONLY", FO_WRONLY, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1565 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1566 @deftypefn {} {} O_WRONLY () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1567 Return the numerical value of the file status flag that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1568 returned by @code{fcntl} to indicate that a file is open for writing only. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1569 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1570 @end deftypefn */) |
5749 | 1571 { |
21911 | 1572 static int val = octave_o_wronly_wrapper (); |
1573 | |
1574 if (val < 0) | |
1575 err_disabled_feature ("O_WRONLY", "O_WRONLY"); | |
1576 | |
1577 return const_value (args, val); | |
5749 | 1578 } |
3446 | 1579 |
5749 | 1580 DEFUNX ("WNOHANG", FWNOHANG, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1581 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1582 @deftypefn {} {} WNOHANG () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1583 Return the numerical value of the option argument that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1584 passed to @code{waitpid} to indicate that it should return its status |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1585 immediately instead of waiting for a process to exit. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1586 @seealso{waitpid, WUNTRACED, WCONTINUE} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1587 @end deftypefn */) |
5749 | 1588 { |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1589 return const_value (args, octave::sys::wnohang ()); |
5749 | 1590 } |
5453 | 1591 |
5749 | 1592 DEFUNX ("WUNTRACED", FWUNTRACED, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1593 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1594 @deftypefn {} {} WUNTRACED () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1595 Return the numerical value of the option argument that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1596 passed to @code{waitpid} to indicate that it should also return if the child |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1597 process has stopped but is not traced via the @code{ptrace} system call |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1598 @seealso{waitpid, WNOHANG, WCONTINUE} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1599 @end deftypefn */) |
5749 | 1600 { |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1601 return const_value (args, octave::sys::wuntraced ()); |
5749 | 1602 } |
5453 | 1603 |
5749 | 1604 DEFUNX ("WCONTINUE", FWCONTINUE, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1605 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1606 @deftypefn {} {} WCONTINUE () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1607 Return the numerical value of the option argument that may be |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1608 passed to @code{waitpid} to indicate that it should also return if a stopped |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1609 child has been resumed by delivery of a @code{SIGCONT} signal. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1610 @seealso{waitpid, WNOHANG, WUNTRACED} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21949
diff
changeset
|
1611 @end deftypefn */) |
5749 | 1612 { |
21921
ecfcc8527661
hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents:
21911
diff
changeset
|
1613 return const_value (args, octave::sys::wcontinue ()); |
2075 | 1614 } |