I am running NetBSD 1.1 for sparc at home. I wanted xxgdb, so I fetched
the 1.12 sources from ftp.x.org. Here are the changes I made to get
it to compile and work under NetBSD 1.1/sparc.
The problems amount to xxgdb sources believing that if BSD is #defined,
it has to use "struct sgttyb" stuff. Not so, for NetBSD - it uses
struct termios stuff. It's also missing the TCGETA/TCSETA ioctls,
too.
There was also some weirdness with the scrolling of the gdb input
window. It wouldn't scroll until a whole lot of gdb input/output text
had scrolled beyond the bottom of the window. I just un-ifdef'ed
someone else's hack to correct this.
diff -r -c xxgdb-1.12/calldbx.c netbsd.xxgdb-1.12/calldbx.c
*** xxgdb-1.12/calldbx.c Mon Jun 19 16:11:00 1995
--- netbsd.xxgdb-1.12/calldbx.c Tue Feb 27 19:21:41 1996
***************
*** 74,84 ****
--- 74,88 ----
#include <string.h>
#include <fcntl.h>
#include "global.h"
+ #ifdef __NetBSD__
+ #include <termios.h>
+ #else
#if !(defined(OLDSUNOS) || defined(BSD))
#include <termio.h>
#else
#include <sgtty.h>
#endif
+ #endif
#ifdef CREATE_IO_WINDOW
#include <sys/socket.h>
***************
*** 249,256 ****
--- 253,264 ----
#if !(defined(OLDSUNOS) || defined(BSD))
struct termio Termio;
#else
+ #ifdef __NetBSD__
+ struct termios Termio;
+ #else
struct sgttyb Termio;
#endif
+ #endif
int master; /* file descriptor of master pty */
int slave; /* file descriptor of slave pty */
#ifdef OLDBSD
***************
*** 361,370 ****
--- 369,387 ----
Termio.c_oflag &= ~ONLCR; /* Do not map NL to CR-NL on output */
ioctl(slave, TCSETA, &Termio);
#else
+
+ #ifdef __NetBSD__
+ tcgetattr(slave, &Termio);
+ Termio.c_lflag &= ~ECHO; /* No echo */
+ Termio.c_oflag &= ~ONLCR; /* Do not map NL to CR-NL on output */
+ tcsetattr(slave, TCSANOW, &Termio);
+ #else
ioctl(slave, TIOCGETP, &Termio);
Termio.sg_flags &= ~ECHO; /* No echo */
Termio.sg_flags &= ~CRMOD; /* Do not map NL to CR-NL on output */
ioctl(slave, TIOCSETP, &Termio);
+ #endif
+
#endif
dup2(slave, 0);
diff -r -c xxgdb-1.12/command.c netbsd.xxgdb-1.12/command.c
*** xxgdb-1.12/command.c Tue Nov 22 17:27:05 1994
--- netbsd.xxgdb-1.12/command.c Tue Feb 27 19:23:35 1996
***************
*** 386,392 ****
--- 386,396 ----
#ifdef SYSV
int status;
#else
+ #ifdef __NetBSD__
+ int status;
+ #else
union wait status;
+ #endif
#endif /* SYSV */
write_dbx("quit\n");
diff -r -c xxgdb-1.12/dialog.c netbsd.xxgdb-1.12/dialog.c
*** xxgdb-1.12/dialog.c Mon Jun 19 16:15:13 1995
--- netbsd.xxgdb-1.12/dialog.c Wed Feb 28 17:38:13 1996
***************
*** 391,397 ****
StartPos = TextGetLastPos(dialogWindow);
XawTextSetInsertionPoint(dialogWindow, StartPos);
! #if 0 /* no longer necessary I think */
/* fix annoying bug that dialog mark is sometimes scrolled off bottom (widget bug?) */
XawTextDisplay(dialogWindow);
#endif
--- 391,397 ----
StartPos = TextGetLastPos(dialogWindow);
XawTextSetInsertionPoint(dialogWindow, StartPos);
! #if 1 /* no longer necessary I think */
/* fix annoying bug that dialog mark is sometimes scrolled off bottom (widget bug?) */
XawTextDisplay(dialogWindow);
#endif
diff -r -c xxgdb-1.12/regex.c netbsd.xxgdb-1.12/regex.c
*** xxgdb-1.12/regex.c Wed Apr 19 10:58:00 1995
--- netbsd.xxgdb-1.12/regex.c Sun Feb 11 23:02:19 1996
***************
*** 123,129 ****
#include <assert.h>
#ifdef sparc
! #include <alloca.h>
#else
#pragma alloca
#endif
--- 123,129 ----
#include <assert.h>
#ifdef sparc
! /*#include <alloca.h>*/
#else
#pragma alloca
#endif
diff -r -c xxgdb-1.12/signals.c netbsd.xxgdb-1.12/signals.c
*** xxgdb-1.12/signals.c Thu Apr 6 10:25:04 1995
--- netbsd.xxgdb-1.12/signals.c Tue Feb 27 19:26:09 1996
***************
*** 96,102 ****
--- 96,106 ----
#ifdef SYSV
int status;
#else
+ #ifdef __NetBSD__
+ int status;
+ #else
union wait status;
+ #endif
#endif /* SYSV */
/* wait for the child to report its status; if the child has died,
diff -r -c xxgdb-1.12/xdbx.c netbsd.xxgdb-1.12/xdbx.c
*** xxgdb-1.12/xdbx.c Thu Apr 20 20:37:31 1995
--- netbsd.xxgdb-1.12/xdbx.c Tue Mar 12 22:27:00 1996
***************
*** 476,481 ****
--- 476,482 ----
toplevel = XtAppInitialize(&app_context, "XDbx", options, XtNumber(options),
&argc, argv, fallback_resources, NULL, 0);
+
if (argc > 3) Syntax(argv[0]);
XtGetApplicationResources(toplevel, &app_resources, resources,