Index: Environs.c
===================================================================
--- Environs.c	(revision 14071)
+++ Environs.c	(working copy)
@@ -161,6 +161,68 @@
   return EXIT_FAILURE;
 }
 
+/** (work in progress)  Attempt to mimic posix popen() system call in some usefull
+    way.  If string is a null pointer, an error is returned. If string is not a null
+    pointer, the system function passes the string pointed to by string to the
+    command processor to be executed in a manner which the implementation shall
+    document; this might then cause the program calling system to behave in a
+    non-conforming manner or to terminate.
+
+    @retval   NULL            An error occured.
+
+    @retval   FILE *          Handle to a file containing the stdout from the command.
+**/
+static char popen_cmd[256];
+static char popen_ofname[128];
+
+FILE *
+popen(const char *string, const char *type)
+{
+  EFI_STATUS  CmdStat;
+  EFI_STATUS  OpStat;
+  EFI_HANDLE  MyHandle = gImageHandle;
+  UINTN       i;
+
+  if( string == NULL || AsciiStrLen( string ) == 0 ){
+    errno = EINVAL;
+    return NULL;
+  }
+  tmpnam(popen_ofname);
+  AsciiStrCpy(popen_cmd, string);
+  AsciiStrCat(popen_cmd, " > ");
+  //i = AsciiStrLen(popen_cmd);
+  for (i = 0; popen_cmd[i]; i++) {
+    if (popen_cmd[i] == '/')
+      popen_cmd[i] = '\\';
+  }
+  for (i = 0; popen_ofname[i]; i++) {
+    if (popen_ofname[i] == '/')
+      popen_ofname[i] = '\\';
+  }
+  AsciiStrCat(popen_cmd, popen_ofname);
+  (void)AsciiStrToUnicodeStr( popen_cmd, gMD->UString);
+  OpStat = ShellExecute( &MyHandle, gMD->UString, TRUE, NULL, &CmdStat);
+  if(OpStat == RETURN_SUCCESS) {
+    EFIerrno = CmdStat;
+    errno = 0;
+  }
+  EFIerrno = OpStat;
+  errno = ENOENT;
+  //return NULL;
+
+  /* cheap and dirty way to get a file handle */
+  printf("++ popen: %s\n\n", popen_cmd);
+  return fopen(popen_ofname, "r");
+}
+
+int
+pclose (FILE *stream)
+{
+  fclose(stream);
+  //unlink(popen_ofname);
+  return 0;
+}
+
 /** The getenv function searches an environment list, provided by the host
     environment, for a string that matches the string pointed to by name.  The
     set of environment names and the method for altering the environment list
