Created
October 7, 2012 15:24
-
-
Save faried/3848655 to your computer and use it in GitHub Desktop.
a diff against xcalc from X11R3 to get it to compile on Ubuntu 12.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur xcalc/Imakefile xcalc-working/Imakefile | |
--- xcalc/Imakefile 1988-07-22 16:22:53.000000000 +0500 | |
+++ xcalc-working/Imakefile 2012-10-07 20:21:24.589409247 +0500 | |
@@ -1,8 +1,6 @@ | |
LOCAL_LIBRARIES = $(XLIB) | |
SYS_LIBRARIES = -lm | |
-#ifdef MacIIArchitecture | |
DEFINES = -DIEEE | |
-#endif /* MacIIArchitecture */ | |
SRCS = xcalc.c sr.c | |
OBJS = xcalc.o sr.o | |
diff -ur xcalc/sr.c xcalc-working/sr.c | |
--- xcalc/sr.c 1988-10-23 13:37:59.000000000 +0500 | |
+++ xcalc-working/sr.c 2012-10-07 20:18:38.641285787 +0500 | |
@@ -4,11 +4,12 @@ | |
#ifndef lint | |
static char *rcsid_sr_c = "$XConsortium: sr.c,v 1.10 88/10/22 10:37:58 jim Exp $"; | |
-#endif lint | |
+#endif /* lint */ | |
/* Slide Rule */ | |
#include <stdio.h> | |
+#include <stdlib.h> | |
#include <math.h> | |
#include <signal.h> | |
#include <X11/Xos.h> | |
@@ -51,8 +52,8 @@ | |
extern XFontStruct *kfontinfo; | |
Font scalefont, sscalefont; | |
extern Pixmap backgroundPix,regBorder,dimBorder,IconPix; | |
-Pixmap slidePix = NULL; | |
-Pixmap framePix = NULL; | |
+Pixmap slidePix = 0; | |
+Pixmap framePix = 0; | |
extern Cursor arrow; | |
GC sgc, cgc; | |
int height,scalelen,width,fheight,foffset; | |
@@ -269,7 +270,7 @@ | |
case NoExpose: | |
break; | |
default: | |
- printf("event type=%ld\n",event.type); | |
+ printf("event type=%d\n",event.type); | |
/* XSRError("Unexpected X_Event"); */ | |
} /* end of switch */ | |
@@ -309,11 +310,11 @@ | |
XResizeWindow(dpy, blackwid, width, SLIDEHIGH+2); | |
if (framePix) | |
XFreePixmap(dpy, framePix); | |
- framePix = NULL; | |
+ framePix = 0; | |
drawframe(); | |
if (slidePix) | |
XFreePixmap(dpy, slidePix); | |
- slidePix = NULL; | |
+ slidePix = 0; | |
drawslide(); | |
XMoveWindow(dpy, slidewid, xo, SLIDETOP); | |
drawnums(); | |
@@ -346,7 +347,7 @@ | |
char str[5]; | |
int midpt = scalelen/2; | |
- if (framePix == NULL) | |
+ if (framePix == 0) | |
framePix = XCreatePixmap (dpy, theWindow, width, HEIGHT, | |
DefaultDepth (dpy, DefaultScreen (dpy))); | |
XFillRectangle(dpy, framePix, cgc, 0, 0, width, HEIGHT); | |
@@ -465,7 +466,7 @@ | |
char str[5]; | |
int midpt = scalelen/2; | |
- if (slidePix == NULL) | |
+ if (slidePix == 0) | |
slidePix = XCreatePixmap (dpy, theWindow, width, SLIDEHIGH, | |
DefaultDepth (dpy, DefaultScreen (dpy))); | |
XFillRectangle(dpy, slidePix, cgc, 0, 0, width, SLIDEHIGH); | |
@@ -489,7 +490,7 @@ | |
{ | |
int i; | |
- if (slidePix != NULL) | |
+ if (slidePix != 0) | |
XCopyArea(dpy, slidePix, slidewid, sgc, 0, 0, scalelen + START + END, SLIDEHIGH, | |
0, 0); | |
else | |
@@ -499,7 +500,7 @@ | |
redrawframe(x, y, w, h) | |
int x,y,w,h; | |
{ | |
- if (framePix != NULL) | |
+ if (framePix != 0) | |
XCopyArea(dpy, framePix, theWindow, sgc, 0, 0, scalelen + START + END, HEIGHT, | |
0, 0); | |
else | |
diff -ur xcalc/xcalc.c xcalc-working/xcalc.c | |
--- xcalc/xcalc.c 1988-10-06 14:13:38.000000000 +0500 | |
+++ xcalc-working/xcalc.c 2012-10-07 20:20:07.955496608 +0500 | |
@@ -4,7 +4,7 @@ | |
#ifndef lint | |
static char *rcsid_xcalc_c = "$XConsortium: xcalc.c,v 1.23 88/10/05 11:13:33 jim Exp $"; | |
-#endif lint | |
+#endif /* lint */ | |
/* | |
* xcalc.c - a hand calculator for the X Window system | |
@@ -33,6 +33,8 @@ | |
*/ | |
#include <stdio.h> | |
+#include <stdlib.h> | |
+#include <errno.h> | |
#include <math.h> | |
#include <signal.h> | |
#include <X11/Xos.h> | |
@@ -44,7 +46,7 @@ | |
/* program icon */ | |
#include "icon" | |
-extern int errno; | |
+/* extern int errno; */ | |
/* constants used for setting up the calculator. changing them would | |
@@ -680,7 +682,7 @@ | |
break; | |
} | |
default: | |
- fprintf (stderr, "%s: unexpected event type %ld = 0x%lx\n", | |
+ fprintf (stderr, "%s: unexpected event type %d = 0x%d\n", | |
ProgramName, event.type, event.type); | |
break; | |
} /* end of switch */ | |
@@ -1668,7 +1670,9 @@ | |
#endif | |
/*******/ | |
-onalarm() | |
+void | |
+onalarm(ign) | |
+ int ign; | |
/*******/ | |
{ | |
timerdone=1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment