comparison tools.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
comparison
equal deleted inserted replaced
2:fba0b6e6cdc7 3:5a977ccbc7a9
1 /* $Id: tools.c,v 1.1.1.1 1997/12/06 05:41:31 darius Exp $ */
2
3 /* tools.c - shell escape, graphic toolsw - 10/10/93
4 *
5 * copyright 1993 Kurt Siegl <siegl@risc.uni-linz.ac.at> Free to use, hack, etc.
6 * Just keep these credits here. Use of this code may be dangerous to your
7 * health and/or system. Its use is at your own risk. I assume no
8 * responsibility for damages, real, potential, or imagined, resulting from
9 * the use of it.
10 *
11 */
12
13 #ifdef TOOLS
14 #include <stdio.h>
15 #include "math.h"
16 #include <signal.h>
17 #include <sys/types.h>
18 #include <strings.h>
19 #include "Wlib.h"
20 #include "defs.h"
21 #include "struct.h"
22 #include "data.h"
23
24 void
25 sendTools(str)
26 char *str;
27 {
28 char pipebuf[100];
29 FILE *pipefp;
30 int len;
31
32 if (!W_IsMapped(toolsWin))
33 showToolsWin();
34 signal(SIGCHLD, SIG_DFL);
35 if (shelltools && (pipefp = popen(str, "r")) != NULL)
36 {
37 while (fgets(pipebuf, 80, pipefp) != NULL)
38 {
39 len = strlen(pipebuf);
40 if (pipebuf[len - 1] == '\n')
41 pipebuf[len - 1] = '\0';
42 W_WriteText(toolsWin, 0, 0, textColor, pipebuf,
43 strlen(pipebuf), W_RegularFont);
44 }
45 pclose(pipefp);
46 }
47 else
48 W_WriteText(toolsWin, 0, 0, textColor, str, strlen(str), W_RegularFont);
49 }
50
51 showToolsWin()
52 {
53 if (W_IsMapped(toolsWin))
54 W_UnmapWindow(toolsWin);
55 else
56 W_MapWindow(toolsWin);
57 }
58
59 #endif /* TOOLS */