Index: /branches/eam_branches/ohana.20190329/src/opihi/lib.shell/multicommand.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/lib.shell/multicommand.c	(revision 40775)
+++ /branches/eam_branches/ohana.20190329/src/opihi/lib.shell/multicommand.c	(revision 40776)
@@ -74,82 +74,89 @@
     tmpline = strncreate (p, q - p);
     stripwhite (tmpline);
-    if (*tmpline) {
 
-      if (bufferPending) {
-	// flush old messages
-	ExpectMessage (server, 0.2, &message);
-	bufferPending = FALSE;
-      }
+    // empty command, free and continue
+    if (*tmpline == 0) {
+      free (tmpline);
+      p = q + 1;
+      continue;
+    }
 
-      status = command (tmpline, &outline, verbose);
+    if (bufferPending) {
+      // flush old messages
+      ExpectMessage (server, 0.2, &message);
+      bufferPending = FALSE;
+    }
 
-      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;
-	    }
+    // 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;
 	  }
+	}
 
-	  // 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 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);
+	// 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 {
-	  // 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;
+	  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;
+      }	
     }
+  escape:
+    if (outline != NULL) free (outline);
+    if (!status && auto_break) done = TRUE;
+
     p = q + 1;
   }
