changeset 1755:3a9462b655f1

[project @ 1996-01-22 04:47:22 by jwe]
author jwe
date Mon, 22 Jan 1996 04:47:22 +0000
parents 5f1938919fdc
children 1af643fa00e3
files src/Makefile.in src/Map.cc src/Map.h src/SLStack-str.cc src/colloc.cc src/dassl.cc src/data.cc src/defun-int.h src/defun.h src/dirfns.cc src/dirfns.h src/dynamic-ld.cc src/dynamic-ld.h src/file-info.cc src/file-info.h src/file-io.cc src/fsolve.cc src/help.cc src/help.h src/input.cc src/input.h src/lex.l src/load-save.cc src/load-save.h src/lsode.cc src/mappers.h src/npsol.cc src/oct-hist.cc src/oct-hist.h src/oct-map.cc src/oct-map.h src/oct-obj.cc src/oct-obj.h src/octave.cc src/pager.cc src/parse.h src/parse.y src/pr-output.cc src/pr-output.h src/pt-base.cc src/pt-const.cc src/pt-const.h src/pt-exp.cc src/pt-fcn.cc src/pt-fcn.h src/pt-fvc-base.cc src/pt-fvc-base.h src/pt-fvc.cc src/pt-fvc.h src/pt-mvr.cc src/pt-mvr.h src/pt-plot.cc src/pt-plot.h src/qpsol.cc src/quad.cc src/schur.cc src/symtab.cc src/symtab.h src/sysdep.cc src/sysdep.h src/timefns.cc src/token.cc src/token.h src/toplev.cc src/toplev.h src/unwind-prot.cc src/unwind-prot.h src/user-prefs.cc src/user-prefs.h src/utils.cc src/utils.h src/variables.cc src/variables.h
diffstat 73 files changed, 2310 insertions(+), 2768 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.in	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/Makefile.in	Mon Jan 22 04:47:22 1996 +0000
@@ -94,9 +94,10 @@
 	variables.h version.h xdiv.h xpow.h Map.h SLStack.h Stack.h
 
 TI_SRC := Array-tc.cc Map-tc.cc DLList-fi.cc \
-	SLList-expr.cc SLList-misc.cc SLList-plot.cc SLList-tc.cc \
-	SLStack-i.cc SLStack-pc.cc SLStack-str.cc SLStack-sym.cc \
-	SLStack-tok.cc SLStack-tm.cc SLStack-ue.cc SLStack-ui.cc
+	SLList-expr.cc SLList-misc.cc SLList-plot.cc SLList-str.cc \
+	SLList-tc.cc SLStack-i.cc SLStack-pc.cc SLStack-str.cc \
+	SLStack-sym.cc SLStack-tok.cc SLStack-tm.cc SLStack-ue.cc \
+	SLStack-ui.cc
 
 TI_OBJ := $(patsubst %.cc, %.o, $(TI_SRC))
 
--- a/src/Map.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/Map.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -43,21 +43,21 @@
 #include "Map.h"
 
 static unsigned int
-hash (const char *str)
+hash (const string& str)
 {
   unsigned h = 0;
-  while (*str)
-    h = h * 33 + *str++;
+  for (unsigned i = 0; i < str.length (); i++)
+    h = h * 33 + str[i];
   return h;
 }
 
 template <class C>
 Pix
-Map<C>::seek (const char *item) const
+Map<C>::seek (const string& item) const
 {
   Pix i = 0;
 
-  for (i = first (); i != 0 && strcmp (key (i), item) != 0; next (i))
+  for (i = first (); i != 0 && key (i) != item; next (i))
     ; // Skip items until match found.
 
   return i;
@@ -91,14 +91,14 @@
 
 template <class C>
 int
-Map<C>::contains (const char *item) const
+Map<C>::contains (const string& item) const
 {
   return seek (item) != 0;
 }
 
 template <class C>
 void
-Map<C>::error (const char* msg) const
+Map<C>::error (const string& msg) const
 {
   cerr << "Map: " << msg << "\n";
 }
@@ -153,12 +153,12 @@
 
 template <class C>
 Pix
-CHMap<C>::seek (const char *key) const
+CHMap<C>::seek (const string& key) const
 {
   unsigned int h = hash (key) % size;
 
   for (CHNode<C> *t = tab[h]; goodCHptr (t); t = t->tl)
-    if (strcmp (key, t->hd) == 0)
+    if (key == t->hd)
       return Pix (t);
 
   return 0;
@@ -166,13 +166,13 @@
 
 template <class C>
 C&
-CHMap<C>::operator [] (const char *item)
+CHMap<C>::operator [] (const string& item)
 {
   unsigned int h = hash (item) % size;
 
   CHNode<C> *t = 0;
   for (t = tab[h]; goodCHptr (t); t = t->tl)
-    if (strcmp (item, t->hd) == 0)
+    if (item == t->hd)
       return t->cont;
 
   t = new CHNode<C> (item, def, tab[h]);
@@ -183,7 +183,7 @@
 
 template <class C>
 void
-CHMap<C>::del (const char *key)
+CHMap<C>::del (const string& key)
 {
   unsigned int h = hash (key) % size;
 
@@ -191,7 +191,7 @@
   CHNode<C> *trail = t;
   while (goodCHptr (t))
     {
-      if (strcmp (key, t->hd) == 0)
+      if (key == t->hd)
 	{
 	  if (trail == t)
 	    tab[h] = t->tl;
--- a/src/Map.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/Map.h	Mon Jan 22 04:47:22 1996 +0000
@@ -37,7 +37,7 @@
 #if ! defined (octave_Map_h)
 #define octave_Map_h 1
 
-#include <cstring>
+#include <string>
 
 #include <Pix.h>
 
@@ -56,25 +56,25 @@
   int length (void) const { return count; }	// current number of items
   int empty (void) const { return count == 0; }
 
-  virtual int contains (const char *key) const;	// is key mapped?
+  virtual int contains (const string& key) const;  // is key mapped?
 
   virtual void clear (void);			// delete all items
 	      
-  virtual C& operator [] (const char *key) = 0;	// access contents by key
+  virtual C& operator [] (const string& key) = 0;  // access contents by key
 	      
-  virtual void del (const char *key) = 0;	// delete entry
+  virtual void del (const string& key) = 0;	// delete entry
 	      
   virtual Pix first (void) const = 0;		// Pix of first item or 0
   virtual void next (Pix& i) const = 0;		// advance to next or 0
-  virtual const char *key (Pix i) const = 0;	// access key at i
+  virtual string key (Pix i) const = 0;		// access key at i
   virtual C& contents (Pix i) const = 0;	// access contents at i
 
   virtual int owns (Pix i) const;		// is i a valid Pix  ?
-  virtual Pix seek (const char *key) const;	// Pix of key
+  virtual Pix seek (const string& key) const;	// Pix of key
 
   C& dflt (void) { return def; }		// access default val
 
-  void  error (const char* msg) const;
+  void error (const string& msg) const;
 
   virtual int OK (void) const = 0;		// rep invariant
 };
@@ -83,19 +83,15 @@
 struct CHNode
 {
   CHNode *tl;
-  char *hd;
+  string hd;
   C cont;
 
-  CHNode (void) : tl (0), hd (0) { }
+  CHNode (void) : tl (0), hd (), cont () { }
 
-  CHNode (const char *h, const C& c, CHNode *t = 0) : tl (t), cont (c)
-    {
-      hd = h ? strcpy (new char [strlen (h) + 1], h) : 0;
-    }
+  CHNode (const string& h, const C& c, CHNode *t = 0)
+    : tl (t), hd (h), cont (c) { }
 
-
-  ~CHNode (void)
-    { delete [] hd; }
+  ~CHNode (void) { }
 };
 
 #ifndef DEFAULT_INITIAL_CAPACITY
@@ -120,14 +116,14 @@
       delete tab;
     }
 
-  C& operator [] (const char *key);
+  C& operator [] (const string& key);
 
-  void del (const char *key);
+  void del (const string& key);
 
   Pix first (void) const;
   void next (Pix& i) const;
 
-  const char *key (Pix p) const
+  string key (Pix p) const
     {
       if (p == 0)
 	error ("null Pix");
@@ -143,9 +139,9 @@
      return ((CHNode<C> *) p)->cont;
    }
 
-  Pix seek (const char *key) const;
+  Pix seek (const string& key) const;
 
-  int contains (const char *key) const
+  int contains (const string& key) const
     {
       return seek (key) != 0;
     }
--- a/src/SLStack-str.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/SLStack-str.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -28,8 +28,10 @@
 
 #include <string>
 
-template class SLNode<string>;
-template class SLList<string>;
+// We already have SLList<string>, so we don't need to make them here.
+
+// template class SLNode<string>;
+// template class SLList<string>;
 template class Stack<string>;
 template class SLStack<string>;
 
--- a/src/colloc.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/colloc.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -87,16 +87,15 @@
 	      return retval;
 	    }
 
-	  string tstr = args(i).string_value ();
-	  const char *s = tstr.c_str ();
+	  string s = args(i).string_value ();
 
-	  if (s && (((*s == 'R' || *s == 'r') && strlen (s) == 1)
-		    || strcmp (s, "right") == 0))
+	  if ((s.length () == 1 && (s[0] == 'R' || s[0] == 'r'))
+	      || s == "right")
 	    {
 	      right = 1;
 	    }
-	  else if (s && (((*s == 'L' || *s == 'l') && strlen (s) == 1)
-			 || strcmp (s, "left") == 0))
+	  else if ((s.length () == 1 && (s[0] == 'L' || s[0] == 'l'))
+		   || s == "left")
 	    {
 	      left = 1;
 	    }
@@ -108,7 +107,7 @@
 	}
       else
 	{
-	  error ("colloc: unexpected NULL argument");
+	  error ("colloc: unexpected empty argument");
 	  return retval;
 	}
     }
--- a/src/dassl.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/dassl.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -276,7 +276,7 @@
 }
 
 static void
-set_dassl_option (const char *keyword, double val)
+set_dassl_option (const string& keyword, double val)
 {
   DAE_OPTIONS *list = dassl_option_table;
 
@@ -292,11 +292,11 @@
       list++;
     }
 
-  warning ("dassl_options: no match for `%s'", keyword);
+  warning ("dassl_options: no match for `%s'", keyword.c_str ());
 }
 
 static Octave_object
-show_dassl_option (const char *keyword)
+show_dassl_option (const string& keyword)
 {
   Octave_object retval;
 
@@ -312,7 +312,7 @@
       list++;
     }
 
-  warning ("dassl_options: no match for `%s'", keyword);
+  warning ("dassl_options: no match for `%s'", keyword.c_str ());
 
   return retval;
 }
@@ -335,8 +335,7 @@
     }
   else if (nargin == 1 || nargin == 2)
     {
-      string tstr = args(0).string_value ();
-      const char *keyword = tstr.c_str ();
+      string keyword = args(0).string_value ();
 
       if (! error_state)
 	{
--- a/src/data.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/data.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -35,6 +35,8 @@
 
 #include <string>
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "error.h"
 #include "gripes.h"
@@ -758,31 +760,7 @@
       if (args (0).is_map ())
 	{
 	  Octave_map m = args(0).map_value ();
-	  char **names = m.make_name_list ();
-
-	  char **ptr = names;
-	  int max_len = 0;
-	  while (*ptr)
-	    {
-	      int len = strlen (*ptr);
-	      if (len > max_len)
-		max_len = len;
-	      ptr++;
-	    }
-
-	  charMatrix list (m.length (), max_len);
-
-	  ptr = names;
-	  int i = 0;
-	  while (*ptr)
-	    {
-	      list.insert (*ptr, i++, 0);
-	      delete [] *ptr++;
-	    }
-
-	  delete [] names;
-
-	  retval(0) = list;
+	  retval(0) = m.make_name_list ();
 	}
       else
 	gripe_wrong_type_arg ("struct_elements", args (0));
@@ -807,8 +785,7 @@
       retval = 0.0;
       if (args(0).is_map () && args(1).is_string ())
 	{
-	  string tstr = args(1).string_value ();
-	  const char *s = tstr.c_str ();
+	  string s = args(1).string_value ();
 	  tree_constant tmp = args(0).lookup_map_element (s, 0, 1);
 	  retval = (double) tmp.is_defined ();
 	}
--- a/src/defun-int.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/defun-int.h	Mon Jan 22 04:47:22 1996 +0000
@@ -39,7 +39,7 @@
   BEGIN_INSTALL_BUILTIN \
     extern DECLARE_FUN_ ## unused_arg_flags (fname); \
     DEFINE_FUN_STRUCT (name, fname, sname, is_text_fcn, doc); \
-    install_builtin_function (&sname); \
+    install_builtin_function (sname); \
   END_INSTALL_BUILTIN
 
 // Generate code for making another name for an existing function.
@@ -68,14 +68,13 @@
 // the symbol table.
 
 #define DEFINE_FUN_STRUCT(name, fname, sname, is_text_fcn, doc) \
-  static builtin_function sname = \
-    { name, is_text_fcn, fname, doc }
+  static builtin_function sname (name, is_text_fcn, fname, doc)
 
 #define DEFINE_FUN_STRUCT_FUN(sname, fsname) \
-  builtin_function * \
+  builtin_function& \
   fsname (void) \
   { \
-    return &sname; \
+    return sname; \
   }
 
 // Declare an internal function named fname.  This is the interface
@@ -97,26 +96,6 @@
 
 #define DECLARE_FUN_(fname) DECLARE_FUN_11 (fname)
 
-// XXX FIXME XXX -- eliminate the need for these in the functions that
-// use them?
-
-#define DEFINE_ARGV(fcn_name) \
-  int argc = args.length () + 1; \
-  int save_argc = argc; \
-  char **argv = make_argv (args, fcn_name); \
-  char **save_argv = argv; \
-  if (error_state) \
-    return retval
-
-#define DELETE_ARGV \
-  do \
-    { \
-      while (--save_argc >= 0) \
-	delete [] save_argv[save_argc]; \
-      delete [] save_argv; \
-    } \
-  while (0)
-
 #endif
 
 /*
--- a/src/defun.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/defun.h	Mon Jan 22 04:47:22 1996 +0000
@@ -63,17 +63,10 @@
 		   sv_fcn, doc) \
   do \
     { \
-      builtin_variable sname = \
-	{ \
-	  name, \
-	  new tree_constant (defn), \
-	  inst_as_fcn, \
-	  protect, \
-	  (sv_fcn ? 1 : 0), \
-	  sv_fcn, \
-	  doc, \
-	}; \
-      install_builtin_variable (&sname); \
+      builtin_variable sname (name, new tree_constant (defn), \
+			      inst_as_fcn, protect, (sv_fcn ? 1 : 0), \
+			      sv_fcn, doc); \
+      install_builtin_variable (sname); \
     } \
   while (0)
 
@@ -160,18 +153,10 @@
 		     d_d_map, d_c_map, c_c_map, doc) \
   do \
     { \
-      builtin_mapper_function sname = \
-	{ \
-	  name, \
-	  can_ret_cmplx_for_real, \
-	  lo, \
-	  hi, \
-	  d_d_map, \
-	  d_c_map, \
-	  c_c_map, \
-	  doc, \
-	}; \
-      install_builtin_mapper (&sname); \
+      builtin_mapper_function sname (name, can_ret_cmplx_for_real, \
+				     lo, hi, d_d_map, d_c_map, \
+				     c_c_map, doc); \
+      install_builtin_mapper (sname); \
     } \
   while (0)
 
--- a/src/dirfns.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/dirfns.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -48,6 +48,8 @@
 
 #include <strstream.h>
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "dirfns.h"
 #include "error.h"
@@ -66,9 +68,6 @@
 #include "utils.h"
 #include "variables.h"
 
-// Temp storage for a path.
-static char tdir[MAXPATHLEN];
-
 // Non-zero means follow symbolic links that point to directories just
 // as if they are real directories.
 static int follow_symbolic_links = 1;
@@ -80,67 +79,71 @@
 // Remove the last N directories from PATH.  Do not PATH blank.
 // PATH must contain enough space for MAXPATHLEN characters.
 
-void
-pathname_backup (char *path, int n)
+static void
+pathname_backup (string& path, int n)
 {
-  register char *p;
-
-  if (! *path)
+  if (path.empty ())
     return;
 
-  p = path + (strlen (path) - 1);
+  size_t i = path.length () - 1;
 
   while (n--)
     {
-      while (*p == '/' && p != path)
-	p--;
+      while (path[i] == '/' && i > 0)
+	i--;
 
-      while (*p != '/' && p != path)
-	p--;
+      while (path[i] != '/' && i > 0)
+	i--;
 
-      *++p = '\0';
+      i++;
     }
+
+  path.resize (i);
 }
 
 // Return a pretty pathname.  If the first part of the pathname is the
 // same as $HOME, then replace that with `~'.
 
-char *
-polite_directory_format (char *name)
+string
+polite_directory_format (const string& name)
 {
-  int l = home_directory ? strlen (home_directory) : 0;
+  string retval;
 
-  if (l > 1 && strncmp (home_directory, name, l) == 0
-      && (! name[l] || name[l] == '/'))
+  size_t len = home_directory.length ();
+
+  if (len > 1 && home_directory.compare (name, 0, len) == 0
+      && (name.length () == len || name[len] == '/'))
     {
-      strcpy (tdir + 1, name + l);
-      tdir[0] = '~';
-      return (tdir);
+      retval = "~";
+      retval.append (name.substr (len));
     }
   else
-    return name;
+    retval = name;
+
+  return retval;
 }
 
 // Return 1 if STRING contains an absolute pathname, else 0.
 
 int
-absolute_pathname (const char *string)
+absolute_pathname (const string& s)
 {
-  if (! string || ! *string)
+  if (s.empty ())
     return 0;
 
-  if (*string == '/')
+  if (s[0] == '/')
     return 1;
 
-  if (*string++ == '.')
+  if (s[0] == '.')
     {
-      if ((! *string) || *string == '/')
+      if (s[1] == '\0' || s[1] == '/')
 	return 1;
 
-      if (*string++ == '.')
-	if (! *string || *string == '/')
+      if (s[1] == '.')
+	if (s[2] == '\0' || s[2] == '/')
 	  return 1;
     }
+
   return 0;
 }
 
@@ -149,89 +152,91 @@
 // look up through $PATH.
 
 int
-absolute_program (const char *string)
+absolute_program (const string& s)
 {
-  return (strchr (string, '/') != 0);
+  return (s.find ('/') != NPOS);
 }
 
 // Return the `basename' of the pathname in STRING (the stuff after
 // the last '/').  If STRING is not a full pathname, simply return it.
 
-char *
-base_pathname (char *string)
+string
+base_pathname (const string& s)
 {
-  char *p = strrchr (string, '/');
+  if (! absolute_pathname (s))
+    return s;
 
-  if (! absolute_pathname (string))
-    return (string);
+  size_t pos = s.rfind ('/');
 
-  if (p)
-    return (++p);
+  if (pos == NPOS)
+    return s;
   else
-    return (string);
+    return s.substr (pos+1);
 }
 
 // Turn STRING (a pathname) into an absolute pathname, assuming that
-// DOT_PATH contains the symbolic location of '.'.  This always
-// returns a new string, even if STRING was an absolute pathname to
-// begin with.
+// DOT_PATH contains the symbolic location of '.'.
 
-char *
-make_absolute (const char *string, const char *dot_path)
+string
+make_absolute (const string& s, const string& dot_path)
 {
-  static char current_path[MAXPATHLEN];
-  register char *cp;
+  if (dot_path.empty () || s[0] == '/')
+    return s;
+
+  string current_path = dot_path;
 
-  if (! dot_path || *string == '/')
-    return strsave (string);
+  if (current_path.empty ())
+    current_path = "./";
 
-  strcpy (current_path, dot_path);
-
-  if (! current_path[0])
-    strcpy (current_path, "./");
+  size_t pos = current_path.length () - 1;
 
-  cp = current_path + (strlen (current_path) - 1);
+  if (current_path[pos] != '/')
+    current_path.append ("/");
 
-  if (*cp++ != '/')
-    *cp++ = '/';
+  size_t i = 0;
+  size_t slen = s.length ();
 
-  *cp = '\0';
-
-  while (*string)
+  while (i < slen)
     {
-      if (*string == '.')
+      if (s[i] == '.')
 	{
-	  if (! string[1])
-	    return strsave (current_path);
+	  if (i + 1 == slen)
+	    return current_path;
 
-	  if (string[1] == '/')
+	  if (s[i+1] == '/')
 	    {
-	      string += 2;
+	      i += 2;
 	      continue;
 	    }
 
-	  if (string[1] == '.' && (string[2] == '/' || ! string[2]))
+	  if (s[i+1] == '.' && (i + 2 == slen || s[i+2] == '/'))
 	    {
-	      string += 2;
+	      i += 2;
 
-	      if (*string)
-		string++;
+	      if (i != slen)
+		i++;
 
 	      pathname_backup (current_path, 1);
-	      cp = current_path + strlen (current_path);
+
 	      continue;
 	    }
 	}
 
-      while (*string && *string != '/')
-	*cp++ = *string++;
+      size_t tmp = s.find ('/', i);
 
-      if (*string)
-	*cp++ = *string++;
+      if (tmp == NPOS)
+	{
+	  current_path.append (s, i, tmp-i);
+	  break;
+	}
+      else
+	{
+	  current_path.append (s, i, tmp-i+1);
+	  i = tmp + 1;
+	}
+    }
 
-      *cp = '\0';
-    }
-  return strsave (current_path);
+  return current_path;
 }
 
 // Has file `A' been modified after time `T'?
@@ -243,13 +248,13 @@
 //   stat on a fails        returns   -1
 
 int
-is_newer (const char *fa, time_t t)
+is_newer (const string& fa, time_t t)
 {
   struct stat fa_sb;
   register int fa_stat;
   register int status = 0;
 
-  fa_stat = stat (fa, &fa_sb);
+  fa_stat = stat (fa.c_str (), &fa_sb);
   if (fa_stat != 0)
     status = -1;
 
@@ -262,30 +267,18 @@
 // Return a consed string which is the current working directory.
 // FOR_WHOM is the name of the caller for error printing.
 
-char *
-get_working_directory (const char *for_whom)
+string
+get_working_directory (const string& for_whom)
 {
   if (! follow_symbolic_links)
-    {
-      if (the_current_working_directory)
-	delete [] the_current_working_directory;
+    the_current_working_directory = "";
 
-      the_current_working_directory = 0;
-    }
-
-  if (! the_current_working_directory)
+  if (the_current_working_directory.empty ())
     {
-      char *directory;
+      the_current_working_directory = octave_getcwd ();
 
-      the_current_working_directory = new char [MAXPATHLEN];
-      directory = octave_getcwd (the_current_working_directory, MAXPATHLEN);
-      if (! directory)
-	{
-	  message (for_whom, the_current_working_directory);
-	  delete [] the_current_working_directory;
-	  the_current_working_directory = 0;
-	  return 0;
-	}
+      if (the_current_working_directory.empty ())
+	warning ("%s: can't find current directory!", for_whom.c_str ());
     }
 
   return the_current_working_directory;
@@ -295,62 +288,51 @@
 // link following, etc.
 
 static int
-change_to_directory (const char *newdir)
+change_to_directory (const string& newdir)
 {
-  char *t;
+  string tmp;
 
   if (follow_symbolic_links)
     {
-      if (! the_current_working_directory)
+      if (the_current_working_directory.empty ())
 	get_working_directory ("cd_links");
 
-      if (the_current_working_directory)
-	t = make_absolute (newdir, the_current_working_directory);
+      if (the_current_working_directory.empty ())
+	tmp = newdir;
       else
-	t = strsave (newdir);
+	tmp = make_absolute (newdir, the_current_working_directory);
 
       // Get rid of trailing `/'.
 
-      {
-	register int len_t = strlen (t);
-	if (len_t > 1)
-	  {
-	    --len_t;
-	    if (t[len_t] == '/')
-	      t[len_t] = '\0';
-	  }
-      }
+      size_t len = tmp.length ();
 
-      if (octave_chdir (t) < 0)
+      if (len > 1)
 	{
-	  delete [] t;
-	  return 0;
+	  if (tmp[--len] == '/')
+	    tmp.resize (len);
 	}
 
-      if (the_current_working_directory)
-	strcpy (the_current_working_directory, t);
-
-      delete [] t;
-      return 1;
+      if (octave_chdir (tmp) < 0)
+	return 0;
+      else
+	{
+	  the_current_working_directory = tmp;
+	  return 1;
+	}
     }
   else
-    {
-      if (octave_chdir (newdir) < 0)
-	return 0;
-      else
-	return 1;
-    }
+    return (octave_chdir (newdir) < 0) ? 0 : 1;
 }
 
 static int
-octave_change_to_directory (const char *newdir)
+octave_change_to_directory (const string& newdir)
 {
   int cd_ok = change_to_directory (newdir);
 
   if (cd_ok)
     do_external_plotter_cd (newdir);
   else
-    error ("%s: %s", newdir, strerror (errno));
+    error ("%s: %s", newdir.c_str (), strerror (errno));
 
   return cd_ok;
 }
@@ -364,34 +346,36 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("cd");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "cd");
+
+  if (error_state)
+    return retval;
 
   if (argc > 1)
     {
       string dirname = oct_tilde_expand (argv[1]);
 
       if (dirname.length () > 0
-	  && ! octave_change_to_directory (dirname.c_str ()))
+	  && ! octave_change_to_directory (dirname))
 	{
-	  DELETE_ARGV;
 	  return retval;
 	}
     }
   else
     {
-      if (! home_directory || ! octave_change_to_directory (home_directory))
+      if (home_directory.empty ()
+	  || ! octave_change_to_directory (home_directory))
 	{
-	  DELETE_ARGV;
 	  return retval;
 	}
     }
 
-  char *directory = get_working_directory ("cd");
+  string directory = get_working_directory ("cd");
   tree_constant *dir = new tree_constant (directory);
   bind_builtin_variable ("PWD", dir, 1);
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -406,7 +390,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("ls");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "ls");
+
+  if (error_state)
+    return retval;
 
   ostrstream ls_buf;
 
@@ -438,8 +427,6 @@
 
   run_unwind_protect ();
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -449,25 +436,19 @@
   "pwd (): print current working directory")
 {
   Octave_object retval;
-  char *directory;
+  string directory;
 
   if (verbatim_pwd)
     {
-      char *buffer = new char [MAXPATHLEN];
-      directory = octave_getcwd (buffer, MAXPATHLEN);
+      directory = octave_getcwd ();
 
-      if (!directory)
-	{
-	  warning ("pwd: can't find working directory!");
-	  delete buffer;
-	}
+      if (directory.empty ())
+	warning ("pwd: can't find working directory!");
     }
   else
-    {
-      directory = get_working_directory ("pwd");
-    }
+    directory = get_working_directory ("pwd");
 
-  if (directory)
+  if (! directory.empty ())
     {
       if (nargout == 0)
 	{
@@ -495,8 +476,7 @@
 
   if (args.length () == 1)
     {
-      string tstr = args(0).string_value ();
-      const char *dirname = tstr.c_str ();
+      string dirname = args(0).string_value ();
 
       if (error_state)
 	{
@@ -583,8 +563,7 @@
 
   if (args.length () == 1)
     {
-      string tstr = args(0).string_value ();
-      const char *dirname = tstr.c_str ();
+      string dirname = args(0).string_value ();
 
       if (error_state)
 	gripe_wrong_type_arg ("mkdir", args(0));
@@ -622,8 +601,7 @@
 
   if (args.length () == 1)
     {
-      string tstr = args(0).string_value ();
-      const char *dirname = tstr.c_str ();
+      string dirname = args(0).string_value ();
 
       if (error_state)
 	gripe_wrong_type_arg ("rmdir", args(0));
@@ -661,19 +639,17 @@
 
   if (args.length () == 2)
     {
-      string tstr1 = args(0).string_value ();
-      const char *from = tstr1.c_str ();
+      string from = args(0).string_value ();
 
       if (error_state)
 	gripe_wrong_type_arg ("rename", args(0));
       else
 	{
-	  string tstr2 = args(1).string_value ();
-	  const char *to = tstr2.c_str ();
+	  string to = args(1).string_value ();
 
 	  if (error_state)
 	    gripe_wrong_type_arg ("rename", args(1));
-	  else if (rename (from, to) < 0)
+	  else if (rename (from.c_str (), to.c_str ()) < 0)
 	    {
 	      status = -1;
 	      error ("%s", strerror (errno));
--- a/src/dirfns.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/dirfns.h	Mon Jan 22 04:47:22 1996 +0000
@@ -26,14 +26,15 @@
 
 #include <ctime>
 
-extern char *polite_directory_format (char *);
-extern int absolute_pathname (const char *);
-extern int absolute_program (const char *);
-extern char *base_pathname (char *);
-extern void pathname_backup (char *, int);
-extern char *make_absolute (const char *, const char *);
-extern int is_newer (const char *, time_t);
-extern char *get_working_directory (const char *);
+#include <string>
+
+extern string polite_directory_format (const string&);
+extern int absolute_pathname (const string&);
+extern int absolute_program (const string&);
+extern string base_pathname (const string&);
+extern string make_absolute (const string&, const string&);
+extern int is_newer (const string&, time_t);
+extern string get_working_directory (const string&);
 
 #endif
 
--- a/src/dynamic-ld.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/dynamic-ld.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -36,10 +36,11 @@
 {
 #if defined (WITH_DL)
 #include <dlfcn.h>
+#ifndef RTLD_LAZY
+#define RTLD_LAZY 1
+#endif
 #elif defined (WITH_SHL)
 #include <dl.h>
-#elif defined (WITH_DLD)
-#include <dld/dld.h>
 #endif
 }
 
@@ -64,28 +65,28 @@
 // current DEFUN_DLD() macro, which assumes you know how to name the
 // function, the struct, and the helper function.
 
-static char *
-mangle_octave_builtin_name (const char *name)
+static string
+mangle_octave_builtin_name (const string& name)
 {
-  char *tmp = strconcat (name, "__FRC13Octave_objecti");
-  char *retval = strconcat ("F", tmp);
-  delete [] tmp;
+  string retval ("F");
+  retval.append (name);
+  retval.append ("__FRC13Octave_objecti");
   return retval;
 }
 
-static char *
-mangle_octave_oct_file_name (const char *name)
+static string
+mangle_octave_oct_file_name (const string& name)
 {
-  char *tmp = strconcat (name, "__Fv");
-  char *retval = strconcat ("FS", tmp);
-  delete [] tmp;
+  string retval ("FS");
+  retval.append (name);
+  retval.append ("__Fv");
   return retval;
 }
 
 #if defined (WITH_DL)
 
 static void *
-dl_resolve_octave_reference (const char *name, const char *file)
+dl_resolve_octave_reference (const string& name, const string& file)
 {
   void *retval = 0;
 
@@ -93,26 +94,26 @@
   // of the libraries at runtime.  Instead, they are specified when
   // the .oct file is created.
 
-  void *handle = dlopen (file, RTLD_LAZY);
+  void *handle = dlopen (file.c_str (), RTLD_LAZY);
 
   if (handle)
     {
-      retval = dlsym (handle, name);
+      retval = dlsym (handle, name.c_str ());
 
       if (! retval)
 	{
 	  const char *errmsg = dlerror ();
 
 	  if (errmsg)
-	    error("%s: `%s'", name, errmsg);
+	    error("%s: `%s'", name.c_str (), errmsg);
 	  else
-	    error("unable to link function `%s'", name);
+	    error("unable to link function `%s'", name.c_str ());
 
 	  dlclose (handle);
 	}
     }
   else
-    error ("%s: %s `%s'", dlerror (), file, name);
+    error ("%s: %s `%s'", dlerror (), file.c_str (), name.c_str ());
 
   return retval;
 }
@@ -120,7 +121,7 @@
 #elif defined (WITH_SHL)
 
 static void *
-shl_resolve_octave_reference (const char *name, const char *file)
+shl_resolve_octave_reference (const string& name, const string& file)
 {
   void *retval = 0;
 
@@ -128,11 +129,11 @@
   // specification of the libraries at runtime.  Instead, they are
   // specified when the .oct file is created.
 
-  void *handle = shl_load (file, BIND_DEFERRED, 0L);
+  void *handle = shl_load (file.c_str (), BIND_DEFERRED, 0L);
 
   if (handle)
     {
-      int status = shl_findsym ((shl_t *) &handle, name,
+      int status = shl_findsym ((shl_t *) &handle, name.c_str (),
 				TYPE_UNDEFINED, retval);
 
       if (status < 0)
@@ -140,159 +141,25 @@
 	  const char *errmsg = strerror (errno);
 
 	  if (errmsg)
-	    error("%s: `%s'", name, errmsg);
+	    error("%s: `%s'", name.c_str (), errmsg);
 	  else
-	    error("unable to link function `%s'", name);
+	    error("unable to link function `%s'", name.c_str ());
 
 	  retval = 0;
 	}
     }
   else
-    error ("%s: %s `%s'", strerror (errno), file, name);
+    error ("%s: %s `%s'", strerror (errno), file.c_str (), name.c_str ());
 
   return retval;
 }
 
-#elif defined (WITH_DLD)
-
-// Now that we have the code above to do dynamic linking with the
-// dlopen/dlsym interface and Linux uses elf, I doubt that this code
-// will be used very much.  Maybe it will be able to go away
-// eventually.  Consider it unsupported...
-
-// XXX FIXME XXX -- should this list be in a user-level variable,
-// with default taken from the environment?
-
-#ifndef STD_LIB_PATH
-#define STD_LIB_PATH "/lib:/usr/lib:/usr/local/lib"
-#endif
-
-#ifndef OCTAVE_LIB_PATH
-#define OCTAVE_LIB_PATH OCTAVE_LIBDIR ":" FLIB_PATH ":" CXXLIB_PATH 
-#endif
-
-static char *lib_dir_path = OCTAVE_LIB_PATH ":" STD_LIB_PATH;
-
-// This is the list of interesting libraries that Octave is linked
-// with.  Maybe it should include the readline, info, and kpathsea
-// libraries.  Would there ever be a time that they would really be
-// needed?
-
-#ifndef SYSTEM_LIB_LIST
-#define SYSTEM_LIB_LIST "libtermcap.a:libm.a" ":" CXXLIB_LIST
-#endif
-
-#ifndef OCTAVE_LIB_LIST
-#define OCTAVE_LIB_LIST "liboctdld.a:liboctave.a:libcruft.a:libdld.a"
-#endif
-
-static char *lib_list = OCTAVE_LIB_LIST ":" FLIB_LIST ":" SYSTEM_LIB_LIST;
-
-static void
-octave_dld_init (void)
-{
-  static int initialized = 0;
-
-  if (! initialized)
-    {
-      char *full_path = 0;
-
-      char *tmp = dld_find_executable (raw_prog_name);
-      if (tmp)
-	{
-	  full_path = make_absolute (tmp, the_current_working_directory);
-	  free (tmp);
-	}
-
-      if (full_path)
-	{
-	  int status = dld_init (full_path);
-
-	  if (status != 0)
-	    error ("failed to load symbols from `%s'", full_path);
-	  else
-	    initialized = 1;
-	}
-      else
-	{
-	  error ("octave_dld_init: can't find full path to `%s'",
-		 raw_prog_name);
-	}
-    }
-}
-
-static void
-octave_list_undefined_symbols (ostream& os)
-{
-  char **list = dld_list_undefined_sym ();
-
-  if (list)
-    {
-      os << "undefined symbols:\n\n";
-      for (int i = 0; i < dld_undefined_sym_count; i++)
-	os << list[i] << "\n";
-      os << "\n";
-    }
-}
-
-static void *
-dld_resolve_octave_reference (const char *name, const char *file)
-{
-  dld_create_reference (name);
-
-  if (file)
-    {
-      if (dld_link (file) != 0)
-	{
-	  error ("failed to link file `%s'", file);
-	  return 0;
-	}
-
-      if (dld_function_executable_p (name))
-	return (void *) dld_get_func (name);
-    }
-
-  // For each library, try to find it in a list of directories, then
-  // link to it.  It would have been nice to use the kpathsea
-  // functions here too, but calls to them can't be nested as they
-  // would need to be here...
-
-  char **libs = pathstring_to_vector (lib_list);
-  char **ptr = libs;
-  char *lib_list_elt;
-
-  while ((lib_list_elt = *ptr++))
-    {
-      char *lib = kpse_path_search (lib_dir_path, lib_list_elt,
-				    kpathsea_true);
-
-      if (lib && dld_link (lib) != 0)
-	{
-	  error ("failed to link library %s", lib);
-	  return 0;
-	}
-
-      if (dld_function_executable_p (name))
-	return (void *) dld_get_func (name);
-    }
-
-  // If we get here, there was a problem.
-
-  ostrstream output_buf;
-  octave_list_undefined_symbols (output_buf);
-  char *msg = output_buf.str ();
-  error (msg);
-  delete [] msg;
-
-  return 0;
-}
-
 #endif
 #endif
 
 #if defined (WITH_DYNAMIC_LINKING)
 static void *
-resolve_octave_reference (const char *name, const char *file)
+resolve_octave_reference (const string& name, const string& file)
 {
 #if defined (WITH_DL)
 
@@ -302,26 +169,22 @@
 
   return shl_resolve_octave_reference (name, file);
 
-#elif defined (WITH_DLD)
-
-  return dld_resolve_octave_reference (name, file);
-
 #endif
 }
 #endif
 
 Octave_builtin_fcn
 #if defined (WITH_DYNAMIC_LINKING)
-load_octave_builtin (const char *name)
+load_octave_builtin (const string& name)
 #else
-load_octave_builtin (const char *)
+load_octave_builtin (const string&)
 #endif
 {
   Octave_builtin_fcn retval = 0;
 
 #if defined (WITH_DYNAMIC_LINKING)
 
-  char *mangled_name = mangle_octave_builtin_name (name);
+  string mangled_name = mangle_octave_builtin_name (name);
 
   retval = (Octave_builtin_fcn) resolve_octave_reference (mangled_name);
 
@@ -333,17 +196,17 @@
 }
 
 int
-load_octave_oct_file (const char *name)
+load_octave_oct_file (const string& name)
 {
   int retval = 0;
 
 #if defined (WITH_DYNAMIC_LINKING)
 
-  char *oct_file = oct_file_in_path (name);
+  string oct_file = oct_file_in_path (name);
 
   if (oct_file)
     {
-      char *mangled_name = mangle_octave_oct_file_name (name);
+      string mangled_name = mangle_octave_oct_file_name (name);
 
       Octave_builtin_fcn_struct_fcn f =
 	(Octave_builtin_fcn_struct_fcn) resolve_octave_reference
@@ -375,11 +238,7 @@
 void
 init_dynamic_linker (void)
 {
-#if defined (WITH_DLD)
-
-  octave_dld_init ();
-
-#endif
+  // Nothing to do anymore...
 }
 
 /*
--- a/src/dynamic-ld.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/dynamic-ld.h	Mon Jan 22 04:47:22 1996 +0000
@@ -28,9 +28,9 @@
 
 typedef Octave_object (*Octave_builtin_fcn)(const Octave_object&, int);
 
-extern Octave_builtin_fcn load_octave_builtin (const char *name);
+extern Octave_builtin_fcn load_octave_builtin (const string& name);
 
-extern int load_octave_oct_file (const char *name);
+extern int load_octave_oct_file (const string& name);
 
 extern void init_dynamic_linker (void);
 
--- a/src/file-info.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/file-info.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -43,7 +43,7 @@
   file_fptr = 0;
 }
 
-file_info::file_info (int n, const char *nm, FILE *t, const char *md)
+file_info::file_info (int n, const string& nm, FILE *t, const string& md)
 {
   file_number = n;
   file_name = nm;
--- a/src/file-info.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/file-info.h	Mon Jan 22 04:47:22 1996 +0000
@@ -37,7 +37,7 @@
 {
 public:
   file_info (void);
-  file_info (int num, const char *nm, FILE *t, const char *md);
+  file_info (int num, const string& nm, FILE *t, const string& md);
   file_info (const file_info& f);
 
   file_info& operator = (const file_info& f);
--- a/src/file-io.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/file-io.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -117,8 +117,7 @@
       int file_count = file_list.length ();
       for (int i = 0; i < file_count; i++)
 	{
-	  string tstr = arg.string_value ();
-	  const char *file_name = tstr.c_str ();
+	  string file_name = arg.string_value ();
 	  file = file_list (p);
 	  if (file.name () == file_name)
 	    return p;
@@ -156,10 +155,10 @@
 }
 
 static Pix 
-fopen_file_for_user (const char *name, const char *mode,
+fopen_file_for_user (const string& name, const char *mode,
 		     const char *warn_for)
 {
-  FILE *file_ptr = fopen (name, mode);
+  FILE *file_ptr = fopen (name.c_str (), mode);
   if (file_ptr)
     { 
       int file_number = get_next_avail_file_num ();
@@ -179,7 +178,7 @@
 	}
     }
 
-  error ("%s: unable to open file `%s'", warn_for, name);
+  error ("%s: unable to open file `%s'", warn_for, name.c_str ());
 
   return 0;
 }
@@ -194,11 +193,10 @@
     {
       if (arg.is_string ())
 	{
-	  string tstr = arg.string_value ();
-	  const char *name = tstr.c_str ();
+	  string name = arg.string_value ();
 
 	  struct stat buffer;
-	  int status = stat (name, &buffer);
+	  int status = stat (name.c_str (), &buffer);
 
 	  if (status == 0)
 	    {
@@ -210,7 +208,7 @@
 	  else if (status < 0 && *mode != 'r')
 	    p = fopen_file_for_user (name, mode, warn_for);
 	  else
-	    error ("%s: can't stat file `%s'", warn_for, name);
+	    error ("%s: can't stat file `%s'", warn_for, name.c_str ());
 	}
       else
 	error ("%s: invalid file specifier", warn_for);
@@ -319,16 +317,13 @@
 }
 
 static int
-valid_mode (const char *mode)
+valid_mode (const string& mode)
 {
-  if (mode)
+  if (! mode.empty ())
     {
       char m = mode[0];
       if (m == 'r' || m == 'w' || m == 'a')
-	{
-	  m = mode[1];
-	  return (m == '\0' || (m == '+' && mode[2] == '\0'));
-	}
+	return (mode.length () == 2) ? mode[1] == '+' : 1;
     }
   return 0;
 }
@@ -485,10 +480,8 @@
       return retval;
     }
 
-  string tstr1 = args(0).string_value ();
-  const char *name = tstr1.c_str ();
-  string tstr2 = args(1).string_value ();
-  const char *mode = tstr2.c_str ();
+  string name = args(0).string_value ();
+  string mode = args(1).string_value ();
 
   if (! valid_mode (mode))
     {
@@ -497,17 +490,18 @@
     }
 
   struct stat buffer;
-  if (stat (name, &buffer) == 0 && (buffer.st_mode & S_IFDIR) == S_IFDIR)
+  if (stat (name.c_str (), &buffer) == 0
+      && (buffer.st_mode & S_IFDIR) == S_IFDIR)
     {
       error ("fopen: can't open directory");
       return retval;
     }
 
-  FILE *file_ptr = fopen (name, mode);
+  FILE *file_ptr = fopen (name.c_str (), mode.c_str ());
 
   if (! file_ptr)
     {
-      error ("fopen: unable to open file `%s'", name);
+      error ("fopen: unable to open file `%s'", name.c_str ());
       return retval;
     }
 
@@ -941,8 +935,7 @@
 
     case 's':
       {
-	string tstr = args(fmt_arg_count++).string_value ();
-	const char *val = tstr.c_str ();
+	string val = args(fmt_arg_count++).string_value ();
 
 	if (error_state)
 	  goto invalid_conversion;
@@ -951,7 +944,7 @@
 	    chars_from_fmt_str++;
 	    fmt << *s << ends;
 	    char *tmp_fmt = fmt.str ();
-	    sb.form (tmp_fmt, val);
+	    sb.form (tmp_fmt, val.c_str ());
 	    delete [] tmp_fmt;
 	    return chars_from_fmt_str;
 	  }
@@ -959,17 +952,16 @@
 
     case 'c':
       {
-	string tstr = args(fmt_arg_count++).string_value ();
-	const char *val = tstr.c_str ();
-
-	if (error_state || strlen (val) != 1)
+	string val = args(fmt_arg_count++).string_value ();
+
+	if (error_state || val.length () != 1)
 	  goto invalid_conversion;
 	else
 	  {
 	    chars_from_fmt_str++;
 	    fmt << *s << ends;
 	    char *tmp_fmt = fmt.str ();
-	    sb.form (tmp_fmt, *val);
+	    sb.form (tmp_fmt, val[0]);
 	    delete [] tmp_fmt;
 	    return chars_from_fmt_str;
 	  }
@@ -1320,7 +1312,7 @@
   Octave_object retval;
   const char *scanf_fmt = 0;
   string scanf_fmt_str;
-  char *tmp_file = 0;
+  string tmp_file;
   int tmp_file_open = 0;
   FILE *fptr = 0;
   file_info file;
@@ -1394,14 +1386,14 @@
 
       tmp_file = octave_tmp_file_name ();
 
-      fptr = fopen (tmp_file, "w+");
+      fptr = fopen (tmp_file.c_str (), "w+");
       if (! fptr)
 	{
 	  error ("%s: error opening temporary file", type);
 	  return retval;
 	}
       tmp_file_open = 1;
-      unlink (tmp_file);
+      unlink (tmp_file.c_str ());
 
       if (! xstring)
 	{
@@ -1908,7 +1900,7 @@
   if (nargout > 1)
     retval(1) = (double) ierr;
 
-  retval(0) = strsave (strerror (ierr));
+  retval(0) = strerror (ierr);
 
   return retval;
 }
@@ -1959,29 +1951,28 @@
       return retval;
     }
 
-  string tstr1 = args(0).string_value ();
-  const char *name = tstr1.c_str ();
-  string tstr2 = args(1).string_value ();
-  const char *mode = tstr2.c_str ();
-
-  if (mode[1] || (mode[0] != 'w' && mode[0] != 'r'))
+  string name = args(0).string_value ();
+  string mode = args(1).string_value ();
+
+  if (mode.length () > 1 || (mode[0] != 'w' && mode[0] != 'r'))
     {
       error ("popen: invalid mode, must be either \"r\" or \"w\".");
       return retval;
     }
 
   struct stat buffer;
-  if (stat (name, &buffer) == 0 && (buffer.st_mode & S_IFDIR) == S_IFDIR)
+  if (stat (name.c_str (), &buffer) == 0
+      && (buffer.st_mode & S_IFDIR) == S_IFDIR)
     {
       error ("popen: can't open directory");
       return retval;
     }
 
-  FILE *file_ptr = popen (name, mode);
+  FILE *file_ptr = popen (name.c_str (), mode.c_str ());
 
   if (! file_ptr)
     {
-      error ("popen: unable to start process `%s'", name);
+      error ("popen: unable to start process `%s'", name.c_str ());
       return retval;
     }
 
@@ -2084,8 +2075,7 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  const char *name = tstr.c_str ();
+  string name = args(0).string_value ();
 
   if (pipe (stdin_pipe) || pipe (stdout_pipe)) 
     {
@@ -2112,8 +2102,8 @@
       dup2 (stdout_pipe[1], STDOUT_FILENO);
       close (stdout_pipe[1]);
 
-      if (execlp (name, name, 0) == -1)
-	error ("execute: unable to start process `%s'", name);
+      if (execlp (name.c_str (), name.c_str (), 0) == -1)
+	error ("execute: unable to start process `%s'", name.c_str ());
 
       exit (0);
       return 0.0;
@@ -2177,10 +2167,9 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  const char *name = tstr.c_str ();
-
-  retval (0) = (double) system (name);
+  string name = args(0).string_value ();
+
+  retval (0) = (double) system (name.c_str ());
   return retval;
 }
 
@@ -2213,8 +2202,7 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  const char *name = tstr.c_str ();
+  string name = args(0).string_value ();
 
   pid = fork ();
 
@@ -2226,7 +2214,7 @@
 
   if (pid == 0) 
     {
-      system (name);
+      system (name.c_str ());
       exit (0);
       retval (0) = 0.0;
       return retval;
@@ -2347,8 +2335,7 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  const char *name = tstr.c_str ();
+  string name = args(0).string_value ();
 
   if (! args(1).is_scalar_type ())
     {
@@ -2358,7 +2345,7 @@
 
   long mode = (long) args(1).double_value ();
 
-  retval (0) = (double) mkfifo (name, mode);
+  retval (0) = (double) mkfifo (name.c_str (), mode);
 
   return retval;
 }
@@ -2397,10 +2384,9 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  const char *name = tstr.c_str ();
-
-  retval (0) = (double) unlink (name);
+  string name = args(0).string_value ();
+
+  retval (0) = (double) unlink (name.c_str ());
 
   return retval;
 }
--- a/src/fsolve.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/fsolve.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -242,7 +242,7 @@
 }
 
 static void
-set_fsolve_option (const char *keyword, double val)
+set_fsolve_option (const string& keyword, double val)
 {
   NLEQN_OPTIONS *list = fsolve_option_table;
 
@@ -258,11 +258,11 @@
       list++;
     }
 
-  warning ("fsolve_options: no match for `%s'", keyword);
+  warning ("fsolve_options: no match for `%s'", keyword.c_str ());
 }
 
 static Octave_object
-show_fsolve_option (const char *keyword)
+show_fsolve_option (const string& keyword)
 {
   Octave_object retval;
 
@@ -278,7 +278,7 @@
       list++;
     }
 
-  warning ("fsolve_options: no match for `%s'", keyword);
+  warning ("fsolve_options: no match for `%s'", keyword.c_str ());
 
   return retval;
 }
@@ -301,8 +301,7 @@
     }
   else if (nargin == 1 || nargin == 2)
     {
-      string tstr = args(0).string_value ();
-      const char *keyword = tstr.c_str ();
+      string keyword = args(0).string_value ();
 
       if (! error_state)
 	{
--- a/src/help.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/help.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -29,6 +29,8 @@
 #include <cstdlib>
 #include <cstring>
 
+#include <string>
+
 #include <iostream.h>
 #include <strstream.h>
 
@@ -37,18 +39,20 @@
 #include <unistd.h>
 #endif
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "dirfns.h"
 #include "error.h"
 #include "help.h"
-#include "toplev.h"
+#include "oct-obj.h"
 #include "pager.h"
 #include "pathsearch.h"
+#include "pt-const.h"
+#include "pt-exp.h"
 #include "sighandlers.h"
 #include "symtab.h"
-#include "pt-const.h"
-#include "oct-obj.h"
-#include "pt-exp.h"
+#include "toplev.h"
 #include "unwind-prot.h"
 #include "user-prefs.h"
 #include "utils.h"
@@ -264,9 +268,11 @@
 
 // Return a copy of the operator or keyword names.
 
-char **
+string_vector
 names (help_list *lst, int& count)
 {
+  string_vector retval;
+
   count = 0;
   help_list *ptr = lst;
   while (ptr->name)
@@ -275,21 +281,19 @@
       ptr++;
     }
 
-  if (count == 0)
-    return 0;
-    
-  char **name_list = new char * [count+1];
+  if (count > 0)
+    {
+      retval.resize (count);
 
-  ptr = lst;
-  int i = 0;
-  while (ptr->name)
-    {
-      name_list[i++] = strsave (ptr->name);
-      ptr++;
+      ptr = lst;
+      for (int i = 0; i < count; i++)
+	{
+	  retval[i] = ptr->name;
+	  ptr++;
+	}
     }
 
-  name_list[i] = 0;
-  return name_list;
+  return retval;
 }
 
 help_list *
@@ -321,17 +325,18 @@
 }
 
 void
-print_usage (const char *string, int just_usage)
+print_usage (const string& nm, int just_usage)
 {
   ostrstream output_buf;
 
-  symbol_record *sym_rec = global_sym_tab->lookup (string, 0, 0);
+  symbol_record *sym_rec = global_sym_tab->lookup (nm, 0, 0);
   if (sym_rec)
     {
-      char *h = sym_rec->help ();
-      if (h && *h)
+      string h = sym_rec->help ();
+
+      if (h.length () > 0)
 	{
-	  output_buf << "\n*** " << string << ":\n\n"
+	  output_buf << "\n*** " << nm << ":\n\n"
 	    << h << "\n";
 
 	  if (! just_usage)
@@ -341,7 +346,7 @@
 	}
     }
   else
-    warning ("no usage message found for `%s'", string);
+    warning ("no usage message found for `%s'", nm.c_str ());
 }
 
 static void
@@ -349,27 +354,29 @@
 			      const char *desc)
 {
   int count = 0;
-  char **symbols = names (list, count);
+  string_vector symbols = names (list, count);
   output_buf << "\n*** " << desc << ":\n\n";
-  if (symbols && count > 0)
+  if (symbols.length () > 0)
     list_in_columns (output_buf, symbols);
-  delete [] symbols;
 }
 
-static char *
+static string
 print_symbol_type (ostrstream& output_buf, symbol_record *sym_rec,
-		   char *name, int print)
+		   const string& name, int print)
 {
-  char *retval = 0;
+  string retval;
 
   if (sym_rec->is_user_function ())
     {
       tree_fvc *defn = sym_rec->def ();
-      char *fn = defn->fcn_file_name ();
-      if (fn)
+
+      string fn = defn->fcn_file_name ();
+
+      if (! fn.empty ())
 	{
-	  char *ff = fcn_file_in_path (fn);
-	  ff = ff ? ff : fn;
+	  string ff = fcn_file_in_path (fn);
+
+	  ff = ff.length () > 0 ? ff : fn;
 
 	  if (print)
 	    output_buf << name
@@ -427,11 +434,11 @@
 }
 
 static void
-display_symtab_names (ostrstream& output_buf, char **names,
-		      int count, const char *desc)
+display_symtab_names (ostrstream& output_buf, const string_vector& names,
+		      int /* count */, const string& desc)
 {
   output_buf << "\n*** " << desc << ":\n\n";
-  if (names && count > 0)
+  if (names.length () > 0)
     list_in_columns (output_buf, names);
 }
 
@@ -453,12 +460,8 @@
   do \
     { \
       int count; \
-      char **names = global_sym_tab->list (count, 0, 0, 1, type); \
+      string_vector names = global_sym_tab->list (count, 0, 0, 1, type); \
       display_symtab_names (output_buf, names, count, msg); \
-      char **ptr = names; \
-      while (*ptr) \
-        delete [] *ptr++; \
-      delete [] names; \
     } \
   while (0)
 
@@ -478,7 +481,7 @@
 
   // Also need to search octave_path for script files.
 
-  char *path_elt = kpse_path_element (user_pref.loadpath);
+  char *path_elt = kpse_path_element (user_pref.loadpath.c_str ());
 
   while (path_elt)
     {
@@ -492,16 +495,14 @@
 	  if (elt_dir)
 	    {
 	      int count;
-	      char **names = get_fcn_file_names (count, elt_dir, 0);
+	      string_vector names = get_fcn_file_names (count, elt_dir, 0);
 
 	      output_buf << "\n*** function files in "
 		<< make_absolute (elt_dir, the_current_working_directory)
 		  << ":\n\n";
 
-	      if (names && count > 0)
+	      if (names.length () > 0)
 		list_in_columns (output_buf, names);
-
-	      delete [] names;
 	    }
 	}
 
@@ -515,7 +516,7 @@
 
 #ifdef USE_GNU_INFO
 static int
-try_info (const char *string)
+try_info (const string& nm)
 {
   int status = 0;
 
@@ -528,18 +529,17 @@
 
   cmd_buf << user_pref.info_prog << " --file " << user_pref.info_file;
 
-  char *directory_name = strsave (user_pref.info_file);
-  char *file = strrchr (directory_name, '/');
-  if (file)
+  string directory_name = user_pref.info_file;
+  size_t pos = directory_name.rfind ('/');
+
+  if (pos != NPOS)
     {
-      file++;
-      *file = 0;
+      directory_name.resize (pos + 1);
       cmd_buf << " --directory " << directory_name;
     }
-  delete [] directory_name;
 
-  if (string)
-    cmd_buf << " --index-search " << string;
+  if (nm.length () > 0)
+    cmd_buf << " --index-search " << nm;
 
   cmd_buf << ends;
 
@@ -562,21 +562,16 @@
 #endif
 
 static void
-help_from_info (int argc, char **argv)
+help_from_info (const string_vector& argv, int idx, int argc)
 {
 #ifdef USE_GNU_INFO
-  if (argc == 1)
-    try_info (0);
+  if (idx == argc)
+    try_info (string ());
   else
     {
-      while (--argc > 0)
+      for (int i = idx; i < argc; i++)
 	{
-	  argv++;
-
-	  if (! *argv || ! **argv)
-	    continue;
-
-	  int status = try_info (*argv);
+	  int status = try_info (argv[i]);
 
 	  if (status)
 	    {
@@ -584,7 +579,7 @@
 		{
 		  message ("help",
 			   "sorry, `%s' is not indexed in the manual",
-			   *argv);
+			   argv[i].c_str ());
 		  sleep (2);
 		}
 	      else
@@ -602,18 +597,18 @@
 
 int
 help_from_list (ostrstream& output_buf, const help_list *list,
-		const char *string, int usage)
+		const string& nm, int usage)
 {
   char *name;
   while ((name = list->name) != 0)
     {
-      if (strcmp (name, string) == 0)
+      if (strcmp (name, nm.c_str ()) == 0)
 	{
 	  if (usage)
 	    output_buf << "\nusage: ";
 	  else
 	    {
-	      output_buf << "\n*** " << string << ":\n\n";
+	      output_buf << "\n*** " << nm << ":\n\n";
 	    }
 
 	  output_buf << list->help << "\n";
@@ -626,52 +621,48 @@
 }
 
 static void
-builtin_help (int argc, char **argv)
+builtin_help (int argc, const string_vector& argv)
 {
   ostrstream output_buf;
 
   help_list *op_help_list = operator_help ();
   help_list *kw_help_list = keyword_help ();
 
-  while (--argc > 0)
+  for (int i = 1; i < argc; i++)
     {
-      argv++;
-
-      if (! *argv || ! **argv)
+      if (help_from_list (output_buf, op_help_list, argv[i], 0))
 	continue;
 
-      if (help_from_list (output_buf, op_help_list, *argv, 0))
+      if (help_from_list (output_buf, kw_help_list, argv[i], 0))
 	continue;
 
-      if (help_from_list (output_buf, kw_help_list, *argv, 0))
-	continue;
-
-      symbol_record *sym_rec = lookup_by_name (*argv, 0);
+      symbol_record *sym_rec = lookup_by_name (argv[i], 0);
 
       if (sym_rec && sym_rec->is_defined ())
 	{
-	  char *h = sym_rec->help ();
-	  if (h && *h)
+	  string h = sym_rec->help ();
+
+	  if (h.length () > 0)
 	    {
-	      print_symbol_type (output_buf, sym_rec, *argv, 1);
+	      print_symbol_type (output_buf, sym_rec, argv[i], 1);
 	      output_buf << "\n" << h << "\n";
 	      continue;
 	    }
 	}
 
-      char *path = fcn_file_in_path (*argv);
-      char *h = get_help_from_file (path);
-      if (h && *h)
+      string path = fcn_file_in_path (argv[i]);
+
+      string h = get_help_from_file (path);
+
+      if (! h.empty ())
 	{
-	  output_buf << *argv << " is the file:\n"
+	  output_buf << argv[i] << " is the file:\n"
 	    << path << "\n\n" << h << "\n";
-	  delete [] h;
-	  delete [] path;
+
 	  continue;
 	}
-      delete [] path;
 
-      output_buf << "\nhelp: sorry, `" << *argv << "' is not documented\n"; 
+      output_buf << "\nhelp: sorry, `" << argv[i] << "' is not documented\n"; 
     }
 
   additional_help_message (output_buf);
@@ -693,7 +684,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("help");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "help");
+
+  if (error_state)
+    return retval;
 
   if (argc == 1)
     {
@@ -701,12 +697,9 @@
     }
   else
     {
-      if (argv[1] && strcmp (argv[1], "-i") == 0)
+      if (argv[1] == "-i")
 	{
-	  argc--;
-	  argv++;
-
-	  help_from_info (argc, argv);
+	  help_from_info (argv, 2, argc);
 	}
       else
 	{
@@ -714,8 +707,6 @@
 	}
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -728,41 +719,44 @@
 
   begin_unwind_frame ("Ftype");
 
-  unwind_protect_ptr (user_pref.ps4);
-  user_pref.ps4 = "";
+  // XXX FIXME XXX -- need a way to protect strings.
+  //  unwind_protect_ptr (user_pref.ps4);
+  //  user_pref.ps4 = "";
 
-  DEFINE_ARGV("type");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "type");
+
+  if (error_state)
+    return retval;
 
   if (argc > 1)
     {
       // XXX FIXME XXX -- we should really use getopt ()
 
       int quiet = 0;
-      if (argv[1] && strcmp (argv[1], "-q") == 0)
+      int idx = 1;
+      if (argv[idx] == "-q")
 	{
 	  quiet = 1;
-	  argc--;
-	  argv++;
+	  idx++;
 	}
 
       ostrstream output_buf;
 
-      while (--argc > 0)
+      for (int i = idx; i < argc; i++)
 	{
-	  argv++;
-
-	  if (! *argv || ! **argv)
-	    continue;
+	  string id = argv[i];
+	  string elts;
 
-	  char *id = strsave (*argv);
-	  char *elts = 0;
-	  if (id[strlen (id) - 1] != '.')
+	  if (id[id.length () - 1] != '.')
 	    {
-	      char *ptr = strchr (id, '.');
-	      if (ptr)
+	      size_t pos = id.find ('.');
+
+	      if (pos != NPOS)
 		{
-		  *ptr = '\0';
-		  elts = ptr + 1;
+		  id = id.substr (0, pos);
+		  elts = id.substr (pos+1);
 		}
 	    }
 
@@ -775,7 +769,7 @@
 		  tree_fvc *defn = sym_rec->def ();
 
 		  if (nargout == 0 && ! quiet)
-		    output_buf << *argv << " is a user-defined function\n";
+		    output_buf << argv[i] << " is a user-defined function\n";
 
 		  defn->print_code (output_buf);
 		}
@@ -784,9 +778,9 @@
 	      // Fwhich.
 
 	      else if (sym_rec->is_text_function ())
-		output_buf << *argv << " is a builtin text-function\n";
+		output_buf << argv[i] << " is a builtin text-function\n";
 	      else if (sym_rec->is_builtin_function ())
-		output_buf << *argv << " is a builtin function\n";
+		output_buf << argv[i] << " is a builtin function\n";
 	      else if (sym_rec->is_user_variable ()
 		       || sym_rec->is_builtin_variable ())
 		{
@@ -799,7 +793,7 @@
 		  int var_ok = 1;
 		  if (tmp && tmp->is_map ())
 		    {
-		      if (elts && *elts)
+		      if (! elts.empty ())
 			{
 			  tree_constant ult =
 			    tmp->lookup_map_element (elts, 0, 1);
@@ -813,7 +807,7 @@
 		    {
 		      if (var_ok)
 			{
-			  output_buf << *argv;
+			  output_buf << argv[i];
 			  if (sym_rec->is_user_variable ())
 			    output_buf << " is a user-defined variable\n";
 			  else
@@ -821,7 +815,7 @@
 			}
 		      else
 			{
-			  if (elts && *elts)
+			  if (! elts.empty ())
 			    output_buf << "type: structure `" << id
 			      << "' has no member `" << elts << "'\n";
 			  else
@@ -838,12 +832,10 @@
 		    }
 		}
 	      else
-		output_buf << "type: `" << *argv << "' has unknown type!\n";
+		output_buf << "type: `" << argv[i] << "' has unknown type!\n";
 	    }
 	  else
-	    output_buf << "type: `" << *argv << "' undefined\n";
-
-	  delete [] id;
+	    output_buf << "type: `" << argv[i] << "' undefined\n";
 	}
 
       output_buf << ends;
@@ -860,8 +852,6 @@
   else
     print_usage ("type");
 
-  DELETE_ARGV;
-
   run_unwind_frame ("Ftype");
 
   return retval;
@@ -875,7 +865,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("which");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "which");
+
+  if (error_state)
+    return retval;
 
   if (argc > 1)
     {
@@ -884,27 +879,22 @@
 
       ostrstream output_buf;
 
-      for (int i = 0; i < argc-1; i++)
+      for (int i = 1; i < argc; i++)
 	{
-	  argv++;
-
-	  if (! *argv || ! **argv)
-	    continue;
-
-	  symbol_record *sym_rec = lookup_by_name (*argv, 0);
+	  symbol_record *sym_rec = lookup_by_name (argv[i], 0);
 
 	  if (sym_rec)
 	    {
 	      int print = (nargout == 0);
-	      char *tmp = print_symbol_type (output_buf, sym_rec,
-					     *argv, print);
+	      string tmp = print_symbol_type (output_buf, sym_rec,
+					      argv[i], print);
 	      if (! print)
 		retval(i) = tmp;
 	    }
 	  else
 	    {
 	      if (nargout == 0)
-		output_buf << "which: `" << *argv << "' is undefined\n";
+		output_buf << "which: `" << argv[i] << "' is undefined\n";
 	      else
 		retval(i) = "undefined";
 	    }
@@ -915,8 +905,6 @@
   else
     print_usage ("which");
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/help.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/help.h	Mon Jan 22 04:47:22 1996 +0000
@@ -26,22 +26,28 @@
 
 class ostrstream;
 
-typedef struct help_list
+#include <string>
+
+class string_vector;
+
+// XXX FIXME XXX -- should probably use string, not char*.
+
+struct help_list
 {
   char *name;
   char *help;
 };
 
-extern char **names (help_list *l, int& count);
+extern string_vector names (help_list *l, int& count);
 extern help_list *operator_help (void);
 extern help_list *keyword_help (void);
 
+extern void print_usage (const string& nm, int just_usage = 0);
+
 extern int help_from_list (ostrstream& output_buf,
-			   const help_list *list, const char *string,
+			   const help_list *list, const string& nm,
 			   int usage);
 
-extern void print_usage (const char *s, int just_usage = 0);
-
 #endif
 
 /*
--- a/src/input.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/input.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -91,6 +91,8 @@
     return readline (s);
 }
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "dirfns.h"
 #include "error.h"
@@ -99,14 +101,14 @@
 #include "oct-map.h"
 #include "oct-hist.h"
 #include "toplev.h"
+#include "oct-obj.h"
 #include "pager.h"
 #include "parse.h"
 #include "pathlen.h"
+#include "pt-const.h"
 #include "sighandlers.h"
 #include "symtab.h"
 #include "sysdep.h"
-#include "pt-const.h"
-#include "oct-obj.h"
 #include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
@@ -122,7 +124,7 @@
 #endif
 
 // Global pointer for eval().
-const char *current_eval_string = 0;
+string current_eval_string;
 
 // Nonzero means get input from current_eval_string.
 int get_input_from_eval_string = 0;
@@ -131,10 +133,10 @@
 int reading_fcn_file = 0;
 
 // Simple name of function file we are reading.
-const char *curr_fcn_file_name = 0;
+string curr_fcn_file_name;
 
 // Full name of file we are reading.
-const char *curr_fcn_file_full_name = 0;
+string curr_fcn_file_full_name;
 
 // Nonzero means we're parsing a script file.
 int reading_script_file = 0;
@@ -155,53 +157,31 @@
 int promptflag = 1;
 
 // The current line of input, from wherever.
-char *current_input_line = 0;
+string current_input_line;
 
 // A line of input from readline.
 static char *octave_gets_line = 0;
 
-// Append SOURCE to TARGET at INDEX.  SIZE is the current amount of
-// space allocated to TARGET.  SOURCE can be NULL, in which case
-// nothing happens.  Gets rid of SOURCE by free ()ing it.  Returns
-// TARGET in case the location has changed.
-
-static char *
-sub_append_string (char *source, char *target, int *index, int *size)
-{
-  if (source)
-    {
-      while ((int)strlen (source) >= (int)(*size - *index))
-	{
-	  char *tmp = new char [*size += DEFAULT_ARRAY_SIZE];
-	  strcpy (tmp, target);
-	  delete [] target;
-	  target = tmp;
-	}
-
-      strcat (target, source);
-      *index += strlen (source);
-
-      delete [] source;
-    }
-  return target;
-}
-
 // Return the octal number parsed from STRING, or -1 to indicate that
 // the string contained a bad number.
 
 int
-read_octal (const char *string)
+read_octal (const string& s)
 {
   int result = 0;
   int digits = 0;
 
-  while (*string && *string >= '0' && *string < '8')
+  size_t i = 0;
+  size_t slen = s.length ();
+
+  while (i < slen && s[i] >= '0' && s[i] < '8')
     {
       digits++;
-      result = (result * 8) + *string++ - '0';
+      result = (result * 8) + s[i] - '0';
+      i++;
     }
 
-  if (! digits || result > 0777 || *string)
+  if (! digits || result > 0777 || i < slen)
     result = -1;
 
   return result;
@@ -224,21 +204,24 @@
 //	\<octal> character code in octal
 //	\\	a backslash
 
-static char *
-decode_prompt_string (const char *string)
+static string
+decode_prompt_string (const string& s)
 {
-  int result_size = PROMPT_GROWTH;
-  int result_index = 0;
-  char *result = new char [PROMPT_GROWTH];
+  string result;
+  string temp;
+  size_t i = 0;
+  size_t slen = s.length ();
   int c;
-  char *temp = 0;
 
-  result[0] = 0;
-  while ((c = *string++))
+  while (i < slen)
     {
+      c = s[i];
+
+      i++;
+
       if (c == '\\')
 	{
-	  c = *string;
+	  c = s[i];
 
 	  switch (c)
 	    {
@@ -250,19 +233,15 @@
 	    case '5':
 	    case '6':
 	    case '7':
+	      // Maybe convert an octal number.
 	      {
-		char octal_string[4];
-		int n;
+		int n = read_octal (s.substr (i, 3));
 
-		strncpy (octal_string, string, 3);
-		octal_string[3] = '\0';
+		temp = "\\";
 
-		n = read_octal (octal_string);
-
-		temp = strsave ("\\");
 		if (n != -1)
 		  {
-		    string += 3;
+		    i += 3;
 		    temp[0] = n;
 		  }
 
@@ -272,84 +251,84 @@
 	  
 	    case 't':
 	    case 'd':
-	      /* Make the current time/date into a string. */
+	      // Make the current time/date into a string.
 	      {
-		time_t the_time = time (0);
-		char *ttemp = ctime (&the_time);
-		temp = strsave (ttemp);
+		time_t now = time (0);
+
+		temp = ctime (&now);
 
 		if (c == 't')
 		  {
-		    strcpy (temp, temp + 11);
-		    temp[8] = '\0';
+		    temp = temp.substr (11);
+		    temp.resize (8);
 		  }
 		else
-		  temp[10] = '\0';
+		  temp.resize (10);
 
 		goto add_string;
 	      }
 
 	    case 'n':
-	      if (! no_line_editing)
-		temp = strsave ("\r\n");
-	      else
-		temp = strsave ("\n");
-	      goto add_string;
+	      {
+		if (! no_line_editing)
+		  temp = "\r\n";
+		else
+		  temp = "\n";
+
+		goto add_string;
+	      }
 
 	    case 's':
 	      {
 		temp = base_pathname (prog_name);
-		temp = strsave (temp);
+
 		goto add_string;
 	      }
 	
 	    case 'w':
 	    case 'W':
 	      {
-		char t_string[MAXPATHLEN];
 #define EFFICIENT
 #ifdef EFFICIENT
-
 		// Use the value of PWD because it is much more
 		// effecient.
 
 		temp = user_pref.pwd;
 
-		if (! temp)
-		  octave_getcwd (t_string, MAXPATHLEN);
-		else
-		  strcpy (t_string, temp);
+		if (temp.empty ())
+		  temp = octave_getcwd ();
 #else
-		octave_getcwd (t_string, MAXPATHLEN);
+		temp = octave_getcwd ();
 #endif	/* EFFICIENT */
 
 		if (c == 'W')
 		  {
-		    char *dir = strrchr (t_string, '/');
-		    if (dir && dir != t_string)
-		      strcpy (t_string, dir + 1);
-		    temp = strsave (t_string);
+		    size_t pos = temp.rfind ('/');
+
+		    if (pos != NPOS && pos != 0)
+		      temp = temp.substr (pos + 1);
 		  }
 		else
-		  temp = strsave (polite_directory_format (t_string));
+		  temp = polite_directory_format (temp);
+
 		goto add_string;
 	      }
       
 	    case 'u':
 	      {
-		temp = strsave (user_name);
+		temp = user_name;
 
 		goto add_string;
 	      }
 
 	    case 'h':
 	      {
-		char *t_string;
+		temp = host_name;
 
-		temp = strsave (host_name);
-		t_string = strchr (temp, '.');
-		if (t_string);
-		  *t_string = '\0';
+		size_t pos = temp.find ('.');
+
+		if (pos != NPOS)
+		  temp.resize (pos);
 		
 		goto add_string;
 	      }
@@ -358,7 +337,8 @@
 	      {
 		char number_buffer[128];
 		sprintf (number_buffer, "%d", current_command_number);
-		temp = strsave (number_buffer);
+		temp = number_buffer;
+
 		goto add_string;
 	      }
 
@@ -370,77 +350,66 @@
                   sprintf (number_buffer, "%d", num);
 		else
 		  strcpy (number_buffer, "!");
-		temp = strsave (number_buffer);
+		temp = number_buffer;
+
 		goto add_string;
 	      }
 
 	    case '$':
-	      temp = strsave (geteuid () == 0 ? "#" : "$");
-	      goto add_string;
+	      {
+		temp = (geteuid () == 0 ? "#" : "$");
+
+		goto add_string;
+	      }
 
 	    case '[':
 	    case ']':
-	      temp = new char[3];
-              temp[0] = '\001';
-              temp[1] = ((c == '[')
-			 ? RL_PROMPT_START_IGNORE
-			 : RL_PROMPT_END_IGNORE);
-              temp[2] = '\0';
-	      goto add_string;
+	      {
+		temp.resize (2);
+
+		temp[0] = '\001';
+		temp[1] = ((c == '[')
+			   ? RL_PROMPT_START_IGNORE
+			   : RL_PROMPT_END_IGNORE);
+
+		goto add_string;
+	      }
 
 	    case '\\':
-	      temp = strsave ("\\");
-	      goto add_string;
+	      {
+		temp = "\\";
+
+		goto add_string;
+	      }
 
 	    default:
-	      temp = strsave ("\\ ");
-	      temp[1] = c;
+	      {
+		temp = "\\ ";
+		temp[1] = c;
+
+		goto add_string;
+	      }
 
 	    add_string:
-	      if (c)
-		string++;
-	      result =
-		(char *)sub_append_string (temp, result,
-					   &result_index, &result_size);
-	      temp = 0; // Free ()'ed in sub_append_string ().
-	      result[result_index] = '\0';
-	      break;
+	      {
+		if (c)
+		  i++;
+
+		result.append (temp);
+
+		break;
+	      }
 	    }
 	}
       else
-	{
-	  while (3 + result_index > result_size)
-	    {
-	      char *tmp = new char [result_size += PROMPT_GROWTH];
-	      strcpy (tmp, result);
-	      delete [] result;
-	      result = tmp;
-	    }
-	  result[result_index++] = c;
-	  result[result_index] = '\0';
-	}
+	result += c;
     }
 
-#if 0
-  // I don't really think that this is a good idea.  Do you?
-
-  if (! find_variable ("NO_PROMPT_VARS"))
-    {
-      WORD_LIST *expand_string (), *list;
-      char *string_list ();
-
-      list = expand_string (result, 1);
-      free (result);
-      result = string_list (list);
-      dispose_words (list);
-    }
-#endif
-
   return result;
 }
 
 static void
-do_input_echo (const char *input_string)
+do_input_echo (const string& input_string)
 {
   int do_echo = reading_script_file ?
     (user_pref.echo_executing_commands & ECHO_SCRIPTS)
@@ -452,23 +421,19 @@
 
       if (forced_interactive)
 	{
-	  char *ps = (promptflag > 0) ? user_pref.ps1 : user_pref.ps2;
-	  char *prefix = decode_prompt_string (ps);
-	  buf << prefix;
-	  delete [] prefix;
+	  if (promptflag > 0)
+	    buf << decode_prompt_string (user_pref.ps1);
+	  else
+	    buf << decode_prompt_string (user_pref.ps2);
 	}
       else
-	{
-	  char *prefix = decode_prompt_string (user_pref.ps4);
-	  buf << prefix;
-	  delete [] prefix;
-	}
+	buf << decode_prompt_string (user_pref.ps4);
 
-      if (input_string)
+      if (! input_string.empty ())
 	{
 	  buf << input_string;
-	  int len = strlen (input_string);
-	  if (input_string[len-1] != '\n')
+
+	  if (input_string[input_string.length () - 1] != '\n')
 	    buf << "\n";
 	}
 
@@ -490,8 +455,10 @@
 
   if (interactive || forced_interactive)
     {
-      char *ps = (promptflag > 0) ? user_pref.ps1 : user_pref.ps2;
-      char *prompt = decode_prompt_string (ps);
+      const char *ps = (promptflag > 0) ? user_pref.ps1.c_str () :
+	user_pref.ps2.c_str ();
+
+      const char *prompt = decode_prompt_string (ps).c_str ();
 
       if (interactive)
 	{
@@ -527,18 +494,17 @@
 // Read a line from the input stream.
 
 int
-octave_read (char *buf, int max_size)
+octave_read (char *buf, unsigned max_size)
 {
   int status = 0;
 
-  static char *stashed_line = 0;
-
   if (get_input_from_eval_string)
     {
-      int len = strlen (current_eval_string);
+      size_t len = current_eval_string.length ();
+
       if (len < max_size - 1)
 	{
-	  strcpy (buf, current_eval_string);
+	  strcpy (buf, current_eval_string.c_str ());
 	  buf[len++] = '\n';
 	  buf[len] = '\0';    // Paranoia.
 	  status = len;
@@ -546,18 +512,15 @@
       else
 	status = -1;
 
-      if (stashed_line)
-	delete [] stashed_line;
-
-      stashed_line = strsave (buf);
-      current_input_line = stashed_line;
+      current_input_line = buf;
     }
   else if (using_readline)
     {
       char *cp = octave_gets ();
       if (cp)
 	{
-	  int len = strlen (cp);
+	  size_t len = strlen (cp);
+
 	  if (len >= max_size)
 	    status = -1;
 	  else
@@ -583,7 +546,8 @@
 
       if (fgets (buf, max_size, curr_stream))
 	{
-	  int len = strlen (buf);
+	  size_t len = strlen (buf);
+
 	  if (len > max_size - 2)
 	    status = -1;
 	  else
@@ -599,12 +563,7 @@
       else
 	status = 0; // Tell yylex that we found EOF.
 
-      if (stashed_line)
-	delete [] stashed_line;
-
-      stashed_line = strsave (buf);
-
-      current_input_line = stashed_line;
+      current_input_line = buf;
 
       do_input_echo (current_input_line);
     }
@@ -647,11 +606,11 @@
   return rl_instream;
 }
 
-static char **
+static const char **
 generate_struct_completions (const char *text, char *& prefix,
 			     char *& hint)
 {
-  char **names = 0;
+  const char **names = 0;
 
   assert (text);
 
@@ -687,6 +646,8 @@
 
       if (def && def->is_map ())
 	{
+	  string_vector tmp_names;
+
 	  if (elts && *elts)
 	    {
 	      tree_constant ult = def->lookup_map_element (elts, 0, 1);
@@ -694,13 +655,23 @@
 	      if (ult.is_map ())
 		{
 		  Octave_map m = ult.map_value ();
-		  names = m.make_name_list ();
+		  tmp_names = m.make_name_list ();
 		}
 	    }
 	  else
 	    {
 	      Octave_map m = def->map_value ();
-	      names = m.make_name_list ();
+	      tmp_names = m.make_name_list ();
+	    }
+
+	  int n = tmp_names.length ();
+
+	  if (n > 0)
+	    {
+	      names = new const char * [n+1];
+	      for (int i = 0; i < n; i++)
+		names[i] = strsave (tmp_names[i].c_str ());
+	      names[n] = 0;
 	    }
 	}
     }
@@ -712,18 +683,30 @@
 
 // XXX FIXME XXX -- make this generate file names when appropriate.
 
-static char **
+static const char **
 generate_possible_completions (const char *text, char *& prefix,
 			       char *& hint)
 {
-  char **names = 0;
+  const char **names = 0;
 
   prefix = 0;
 
   if (text && *text && *text != '.' && strrchr (text, '.'))
     names = generate_struct_completions (text, prefix, hint);
   else
-    names = make_name_list ();
+    {
+      string_vector tmp_names = make_name_list ();
+
+      int n = tmp_names.length ();
+
+      if (n > 0)
+	{
+	  names = new const char * [n+1];
+	  for (int i = 0; i < n; i++)
+	    names[i] = strsave (tmp_names[i].c_str ());
+	  names[n] = 0;
+	}
+    }
 
   return names;
 }
@@ -785,7 +768,7 @@
   static int hint_len = 0;
 
   static int list_index = 0;
-  static char **name_list = 0;
+  static const char **name_list = 0;
 
   static int matches = 0;
 
@@ -795,7 +778,8 @@
 
       if (name_list)
 	{
-	  char **ptr = name_list;
+	  const char **ptr = name_list;
+
 	  while (ptr && *ptr)
 	    delete [] *ptr++;
 
@@ -831,7 +815,8 @@
 
   if (name_list && matches)
     {
-      char *name;
+      const char *name;
+
       while ((name = name_list[list_index]) != 0)
 	{
 	  list_index++;
@@ -1128,7 +1113,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV ("echo");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "echo");
+
+  if (error_state)
+    return retval;
 
   switch (argc)
     {
@@ -1144,10 +1134,11 @@
 
     case 2:
       {
-	char *arg = argv[1];
-	if (strcmp (arg, "on") == 0)
+	string arg = argv[1];
+
+	if (arg == "on")
 	  bind_builtin_variable ("echo_executing_commands", ECHO_SCRIPTS);
-	else if (strcmp (arg, "off") == 0)
+	else if (arg == "off")
 	  bind_builtin_variable ("echo_executing_commands", ECHO_OFF);
 	else
 	  print_usage ("echo");
@@ -1156,11 +1147,12 @@
 
     case 3:
       {
-	char *arg = argv[1];
-	if (strcmp (arg, "on") == 0 && strcmp (argv[2], "all") == 0)
+	string arg = argv[1];
+
+	if (arg == "on" && argv[2] == "all")
 	  bind_builtin_variable ("echo_executing_commands",
 				 (ECHO_SCRIPTS | ECHO_FUNCTIONS));
-	else if (strcmp (arg, "off") == 0 && strcmp (argv[2], "all") == 0)
+	else if (arg == "off" && argv[2] == "all")
 	  bind_builtin_variable ("echo_executing_commands", ECHO_OFF);
 	else
 	  print_usage ("echo");
@@ -1172,8 +1164,6 @@
       break;
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/input.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/input.h	Mon Jan 22 04:47:22 1996 +0000
@@ -30,13 +30,13 @@
 
 #include <string>
 
-extern int octave_read (char *buf, int max_size);
+extern int octave_read (char *buf, unsigned max_size);
 extern FILE *get_input_from_file (const string& name, int warn = 1);
 extern FILE *get_input_from_stdin (void);
 extern void initialize_readline (void);
 
 // Global pointer for eval().
-extern const char *current_eval_string;
+extern string current_eval_string;
 
 // Nonzero means get input from current_eval_string.
 extern int get_input_from_eval_string;
@@ -45,10 +45,10 @@
 extern int reading_fcn_file;
 
 // Simple name of function file we are reading.
-extern const char *curr_fcn_file_name;
+extern string curr_fcn_file_name;
 
 // Full name of file we are reading.
-extern const char *curr_fcn_file_full_name;
+extern string curr_fcn_file_full_name;
 
 // Nonzero means we're parsing a script file.
 extern int reading_script_file;
@@ -69,7 +69,7 @@
 extern int promptflag;
 
 // A line of input.
-extern char *current_input_line;
+extern string current_input_line;
 
 char *gnu_readline (const char *s);
 
--- a/src/lex.l	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/lex.l	Mon Jan 22 04:47:22 1996 +0000
@@ -476,7 +476,7 @@
 %} 
 
 {CCHAR} {
-    if (! help_buf && beginning_of_function && nesting_level.empty ())
+    if (help_buf.empty () && beginning_of_function && nesting_level.empty ())
       {
 	grab_help_text ();
 	beginning_of_function = 0;
@@ -681,9 +681,9 @@
   if (interactive && ! (reading_fcn_file || get_input_from_eval_string))
     yyrestart (stdin);
 
-// Delete the buffer for help text.
-  delete [] help_buf;
-  help_buf = 0;
+// Clear the buffer for help text.
+
+  help_buf.resize (0);
 }
 
 // Replace backslash escapes in a string with the real values.
@@ -1026,11 +1026,12 @@
 	      error ("function keyword invalid within a function body");
 
 	      if ((reading_fcn_file || reading_script_file)
-		  && curr_fcn_file_name)
+		  && ! curr_fcn_file_name.empty ())
 		error ("defining new function near line %d of file `%s.m'",
-		       input_line_number, curr_fcn_file_name);
+		       input_line_number, curr_fcn_file_name.c_str ());
 	      else
-		error ("defining new function near line %d", input_line_number);
+		error ("defining new function near line %d",
+		       input_line_number);
 
 	      return LEXICAL_ERROR;
 	    }
@@ -1076,10 +1077,7 @@
 static void
 grab_help_text (void)
 {
-  delete [] help_buf;
-  help_buf = 0;
-
-  ostrstream buf;
+  help_buf.resize (0);
 
   int in_comment = 1;
   int c = 0;
@@ -1088,7 +1086,8 @@
     {
       if (in_comment)
 	{
-	  buf << (char) c;
+	  help_buf += (char) c;
+
 	  if (c == '\n')
 	    in_comment = 0;
 	}
@@ -1115,16 +1114,6 @@
 
   if (c)
     yyunput (c, yytext);
-
-  buf << ends;
-
-  help_buf = buf.str ();
-
-  if (! help_buf || ! *help_buf)
-    {
-      delete [] help_buf;
-      help_buf = 0;
-    }
 }
 
 // Return 1 if the given character matches any character in the given
@@ -1834,7 +1823,7 @@
 	  else
 	    {
 	      warning ("ignoring trailing garbage after end of function\n\
-         near line %d of file `%s.m'", lineno, curr_fcn_file_name);
+         near line %d of file `%s.m'", lineno, curr_fcn_file_name.c_str ());
 	      
 	      yyunput ('\n', yytext);
 	      return;
--- a/src/load-save.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/load-save.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -38,6 +38,8 @@
 
 #include "fnmatch.h"
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "error.h"
 #include "gripes.h"
@@ -1256,7 +1258,7 @@
 // arbitrary comments, etc.  Someone should fix that.
 
 static char *
-read_ascii_data (istream& is, const char *filename, int& global,
+read_ascii_data (istream& is, const string& filename, int& global,
 		 tree_constant& tc)
 {
   // Read name for this entry or break on EOF.
@@ -1268,7 +1270,8 @@
 
   if (! *name)
     {
-      error ("load: empty name keyword found in file `%s'", filename);
+      error ("load: empty name keyword found in file `%s'",
+	     filename.c_str ());
       delete [] name;
       return 0;
     }
@@ -1276,7 +1279,8 @@
 
   if (! valid_identifier (name))
     {
-      error ("load: bogus identifier `%s' found in file `%s'", name, filename);
+      error ("load: bogus identifier `%s' found in file `%s'", name,
+	     filename.c_str ());
       delete [] name;
       return 0;
     }
@@ -1439,7 +1443,7 @@
 
   if (error_state)
     {
-      error ("load: reading file %s", filename);
+      error ("load: reading file %s", filename.c_str ());
       return 0;
     }
 
@@ -1518,7 +1522,7 @@
 
 static char *
 read_binary_data (istream& is, int swap, floating_point_format fmt,
-		  const char *filename, int& global,
+		  const string& filename, int& global,
 		  tree_constant& tc, char *&doc)
 {
   char tmp = 0;
@@ -1710,7 +1714,7 @@
 
     default:
     data_read_error:
-      error ("load: trouble reading binary file `%s'", filename);
+      error ("load: trouble reading binary file `%s'", filename.c_str ());
       delete [] name;
       name = 0;
       break;
@@ -1876,7 +1880,7 @@
 // This format provides no way to tag the data as global.
 
 static char *
-read_mat_binary_data (istream& is, const char *filename,
+read_mat_binary_data (istream& is, const string& filename,
 		      tree_constant& tc)
 {
   // These are initialized here instead of closer to where they are
@@ -1971,7 +1975,7 @@
   return name;
 
  data_read_error:
-  error ("load: trouble reading binary file `%s'", filename);
+  error ("load: trouble reading binary file `%s'", filename.c_str ());
   delete [] name;
   return 0;
 }
@@ -1979,11 +1983,12 @@
 // Return nonzero if NAME matches one of the given globbing PATTERNS.
 
 static int
-matches_patterns (char **patterns, int num_pat, char *name)
+matches_patterns (const string_vector& patterns, int pat_idx,
+		  int num_pat, char *name)
 {
-  while (num_pat-- > 0)
+  for (int i = pat_idx; i < num_pat; i++)
     {
-      if (fnmatch (*patterns++, name, __FNM_FLAGS) == 0)
+      if (fnmatch (patterns[i].c_str (), name, __FNM_FLAGS) == 0)
 	return 1;
     }
   return 0;
@@ -2074,10 +2079,10 @@
 }
 
 static Octave_object
-do_load (istream& stream, const char *orig_fname, int force,
+do_load (istream& stream, const string& orig_fname, int force,
 	 load_save_format format, floating_point_format flt_fmt,
-	 int list_only, int swap, int verbose, char **argv,
-	 int argc, int nargout)
+	 int list_only, int swap, int verbose, const string_vector& argv,
+	 int argv_idx, int argc, int nargout)
 {
   Octave_object retval;
 
@@ -2121,7 +2126,8 @@
 	{
 	  if (tc.is_defined ())
 	    {
-	      if (argc == 0 || matches_patterns (argv, argc, name))
+	      if (argv_idx == argc
+		  || matches_patterns (argv, argv_idx, argc, name))
 		{
 		  count++;
 		  if (list_only)
@@ -2153,7 +2159,7 @@
 	{
 	  if (count == 0)
 	    error ("load: are you sure `%s' is an Octave data file?",
-		   orig_fname);
+		   orig_fname.c_str ());
 
 	  delete [] name;
 	  delete [] doc;
@@ -2194,10 +2200,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV ("load");
-
-  argc--;
-  argv++;
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "load");
+
+  if (error_state)
+    return retval;
 
   int force = 0;
 
@@ -2210,65 +2218,52 @@
   int list_only = 0;
   int verbose = 0;
 
-  while (argc > 0)
+  int i;
+  for (i = 1; i < argc; i++)
     {
-      if (strcmp (*argv, "-force") == 0 || strcmp (*argv, "-f") == 0)
+      if (argv[i] == "-force" || argv[i] == "-f")
 	{
 	  force++;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-list") == 0 || strcmp (*argv, "-l") == 0)
+      else if (argv[i] == "-list" || argv[i] == "-l")
 	{
 	  list_only = 1;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-verbose") == 0 || strcmp (*argv, "-v") == 0)
+      else if (argv[i] == "-verbose" || argv[i] == "-v")
 	{
 	  verbose = 1;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-ascii") == 0 || strcmp (*argv, "-a") == 0)
+      else if (argv[i] == "-ascii" || argv[i] == "-a")
 	{
 	  format = LS_ASCII;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-binary") == 0 || strcmp (*argv, "-b") == 0)
+      else if (argv[i] == "-binary" || argv[i] == "-b")
 	{
 	  format = LS_BINARY;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-mat-binary") == 0 || strcmp (*argv, "-m") == 0)
+      else if (argv[i] == "-mat-binary" || argv[i] == "-m")
 	{
 	  format = LS_MAT_BINARY;
-	  argc--;
-	  argv++;
 	}
       else
 	break;
     }
 
-  if (argc < 1)
+  if (i == argc)
     {
       error ("load: you must specify a single file to read");
-      DELETE_ARGV;
       return retval;
     }
 
-  char *orig_fname = *argv;
+  string orig_fname = argv[i];
 
   floating_point_format flt_fmt = OCTAVE_UNKNOWN_FLT_FMT;
 
   int swap = 0;
 
-  if (strcmp (*argv, "-") == 0)
+  if (argv[i] == "-")
     {
-      argc--;
-      argv++;
+      i++;
 
       if (format != LS_UNKNOWN)
 	{
@@ -2278,7 +2273,7 @@
 	  // fix this using cin only.
 
 	  retval = do_load (cin, orig_fname, force, format, flt_fmt,
-			    list_only, swap, verbose, argv, argc,
+			    list_only, swap, verbose, argv, i, argc,
 			    nargout);
 	}
       else
@@ -2286,15 +2281,14 @@
     }
   else
     {
-      string fname = oct_tilde_expand (*argv);
+      string fname = oct_tilde_expand (argv[i]);
 
       if (format == LS_UNKNOWN)
 	format = get_file_format (fname, orig_fname);
 
       if (format != LS_UNKNOWN)
 	{
-	  argv++;
-	  argc--;
+	  i++;
 
 	  unsigned mode = ios::in;
 	  if (format == LS_BINARY || format == LS_MAT_BINARY)
@@ -2309,38 +2303,38 @@
 		  if (read_binary_file_header (file, swap, flt_fmt) < 0)
 		    {
 		      file.close ();
-		      DELETE_ARGV;
 		      return retval;
 		    }
 		}
 
 	      retval = do_load (file, orig_fname, force, format,
 				flt_fmt, list_only, swap, verbose,
-				argv, argc, nargout);
+				argv, i, argc, nargout);
 
 	      file.close ();
 	    }
 	  else
-	    error ("load: couldn't open input file `%s'", orig_fname);
+	    error ("load: couldn't open input file `%s'",
+		   orig_fname.c_str ());
 	}
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
 // Return nonzero if PATTERN has any special globbing chars in it.
 
 static int
-glob_pattern_p (char *pattern)
+glob_pattern_p (const string& pattern)
 {
-  char *p = pattern;
-  char c;
   int open = 0;
 
-  while ((c = *p++) != '\0')
+  int len = pattern.length ();
+
+  for (int i = 0; i < len; i++)
     {
+      char c = pattern[i];
+
       switch (c)
 	{
 	case '?':
@@ -2357,7 +2351,7 @@
 	  continue;
 	  
 	case '\\':
-	  if (*p++ == '\0')
+	  if (i == len - 1)
 	    return 0;
 
 	default:
@@ -2397,24 +2391,21 @@
 // binary format described above for read_binary_data.
 
 static int
-save_binary_data (ostream& os, const tree_constant& tc, char *name,
-		  char *doc, int mark_as_global, int save_as_floats) 
+save_binary_data (ostream& os, const tree_constant& tc,
+		  const string& name, const string& doc,
+		  int mark_as_global, int save_as_floats) 
 {
   int fail = 0;
 
-  FOUR_BYTE_INT name_len = 0;
-  if (name)
-    name_len = strlen (name);
+  FOUR_BYTE_INT name_len = name.length ();
 
   os.write (&name_len, 4);
-  os.write (name, name_len);
-
-  FOUR_BYTE_INT doc_len = 0;
-  if (doc)
-    doc_len = strlen (doc);
+  os << name;
+
+  FOUR_BYTE_INT doc_len = doc.length ();
 
   os.write (&doc_len, 4);
-  os.write (doc, doc_len);
+  os << doc;
 
   char tmp;
 
@@ -2542,7 +2533,8 @@
 // in the MatLab binary format.
 
 static int
-save_mat_binary_data (ostream& os, const tree_constant& tc, char *name) 
+save_mat_binary_data (ostream& os, const tree_constant& tc,
+		      const string& name) 
 {
   int fail = 0;
 
@@ -2564,10 +2556,10 @@
   FOUR_BYTE_INT imag = tc.is_complex_type () ? 1 : 0;
   os.write (&imag, 4);
 
-  FOUR_BYTE_INT name_len = name ? strlen (name) + 1 : 0;
+  FOUR_BYTE_INT name_len = name.length ();
 
   os.write (&name_len, 4);
-  os.write (name, name_len);
+  os << name;
 
   if (tc.is_real_scalar ())
     {
@@ -2705,7 +2697,7 @@
 
 // Save the data from TC along with the corresponding NAME, and global
 // flag MARK_AS_GLOBAL on stream OS in the plain text format described
-// above for load_ascii_data.  If NAME is null, the name: line is not
+// above for load_ascii_data.  If NAME is empty, the name: line is not
 // generated.  PRECISION specifies the number of decimal digits to print. 
 // If STRIP_NAN_AND_INF is nonzero, rows containing NaNs are deleted,
 // and Infinite values are converted to +/-OCT_RBV (A Real Big Value,
@@ -2720,7 +2712,7 @@
 
 int
 save_ascii_data (ostream& os, const tree_constant& tc,
-		 char *name, int strip_nan_and_inf,
+		 const string& name, int strip_nan_and_inf,
 		 int mark_as_global, int precision) 
 {
   int success = 1;
@@ -2728,7 +2720,7 @@
   if (! precision)
     precision = user_pref.save_precision;
 
-  if (name)
+  if (! name.empty ())
     os << "# name: " << name << "\n";
 
   long old_precision = os.precision ();
@@ -2855,12 +2847,12 @@
       return;
     }
 
-  char *name = sr->name ();
-  char *help = sr->help ();
+  string name = sr->name ();
+  string help = sr->help ();
   int global = sr->is_linked_to_global ();
   tree_constant tc = *((tree_constant *) sr->def ());
 
-  if (! name || ! tc.is_defined ())
+  if (tc.is_undefined ())
     return;
 
   switch (fmt)
@@ -2888,7 +2880,7 @@
 // builtin variables with names that match PATTERN.
 
 static int
-save_vars (ostream& os, char *pattern, int save_builtins,
+save_vars (ostream& os, const string& pattern, int save_builtins,
 	   load_save_format fmt, int save_as_floats)
 {
   int count;
@@ -2936,12 +2928,11 @@
 {
   load_save_format retval = LS_ASCII;
 
-  char *fmt = user_pref.default_save_format;
-
-  if (strcasecmp (fmt, "binary") == 0)
+  string fmt = user_pref.default_save_format;
+
+  if (fmt == "binary")
     retval = LS_BINARY;
-  else if (strcasecmp (fmt, "mat-binary") == 0
-	   || strcasecmp (fmt, "mat_binary") == 0)
+  else if (fmt == "mat-binary" || fmt =="mat_binary")
     retval = LS_MAT_BINARY;
       
   return retval;
@@ -2960,25 +2951,24 @@
 }
 
 static void
-save_vars (char **argv, int argc, ostream& os, int save_builtins,
-	   load_save_format fmt, int save_as_floats)
+save_vars (const string_vector& argv, int argv_idx, int argc,
+	   ostream& os, int save_builtins, load_save_format fmt,
+	   int save_as_floats) 
 {
   write_binary_header (os, fmt);
 
-  if (argc == 0)
+  if (argv_idx == argc)
     {
       save_vars (os, "*", save_builtins, fmt, save_as_floats);
     }
   else
     {
-      while (argc-- > 0)
+      for (int i = argv_idx; i < argc; i++)
 	{
-	  if (! save_vars (os, *argv, save_builtins, fmt, save_as_floats))
+	  if (! save_vars (os, argv[i], save_builtins, fmt, save_as_floats))
 	    {
-	      warning ("save: no such variable `%s'", *argv);
+	      warning ("save: no such variable `%s'", argv[i].c_str ());
 	    }
-
-	  argv++;
 	}
     }
 }
@@ -3002,7 +2992,7 @@
 
   if (file)
     {
-      save_vars (0, 0, file, 0, format, 0);
+      save_vars (string_vector (), 0, 0, file, 0, format, 0);
       message (0, "save to `%s' complete", fname);
     }
   else
@@ -3017,10 +3007,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV ("save");
-
-  argc--;
-  argv++;
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "save");
+
+  if (error_state)
+    return retval;
 
   // Here is where we would get the default save format if it were
   // stored in a user preference variable.
@@ -3031,39 +3023,29 @@
 
   load_save_format format = get_default_save_format ();
 
-  while (argc > 0)
+  int i;
+  for (i = 1; i < argc; i++)
     {
-      if (strcmp (*argv, "-ascii") == 0 || strcmp (*argv, "-a") == 0)
+      if (argv[i] == "-ascii" || argv[i] == "-a")
 	{
 	  format = LS_ASCII;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-binary") == 0 || strcmp (*argv, "-b") == 0)
+      else if (argv[i] == "-binary" || argv[i] == "-b")
 	{
 	  format = LS_BINARY;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-mat-binary") == 0 || strcmp (*argv, "-m") == 0)
+      else if (argv[i] == "-mat-binary" || argv[i] == "-m")
 	{
 	  format = LS_MAT_BINARY;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-float-binary") == 0
-	       || strcmp (*argv, "-f") == 0)
+      else if (argv[i] == "-float-binary" || argv[i] == "-f")
 	{
 	  format = LS_BINARY;
 	  save_as_floats = 1;
-	  argc--;
-	  argv++;
 	}
-      else if (strcmp (*argv, "-save-builtins") == 0)
+      else if (argv[i] == "-save-builtins")
 	{
 	  save_builtins = 1;
-	  argc--;
-	  argv++;
 	}
       else
 	break;
@@ -3072,44 +3054,42 @@
   if (argc < 1)
     {
       print_usage ("save");
-      DELETE_ARGV;
       return retval;
     }
 
   if (save_as_floats && format == LS_ASCII)
     {
       error ("save: cannot specify both -ascii and -float-binary");
-      DELETE_ARGV;
       return retval;
     }
 
-  if (strcmp (*argv, "-") == 0)
+  if (argv[i] == "-")
     {
-      argc--;
-      argv++;
+      i++;
 
       // XXX FIXME XXX -- should things intended for the screen end up
       // in a tree_constant (string)?
 
       ostrstream buf;
 
-      save_vars (argv, argc, buf, save_builtins, format,
+      save_vars (argv, i, argc, buf, save_builtins, format,
 		 save_as_floats);
 
       maybe_page_output (buf);
     }
-  else if (argc == 1 && glob_pattern_p (*argv)) // Guard against things
-    {						// like `save a*',
-      print_usage ("save");			// which are probably
-      DELETE_ARGV;				// mistakes...
+
+  // Guard against things like `save a*', which are probably mistakes...
+
+  else if (i == argc - 1 && glob_pattern_p (argv[i]))
+    {
+      print_usage ("save");
       return retval;
     }
   else
     {
-      string fname = oct_tilde_expand (*argv);
-
-      argc--;
-      argv++;
+      string fname = oct_tilde_expand (argv[i]);
+
+      i++;
 
       unsigned mode = ios::out|ios::trunc;
       if (format == LS_BINARY || format == LS_MAT_BINARY)
@@ -3119,19 +3099,16 @@
 
       if (file)
 	{
-	  save_vars (argv, argc, file, save_builtins, format,
+	  save_vars (argv, i, argc, file, save_builtins, format,
 		     save_as_floats);
 	}
       else
 	{
-	  error ("save: couldn't open output file `%s'", *argv);
-	  DELETE_ARGV;
+	  error ("save: couldn't open output file `%s'", fname.c_str ());
 	  return retval;
 	}
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/load-save.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/load-save.h	Mon Jan 22 04:47:22 1996 +0000
@@ -28,8 +28,11 @@
 
 class tree_constant;
 
+#include <string>
+
 extern int save_ascii_data (ostream& os, const tree_constant& t,
-			    char *name = 0, int strip_nan_and_inf = 0,
+			    const string& name = string (),
+			    int strip_nan_and_inf = 0,
 			    int mark_as_global = 0, int precision = 0);
 
 extern int save_three_d (ostream& os, const tree_constant& t,
--- a/src/lsode.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/lsode.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -257,7 +257,7 @@
 }
 
 static void
-set_lsode_option (const char *keyword, double val)
+set_lsode_option (const string& keyword, double val)
 {
   ODE_OPTIONS *list = lsode_option_table;
 
@@ -273,11 +273,11 @@
       list++;
     }
 
-  warning ("lsode_options: no match for `%s'", keyword);
+  warning ("lsode_options: no match for `%s'", keyword.c_str ());
 }
 
 static Octave_object
-show_lsode_option (const char *keyword)
+show_lsode_option (const string& keyword)
 {
   Octave_object retval;
 
@@ -293,7 +293,7 @@
       list++;
     }
 
-  warning ("lsode_options: no match for `%s'", keyword);
+  warning ("lsode_options: no match for `%s'", keyword.c_str ());
 
   return retval;
 }
@@ -316,8 +316,7 @@
     }
   else if (nargin == 1 || nargin == 2)
     {
-      string tstr = args(0).string_value ();
-      const char *keyword = tstr.c_str ();
+      string keyword = args(0).string_value ();
 
       if (! error_state)
 	{
--- a/src/mappers.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/mappers.h	Mon Jan 22 04:47:22 1996 +0000
@@ -24,6 +24,8 @@
 #if !defined (octave_mappers_h)
 #define octave_mappers_h 1
 
+#include <string>
+
 #include "oct-cmplx.h"
 
 typedef double (*d_d_Mapper)(double);
@@ -40,7 +42,7 @@
 
 struct Mapper_fcn
 {
-  char *name;
+  string name;
   int can_return_complex_for_real_arg;
   double lower_limit;
   double upper_limit;
@@ -51,14 +53,21 @@
 
 struct builtin_mapper_function
 {
-  char *name;
+  builtin_mapper_function (const string n, int cfr, double l, double u,
+			   d_d_Mapper dd, d_c_Mapper dc, c_c_Mapper cc,
+			   const string& h)
+    : name (n), can_return_complex_for_real_arg (cfr),
+      lower_limit (l), upper_limit (u), d_d_mapper (dd),
+      d_c_mapper (dc), c_c_mapper (cc), help_string (h) { }
+
+  string name;
   int can_return_complex_for_real_arg;
   double lower_limit;
   double upper_limit;
   d_d_Mapper d_d_mapper;
   d_c_Mapper d_c_mapper;
   c_c_Mapper c_c_mapper;
-  char *help_string;
+  string help_string;
 };
 
 extern double arg (double x);
--- a/src/npsol.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/npsol.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -716,7 +716,7 @@
 }
 
 static void
-set_npsol_option (const char *keyword, double val)
+set_npsol_option (const string& keyword, double val)
 {
   NPSOL_OPTIONS *list = npsol_option_table;
 
@@ -732,7 +732,7 @@
 	      if (xisnan (val))
 		{
 		  error ("npsol_options: %s: expecting integer, found NaN",
-			 keyword);
+			 keyword.c_str ());
 		}
 	      else
 		(npsol_opts.*list->i_set_fcn) (NINT (val));
@@ -742,11 +742,11 @@
       list++;
     }
 
-  warning ("npsol_options: no match for `%s'", keyword);
+  warning ("npsol_options: no match for `%s'", keyword.c_str ());
 }
 
 static Octave_object
-show_npsol_option (const char *keyword)
+show_npsol_option (const string& keyword)
 {
   Octave_object retval;
 
@@ -765,7 +765,7 @@
       list++;
     }
 
-  warning ("npsol_options: no match for `%s'", keyword);
+  warning ("npsol_options: no match for `%s'", keyword.c_str ());
 
   return retval;
 }
@@ -804,8 +804,7 @@
     }
   else if (nargin == 1 || nargin == 2)
     {
-      string tstr = args(0).string_value ();
-      const char *keyword = tstr.c_str ();
+      string keyword = args(0).string_value ();
 
       if (! error_state)
 	{
--- a/src/oct-hist.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/oct-hist.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -50,6 +50,8 @@
 
 #include <readline/history.h>
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "error.h"
 #include "input.h"
@@ -90,24 +92,31 @@
   return size;
 }
 
-char *
+string
 default_history_file (void)
 {
-  char *file = 0;
+  string file;
 
   char *env_file = getenv ("OCTAVE_HISTFILE");
+
   if (env_file)
     {
       fstream f (env_file, (ios::in | ios::out));
+
       if (f)
 	{
-	  file = strsave (env_file);
+	  file = env_file;
 	  f.close ();
 	}
     }
 
-  if (! file && home_directory)
-    file = strconcat (home_directory, "/.octave_hist");
+  if (file.empty ())
+    {
+      if (! home_directory.empty ())
+	file = home_directory.append ("/.octave_hist");
+      else
+	file = ".octave_hist";
+    }
 
   return file;
 }
@@ -138,11 +147,11 @@
 }
 
 void
-maybe_save_history (const char *s)
+maybe_save_history (const string& s)
 {
   if (user_pref.saving_history && ! input_from_startup_file)
     {
-      add_history (s);
+      add_history (s.c_str ());
       history_lines_this_session++;
     }
 }
@@ -153,31 +162,30 @@
 // means read file, arg of -q means don't number lines.  Arg of N
 // means only display that many items. 
 
-void
-do_history (int argc, char **argv)
+static void
+do_history (int argc, const string_vector& argv)
 {
   HIST_ENTRY **hlist;
 
   int numbered_output = 1;
 
-  while (--argc > 0)
+  int i;
+  for (i = 1; i < argc; i++)
     {
-      argv++;
-
-      if (*argv[0] == '-' && strlen (*argv) == 2
-	  && ((*argv)[1] == 'r' || (*argv)[1] == 'w'
-	      || (*argv)[1] == 'a' || (*argv)[1] == 'n'))
+      if (argv[i][0] == '-' && argv[i].length () == 2
+	  && (argv[i][1] == 'r' || argv[i][1] == 'w'
+	      || argv[i][1] == 'a' || argv[i][1] == 'n'))
 	{
 	  int result = 0;
 
 	  string file;
 
-	  if (argc > 1)
-	    file = oct_tilde_expand (*(argv+1));
+	  if (i < argc - 1)
+	    file = oct_tilde_expand (argv[i+1]);
 	  else
 	    file = oct_tilde_expand (user_pref.history_file);
 
-	  switch ((*argv)[1])
+	  switch (argv[i][1])
 	    {
 	    case 'a':		// Append `new' lines to file.
 	      {
@@ -230,12 +238,11 @@
 	    }
 	  return;
 	}
-      else if (strcmp (*argv, "-q") == 0)
+      else if (argv[i] == "-q")
 	numbered_output = 0;
-      else if (strcmp (*argv, "--") == 0)
+      else if (argv[i] == "--")
 	{
-	  argc--;
-	  argv++;
+	  i++;
 	  break;
 	}
       else
@@ -245,15 +252,15 @@
   int limited = 0;
   int limit = 0;
 
-  if (argc > 0)
+  if (i < argc)
     {
       limited = 1;
-      if (sscanf (*argv, "%d", &limit) != 1)
+      if (sscanf (argv[i].c_str (), "%d", &limit) != 1)
         {
-	  if (*argv[0] == '-')
-	    error ("history: unrecognized option `%s'", *argv);
+	  if (argv[i][0] == '-')
+	    error ("history: unrecognized option `%s'", argv[i].c_str ());
 	  else
-	    error ("history: bad non-numeric arg `%s'", *argv);
+	    error ("history: bad non-numeric arg `%s'", argv[i].c_str ());
 	  return;
         }
     }
@@ -420,8 +427,9 @@
 
 #define histline(i) (hlist[(i)]->line)
 
-static char *
-mk_tmp_hist_file (int argc, char **argv, int insert_curr, char *warn_for)
+static string
+mk_tmp_hist_file (int argc, const string_vector& argv,
+		  int insert_curr, char *warn_for) 
 {
   HIST_ENTRY **hlist;
 
@@ -452,9 +460,8 @@
   int usage_error = 0;
   if (argc == 3)
     {
-      argv++;
-      if (sscanf (*argv++, "%d", &hist_beg) != 1
-	  || sscanf (*argv, "%d", &hist_end) != 1)
+      if (sscanf (argv[1].c_str (), "%d", &hist_beg) != 1
+	  || sscanf (argv[2].c_str (), "%d", &hist_end) != 1)
 	usage_error = 1;
       else
 	{
@@ -464,8 +471,7 @@
     }
   else if (argc == 2)
     {
-      argv++;
-      if (sscanf (*argv++, "%d", &hist_beg) != 1)
+      if (sscanf (argv[1].c_str (), "%d", &hist_beg) != 1)
 	usage_error = 1;
       else
 	{
@@ -495,13 +501,14 @@
       reverse = 1;
     }
 
-  char *name = octave_tmp_file_name ();
+  string name = octave_tmp_file_name ();
 
-  fstream file (name, ios::out);
+  fstream file (name.c_str (), ios::out);
 
   if (! file)
     {
-      error ("%s: couldn't open temporary file `%s'", warn_for, name);
+      error ("%s: couldn't open temporary file `%s'", warn_for,
+	     name.c_str ());
       return 0;
     }
 
@@ -518,15 +525,15 @@
 
   file.close ();
 
-  return strsave (name);
+  return name;
 }
 
-void
-do_edit_history (int argc, char **argv)
+static void
+do_edit_history (int argc, const string_vector& argv)
 {
-  char *name = mk_tmp_hist_file (argc, argv, 0, "edit_history");
+  string name = mk_tmp_hist_file (argc, argv, 0, "edit_history");
 
-  if (! name)
+  if (name.empty ())
     return;
 
   // Call up our favorite editor on the file of commands.
@@ -548,7 +555,7 @@
   // Write the commands to the history file since parse_and_execute
   // disables command line history while it executes.
 
-  fstream file (name, ios::in);
+  fstream file (name.c_str (), ios::in);
 
   char *line;
   int first = 1;
@@ -589,17 +596,15 @@
   // Delete the temporary file.  Should probably be done with an
   // unwind_protect.
 
-  unlink (name);
-
-  delete [] name;
+  unlink (name.c_str ());
 }
 
-void
-do_run_history (int argc, char **argv)
+static void
+do_run_history (int argc, const string_vector& argv)
 {
-  char *name = mk_tmp_hist_file (argc, argv, 1, "run_history");
+  string name = mk_tmp_hist_file (argc, argv, 1, "run_history");
 
-  if (! name)
+  if (name.empty ())
     return;
 
   // Turn on command echo, so the output from this will make better
@@ -618,9 +623,7 @@
   // Delete the temporary file.  Should probably be done with an
   // unwind_protect.
 
-  unlink (name);
-
-  delete [] name;
+  unlink (name.c_str ());
 }
 
 int
@@ -642,12 +645,15 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("edit_history");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "edit_history");
+
+  if (error_state)
+    return retval;
 
   do_edit_history (argc, argv);
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -658,12 +664,15 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("history");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "history");
+
+  if (error_state)
+    return retval;
 
   do_history (argc, argv);
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -674,12 +683,15 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("run_history");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "run_history");
+
+  if (error_state)
+    return retval;
 
   do_run_history (argc, argv);
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/oct-hist.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/oct-hist.h	Mon Jan 22 04:47:22 1996 +0000
@@ -24,14 +24,13 @@
 #if !defined (octave_octave_hist_h)
 #define octave_octave_hist_h 1
 
+#include <string>
+
 extern int default_history_size (void);
-extern char *default_history_file (void);
+extern string default_history_file (void);
 extern void initialize_history (void);
 extern void clean_up_history (void);
-extern void maybe_save_history (const char*);
-extern void do_history (int, char**);
-extern void do_edit_history (int, char**);
-extern void do_run_history (int, char**);
+extern void maybe_save_history (const string& s);
 extern int current_history_number (void);
 
 // Nonzero means input is coming from temporary history file.
--- a/src/oct-map.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/oct-map.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -29,22 +29,22 @@
 #include <config.h>
 #endif
 
+#include "str-vec.h"
+
 #include "pt-const.h"
 #include "oct-map.h"
 #include "utils.h"
 
-char **
+string_vector
 Octave_map::make_name_list (void)
 {
   int len = length ();
 
-  char **names = new char * [len + 1];
+  string_vector names (len);
 
   int i = 0;
   for (Pix p = first (); p != 0; next (p))
-    names[i++] = strsave (key (p));
-
-  names[i] = 0;
+    names[i++] = key (p);
 
   return names;
 }
--- a/src/oct-map.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/oct-map.h	Mon Jan 22 04:47:22 1996 +0000
@@ -32,13 +32,15 @@
 
 #include "pt-const.h"
 
+class string_vector;
+
 class
 Octave_map : public CHMap<tree_constant>
 {
  public:
   Octave_map (void) : CHMap<tree_constant> (tree_constant ()) { }
 
-  Octave_map (const char *key, const tree_constant& value)
+  Octave_map (const string& key, const tree_constant& value)
     : CHMap<tree_constant> (tree_constant ())
       {
 	CHMap<tree_constant>::operator [] (key) = value;
@@ -48,7 +50,7 @@
 
   ~Octave_map (void) { }
 
-  char **make_name_list (void);
+  string_vector make_name_list (void);
 };
 
 #endif
--- a/src/oct-obj.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/oct-obj.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -69,6 +69,9 @@
 Octave_object::Octave_object (const string& s)
   : Array<tree_constant> (1, tree_constant (s)) { }
 
+Octave_object::Octave_object (const string_vector& s)
+  : Array<tree_constant> (1, tree_constant (s)) { }
+
 Octave_object::Octave_object (double base, double limit, double inc)
   : Array<tree_constant> (1, tree_constant (base, limit, inc)) { }
 
--- a/src/oct-obj.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/oct-obj.h	Mon Jan 22 04:47:22 1996 +0000
@@ -60,6 +60,7 @@
 
   Octave_object (const char *s);
   Octave_object (const string& s);
+  Octave_object (const string_vector& s);
 
   Octave_object (double base, double limit, double inc);
   Octave_object (const Range& r);
--- a/src/octave.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/octave.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -164,30 +164,30 @@
 // Initialize some global variables for later use.
 
 static void
-initialize_globals (char *name)
+initialize_globals (const string& name)
 {
-  raw_prog_name = strsave (name);
-  char *tmp = strrchr (raw_prog_name, '/');
-  prog_name = tmp ? strsave (tmp+1) : strsave (raw_prog_name);
+  raw_prog_name = name;
+  size_t pos = raw_prog_name.rfind ('/');
+  if (pos == NPOS)
+    prog_name = raw_prog_name;
+  else
+    prog_name = raw_prog_name.substr (pos+1);
 
   struct passwd *entry = getpwuid (getuid ());
   if (entry)
-    user_name = strsave (entry->pw_name);
+    user_name = entry->pw_name;
   else
-    user_name = strsave ("I have no name!");
+    user_name = "I have no name!";
   endpwent ();
 
   char hostname[256];
   if (gethostname (hostname, 255) < 0)
-    host_name = strsave ("I have no host!");
+    host_name = "I have no host!";
   else
-    host_name = strsave (hostname);
+    host_name = hostname;
 
   char *hd = getenv ("HOME");
-  if (hd)
-    home_directory = strsave (hd);
-  else
-    home_directory = strsave ("I have no home!");
+  home_directory = hd ? hd : "I have no home!";
 
   exec_path = default_exec_path ();
 
@@ -223,31 +223,35 @@
   // then from the file $(prefix)/lib/octave/$(version)/m/octaverc (if
   // it exists).
 
-  char *lsd = get_local_site_defaults ();
+  string lsd = get_local_site_defaults ();
   parse_and_execute (lsd, 0, verbose);
 
-  char *sd = get_site_defaults ();
+  string sd = get_site_defaults ();
   parse_and_execute (sd, 0, verbose);
 
   // Try to execute commands from $HOME/.octaverc and ./.octaverc.
 
-  char *home_rc = 0;
-  if (home_directory)
+  int home_rc_already_executed = 0;
+  string home_rc;
+  if (! home_directory.empty ())
     {
-      home_rc = strconcat (home_directory, "/.octaverc");
+      home_rc = home_directory;
+      home_rc.append ("/.octaverc");
       parse_and_execute (home_rc, 0, verbose);
+
+      // Names alone are not enough.
+
+      struct stat home_rc_statbuf;
+      stat (home_rc.c_str (), &home_rc_statbuf);
+
+      struct stat dot_rc_statbuf;
+      stat ("./.octaverc", &dot_rc_statbuf);
+
+      if (home_rc_statbuf.st_ino == dot_rc_statbuf.st_ino)
+	home_rc_already_executed = 1;
     }
 
-  // Names alone are not enough.
-
-  struct stat home_rc_statbuf;
-  stat (home_rc, &home_rc_statbuf);
-  delete [] home_rc;
-
-  struct stat dot_rc_statbuf;
-  stat ("./.octaverc", &dot_rc_statbuf);
-
-  if (home_rc_statbuf.st_ino != dot_rc_statbuf.st_ino)
+  if (! home_rc_already_executed)
     parse_and_execute ("./.octaverc", 0, verbose);
 
   run_unwind_frame ("execute_startup_files");
@@ -380,7 +384,7 @@
 
 	case 'p':
 	  if (optarg)
-	    load_path = strsave (optarg);
+	    load_path = string (optarg);
 	  break;
 
 	case 'q':
@@ -397,17 +401,17 @@
 
 	case EXEC_PATH_OPTION:
 	  if (optarg)
-	    exec_path = strsave (optarg);
+	    exec_path = string (optarg);
 	  break;
 
 	case INFO_FILE_OPTION:
 	  if (optarg)
-	    info_file = strsave (optarg);
+	    info_file = string (optarg);
 	  break;
 
 	case INFO_PROG_OPTION:
 	  if (optarg)
-	    info_prog = strsave (optarg);
+	    info_prog = string (optarg);
 	  break;
 
 	case TRADITIONAL_OPTION:
@@ -483,8 +487,10 @@
 	  bind_builtin_variable ("program_invocation_name",
 				 curr_fcn_file_name);
 
-	  const char *tmp = strrchr (curr_fcn_file_name, '/');
-	  tmp = tmp ? tmp+1 : curr_fcn_file_name;
+	  size_t pos = curr_fcn_file_name.rfind ('/');
+
+	  string tmp = (pos != NPOS)
+	    ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name;
 
 	  bind_builtin_variable ("program_name", tmp);
 
--- a/src/pager.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pager.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -28,20 +28,24 @@
 #include <csignal>
 #include <cstdlib>
 
+#include <string>
+
 #include <iostream.h>
 #include <strstream.h>
 #include <fstream.h>
 
 #include "procstream.h"
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "error.h"
 #include "help.h"
 #include "input.h"
+#include "oct-obj.h"
 #include "pager.h"
+#include "pt-const.h"
 #include "sighandlers.h"
-#include "pt-const.h"
-#include "oct-obj.h"
 #include "unwind-prot.h"
 #include "user-prefs.h"
 #include "utils.h"
@@ -54,7 +58,7 @@
 static int write_to_diary_file = 0;
 
 // The name of the current diary file.
-static char *diary_file = 0;
+static string diary_file;
 
 // The diary file.
 static ofstream diary_stream;
@@ -113,7 +117,7 @@
 
       if (interactive
 	  && user_pref.page_screen_output
-	  && user_pref.pager_binary)
+	  && ! user_pref.pager_binary.empty ())
 	{
 	  *pager_buf << message;
 	}
@@ -147,13 +151,14 @@
 
   if (nlines > terminal_rows () - 2)
     {
-      char *pgr = user_pref.pager_binary;
-      if (pgr)
+      string pgr = user_pref.pager_binary;
+
+      if (! pgr.empty ())
 	{
 	  volatile sig_handler *old_sigint_handler;
 	  old_sigint_handler = octave_set_signal_handler (SIGINT, SIG_IGN);
 
-	  oprocstream *pager_stream = new oprocstream (pgr);
+	  oprocstream *pager_stream = new oprocstream (pgr.c_str ());
 
 	  add_unwind_protect (cleanup_oprocstream, pager_stream);
 
@@ -187,10 +192,10 @@
   if (diary_stream.is_open ())
     diary_stream.close ();
 
-  diary_stream.open (diary_file, ios::app);
+  diary_stream.open (diary_file.c_str (), ios::app);
 
   if (! diary_stream)
-    error ("diary: can't open diary file `%s'", diary_file);
+    error ("diary: can't open diary file `%s'", diary_file.c_str ());
 }
 
 void
@@ -215,10 +220,15 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV ("diary");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "diary");
 
-  if (! diary_file)
-    diary_file = strsave ("diary");
+  if (error_state)
+    return retval;
+
+  if (diary_file.empty ())
+    diary_file = "diary";
 
   switch (argc)
     {
@@ -229,18 +239,18 @@
 
     case 2:
       {
-	char *arg = argv[1];
-	if (strcmp (arg, "on") == 0)
+	string arg = argv[1];
+
+	if (arg == "on")
 	  {
 	    write_to_diary_file = 1;
 	    open_diary_file ();
 	  }	
-	else if (strcmp (arg, "off") == 0)
+	else if (arg == "off")
 	  write_to_diary_file = 0;
 	else
 	  {
-	    delete [] diary_file;
-	    diary_file = strsave (arg);
+	    diary_file = arg;
 	    open_diary_file ();
 	  }
       }
@@ -251,8 +261,6 @@
       break;
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -264,24 +272,27 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV ("more");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "more");
+
+  if (error_state)
+    return retval;
 
   if (argc == 2)
     {
-      char *arg = argv[1];
+      string arg = argv[1];
 
-      if (strcmp (arg, "on") == 0)
+      if (arg == "on")
 	bind_builtin_variable ("page_screen_output", "true");
-      else if (strcmp (arg, "off") == 0)
+      else if (arg == "off")
 	bind_builtin_variable ("page_screen_output", "false");
       else
-	error ("more: unrecognized argument `%s'", arg);
+	error ("more: unrecognized argument `%s'", arg.c_str ());
     }
   else
     print_usage ("more");
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/parse.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/parse.h	Mon Jan 22 04:47:22 1996 +0000
@@ -24,6 +24,8 @@
 #if !defined (octave_parse_h)
 #define octave_parse_h 1
 
+#include <string>
+
 #include "SLStack.h"
 
 extern void discard_until (char c);
@@ -74,7 +76,7 @@
 extern int current_input_column;
 
 // Buffer for help text snagged from function files.
-extern char *help_buf;
+extern string help_buf;
 
 // Nonzero means we're working on a plot command.
 extern int plotting;
--- a/src/parse.y	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/parse.y	Mon Jan 22 04:47:22 1996 +0000
@@ -94,7 +94,7 @@
 int current_input_column = 1;
 
 // Buffer for help text snagged from function files.
-char *help_buf = 0;
+string help_buf;
 
 // Nonzero means we're working on a plot command.
 int plotting = 0;
@@ -625,11 +625,11 @@
 		;
 
 style		: WITH STYLE
-		  { $$ = new subplot_style ($2->string ()); }
+		  { $$ = new subplot_style ($2->text ()); }
 		| WITH STYLE expression
-		  { $$ = new subplot_style ($2->string (), $3); }
+		  { $$ = new subplot_style ($2->text (), $3); }
 		| WITH STYLE expression bogus_syntax expression
-		  { $$ = new subplot_style ($2->string (), $3, $5); }
+		  { $$ = new subplot_style ($2->text (), $3, $5); }
 		;
 
 bogus_syntax	: // empty
@@ -1028,7 +1028,7 @@
 						$1->column ());
 		  }
 		| indirect_ref1 '.' { looking_at_indirect_ref = 1; } TEXT_ID
-		  { $$ = $1->chain ($4->string ()); }
+		  { $$ = $1->chain ($4->text ()); }
 		;
 
 variable	: indirect_ref
@@ -1161,7 +1161,6 @@
 static void
 yyerror (char *s)
 {
-  char *line = current_input_line;
   int err_col = current_input_column - 1;
 
   ostrstream output_buf;
@@ -1177,19 +1176,16 @@
 
   output_buf << "\n\n";
 
-  if (line)
+  if (! current_input_line.empty ())
     {
-      int len = strlen (line);
+      size_t len = current_input_line.length ();
 
-      if (line[len-1] == '\n')
-        {
-          len--;
-          line[len] = '\0';
-        }
+      if (current_input_line[len-1] == '\n')
+        current_input_line.resize (len-1);
 
 // Print the line, maybe with a pointer near the error token.
 
-      output_buf << ">>> " << line << "\n";
+      output_buf << ">>> " << current_input_line << "\n";
 
       if (err_col == 0)
 	err_col = len;
@@ -1426,7 +1422,7 @@
       break;
 
     case TEXT:
-      retval = new tree_constant (tok_val->string (), l, c);
+      retval = new tree_constant (tok_val->text (), l, c);
       break;
 
     default:
@@ -1957,7 +1953,7 @@
 static tree_function *
 frob_function_def (tree_identifier *id, tree_function *fcn)
 {
-  char *id_name = id->name ();
+  string id_name = id->name ();
 
   // If input is coming from a file, issue a warning if the name of
   // the file does not match the name of the function stated in the
@@ -1968,11 +1964,11 @@
 
   if (reading_fcn_file)
     {
-      if (strcmp (curr_fcn_file_name, id_name) != 0)
+      if (curr_fcn_file_name != id_name)
 	{
 	  if (user_pref.warn_function_name_clash)
 	    warning ("function name `%s' does not agree with function\
- file name `%s'", id_name, curr_fcn_file_full_name);
+ file name `%s'", id_name.c_str (), curr_fcn_file_full_name.c_str ());
 
 	  global_sym_tab->rename (id_name, curr_fcn_file_name);
 
@@ -1989,16 +1985,16 @@
     }
   else if (! (input_from_tmp_history_file || input_from_startup_file)
 	   && reading_script_file
-	   && curr_fcn_file_name
-	   && strcmp (curr_fcn_file_name, id_name) == 0)
+	   && curr_fcn_file_name == id_name)
     {
       warning ("function `%s' defined within script file `%s'",
-	       id_name, curr_fcn_file_full_name);
+	       id_name.c_str (), curr_fcn_file_full_name.c_str ());
     }
 
   top_level_sym_tab->clear (id_name);
 
   id->define (fcn);
+
   id->document (help_buf);
 
   return fcn;
@@ -2112,6 +2108,7 @@
 
       if (tmp->is_expression ())
 	warning ("missing semicolon near line %d, column %d in file `%s'",
-		 tmp->line (), tmp->column (), curr_fcn_file_full_name);
+		 tmp->line (), tmp->column (),
+		 curr_fcn_file_full_name.c_str ());
     }
 }
--- a/src/pr-output.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pr-output.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -38,16 +38,17 @@
 #include "Range.h"
 #include "dMatrix.h"
 #include "oct-cmplx.h"
+#include "str-vec.h"
 
 #include "defun.h"
 #include "error.h"
 #include "help.h"
 #include "mappers.h"
+#include "oct-obj.h"
 #include "pager.h"
 #include "pr-output.h"
+#include "pt-const.h"
 #include "sysdep.h"
-#include "pt-const.h"
-#include "oct-obj.h"
 #include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
@@ -1518,24 +1519,17 @@
 
       for (int i = 0; i < nstr; i++)
 	{
-	  string tstr = chm.row_as_string (i);
-	  const char *row = tstr.c_str ();
+	  string row = chm.row_as_string (i);
 
 	  if (pr_as_read_syntax)
 	    {
-	      char *tmp = undo_string_escapes (row);
-
-	      os << "\"" << tmp << "\"";
-
-	      delete [] tmp;
+	      os << "\"" << undo_string_escapes (row) << "\"";
 
 	      if (i < nstr - 1)
 		os << "; ";
 	    }
 	  else
 	    os << row << "\n";
-
-	  delete [] row;
 	}
 
       if (pr_as_read_syntax && nstr > 1)
@@ -1586,121 +1580,122 @@
   bind_builtin_variable ("output_max_field_width", tmp);
 }
 
-void
-set_format_style (int argc, char **argv)
+static void
+set_format_style (int argc, const string_vector& argv)
 {
-  if (--argc > 0)
+  int idx = 1;
+  string arg = argv[idx++];
+
+  if (argc > 1)
     {
-      argv++;
-      if (*argv[0])
+      if (arg == "short")
 	{
-	  if (strcmp (*argv, "short") == 0)
+	  if (--argc > 0)
 	    {
-	      if (--argc > 0)
+	      arg = argv[idx++];
+
+	      if (arg == "e")
 		{
-		  argv++;
-		  if (strcmp (*argv, "e") == 0)
-		    {
-		      init_format_state ();
-		      print_e = 1;
-		    }
-		  else if (strcmp (*argv, "E") == 0)
-		    {
-		      init_format_state ();
-		      print_e = 1;
-		      print_big_e = 1;
-		    }
-		  else
-		    {
-		      error ("format: unrecognized option `short %s'", *argv);
-		      return;
-		    }
+		  init_format_state ();
+		  print_e = 1;
+		}
+	      else if (arg == "E")
+		{
+		  init_format_state ();
+		  print_e = 1;
+		  print_big_e = 1;
 		}
 	      else
-		init_format_state ();
-
-	      set_output_prec_and_fw (3, 8);
-	    }
-	  else if (strcmp (*argv, "long") == 0)
-	    {
-	      if (--argc > 0)
 		{
-		  argv++;
-		  if (strcmp (*argv, "e") == 0)
-		    {
-		      init_format_state ();
-		      print_e = 1;
-		    }
-		  else if (strcmp (*argv, "E") == 0)
-		    {
-		      init_format_state ();
-		      print_e = 1;
-		      print_big_e = 1;
-		    }
-		  else
-		    {
-		      error ("format: unrecognized option `long %s'", *argv);
-		      return;
-		    }
+		  error ("format: unrecognized option `short %s'",
+			 arg.c_str ());
+		  return;
+		}
+	    }
+	  else
+	    init_format_state ();
+
+	  set_output_prec_and_fw (3, 8);
+	}
+      else if (arg == "long")
+	{
+	  if (--argc > 0)
+	    {
+	      arg = argv[idx++];
+
+	      if (arg == "e")
+		{
+		  init_format_state ();
+		  print_e = 1;
+		}
+	      else if (arg == "E")
+		{
+		  init_format_state ();
+		  print_e = 1;
+		  print_big_e = 1;
 		}
 	      else
-		init_format_state ();
-
-	      set_output_prec_and_fw (15, 24);
-	    }
-	  else if (strcmp (*argv, "hex") == 0)
-	    {
-	      init_format_state ();
-	      hex_format = 1;
-	    }
-	  else if (strcmp (*argv, "native-hex") == 0)
-	    {
-	      init_format_state ();
-	      hex_format = 2;
-	    }
-	  else if (strcmp (*argv, "bit") == 0)
-	    {
-	      init_format_state ();
-	      bit_format = 1;
-	    }
-	  else if (strcmp (*argv, "native-bit") == 0)
-	    {
-	      init_format_state ();
-	      bit_format = 2;
-	    }
-	  else if (strcmp (*argv, "+") == 0 || strcmp (*argv, "plus") == 0)
-	    {
-	      init_format_state ();
-	      plus_format = 1;
-	    }
-	  else if (strcmp (*argv, "bank") == 0)
-	    {
-	      init_format_state ();
-	      bank_format = 1;
-	    }
-	  else if (strcmp (*argv, "free") == 0)
-	    {
-	      init_format_state ();
-	      free_format = 1;
-	    }
-	  else if (strcmp (*argv, "none") == 0)
-	    {
-	      init_format_state ();
-	      free_format = 1;
-	    }
-	  else if (strcmp (*argv, "compact") == 0)
-	    {
-	      compact_format = 1;
-	    }
-	  else if (strcmp (*argv, "loose") == 0)
-	    {
-	      compact_format = 0;
+		{
+		  error ("format: unrecognized option `long %s'",
+			 arg.c_str ());
+		  return;
+		}
 	    }
 	  else
-	    error ("format: unrecognized format state `%s'", *argv);
+	    init_format_state ();
+
+	  set_output_prec_and_fw (15, 24);
+	}
+      else if (arg == "hex")
+	{
+	  init_format_state ();
+	  hex_format = 1;
+	}
+      else if (arg == "native-hex")
+	{
+	  init_format_state ();
+	  hex_format = 2;
+	}
+      else if (arg == "bit")
+	{
+	  init_format_state ();
+	  bit_format = 1;
+	}
+      else if (arg == "native-bit")
+	{
+	  init_format_state ();
+	  bit_format = 2;
+	}
+      else if (arg == "+" || arg == "plus")
+	{
+	  init_format_state ();
+	  plus_format = 1;
+	}
+      else if (arg == "bank")
+	{
+	  init_format_state ();
+	  bank_format = 1;
+	}
+      else if (arg == "free")
+	{
+	  init_format_state ();
+	  free_format = 1;
+	}
+      else if (arg == "none")
+	{
+	  init_format_state ();
+	  free_format = 1;
+	}
+      else if (arg == "compact")
+	{
+	  compact_format = 1;
+	}
+      else if (arg == "loose")
+	{
+	  compact_format = 0;
 	}
       else
-	usage ("format [format_state]");
+	error ("format: unrecognized format state `%s'", arg.c_str ());
     }
   else
     {
@@ -1716,12 +1711,15 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("format");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "format");
+
+  if (error_state)
+    return retval;
 
   set_format_style (argc, argv);
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/pr-output.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pr-output.h	Mon Jan 22 04:47:22 1996 +0000
@@ -52,8 +52,6 @@
 				   int pr_as_read_syntax = 0,
 				   int pr_as_string = 0);
 
-extern void set_format_style (int argc, char **argv);
-
 // XXX FIXME XXX -- these should probably be somewhere else.
 
 extern int any_element_is_inf_or_nan (const Matrix& a);
--- a/src/pt-base.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-base.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -64,7 +64,7 @@
  
   if (beginning_of_line)
     {
-      os.form ("%s%*s", user_pref.ps4, curr_print_indent_level, "");
+      os.form ("%s%*s", user_pref.ps4.c_str (), curr_print_indent_level, "");
       beginning_of_line = 0;
     }
 }
--- a/src/pt-const.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-const.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -42,6 +42,7 @@
 
 #include "mx-base.h"
 #include "Range.h"
+#include "str-vec.h"
 
 #include "arith-ops.h"
 #include "error.h"
@@ -187,39 +188,37 @@
 }
 
 tree_constant
-tree_constant::lookup_map_element (const char *ref, int insert,
+tree_constant::lookup_map_element (const string& ref, int insert,
 				   int silent)
 {
   tree_constant retval;
 
-  if (ref)
+  if (! ref.empty ())
     {
-      char *tmp = strsave (ref);
-
-      SLList<char *> list;
-
-      char *beg = tmp;
-      char *end = 0;
+      SLList<string> list;
+
+      size_t beg = 0;
+      size_t end;
+
       do
 	{
-	  end = strchr (beg, '.');
-	  if (end)
-	    *end = '\0';
-
-	  list.append (strsave (beg));
+	  end = ref.find ('.', beg);
+
+	  string tmp = (end == NPOS)
+	    ? ref.substr (beg) : ref.substr (beg, end - 1);
+
+	  list.append (tmp);
 	}
-      while (end && (beg = end + 1));
+      while (end != NPOS && (beg = end + 1));
 
       retval = lookup_map_element (list, insert, silent);
-
-      delete [] tmp;
     }
 
   return retval;
 }
 
 tree_constant
-tree_constant::lookup_map_element (SLList<char*>& list, int insert,
+tree_constant::lookup_map_element (SLList<string>& list, int insert,
 				   int silent)
 {
   tree_constant retval;
@@ -229,7 +228,7 @@
   Pix p = list.first ();
   while (p)
     {
-      char *elt = list (p);
+      string elt = list (p);
 
       list.next (p);
 
@@ -258,6 +257,38 @@
   maybe_page_output (output_buf);
 }
 
+void
+tree_constant::print_with_name (const string& name, int print_padding)
+{
+  ostrstream output_buf;
+  print_with_name (output_buf, name, print_padding);
+  output_buf << ends;
+  maybe_page_output (output_buf);
+}
+
+void
+tree_constant::print_with_name (ostream& output_buf, const string& name,
+				int print_padding) 
+{
+  int pad_after = 0;
+
+  if (user_pref.print_answer_id_name)
+    {
+      if (print_as_scalar () || print_as_structure ())
+	output_buf << name << " = ";
+      else
+	{
+	  pad_after = 1;
+	  output_buf << name << " =\n\n";
+	}
+    }
+
+  print (output_buf);
+
+  if (print_padding && pad_after)
+    output_buf << "\n";
+}
+
 // Simple structure assignment.
 
 void
@@ -298,7 +329,7 @@
 }
 
 tree_constant
-tree_constant::assign_map_element (SLList<char*>& list,
+tree_constant::assign_map_element (SLList<string>& list,
 				   tree_constant& rhs)
 {
   tree_constant_rep *tmp_rep = make_unique_map ();
@@ -309,7 +340,7 @@
   Pix p = list.first ();
   while (p)
     {
-      char *elt = list (p);
+      string elt = list (p);
 
       list.next (p);
 
@@ -330,7 +361,7 @@
 // Indexed structure assignment.
 
 tree_constant
-tree_constant::assign_map_element (SLList<char*>& list,
+tree_constant::assign_map_element (SLList<string>& list,
 				   tree_constant& rhs,
 				   const Octave_object& args)
 {
@@ -342,7 +373,7 @@
   Pix p = list.first ();
   while (p)
     {
-      char *elt = list (p);
+      string elt = list (p);
 
       list.next (p);
 
@@ -391,38 +422,17 @@
     os << ")";
 }
 
-int
-print_as_scalar (const tree_constant& val)
-{
-  int nr = val.rows ();
-  int nc = val.columns ();
-  return (val.is_scalar_type ()
-	  || (val.is_string () && nr <= 1)
-	  || (val.is_matrix_type ()
-	      && ((nr == 1 && nc == 1)
-		  || nr == 0
-		  || nc == 0)));
-}
-
-int
-print_as_structure (const tree_constant& val)
-{
-  return val.is_map ();
-}
-
 // The real representation of constants.
 
 TC_REP::tree_constant_rep (void)
 {
   type_tag = unknown_constant;
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (double d)
 {
   scalar = d;
   type_tag = scalar_constant;
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const Matrix& m)
@@ -437,7 +447,6 @@
       matrix = new Matrix (m);
       type_tag = matrix_constant;
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const DiagMatrix& d)
@@ -452,7 +461,6 @@
       matrix = new Matrix (d);
       type_tag = matrix_constant;
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const RowVector& v, int prefer_column_vector)
@@ -486,7 +494,6 @@
 	  type_tag = matrix_constant;
 	}
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const ColumnVector& v, int prefer_column_vector)
@@ -520,7 +527,6 @@
 	  type_tag = matrix_constant;
 	}
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const Complex& c)
@@ -535,7 +541,6 @@
       complex_scalar = new Complex (c);
       type_tag = complex_scalar_constant;
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const ComplexMatrix& m)
@@ -560,7 +565,6 @@
       complex_matrix = new ComplexMatrix (m);
       type_tag = complex_matrix_constant;
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const ComplexDiagMatrix& d)
@@ -585,7 +589,6 @@
       complex_matrix = new ComplexMatrix (d);
       type_tag = complex_matrix_constant;
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const ComplexRowVector& v,
@@ -630,7 +633,6 @@
 	  type_tag = complex_matrix_constant;
 	}
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const ComplexColumnVector& v, int
@@ -675,28 +677,38 @@
 	  type_tag = complex_matrix_constant;
 	}
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const char *s)
 {
   char_matrix = new charMatrix (s);
   type_tag = char_matrix_constant_str;
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const string& s)
 {
   char_matrix = new charMatrix (s);
   type_tag = char_matrix_constant_str;
-  orig_text = 0;
+}
+
+TC_REP::tree_constant_rep (const string_vector& s)
+{
+  int nr = s.length ();
+  int nc = s.max_length ();
+  char_matrix = new charMatrix (nr, nc, 0);
+  for (int i = 0; i < nr; i++)
+    {
+      nc = s[i].length ();
+      for (int j = 0; j < nc; j++)
+	char_matrix->elem (i, j) = s[i][j];
+    }
+  type_tag = char_matrix_constant_str;
 }
 
 TC_REP::tree_constant_rep (const charMatrix& chm, int is_str)
 {
   char_matrix = new charMatrix (chm);
   type_tag = is_str ? char_matrix_constant_str : char_matrix_constant;
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (double b, double l, double i)
@@ -727,7 +739,6 @@
 	    ::error ("invalid range");
 	}
     }
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const Range& r)
@@ -756,22 +767,18 @@
       else
 	::error ("invalid range");
     }
-
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const Octave_map& m)
 {
   a_map = new Octave_map (m);
   type_tag = map_constant;
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (TC_REP::constant_type t)
 {
   assert (t == magic_colon || t == all_va_args);
   type_tag = t;
-  orig_text = 0;
 }
 
 TC_REP::tree_constant_rep (const tree_constant_rep& t)
@@ -820,7 +827,7 @@
       break;
     }
 
-  orig_text = strsave (t.orig_text);
+  orig_text = t.orig_text;
 }
 
 TC_REP::~tree_constant_rep (void)
@@ -858,8 +865,6 @@
     case all_va_args:
       break;
     }
-
-  delete [] orig_text;
 }
 
 void *
@@ -1505,7 +1510,7 @@
 }
 
 tree_constant&
-TC_REP::lookup_map_element (const char *name, int insert, int silent)
+TC_REP::lookup_map_element (const string& name, int insert, int silent)
 {
   static tree_constant retval;
 
@@ -1518,7 +1523,7 @@
       else if (insert)
 	return (*a_map) [name];
       else if (! silent)
-	error ("structure has no member `%s'", name);
+	error ("structure has no member `%s'", name.c_str ());
     }
   else if (! silent)
     error ("invalid structure access attempted");
@@ -2119,9 +2124,9 @@
 }
 
 void
-TC_REP::stash_original_text (char *s)
+TC_REP::stash_original_text (const string &s)
 {
-  orig_text = strsave (s);
+  orig_text = s;
 }
 
 void
@@ -2257,13 +2262,13 @@
 
 	    for (Pix p = a_map->first (); p != 0; a_map->next (p))
 	      {
-		const char *key = a_map->key (p);
+		string key = a_map->key (p);
 		tree_constant val = a_map->contents (p);
 
 		output_buf.form ("%*s%s = ", structure_indent_level,
-				 "", key);
-
-		if (! (print_as_scalar (val) || print_as_structure (val))) 
+				 "", key.c_str ());
+
+		if (! (print_as_scalar () || print_as_structure ())) 
 		  output_buf << "\n";
 
 		val.print (output_buf);
@@ -2294,10 +2299,10 @@
   switch (type_tag)
     {
     case scalar_constant:
-      if (orig_text)
+      if (orig_text.empty ())
+	octave_print_internal (os, scalar, 1);
+      else
 	os << orig_text;
-      else
-	octave_print_internal (os, scalar, 1);
       break;
 
     case matrix_constant:
@@ -2313,7 +2318,7 @@
 	// print the original text, because this must be a constant
 	// that was parsed as part of a function.
 
-	if (orig_text && re == 0.0 && im > 0.0)
+	if (! orig_text.empty () && re == 0.0 && im > 0.0)
 	  os << orig_text;
 	else
 	  octave_print_internal (os, *complex_scalar, 1);
@@ -3108,6 +3113,25 @@
     maybe_mutate ();
 }
 
+int
+TC_REP::print_as_scalar (void)
+{
+  int nr = rows ();
+  int nc = columns ();
+  return (is_scalar_type ()
+	  || (is_string () && nr <= 1)
+	  || (is_matrix_type ()
+	      && ((nr == 1 && nc == 1)
+		  || nr == 0
+		  || nc == 0)));
+}
+
+int
+TC_REP::print_as_structure (void)
+{
+  return is_map ();
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/pt-const.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-const.h	Mon Jan 22 04:47:22 1996 +0000
@@ -36,6 +36,7 @@
 
 #include "Range.h"
 #include "mx-base.h"
+#include "str-vec.h"
 
 #include "pt-fvc.h"
 
@@ -96,6 +97,7 @@
 
 	tree_constant_rep (const char *s);
 	tree_constant_rep (const string& s);
+	tree_constant_rep (const string_vector& s);
 	tree_constant_rep (const charMatrix& chm, int is_string);
 
 	tree_constant_rep (double base, double limit, double inc);
@@ -218,7 +220,8 @@
 	Range range_value (void) const;
 	Octave_map map_value (void) const;
 
-	tree_constant& lookup_map_element (const char *name, int insert = 0,
+	tree_constant& lookup_map_element (const string& name,
+					   int insert = 0,
 					   int silent = 0);
 
 	ColumnVector vector_value (int frc_str_conv = 0,
@@ -236,7 +239,7 @@
 	void resize (int i, int j);
 	void resize (int i, int j, double val);
 
-	void stash_original_text (char *s);
+	void stash_original_text (const string& s);
 
 	void maybe_mutate (void);
 
@@ -289,6 +292,10 @@
 
 	void assign (tree_constant& rhs, const Octave_object& args);
 
+	int print_as_scalar (void);
+
+	int print_as_structure (void);
+
 	// Data.
 
 	union
@@ -308,7 +315,7 @@
 
 	int count;
 
-	char *orig_text;
+	string orig_text;
     };
 
   union
@@ -387,6 +394,10 @@
   tree_constant (const string& s, int l = -1, int c = -1) : tree_fvc (l, c)
     { rep = new tree_constant_rep (s); rep->count = 1; }
 
+  tree_constant (const string_vector& s, int l = -1, int c = -1)
+    : tree_fvc (l, c)
+    { rep = new tree_constant_rep (s); rep->count = 1; }
+
   tree_constant (const charMatrix& chm, int is_string = 0) : tree_fvc ()
     { rep = new tree_constant_rep (chm, is_string); rep->count = 1; }
 
@@ -450,12 +461,12 @@
 
   // Simple structure assignment.
 
-  tree_constant assign_map_element (SLList<char*>& list,
+  tree_constant assign_map_element (SLList<string>& list,
 				    tree_constant& rhs);
 
   // Indexed structure assignment.
 
-  tree_constant assign_map_element (SLList<char*>& list,
+  tree_constant assign_map_element (SLList<string>& list,
 				    tree_constant& rhs,
 				    const Octave_object& args);
 
@@ -557,10 +568,10 @@
 
   Octave_map map_value (void) const;
 
-  tree_constant lookup_map_element (const char *ref, int insert = 0,
+  tree_constant lookup_map_element (const string& ref, int insert = 0,
 				    int silent = 0);
 
-  tree_constant lookup_map_element (SLList<char*>& list,
+  tree_constant lookup_map_element (SLList<string>& list,
 				    int insert = 0, int silent = 0);
 
   ColumnVector vector_value (int /* frc_str_conv */ = 0,
@@ -606,6 +617,10 @@
   void print (void);
   void print (ostream& os) { rep->print (os); }
 
+  void print_with_name (const string& name, int print_padding = 1);
+  void print_with_name (ostream& os, const string& name,
+			int print_padding = 1);
+
   // Evaluate this constant, possibly converting complex to real, or
   // matrix to scalar, etc.
 
@@ -625,7 +640,7 @@
   // Store the original text corresponding to this constant for later
   // pretty printing.
 
-  void stash_original_text (char *s)
+  void stash_original_text (const string& s)
     { rep->stash_original_text (s); }
 
   // Pretty print this constant.
@@ -665,11 +680,11 @@
       else
 	return rep->make_numeric (frc_str_conv);
     }
-};
+
+  int print_as_scalar (void) { return rep->print_as_scalar (); }
 
-extern int print_as_scalar (const tree_constant& val);
-
-extern int print_as_structure (const tree_constant& val);
+  int print_as_structure (void) { return rep->print_as_structure (); }
+};
 
 #endif
 
--- a/src/pt-exp.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-exp.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -53,39 +53,6 @@
 // Nonzero means we're breaking out of a loop or function body.
 extern int breaking;
 
-// But first, some extra functions used by the tree classes.
-
-static void
-print_constant (tree_constant& tc, char *name, int print_padding = 1)
-{
-  int pad_after = 0;
-  if (user_pref.print_answer_id_name)
-    {
-      if (print_as_scalar (tc) || print_as_structure (tc))
-	{
-	  ostrstream output_buf;
-	  output_buf << name << " = " << ends;
-	  maybe_page_output (output_buf);
-	}
-      else
-	{
-	  pad_after = 1;
-	  ostrstream output_buf;
-	  output_buf << name << " =\n\n" << ends;
-	  maybe_page_output (output_buf);
-	}
-    }
-
-  tc.eval (1);
-
-  if (print_padding && pad_after)
-    {
-      ostrstream output_buf;
-      output_buf << "\n" << ends;
-      maybe_page_output (output_buf);
-    }
-}
-
 // Prefix expressions.
 
 tree_prefix_expression::~tree_prefix_expression (void)
@@ -715,7 +682,7 @@
     }
 
   if (! error_state && print && retval.is_defined ())
-    print_constant (retval, lhs->name ());
+    retval.print_with_name (lhs->name ());
 
   return retval;
 }
--- a/src/pt-fcn.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-fcn.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -81,8 +81,6 @@
   delete ret_list;
   delete sym_tab;
   delete cmd_list;
-  delete [] file_name;
-  delete [] fcn_name;
   delete vr_list;
 }
 
@@ -123,14 +121,16 @@
 void
 tree_function::stash_fcn_file_name (void)
 {
-  delete [] file_name;
-  file_name = fcn_name ? fcn_file_in_path (fcn_name) : 0;
+  if (fcn_name.empty ())
+    file_name = "";
+  else
+    file_name = fcn_file_in_path (fcn_name);
 }
 
 void
 tree_function::mark_as_system_fcn_file (void)
 {
-  if (file_name)
+  if (! file_name.empty ())
     {
       // We really should stash the whole path to the file we found,
       // when we looked it up, to avoid possible race conditions...
@@ -141,15 +141,12 @@
       // function file is parsed, it probably doesn't matter that
       // much.
 
-      char *ff_name = fcn_file_in_path (file_name);
-
-      char *system_dir = octave_fcn_file_dir ();
-      int len = strlen (system_dir);
+      string ff_name = fcn_file_in_path (file_name);
 
-      if (strncmp (system_dir, ff_name, len) == 0)
+      string system_dir = octave_fcn_file_dir ();
+
+      if (system_dir.compare (ff_name, 0, system_dir.length ()) == 0)
 	system_fcn_file = 1;
-
-      delete [] ff_name;
     }
   else
     system_fcn_file = 0;
@@ -204,10 +201,9 @@
 }
 
 void
-tree_function::stash_function_name (char *s)
+tree_function::stash_function_name (const string& s)
 {
-  delete [] fcn_name;
-  fcn_name = strsave (s);
+  fcn_name = s;
 }
 
 tree_constant
@@ -304,7 +300,8 @@
   unwind_protect_ptr (curr_function);
   curr_function = this;
 
-  //  unwind_protect_ptr (args_passed);
+  // XXX FIXME XXX -- ???
+  // unwind_protect_ptr (args_passed);
 
   args_passed = args;
 
@@ -383,19 +380,20 @@
   if (error_state >= 0)
     error_state = -1;
 
-  if (fcn_name)
+  if (fcn_name.empty ())
     {
-      if (file_name)
-	::error ("called from `%s' in file `%s'", fcn_name, file_name);
-      else 
-	::error ("called from `%s'", fcn_name);
+      if (file_name.empty ())
+	::error ("called from `?unknown?'");
+      else
+	::error ("called from file `%s'", file_name.c_str ());
     }
   else
     {
-      if (file_name)
-	::error ("called from file `%s'", file_name);
-      else
-	::error ("called from `?unknown?'");
+      if (file_name.empty ())
+	::error ("called from `%s'", fcn_name.c_str ());
+      else 
+	::error ("called from `%s' in file `%s'",
+		 fcn_name.c_str (), file_name.c_str ());
     }
 }
 
@@ -447,7 +445,7 @@
       os << " = ";
     }
 
-  os << (fcn_name ? fcn_name : "(null)") << " ";
+  os << (fcn_name.empty () ? string ("(empty)") : fcn_name) << " ";
 
   if (param_list)
     {
--- a/src/pt-fcn.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-fcn.h	Mon Jan 22 04:47:22 1996 +0000
@@ -32,6 +32,8 @@
 
 class ostream;
 
+#include <string>
+
 class tree_parameter_list;
 class tree_statement_list;
 class tree_va_return_list;
@@ -57,8 +59,6 @@
       ret_list = 0;
       sym_tab = 0;
       cmd_list = 0;
-      file_name = 0;
-      fcn_name = 0;
       t_parsed = 0;
       system_fcn_file = 0;
       num_named_args = 0;
@@ -92,7 +92,7 @@
   void stash_fcn_file_time (time_t t)
     { t_parsed = t; }
 
-  char *fcn_file_name (void)
+  string fcn_file_name (void)
     { return file_name; }
 
   time_t time_parsed (void)
@@ -116,9 +116,9 @@
 
   void octave_vr_val (const tree_constant& val);
 
-  void stash_function_name (char *s);
+  void stash_function_name (const string& s);
 
-  char *function_name (void)
+  string function_name (void)
     { return fcn_name; }
 
   tree_constant eval (int print);
@@ -135,8 +135,8 @@
   tree_parameter_list *ret_list;
   symbol_table *sym_tab;
   tree_statement_list *cmd_list;
-  char *file_name;
-  char *fcn_name;
+  string file_name;
+  string fcn_name;
   time_t t_parsed;
   int system_fcn_file;
   int num_named_args;
--- a/src/pt-fvc-base.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-fvc-base.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -47,11 +47,12 @@
   return tree_constant ();
 }
 
-char *
+string
 tree_fvc::name (void) const
 {
+  string retval;
   panic_impossible ();
-  return 0;
+  return retval;
 }
 
 void
@@ -61,7 +62,7 @@
 }
 
 tree_constant
-tree_fvc::lookup_map_element (SLList<char*>&, int, int)
+tree_fvc::lookup_map_element (SLList<string>&, int, int)
 {
   static tree_constant retval;
 
--- a/src/pt-fvc-base.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-fvc-base.h	Mon Jan 22 04:47:22 1996 +0000
@@ -32,6 +32,8 @@
 
 class ostream;
 
+#include <string>
+
 #include <SLList.h>
 
 class tree_constant;
@@ -52,15 +54,15 @@
   virtual tree_constant assign (tree_constant& t,
 				const Octave_object& args);
 
-  virtual char *name (void) const;
+  virtual string name (void) const;
 
   virtual void bump_value (tree_expression::type);
 
-  virtual tree_constant lookup_map_element (SLList<char*>& list,
+  virtual tree_constant lookup_map_element (SLList<string>& list,
 					    int insert = 0, int silent = 0);
 
-  virtual char *fcn_file_name (void)
-    { return 0; }
+  virtual string fcn_file_name (void)
+    { return string (); }
 
   virtual time_t time_parsed (void);
 
--- a/src/pt-fvc.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-fvc.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -71,37 +71,6 @@
   return 0;
 }
 
-static void
-print_constant (tree_constant& tc, char *name, int print_padding = 1)
-{
-  int pad_after = 0;
-  if (user_pref.print_answer_id_name)
-    {
-      if (print_as_scalar (tc) || print_as_structure (tc))
-	{
-	  ostrstream output_buf;
-	  output_buf << name << " = " << ends;
-	  maybe_page_output (output_buf);
-	}
-      else
-	{
-	  pad_after = 1;
-	  ostrstream output_buf;
-	  output_buf << name << " =\n\n" << ends;
-	  maybe_page_output (output_buf);
-	}
-    }
-
-  tc.eval (1);
-
-  if (print_padding && pad_after)
-    {
-      ostrstream output_buf;
-      output_buf << "\n" << ends;
-      maybe_page_output (output_buf);
-    }
-}
-
 // Make sure that all arguments have values.
 
 // Are any of the arguments `:'?
@@ -120,10 +89,13 @@
 
 // Symbols from the symbol table.
 
-char *
+string
 tree_identifier::name (void) const
 {
-  return sym ? sym->name () : 0;
+  string retval;
+  if (sym)
+    retval = sym->name ();
+  return retval;
 }
 
 tree_identifier *
@@ -141,10 +113,10 @@
 }
 
 void
-tree_identifier::document (char *s)
+tree_identifier::document (const string& s)
 {
-  if (sym && s)
-    sym->document (strsave (s));
+  if (sym)
+    sym->document (s);
 }
 
 tree_constant
@@ -226,7 +198,7 @@
 }
 
 tree_constant
-tree_identifier::assign (SLList<char*> list, tree_constant& rhs)
+tree_identifier::assign (SLList<string> list, tree_constant& rhs)
 {
   tree_constant retval;
 
@@ -258,7 +230,7 @@
 }
 
 tree_constant
-tree_identifier::assign (SLList<char*> list, tree_constant& rhs,
+tree_identifier::assign (SLList<string> list, tree_constant& rhs,
 			 const Octave_object& args)
 {
   tree_constant retval;
@@ -317,7 +289,8 @@
     {
       if (sym->is_read_only ())
 	{
-	  ::error ("can't redefined read-only variable `%s'", name ());
+	  ::error ("can't redefined read-only variable `%s'",
+		   name ().c_str ());
 	}
       else
 	{
@@ -331,13 +304,13 @@
 void
 tree_identifier::eval_undefined_error (void)
 {
-  char *nm = name ();
   int l = line ();
   int c = column ();
   if (l == -1 && c == -1)
-    ::error ("`%s' undefined", nm);
+    ::error ("`%s' undefined", name ().c_str ());
   else
-    ::error ("`%s' undefined near line %d column %d", nm, l, c);
+    ::error ("`%s' undefined near line %d column %d",
+	     name ().c_str (), l, c);
 }
 
 // Try to find a definition for an identifier.  Here's how:
@@ -420,7 +393,7 @@
       if (maybe_do_ans_assign && ! object_to_eval->is_constant ())
 	bind_ans (retval, print);
       else if (print)
-	print_constant (retval, name ());
+	retval.print_with_name (name ());
     }
 
   return retval;
@@ -473,8 +446,8 @@
   if (in_parens)
     os << "(";
 
-  char *nm = name ();
-  os << (nm) ? nm : "(null)";
+  string nm = name ();
+  os << (nm.empty () ? string ("(empty)") : nm);
 
   if (in_parens)
     os << ")";
@@ -484,49 +457,33 @@
 
 tree_indirect_ref::~tree_indirect_ref (void)
 {
-  while (! refs.empty ())
-    {
-      char *t = refs.remove_front ();
-      delete [] t;
-    }
-
   if (! preserve_ident)
     delete id;
 }
 
 tree_indirect_ref *
-tree_indirect_ref::chain (const char *elt)
+tree_indirect_ref::chain (const string& elt)
 {
-  refs.append (strsave (elt));
+  refs.append (elt);
   return this;
 }
 
-char *
-tree_indirect_ref::name (void)
+string
+tree_indirect_ref::name (void) const
 {
-  char *id_nm = id->name ();
+  string id_nm = id->name ();
+
   if (refs.empty ())
     return id_nm;
   else
     {
-      static char *nm = 0;
-      delete [] nm;
-
-      ostrstream tmp;
-
-      tmp << id_nm;
-
       for (Pix p = refs.first (); p != 0; refs.next (p))
 	{
-	  char *elt = refs (p);
-
-	  if (elt)
-	    tmp << "." << elt;
+	  id_nm.append (".");
+	  id_nm.append (refs (p));
 	}
 
-      tmp << ends;
-      nm = tmp.str ();
-      return nm;
+      return id_nm;
     }
 }
 
@@ -579,7 +536,7 @@
 	  retval = object_to_eval->lookup_map_element (refs);
 
 	  if (! error_state && print)
-	    print_constant (retval, name ());
+	    retval.print_with_name (name ());
 	}
       else
 	id->eval_undefined_error ();
@@ -618,7 +575,7 @@
 		{
 		  tmp = retval (0);
 		  if (tmp.is_defined ())
-		    print_constant (tmp, name ());
+		    tmp.print_with_name (name ());
 		}
 	    }
 	}
@@ -637,16 +594,11 @@
   if (in_parens)
     os << "(";
 
-  char *nm = id ? id->name () : "(null)";
-  os << (nm) ? nm : "(null)";
+  string nm = id ? id->name () : string ("(null)");
+  os << (nm.empty () ? string ("(empty)") : nm);
 
   for (Pix p = refs.first (); p != 0; refs.next (p))
-    {
-      char *elt = refs (p);
-
-      if (elt)
-	os << "." << elt;
-    }
+    os << "." << refs (p);
 
   if (in_parens)
     os << ")";
@@ -654,27 +606,26 @@
 
 // Builtin functions.
 
-tree_builtin::tree_builtin (const char *nm)
+tree_builtin::tree_builtin (const string& nm)
 {
   is_mapper = 0;
   fcn = 0;
-  if (nm)
-    my_name = strsave (nm);
+  my_name = nm;
 }
 
-tree_builtin::tree_builtin (Mapper_fcn& m_fcn, const char *nm)
+tree_builtin::tree_builtin (Mapper_fcn& m_fcn, const string &nm)
 {
   mapper_fcn = m_fcn;
   is_mapper = 1;
   fcn = 0;
-  my_name = nm ? strsave (nm) : 0;
+  my_name = nm;
 }
 
-tree_builtin::tree_builtin (Octave_builtin_fcn g_fcn, const char *nm)
+tree_builtin::tree_builtin (Octave_builtin_fcn g_fcn, const string& nm)
 {
   is_mapper = 0;
   fcn = g_fcn;
-  my_name = nm ? strsave (nm) : 0;
+  my_name = nm;
 }
 
 tree_constant
@@ -696,7 +647,7 @@
     }
   else if (is_mapper)
     {
-      ::error ("%s: too few arguments", my_name);
+      ::error ("%s: too few arguments", my_name.c_str ());
     }
   else
     {
@@ -705,7 +656,7 @@
       if (fcn)
 	goto eval_fcn;
       else
-	::error ("unable to load builtin function %s", my_name);
+	::error ("unable to load builtin function %s", my_name.c_str ());
     }
 
   return retval;
@@ -729,12 +680,14 @@
 	      if (m_fcn.c_c_mapper)
 		retval = m_fcn.c_c_mapper (Complex (d));
 	      else
-		error ("%s: unable to handle real arguments", m_fcn.name);
+		error ("%s: unable to handle real arguments",
+		       m_fcn.name.c_str ());
 	    }
 	  else if (m_fcn.d_d_mapper)
 	    retval = m_fcn.d_d_mapper (d);
 	  else
-	    error ("%s: unable to handle real arguments", m_fcn.name);
+	    error ("%s: unable to handle real arguments",
+		   m_fcn.name.c_str ());
 	}
       else
 	{
@@ -750,12 +703,14 @@
 	      if (m_fcn.c_c_mapper)
 		retval = map (m_fcn.c_c_mapper, ComplexMatrix (m));
 	      else
-		error ("%s: unable to handle real arguments", m_fcn.name);
+		error ("%s: unable to handle real arguments",
+		       m_fcn.name.c_str ());
 	    }
 	  else if (m_fcn.d_d_mapper)
 	    retval = map (m_fcn.d_d_mapper, m);
 	  else
-	    error ("%s: unable to handle real arguments", m_fcn.name);
+	    error ("%s: unable to handle real arguments",
+		   m_fcn.name.c_str ());
 	}
     }
   else if (arg.is_complex_type ())
@@ -769,7 +724,8 @@
 	  else if (m_fcn.c_c_mapper)
 	    retval = m_fcn.c_c_mapper (c);
 	  else
-	    error ("%s: unable to handle complex arguments", m_fcn.name);
+	    error ("%s: unable to handle complex arguments",
+		   m_fcn.name.c_str ());
 	}
       else
 	{
@@ -783,7 +739,8 @@
 	  else if (m_fcn.c_c_mapper)
 	    retval = map (m_fcn.c_c_mapper, cm);
 	  else
-	    error ("%s: unable to handle complex arguments", m_fcn.name);
+	    error ("%s: unable to handle complex arguments",
+		   m_fcn.name.c_str ());
 	}
     }
   else
@@ -816,7 +773,7 @@
 // XXX FIXME XXX -- should we just assume nargin_max == 1?
 //
 //      if (nargin > nargin_max)
-//	::error ("%s: too many arguments", my_name);
+//	::error ("%s: too many arguments", my_name.c_str ());
 //      else
       if (nargin > 0 && args(0).is_defined ())
 	{
@@ -825,7 +782,7 @@
 	}
       else
 	{
-	  ::error ("%s: too few arguments", my_name);
+	  ::error ("%s: too few arguments", my_name.c_str ());
 	}
     }
   else
@@ -835,7 +792,7 @@
       if (fcn)
 	goto eval_fcn;
       else
-	::error ("unable to load builtin function %s", my_name);
+	::error ("unable to load builtin function %s", my_name.c_str ());
     }
 
   return retval;
--- a/src/pt-fvc.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-fvc.h	Mon Jan 22 04:47:22 1996 +0000
@@ -58,18 +58,18 @@
   int is_identifier (void) const
     { return 1; }
 
-  char *name (void) const;
+  string name (void) const;
 
   tree_identifier *define (tree_constant *t);
   tree_identifier *define (tree_function *t);
 
-  void document (char *s);
+  void document (const string& s);
 
   tree_constant assign (tree_constant& t);
   tree_constant assign (tree_constant& t, const Octave_object& args);
 
-  tree_constant assign (SLList<char*> list, tree_constant& t);
-  tree_constant assign (SLList<char*> list, tree_constant& t,
+  tree_constant assign (SLList<string> list, tree_constant& t);
+  tree_constant assign (SLList<string> list, tree_constant& t,
 			const Octave_object& args); 
 
   int is_defined (void);
@@ -112,7 +112,7 @@
 
   ~tree_indirect_ref (void);
 
-  tree_indirect_ref *chain (const char *s);
+  tree_indirect_ref *chain (const string& s);
 
   int is_indirect_ref (void) const
     { return 1; }
@@ -126,7 +126,7 @@
   void preserve_identifier (void)
     { preserve_ident = 1; }
 
-  char *name (void);
+  string name (void) const;
 
   tree_constant assign (tree_constant& t);
   tree_constant assign (tree_constant& t, const Octave_object& args);
@@ -142,7 +142,7 @@
 
 private:
   tree_identifier *id;
-  SLList<char*> refs;
+  SLList<string> refs;
   int preserve_ident;
 };
 
@@ -152,11 +152,11 @@
 tree_builtin : public tree_fvc
 {
 public:
-  tree_builtin (const char *nm = 0);
+  tree_builtin (const string& nm = string ());
 
-  tree_builtin (Mapper_fcn& m_fcn, const char *nm = 0);
+  tree_builtin (Mapper_fcn& m_fcn, const string& nm = string ());
 
-  tree_builtin (Octave_builtin_fcn f, const char *nm = 0);
+  tree_builtin (Octave_builtin_fcn f, const string& nm = string ());
 
   ~tree_builtin (void) { }  // XXX ?? XXX
 
@@ -169,7 +169,7 @@
 
   Octave_object eval (int print, int nargout, const Octave_object& args);
 
-  char *name (void) const
+  string name (void) const
     { return my_name; }
 
   void print_code (ostream& os);
@@ -178,7 +178,7 @@
   int is_mapper;
   Mapper_fcn mapper_fcn;
   Octave_builtin_fcn fcn;
-  char *my_name;
+  string my_name;
 };
 
 #endif
--- a/src/pt-mvr.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-mvr.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -44,37 +44,6 @@
 
 // But first, some extra functions used by the tree classes.
 
-static void
-print_constant (tree_constant& tc, char *name, int print_padding = 1)
-{
-  int pad_after = 0;
-  if (user_pref.print_answer_id_name)
-    {
-      if (print_as_scalar (tc) || print_as_structure (tc))
-	{
-	  ostrstream output_buf;
-	  output_buf << name << " = " << ends;
-	  maybe_page_output (output_buf);
-	}
-      else
-	{
-	  pad_after = 1;
-	  ostrstream output_buf;
-	  output_buf << name << " =\n\n" << ends;
-	  maybe_page_output (output_buf);
-	}
-    }
-
-  tc.eval (1);
-
-  if (print_padding && pad_after)
-    {
-      ostrstream output_buf;
-      output_buf << "\n" << ends;
-      maybe_page_output (output_buf);
-    }
-}
-
 // Make sure that all arguments have values.
 
 static int
@@ -128,7 +97,7 @@
   delete list;
 }
 
-char *
+string
 tree_index_expression::name (void)
 {
   return id->name ();
@@ -380,7 +349,7 @@
 		}
 
 	      if (print)
-		print_constant (results(i), lhs_expr->name (), 0);
+		results(i).print_with_name (lhs_expr->name (), 0);
 
 	      pad_after++;
 	      i++;
--- a/src/pt-mvr.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-mvr.h	Mon Jan 22 04:47:22 1996 +0000
@@ -38,6 +38,8 @@
 class tree_indirect_ref;
 class tree_return_list;
 
+#include <string>
+
 #include "pt-const.h"
 #include "pt-mvr-base.h"
 #include "oct-obj.h"
@@ -94,7 +96,7 @@
   tree_indirect_ref *ident (void)
     { return id; }
 
-  char *name (void);
+  string name (void);
 
   tree_argument_list *arg_list (void)
     { return list; }
--- a/src/pt-plot.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-plot.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -45,6 +45,8 @@
 #include "SLStack.h"
 #include "procstream.h"
 
+#include "str-vec.h"
+
 #include "defun.h"
 #include "error.h"
 #include "gripes.h"
@@ -121,10 +123,11 @@
 
       plot_line_count = 0;
 
-      char *plot_prog = user_pref.gnuplot_binary;
-      if (plot_prog)
+      string plot_prog = user_pref.gnuplot_binary;
+
+      if (! plot_prog.empty ())
 	{
-	  plot_stream = new oprocstream (plot_prog);
+	  plot_stream = new oprocstream (plot_prog.c_str ());
 
 	  if (plot_stream && ! *plot_stream)
 	    {
@@ -135,9 +138,9 @@
 	  if (! plot_stream)
 	    {
 	      warning ("plot: unable to open pipe to `%s'",
-		       plot_prog);
+		       plot_prog.c_str ());
 
-	      if (strcmp (plot_prog, "gnuplot") != 0)
+	      if (plot_prog == "gnuplot")
 		{
 		  warning ("having trouble finding plotting program.");
 		  warning ("trying again with `gnuplot'");
@@ -158,7 +161,8 @@
 	    }
 
 	  if (! plot_stream)
-	    error ("plot: unable to open pipe to `%s'", plot_prog);
+	    error ("plot: unable to open pipe to `%s'",
+		   plot_prog.c_str ());
 	}
     }
 
@@ -558,31 +562,30 @@
     }
 }
 
-subplot_style::subplot_style (char *s)
+subplot_style::subplot_style (const string& s)
 {
-  style = strsave (s);
+  style = s;
   linetype = 0;
   pointtype = 0;
 }
 
-subplot_style::subplot_style (char *s, tree_expression *lt)
+subplot_style::subplot_style (const string& s, tree_expression *lt)
 {
-  style = strsave (s);
+  style = s;
   linetype = lt;
   pointtype = 0;
 }
 
-subplot_style::subplot_style (char *s, tree_expression *lt,
+subplot_style::subplot_style (const string& s, tree_expression *lt,
 			      tree_expression *pt)
 {
-  style = strsave (s);
+  style = s;
   linetype = lt;
   pointtype = pt;
 }
 
 subplot_style::~subplot_style (void)
 {
-  delete [] style;
   delete linetype;
   delete pointtype;
 }
@@ -590,7 +593,7 @@
 int
 subplot_style::print (ostrstream& plot_buf)
 {
-  if (style)
+  if (! style.empty ())
     {
       plot_buf << " " << GNUPLOT_COMMAND_WITH << " " << style;
 
@@ -645,9 +648,8 @@
 int
 subplot_style::errorbars (void)
 {
-  return (style
-	  && (almost_match ("errorbars", style, 1, 0)
-	      || almost_match ("boxerrorbars", style, 5, 0)));
+  return (almost_match ("errorbars", style, 1, 0)
+	  || almost_match ("boxerrorbars", style, 5, 0));
 }
 
 void
@@ -909,19 +911,21 @@
     }
 }
 
-char *
+string
 save_in_tmp_file (tree_constant& t, int ndim, int parametric)
 {
-  char *name = octave_tmp_file_name ();
-  if (name)
+  string name = octave_tmp_file_name ();
+
+  if (! name.empty ())
     {
-      ofstream file (name);
+      ofstream file (name.c_str ());
+
       if (file)
 	{
 	  switch (ndim)
 	    {
 	    case 2:
-	      save_ascii_data (file, t, 0, 1);
+	      save_ascii_data (file, t, name, 1);
 	      break;
 
 	    case 3:
@@ -935,10 +939,11 @@
 	}
       else
 	{
-	  error ("couldn't open temporary output file `%s'", name);
-	  name = 0;
+	  error ("couldn't open temporary output file `%s'", name.c_str ());
+	  name.resize (0);
 	}
     }
+
   return name;
 }
 
@@ -971,7 +976,7 @@
 }
 
 void
-do_external_plotter_cd (const char *newdir)
+do_external_plotter_cd (const string& newdir)
 {
   if (plot_stream && *plot_stream)
     {
@@ -1025,7 +1030,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("hold");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "hold");
+
+  if (error_state)
+    return retval;
 
   switch (argc)
     {
@@ -1034,9 +1044,9 @@
       break;
 
     case 2:
-      if (strcasecmp (argv[1], "on") == 0)
+      if (argv[1] == "on")
 	clear_before_plotting = 0;
-      else if (strcasecmp (argv[1], "off") == 0)
+      else if (argv[1] == "off")
 	clear_before_plotting = 1;
       else
 	print_usage ("hold");
@@ -1047,8 +1057,6 @@
       break;
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -1075,7 +1083,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("set");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "set");
+
+  if (error_state)
+    return retval;
 
   ostrstream plot_buf;
 
@@ -1106,8 +1119,6 @@
 
   delete [] plot_command;
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -1118,7 +1129,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("show");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "show");
+
+  if (error_state)
+    return retval;
 
   ostrstream plot_buf;
 
@@ -1132,8 +1148,6 @@
 
   delete [] plot_command;
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/pt-plot.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/pt-plot.h	Mon Jan 22 04:47:22 1996 +0000
@@ -165,9 +165,9 @@
   subplot_style (void)
     : tree_print_code (), style (0), linetype (0), pointtype (0) { }
 
-  subplot_style (char *s);
-  subplot_style (char *s, tree_expression *lt);
-  subplot_style (char *s, tree_expression *lt, tree_expression *pt);
+  subplot_style (const string& s);
+  subplot_style (const string& s, tree_expression *lt);
+  subplot_style (const string& s, tree_expression *lt, tree_expression *pt);
 
   ~subplot_style (void);
 
@@ -178,7 +178,7 @@
   void print_code (ostream& os);
 
 private:
-  char *style;
+  string style;
   tree_expression *linetype;
   tree_expression *pointtype;
 };
@@ -234,8 +234,8 @@
   void print_code (ostream& os);
 };
 
-extern char *save_in_tmp_file (tree_constant& t, int ndim = 2,
-			       int parametric = 0);
+extern string save_in_tmp_file (tree_constant& t, int ndim = 2,
+				int parametric = 0);
 
 extern void mark_for_deletion (const string&);
 
@@ -243,7 +243,7 @@
 
 extern void close_plot_stream (void);
 
-extern void do_external_plotter_cd (const char *newdir);
+extern void do_external_plotter_cd (const string& newdir);
 
 #endif
 
--- a/src/qpsol.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/qpsol.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -331,7 +331,7 @@
 }
 
 static void
-set_qpsol_option (const char *keyword, double val)
+set_qpsol_option (const string& keyword, double val)
 {
   QPSOL_OPTIONS *list = qpsol_option_table;
 
@@ -347,7 +347,7 @@
 	      if (xisnan (val))
 		{
 		  error ("qpsol_options: %s: expecting integer, found NaN",
-			 keyword);
+			 keyword.c_str ());
 		}
 	      else
 		(qpsol_opts.*list->i_set_fcn) (NINT (val));
@@ -357,11 +357,11 @@
       list++;
     }
 
-  warning ("qpsol_options: no match for `%s'", keyword);
+  warning ("qpsol_options: no match for `%s'", keyword.c_str ());
 }
 
 static Octave_object
-show_qpsol_option (const char *keyword)
+show_qpsol_option (const string& keyword)
 {
   Octave_object retval;
 
@@ -380,7 +380,7 @@
       list++;
     }
 
-  warning ("qpsol_options: no match for `%s'", keyword);
+  warning ("qpsol_options: no match for `%s'", keyword.c_str ());
 
   return retval;
 }
@@ -419,8 +419,7 @@
     }
   else if (nargin == 1 || nargin == 2)
     {
-      string tstr = args(0).string_value ();
-      const char *keyword = tstr.c_str ();
+      string keyword = args(0).string_value ();
 
       if (! error_state)
 	{
--- a/src/quad.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/quad.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -314,7 +314,7 @@
 }
 
 static void
-set_quad_option (const char *keyword, double val)
+set_quad_option (const string& keyword, double val)
 {
   QUAD_OPTIONS *list = quad_option_table;
 
@@ -330,11 +330,11 @@
       list++;
     }
 
-  warning ("quad_options: no match for `%s'", keyword);
+  warning ("quad_options: no match for `%s'", keyword.c_str ());
 }
 
 static Octave_object
-show_quad_option (const char *keyword)
+show_quad_option (const string& keyword)
 {
   Octave_object retval;
 
@@ -350,7 +350,7 @@
       list++;
     }
 
-  warning ("quad_options: no match for `%s'", keyword);
+  warning ("quad_options: no match for `%s'", keyword.c_str ());
 
   return retval;
 }
@@ -373,8 +373,7 @@
     }
   else if (nargin == 1 || nargin == 2)
     {
-      string tstr = args(0).string_value ();
-      const char *keyword = tstr.c_str ();
+      string keyword = args(0).string_value ();
 
       if (! error_state)
 	{
--- a/src/schur.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/schur.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -63,13 +63,11 @@
 
   tree_constant arg = args(0);
 
-  const char *ord = "U";
-  string tstr;
+  string ord;
 
   if (nargin == 2)
     {
-      tstr = args(1).string_value (); 
-      ord = tstr.c_str ();
+      ord = args(1).string_value (); 
 
       if (error_state)
 	{
@@ -78,10 +76,13 @@
 	}
     }
 
-  if (*ord != 'U' && *ord != 'A' && *ord != 'D'
-      && *ord != 'u' && *ord != 'a' && *ord != 'd')
+  char ord_char = ord.empty () ? 'U' : ord[0];
+
+  if (ord_char != 'U' && ord_char != 'A' && ord_char != 'D'
+      && ord_char != 'u' && ord_char != 'a' && ord_char != 'd')
     {
-      warning ("schur: incorrect ordered schur argument `%c'", *ord);
+      warning ("schur: incorrect ordered schur argument `%c'",
+	       ord.c_str ());
       return retval;
     }
 
@@ -107,7 +108,7 @@
 
       if (! error_state)
 	{
-	  SCHUR result (tmp,ord);
+	  SCHUR result (tmp, ord);
 
 	  if (nargout == 0 || nargout == 1)
 	    {
@@ -126,7 +127,7 @@
 
       if (! error_state)
 	{
-	  ComplexSCHUR result (ctmp,ord);
+	  ComplexSCHUR result (ctmp, ord);
  
 	  if (nargout == 0 || nargout == 1)
 	    {
--- a/src/symtab.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/symtab.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -31,11 +31,13 @@
 
 #include "fnmatch.h"
 
+#include "str-vec.h"
+
 #include "error.h"
-#include "symtab.h"
 #include "pt-const.h"
 #include "pt-fcn.h"
 #include "pt-fvc.h"
+#include "symtab.h"
 #include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
@@ -75,7 +77,6 @@
   eternal = 0;
   read_only = 0;
 
-  help_string = 0;
   definition = 0;
   next_elem = 0;
   count = 0;
@@ -83,7 +84,6 @@
 
 symbol_def::~symbol_def (void)
 {
-  delete [] help_string;
   delete definition;
 }
 
@@ -182,17 +182,16 @@
   return definition;
 }
 
-char *
+string
 symbol_def::help (void) const
 {
   return help_string;
 }
 
 void
-symbol_def::document (const char *h)
+symbol_def::document (const string& h)
 {
-  delete [] help_string;
-  help_string = strsave (h);
+  help_string = h;
 }
 
 int
@@ -216,10 +215,10 @@
   init_state ();
 }
 
-symbol_record::symbol_record (const char *n, symbol_record *nxt)
+symbol_record::symbol_record (const string& n, symbol_record *nxt)
 {
   init_state ();
-  nm = strsave (n);
+  nm = n;
   next_elem = nxt;
 }
 
@@ -228,27 +227,24 @@
 {
   formal_param = 0;
   linked_to_global = 0;
-  nm = 0;
   sv_fcn = 0;
   definition = 0;
   next_elem = 0;
 }
 
-symbol_record::~symbol_record (void)
-{
-  delete [] nm;
-}
-
-char *
+string
 symbol_record::name (void) const
 {
   return nm;
 }
 
-char *
+string
 symbol_record::help (void) const
 {
-  return definition ? definition->help () : 0;
+  string retval;
+  if (definition)
+    retval = definition->help ();
+  return retval;
 }
 
 tree_fvc *
@@ -258,10 +254,9 @@
 }
 
 void
-symbol_record::rename (const char *new_name)
+symbol_record::rename (const string& new_name)
 {
-  delete [] nm;
-  nm = strsave (new_name);
+  nm = new_name;
 }
 
 int
@@ -344,7 +339,7 @@
       definition->protect ();
 
       if (! is_defined ())
-	warning ("protecting undefined variable `%s'", nm);
+	warning ("protecting undefined variable `%s'", nm.c_str ());
     }
 }
 
@@ -363,7 +358,8 @@
       definition->make_eternal ();
 
       if (! is_defined ())
-	warning ("giving eternal life to undefined variable `%s'", nm);
+	warning ("giving eternal life to undefined variable `%s'",
+		 nm.c_str ());
     }
 }
 
@@ -504,14 +500,14 @@
 }
 
 void
-symbol_record::document (const char *h)
+symbol_record::document (const string& h)
 {
   if (definition)
     {
       definition->document (h);
 
       if (! is_defined ())
-	warning ("documenting undefined variable `%s'", nm);
+	warning ("documenting undefined variable `%s'", nm.c_str ());
     }
 }
 
@@ -634,20 +630,22 @@
 	    {
 	      if (user_pref.read_only_constants < 0)
 		{
-		  ::warning ("redefinition of constant `%s'", nm);
+		  ::warning ("redefinition of constant `%s'",
+			     nm.c_str ());
 		  return 0;
 		}
 	      else
-		::error ("can't redefine read-only constant `%s'", nm);
+		::error ("can't redefine read-only constant `%s'",
+			 nm.c_str ());
 	    }
 	}
       else if (is_function ())
 	{
-	  ::error ("can't redefine read-only function `%s'", nm);
+	  ::error ("can't redefine read-only function `%s'", nm.c_str ());
 	}
       else
 	{
-	  ::error ("can't redefine read-only symbol `%s'", nm);
+	  ::error ("can't redefine read-only symbol `%s'", nm.c_str ());
 	}
 
       return 1;
@@ -723,7 +721,7 @@
   eternal = sr.is_eternal ();
   read_only = sr.is_read_only ();
 
-  nm = strsave (sr.name ());
+  nm = sr.name ();
 
   initialized = 1;
 }
@@ -737,21 +735,15 @@
   read_only = s.read_only;
   nr = s.nr;
   nc = s.nc;
-  nm = strsave (s.nm);
+  nm = s.nm;
   initialized = s.initialized;
 }
 
-symbol_record_info::~symbol_record_info (void)
-{
-  delete nm;
-}
-
 symbol_record_info&
 symbol_record_info::operator = (const symbol_record_info& s)
 {
   if (this != &s)
     {
-      delete nm;
       type = s.type;
       const_type = s.const_type;
       hides = s.hides;
@@ -759,7 +751,7 @@
       read_only = s.read_only;
       nr = s.nr;
       nc = s.nc;
-      nm = strsave (s.nm);
+      nm = s.nm;
       initialized = s.initialized;
     }
   return *this;
@@ -795,7 +787,7 @@
   return (hides & SR_INFO_BUILTIN_FUNCTION);
 }
 
-char *
+string
 symbol_record_info::type_as_string (void) const
 {
   if (type == symbol_def::USER_FUNCTION)
@@ -840,7 +832,7 @@
   return nc;
 }
 
-char *
+string
 symbol_record_info::name (void) const
 {
   return nm;
@@ -857,7 +849,6 @@
   read_only = 0;
   nr = -1;
   nc = -1;
-  nm = 0;
 }
 
 // A symbol table.
@@ -867,7 +858,7 @@
 }
 
 symbol_record *
-symbol_table::lookup (const char *nm, int insert, int warn)
+symbol_table::lookup (const string& nm, int insert, int warn)
 {
   int index = hash (nm) & HASH_MASK;
 
@@ -875,7 +866,7 @@
 
   while (ptr)
     {
-      if (strcmp (ptr->name (), nm) == 0)
+      if (ptr->name () == nm)
 	return ptr;
       ptr = ptr->next ();
     }
@@ -888,13 +879,13 @@
       return new_sym;
     }
   else if (warn)
-    warning ("lookup: symbol`%s' not found", nm);
+    warning ("lookup: symbol`%s' not found", nm.c_str ());
 
   return 0;
 }
 
 void
-symbol_table::rename (const char *old_name, const char *new_name)
+symbol_table::rename (const string& old_name, const string& new_name)
 {
   int index = hash (old_name) & HASH_MASK;
 
@@ -903,7 +894,7 @@
 
   while (ptr)
     {
-      if (strcmp (ptr->name (), old_name) == 0)
+      if (ptr->name () == old_name)
 	{
 	  prev->chain (ptr->next ());
 
@@ -918,7 +909,8 @@
       ptr = ptr->next ();
     }
 
-  error ("unable to rename `%s' to `%s', old_name, new_name");
+  error ("unable to rename `%s' to `%s'", old_name.c_str (),
+	 new_name.c_str ());
 }
 
 void
@@ -942,7 +934,7 @@
 }
 
 int
-symbol_table::clear (const char *nm, int clear_user_functions)
+symbol_table::clear (const string& nm, int clear_user_functions)
 {
   int index = hash (nm) & HASH_MASK;
 
@@ -950,7 +942,7 @@
 
   while (ptr)
     {
-      if (strcmp (ptr->name (), nm) == 0
+      if (ptr->name () == nm
 	  && (ptr->is_user_variable ()
 	      || (clear_user_functions && ptr->is_user_function ())))
 	{
@@ -988,18 +980,16 @@
 static inline int
 symbol_record_info_cmp (symbol_record_info *a, symbol_record_info *b)
 {
-  return strcmp (a->name (), b->name ());
+  return (a->name () == b->name ());
 }
 
 static int
-matches_patterns (const char *name, char **pats, int npats)
+matches_patterns (const string& name, const string_vector& pats, int npats)
 {
-  while (npats-- > 0)
+  for (int i = 0; i < npats; i++)
     {
-      if (fnmatch (*pats, name, __FNM_FLAGS) == 0)
+      if (fnmatch (pats[i].c_str (), name.c_str (), __FNM_FLAGS) == 0)
 	return 1;
-
-      pats++;
     }
 
   return 0;
@@ -1009,8 +999,9 @@
 // XXX FIXME XXX
 
 symbol_record_info *
-symbol_table::long_list (int& count, char **pats, int npats, int sort,
-			 unsigned type, unsigned scope) const 
+symbol_table::long_list (int& count, const string_vector& pats,
+			 int npats, int sort, unsigned type,
+			 unsigned scope) const 
 {
   count = 0;
   int n = size ();
@@ -1029,7 +1020,7 @@
 
 	  unsigned my_type = ptr->type ();
 
-	  char *my_name = ptr->name ();
+	  string my_name = ptr->name ();
 
 	  if ((type & my_type) && (scope & my_scope)
 	      && (npats == 0 || matches_patterns (my_name, pats, npats)))
@@ -1047,16 +1038,17 @@
   return symbols;
 }
 
-char **
-symbol_table::list (int& count, char **pats, int npats, int sort,
-		    unsigned type, unsigned scope) const
+string_vector
+symbol_table::list (int& count, const string_vector& pats, int npats,
+		    int sort, unsigned type, unsigned scope) const
 {
   count = 0;
   int n = size ();
   if (n == 0)
     return 0;
 
-  char **symbols = new char * [n+1];
+  string_vector symbols (n);
+
   for (int i = 0; i < HASH_TABLE_SIZE; i++)
     {
       symbol_record *ptr = table[i].next ();
@@ -1068,26 +1060,26 @@
 
 	  unsigned my_type = ptr->type ();
 
-	  char *my_name = ptr->name ();
+	  string my_name = ptr->name ();
 
 	  if ((type & my_type) && (scope & my_scope)
 	      && (npats == 0 || matches_patterns (my_name, pats, npats)))
-	    symbols[count++] = strsave (ptr->name ());
+	    symbols[count++] = ptr->name ();
 
 	  ptr = ptr->next ();
 	}
     }
-  symbols[count] = 0;
+
+  symbols.resize (count);
 
-  if (sort && symbols)
-    qsort ((void **) symbols, count, sizeof (char *),
-	   (int (*)(const void*, const void*)) pstrcmp);
+  if (sort && ! symbols.empty ())
+    symbols.qsort ();
 
   return symbols;
 }
 
 symbol_record **
-symbol_table::glob (int& count, char *pat, unsigned type,
+symbol_table::glob (int& count, const string& pat, unsigned type,
 		    unsigned scope) const
 {
   count = 0;
@@ -1107,8 +1099,10 @@
 
 	  unsigned my_type = ptr->type ();
 
+	  string tmp = ptr->name ();
+
 	  if ((type & my_type) && (scope & my_scope)
-	      && fnmatch (pat, ptr->name (), __FNM_FLAGS) == 0)
+	      && fnmatch (pat.c_str (), tmp.c_str (), __FNM_FLAGS) == 0)
 	    {
 	      symbols[count++] = ptr;
 	    }
@@ -1154,11 +1148,11 @@
 // Chris Torek's fave hash function.
 
 unsigned int
-symbol_table::hash (const char *str)
+symbol_table::hash (const string& str)
 {
   unsigned h = 0;
-  while (*str)
-    h = h * 33 + *str++;
+  for (unsigned i = 0; i < str.length (); i++)
+    h = h * 33 + str[i];
   return h;
 }
 
--- a/src/symtab.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/symtab.h	Mon Jan 22 04:47:22 1996 +0000
@@ -28,8 +28,12 @@
 #pragma interface
 #endif
 
+#include <string>
+
 #include "SLStack.h"
 
+#include "str-vec.h"
+
 #include "variables.h"
 
 // Must be multiple of 2.
@@ -42,6 +46,8 @@
 class tree_constant;
 class tree_function;
 
+class string_vector;
+
 class symbol_def;
 class symbol_record;
 class symbol_record_info;
@@ -81,8 +87,8 @@
   void make_eternal (void);
 
   tree_fvc *def (void) const;
-  char *help (void) const;
-  void document (const char *h);
+  string help (void) const;
+  void document (const string& h);
 
   enum TYPE
     {
@@ -103,7 +109,7 @@
   unsigned eternal : 1;
   unsigned read_only : 1;
 
-  char *help_string;
+  string help_string;
   tree_fvc *definition;
   symbol_def *next_elem;
   int count;
@@ -123,15 +129,15 @@
 
 public:
   symbol_record (void);
-  symbol_record (const char *n, symbol_record *nxt = 0);
+  symbol_record (const string& n, symbol_record *nxt = 0);
 
- ~symbol_record (void);
+  ~symbol_record (void) { }
 
-  char *name (void) const;
-  char *help (void) const; 
+  string name (void) const;
+  string help (void) const; 
   tree_fvc *def (void) const;
 
-  void rename (const char *new_name);
+  void rename (const string& new_name);
 
   int is_function (void) const;
   int is_user_function (void) const;
@@ -160,7 +166,7 @@
   int define_as_fcn (tree_constant *t);
   int define_builtin_var (tree_constant *t);
 
-  void document (const char *h);
+  void document (const string& h);
 
   int clear (void);
 
@@ -184,7 +190,7 @@
   unsigned formal_param : 1;
   unsigned linked_to_global : 1;
 
-  char *nm;
+  string nm;
   sv_Function sv_fcn;
   symbol_def *definition;
   symbol_record *next_elem;
@@ -216,7 +222,7 @@
 
   symbol_record_info (const symbol_record_info& s);
 
-  ~symbol_record_info (void);
+  ~symbol_record_info (void) { }
 
   symbol_record_info& operator = (const symbol_record_info& s);
 
@@ -225,11 +231,11 @@
   int is_eternal (void) const;
   int hides_fcn (void) const;
   int hides_builtin (void) const;
-  char *type_as_string (void) const;
+  string type_as_string (void) const;
   int is_function (void) const;
   int rows (void) const;
   int columns (void) const;
-  char *name (void) const;
+  string name (void) const;
 
   enum HIDES
     {
@@ -260,7 +266,7 @@
   unsigned read_only : 1;
   int nr;
   int nc;
-  char *nm;
+  string nm;
   
   int initialized;
 };
@@ -289,25 +295,26 @@
 
   symbol_table (void);
 
-  symbol_record *lookup (const char *nm, int insert = 0, int warn = 0);
+  symbol_record *lookup (const string& nm, int insert = 0, int warn = 0);
 
-  void rename (const char *old_name, const char *new_name);
+  void rename (const string& old_name, const string& new_name);
 
   void clear (int clear_user_functions = 1);
-  int clear (const char *nm, int clear_user_functions = 1);
+  int clear (const string& nm, int clear_user_functions = 1);
 
   int size (void) const;
 
-  symbol_record_info *long_list (int& count, char **pats = 0,
-				 int npats = 0, int sort = 0,
-				 unsigned type = SYMTAB_ALL_TYPES,
-				 unsigned scope = SYMTAB_ALL_SCOPES) const;
+  symbol_record_info *
+  long_list (int& count, const string_vector& pats = string_vector (),
+	     int npats = 0, int sort = 0, unsigned type = SYMTAB_ALL_TYPES,
+	     unsigned scope = SYMTAB_ALL_SCOPES) const;
 
-  char **list (int& count, char **pats = 0, int npats = 0,
-	       int sort = 0, unsigned type = SYMTAB_ALL_TYPES,
-	       unsigned scope = SYMTAB_ALL_SCOPES) const;
+  string_vector
+  list (int& count, const string_vector& pats = string_vector (),
+	int npats = 0, int sort = 0, unsigned type = SYMTAB_ALL_TYPES,
+	unsigned scope = SYMTAB_ALL_SCOPES) const;
 
-  symbol_record **glob (int& count, char *pat = "*",
+  symbol_record **glob (int& count, const string& pat = string ("*"),
 			unsigned type = SYMTAB_ALL_TYPES,
 			unsigned scope = SYMTAB_ALL_SCOPES) const;
 
@@ -316,7 +323,7 @@
 
 private:
 
-  unsigned int hash (const char *s);
+  unsigned int hash (const string& s);
 
   symbol_record table[HASH_TABLE_SIZE];
 };
--- a/src/sysdep.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/sysdep.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -79,10 +79,11 @@
 #include "help.h"
 #include "input.h"
 #include "mappers.h"
-#include "toplev.h"
+#include "oct-obj.h"
+#include "pathlen.h"
+#include "pt-const.h"
 #include "sysdep.h"
-#include "pt-const.h"
-#include "oct-obj.h"
+#include "toplev.h"
 #include "utils.h"
 
 extern "C" double F77_FCN (d1mach, D1MACH) (const int&);
@@ -482,35 +483,43 @@
   return c;
 }
 
-char *
-octave_getcwd (char *buf, int len)
+string
+octave_getcwd (void)
 {
+  string retval;
+  char buf[MAXPATHLEN];
+
 #if defined (__EMX__)
-  return _getcwd2 (buf, len);
+  char *tmp = _getcwd2 (buf, MAXPATHLEN);
 #else
-  return getcwd (buf, len);
+  char *tmp = getcwd (buf, MAXPATHLEN);
 #endif
+
+  if (tmp)
+    retval = tmp;
+
+  return retval;
 }
 
 int
-octave_chdir (const char *path)
+octave_chdir (const string& path)
 {
 #if defined (__EMX__)
   int retval = -1;
 
-  if (strlen (path) == 2 && path[1] == ':')
+  if (path.length () == 2 && path[1] == ':')
     {
-      char *upper_case_dir_name = strupr (path);
+      char *upper_case_dir_name = strupr (path.c_str ());
       _chdrive (upper_case_dir_name[0]);
       if (_getdrive () == upper_case_dir_name[0])
 	retval = _chdir2 ("/");
     }
   else
-    retval = _chdir2 (path);
+    retval = _chdir2 (path.c_str ());
 
   return retval;
 #else
-  return chdir (path);
+  return chdir (path.c_str ());
 #endif
 }
 
@@ -574,16 +583,14 @@
 
   if (nargin == 2)
     {
-      string tstr1 = args(0).string_value (); 
-      const char *var = tstr1.c_str ();
+      string var = args(0).string_value (); 
 
       if (! error_state)
 	{
-	  string tstr2 = args(1).string_value (); 
-	  const char *val = tstr2.c_str ();
+	  string val = args(1).string_value (); 
 
 	  if (! error_state)
-	    oct_putenv (var, val);
+	    oct_putenv (var.c_str (), val.c_str ());
 	  else
 	    error ("putenv: second argument should be a string");
 	}
--- a/src/sysdep.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/sysdep.h	Mon Jan 22 04:47:22 1996 +0000
@@ -31,8 +31,8 @@
 extern void raw_mode (int);
 extern int kbhit (void);
 
-extern char *octave_getcwd (char *, int);
-extern int octave_chdir (const char *);
+extern string octave_getcwd (void);
+extern int octave_chdir (const string&);
 
 #if !defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
 extern int gethostname (char *, int);
--- a/src/timefns.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/timefns.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -276,8 +276,8 @@
 
   if (args.length () == 2 && args(0).is_string () && args(1).is_map ()) 
     {
-      string tstr = args(0).string_value ();
-      const char *fmt = tstr.c_str ();
+      string fmt = args(0).string_value ();
+
       Octave_map map = args(1).map_value ();
 
       double fraction;
@@ -289,7 +289,7 @@
 	  int bufsize = 128;
 	  char *buf = new char [bufsize];
 
-	  while (! strftime (buf, bufsize, fmt, tm))
+	  while (! strftime (buf, bufsize, fmt.c_str (), tm))
 	    {
 	      delete [] buf;
 	      bufsize *= 2;
--- a/src/token.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/token.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -41,25 +41,22 @@
   line_num = l;
   column_num = c;
   type_tag = generic_token;
-  orig_text = 0;
 }
 
-token::token (char *s, int l, int c)
+token::token (const string& s, int l, int c)
 {
   line_num = l;
   column_num = c;
   type_tag = string_token;
-  str = strsave (s);
-  orig_text = 0;
+  str = new string (s);
 }
 
-token::token (double d, char * /* s */, int l, int c)
+token::token (double d, const string& /* s */, int l, int c)
 {
   line_num = l;
   column_num = c;
   type_tag = double_token;
   num = d;
-  orig_text = 0; // strsave (s);
 }
 
 token::token (end_tok_type t, int l, int c)
@@ -68,7 +65,6 @@
   column_num = c;
   type_tag = ettype_token;
   et = t;
-  orig_text = 0;
 }
 
 token::token (plot_tok_type t, int l, int c)
@@ -77,7 +73,6 @@
   column_num = c;
   type_tag = pttype_token;
   pt = t;
-  orig_text = 0;
 }
 
 token::token (symbol_record *s, int l, int c)
@@ -86,33 +81,19 @@
   column_num = c;
   type_tag = sym_rec_token;
   sr = s;
-  orig_text = 0;
 }
 
 token::~token (void)
 {
   if (type_tag == string_token)
-    delete [] str;
-  delete [] orig_text;
-}
-
-int
-token::line (void)
-{
-  return line_num;
+    delete str;
 }
 
-int
-token::column (void)
-{
-  return column_num;
-}
-
-char *
-token::string (void)
+string
+token::text (void)
 {
   assert (type_tag == string_token);
-  return str;
+  return *str;
 }
 
 double
@@ -143,7 +124,7 @@
   return sr;
 }
 
-char *
+string
 token::text_rep (void)
 {
   return orig_text;
--- a/src/token.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/token.h	Mon Jan 22 04:47:22 1996 +0000
@@ -28,6 +28,8 @@
 #pragma interface
 #endif
 
+#include <string>
+
 class symbol_record;
 
 class
@@ -63,24 +65,24 @@
     };
 
   token (int l = -1, int c = -1);
-  token (char *s, int l = -1, int c = -1);
-  token (double d, char *s = 0, int l = -1, int c = -1);
+  token (const string& s, int l = -1, int c = -1);
+  token (double d, const string& s = string (), int l = -1, int c = -1);
   token (end_tok_type t, int l = -1, int c = -1);
   token (plot_tok_type t, int l = -1, int c = -1);
   token (symbol_record *s, int l = -1, int c = -1);
 
- ~token (void);
+  ~token (void);
 
-  int line (void);
-  int column (void);
+  int line (void) { return line_num; }
+  int column (void) { return column_num; }
 
-  char *string (void);
+  string text (void);
   double number (void);
   end_tok_type ettype (void);
   plot_tok_type pttype (void);
   symbol_record *sym_rec (void);
 
-  char *text_rep (void);
+  string text_rep (void);
 
 private:
   token (const token& tok);
@@ -91,13 +93,13 @@
   token_type type_tag;
   union
     {
-      char *str;
+      string *str;
       double num;
       end_tok_type et;
       plot_tok_type pt;
       symbol_record *sr;
     };
-  char *orig_text;
+  string orig_text;
 };
 
 #endif
--- a/src/toplev.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/toplev.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -44,6 +44,7 @@
 #endif
 
 #include "lo-error.h"
+#include "str-vec.h"
 
 #include "builtins.h"
 #include "defaults.h"
@@ -73,41 +74,41 @@
 #include "version.h"
 
 // argv[0] for this program.
-char *raw_prog_name = 0;
+string raw_prog_name;
 
 // Cleaned-up name of this program, not including path information.
-char *prog_name = 0;
+string prog_name;
 
 // Login name for user running this program.
-char *user_name = 0;
+string user_name;
 
 // Name of the host we are running on.
-char *host_name = 0;
+string host_name;
 
 // User's home directory.
-char *home_directory = 0;
+string home_directory;
 
 // Guess what?
-char *the_current_working_directory = 0;
+string the_current_working_directory;
 
 // The path that will be searched for programs that we execute.
 // (--exec-path path)
-char *exec_path = 0;
+string exec_path;
 
 // Load path specified on command line.
 // (--path path; -p path)
-char *load_path = 0;
+string load_path;
 
 // Name of the info file specified on command line.
 // (--info-file file)
-char *info_file = 0;
+string info_file;
 
 // Name of the info reader we'd like to use.
 // (--info-program program)
-char *info_prog = 0;
+string info_prog;
 
 // Name of the editor to be invoked by the edit_history command.
-char *editor = 0;
+string editor;
 
 // If nonzero, don't do fancy line editing.
 int no_line_editing = 0;
@@ -187,10 +188,10 @@
   begin_unwind_frame ("parse_and_execute_2");
 
   unwind_protect_int (reading_script_file);
-  unwind_protect_ptr (curr_fcn_file_full_name);
+  unwind_protect_str (curr_fcn_file_full_name);
 
   reading_script_file = 1;
-  curr_fcn_file_full_name = s.c_str ();
+  curr_fcn_file_full_name = s;
 
   FILE *f = get_input_from_file (s, 0);
 
@@ -290,17 +291,20 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("casesen");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "casesen");
 
-  if (argc == 1 || (argc > 1 && strcmp (argv[1], "off") == 0))
+  if (error_state)
+    return retval;
+
+  if (argc == 1 || (argc > 1 && argv[1] == "off"))
     warning ("casesen: sorry, Octave is always case sensitive");
-  else if (argc > 1 && strcmp (argv[1], "on") == 0)
+  else if (argc > 1 && argv[1] == "on")
     ; // ok.
   else
     print_usage ("casesen");
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -430,7 +434,7 @@
 }
 
 static Octave_object
-eval_string (const char *string, int print, int& parse_status,
+eval_string (const string& s, int print, int& parse_status,
 	     int nargout) 
 {
   begin_unwind_frame ("eval_string");
@@ -438,11 +442,11 @@
   unwind_protect_int (get_input_from_eval_string);
   unwind_protect_int (input_from_command_line_file);
   unwind_protect_ptr (global_command);
-  unwind_protect_ptr (current_eval_string);
+  unwind_protect_str (current_eval_string);
 
   get_input_from_eval_string = 1;
   input_from_command_line_file = 0;
-  current_eval_string = string;
+  current_eval_string = s;
 
   YY_BUFFER_STATE old_buf = current_buffer ();
   YY_BUFFER_STATE new_buf = create_buffer (0);
@@ -478,11 +482,11 @@
 }
 
 tree_constant
-eval_string (const char *string, int print, int& parse_status)
+eval_string (const string& s, int print, int& parse_status)
 {
   tree_constant retval;
 
-  Octave_object tmp = eval_string (string, print, parse_status, 1);
+  Octave_object tmp = eval_string (s, print, parse_status, 1);
 
   retval = tmp(0);
 
@@ -492,8 +496,7 @@
 static Octave_object
 eval_string (const tree_constant& arg, int& parse_status, int nargout)
 {
-  string tstr = arg.string_value ();
-  const char *string = tstr.c_str ();
+  string s = arg.string_value ();
 
   if (error_state)
     {
@@ -503,7 +506,7 @@
 
   // Yes Virginia, we always print here...
 
-  return eval_string (string, 1, parse_status, nargout);
+  return eval_string (s, 1, parse_status, nargout);
 }
 
 DEFUN ("eval", Feval, Seval, 11,
@@ -571,8 +574,7 @@
 
   tree_constant tc_command = args(0);
 
-  string tstr = tc_command.string_value ();
-  const char *tmp_str = tstr.c_str ();
+  string tmp = tc_command.string_value ();
 
   if (error_state)
     {
@@ -580,7 +582,7 @@
     }
   else
     {
-      iprocstream *cmd = new iprocstream (tmp_str);
+      iprocstream *cmd = new iprocstream (tmp.c_str ());
 
       add_unwind_protect (cleanup_iprocstream, cmd);
 
@@ -618,7 +620,7 @@
 	    maybe_page_output (output_buf);
 	}
       else
-	error ("unable to start subprocess for `%s'", tmp_str);
+	error ("unable to start subprocess for `%s'", tmp.c_str ());
 
       run_unwind_protect ();
     }
--- a/src/toplev.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/toplev.h	Mon Jan 22 04:47:22 1996 +0000
@@ -41,41 +41,41 @@
 			       int verbose = 0,
 			       const char *warn_for = 0);
 
-extern tree_constant eval_string (const char *string, int print,
+extern tree_constant eval_string (const string&, int print,
 				  int& parse_status);
 
 // argv[0] for this program.
-extern char *raw_prog_name;
+extern string raw_prog_name;
 
 // Cleaned-up name of this program, not including path information.
-extern char *prog_name;
+extern string prog_name;
 
 // Login name for user running this program.
-extern char *user_name;
+extern string user_name;
 
 // Name of the host we are running on.
-extern char *host_name;
+extern string host_name;
 
 // User's home directory.
-extern char *home_directory;
+extern string home_directory;
 
 // Guess what?
-extern char *the_current_working_directory;
+extern string the_current_working_directory;
 
 // The path that will be searched for programs that we execute.
-extern char *exec_path;
+extern string exec_path;
 
 // Load path specified on command line.
-extern char *load_path;
+extern string load_path;
 
 // Name of the info file specified on command line.
-extern char *info_file;
+extern string info_file;
 
 // Name of the info reader we'd like to use.
-extern char *info_prog;
+extern string info_prog;
 
 // Name of the editor to be invoked by the edit_history command.
-extern char *editor;
+extern string editor;
 
 // If nonzero, don't do fancy line editing.
 extern int no_line_editing;
--- a/src/unwind-prot.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/unwind-prot.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -31,6 +31,8 @@
 
 #include <cstddef>
 
+#include <string>
+
 #include "SLStack.h"
 
 #include "CMatrix.h"
@@ -39,67 +41,6 @@
 #include "unwind-prot.h"
 #include "utils.h"
 
-unwind_elem::unwind_elem (void)
-{
-  unwind_elem_tag = 0;
-  unwind_elem_fptr = 0;
-  unwind_elem_ptr = 0;
-}
-
-unwind_elem::unwind_elem (char *t)
-{
-  unwind_elem_tag = strsave (t);
-  unwind_elem_fptr = 0;
-  unwind_elem_ptr = 0;
-}
-
-unwind_elem::unwind_elem (cleanup_func f, void *p)
-{
-  unwind_elem_tag = 0;
-  unwind_elem_fptr = f;
-  unwind_elem_ptr = p;
-}
-
-unwind_elem::unwind_elem (const unwind_elem& el)
-{
-  unwind_elem_tag = strsave (el.unwind_elem_tag);
-  unwind_elem_fptr = el.unwind_elem_fptr;
-  unwind_elem_ptr = el.unwind_elem_ptr;
-}
-
-unwind_elem::~unwind_elem (void)
-{
-  delete [] unwind_elem_tag;
-}
-
-unwind_elem&
-unwind_elem::operator = (const unwind_elem& el)
-{
-  unwind_elem_tag = strsave (el.unwind_elem_tag);
-  unwind_elem_fptr = el.unwind_elem_fptr;
-  unwind_elem_ptr = el.unwind_elem_ptr;
-
-  return *this;
-}
-
-char *
-unwind_elem::tag (void)
-{
-  return unwind_elem_tag;
-}
-
-cleanup_func
-unwind_elem::fptr (void)
-{
-  return unwind_elem_fptr;
-}
-
-void *
-unwind_elem::ptr (void)
-{
-  return unwind_elem_ptr;
-}
-
 static SLStack <unwind_elem> unwind_protect_list;
 
 void
@@ -115,6 +56,7 @@
   unwind_elem el = unwind_protect_list.pop ();
 
   cleanup_func f = el.fptr ();
+
   if (f)
     f (el.ptr ());
 }
@@ -126,37 +68,37 @@
 }
 
 void
-begin_unwind_frame (char *tag)
+begin_unwind_frame (const string& tag)
 {
   unwind_elem elem (tag);
   unwind_protect_list.push (elem);
 }
 
 void
-run_unwind_frame (char *tag)
+run_unwind_frame (const string& tag)
 {
   while (! unwind_protect_list.empty ())
     {
       unwind_elem el = unwind_protect_list.pop ();
 
       cleanup_func f = el.fptr ();
+
       if (f)
 	f (el.ptr ());
 
-      char *t = el.tag ();
-      if (t && strcmp (t, tag) == 0)
+      if (tag == el.tag ())
 	break;
     }
 }
 
 void
-discard_unwind_frame (char *tag)
+discard_unwind_frame (const string& tag)
 {
   while (! unwind_protect_list.empty ())
     {
       unwind_elem el = unwind_protect_list.pop ();
-      char *t = el.tag ();
-      if (t && strcmp (t, tag) == 0)
+
+      if (tag == el.tag ())
 	break;
     }
 }
@@ -169,6 +111,7 @@
       unwind_elem el = unwind_protect_list.pop ();
 
       cleanup_func f = el.fptr ();
+
       if (f)
 	f (el.ptr ());
     }
@@ -195,10 +138,11 @@
 class saved_variable
 {
  public:
-  enum var_type { integer, generic_ptr, generic };
+  enum var_type { integer, string_type, generic_ptr, generic };
 
   saved_variable (void);
   saved_variable (int *p, int v);
+  saved_variable (string *p, const string& v);
   saved_variable (void **p, void *v);
   ~saved_variable (void);
 
@@ -215,6 +159,7 @@
   union
     {
       int int_value;
+      const string *str_value;
       void *gen_ptr_value;
     };
 
@@ -235,7 +180,15 @@
   type_tag = integer;
   ptr_to_int = p;
   int_value = v;
-  size = sizeof (int);
+  size = sizeof (int);  // Is this necessary?
+}
+
+saved_variable::saved_variable (string *p, const string& v)
+{
+  type_tag = string_type;
+  gen_ptr = p;
+  str_value = new string (v);
+  size = sizeof (string);  // Is this necessary?
 }
 
 saved_variable::saved_variable (void **p, void *v)
@@ -248,8 +201,19 @@
 
 saved_variable::~saved_variable (void)
 {
-  if (type_tag == generic)
-    delete [] gen_ptr_value;
+  switch (type_tag)
+    {
+    case string_type:
+      delete str_value;
+      break;
+
+    case generic:
+      delete [] gen_ptr_value;  // Can this be right?
+      break;
+
+    default:
+      break;
+    }
 }
 
 void
@@ -261,6 +225,10 @@
       *ptr_to_int = int_value;
       break;
 
+    case string_type:
+      ((string *) gen_ptr) -> assign (*str_value);
+      break;
+
     case generic_ptr:
       *ptr_to_gen_ptr = gen_ptr_value;
       break;
@@ -291,6 +259,13 @@
 }
 
 void
+unwind_protect_str_internal (string *ptr, const string& value)
+{
+  saved_variable *s = new saved_variable (ptr, value);
+  add_unwind_protect (restore_saved_variable, (void *) s);
+}
+
+void
 unwind_protect_ptr_internal (void **ptr, void *value)
 {
   saved_variable *s = new saved_variable (ptr, value);
--- a/src/unwind-prot.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/unwind-prot.h	Mon Jan 22 04:47:22 1996 +0000
@@ -30,14 +30,16 @@
 
 #include <cstddef>
 
+#include <string>
+
 typedef void (*cleanup_func)(void *ptr);
 
 void add_unwind_protect (cleanup_func fptr, void *ptr);
 void run_unwind_protect (void);
 void discard_unwind_protect (void);
-void begin_unwind_frame (char *tag);
-void run_unwind_frame (char *tag);
-void discard_unwind_frame (char *tag);
+void begin_unwind_frame (const string& tag);
+void run_unwind_frame (const string& tag);
+void discard_unwind_frame (const string& tag);
 void run_all_unwind_protects (void);
 void discard_all_unwind_protects (void);
 
@@ -45,12 +47,16 @@
 void complex_matrix_cleanup (void *cm);
 
 void unwind_protect_int_internal (int *ptr, int value);
+void unwind_protect_str_internal (string *ptr, const string& value);
 void unwind_protect_ptr_internal (void **ptr, void *value);
 void unwind_protect_var_internal (void *ptr, void *value, size_t size);
 
 #define unwind_protect_int(i) \
   unwind_protect_int_internal (&(i), (i))
 
+#define unwind_protect_str(s) \
+  unwind_protect_str_internal (&(s), (s))
+
 #define unwind_protect_ptr(p) \
   unwind_protect_ptr_internal ((void **) &(p), (void *) (p))
 
@@ -58,22 +64,39 @@
 unwind_elem
 {
  public:
-  unwind_elem (void);
-  unwind_elem (char *t);
-  unwind_elem (cleanup_func f, void *p);
-  unwind_elem (const unwind_elem& el);
-  ~unwind_elem (void);
+  unwind_elem (void)
+    : ue_tag (), ue_fptr (0), ue_ptr (0) { }
+
+  unwind_elem (const string &t)
+    : ue_tag (t), ue_fptr (0), ue_ptr (0) { }
+
+  unwind_elem (cleanup_func f, void *p)
+    : ue_tag (), ue_fptr (f), ue_ptr (p) { }
+
+  unwind_elem (const unwind_elem& el)
+    : ue_tag (el.ue_tag), ue_fptr (el.ue_fptr), ue_ptr (el.ue_ptr) { }
+
+  ~unwind_elem (void) { }
 
-  unwind_elem& operator = (const unwind_elem& el);
+  unwind_elem& operator = (const unwind_elem& el)
+    {
+      ue_tag = el.ue_tag;
+      ue_fptr = el.ue_fptr;
+      ue_ptr = el.ue_ptr;
 
-  char *tag (void);
-  cleanup_func fptr (void);
-  void *ptr (void);
+      return *this;
+    }
+
+  string tag (void) { return ue_tag; }
+
+  cleanup_func fptr (void) { return ue_fptr; }
+
+  void *ptr (void) { return ue_ptr; }
 
  private:
-  char *unwind_elem_tag;
-  cleanup_func unwind_elem_fptr;
-  void *unwind_elem_ptr;
+  string ue_tag;
+  cleanup_func ue_fptr;
+  void *ue_ptr;
 };
 
 #endif
--- a/src/user-prefs.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/user-prefs.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -82,20 +82,20 @@
 
   user_pref.completion_append_char = '\0';
 
-  user_pref.default_save_format = 0;
-  user_pref.editor = 0;
-  user_pref.exec_path = 0;
-  user_pref.gnuplot_binary = 0;
-  user_pref.history_file = 0;
-  user_pref.imagepath = 0;
-  user_pref.info_file = 0;
-  user_pref.info_prog = 0;
-  user_pref.loadpath = 0;
-  user_pref.pager_binary = 0;
-  user_pref.ps1 = 0;
-  user_pref.ps2 = 0;
-  user_pref.ps4 = 0;
-  user_pref.pwd = 0;
+  user_pref.default_save_format = string ();
+  user_pref.editor = string ();
+  user_pref.exec_path = string ();
+  user_pref.gnuplot_binary = string ();
+  user_pref.history_file = string ();
+  user_pref.imagepath = string ();
+  user_pref.info_file = string ();
+  user_pref.info_prog = string ();
+  user_pref.loadpath = string ();
+  user_pref.pager_binary = string ();
+  user_pref.ps1 = string ();
+  user_pref.ps2 = string ();
+  user_pref.ps4 = string ();
+  user_pref.pwd = string ();
 }
 
 // Check the value of a string variable to see if it it's ok to do
@@ -109,30 +109,28 @@
 // to mean "true".
 
 static int
-check_preference (char *var)
+check_preference (const string& var)
 {
   int pref = -1;
 
-  char *val = builtin_string_variable (var);
+  string val = builtin_string_variable (var);
 
-  if (val)
-    {
-      if (strncmp (val, "yes", 3) == 0
-	  || strncmp (val, "true", 4) == 0)
-	pref = 1;
-      else if (strncmp (val, "never", 5) == 0
-	       || strncmp (val, "no", 2) == 0
-	       || strncmp (val, "false", 5) == 0)
-	pref = 0;
-
-      delete [] val;
-    }
-  else
+  if (val.empty ())
     {
       double dval = 0;
       if (builtin_real_scalar_variable (var, dval))
 	pref = NINT (dval);
     }
+  else
+    {
+      if (val.compare ("yes", 0, 3) == 0
+	  || val.compare ("true", 0, 4) == 0)
+	pref = 1;
+      else if (val.compare ("never", 0, 5) == 0
+	       || val.compare ("no", 0, 2) == 0
+	       || val.compare ("false", 0, 5) == 0)
+	pref = 0;
+    }
 
   return pref;
 }
@@ -264,13 +262,13 @@
 {
   int pref = 0;
 
-  char *val = builtin_string_variable ("ignore_function_time_stamp");
+  string val = builtin_string_variable ("ignore_function_time_stamp");
 
-  if (val)
+  if (! val.empty ())
     {
-      if (strncmp (val, "all", 3) == 0)
+      if (val.compare ("all", 0, 3) == 0)
 	pref = 2;
-      if (strncmp (val, "system", 6) == 0)
+      if (val.compare ("system", 0, 6) == 0)
 	pref = 1;
     }
 
@@ -630,12 +628,12 @@
 whitespace_in_literal_matrix (void)
 {
   int pref = 0;
-  char *val = builtin_string_variable ("whitespace_in_literal_matrix");
-  if (val)
+  string val = builtin_string_variable ("whitespace_in_literal_matrix");
+  if (! val.empty ())
     {
-      if (strncmp (val, "ignore", 6) == 0)
+      if (val.compare ("ignore", 0, 6) == 0)
 	pref = 2;
-      else if (strncmp (val, "traditional", 11) == 0)
+      else if (val.compare ("traditional", 0, 11) == 0)
 	pref = 1;
     }
   user_pref.whitespace_in_literal_matrix = pref;
@@ -702,21 +700,22 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("completion_append_char");
-  if (s)
+  string s = builtin_string_variable ("completion_append_char");
+
+  switch (s.length ())
     {
-      if (s[0] == '\0' || (s[0] && s[1] == '\0'))
-	user_pref.completion_append_char = s[0];
-      else
-	{
-	  warning ("completion_append_char must be a single character");
-	  status = -1;
-	}
-    }
-  else
-    {
-      gripe_invalid_value_specified ("completion_append_char");
+    case 1:
+      user_pref.completion_append_char = s[0];
+      break;
+
+    case 0:
+      user_pref.completion_append_char = '\0';
+      break;
+
+    default:
+      warning ("completion_append_char must be a single character");
       status = -1;
+      break;
     }
 
   return status;
@@ -727,17 +726,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("default_save_format");
-  if (s)
-    {
-      delete [] user_pref.default_save_format;
-      user_pref.default_save_format = s;
-    }
-  else
+  string s = builtin_string_variable ("default_save_format");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("default_save_format");
       status = -1;
     }
+  else
+    user_pref.default_save_format = s;
 
   return status;
 }
@@ -747,17 +744,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("EDITOR");
-  if (s)
-    {
-      delete [] user_pref.editor;
-      user_pref.editor = s;
-    }
-  else
+  string s = builtin_string_variable ("EDITOR");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("EDITOR");
       status = -1;
     }
+  else
+    user_pref.editor = s;
 
   return status;
 }
@@ -767,13 +762,19 @@
 {
   int status = 0;
 
-  char *exec_path = builtin_string_variable ("EXEC_PATH");
-  if (exec_path)
+  string exec_path = builtin_string_variable ("EXEC_PATH");
+
+  if (exec_path.empty ())
     {
-      char *arch_dir = octave_arch_lib_dir ();
-      char *bin_dir = octave_bin_dir ();
+      gripe_invalid_value_specified ("EXEC_PATH");
+      status = -1;
+    }
+  else
+    {
+      string arch_dir = octave_arch_lib_dir ();
+      string bin_dir = octave_bin_dir ();
 
-      int len = strlen (arch_dir) + strlen (bin_dir) + strlen (SEPCHAR_STR);
+      int len = arch_dir.length () + bin_dir.length () + strlen (SEPCHAR_STR);
 
       static char *putenv_cmd = 0;
 
@@ -781,7 +782,7 @@
 
       putenv_cmd = 0;
 
-      int eplen = strlen (exec_path);
+      int eplen = exec_path.length ();
 
       if (eplen > 0)
 	{
@@ -795,14 +796,17 @@
 		  putenv_cmd = new char [2 * len + eplen + 6];
 		  sprintf (putenv_cmd,
 			   "PATH=%s" SEPCHAR_STR "%s%s%s" SEPCHAR_STR "%s",
-			   arch_dir, bin_dir, exec_path, arch_dir, bin_dir);
+			   arch_dir.c_str (), bin_dir.c_str (),
+			   exec_path.c_str (), arch_dir.c_str (),
+			   bin_dir.c_str ());
 		}
 	      else
 		{
 		  putenv_cmd = new char [len + eplen + 6];
 		  sprintf (putenv_cmd,
 			   "PATH=%s" SEPCHAR_STR "%s%s",
-			   arch_dir, bin_dir, exec_path);
+			   arch_dir.c_str (), bin_dir.c_str (),
+			   exec_path.c_str ());
 		}
 	    }
 	  else
@@ -812,28 +816,25 @@
 		  putenv_cmd = new char [len + eplen + 6];
 		  sprintf (putenv_cmd,
 			   "PATH=%s%s" SEPCHAR_STR "%s",
-			   exec_path, arch_dir, bin_dir);
+			   exec_path.c_str (), arch_dir.c_str (),
+			   bin_dir.c_str ());
 		}
 	      else
 		{
 		  putenv_cmd = new char [len + eplen + 6];
-		  sprintf (putenv_cmd, "PATH=%s", exec_path);
+		  sprintf (putenv_cmd, "PATH=%s", exec_path.c_str ());
 		}
 	    }
 	}
       else
 	{
 	  putenv_cmd = new char [len+6];
-	  sprintf (putenv_cmd, "PATH=%s" SEPCHAR_STR "%s", arch_dir, bin_dir);
+	  sprintf (putenv_cmd, "PATH=%s" SEPCHAR_STR "%s",
+		   arch_dir.c_str (), bin_dir.c_str ());
 	}
 
       putenv (putenv_cmd);
     }
-  else
-    {
-      gripe_invalid_value_specified ("EXEC_PATH");
-      status = -1;
-    }
 
   return status;
 }
@@ -843,17 +844,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("gnuplot_binary");
-  if (s)
-    {
-      delete [] user_pref.gnuplot_binary;
-      user_pref.gnuplot_binary = s;
-    }
-  else
+  string s = builtin_string_variable ("gnuplot_binary");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("gnuplot_binary");
       status = -1;
     }
+  else
+    user_pref.gnuplot_binary = s;
 
   return status;
 }
@@ -863,17 +862,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("history_file");
-  if (s)
-    {
-      delete [] user_pref.history_file;
-      user_pref.history_file = s;
-    }
-  else
+  string s = builtin_string_variable ("history_file");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("history_file");
       status = -1;
     }
+  else
+    user_pref.history_file = s;
 
   return status;
 }
@@ -883,17 +880,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("IMAGEPATH");
-  if (s)
-    {
-      delete [] user_pref.imagepath;
-      user_pref.imagepath = s;
-    }
-  else
+  string s = builtin_string_variable ("IMAGEPATH");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("IMAGEPATH");
       status = -1;
     }
+  else
+    user_pref.imagepath = s;
 
   return status;
 }
@@ -903,17 +898,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("INFO_FILE");
-  if (s)
-    {
-      delete [] user_pref.info_file;
-      user_pref.info_file = s;
-    }
-  else
+  string s = builtin_string_variable ("INFO_FILE");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("INFO_FILE");
       status = -1;
     }
+  else
+    user_pref.info_file = s;
 
   return status;
 }
@@ -923,17 +916,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("INFO_PROGRAM");
-  if (s)
-    {
-      delete [] user_pref.info_prog;
-      user_pref.info_prog = s;
-    }
-  else
+  string s = builtin_string_variable ("INFO_PROGRAM");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("INFO_PROGRAM");
       status = -1;
     }
+  else
+    user_pref.info_prog = s;
 
   return status;
 }
@@ -943,17 +934,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("LOADPATH");
-  if (s)
-    {
-      delete [] user_pref.loadpath;
-      user_pref.loadpath = maybe_add_default_load_path (s);
-    }
-  else
+  string s = builtin_string_variable ("LOADPATH");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("LOADPATH");
       status = -1;
     }
+  else
+    user_pref.loadpath = maybe_add_default_load_path (s);
 
   return status;
 }
@@ -963,17 +952,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("PAGER");
-  if (s)
-    {
-      delete [] user_pref.pager_binary;
-      user_pref.pager_binary = s;
-    }
-  else
+  string s = builtin_string_variable ("PAGER");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("PAGER");
       status = -1;
     }
+  else
+    user_pref.pager_binary = s;
 
   return status;
 }
@@ -983,17 +970,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("PS1");
-  if (s)
-    {
-      delete [] user_pref.ps1;
-      user_pref.ps1 = s;
-    }
-  else
+  string s = builtin_string_variable ("PS1");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("PS1");
       status = -1;
     }
+  else
+    user_pref.ps1 = s;
 
   return status;
 }
@@ -1003,17 +988,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("PS2");
-  if (s)
-    {
-      delete [] user_pref.ps2;
-      user_pref.ps2 = s;
-    }
-  else
+  string s = builtin_string_variable ("PS2");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("PS2");
       status = -1;
     }
+  else
+    user_pref.ps2 = s;
 
   return status;
 }
@@ -1023,17 +1006,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("PS4");
-  if (s)
-    {
-      delete [] user_pref.ps4;
-      user_pref.ps4 = s;
-    }
-  else
+  string s = builtin_string_variable ("PS4");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("PS4");
       status = -1;
     }
+  else
+    user_pref.ps4 = s;
 
   return status;
 }
@@ -1043,17 +1024,15 @@
 {
   int status = 0;
 
-  char *s = builtin_string_variable ("PWD");
-  if (s)
-    {
-      delete [] user_pref.pwd;
-      user_pref.pwd = s;
-    }
-  else
+  string s = builtin_string_variable ("PWD");
+
+  if (s.empty ())
     {
       gripe_invalid_value_specified ("PWD");
       status = -1;
     }
+  else
+    user_pref.pwd = s;
 
   return status;
 }
--- a/src/user-prefs.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/user-prefs.h	Mon Jan 22 04:47:22 1996 +0000
@@ -24,6 +24,8 @@
 #if !defined (octave_user_prefs_h)
 #define octave_user_prefs_h 1
 
+#include <string>
+
 struct user_preferences
 {
   int automatic_replot;
@@ -64,20 +66,20 @@
 
   char completion_append_char;
 
-  char *default_save_format;
-  char *editor;
-  char *exec_path;
-  char *gnuplot_binary;
-  char *history_file;
-  char *imagepath;
-  char *info_file;
-  char *info_prog;
-  char *loadpath;
-  char *pager_binary;
-  char *ps1;
-  char *ps2;
-  char *ps4;
-  char *pwd;
+  string default_save_format;
+  string editor;
+  string exec_path;
+  string gnuplot_binary;
+  string history_file;
+  string imagepath;
+  string info_file;
+  string info_prog;
+  string loadpath;
+  string pager_binary;
+  string ps1;
+  string ps2;
+  string ps4;
+  string pwd;
 };
 
 extern user_preferences user_pref;
--- a/src/utils.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/utils.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -57,6 +57,7 @@
 #include "SLStack.h"
 
 #include "oct-cmplx.h"
+#include "str-vec.h"
 
 #include "defun.h"
 #include "dirfns.h"
@@ -94,6 +95,8 @@
   return tmp;
 }
 
+#if 0
+
 // Concatenate two strings.
 
 char *
@@ -105,6 +108,7 @@
   strcat (tmp, t);
   return tmp;
 }
+#endif
 
 // Throw away input until a given character is read.
 
@@ -164,17 +168,20 @@
 
 // Get a temporary file name.
 
-char *
+string
 octave_tmp_file_name (void)
 {
-  static char *retval = 0;
+  string retval;
+
+  char *tmp = tempnam (0, "oct-");
 
-  if (retval)
-    free (retval);
+  if (tmp)
+    {
+      retval = tmp;
 
-  retval = tempnam (0, "oct-");
-
-  if (! retval)
+      free (tmp);
+    }
+  else
     error ("can't open temporary file!");
 
   return retval;
@@ -194,54 +201,6 @@
   return retval;
 }
 
-char **
-pathstring_to_vector (char *pathstring)
-{
-  static char **path = 0;
-
-  if (pathstring)
-    {
-      int nelem = 0;
-      char *tmp_path = strsave (pathstring);
-      if (*tmp_path != '\0')
-	{
-	  nelem++;
-	  char *ptr = tmp_path;
-	  while (*ptr != '\0')
-	    {
-	      if (*ptr == SEPCHAR)
-		nelem++;
-	      ptr++;
-	    }
-	}
-
-      char **foo = path;
-      while (foo && *foo)
-	delete [] *foo++;
-      delete [] path;
-
-      path = new char * [nelem+1];
-      path[nelem] = 0;
-
-      int i = 0;
-      char *ptr = tmp_path;
-      while (i < nelem)
-	{
-	  char *end = strchr (ptr, SEPCHAR);
-	  if (end)
-	    *end = '\0';
-	  string result = oct_tilde_expand (ptr);
-	  path[i] = strsave (result.c_str ());
-	  ptr = end + 1;
-	  i++;
-	}
-
-      delete [] tmp_path;
-    }
-
-  return path;
-}
-
 // Return to the main command loop in octave.cc.
 
 extern "C" void
@@ -253,33 +212,33 @@
 }
 
 int
-almost_match (const char *std, const char *s, int min_match_len,
+almost_match (const string& std, const string& s, int min_match_len,
 	      int case_sens)
 {
-  int stdlen = strlen (std);
-  int slen = strlen (s);
+  int stdlen = std.length ();
+  int slen = s.length ();
 
   return (slen <= stdlen
 	  && slen >= min_match_len
 	  && (case_sens
-	      ? (strncmp (std, s, slen) == 0)
-	      : (strncasecmp (std, s, slen) == 0)));
+	      ? (strncmp (std.c_str (), s.c_str (), slen) == 0)
+	      : (strncasecmp (std.c_str (), s.c_str (), slen) == 0)));
 }
 
 // Ugh.
 
 int
-keyword_almost_match (const char **std, int *min_len, const char *s,
+keyword_almost_match (const char **std, int *min_len, const string& s,
 		      int min_toks_to_match, int max_toks)
 {
   int status = 0;
   int tok_count = 0;
   int toks_matched = 0;
 
-  if (! s || *s == '\0' || max_toks < 1)
+  if (s.empty () || max_toks < 1)
     return status;
 
-  char *kw = strsave (s);
+  char *kw = strsave (s.c_str ());
 
   char *t = kw;
   while (*t != '\0')
@@ -355,11 +314,11 @@
   return status;
 }
 
-char **
+string_vector
 get_fcn_file_names (int& num, const char *dir, int no_suffix)
 {
   static int num_max = 256;
-  char **retval = new char * [num_max];
+  string_vector retval (num_max);
   int i = 0;
 
   DIR *dirp = opendir (dir);
@@ -384,7 +343,7 @@
 	      && entry->d_name[len-1] == 'm')
 #endif
 	    {
-	      retval[i] = strsave (entry->d_name);
+	      retval[i] = entry->d_name;
 	      if (no_suffix)
 		{
 		  if (retval[i][len-1] == 'm')
@@ -397,39 +356,28 @@
 
 	      if (i == num_max - 1)
 		{
-		  // Reallocate the array.  Only copy pointers, not
-		  // the strings they point to, then only delete the
-		  // original array of pointers, and not the strings
-		  // they point to.
-
 		  num_max += 256;
-		  char **tmp = new char * [num_max];
-		  for (int j = 0; j < i; j++)
-		    tmp[j] = retval[j];
-
-		  delete [] retval;
-
-		  retval = tmp;
+		  retval.resize (num_max);
 		}
 	    }
 	}
       closedir (dirp);
     }
 
-  retval[i] = 0;
   num = i;
+  retval.resize (num);
 
   return retval;
 }
 
-char **
+string_vector
 get_fcn_file_names (int& num, int no_suffix)
 {
   static int num_max = 1024;
-  char **retval = new char * [num_max];
+  string_vector retval (num_max);
   int i = 0;
 
-  char *path_elt = kpse_path_element (user_pref.loadpath);
+  char *path_elt = kpse_path_element (user_pref.loadpath.c_str ());
 
   while (path_elt)
     {
@@ -443,23 +391,13 @@
 	  if (elt_dir)
 	    {
 	      int tmp_num;
-	      char **names = get_fcn_file_names (tmp_num, elt_dir, no_suffix);
+	      string_vector names
+		= get_fcn_file_names (tmp_num, elt_dir, no_suffix);
 
 	      if (i + tmp_num >= num_max - 1)
 		{
-		  // Reallocate the array.  Only copy pointers, not
-		  // the strings they point to, then only delete the
-		  // original array of pointers, and not the strings
-		  // they point to.
-
 		  num_max += 1024;
-		  char **tmp = new char * [num_max];
-		  for (int j = 0; j < i; j++)
-		    tmp[j] = retval[j];
-
-		  delete [] retval;
-
-		  retval = tmp;
+		  retval.resize (num_max);
 		}
 
 	      int k = 0;
@@ -471,8 +409,8 @@
       path_elt = kpse_path_element (0);
     }
 
-  retval[i] = 0;
   num = i;
+  retval.resize (num);
 
   return retval;
 }
@@ -512,23 +450,22 @@
   return 1;
 }
 
-char **
-make_argv (const Octave_object& args, const char *fcn_name)
+string_vector
+make_argv (const Octave_object& args, const string& fcn_name)
 {
-  char **argv = 0;
+  string_vector argv;
+
   if (all_strings (args))
     {
       int n = args.length ();
-      argv = new char * [n + 1];
-      argv[0] = strsave (fcn_name);
+      argv.resize (n+1);
+      argv[0] = fcn_name;
+
       for (int i = 0; i < n; i++)
-	{
-	  string tstr = args(i).string_value ();
-	  argv[i+1] = strsave (tstr.c_str ());
-	}
+	argv[i+1] = args(i).string_value ();
     }
   else
-    error ("%s: expecting all arguments to be strings", fcn_name);
+    error ("%s: expecting all arguments to be strings", fcn_name.c_str ());
 
   return argv;
 }
@@ -562,21 +499,19 @@
   return is_empty;
 }
 
-// Format a list in neat columns.  Mostly stolen from GNU ls.  This
-// should maybe be in utils.cc.
+// Format a list in neat columns.  Mostly stolen from GNU ls.
 
 ostrstream&
-list_in_columns (ostrstream& os, char **list)
+list_in_columns (ostrstream& os, const string_vector& list)
 {
   // Compute the maximum name length.
 
   int max_name_length = 0;
-  int total_names = 0;
-  char **names = 0;
-  for (names = list; *names; names++)
+  int total_names = list.length ();
+
+  for (int i = 0; i < total_names; i++)
     {
-      total_names++;
-      int name_length = strlen (*names);
+      int name_length = list[i].length ();
       if (name_length > max_name_length)
 	max_name_length = name_length;
     }
@@ -601,7 +536,6 @@
 
   cols = total_names / rows + (total_names % rows != 0);
 
-  names = list;
   int count;
   for (int row = 0; row < rows; row++)
     {
@@ -612,8 +546,10 @@
 
       while (1)
 	{
-	  os << *(names + count);
-	  int name_length = strlen (*(names + count));
+	  string nm = list[count];
+
+	  os << nm;
+	  int name_length = nm.length ();
 
 	  count += rows;
 	  if (count >= total_names)
@@ -632,12 +568,13 @@
 
 // See if the given file is in the path.
 
-char *
-search_path_for_file (const char *path, const char *name)
+string
+search_path_for_file (const string& path, const string& name)
 {
-  char *retval = 0;
+  string retval;
 
-  char *tmp = kpse_path_search (path, name, kpathsea_true);
+  char *tmp = kpse_path_search (path.c_str (), name.c_str (),
+				kpathsea_true);
 
   if (tmp)
     {
@@ -653,95 +590,90 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("file_in_path");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "file_in_path");
+
+  if (error_state)
+    return retval;
 
   if (argc == 3)
     {
-      char *fname = search_path_for_file (argv[1], argv[2]);
+      string fname = search_path_for_file (argv[1], argv[2]);
 
-      if (fname)
+      if (fname.empty ())
+	retval = Matrix ();
+      else
 	retval = fname;
-      else
-	retval = Matrix ();
     }
   else
     print_usage ("file_in_path");
 
-  DELETE_ARGV;
-
   return retval;
 }
 
-
-char *
-file_in_path (const char *name, const char *suffix)
+string
+file_in_path (const string& name, const string& suffix)
 {
-  char *retval = 0;
+  string nm = name;
 
-  char *nm = 0;
+  if (! suffix.empty ())
+    nm.append (suffix);
 
-  if (suffix)
-    nm = strconcat (name, suffix);
-  else
-    nm = strsave (name);
-
-  if (! the_current_working_directory)
+  if (the_current_working_directory.empty ())
     get_working_directory ("file_in_path");
 
-  retval = search_path_for_file (user_pref.loadpath, nm);
-
-  delete [] nm;
-
-  return retval;
+  return search_path_for_file (user_pref.loadpath, nm);
 }
 
 // See if there is an function file in the path.  If so, return the
 // full path to the file.
 
-char *
-fcn_file_in_path (const char *name)
+string
+fcn_file_in_path (const string& name)
 {
-  if (name)
-    {
-      int len = strlen (name);
+  string retval;
 
-      if (name [len - 2] == '.' && name [len - 1] == 'm')
-	return file_in_path (name, "");
+  int len = name.length ();
+  
+  if (len > 0)
+    {
+      if (len > 2 && name [len - 2] == '.' && name [len - 1] == 'm')
+	retval = file_in_path (name, "");
       else
-	return file_in_path (name, ".m");
+	retval = file_in_path (name, ".m");
     }
-  else
-    return 0;
+
+  return retval;
 }
 
 // See if there is an octave file in the path.  If so, return the
 // full path to the file.
 
-char *
-oct_file_in_path (const char *name)
+string
+oct_file_in_path (const string& name)
 {
-  if (name)
-    {
-      int len = strlen (name);
+  string retval;
 
-      if (name [len - 4] == '.' && name [len - 3] == 'o'
+  int len = name.length ();
+  
+  if (len > 0)
+    {
+      if (len > 2 && name [len - 4] == '.' && name [len - 3] == 'o'
 	  && name [len - 2] == 'c' && name [len - 1] == 't')
-	return file_in_path (name, "");
+	retval = file_in_path (name, "");
       else
-	return file_in_path (name, ".oct");
+	retval = file_in_path (name, ".oct");
     }
-  else
-    return 0;
+
+  return retval;
 }
 
-char *
+const char *
 undo_string_escape (char c)
 {
-  static char retval[2];
-  retval[1] = '\0';
-
   if (! c)
-    return 0;
+    return "";
 
   switch (c)
     {
@@ -773,22 +705,24 @@
       return "\\\"";
 
     default:
-      retval[0] = c;
-      return retval;
+      {
+	static char retval[2];
+	retval[0] = c;
+	retval[1] = '\0';
+	return retval;
+      }
     }
 }
 
-char *
-undo_string_escapes (const char *s)
+string
+undo_string_escapes (const string& s)
 {
-  ostrstream buf;
+  string retval;
 
-  char *t;
-  while ((t = undo_string_escape (*s++)))
-    buf << t;
-  buf << ends;
+  for (size_t i = 0; i < s.length (); i++)
+    retval.append (undo_string_escape (s[i]));
 
-  return buf.str ();
+  return retval;
 }
 
 DEFUN ("undo_string_escapes", Fundo_string_escapes,
@@ -800,12 +734,7 @@
   int nargin = args.length ();
 
   if (nargin == 1 && args(0).is_string ())
-    {
-      string tstr = args(0).string_value ();
-      char *str = undo_string_escapes (tstr.c_str ());
-      retval = str;
-      delete [] str;
-    }
+    retval = undo_string_escapes (args(0).string_value ());
   else
     print_usage ("undo_string_escapes");
 
--- a/src/utils.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/utils.h	Mon Jan 22 04:47:22 1996 +0000
@@ -27,10 +27,16 @@
 class istream;
 class ostrstream;
 
+#include <string>
+
 class Octave_object;
+class string_vector;
 
 extern char *strsave (const char *);
+
+#if 0
 extern char *strconcat (const char *, const char *);
+#endif
 
 extern void discard_until (istream&, char);
 
@@ -38,40 +44,40 @@
 extern char *read_until (istream&, char);
 #endif
 
-extern char *search_path_for_file (const char *, const char *);
-extern char *file_in_path (const char *, const char *);
-extern char *fcn_file_in_path (const char *);
-extern char *oct_file_in_path (const char *);
+extern string search_path_for_file (const string&, const string&);
+extern string file_in_path (const string&, const string&);
+extern string fcn_file_in_path (const string&);
+extern string oct_file_in_path (const string&);
 
-extern char *octave_tmp_file_name (void);
-
-extern char **pathstring_to_vector (char *pathstring);
+extern string octave_tmp_file_name (void);
 
 extern "C" void jump_to_top_level (void) NORETURN;
 
-extern int almost_match (const char *std, const char *s,
+extern int almost_match (const string& std, const string& s,
 			 int min_match_len = 1, int case_sens = 1);
-extern int keyword_almost_match (const char **std, int *min_len,
-				 const char *s, int min_toks_to_match,
-				 int max_toks);
 
-extern char **get_fcn_file_names (int& ffl_len, const char *dir,
-				  int no_suffix); 
-extern char **get_fcn_file_names (int& ffl_len, int no_suffix);
+extern int
+keyword_almost_match (const char **std, int *min_len,
+		      const string& s, int min_toks_to_match,
+		      int max_toks);
+
+extern string_vector get_fcn_file_names (int& ffl_len, const char *dir,
+					 int no_suffix); 
+
+extern string_vector get_fcn_file_names (int& ffl_len, int no_suffix);
 
 extern int NINT (double x);
 extern double D_NINT (double x);
 
-extern char **make_argv (const Octave_object& args, const char *fcn_name);
+extern string_vector make_argv (const Octave_object&, const string&);
 
 extern int empty_arg (const char *name, int nr, int nc);
 
-extern ostrstream& list_in_columns (ostrstream& os, char **list);
+extern ostrstream& list_in_columns (ostrstream& os, const string_vector& list);
 
-extern char *undo_string_escape (char c);
-extern char *undo_string_escapes (const char *s);
+extern string undo_string_escapes (const string& s);
 
-extern void oct_putenv (const char *,  const char *);
+extern void oct_putenv (const char *, const char *);
 
 #endif
 
--- a/src/variables.cc	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/variables.cc	Mon Jan 22 04:47:22 1996 +0000
@@ -42,6 +42,8 @@
 
 #include "fnmatch.h"
 
+#include "str-vec.h"
+
 #include "defaults.h"
 #include "defun.h"
 #include "dirfns.h"
@@ -99,7 +101,7 @@
 // Is this variable a builtin?
 
 int
-is_builtin_variable (const char *name)
+is_builtin_variable (const string& name)
 {
   symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
   return (sr && sr->is_builtin_variable ());
@@ -108,7 +110,7 @@
 // Is this a text-style function?
 
 int
-is_text_function_name (const char *s)
+is_text_function_name (const string& s)
 {
   symbol_record *sr = global_sym_tab->lookup (s);
   return (sr && sr->is_text_function ());
@@ -117,7 +119,7 @@
 // Is this function globally in this scope?
 
 int
-is_globally_visible (const char *name)
+is_globally_visible (const string& name)
 {
   symbol_record *sr = curr_sym_tab->lookup (name, 0, 0);
   return (sr && sr->is_linked_to_global ());
@@ -126,29 +128,26 @@
 // Is this tree_constant a valid function?
 
 tree_fvc *
-is_valid_function (const tree_constant& arg, char *warn_for, int warn)
+is_valid_function (const tree_constant& arg, const string& warn_for, int warn)
 {
   tree_fvc *ans = 0;
 
-  const char *fcn_name = 0;
-
-  string tstr;
+  string fcn_name;
 
   if (arg.is_string ())
-    {
-      tstr = arg.string_value ();
-      fcn_name = tstr.c_str ();
-    }
+    fcn_name = arg.string_value ();
 
-  if (! fcn_name || error_state)
+  if (fcn_name.empty () || error_state)
     {
       if (warn)
-	error ("%s: expecting function name as argument", warn_for);
+	error ("%s: expecting function name as argument",
+	       warn_for.c_str ());
       return ans;
     }
 
   symbol_record *sr = 0;
-  if (fcn_name)
+
+  if (! fcn_name.empty ())
     sr = lookup_by_name (fcn_name);
 
   if (sr)
@@ -158,7 +157,7 @@
     {
       if (warn)
 	error ("%s: the symbol `%s' is not valid as a function",
-	       warn_for, fcn_name);
+	       warn_for.c_str (), fcn_name.c_str ());
       ans = 0;
     }
 
@@ -179,8 +178,7 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  const char *name = tstr.c_str ();
+  string name = args(0).string_value ();
 
   if (error_state)
     {
@@ -216,21 +214,22 @@
       return retval;
     }
 
-  string tstr = args(0).string_value ();
-  char *name = strsave (tstr.c_str ());
+  string name = args(0).string_value ();
 
   if (error_state)
     {
       error ("exist: expecting string argument");
-      delete [] name;
       return retval;
     }
 
-  char *struct_elts = strchr (name, '.');
-  if (struct_elts)
+  string struct_elts;
+
+  size_t pos = name.find ('.');
+
+  if (pos != NPOS)
     {
-      *struct_elts = '\0';
-      struct_elts++;
+      struct_elts = name.substr (pos+1);
+      name = name.substr (0, pos);
     }
 
   symbol_record *sr = curr_sym_tab->lookup (name, 0, 0);
@@ -243,14 +242,16 @@
     {
       retval = 1.0;
       tree_fvc *def = sr->def ();
-      if (struct_elts)
+
+      if (! struct_elts.empty ())
 	{
 	  retval = 0.0;
 	  if (def->is_constant ())
 	    {
 	      tree_constant *tmp = (tree_constant *) def;
-	      tree_constant ult;
-	      ult = tmp->lookup_map_element (struct_elts, 0, 1);
+
+	      tree_constant ult	= tmp->lookup_map_element (struct_elts, 0, 1);
+
 	      if (ult.is_defined ())
 		retval = 1.0;
 	    }
@@ -266,208 +267,157 @@
     }
   else
     {
-      char *path = fcn_file_in_path (name);
-      if (path)
+      string path = fcn_file_in_path (name);
+
+      if (path.length () > 0)
 	{
-	  delete [] path;
 	  retval = 2.0;
 	}
       else
 	{
 	  path = oct_file_in_path (name);
-	  if (path)
+
+	  if (path.length () > 0)
 	    {
-	      delete [] path;
 	      retval = 3.0;
 	    }
 	  else
 	    {
 	      struct stat buf;
-	      if (stat (name, &buf) == 0 && S_ISREG (buf.st_mode))
+	      if (stat (name.c_str (), &buf) == 0 && S_ISREG (buf.st_mode))
 		retval = 2.0;
 	    }
 	}
     }
 
-  delete [] name;
-
   return retval;
 }
 
 // XXX FIXME XXX -- should these really be here?
 
-static char *
+static string
 octave_home (void)
 {
   char *oh = getenv ("OCTAVE_HOME");
 
-  return (oh ? oh : OCTAVE_PREFIX);
+  return oh ? string (oh) : string (OCTAVE_PREFIX);
 }
 
-static char *
-subst_octave_home (char *s)
+static string
+subst_octave_home (const string& s)
 {
-  char *home = octave_home ();
-  char *prefix = OCTAVE_PREFIX;
-
-  char *retval;
-
-  if (strcmp (home, prefix) == 0)
-    retval = strsave (s);
-  else
-    {
-      int len_home = strlen (home);
-      int len_prefix = strlen (prefix);
+  string retval;
 
-      int count = 0;
-      char *ptr = s;
-      char *next = 0;
-      while ((next = strstr (ptr, prefix)))
-	{
-	  ptr = next + len_prefix;
-	  count++;
-	}
-
-      int grow_size = count * (len_home - len_prefix);
-
-      int len_s = strlen (s);
-
-      int len_retval = len_s + count * grow_size;
+  string home = octave_home ();
+  string prefix = OCTAVE_PREFIX;
 
-      retval = new char [len_retval+1];
-
-      char *p1 = s;
-      char *p2 = p1;
-      char *pdest = retval;
-
-      // Is this really a good way to do this?
-
-      while (count >= 0)
-	{
-	  p2 = strstr (p1, prefix);
+  retval = s;
 
-	  if (! p2)
-	    {
-	      memcpy (pdest, p1, strlen (p1)+1);
-	      break;
-	    }
-	  else if (p1 == p2)
-	    {
-	      memcpy (pdest, home, len_home);
-	      pdest += len_home;
-	      p1 += len_prefix;
-	      count--;
-	    }
-	  else
-	    {
-	      int len = (int) (p2 - p1);
-	      memcpy (pdest, p1, len);
-	      pdest += len;
-	      p1 += len;
-	    }
-
+  if (home != prefix)
+    {
+      int len = prefix.length ();
+      size_t start = 0;
+      while ((start = s.find (prefix)) != NPOS)
+	{
+	  retval.replace (start, len, home);
+	  start++;
 	}
     }
 
   return retval;
 }
 
-static char *
+static string
 octave_info_dir (void)
 {
-  static char *retval = subst_octave_home (OCTAVE_INFODIR);
-  return retval;
+  return subst_octave_home (OCTAVE_INFODIR);
 }
 
-char *
+string
 octave_arch_lib_dir (void)
 {
-  static char *retval = subst_octave_home (OCTAVE_ARCHLIBDIR);
-  return retval;
+  return subst_octave_home (OCTAVE_ARCHLIBDIR);
 }
 
-char *
+string
 octave_fcn_file_dir (void)
 {
-  static char *retval = subst_octave_home (OCTAVE_FCNFILEDIR);
-  return retval;
+  return subst_octave_home (OCTAVE_FCNFILEDIR);
 }
 
-char *
+string
 octave_bin_dir (void)
 {
-  static char *retval = subst_octave_home (OCTAVE_BINDIR);
-  return retval;
+  return subst_octave_home (OCTAVE_BINDIR);
 }
 
-static char *
+string
 default_pager (void)
 {
-  static char *pager_binary = 0;
-  delete [] pager_binary;
+  string pager_binary;
+
   char *pgr = getenv ("PAGER");
+
   if (pgr)
-    pager_binary = strsave (pgr);
-  else
+    pager_binary = string (pgr);
 #ifdef DEFAULT_PAGER
-    pager_binary = strsave (DEFAULT_PAGER);
-#else
-    pager_binary = strsave ("");
+  else
+    pager_binary = string (DEFAULT_PAGER);
 #endif
 
   return pager_binary;
 }
 
-// Always returns a new string.
+string
+maybe_add_default_load_path (const string& pathstring)
+{
+  string std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
 
-char *
-maybe_add_default_load_path (const char *p)
-{
-  static char *std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
+  string retval;
 
-  char *pathstring = strsave (p);
-
-  if (pathstring[0] == SEPCHAR)
+  if (! pathstring.empty ())
     {
-      char *tmp = pathstring;
-      pathstring = strconcat (std_path, pathstring);
-      delete [] tmp;
+      if (pathstring[0] == SEPCHAR)
+	{
+	  retval = std_path;
+	  retval.append (pathstring);
+	}
+      else
+	retval = pathstring;
+
+      if (pathstring[pathstring.length () - 1] == SEPCHAR)
+	retval.append (std_path);
     }
 
-  int tmp_len = strlen (pathstring);
-  if (pathstring[tmp_len-1] == SEPCHAR)
-    {
-      char *tmp = pathstring;
-      pathstring = strconcat (pathstring, std_path);
-      delete [] tmp;
-    }
-
-  return pathstring;
-}
-
-char *
-octave_lib_dir (void)
-{
-  static char *retval = subst_octave_home (OCTAVE_LIBDIR);
   return retval;
 }
 
-char *
+string
+octave_lib_dir (void)
+{
+  return subst_octave_home (OCTAVE_LIBDIR);
+}
+
+string
 default_exec_path (void)
 {
-  static char *exec_path_string = 0;
-  delete [] exec_path_string;
+  string exec_path_string;
+
   char *octave_exec_path = getenv ("OCTAVE_EXEC_PATH");
+
   if (octave_exec_path)
-    exec_path_string = strsave (octave_exec_path);
+    exec_path_string = string (octave_exec_path);
   else
     {
       char *shell_path = getenv ("PATH");
+
       if (shell_path)
-	exec_path_string = strconcat (":", shell_path);
-      else
-	exec_path_string = strsave ("");
+	{
+	  exec_path_string = string (":");
+	  exec_path_string.append (shell_path);
+	}
     }
+
   return exec_path_string;
 }
 
@@ -475,82 +425,78 @@
 // If the path starts with `:', prepend the standard path.  If it ends
 // with `:' append the standard path.  If it begins and ends with
 // `:', do both (which is useless, but the luser asked for it...).
-//
-// This function may eventually be called more than once, so be
-// careful not to create memory leaks.
 
-char *
+string
 default_path (void)
 {
-  static char *std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
-
-  static char *oct_path = getenv ("OCTAVE_PATH");
+  string std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
 
-  static char *pathstring = 0;
-  delete [] pathstring;
+  char *oct_path = getenv ("OCTAVE_PATH");
 
-  return oct_path ? strsave (oct_path) : strsave (std_path);
+  return oct_path ? string (oct_path) : std_path;
 }
 
-char *
+string
 default_info_file (void)
 {
-  static char *info_file_string = 0;
-  delete [] info_file_string;
+  string info_file_string;
+
   char *oct_info_file = getenv ("OCTAVE_INFO_FILE");
+
   if (oct_info_file)
-    info_file_string = strsave (oct_info_file);
+    info_file_string = string (oct_info_file);
   else
     {
-      char *infodir = octave_info_dir ();
-      info_file_string = strconcat (infodir, "/octave.info");
+      string infodir = octave_info_dir ();
+      info_file_string = infodir.append ("/octave.info");
     }
+
   return info_file_string;
 }
 
-char *
+string
 default_info_prog (void)
 {
-  static char *info_prog_string = 0;
-  delete [] info_prog_string;
+  string info_prog_string;
+
   char *oct_info_prog = getenv ("OCTAVE_INFO_PROGRAM");
+
   if (oct_info_prog)
-    info_prog_string = strsave (oct_info_prog);
+    info_prog_string = string (oct_info_prog);
   else
     {
-      char *archdir = octave_arch_lib_dir ();
-      info_prog_string = strconcat (archdir, "/info");
+      string archdir = octave_arch_lib_dir ();
+      info_prog_string = archdir.append ("/info");
     }
+
   return info_prog_string;
 }
 
-char *
+string
 default_editor (void)
 {
-  static char *editor_string = 0;
-  delete [] editor_string;
+  string editor_string = "vi";
+
   char *env_editor = getenv ("EDITOR");
+
   if (env_editor && *env_editor)
-    editor_string = strsave (env_editor);
-  else
-    editor_string = strsave ("vi");
+    editor_string = string (env_editor);
+
   return editor_string;
 }
 
-char *
+string
 get_local_site_defaults (void)
 {
-  static char *startupdir = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR);
-  static char *sd = strconcat (startupdir, "/octaverc");
-  return sd;
+  string startupdir = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR);
+  return startupdir.append ("/octaverc");
 }
 
-char *
+string
 get_site_defaults (void)
 {
-  static char *startupdir = subst_octave_home (OCTAVE_STARTUPFILEDIR);
-  static char *sd = strconcat (startupdir, "/octaverc");
-  return sd;
+  string startupdir = subst_octave_home (OCTAVE_STARTUPFILEDIR);
+  return startupdir.append ("/octaverc");
 }
 
 // Functions for looking up variables and functions.
@@ -571,13 +517,15 @@
       tree_fvc *ans = sr->def ();
       if (ans)
 	{
-	  char *ff = ans->fcn_file_name ();
-	  if (ff && ! (ignore && ans->is_system_fcn_file ()))
+	  string ff = ans->fcn_file_name ();
+	  if (! ff.empty () && ! (ignore && ans->is_system_fcn_file ()))
 	    {
 	      time_t tp = ans->time_parsed ();
-	      char *fname = fcn_file_in_path (ff);
+
+	      string fname = fcn_file_in_path (ff);
+
 	      int status = is_newer (fname, tp);
-	      delete [] fname;
+
 	      if (status > 0)
 		return 1;
 	    }
@@ -587,20 +535,26 @@
 }
 
 static int
-looks_like_octave_copyright (char *s)
+looks_like_octave_copyright (const string& s)
 {
-  if (s && strncmp (s, " Copyright (C) ", 15) == 0)
+  string t = s.substr (0, 15);
+
+  if (t == " Copyright (C) ")
     {
-      s = strchr (s, '\n');
-      if (s)
+      size_t pos = s.find ('\n');
+
+      if (pos != NPOS)
 	{
-	  s++;
-	  s = strchr (s, '\n');
-	  if (s)
+	  pos = s.find ('\n', pos + 1);
+
+	  if (pos != NPOS)
 	    {
-	      s++;
-	      if (strncmp (s, " This file is part of Octave.", 29) == 0
-		  || strncmp (s, " This program is free software", 30) == 0)
+	      pos++;
+
+	      t = s.substr (pos, 29);
+
+	      if (t == " This file is part of Octave."
+		  || t == " This program is free software")
 		return 1;
 	    }
 	}
@@ -613,24 +567,26 @@
 // IN_PARTS, consider each block of comments separately; otherwise,
 // grab them all at once.
 
-static char *
+static string
 gobble_leading_white_space (FILE *ffile, int in_parts)
 {
-  ostrstream buf;
+  string help_txt;
 
   int first_comments_seen = 0;
   int have_help_text = 0;
   int in_comment = 0;
   int c;
+
   while ((c = getc (ffile)) != EOF)
     {
       current_input_column++;
+
       if (in_comment)
 	{
 	  if (! have_help_text)
 	    {
 	      first_comments_seen = 1;
-	      buf << (char) c;
+	      help_txt += (char) c;
 	    }
 
 	  if (c == '\n')
@@ -638,6 +594,7 @@
 	      input_line_number++;
 	      current_input_column = 0;
 	      in_comment = 0;
+
 	      if (in_parts)
 		{
 		  if ((c = getc (ffile)) != EOF)
@@ -684,27 +641,15 @@
 
  done:
 
-  buf << ends;
-  char *help_txt = buf.str ();
-
-  if (help_txt)
+  if (! help_txt.empty ())
     {
       if (looks_like_octave_copyright (help_txt)) 
-	{
-	  delete [] help_txt;
-	  help_txt = 0;
-	}
+	help_txt.resize (0);
 
-      if (in_parts && ! help_txt)
+      if (in_parts && help_txt.empty ())
 	help_txt = gobble_leading_white_space (ffile, in_parts);
     }
 
-  if (help_txt && ! *help_txt)
-    {
-      delete [] help_txt;
-      help_txt = 0;
-    }
-
   return help_txt;
 }
 
@@ -728,14 +673,12 @@
 }
 
 static int
-parse_fcn_file (int exec_script, char *ff)
+parse_fcn_file (int exec_script, const string& ff)
 {
   begin_unwind_frame ("parse_fcn_file");
 
   int script_file_executed = 0;
 
-  assert (ff);
-
   // Open function file and parse.
 
   int old_reading_fcn_file_state = reading_fcn_file;
@@ -760,7 +703,7 @@
       // Check to see if this file defines a function or is just a
       // list of commands.
 
-      char *tmp_help_txt = gobble_leading_white_space (ffile, 0);
+      string tmp_help_txt = gobble_leading_white_space (ffile, 0);
 
       if (is_function_file (ffile))
 	{
@@ -786,23 +729,19 @@
 
 	  reset_parser ();
 
-	  delete [] help_buf;
 	  help_buf = tmp_help_txt;
 
 	  int status = yyparse ();
 
 	  if (status != 0)
 	    {
-	      error ("parse error while reading function file %s", ff);
+	      error ("parse error while reading function file %s",
+		     ff.c_str ());
 	      global_sym_tab->clear (curr_fcn_file_name);
 	    }
 	}
       else if (exec_script)
 	{
-	  // We don't need this now.
-
-	  delete [] tmp_help_txt;
-
 	  // The value of `reading_fcn_file' will be restored to the
 	  // proper value when we unwind from this frame.
 
@@ -828,7 +767,7 @@
 {
   int script_file_executed = 0;
 
-  char *nm = sym_rec->name ();
+  string nm = sym_rec->name ();
 
   if (load_octave_oct_file (nm))
     {
@@ -836,21 +775,25 @@
     }
   else
     {
-      char *ff = fcn_file_in_path (nm);
+      string ff = fcn_file_in_path (nm);
 
       // These are needed by yyparse.
 
+      begin_unwind_frame ("load_fcn_from_file");
+
+      unwind_protect_str (curr_fcn_file_name);
+      unwind_protect_str (curr_fcn_file_full_name);
+
       curr_fcn_file_name = nm;
       curr_fcn_file_full_name = ff;
 
-      if (ff)
-	{
-	  script_file_executed = parse_fcn_file (exec_script, ff);
-	  delete [] ff;
-	}
+      if (ff.length () > 0)
+	script_file_executed = parse_fcn_file (exec_script, ff);
 
       if (! (error_state || script_file_executed))
 	force_link_to_function (nm);
+
+      run_unwind_frame ("load_fcn_from_file");
     }
 
   return script_file_executed;
@@ -889,7 +832,7 @@
 // current symbol table.
 
 symbol_record *
-lookup_by_name (const char *nm, int exec_script)
+lookup_by_name (const string& nm, int exec_script)
 {
   symbol_record *sym_rec = curr_sym_tab->lookup (nm, 1, 0);
 
@@ -898,20 +841,23 @@
   return sym_rec;
 }
 
-char *
-get_help_from_file (const char *path)
+string
+get_help_from_file (const string& path)
 {
-  if (path && *path)
+  string retval;
+
+  if (! path.empty ())
     {
-      FILE *fptr = fopen (path, "r");
+      FILE *fptr = fopen (path.c_str (), "r");
+
       if (fptr)
 	{
-	  char *help_txt = gobble_leading_white_space (fptr, 1);
+	  retval = gobble_leading_white_space (fptr, 1);
 	  fclose (fptr);
-	  return help_txt;
 	}
     }
-  return 0;
+
+  return retval;
 }
 
 // Variable values.
@@ -919,8 +865,8 @@
 // Look for the given name in the global symbol table.  If it refers
 // to a string, return a new copy.  If not, return 0;
 
-char *
-builtin_string_variable (const char *name)
+string
+builtin_string_variable (const string& name)
 {
   symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
 
@@ -928,7 +874,7 @@
 
   assert (sr);
 
-  char *retval = 0;
+  string retval;
 
   tree_fvc *defn = sr->def ();
 
@@ -937,13 +883,7 @@
       tree_constant val = defn->eval (0);
 
       if (! error_state && val.is_string ())
-	{
-	  string tstr = val.string_value ();
-	  const char *s = tstr.c_str ();
-
-	  if (s)
-	    retval = strsave (s);
-	}
+	retval = val.string_value ();
     }
 
   return retval;
@@ -954,7 +894,7 @@
 // return 0.
 
 int
-builtin_real_scalar_variable (const char *name, double& d)
+builtin_real_scalar_variable (const string& name, double& d)
 {
   int status = 0;
   symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
@@ -982,7 +922,7 @@
 // Look for the given name in the global symbol table.
 
 tree_constant
-builtin_any_variable (const char *name)
+builtin_any_variable (const string& name)
 {
   tree_constant retval;
 
@@ -1012,11 +952,13 @@
   if (sr->is_linked_to_global ())
     return;
 
-  symbol_record *gsr = global_sym_tab->lookup (sr->name (), 1, 0);
+  string nm = sr->name ();
+
+  symbol_record *gsr = global_sym_tab->lookup (nm, 1, 0);
 
   if (sr->is_formal_parameter ())
     {
-      error ("can't make function parameter `%s' global", sr->name ());
+      error ("can't make function parameter `%s' global", nm.c_str ());
       return;
     }
 
@@ -1083,7 +1025,7 @@
 // given name defined in the global symbol table.
 
 void
-force_link_to_function (const char *id_name)
+force_link_to_function (const string& id_name)
 {
   symbol_record *gsr = global_sym_tab->lookup (id_name, 1, 0);
   if (gsr->is_function ())
@@ -1098,7 +1040,7 @@
 
 // It's not likely that this does the right thing now.  XXX FIXME XXX
 
-char **
+string_vector
 make_name_list (void)
 {
   int key_len = 0;
@@ -1107,11 +1049,11 @@
   int lcl_len = 0;
   int ffl_len = 0;
 
-  char **key = 0;
-  char **glb = 0;
-  char **top = 0;
-  char **lcl = 0;
-  char **ffl = 0;
+  string_vector key;
+  string_vector glb;
+  string_vector top;
+  string_vector lcl;
+  string_vector ffl;
 
   // Each of these functions returns a new vector of pointers to new
   // strings.
@@ -1125,7 +1067,7 @@
 
   int total_len = key_len + glb_len + top_len + lcl_len + ffl_len;
 
-  char **list = new char * [total_len+1];
+  string_vector list (total_len);
 
   // Put all the symbols in one big list.  Only copy pointers, not the
   // strings they point to, then only delete the original array of
@@ -1148,14 +1090,6 @@
   for (i = 0; i < ffl_len; i++)
     list[j++] = ffl[i];
 
-  list[j] = 0;
-
-  delete [] key;
-  delete [] glb;
-  delete [] top;
-  delete [] lcl;
-  delete [] ffl;
-
   return list;
 }
 
@@ -1169,7 +1103,7 @@
 #if 0
   output_buf << (s.hides_fcn () ? "f" : (s.hides_builtin () ? "F" : "-"));
 #endif
-  output_buf.form ("  %-16s", s.type_as_string ());
+  output_buf.form ("  %-16s", s.type_as_string ().c_str ());
   if (s.is_function ())
     output_buf << "      -      -";
   else
@@ -1195,7 +1129,7 @@
 }
 
 static int
-maybe_list (const char *header, char **argv, int argc,
+maybe_list (const char *header, const string_vector& argv, int argc,
 	    ostrstream& output_buf, int show_verbose, symbol_table
 	    *sym_tab, unsigned type, unsigned scope)
 {
@@ -1218,14 +1152,14 @@
     }
   else
     {
-      char **symbols = sym_tab->list (count, argv, argc, 1, type, scope);
-      if (symbols && count > 0)
+      string_vector symbols = sym_tab->list (count, argv, argc, 1,
+					     type, scope);
+      if (symbols.length () > 0 && count > 0)
 	{
 	  output_buf << "\n" << header << "\n\n";
 	  list_in_columns (output_buf, symbols);
 	  status = 1;
 	}
-      delete [] symbols;
     }
   return status;
 }
@@ -1237,12 +1171,17 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("document");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "document");
+
+  if (error_state)
+    return retval;
 
   if (argc == 3)
     {
-      char *name = argv[1];
-      char *help = argv[2];
+      string name = argv[1];
+      string help = argv[2];
 
       if (is_builtin_variable (name))
 	error ("sorry, can't redefine help for builtin variables");
@@ -1253,14 +1192,12 @@
 	  if (sym_rec)
 	    sym_rec->document (help);
 	  else
-	    error ("document: no such symbol `%s'", name);
+	    error ("document: no such symbol `%s'", name.c_str ());
 	}
     }
   else
     print_usage ("document");
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -1268,7 +1205,7 @@
 // naming the variables to look for.
 
 static Octave_object
-do_who (int argc, char **argv)
+do_who (int argc, const string_vector& argv)
 {
   Octave_object retval;
 
@@ -1277,7 +1214,7 @@
   int show_variables = 1;
   int show_verbose = 0;
 
-  char *my_name = argv[0];
+  string my_name = argv[0];
 
   if (argc > 1)
     {
@@ -1285,26 +1222,25 @@
       show_variables = 0;
     }
 
-  while (--argc > 0)
+  for (int i = 1; i < argc; i++)
     {
-      argv++;
-
-      if (strcmp (*argv, "-all") == 0 || strcmp (*argv, "-a") == 0)
+      if (argv[i] == "-all" || argv[i] == "-a")
 	{
 	  show_builtins++;
 	  show_functions++;
 	  show_variables++;
 	}
-      else if (strcmp (*argv, "-builtins") == 0 || strcmp (*argv, "-b") == 0)
+      else if (argv[i] == "-builtins" || argv[i] == "-b")
 	show_builtins++;
-      else if (strcmp (*argv, "-functions") == 0 || strcmp (*argv, "-f") == 0)
+      else if (argv[i] == "-functions" || argv[i] == "-f")
 	show_functions++;
-      else if (strcmp (*argv, "-long") == 0 || strcmp (*argv, "-l") == 0)
+      else if (argv[i] == "-long" || argv[i] == "-l")
 	show_verbose++;
-      else if (strcmp (*argv, "-variables") == 0 || strcmp (*argv, "-v") == 0)
+      else if (argv[i] == "-variables" || argv[i] == "-v")
 	show_variables++;
-      else if (*argv[0] == '-')
-	warning ("%s: unrecognized option `%s'", my_name, *argv);
+      else if (argv[i][0] == '-')
+	warning ("%s: unrecognized option `%s'", my_name.c_str (),
+		 argv[i].c_str ());
       else
 	break;
     }
@@ -1372,12 +1308,15 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("who");
+  int argc = args.length () + 1;
+
+  string_vector argv = make_argv (args, "who");
+
+  if (error_state)
+    return retval;
 
   retval = do_who (argc, argv);
 
-  DELETE_ARGV;
-
   return retval;
 }
 
@@ -1397,83 +1336,79 @@
   tmp_args(0) = "-long";
 
   int argc = tmp_args.length () + 1;
-  char **argv = make_argv (tmp_args, "whos");
+
+  string_vector argv = make_argv (tmp_args, "whos");
 
   if (error_state)
     return retval;
 
   retval = do_who (argc, argv);
 
-  while (--argc >= 0)
-    delete [] argv[argc];
-  delete [] argv;
-
   return retval;
 }
 
 // Install variables and functions in the symbol tables.
 
 void
-install_builtin_mapper (builtin_mapper_function *mf)
+install_builtin_mapper (const builtin_mapper_function& mf)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (mf->name, 1);
+  symbol_record *sym_rec = global_sym_tab->lookup (mf.name, 1);
   sym_rec->unprotect ();
 
   Mapper_fcn mfcn;
-  mfcn.name = strsave (mf->name);
-  mfcn.can_return_complex_for_real_arg = mf->can_return_complex_for_real_arg;
-  mfcn.lower_limit = mf->lower_limit;
-  mfcn.upper_limit = mf->upper_limit;
-  mfcn.d_d_mapper = mf->d_d_mapper;
-  mfcn.d_c_mapper = mf->d_c_mapper;
-  mfcn.c_c_mapper = mf->c_c_mapper;
 
-  tree_builtin *def = new tree_builtin (mfcn, mf->name);
+  mfcn.name = mf.name;
+  mfcn.can_return_complex_for_real_arg = mf.can_return_complex_for_real_arg;
+  mfcn.lower_limit = mf.lower_limit;
+  mfcn.upper_limit = mf.upper_limit;
+  mfcn.d_d_mapper = mf.d_d_mapper;
+  mfcn.d_c_mapper = mf.d_c_mapper;
+  mfcn.c_c_mapper = mf.c_c_mapper;
+
+  tree_builtin *def = new tree_builtin (mfcn, mf.name);
 
   sym_rec->define (def);
 
-  sym_rec->document (mf->help_string);
+  sym_rec->document (mf.help_string);
   sym_rec->make_eternal ();
   sym_rec->protect ();
 }
 
 void
-install_builtin_function (builtin_function *f)
+install_builtin_function (const builtin_function& f)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (f->name, 1);
+  symbol_record *sym_rec = global_sym_tab->lookup (f.name, 1);
   sym_rec->unprotect ();
 
-  tree_builtin *def = new tree_builtin (f->fcn, f->name);
+  tree_builtin *def = new tree_builtin (f.fcn, f.name);
 
-  sym_rec->define (def, f->is_text_fcn);
+  sym_rec->define (def, f.is_text_fcn);
 
-  sym_rec->document (f->help_string);
+  sym_rec->document (f.help_string);
   sym_rec->make_eternal ();
   sym_rec->protect ();
 }
 
 void
-install_builtin_variable (builtin_variable *v)
+install_builtin_variable (const builtin_variable& v)
 {
-  if (v->install_as_function)
-    install_builtin_variable_as_function (v->name, v->value, v->protect,
-					  v->eternal, v->help_string);
+  if (v.install_as_function)
+    install_builtin_variable_as_function (v.name, v.value, v.protect,
+					  v.eternal, v.help_string);
   else
-    bind_builtin_variable (v->name, v->value, v->protect, v->eternal,
-			   v->sv_function, v->help_string);
+    bind_builtin_variable (v.name, v.value, v.protect, v.eternal,
+			   v.sv_function, v.help_string);
 }
 
 void
-install_builtin_variable_as_function (const char *name, tree_constant *val,
+install_builtin_variable_as_function (const string& name, tree_constant *val,
 				      int protect, int eternal,
-				      const char *help)
+				      const string& help)
 {
   symbol_record *sym_rec = global_sym_tab->lookup (name, 1);
   sym_rec->unprotect ();
 
-  const char *tmp_help = help;
-  if (! help)
-    tmp_help = sym_rec->help ();
+  string tmp_help = help.empty () ? sym_rec->help () : help;
 
   sym_rec->define_as_fcn (val);
 
@@ -1487,9 +1422,10 @@
 }
 
 void
-alias_builtin (const char *alias, const char *name)
+alias_builtin (const string& alias, const string& name)
 {
   symbol_record *sr_name = global_sym_tab->lookup (name, 0, 0);
+
   if (! sr_name)
     panic ("can't alias to undefined name!");
 
@@ -1498,7 +1434,8 @@
   if (sr_alias)
     sr_alias->alias (sr_name);
   else
-    panic ("can't find symbol record for builtin function `%s'", alias);
+    panic ("can't find symbol record for builtin function `%s'",
+	   alias.c_str ());
 }
 
 // Defining variables.
@@ -1571,9 +1508,9 @@
 // functions needed?
 
 void
-bind_builtin_variable (const char *varname, tree_constant *val,
+bind_builtin_variable (const string& varname, tree_constant *val,
 		       int protect, int eternal, sv_Function sv_fcn,
-		       const char *help)
+		       const string& help)
 {
   symbol_record *sr = global_sym_tab->lookup (varname, 1, 0);
 
@@ -1599,14 +1536,13 @@
   if (eternal)
     sr->make_eternal ();
 
-  if (help)
-    sr->document (help);
+  sr->document (help);
 }
 
 void
-bind_builtin_variable (const char *varname, const tree_constant& val,
+bind_builtin_variable (const string& varname, const tree_constant& val,
 		       int protect, int eternal, sv_Function sv_fcn,
-		       const char *help)
+		       const string& help)
 {
   tree_constant *tc = new tree_constant (val);
   bind_builtin_variable (varname, tc, protect, eternal, sv_fcn, help);
@@ -1929,10 +1865,12 @@
 {
   Octave_object retval;
 
-  DEFINE_ARGV("clear");
+  int argc = args.length () + 1;
 
-  argc--;
-  argv++;
+  string_vector argv = make_argv (args, "clear");
+
+  if (error_state)
+    return retval;
 
   // Always clear the local table, but don't clear currently compiled
   // functions unless we are at the top level.  (Allowing that to
@@ -1940,7 +1878,7 @@
 
   int clear_user_functions = (curr_sym_tab == top_level_sym_tab);
 
-  if (argc == 0)
+  if (argc == 1)
     {
       curr_sym_tab->clear ();
       global_sym_tab->clear (clear_user_functions);
@@ -1949,23 +1887,21 @@
     {
       int exclusive = 0;
 
-      if (argc > 0)
+      int idx = 1;
+
+      if (argc > 1)
 	{
-	  if (strcmp (*argv, "-x") == 0)
-	    {
-	      exclusive = 1;
-	      argv++;
-	      argc--;
-	    }
+	  if (argv[idx] == "-x")
+	    exclusive = 1;
 	}
 
       int lcount = 0;
       int gcount = 0;
       int fcount = 0;
 
-      char **lvars = 0;
-      char **gvars = 0;
-      char **fcns = 0;
+      string_vector lvars;
+      string_vector gvars;
+      string_vector fcns;
 
       if (argc > 0)
 	{
@@ -1982,17 +1918,19 @@
 				       SYMTAB_ALL_SCOPES);
 	}
 
-      while (argc > 0)
+      for (int k = idx + 1; k < argc; k++)
 	{
-	  char *pat = *argv;
+	  string patstr = argv[k];
 
-	  if (pat)
+	  if (! patstr.empty ())
 	    {
+	      const char *pat = patstr.c_str ();
+
 	      int i;
 	      for (i = 0; i < lcount; i++)
 		{
-		  char *nm = lvars[i];
-		  int match = (fnmatch (pat, nm, __FNM_FLAGS) == 0);
+		  string nm = lvars[i];
+		  int match = (fnmatch (pat, nm.c_str (), __FNM_FLAGS) == 0);
 		  if ((exclusive && ! match) || (! exclusive && match))
 		    curr_sym_tab->clear (nm);
 		}
@@ -2000,8 +1938,8 @@
 	      int count;
 	      for (i = 0; i < gcount; i++)
 		{
-		  char *nm = gvars[i];
-		  int match = (fnmatch (pat, nm, __FNM_FLAGS) == 0);
+		  string nm = gvars[i];
+		  int match = (fnmatch (pat, nm.c_str (), __FNM_FLAGS) == 0);
 		  if ((exclusive && ! match) || (! exclusive && match))
 		    {
 		      count = curr_sym_tab->clear (nm);
@@ -2012,8 +1950,8 @@
 
 	      for (i = 0; i < fcount; i++)
 		{
-		  char *nm = fcns[i];
-		  int match = (fnmatch (pat, nm, __FNM_FLAGS) == 0);
+		  string nm = fcns[i];
+		  int match = (fnmatch (pat, nm.c_str (), __FNM_FLAGS) == 0);
 		  if ((exclusive && ! match) || (! exclusive && match))
 		    {
 		      count = curr_sym_tab->clear (nm);
@@ -2021,19 +1959,9 @@
 		    }
 		}
 	    }
-
-	  argc--;
-	  argv++;
 	}
-
-      delete [] lvars;
-      delete [] gvars;
-      delete [] fcns;
-
     }
 
-  DELETE_ARGV;
-
   return retval;
 }
 
--- a/src/variables.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/variables.h	Mon Jan 22 04:47:22 1996 +0000
@@ -30,6 +30,9 @@
 class tree_fvc;
 class tree_constant;
 class Octave_object;
+class string_vector;
+
+#include <string>
 
 struct builtin_mapper_function;
 
@@ -37,65 +40,73 @@
 
 struct builtin_variable
 {
-  char *name;
+  builtin_variable (const string& n, tree_constant *v, int iaf, int p,
+		    int e, sv_Function svf, const string& h)
+    : name (n), value (v), install_as_function (iaf), protect (p),
+      eternal (e), sv_function (svf), help_string (h) { }
+
+  string name;
   tree_constant *value;
   int install_as_function;
   int protect;
   int eternal;
   sv_Function sv_function;
-  char *help_string;
+  string help_string;
 };
 
 typedef Octave_object (*Octave_builtin_fcn)(const Octave_object&, int);
 
 struct builtin_function
 {
-  char *name;
+  builtin_function (const string& n, int itf, Octave_builtin_fcn f,
+		    const string& h)
+    : name (n), is_text_fcn (itf), fcn (f), help_string (h) { }
+
+  string name;
   int is_text_fcn;
   Octave_builtin_fcn fcn;
-  char *help_string;
+  string help_string;
 };
 
 extern void initialize_symbol_tables (void);
 
 extern int lookup (symbol_record *s, int exec_script = 1);
 
-extern symbol_record *lookup_by_name (const char *nm, int exec_script = 1);
+extern symbol_record *lookup_by_name (const string& nm, int exec_script = 1);
 
-extern char *get_help_from_file (const char *f);
+extern string get_help_from_file (const string& f);
 
-extern char *builtin_string_variable (const char *);
-extern int builtin_real_scalar_variable (const char *, double&);
-extern tree_constant builtin_any_variable (const char *);
+extern string builtin_string_variable (const string&);
+extern int builtin_real_scalar_variable (const string&, double&);
+extern tree_constant builtin_any_variable (const string&);
 
 extern void link_to_global_variable (symbol_record *sr);
 extern void link_to_builtin_variable (symbol_record *sr);
 extern void link_to_builtin_or_function (symbol_record *sr);
 
-extern void force_link_to_function (const char *s);
+extern void force_link_to_function (const string&);
 
-extern int is_builtin_variable (const char *name);
-extern int is_text_function_name (const char *name);
-extern int is_globally_visible (const char *name);
+extern int is_builtin_variable (const string&);
+extern int is_text_function_name (const string&);
+extern int is_globally_visible (const string&);
 
-extern tree_fvc *is_valid_function (const tree_constant&, char *,
+extern tree_fvc *is_valid_function (const tree_constant&, const string&,
 				    int warn = 0); 
 
-extern char **make_name_list (void);
-
-extern void install_builtin_mapper (builtin_mapper_function *mf);
+extern string_vector make_name_list (void);
 
-extern void install_builtin_function (builtin_function *gf);
+extern void install_builtin_mapper (const builtin_mapper_function& mf);
 
-extern void install_builtin_variable (builtin_variable *v);
+extern void install_builtin_function (const builtin_function& gf);
 
-extern void install_builtin_variable_as_function (const char *name,
-						  tree_constant *val,
-						  int protect = 0,
-						  int eternal = 0,
-						  const char *help = 0);
+extern void install_builtin_variable (const builtin_variable& v);
 
-extern void alias_builtin (const char *alias, const char *name);
+extern void
+install_builtin_variable_as_function
+  (const string& name, tree_constant *val, int protect = 0,
+   int eternal = 0, const string& help = string ());
+
+extern void alias_builtin (const string& alias, const string& name);
 
 #if 0
 extern void bind_nargin_and_nargout (symbol_table *sym_tab,
@@ -108,31 +119,31 @@
 
 extern void clear_global_error_variable (void *);
 
-extern void bind_builtin_variable (const char *, tree_constant *,
+extern void bind_builtin_variable (const string&, tree_constant *,
 				   int protect = 0, int eternal = 0,
 				   sv_Function f = (sv_Function) 0,
-				   const char *help = 0);
+				   const string& help = string ());
 
-extern void bind_builtin_variable (const char *, const tree_constant&,
+extern void bind_builtin_variable (const string&, const tree_constant&,
 				   int protect = 0, int eternal = 0,
 				   sv_Function f = (sv_Function) 0,
-				   const char *help = 0);
+				   const string& help = string ());
 
 extern void install_builtin_variables (void);
 
-extern char *maybe_add_default_load_path (const char *p);
+extern string maybe_add_default_load_path (const string& p);
 
-extern char *octave_lib_dir (void);
-extern char *octave_arch_lib_dir (void);
-extern char *octave_fcn_file_dir (void);
-extern char *octave_bin_dir (void);
-extern char *default_exec_path (void);
-extern char *default_path (void);
-extern char *default_info_file (void);
-extern char *default_info_prog (void);
-extern char *default_editor (void);
-extern char *get_local_site_defaults (void);
-extern char *get_site_defaults (void);
+extern string octave_lib_dir (void);
+extern string octave_arch_lib_dir (void);
+extern string octave_fcn_file_dir (void);
+extern string octave_bin_dir (void);
+extern string default_exec_path (void);
+extern string default_path (void);
+extern string default_info_file (void);
+extern string default_info_prog (void);
+extern string default_editor (void);
+extern string get_local_site_defaults (void);
+extern string get_site_defaults (void);
 
 // Symbol table for symbols at the top level.
 extern symbol_table *top_level_sym_tab;