[project @ 2002-02-12 15:17:13 by simonmar]
[ghc-hetmet.git] / ghc / lib / std / cbits / system.c
diff --git a/ghc/lib/std/cbits/system.c b/ghc/lib/std/cbits/system.c
deleted file mode 100644 (file)
index 62f1360..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* 
- * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
- *
- * $Id: system.c,v 1.19 2001/09/17 17:23:32 sewardj Exp $
- *
- * system Runtime Support
- */
-
-/* The itimer stuff in this module is non-posix */
-/* #include "PosixSource.h" */
-
-#include "HsStd.h"
-
-#if defined(mingw32_TARGET_OS)
-#include <windows.h>
-#include <stdlib.h>
-#endif
-
-HsInt
-systemCmd(HsAddr cmd)
-{
-  /* -------------------- WINDOWS VERSION --------------------- */
-#if defined(mingw32_TARGET_OS)
-    return system(cmd);
-#else
-  /* -------------------- UNIX VERSION --------------------- */
-    int pid;
-    int wstat;
-
-    switch(pid = fork()) {
-    case -1:
-       if (errno != EINTR) {
-           return -1;
-       }
-    case 0:
-      {
-#ifdef HAVE_SETITIMER
-       /* Reset the itimers in the child, so it doesn't get plagued
-        * by SIGVTALRM interrupts.
-        */
-       struct timeval tv_null = { 0, 0 };
-       struct itimerval itv;
-       itv.it_interval = tv_null;
-       itv.it_value = tv_null;
-       setitimer(ITIMER_REAL, &itv, NULL);
-       setitimer(ITIMER_VIRTUAL, &itv, NULL);
-       setitimer(ITIMER_PROF, &itv, NULL);
-#endif
-
-       /* the child */
-       execl("/bin/sh", "sh", "-c", cmd, NULL);
-       _exit(127);
-      }
-    }
-
-    while (waitpid(pid, &wstat, 0) < 0) {
-       if (errno != EINTR) {
-           return -1;
-       }
-    }
-
-    if (WIFEXITED(wstat))
-       return WEXITSTATUS(wstat);
-    else if (WIFSIGNALED(wstat)) {
-       errno = EINTR;
-    }
-    else {
-       /* This should never happen */
-    }
-    return -1;
-#endif
-}