diff tools.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.c	Sat Dec 06 05:41:29 1997 +0000
@@ -0,0 +1,59 @@
+/* $Id: tools.c,v 1.1.1.1 1997/12/06 05:41:31 darius Exp $ */
+
+/* tools.c - shell escape, graphic toolsw - 10/10/93
+ * 
+ * copyright 1993 Kurt Siegl <siegl@risc.uni-linz.ac.at> Free to use, hack, etc.
+ * Just keep these credits here. Use of this code may be dangerous to your
+ * health and/or system. Its use is at your own risk. I assume no
+ * responsibility for damages, real, potential, or imagined, resulting  from
+ * the use of it.
+ * 
+ */
+
+#ifdef TOOLS
+#include <stdio.h>
+#include "math.h"
+#include <signal.h>
+#include <sys/types.h>
+#include <strings.h>
+#include "Wlib.h"
+#include "defs.h"
+#include "struct.h"
+#include "data.h"
+
+void
+sendTools(str)
+char *str;
+{
+  char    pipebuf[100];
+  FILE   *pipefp;
+  int     len;
+
+  if (!W_IsMapped(toolsWin))
+    showToolsWin();
+  signal(SIGCHLD, SIG_DFL);
+  if (shelltools && (pipefp = popen(str, "r")) != NULL)
+    {
+      while (fgets(pipebuf, 80, pipefp) != NULL)
+	{
+	  len = strlen(pipebuf);
+	  if (pipebuf[len - 1] == '\n')
+	    pipebuf[len - 1] = '\0';
+	  W_WriteText(toolsWin, 0, 0, textColor, pipebuf,
+		      strlen(pipebuf), W_RegularFont);
+	}
+      pclose(pipefp);
+    }
+  else
+    W_WriteText(toolsWin, 0, 0, textColor, str, strlen(str), W_RegularFont);
+}
+
+showToolsWin()
+{
+  if (W_IsMapped(toolsWin))
+    W_UnmapWindow(toolsWin);
+  else
+    W_MapWindow(toolsWin);
+}
+
+#endif /* TOOLS */