summaryrefslogtreecommitdiff
path: root/math/hexcalc/files/patch-hexcalc.c
blob: c071859b659f6a81c53cf80060370fd129dbde4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- hexcalc.c.orig	2011-05-13 08:28:24.000000000 +0800
+++ hexcalc.c	2011-05-13 08:32:09.000000000 +0800
@@ -37,6 +37,7 @@
 #endif	
 
 #include	<stdio.h>
+#include	<stdlib.h>
 #include	<ctype.h>
 #include	<X11/IntrinsicP.h>
 #include	<X11/StringDefs.h>
@@ -509,14 +510,16 @@
 
 		switch(topOp) {
 		case '+' :
-			ac = PopArg()  + PopArg();
+                        temp = PopArg();
+			ac = PopArg() + temp;
 			break;
 		case '-' :
 			temp = PopArg();
 			ac = PopArg() - temp;
 			break;
 		case '*' :
-			ac = PopArg()  * PopArg();
+                        temp = PopArg();
+			ac = temp * PopArg();
 			break;
 		case '/' :
 			temp = PopArg();
@@ -528,15 +531,18 @@
 			break;
 			
 		case '|' :
-			ac = PopArg() | PopArg();
+                        temp = PopArg();
+			ac = temp | PopArg();
 			break;
 
 		case '&' :
-			ac = PopArg() & PopArg();
+                        temp = PopArg();
+			ac = temp & PopArg();
 			break;
 
 		case '^' :
-			ac = PopArg() ^ PopArg();
+                        temp = PopArg();
+			ac = temp ^ PopArg();
 			break;
 
 		case '<' :