Mercurial > hg > octave-nkf
diff src/octave.cc @ 666:fb4f6556b443
[project @ 1994-09-06 21:22:46 by jwe]
author | jwe |
---|---|
date | Tue, 06 Sep 1994 21:25:14 +0000 |
parents | fae2bd91c027 |
children | 066e1551639c |
line wrap: on
line diff
--- a/src/octave.cc +++ b/src/octave.cc @@ -64,6 +64,7 @@ #include "help.h" #include "octave.h" #include "parse.h" +#include "defaults.h" #include "procstream.h" #include "unwind-prot.h" #include "octave-hist.h" @@ -601,6 +602,38 @@ return retval; } +DEFUN ("computer", Fcomputer, Scomputer, 1, 0, + "computer ():\n\ +\n\ +Have Octave ask the system, \"What kind of computer are you?\"") +{ + Octave_object retval; + + if (args.length () != 1) + warning ("computer: ignoring extra arguments"); + + ostrstream output_buf; + + if (strcmp (TARGET_HOST_TYPE, "unknown") == 0) + output_buf << "Hi Dave, I'm a HAL-9000"; + else + output_buf << TARGET_HOST_TYPE; + + if (nargout == 0) + { + output_buf << "\n" << ends; + maybe_page_output (output_buf); + } + else + { + char *msg = output_buf.str (); + retval = msg; + delete [] msg; + } + + return retval; +} + DEFUN ("flops", Fflops, Sflops, 2, 1, "flops (): count floating point operations") {