brute-force fixing of ghostview for sparc64: add prototypes everywhere,

and don't pass abuse-cast int to XtPointer.

pval@ says it works.
This commit is contained in:
espie 2002-04-26 01:44:08 +00:00
parent a818d63366
commit 220c8232ff
15 changed files with 1217 additions and 24 deletions

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-Dir_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- Dir.c.orig Fri Apr 26 02:40:50 2002
+++ Dir.c Fri Apr 26 02:41:05 2002
@@ -25,6 +25,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#ifdef SEL_FILE_IGNORE_CASE
#include <ctype.h>

View File

@ -0,0 +1,298 @@
$OpenBSD: patch-Draw_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- Draw.c.orig Sat Jul 24 04:29:12 1993
+++ Draw.c Fri Apr 26 03:39:01 2002
@@ -30,6 +30,7 @@
#include <X11/StringDefs.h>
#include <X11/Xaw/Scrollbar.h>
#include <X11/Xaw/Cardinals.h>
+#include "gv.h"
#define SF_DEFAULT_FONT "9x15"
@@ -59,6 +60,8 @@ static int SFcurrentListY;
static XtIntervalId SFscrollTimerId;
+
+void
SFinitFont()
{
TextData *data;
@@ -86,6 +89,7 @@ SFinitFont()
SFcharHeight = SFcharAscent + SFfont->max_bounds.descent;
}
+void
SFcreateGC()
{
XGCValues gcValues;
@@ -151,6 +155,7 @@ SFcreateGC()
);
}
+void
SFclearList(n, doScroll)
int n;
int doScroll;
@@ -193,7 +198,7 @@ SFclearList(n, doScroll)
}
}
-static
+static void
SFdeleteEntry(dir, entry)
SFDir *dir;
SFEntry *entry;
@@ -244,7 +249,7 @@ SFdeleteEntry(dir, entry)
);
}
-static
+static void
SFwriteStatChar(name, last, statBuf)
char *name;
int last;
@@ -320,7 +325,7 @@ SFstatAndCheck(dir, entry)
return 0;
}
-static
+static void
SFdrawStrings(w, dir, from, to)
register Window w;
register SFDir *dir;
@@ -397,6 +402,7 @@ SFdrawStrings(w, dir, from, to)
}
}
+void
SFdrawList(n, doScroll)
int n;
int doScroll;
@@ -422,6 +428,7 @@ SFdrawList(n, doScroll)
}
}
+void
SFdrawLists(doScroll)
int doScroll;
{
@@ -432,7 +439,7 @@ SFdrawLists(doScroll)
}
}
-static
+static void
SFinvertEntry(n)
register int n;
{
@@ -486,19 +493,19 @@ SFscrollTimer(p, id)
int save;
int n;
- n = (int) p;
+ n = * ((int *) p);
dir = &(SFdirs[SFdirPtr + n]);
save = dir->vOrigin;
if (SFcurrentListY < SFlowerY) {
if (dir->vOrigin > 0) {
- SFvSliderMovedCallback(selFileVScrolls[n], n,
+ SFvSliderMovedCallback(selFileVScrolls[n], p,
dir->vOrigin - 1);
}
} else if (SFcurrentListY > SFupperY) {
if (dir->vOrigin < dir->nEntries - SFlistSize) {
- SFvSliderMovedCallback(selFileVScrolls[n], n,
+ SFvSliderMovedCallback(selFileVScrolls[n], p,
dir->vOrigin + 1);
}
}
@@ -516,18 +523,19 @@ SFscrollTimer(p, id)
if (SFbuttonPressed) {
SFscrollTimerId = XtAppAddTimeOut(SFapp,
- SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n);
+ SFscrollTimerInterval(), SFscrollTimer, (XtPointer) p);
}
}
static int
-SFnewInvertEntry(n, event)
- register int n;
+SFnewInvertEntry(k, event)
+ int *k;
register XMotionEvent *event;
{
register int x, y;
register int new;
static int SFscrollTimerAdded = 0;
+ int n = *k;
x = event->x;
y = event->y;
@@ -557,7 +565,7 @@ SFnewInvertEntry(n, event)
SFscrollTimerAdded = 1;
SFscrollTimerId = XtAppAddTimeOut(SFapp,
SFscrollTimerInterval(), SFscrollTimer,
- (XtPointer) n);
+ (XtPointer) k);
}
}
@@ -567,12 +575,13 @@ SFnewInvertEntry(n, event)
/* ARGSUSED */
void
-SFenterList(w, n, event)
+SFenterList(w, k, event)
Widget w;
- register int n;
+ int *k;
register XEnterWindowEvent *event;
{
register int new;
+ int n = *k;
/* sanity */
if (SFcurrentInvert[n] != -1) {
@@ -580,7 +589,7 @@ SFenterList(w, n, event)
SFcurrentInvert[n] = -1;
}
- new = SFnewInvertEntry(n, (XMotionEvent *) event);
+ new = SFnewInvertEntry(k, (XMotionEvent *) event);
if (new != -1) {
SFcurrentInvert[n] = new;
SFinvertEntry(n);
@@ -589,11 +598,12 @@ SFenterList(w, n, event)
/* ARGSUSED */
void
-SFleaveList(w, n, event)
+SFleaveList(w, k, event)
Widget w;
- register int n;
+ int *k;
XEvent *event;
{
+ int n = *k;
if (SFcurrentInvert[n] != -1) {
SFinvertEntry(n);
SFcurrentInvert[n] = -1;
@@ -602,14 +612,15 @@ SFleaveList(w, n, event)
/* ARGSUSED */
void
-SFmotionList(w, n, event)
+SFmotionList(w, k, event)
Widget w;
- register int n;
+ int *k;
register XMotionEvent *event;
{
register int new;
+ int n = *k;
- new = SFnewInvertEntry(n, event);
+ new = SFnewInvertEntry(k, event);
if (new != SFcurrentInvert[n]) {
if (SFcurrentInvert[n] != -1) {
@@ -626,12 +637,12 @@ SFmotionList(w, n, event)
void
SFvFloatSliderMovedCallback(w, n, fnew)
Widget w;
- int n;
+ int *n;
float *fnew;
{
int new;
- new = (*fnew) * SFdirs[SFdirPtr + n].nEntries;
+ new = (*fnew) * SFdirs[SFdirPtr + *n].nEntries;
SFvSliderMovedCallback(w, n, new);
}
@@ -640,14 +651,14 @@ SFvFloatSliderMovedCallback(w, n, fnew)
void
SFvSliderMovedCallback(w, n, new)
Widget w;
- int n;
+ int *n;
int new;
{
int old;
register Window win;
SFDir *dir;
- dir = &(SFdirs[SFdirPtr + n]);
+ dir = &(SFdirs[SFdirPtr + *n]);
old = dir->vOrigin;
dir->vOrigin = new;
@@ -656,7 +667,7 @@ SFvSliderMovedCallback(w, n, new)
return;
}
- win = XtWindow(selFileLists[n]);
+ win = XtWindow(selFileLists[*n]);
if (ABS(new - old) < SFlistSize) {
if (new > old) {
@@ -726,13 +737,13 @@ SFvSliderMovedCallback(w, n, new)
void
SFvAreaSelectedCallback(w, n, pnew)
Widget w;
- int n;
+ int *n;
int pnew;
{
SFDir *dir;
int new;
- dir = &(SFdirs[SFdirPtr + n]);
+ dir = &(SFdirs[SFdirPtr + *n]);
new = dir->vOrigin +
(((double) pnew) / SFvScrollHeight) * dir->nEntries;
@@ -765,33 +776,33 @@ SFvAreaSelectedCallback(w, n, pnew)
void
SFhSliderMovedCallback(w, n, new)
Widget w;
- int n;
+ int *n;
float *new;
{
SFDir *dir;
int save;
- dir = &(SFdirs[SFdirPtr + n]);
+ dir = &(SFdirs[SFdirPtr + *n]);
save = dir->hOrigin;
dir->hOrigin = (*new) * dir->nChars;
if (dir->hOrigin == save) {
return;
}
- SFdrawList(n, SF_DO_NOT_SCROLL);
+ SFdrawList(*n, SF_DO_NOT_SCROLL);
}
/* ARGSUSED */
void
SFhAreaSelectedCallback(w, n, pnew)
Widget w;
- int n;
+ int *n;
int pnew;
{
SFDir *dir;
int new;
- dir = &(SFdirs[SFdirPtr + n]);
+ dir = &(SFdirs[SFdirPtr + *n]);
new = dir->hOrigin +
(((double) pnew) / SFhScrollWidth) * dir->nChars;

View File

@ -0,0 +1,112 @@
$OpenBSD: patch-Ghostview_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- Ghostview.c.orig Sat Jul 24 04:29:12 1993
+++ Ghostview.c Fri Apr 26 02:49:35 2002
@@ -30,6 +30,9 @@
#include <X11/Xos.h>
#include "GhostviewP.h"
#include <ctype.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#ifndef XlibSpecificationRelease
typedef char *XPointer;
@@ -74,8 +77,8 @@ extern int errno;
#define GV_BUFSIZ 1024
#endif /* VMS */
-static void ComputeXdpi();
-static void ComputeYdpi();
+static void ComputeXdpi(Widget, int, XrmValue *);
+static void ComputeYdpi(Widget, int, XrmValue *);
static XtResource resources[] = {
#define offset(field) XtOffsetOf(GhostviewRec, ghostview.field)
@@ -131,27 +134,32 @@ static XtResource resources[] = {
#undef offset
};
-static void Message();
-static void Notify();
-static void Input();
-static void Output();
-
-static void ClassInitialize();
-static void ClassPartInitialize();
-static void Initialize();
-static void Realize();
-static void Destroy();
-static void Resize();
-static Boolean SetValues();
-static XtGeometryResult QueryGeometry();
-
-static void Layout();
-static Boolean ComputeSize();
-static void ChangeSize();
-static Boolean Setup();
-static void StartInterpreter();
-static void StopInterpreter();
-static void InterpreterFailed();
+static void Message(Widget, XEvent *, String *, Cardinal *);
+static void Notify(Widget, XEvent *, String *, Cardinal *);
+static void Input(XtPointer, int *, XtInputId *);
+static void Output(XtPointer, int *, XtInputId *);
+
+static void ClassInitialize(void);
+static void ClassPartInitialize(WidgetClass);
+static void Initialize(Widget, Widget, ArgList, Cardinal *);
+static void Realize(Widget, Mask *, XSetWindowAttributes *);
+static void Destroy(Widget);
+static void Resize(Widget);
+static Boolean SetValues(Widget, Widget, Widget);
+static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *, XtWidgetGeometry *);
+
+static void Layout(Widget, Boolean, Boolean);
+static Boolean ComputeSize(Widget, Boolean, Boolean, Dimension *, Dimension *);
+static void ChangeSize(Widget, Dimension, Dimension);
+static Boolean Setup(Widget);
+static void StartInterpreter(Widget);
+static void StopInterpreter(Widget);
+static void InterpreterFailed(Widget);
+
+Boolean XmuCvtStringToPageOrientation(Display *, XrmValue *, Cardinal *,
+ XrmValue *, XrmValue *, XtPointer *);
+Boolean XmuCvtStringToPalette(Display *, XrmValue *, Cardinal *,
+ XrmValue *, XrmValue *, XtPointer *);
static XtActionsRec actions[] =
{
@@ -1043,8 +1051,8 @@ Setup(w)
gvw->ghostview.gs_width = gvw->core.width;
gvw->ghostview.gs_height = gvw->core.height;
- sprintf(buf, "%d %d %d %d %d %d %g %g %d %d %d %d",
- bpixmap, gvw->ghostview.orientation,
+ sprintf(buf, "%ld %d %d %d %d %d %g %g %d %d %d %d",
+ (long)bpixmap, gvw->ghostview.orientation,
gvw->ghostview.llx, gvw->ghostview.lly,
gvw->ghostview.urx, gvw->ghostview.ury,
gvw->ghostview.xdpi, gvw->ghostview.ydpi,
@@ -1055,11 +1063,11 @@ Setup(w)
XA_STRING, 8, PropModeReplace,
(unsigned char *)buf, strlen(buf));
- sprintf(buf, "%s %d %d",
+ sprintf(buf, "%s %ld %ld",
gvw->ghostview.palette == XtPaletteMonochrome ? "Monochrome" :
gvw->ghostview.palette == XtPaletteGrayscale ? "Grayscale" :
gvw->ghostview.palette == XtPaletteColor ? "Color" : "?",
- gvw->ghostview.foreground, gvw->core.background_pixel);
+ (long)gvw->ghostview.foreground, (long)gvw->core.background_pixel);
XChangeProperty(XtDisplay(w), XtWindow(w),
XmuInternAtom(XtDisplay(w), gvc->ghostview_class.gv_colors),
XA_STRING, 8, PropModeReplace,
@@ -1168,7 +1176,7 @@ StartInterpreter(w)
close(std_out[1]);
dup2(std_err[1], 2);
close(std_err[1]);
- sprintf(buf, "%d", XtWindow(w));
+ sprintf(buf, "%ld", (long int)(XtWindow(w)));
setenv("GHOSTVIEW", buf, True);
setenv("DISPLAY", XDisplayString(XtDisplay(w)), True);
if (gvw->ghostview.filename == NULL) {

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-Imakefile,v 1.1 2002/04/26 01:44:08 espie Exp $
--- Imakefile.orig Sun Apr 21 01:00:06 2002
+++ Imakefile Sun Apr 21 01:01:44 2002
@@ -29,17 +29,17 @@ XCOMM FAX: (608)262-9777 M
#ifdef Use_SelFile
SRCS = main.c misc.c callbacks.c actions.c dialogs.c \
- Ghostview.c ps.c getenv.c setenv.c strcasecmp.c \
+ Ghostview.c ps.c \
SelFile.c Dir.c Path.c Draw.c
OBJS = main.o misc.o callbacks.o actions.o dialogs.o \
- Ghostview.o ps.o getenv.o setenv.o strcasecmp.o \
+ Ghostview.o ps.o \
SelFile.o Dir.o Path.o Draw.o
SELFILE_DEFINE = -DSELFILE
#else
SRCS = main.c misc.c callbacks.c actions.c dialogs.c \
- Ghostview.c ps.c getenv.c setenv.c strcasecmp.c
+ Ghostview.c ps.c strcasecmp.c
OBJS = main.o misc.o callbacks.o actions.o dialogs.o \
- Ghostview.o ps.o getenv.o setenv.o strcasecmp.o
+ Ghostview.o ps.o strcasecmp.o
SELFILE_DEFINE =
#endif

View File

@ -0,0 +1,132 @@
$OpenBSD: patch-Path_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- Path.c.orig Sat Jul 24 04:29:12 1993
+++ Path.c Fri Apr 26 02:16:03 2002
@@ -25,6 +25,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#ifdef SEL_FILE_IGNORE_CASE
#include <ctype.h>
@@ -35,6 +36,7 @@
#include "SFinternal.h"
#include "xstat.h"
#include <X11/Xaw/Scrollbar.h>
+#include "gv.h"
#if defined(SVR4) || defined(SYSV) || defined(USG)
extern uid_t getuid();
@@ -82,7 +84,7 @@ SFchdir(path)
return result;
}
-static
+static void
SFfree(i)
int i;
{
@@ -105,7 +107,7 @@ SFfree(i)
dir->dir = NULL;
}
-static
+static void
SFstrdup(s1, s2)
char **s1;
char *s2;
@@ -113,7 +115,7 @@ SFstrdup(s1, s2)
*s1 = strcpy(XtMalloc((unsigned) (strlen(s2) + 1)), s2);
}
-static
+static void
SFunreadableDir(dir)
SFDir *dir;
{
@@ -128,7 +130,7 @@ SFunreadableDir(dir)
}
#ifdef SEL_FILE_IGNORE_CASE
-static
+static int
SFstrncmp(p, q, n)
register char *p, *q;
register int n;
@@ -172,7 +174,7 @@ SFstrncmp(p, q, n)
}
#endif /* def SEL_FILE_IGNORE_CASE */
-static
+static void
SFreplaceText(dir, str)
SFDir *dir;
char *str;
@@ -356,7 +358,7 @@ SFfindFile(dir, str)
return 0;
}
-static
+static void
SFunselect()
{
SFDir *dir;
@@ -376,7 +378,7 @@ SFcompareLogins(p, q)
return strcmp(p->name, q->name);
}
-static
+static void
SFgetHomeDirs()
{
struct passwd *pw;
@@ -483,6 +485,7 @@ SFfindHomeDir(begin, end)
return 0;
}
+void
SFupdatePath()
{
static int alloc;
@@ -672,6 +675,7 @@ SFupdatePath()
}
}
+void
SFsetText(path)
char *path;
{
@@ -690,7 +694,7 @@ SFsetText(path)
void
SFbuttonPressList(w, n, event)
Widget w;
- int n;
+ int *n;
XButtonPressedEvent *event;
{
SFbuttonPressed = 1;
@@ -698,12 +702,13 @@ SFbuttonPressList(w, n, event)
/* ARGSUSED */
void
-SFbuttonReleaseList(w, n, event)
+SFbuttonReleaseList(w, k, event)
Widget w;
- int n;
+ int *k;
XButtonReleasedEvent *event;
{
SFDir *dir;
+ int n = *k;
SFbuttonPressed = 0;
@@ -717,7 +722,7 @@ SFbuttonReleaseList(w, n, event)
dir,
dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown
);
- SFmotionList(w, n, event);
+ SFmotionList(w, k, event);
}
}

View File

@ -0,0 +1,64 @@
$OpenBSD: patch-SFinternal_h,v 1.1 2002/04/26 01:44:08 espie Exp $
--- SFinternal.h.orig Wed Apr 15 16:15:45 1992
+++ SFinternal.h Fri Apr 26 02:41:41 2002
@@ -91,20 +91,20 @@ extern XSegment SFsegs[], SFcompletionSe
extern XawTextPosition SFtextPos;
extern void
- SFenterList(),
- SFleaveList(),
- SFmotionList(),
- SFbuttonPressList(),
- SFbuttonReleaseList();
+ SFenterList(Widget, int *, register XEnterWindowEvent *),
+ SFleaveList(Widget, int *, XEvent *),
+ SFmotionList(Widget, int *, XMotionEvent *),
+ SFbuttonPressList(Widget, int *, XButtonPressedEvent *),
+ SFbuttonReleaseList(Widget, int *, XButtonReleasedEvent *);
extern void
- SFvSliderMovedCallback(),
- SFvFloatSliderMovedCallback(),
- SFhSliderMovedCallback(),
- SFpathSliderMovedCallback(),
- SFvAreaSelectedCallback(),
- SFhAreaSelectedCallback(),
- SFpathAreaSelectedCallback();
+ SFvSliderMovedCallback(Widget, int *, int),
+ SFvFloatSliderMovedCallback(Widget, int *, float *),
+ SFhSliderMovedCallback(Widget, int *, float *),
+ SFpathSliderMovedCallback(Widget, XtPointer, float *),
+ SFvAreaSelectedCallback(Widget, int *, int),
+ SFhAreaSelectedCallback(Widget, int *, int),
+ SFpathAreaSelectedCallback(Widget, XtPointer, int);
extern int SFupperX, SFlowerY, SFupperY;
@@ -124,7 +124,7 @@ extern int SFcurrentInvert[];
extern int SFworkProcAdded;
-extern Boolean SFworkProc();
+extern Boolean SFworkProc(void);
extern XtAppContext SFapp;
@@ -134,12 +134,15 @@ extern char SFtextBuffer[];
extern int SFbuttonPressed;
-extern int SFcompareEntries();
+extern int SFcompareEntries(SFEntry *, SFEntry *);
-extern void SFdirModTimer();
+extern void SFdirModTimer(XtPointer, XtIntervalId *);
-extern char SFstatChar();
+struct stat;
+extern char SFstatChar(struct stat *);
extern XtIntervalId SFdirModTimerId;
extern int (*SFfunc)();
+
+extern int SFgetDir(SFDir *);

View File

@ -0,0 +1,121 @@
$OpenBSD: patch-SelFile_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- SelFile.c.orig Sat Jul 24 04:29:12 1993
+++ SelFile.c Fri Apr 26 02:40:34 2002
@@ -46,7 +46,6 @@
/* BSD 4.3 errno.h does not declare errno */
extern int errno;
extern int sys_nerr;
-extern char *sys_errlist[];
#include <sys/param.h>
#include <X11/cursorfont.h>
@@ -61,6 +60,7 @@ extern char *sys_errlist[];
#include <X11/Xaw/Cardinals.h>
#include "SFinternal.h"
+#include "gv.h"
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
@@ -127,6 +127,11 @@ char SFtextBuffer[MAXPATHLEN];
XtIntervalId SFdirModTimerId;
+void SFpositionWidget(Widget);
+FILE *SFopenFile(char *, char *, char *, char *);
+FILE *XsraSelFile(Widget, char *, char *, char *, char *, char *, char *,
+ int (*)(), char **);
+
int (*SFfunc)();
static char *oneLineTextEditTranslations = "\
@@ -146,7 +151,7 @@ SFexposeList(w, n, event, cont)
return;
}
- SFdrawList(n, SF_DO_NOT_SCROLL);
+ SFdrawList(*((int *)n), SF_DO_NOT_SCROLL);
}
/* ARGSUSED */
@@ -407,7 +412,10 @@ SFcreateWidgets(toplevel, prompt, ok, ca
compositeWidgetClass, selFileForm, arglist, i);
for (n = 0; n < 3; n++) {
+ int *box;
+ box = XtNew(int);
+ *box = n;
i = 0;
XtSetArg(arglist[i], XtNx, vScrollX); i++;
XtSetArg(arglist[i], XtNy, vScrollY); i++;
@@ -418,9 +426,9 @@ SFcreateWidgets(toplevel, prompt, ok, ca
scrollbarWidgetClass, selFileLists[n], arglist, i);
XtAddCallback(selFileVScrolls[n], XtNjumpProc,
- SFvFloatSliderMovedCallback, (XtPointer) n);
+ SFvFloatSliderMovedCallback, (XtPointer) box);
XtAddCallback(selFileVScrolls[n], XtNscrollProc,
- SFvAreaSelectedCallback, (XtPointer) n);
+ SFvAreaSelectedCallback, (XtPointer) box);
i = 0;
@@ -435,9 +443,9 @@ SFcreateWidgets(toplevel, prompt, ok, ca
scrollbarWidgetClass, selFileLists[n], arglist, i);
XtAddCallback(selFileHScrolls[n], XtNjumpProc,
- SFhSliderMovedCallback, (XtPointer) n);
+ SFhSliderMovedCallback, (XtPointer) box);
XtAddCallback(selFileHScrolls[n], XtNscrollProc,
- SFhAreaSelectedCallback, (XtPointer) n);
+ SFhAreaSelectedCallback, (XtPointer) box);
}
i = 0;
@@ -495,18 +503,22 @@ SFcreateWidgets(toplevel, prompt, ok, ca
XDefineCursor(SFdisplay, XtWindow(selFileCancel), dotCursor);
for (n = 0; n < 3; n++) {
+ int *box;
+
+ box = XtNew(int);
+ *box = n;
XtAddEventHandler(selFileLists[n], ExposureMask, True,
- SFexposeList, (XtPointer) n);
+ SFexposeList, (XtPointer) box);
XtAddEventHandler(selFileLists[n], EnterWindowMask, False,
- SFenterList, (XtPointer) n);
+ SFenterList, (XtPointer) box);
XtAddEventHandler(selFileLists[n], LeaveWindowMask, False,
- SFleaveList, (XtPointer) n);
+ SFleaveList, (XtPointer) box);
XtAddEventHandler(selFileLists[n], PointerMotionMask, False,
- SFmotionList, (XtPointer) n);
+ SFmotionList, (XtPointer) box);
XtAddEventHandler(selFileLists[n], ButtonPressMask, False,
- SFbuttonPressList, (XtPointer) n);
+ SFbuttonPressList, (XtPointer) box);
XtAddEventHandler(selFileLists[n], ButtonReleaseMask, False,
- SFbuttonReleaseList, (XtPointer) n);
+ SFbuttonReleaseList, (XtPointer) box);
}
XtAddEventHandler(selFileField, KeyPressMask, False,
@@ -588,6 +600,7 @@ SFopenFile(name, mode, prompt, failed)
return fp;
}
+void
SFtextChanged()
{
@@ -617,7 +630,7 @@ SFgetText()
SFtextBuffer);
}
-static
+static void
SFprepareToReturn()
{
SFstatus = SEL_FILE_NULL;

View File

@ -1,12 +0,0 @@
*** misc.c.orig Fri Oct 21 22:36:09 1994
--- misc.c Fri Oct 21 22:36:20 1994
***************
*** 61,67 ****
#include <perror.h>
#else
extern int sys_nerr;
- extern char *sys_errlist[];
#endif
#include "Ghostview.h"
--- 61,66 ----

View File

@ -1,12 +0,0 @@
*** SelFile.c.orig Fri Oct 21 22:37:11 1994
--- SelFile.c Fri Oct 21 22:37:17 1994
***************
*** 46,52 ****
/* BSD 4.3 errno.h does not declare errno */
extern int errno;
extern int sys_nerr;
- extern char *sys_errlist[];
#include <sys/param.h>
#include <X11/cursorfont.h>
--- 46,51 ----

View File

@ -0,0 +1,102 @@
$OpenBSD: patch-actions_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- actions.c.orig Thu Oct 1 22:10:08 1992
+++ actions.c Sun Apr 21 01:21:56 2002
@@ -27,9 +27,15 @@
#include <X11/StringDefs.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Scrollbar.h>
+#include <stdlib.h>
#include "gv.h"
#include "ps.h"
+int OPEN_ACTION = OPEN;
+int SAVE_ACTION = SAVE;
+int PRINT_WHOLE_ACTION = PRINT_WHOLE;
+int PRINT_MARKED_ACTION = PRINT_MARKED;
+
/* Popup the copyright window */
void
gv_copyright(w, event, params, num_params)
@@ -60,7 +66,7 @@ gv_open(w, event, params, num_params)
String *params;
Cardinal *num_params;
{
- popup_dialog(w, (XtPointer)OPEN, NULL);
+ popup_dialog(w, (XtPointer)&OPEN_ACTION, NULL);
}
/* Popup the open file dialog box. */
@@ -84,7 +90,7 @@ gv_save(w, event, params, num_params)
Cardinal *num_params;
{
if (!XtIsSensitive(savebutton)) return;
- popup_dialog(w, (XtPointer)SAVE, NULL);
+ popup_dialog(w, (XtPointer)&SAVE_ACTION, NULL);
}
/* Popup the print file dialog box. */
@@ -96,7 +102,7 @@ gv_print_whole(w, event, params, num_par
Cardinal *num_params;
{
if (!XtIsSensitive(printwholebutton)) return;
- popup_dialog(w, (XtPointer)PRINT_WHOLE, NULL);
+ popup_dialog(w, (XtPointer)&PRINT_WHOLE_ACTION, NULL);
}
/* Popup the print file dialog box. */
@@ -108,7 +114,7 @@ gv_print_marked(w, event, params, num_pa
Cardinal *num_params;
{
if (!XtIsSensitive(printmarkedbutton)) return;
- popup_dialog(w, (XtPointer)PRINT_MARKED, NULL);
+ popup_dialog(w, (XtPointer)&PRINT_MARKED_ACTION, NULL);
}
/* Call the prev_page callback */
@@ -196,7 +202,7 @@ gv_set_magstep(w, event, params, num_par
if (*num_params < 1) return;
i = atoi(params[0]);
- set_magstep(w, (XtPointer)i, NULL);
+ set_magstep(w, (XtPointer)&i, NULL);
}
/* Increment the magstep and
@@ -212,7 +218,7 @@ gv_increase_magstep(w, event, params, nu
i = app_res.magstep + 1;
if (i <= app_res.maximum_magstep)
- set_magstep(w, (XtPointer)i, NULL);
+ set_magstep(w, (XtPointer)&i, NULL);
}
/* Decrement the magstep and
@@ -228,7 +234,7 @@ gv_decrease_magstep(w, event, params, nu
i = app_res.magstep - 1;
if (i >= app_res.minimum_magstep)
- set_magstep(w, (XtPointer)i, NULL);
+ set_magstep(w, (XtPointer)&i, NULL);
}
/* Set orientation action routine. Converts text parameter
@@ -284,7 +290,7 @@ gv_set_pagemedia(w, event, params, num_p
if (doc && doc->nummedia) {
for (i = 0; i < doc->nummedia; i++) {
if (!strcmp(params[0], doc->media[i].name)) {
- set_pagemedia(w, (XtPointer)i, NULL);
+ set_pagemedia(w, (XtPointer)&i, NULL);
break;
}
}
@@ -293,7 +299,9 @@ gv_set_pagemedia(w, event, params, num_p
/* Then check the standard ones */
for (i = 0; papersizes[i].name; i++) {
if (!strcmp(params[0], papersizes[i].name)) {
- set_pagemedia(w, (XtPointer)(base_papersize+i), NULL);
+ int n;
+ n = base_papersize+i;
+ set_pagemedia(w, (XtPointer)&n, NULL);
break;
}
}

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-callbacks_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- callbacks.c.orig Sun Apr 21 00:44:47 2002
+++ callbacks.c Sun Apr 21 00:54:26 2002
@@ -96,7 +96,7 @@ popup_dialog(w, client_data, call_data)
}
#endif
- mode = (int) client_data;
+ mode = * ((int *) client_data);
switch (mode) {
case PRINT_WHOLE:
case PRINT_MARKED:
@@ -317,7 +317,7 @@ set_magstep(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
{
- app_res.magstep = (int)client_data;
+ app_res.magstep = * ((int *)client_data);
if (set_new_magstep()) {
layout_ghostview();
show_page(current_page);
@@ -375,7 +375,7 @@ set_pagemedia(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
{
- int new_pagemedia = (int) client_data;
+ int new_pagemedia = * ((int *)client_data);
if (new_pagemedia >= base_papersize) {
default_pagemedia = new_pagemedia;
app_res.force_pagemedia = force_setting;

View File

@ -0,0 +1,176 @@
$OpenBSD: patch-gv_h,v 1.1 2002/04/26 01:44:08 espie Exp $
--- gv.h.orig Sat Jul 24 04:29:12 1993
+++ gv.h Fri Apr 26 02:30:41 2002
@@ -166,81 +166,100 @@ extern Widget dialogpopup;
extern Widget dialog;
/* Dialogs */
-extern Widget CreateDialog();
-extern String GetDialogPrompt();
-extern void SetDialogPrompt();
-extern String GetDialogResponse();
-extern void SetDialogResponse();
-extern void ClearDialogResponse();
+extern Widget CreateDialog(Widget, String, XtCallbackProc, XtCallbackProc);
+extern String GetDialogPrompt(Widget);
+extern void SetDialogPrompt(Widget, String);
+extern String GetDialogResponse(Widget);
+extern void SetDialogResponse(Widget, String);
+extern void ClearDialogResponse(Widget);
/* Callbacks */
-extern void quit_ghostview();
-extern void popup();
-extern void popup_dialog();
-extern void reopen_file();
-extern void prev_page();
-extern void this_page();
-extern void next_page();
-extern void center_page();
-extern void mark_page();
-extern void unmark_page();
-extern void set_magstep();
-extern void set_orientation();
-extern void swap_landscape();
-extern void set_pagemedia();
-extern void track_and_zoom();
-extern void message();
-extern void output();
-extern void okay();
-extern void dismiss();
-extern void destroy();
-extern void destroy_ghost();
+extern void quit_ghostview(Widget, XtPointer, XtPointer);
+extern void popup(Widget, XtPointer, XtPointer);
+extern void popup_dialog(Widget, XtPointer, XtPointer);
+extern void reopen_file(Widget, XtPointer, XtPointer);
+extern void prev_page(Widget, XtPointer, XtPointer);
+extern void this_page(Widget, XtPointer, XtPointer);
+extern void next_page(Widget, XtPointer, XtPointer);
+extern void center_page(Widget, XtPointer, XtPointer);
+extern void mark_page(Widget, XtPointer, XtPointer);
+extern void unmark_page(Widget, XtPointer, XtPointer);
+extern void set_magstep(Widget, XtPointer, XtPointer);
+extern void set_orientation(Widget, XtPointer, XtPointer);
+extern void swap_landscape(Widget, XtPointer, XtPointer);
+extern void set_pagemedia(Widget, XtPointer, XtPointer);
+extern void track_and_zoom(Widget, XtPointer, XtPointer);
+extern void message(Widget, XtPointer, XtPointer);
+extern void output(Widget, XtPointer, XtPointer);
+extern void okay(Widget, XtPointer, XtPointer);
+extern void dismiss(Widget, XtPointer, XtPointer);
+extern void destroy(Widget, XtPointer, XtPointer);
+extern void destroy_ghost(Widget, XtPointer, XtPointer);
/* Actions */
-extern void gv_copyright();
-extern void gv_quit();
-extern void gv_open();
-extern void gv_reopen();
-extern void gv_save();
-extern void gv_print_whole();
-extern void gv_print_marked();
-extern void gv_prev();
-extern void gv_show();
-extern void gv_next();
-extern void gv_center();
-extern void gv_mark();
-extern void gv_unmark();
-extern void gv_set_magstep();
-extern void gv_increase_magstep();
-extern void gv_decrease_magstep();
-extern void gv_set_orientation();
-extern void gv_swap_landscape();
-extern void gv_set_pagemedia();
-extern void gv_default();
-extern void gv_force();
-extern void gv_delete_window();
-extern void gv_delete_zoom();
-extern void gv_dismiss();
-extern void gv_scroll_up();
-extern void gv_scroll_down();
-extern void gv_scroll_left();
-extern void gv_scroll_right();
-extern void gv_erase_locator();
-extern void gv_check_file();
+extern void gv_copyright(Widget, XEvent *, String *, Cardinal *);
+extern void gv_quit(Widget, XEvent *, String *, Cardinal *);
+extern void gv_open(Widget, XEvent *, String *, Cardinal *);
+extern void gv_reopen(Widget, XEvent *, String *, Cardinal *);
+extern void gv_save(Widget, XEvent *, String *, Cardinal *);
+extern void gv_print_whole(Widget, XEvent *, String *, Cardinal *);
+extern void gv_print_marked(Widget, XEvent *, String *, Cardinal *);
+extern void gv_prev(Widget, XEvent *, String *, Cardinal *);
+extern void gv_show(Widget, XEvent *, String *, Cardinal *);
+extern void gv_next(Widget, XEvent *, String *, Cardinal *);
+extern void gv_center(Widget, XEvent *, String *, Cardinal *);
+extern void gv_mark(Widget, XEvent *, String *, Cardinal *);
+extern void gv_unmark(Widget, XEvent *, String *, Cardinal *);
+extern void gv_set_magstep(Widget, XEvent *, String *, Cardinal *);
+extern void gv_increase_magstep(Widget, XEvent *, String *, Cardinal *);
+extern void gv_decrease_magstep(Widget, XEvent *, String *, Cardinal *);
+extern void gv_set_orientation(Widget, XEvent *, String *, Cardinal *);
+extern void gv_swap_landscape(Widget, XEvent *, String *, Cardinal *);
+extern void gv_set_pagemedia(Widget, XEvent *, String *, Cardinal *);
+extern void gv_default(Widget, XEvent *, String *, Cardinal *);
+extern void gv_force(Widget, XEvent *, String *, Cardinal *);
+extern void gv_delete_window(Widget, XEvent *, String *, Cardinal *);
+extern void gv_delete_zoom(Widget, XEvent *, String *, Cardinal *);
+extern void gv_dismiss(Widget, XEvent *, String *, Cardinal *);
+extern void gv_scroll_up(Widget, XEvent *, String *, Cardinal *);
+extern void gv_scroll_down(Widget, XEvent *, String *, Cardinal *);
+extern void gv_scroll_left(Widget, XEvent *, String *, Cardinal *);
+extern void gv_scroll_right(Widget, XEvent *, String *, Cardinal *);
+extern void gv_erase_locator(Widget, XEvent *, String *, Cardinal *);
+extern void gv_check_file(Widget, XEvent *, String *, Cardinal *);
/* Misc */
-extern void show_page();
-extern Boolean setup_ghostview();
-extern void layout_ghostview();
-extern void magnify();
-extern String open_file();
-extern String save_file();
-extern String print_file();
-extern void pscopydoc();
-extern void positionpopup();
-extern Boolean set_new_magstep();
-extern Boolean set_new_orientation();
-extern Boolean set_new_pagemedia();
-extern void build_pagemedia_menu();
-extern Widget build_label_menu();
-extern void new_file();
+extern void show_page(int);
+extern Boolean setup_ghostview(void);
+extern void layout_ghostview(void);
+extern void magnify(float *, int);
+extern String open_file(String);
+extern String save_file(String);
+extern String print_file(String, Boolean);
+extern void pscopydoc(FILE *);
+extern void positionpopup(Widget);
+extern Boolean set_new_magstep(void);
+extern Boolean set_new_orientation(int);
+extern Boolean set_new_pagemedia(int);
+extern void build_pagemedia_menu(void);
+extern Widget build_label_menu(Widget, String, String, Pixmap);
+extern void new_file(int);
+extern int find_page(String);
+extern int catch_Xerror(Display *, XErrorEvent *);
+
+/* Path */
+extern int SFchdir(char *);
+extern void SFupdatePath(void);
+extern void SFsetText(char *);
+extern int SFchdir(char *);
+
+/* Draw */
+extern void SFdrawList(int, int);
+extern void SFinitFont(void);
+extern void SFcreateGC(void);
+extern void SFdrawLists(int);
+extern void SFclearList(int, int);
+
+/* SelFile */
+extern void SFtextChanged(void);
+

View File

@ -0,0 +1,62 @@
$OpenBSD: patch-main_c,v 1.1 2002/04/26 01:44:08 espie Exp $
--- main.c.orig Sat Jul 24 04:29:12 1993
+++ main.c Sun Apr 21 01:04:00 2002
@@ -53,6 +53,11 @@
#include "gv.h"
#include "ps.h"
+extern int OPEN_ACTION;
+extern int SAVE_ACTION;
+extern int PRINT_WHOLE_ACTION;
+extern int PRINT_MARKED_ACTION;
+
extern char *getenv();
static String version = "Ghostview, version 1.5";
@@ -623,7 +628,7 @@ char *argv[];
openbutton = XtCreateManagedWidget("open", smeBSBObjectClass,
filemenu, NULL, ZERO);
- XtAddCallback(openbutton, XtNcallback, popup_dialog, (XtPointer)OPEN);
+ XtAddCallback(openbutton, XtNcallback, popup_dialog, (XtPointer)&OPEN_ACTION);
reopenbutton = XtCreateManagedWidget("reopen", smeBSBObjectClass,
filemenu, NULL, ZERO);
@@ -632,16 +637,16 @@ char *argv[];
printwholebutton = XtCreateManagedWidget("printwhole", smeBSBObjectClass,
filemenu, NULL, ZERO);
XtAddCallback(printwholebutton, XtNcallback, popup_dialog,
- (XtPointer)PRINT_WHOLE);
+ (XtPointer)&PRINT_WHOLE_ACTION);
printmarkedbutton = XtCreateManagedWidget("printmarked", smeBSBObjectClass,
filemenu, NULL, ZERO);
XtAddCallback(printmarkedbutton, XtNcallback, popup_dialog,
- (XtPointer)PRINT_MARKED);
+ (XtPointer)&PRINT_MARKED_ACTION);
savebutton = XtCreateManagedWidget("save", smeBSBObjectClass,
filemenu, NULL, ZERO);
- XtAddCallback(savebutton, XtNcallback, popup_dialog, (XtPointer)SAVE);
+ XtAddCallback(savebutton, XtNcallback, popup_dialog, (XtPointer)&SAVE_ACTION);
line = XtCreateManagedWidget("line", smeLineObjectClass,
filemenu, NULL, ZERO);
@@ -706,12 +711,16 @@ char *argv[];
XtSetArg(args[0], XtNleftMargin, 20);
for (i = app_res.minimum_magstep; i <= app_res.maximum_magstep; i++) {
char buf[16];
+ int *box;
+
sprintf(buf, "%d", i);
magstepentry[i-app_res.minimum_magstep] =
XtCreateManagedWidget(buf, smeBSBObjectClass,
magstepmenu, args, 1);
+ box = XtNew(int);
+ *box = i;
XtAddCallback(magstepentry[i-app_res.minimum_magstep], XtNcallback,
- set_magstep, (XtPointer)i);
+ set_magstep, (XtPointer)box);
}
XtSetArg(args[0], XtNresize, False);

View File

@ -0,0 +1,58 @@
$OpenBSD: patch-misc_c,v 1.1 2002/04/26 01:44:09 espie Exp $
--- misc.c.orig Sat Jul 24 04:29:12 1993
+++ misc.c Sun Apr 21 01:20:42 2002
@@ -24,6 +24,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
@@ -61,7 +62,6 @@ extern int errno;
#include <perror.h>
#else
extern int sys_nerr;
-extern char *sys_errlist[];
#endif
#include "Ghostview.h"
@@ -1212,13 +1212,16 @@ build_pagemedia_menu()
if (doc && doc->nummedia) {
for (i = 0; i < doc->nummedia; i++) {
+ int *box;
num_args = 0;
XtSetArg(args[num_args], XtNleftMargin, 20); num_args++;
pagemediaentry[i] = XtCreateManagedWidget(doc->media[i].name,
smeBSBObjectClass, pagemediamenu,
args, num_args);
+ box = XtNew(int);
+ *box = i;
XtAddCallback(pagemediaentry[i], XtNcallback,
- set_pagemedia, (XtPointer)i);
+ set_pagemedia, (XtPointer)box);
}
num_args = 0;
@@ -1227,6 +1230,8 @@ build_pagemedia_menu()
}
for (i = 0; papersizes[i].name; i++) {
+ int *box;
+
pagemediaentry[i+base_papersize] = NULL;
if (i > 0) {
/* Skip over same paper size with small imageable area */
@@ -1241,8 +1246,10 @@ build_pagemedia_menu()
papersizes[i].name,
smeBSBObjectClass, pagemediamenu,
args, num_args);
+ box = XtNew(int);
+ *box = i+base_papersize;
XtAddCallback(pagemediaentry[i+base_papersize], XtNcallback,
- set_pagemedia, (XtPointer)(i+base_papersize));
+ set_pagemedia, (XtPointer)box);
}
}

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-ps_c,v 1.1 2002/04/26 01:44:09 espie Exp $
--- ps.c.orig Sun Jul 11 18:10:18 1993
+++ ps.c Fri Apr 26 02:38:33 2002
@@ -24,6 +24,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
@@ -67,10 +68,10 @@ struct documentmedia papersizes[] = {
};
-static char *readline();
-static char *gettextline();
-static char *gettext();
-static int blank();
+static char *readline(char *, int, FILE *, long *, unsigned int *);
+static char *gettextline(char *);
+static char *gettext(char *, char **);
+static int blank(char *);
/*
* psscan -- scan the PostScript file for document structuring comments.