Index: trunk/Ohana/src/opihi/lib.shell/multicommand.c
===================================================================
--- trunk/Ohana/src/opihi/lib.shell/multicommand.c	(revision 41161)
+++ trunk/Ohana/src/opihi/lib.shell/multicommand.c	(revision 41340)
@@ -63,6 +63,4 @@
 
   p = line; 
-  int Nline = strlen(line);
-  
   done = FALSE;
   status = TRUE;
@@ -76,95 +74,82 @@
     tmpline = strncreate (p, q - p);
     stripwhite (tmpline);
-    myAssert (tmpline, "oops");
+    if (*tmpline) {
 
-    // empty command, free and continue
-    if (*tmpline == 0) {
-      free (tmpline);
-      if (q == line + Nline) {
-	done = TRUE;
-      } else {
-	p = q + 1;
-	myAssert (p - line <= Nline, "oops");
+      if (bufferPending) {
+	// flush old messages
+	ExpectMessage (server, 0.2, &message);
+	bufferPending = FALSE;
       }
-      continue;
-    }
 
-    if (bufferPending) {
-      // flush old messages
-      ExpectMessage (server, 0.2, &message);
-      bufferPending = FALSE;
-    }
+      status = command (tmpline, &outline, verbose);
 
-    // input tmpline is freed by command
-    status = command (tmpline, &outline, verbose);
+      if (status == -1) {
+	if (server) {
+	  // send the command to the server instead
+	  if (!SendMessage (server, "%s", outline)) {
+	    switch (errno) {
+	      case EPIPE:
+		gprint (GP_ERR, "server connection has died\n");
+		exit (32);
+	      default:
+		gprint (GP_ERR, "server is busy...32\n");
+		bufferPending = TRUE;
+		goto escape;
+	    }
+	  }
 
-    if (status == -1) {
-      if (server) {
-	// send the command to the server instead
-	if (!SendMessage (server, "%s", outline)) {
-	  switch (errno) {
-	    case EPIPE:
-	      gprint (GP_ERR, "server connection has died\n");
-	      exit (32);
-	    default:
-	      gprint (GP_ERR, "server is busy...32\n");
-	      bufferPending = TRUE;
-	      goto escape;
+	  // receive the command exit status
+	  if (ExpectMessage (server, MSG_TIMEOUT, &message)) {
+	    switch (errno) {
+	      case EPIPE:
+		gprint (GP_ERR, "server connection has died\n");
+		exit (33);
+	      default:
+		gprint (GP_ERR, "server is busy...33\n");
+		bufferPending = TRUE;
+		goto escape;
+	    }
+	  } else {
+	    sscanf (message.buffer, "STATUS %d", &status);
 	  }
-	}
 
-	// receive the command exit status
-	if (ExpectMessage (server, MSG_TIMEOUT, &message)) {
-	  switch (errno) {
-	    case EPIPE:
-	      gprint (GP_ERR, "server connection has died\n");
-	      exit (33);
-	    default:
-	      gprint (GP_ERR, "server is busy...33\n");
-	      bufferPending = TRUE;
-	      goto escape;
+	  // receive the resulting stderr
+	  if (ExpectMessage (server, MSG_TIMEOUT, &message)) {
+	    switch (errno) {
+	      case EPIPE:
+		gprint (GP_ERR, "server connection has died\n");
+		exit (34);
+	      default:
+		gprint (GP_ERR, "server is busy...34\n");
+		bufferPending = TRUE;
+		goto escape;
+	    }
+	  } else {
+	    gwrite (message.buffer, 1, message.Nbuffer, GP_ERR);
+	  }
+
+	  // receive the resulting stdout
+	  if (ExpectMessage (server, MSG_TIMEOUT, &message)) {
+	    switch (errno) {
+	      case EPIPE:
+		gprint (GP_ERR, "server connection has died\n");
+		exit (35);
+	      default:
+		gprint (GP_ERR, "server is busy...35\n");
+		bufferPending = TRUE;
+		goto escape;
+	    }
+	  } else {
+	    gwrite (message.buffer, 1, message.Nbuffer, GP_LOG);
 	  }
 	} else {
-	  sscanf (message.buffer, "STATUS %d", &status);
-	}
-
-	// receive the resulting stderr
-	if (ExpectMessage (server, MSG_TIMEOUT, &message)) {
-	  switch (errno) {
-	    case EPIPE:
-	      gprint (GP_ERR, "server connection has died\n");
-	      exit (34);
-	    default:
-	      gprint (GP_ERR, "server is busy...34\n");
-	      bufferPending = TRUE;
-	      goto escape;
-	  }
-	} else {
-	  gwrite (message.buffer, 1, message.Nbuffer, GP_ERR);
-	}
-
-	// receive the resulting stdout
-	if (ExpectMessage (server, MSG_TIMEOUT, &message)) {
-	  switch (errno) {
-	    case EPIPE:
-	      gprint (GP_ERR, "server connection has died\n");
-	      exit (35);
-	    default:
-	      gprint (GP_ERR, "server is busy...35\n");
-	      bufferPending = TRUE;
-	      goto escape;
-	  }
-	} else {
-	  gwrite (message.buffer, 1, message.Nbuffer, GP_LOG);
-	}
-      } else {
-	// if no server is defined, we treat an unknown command as an error
-	status = FALSE;
-      }	
+	  // if no server is defined, we treat an unknown command as an error
+	  status = FALSE;
+	}	
+      }
+    escape:
+      if (outline != NULL) free (outline);
+      if (!status && auto_break) done = TRUE;
     }
-  escape:
-    if (outline != NULL) free (outline);
-    if (!status && auto_break) done = TRUE;
-
     p = q + 1;
   }
