Index: trunk/Ohana/src/opihi/lib.shell/string.c
===================================================================
--- trunk/Ohana/src/opihi/lib.shell/string.c	(revision 37049)
+++ trunk/Ohana/src/opihi/lib.shell/string.c	(revision 40652)
@@ -114,4 +114,27 @@
 }
 
+/* take a pointer to the beginning of a variable (ie $foo)
+and extract only the variable name (eg, foo) */
+
+char *thisref (char *string) {
+
+  int i, start;
+  char *word;
+
+  if (string == (char *) NULL) return ((char *) NULL);
+  if (string[0] != '$') return ((char *) NULL);
+
+  /* special case $?name : check that name is valid */
+  start = 1;
+  if (string[1] == '?') start = 2;
+
+  for (i = start; ISREF(string[i]); i++);
+  if (i == start) return ((char *) NULL);
+
+  /* the ? is part of the variable */
+  word = strncreate (&string[1], i - 1);
+  return (word);
+
+}
 
 /**********************************************************************/
