Index: /trunk/Ohana/src/opihi/cmd.basic/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/Makefile	(revision 8188)
+++ /trunk/Ohana/src/opihi/cmd.basic/Makefile	(revision 8189)
@@ -47,4 +47,5 @@
 $(SDIR)/strlen.$(ARCH).o     \
 $(SDIR)/substr.$(ARCH).o     \
+$(SDIR)/strpop.$(ARCH).o     \
 $(SDIR)/usleep.$(ARCH).o     \
 $(SDIR)/sleep.$(ARCH).o	     \
Index: /trunk/Ohana/src/opihi/cmd.basic/init.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/init.c	(revision 8188)
+++ /trunk/Ohana/src/opihi/cmd.basic/init.c	(revision 8189)
@@ -31,4 +31,5 @@
 int strlen_func     PROTO((int, char **));
 int substr_func     PROTO((int, char **));
+int strpop          PROTO((int, char **));
 int wait_func  	    PROTO((int, char **));
 int which      	    PROTO((int, char **));
@@ -68,4 +69,5 @@
   {"strlen",        strlen_func,        "string length"},
   {"substr",        substr_func,        "substring"},
+  {"strpop",        strpop,             "pop a string"},
   {"wait",    	    wait_func,          "wait until return is typed"},
   {"which",   	    which,              "show command *"}
Index: /trunk/Ohana/src/opihi/cmd.basic/strpop.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/strpop.c	(revision 8189)
+++ /trunk/Ohana/src/opihi/cmd.basic/strpop.c	(revision 8189)
@@ -0,0 +1,35 @@
+# include "basic.h"
+
+int strpop (int argc, char **argv) {
+
+  char *p, *q, *string;
+
+  if ((argc != 2) && (argc != 3)) {
+    gprint (GP_ERR, "USAGE: strpop (var) [out]\n");
+    return (FALSE);
+  }
+
+  /* string is a copy of the value on the variable stack */
+  string = get_variable (argv[1]);
+  if (string == NULL) return (FALSE);
+  
+  /* thisword is an allocated string */
+  p = thisword (string);
+
+  q = nextword (string);
+  if (q == NULL) {
+    set_str_variable (argv[1], "NULL");
+  } else {
+    set_str_variable (argv[1], q);
+  }
+  
+  if (argc == 3) {
+    set_str_variable (argv[2], p);
+  } else {
+    gprint (GP_LOG, "%s\n", p);
+  }
+
+  free (p);
+  free (string);
+  return (TRUE);
+}
