diff src/oct-hist.cc @ 2435:3be97fe02051

[project @ 1996-10-27 21:31:29 by jwe]
author jwe
date Sun, 27 Oct 1996 21:31:30 +0000
parents ced642d8ba6a
children f667d7ec08b9
line wrap: on
line diff
--- a/src/oct-hist.cc
+++ b/src/oct-hist.cc
@@ -131,9 +131,10 @@
   int i;
   for (i = 1; i < argc; i++)
     {
-      if (argv[i][0] == '-' && argv[i].length () == 2
-	  && (argv[i][1] == 'r' || argv[i][1] == 'w'
-	      || argv[i][1] == 'a' || argv[i][1] == 'n'))
+      string option = argv[i];
+
+      if (option == "-r" || option == "-w" || option == "-a"
+	  || option == "-n")
 	{
 	  if (i < argc - 1)
 	    {
@@ -141,24 +142,25 @@
 	      octave_command_history.set_file (file);
 	    }
 
-	  switch (argv[i][1])
-	    {
-	    case 'a':		// Append `new' lines to file.
-	      octave_command_history.append ();
-	      break;
+	  if (option == "-a")
+	    // Append `new' lines to file.
+	    octave_command_history.append ();
+
+	  else if (option == "-w")
+	    // Write entire history.
+	    octave_command_history.write ();
 
-	    case 'w':		// Write entire history.
-	      octave_command_history.write ();
-	      break;
+	  else if (option == "-r")
+	    // Read entire file.
+	    octave_command_history.read ();
 
-	    case 'r':		// Read entire file.
-	      octave_command_history.read ();
-	      break;
+	  else if (option == "-n")
+	    // Read `new' history from file.
+	    octave_command_history.read_range ();
 
-	    case 'n':		// Read `new' history from file.
-	      octave_command_history.read_range ();
-	      break;
-	    }
+	  else
+	    panic_impossible ();
+
 	  return;
 	}
       else if (argv[i] == "-q")