annotate tools.c @ 3:5a977ccbc7a9 default tip

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