Mercurial > octave-nkf
diff src/syscalls.cc @ 11006:aca961a3f387
provide gethostname function
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 21 Sep 2010 03:35:46 -0400 |
parents | 89f4d7e294cc |
children | 39ae406df598 |
line wrap: on
line diff
--- a/src/syscalls.cc Mon Sep 20 21:23:10 2010 -0400 +++ b/src/syscalls.cc Tue Sep 21 03:35:46 2010 -0400 @@ -41,6 +41,7 @@ #include "file-ops.h" #include "file-stat.h" +#include "oct-env.h" #include "oct-syscalls.h" #include "oct-uname.h" @@ -1173,6 +1174,22 @@ return retval; } +DEFUN (gethostname, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {[@var{uts}, @var{err}, @var{msg}] =} uname ()\n\ +Return the hostname of the system on which Octave is running\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 0) + retval = octave_env::get_host_name (); + else + print_usage (); + + return retval; +} + DEFUN (uname, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {[@var{uts}, @var{err}, @var{msg}] =} uname ()\n\