# HG changeset patch # User jwe # Date 862897560 0 # Node ID 87cb7614257db1b082a9a1f3fa92cfb7774c325d # Parent a57fdc645b1f2f822249abbc55a57f5f00570ede [project @ 1997-05-06 05:46:00 by jwe] diff --git a/src/file-io.cc b/src/file-io.cc --- a/src/file-io.cc +++ b/src/file-io.cc @@ -1274,13 +1274,21 @@ } DEFUN (tmpnam, args, , - "tmpnam ()\n\ + "tmpnam (DIR, PREFIX)\n\ Return unique temporary file name.") { octave_value retval; - if (args.length () == 0) - retval = file_ops::tempnam (); + int len = args.length (); + + if (len < 3) + { + string dir = len > 0 ? args(0).string_value () : string (); + string pfx = len > 1 ? args(1).string_value () : string ("oct-"); + + if (! error_state) + retval = file_ops::tempnam (dir, pfx); + } else print_usage ("tmpnam"); diff --git a/src/oct-hist.cc b/src/oct-hist.cc --- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -387,7 +387,7 @@ reverse = 1; } - string name = file_ops::tempnam (); + string name = file_ops::tempnam ("", "oct-"); fstream file (name.c_str (), ios::out); diff --git a/src/pt-plot.cc b/src/pt-plot.cc --- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -850,7 +850,7 @@ string save_in_tmp_file (octave_value& t, int ndim, bool parametric) { - string name = file_ops::tempnam (); + string name = file_ops::tempnam ("", "oct-"); if (! name.empty ()) {