--- ./datadpy.c Fri Aug 24 03:26:29 1990 +++ ../src/./datadpy.c Tue May 9 14:40:36 2000 @@ -90,7 +90,7 @@ while (*p) { if (*p++ == '\n') { if (line == nlines) { /* buffer full, need more memory */ - dataDpy->linepos = (XawTextPosition *)XtRealloc(dataDpy->linepos, + dataDpy->linepos = (XawTextPosition *)XtRealloc((char *)dataDpy->linepos, (nlines + ADD_LINES) * sizeof(XawTextPosition)); nlines += ADD_LINES; } @@ -103,7 +103,7 @@ dataDpy->maxLineLength = max; /* shrink to min size */ dataDpy->linepos = (XawTextPosition *) XtRealloc - (dataDpy->linepos, line * sizeof(XawTextPosition)); + ((char *)dataDpy->linepos, line * sizeof(XawTextPosition)); } /* @@ -256,7 +256,7 @@ dataDpy->label = XtCreateManagedWidget("label", labelWidgetClass, dataDpy->popup, args, n); XtAddEventHandler(dataDpy->label, (EventMask) ButtonPressMask, False, - DestroyDataPopup, dataDpy); + DestroyDataPopup, (XtPointer)dataDpy); /* Create the text window */ n = 0; @@ -412,7 +412,7 @@ DataDpyList *p, *q; XtPopdown(dataDpy->popupshell); - XtFree(dataDpy->linepos); + XtFree((char *)dataDpy->linepos); XtFree(dataDpy->buf); dataDpy->buf = NULL; dataDpy->buflen = 0; @@ -423,7 +423,7 @@ pop_down(p->dataDpy); q = p; p = p->next; - XtFree(q); + XtFree((char *)q); } dataDpy->childlist = NULL; } @@ -556,7 +556,7 @@ && i < dataDpyTableSize; i++); if (i == dataDpyTableSize) { /* Table full */ dataDpyTableSize += ADD_SIZE; - dataDpyTable = (DataDpyRec **) XtRealloc (dataDpyTable, + dataDpyTable = (DataDpyRec **) XtRealloc ((char *)dataDpyTable, dataDpyTableSize * sizeof(DataDpyRec *)); for (j=i; jtopPosition = XawTextTopPosition(w); */ topPosition = XawTextTopPosition(w); - XtCallActionProc(w, "select-start", event, params, num_params); + XtCallActionProc(w, "select-start", event, params, *num_params); /* reset to remembered position if top position changed */ /* if (XawTextTopPosition(w) != displayedFile->topPosition) @@ -354,7 +354,7 @@ while (*p) { if (*p++ == '\n') { if (line == nlines) { /* buffer full, need more memory */ - file->linepos = (XawTextPosition *) XtRealloc (file->linepos, + file->linepos = (XawTextPosition *) XtRealloc ((char *)file->linepos, (nlines + ADD_LINES) * sizeof(XawTextPosition)); nlines += ADD_LINES; } @@ -363,7 +363,7 @@ } file->lastline = line - 2; file->linepos = (XawTextPosition *) XtRealloc /* shrink to min size */ - (file->linepos, line * sizeof(XawTextPosition)); + ((char *)file->linepos, line * sizeof(XawTextPosition)); } @@ -411,7 +411,7 @@ if (i == fileTableSize) { /* file table full, enlarge it */ fileTableSize += ADD_SIZE; fileTable = (FileRec **) - XtRealloc (fileTable, fileTableSize * sizeof(FileRec *)); + XtRealloc ((char *)fileTable, fileTableSize * sizeof(FileRec *)); for (j=i; jbuf, (int) fileTable[i]->filesize)) == -1) { UpdateMessageWindow("Error: cannot read file %s", pathname); XtFree(fileTable[i]->buf); - XtFree(fileTable[i]); + XtFree((char *)fileTable[i]); fileTable[i] = NULL; close(fd); return -1; @@ -573,6 +573,12 @@ if (filename == NULL || strcmp(filename, "") == NULL) return NULL; + /* added by kevin dalley, forces xdbx to understand use directories */ + if (dirList[0] == NULL) + { + query_dbx("use\n"); + } + for (i=0; dirList[i]; i++) { if (*filename == '/' && access(filename, R_OK) == -1) { /* this handles the exceptional case of sun4 dbx output */ --- ./global.h Fri Aug 24 03:26:30 1990 +++ ../src/./global.h Tue May 9 14:40:36 2000 @@ -56,9 +56,12 @@ /* dbx.c */ extern void debug_init(); /* initial source display */ +void ReadDbxCallback(XtPointer, int*, XtInputId*); extern void read_dbx(); /* get data from dbx */ extern void write_dbx(); /* send data to dbx */ extern void query_dbx(); /* ask dbx for info */ +void read_from_dbx(void); +char *freadline(char *s, int maxlen, FILE *stream); /* dialog.c */ @@ -177,3 +180,7 @@ extern Stops stops[]; /* stop widget and mapped info */ extern Bomb bomb; /* bomb widget and mapped info */ extern Cardinal nstops; /* number of stops */ + +#ifdef sgi +char * getpty(); +#endif /* sgi */ --- ./XDbx.ad Fri Aug 24 03:26:28 1990 +++ ../src/./XDbx.ad Tue May 9 14:40:40 2000 @@ -31,7 +31,8 @@ *dialogWindow.translations: #override \n\ : SelectStart() SelectWord() \n\ Shift: SelectEnd() PrintSelection() \n\ - : SelectEnd() \n + : SelectEnd() \n\ + Return: newline() Dispatch()\n *commandWindow.preferredPaneSize: 106 *commandWindow.skipAdjust: True *commandWindow.hSpace: 14 --- ./calldbx.c Fri Aug 24 03:26:29 1990 +++ ../src/./calldbx.c Tue May 9 14:40:36 2000 @@ -1,33 +1,12 @@ +static char rcsid[] = "$Id: calldbx.c,v 1.2 1992/10/27 01:59:25 kevin Exp $"; + /***************************************************************************** * - * xdbx - X Window System interface to the dbx debugger - * * Copyright 1989 The University of Texas at Austin * Copyright 1990 Microelectronics and Computer Technology Corporation - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of The University of Texas - * and Microelectronics and Computer Technology Corporation (MCC) not be - * used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The - * University of Texas and MCC makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * Copyright 1990 Thomson Consumer Electronics, Inc. + * Copyright 1991 Bull HN Worldwide Info Systems, Inc. * - * Author: Po Cheung - * Created: March 10, 1989 - * *****************************************************************************/ /* calldbx.c @@ -35,161 +14,413 @@ * Set up communication between dbx and xdbx using pseudo terminal, and * call dbx. * - * open_master(): Open the master side of pty. - * open_slave(): Open the slave side of pty. - * calldbx(): Invoke dbx. + * open_master(): Open the master side of pty (static). + * open_slave(): Open the slave side of pty (static). + * calldbx(): Invoke the child process. + * callxtty(): Invoke the slave tty for the inferior dbx process. */ -#include -#include "global.h" +#include "global.h" -FILE *dbxfp = NULL; /* file pointer to dbx */ -int dbxpid = 0; /* dbx process id */ +#ifdef HAVE_TERMIO +# include +#else +# include +#endif + +#ifdef SCO +# include +#endif + +#ifdef STR_PTY +# include +#endif + +#if defined(PTC_PTY) +# include +# include +# include +#elif defined(sgi) +# include +# include +#endif + +static int open_master(void); +static int open_slave(void); + +FILE *dbxfp = NULL; /* file pointer to dbx */ +int dbxpid = 0; /* dbx process id */ +int xttypid = 0; /* xtty process id */ +static int dbxInputId; /* dbx input id */ + +#if defined(PTC_PTY) +static char pty[] = "/dev/ptc"; /* clone dev of pseudo-terminal */ +static char tty[15]; /* slave side of pseudo-terminal */ +int pts_master; /* master filedes */ +char dbxtty[12]; +#endif + +#if defined(IRIX4_PTY) +char *_getpty(int*, int, mode_t, int); +static char tty[15]; +static char pty[15]; +char dbxtty[12]; +#endif + +#ifdef STR_PTY +static char pty[] = "/dev/ptmx"; +static char tty[15]; /* slave side of pseudo-terminal */ +int pts_master; /* master filedes */ +#endif -static int dbxInputId; /* dbx input id */ +#if !defined(STR_PTY) && !defined(PTC_PTY) && !defined(IRIX4_PTY) static char pty[11] = "/dev/pty??"; /* master side of pseudo-terminal */ static char tty[11] = "/dev/tty??"; /* slave side of pseudo-terminal */ +char dbxtty[11] = "/dev/tty??"; +#endif + +static int hold_slave = -1; extern char *dbxprompt; /* - * Xdbx talks to dbx through a pseudo terminal which is a pair of master + * xdbx talks to dbx through a pseudo terminal which is a pair of master * and slave devices: /dev/pty?? and /dev/tty??, where ?? goes from p0 to - * sf (system dependent). The pty is opened for both read and write. + * sf (system dependent). The pty is opened for both read and write. Some + * systems use SYSV STREAMS based pty's. For these define STR_PTY. Some use + * /dev/ptc based pty's, for those use PTC_PTY. */ static int open_master() { - int i, master; - char c; + int i, master, fd; + char c; + +#ifdef IRIX4_PTY + char *line; + SIG_PF oldintr; +#endif + +#if defined(PTC_PTY) + if ((pts_master = open(pty, O_RDWR)) >= 0) + { + struct stat sb; + + if (fstat(pts_master, &sb) < 0) + close(pts_master); + else + { + hold_slave = minor(sb.st_rdev); + return(pts_master); + } + } +#endif + +#ifdef IRIX4_PTY + if ((oldintr = signal(SIGCHLD, SIG_DFL)) == SIG_ERR) + { + perror("bad return from signal"); + exit(1); + } + line = _getpty(&master, O_RDWR | O_NDELAY, 0600, 0); + if (signal(SIGCHLD, oldintr) == SIG_ERR) + { + perror("bad return from signal"); + exit(1); + } + if(line) + { + strcpy(tty, line); + return(master); + } +#endif - for (c='p'; c<='s'; c++) { - pty[8] = c; - for (i=0; i<16; i++) { - pty[9] = "0123456789abcdef"[i]; - if ((master = open(pty, O_RDWR)) != -1) - return (master); +#ifdef STR_PTY + if ((pts_master = open(pty, O_RDWR)) >= 0) + { + grantpt(pts_master); + unlockpt(pts_master); + return(pts_master); + } +#endif + +#if !defined(STR_PTY) && !defined(PTC_PTY) && !defined(IRIX4_PTY) + for (c='p'; c<'t'; c++) + { + for (i=0; i<16; i++) + { + pty[8] = c; + pty[9] = "0123456789abcdef"[i]; + tty[8] = c; + tty[9] = pty[9]; + /* + * I need to check that tty is not the same device we are using + * for dbx's pseudo-terminal. Xtty has to find its own. If this + * it the first pseudo-tty then dbxtty[0] is "??" otherwise it + * keeps the last letters of dbx's tty. + */ + if (strcmp(&dbxtty[8], &tty[8]) && + (master = open(pty, O_RDWR)) >= 0) + { + if ((hold_slave = open(tty, O_RDWR)) >= 0) + return (master); + else close(master); + } } } - fprintf(stderr, "xdbx: all ptys in use\n"); - exit(1); +#endif + + fprintf(stderr, "xdbx: all ptys in use\n"); + return(-1); } static int open_slave() { - int slave; + int pts_slave; + +#ifdef STR_PTY + char *ptsname(); + char *slavename; + + slavename = ptsname (pts_master); /* get name of slave */ + strcpy (tty, slavename); /* copy over to save area */ + if ((pts_slave = open(tty, O_RDWR)) >= 0) + { + /*XXX todo: need to make sure these succeed */ + ioctl (pts_slave, I_PUSH, "ptem"); + ioctl (pts_slave, I_PUSH, "ldterm"); + return(pts_save); + } +#endif + +#if defined(PTC_PTY) + sprintf(tty, "/dev/ttyq%d", hold_slave); + if ((pts_slave = open(tty, O_RDWR)) >= 0) + { + strcpy(dbxtty, tty); + return(pts_slave); + } +#endif + +#ifdef IRIX4_PTY + if ((pts_slave = open(tty, O_RDWR)) >= 0) + { + strcpy(dbxtty, tty); + return(pts_slave); + } +#endif + +#if !defined(STR_PTY) && !defined(PTC_PTY) && !defined(IRIX4_PTY) + return(hold_slave); +#else + fprintf(stderr, "xdbx: failed to open slave pty\n"); + return(-1); +#endif - tty[8] = pty[8]; - tty[9] = pty[9]; - if ((slave = open(tty, O_RDWR)) != -1) - return (slave); - fprintf(stderr, "open: cannot open slave pty %s", tty); - exit(1); } -/* ARGSUSED */ -void calldbx(argc, argv) -int argc; -char *argv[]; +/* + * callxtty - function which finds an unused pseudo-tty pair, invokes + * a slave xterm using -S and returns the master device for use by the + * child dbx. This function is called from XttyCallback. + * + */ +char *callxtty() { + char *argv[10]; + char arg1buf[LINESIZ]; + char arg3buf[LINESIZ]; + int master, slave; + +#if defined(STR_PTY) + fprintf(stderr, "xdbx: Xtty not supported on this sytem in this release\n"); + return NULL; +#else + + /* + * Opening the master and slave pty ensures it is not being used + */ + if((master = open_master()) == -1) + return NULL; + if((slave = open_slave()) == -1) + return NULL; + + xttypid = fork(); + if (xttypid == -1) { + perror("xdbx error: cannot fork process"); + return(NULL); + } + else if (xttypid) { + close(master); + close(slave); + sleep(1); + return(tty); + } + else { + + /* + * The xterm slave process "inherits" the slave filedes so we set + * the tty before invoking the slave xterm. + */ +#ifdef HAVE_TERMIO struct termio Termio; - int master; /* file descriptor of master pty */ - int slave; /* file descriptor of slave pty */ - int fd; /* file descriptor of controlling tty */ - int pid; /* process id */ - int pgrp; /* process group id */ - char *debugger; /* name of executable debugger */ - char errmsg[LINESIZ]; - - debugger = (char *) getenv("DEBUGGER"); /* first looks up env var */ - if (debugger == NULL) - debugger = XtNewString(DEBUGGER); - - /* construct dbx prompt string based on the name of debugger invoked */ - if (dbxprompt == NULL) { - dbxprompt = XtMalloc((4+strlen(debugger)) * sizeof(char)); - sprintf(dbxprompt, "(%s) ", debugger); - } - + + ioctl(slave, TCGETA, &Termio); +#ifdef SCO + Termio.c_cflag |= PARENB|CS8|HUPCL|CREAD; + Termio.c_iflag |= IXON; +#else + Termio.c_cflag |= CS8; + Termio.c_iflag |= ICRNL|IGNPAR|BRKINT; +#endif + Termio.c_lflag |= ECHO|ISIG|ICANON|ECHONL|ECHOE|ECHOK; + Termio.c_oflag |= ONLCR|OPOST; + ioctl(slave, TCSETA , &Termio); +#else /* - * Clear controlling tty. Do this now, so that open_slave and - * open_master will cause the selected pty to become the - * controlling tty. - */ - if ((fd = open("/dev/tty", O_RDWR)) > 0) { - ioctl(fd, TIOCNOTTY, 0); - close(fd); - } - - master = open_master(); - slave = open_slave(); - - dbxpid = fork(); - if (dbxpid == -1) { - perror("xdbx error: cannot fork process"); - exit(1); - } - else if (dbxpid) { - /* - * Parent : close the slave side of pty - * close stdin and stdout - * set the dbx file descriptor to nonblocking mode - * open file pointer with read/write access to dbx - * set line buffered mode - * register dbx input with X - */ - close(slave); - close(0); - close(1); - fcntl(master, F_SETFL, FNDELAY); - dbxfp = fdopen(master, "r+"); - setlinebuf(dbxfp); - dbxInputId = XtAppAddInput(app_context, master, XtInputReadMask, - read_dbx, NULL); - } - else { - /* - * Child : close master side of pty - * redirect stdin, stdout, stderr of dbx to pty - * unbuffer output data from dbx - * exec dbx with arguments - */ - close(master); - - /* - * Modify local and output mode of slave pty - */ - ioctl(slave, TCGETA, &Termio); - Termio.c_lflag &= ~ECHO; /* No echo */ - Termio.c_oflag &= ~ONLCR; /* Do not map NL to CR-NL on output */ - ioctl(slave, TCSETA, &Termio); - - dup2(slave, 0); - dup2(slave, 1); - dup2(slave, 2); - if (slave > 2) - close(slave); - fcntl(1, F_SETFL, FAPPEND); - setbuf(stdout, NULL); - - /* - * Set our process group to that of the terminal, - * so we can change the group of the terminal. - */ - ioctl(0, TIOCGPGRP, &pgrp); - setpgrp(0, pgrp); - - /* - * Now set the process group of the terminal and of us - * to our process id. This clears us from the control - * of the other process group. - */ - pid = getpid(); - ioctl(0, TIOCSPGRP, &pid); - setpgrp(0, pid); - - argv[0] = debugger; - execvp(debugger, argv); - sprintf(errmsg, "xdbx error: cannot exec %s", debugger); - perror(errmsg); - exit(1); + * I'm not too sure what should go in here. Is there a BSD hack out + * in netland who can help? Basically I wish to do exactly what I + * did for SYSV above. This may cause problems in BSD systems wishing + * to use Xtty. + */ + struct sgttyb tty_data; + + ioctl(slave, TIOCGETP, &tty_data); + tty_data.sg_flags |= CRMOD|ECHO; + ioctl(slave, TIOCSETP, &tty_data); +#endif + + argv[0] = "xterm"; + argv[1] = arg1buf; + argv[2] = "-title"; + argv[3] = arg3buf; + argv[4] = "-tn"; + argv[5] = "xterm"; + argv[6] = NULL; + + sprintf(arg1buf, "-S%c%c%d", tty[8], tty[9], slave); + sprintf(arg3buf, "Xdbx Xtty: %s", tty); + execvp("xterm", argv); + fprintf(stderr, "xdbx error: cannot exec xterm"); + exit(2); + } +#endif /* !STR_PTY && !PTC_PTY && !IRIX4_PTY */ +} + +void calldbx(argc, argv) + int argc; + char *argv[]; +{ + int master; /* file descriptor of master pty */ + int slave = -1; /* file descriptor of slave pty */ + char *debugger; /* name of executable debugger */ + int pid; +#ifdef HAVE_TERMIO + struct termio Termio; +#else + struct sgttyb tty_data; +#endif + + debugger = (char *) getenv("DBX_DEBUGGER"); /* first looks up env var */ + + if (debugger == NULL) + debugger = XtNewString(DEBUGGER); + printf("debugger = %s\n", debugger); + + + /* construct dbx prompt string based on the name of debugger invoked */ + if (dbxprompt == NULL) { + dbxprompt = XtMalloc((4+strlen(debugger)) * sizeof(char)); + sprintf(dbxprompt, "(%s) ", debugger); + } + printf("dbxprompt = %s\n", dbxprompt); + + if((master = open_master()) == -1) + exit(2); + + dbxpid = fork(); + if (dbxpid == -1) { + perror("xdbx error: cannot fork process"); + exit(2); + } + else if (dbxpid) { + /* + * Parent : close the slave side of pty + * close stdin and stdout + * set the dbx file descriptor to nonblocking mode + * open file pointer with read/write access to dbx + * set line buffered mode + * register dbx input with X + */ + if (slave >= 0) { + close(slave); } + close(0); + close(1); + + fcntl(master, F_SETFL, FNDELAY); + dbxfp = (FILE *)fdopen(master, "r+"); + setbuf(dbxfp, NULL); + + dbxInputId = XtAppAddInput(app_context, master, + (XtPointer) XtInputReadMask, + ReadDbxCallback, NULL); + + /* + * We make a copy of the master in case we wish to restore the pty + * after creating an Xtty + */ +#if !defined(STR_PTY) && !defined(PTC_PTY) && !defined(IRIX4_PTY) + strcpy(dbxtty, pty); +#endif + } + else { + /* + * Now set the process group of the terminal and of us + * to our process id. This clears us from the control + * of the other process group. We also free ourselves from + * the controlling tty. + */ +#if defined(SYSV) || defined(SYSV_SETPGRP) + setpgrp(); +#else + setsid(); +#endif + + /* + * We open_slave after the fork() as it will become our + * controlling tty by default since we just did a setsid()/setpgrp(). + */ + if((slave = open_slave()) == -1) + exit(2); + + /* + * Modify local and output mode of slave pty. + */ +#ifdef HAVE_TERMIO + ioctl(slave, TCGETA, &Termio); + Termio.c_lflag &= ~ECHO; /* No echo */ + Termio.c_oflag &= ~ONLCR; /* Do not map NL to CR-NL on output */ + ioctl(slave, TCSETA, &Termio); +#else + ioctl(slave, TIOCGETP, &tty_data); + tty_data.sg_flags &= ~ECHO; /* No echo */ + tty_data.sg_flags &= ~CRMOD; /* Do not map NL to CR-NL on output */ + ioctl(slave, TIOCSETP, &tty_data); +#endif + + dup2(slave, 0); + dup2(slave, 1); + dup2(slave, 2); + if (slave > 2) + close(slave); + close(master); + + fcntl(1, F_SETFL, FAPPEND); + setbuf(stdout, NULL); + + argv[0] = debugger; + execvp(debugger, argv); + fprintf(stderr, "xdbx error: cannot exec %s", debugger); + exit(2); + } } + --- ./filemenu.c Fri Aug 24 03:26:30 1990 +++ ../src/./filemenu.c Tue May 9 14:40:36 2000 @@ -71,7 +71,8 @@ fileMenu, /* list widget as file menu */ fileMenuLabel; /* label widget as file menu label */ -void File(), UpdateFileMenu(); +void File(); +static void UpdateFileMenu(); /* Change working directory to 'dir'. * For Berkeley dbx, modify static global variable, cwd, to keep track of @@ -83,7 +84,7 @@ { char command[LINESIZ]; -#ifdef BSD +#if defined(BSD) || defined(sgi) int i; if (strcmp(dir, "./") == NULL) @@ -167,16 +168,16 @@ if (filelist) { for (i=0; filelist[i]; i++) XtFree(filelist[i]); - XtFree(filelist); + XtFree((char *)filelist); } filelist = (char **) XtMalloc((nfiles+1) * sizeof(char *)); i = 0; for (j=0; jd_name); - XtFree(namelist[j]); + XtFree((char *)namelist[j]); } filelist[i++] = NULL; - XtFree(namelist); + XtFree((char *)namelist); return; } @@ -209,7 +210,11 @@ #ifndef BSD strcpy(string, filename); LASTCH(string) = '\0'; +#ifdef sgi + sprintf(command, "givenfile %s\n", string); +#else sprintf(command, "debug %s\n", string); +#endif send_command(command); AppendDialogText(command); #endif @@ -275,7 +280,7 @@ XtSetArg(args[n], XtNdefaultColumns, (XtArgVal) ncolumns); n++; fileMenu = XtCreateManagedWidget("fileMenu", listWidgetClass, popup, args, n); - XtAddCallback(fileMenu, XtNcallback, DisplayMenuFile, popupshell); + XtAddCallback(fileMenu, XtNcallback, DisplayMenuFile, (XtPointer)popupshell); n = 0; XtSetArg(args[n], XtNresize, False); n++; @@ -282,7 +287,7 @@ XtSetArg(args[n], XtNlabel, "CANCEL"); n++; cancelButton = XtCreateManagedWidget("cancelButton", commandWidgetClass, popup, args, n); - XtAddCallback(cancelButton, XtNcallback, CancelFileMenu, popupshell); + XtAddCallback(cancelButton, XtNcallback, CancelFileMenu, (XtPointer)popupshell); DisableWindowResize(fileMenuLabel); DisableWindowResize(cancelButton); --- ./parser.c Fri Aug 24 03:26:31 1990 +++ ../src/./parser.c Tue May 9 14:40:36 2000 @@ -55,8 +55,12 @@ #include "bsd_regex.h" #endif #else +#ifdef sgi +#include "iris4d_regex.h" +#else #include "sun_regex.h" #endif +#endif /* sgi */ #define BYTEWIDTH 8 #define RE_BUFFER 100 @@ -248,6 +252,7 @@ use_handler(output_string); break; #ifndef BSD +#ifndef sgi case C_PRINT: if (match(output_pattern, output_string, O_PRINT) != -1) print_handler(output_string); @@ -276,6 +281,7 @@ else bell(0); break; +#endif /* sgi */ #endif #ifdef BSD case C_STATUS: @@ -340,20 +346,27 @@ s = XtNewString(output); switch (command_type) { #ifndef BSD +#ifndef sgi case C_UPDOWN: if (match(output_pattern, s, O_UPDOWN) != -1) - strcpy(s, Token.mesg); + if (Token.msg) + strcpy(s, Token.mesg); break; case C_DISPLAY: if (match(output_pattern, s, O_PRINT) != -1) strcpy(s, ""); break; +#endif /* sgi */ #endif #ifdef MIPS case C_UPDOWN: if (match(output_pattern, s, O_UPDOWN) != -1) - strcpy(s, Token.mesg); + if (Token.mesg) + strcpy(s, Token.mesg); strcat(s, "\n"); +#ifdef sgi + UpdateMessageWindow(Token.func, NULL); +#endif break; case C_FUNC: if (match(output_pattern, s, O_FUNC) != -1) @@ -378,8 +391,10 @@ else { switch (command_type) { #ifndef BSD +#ifndef sgi case C_UPDOWN: case C_DISPLAY: +#endif /* sgi */ #endif #ifdef MIPS case C_UPDOWN: --- ./xdbx.c Fri Aug 24 03:26:33 1990 +++ ../src/./xdbx.c Tue May 9 15:22:30 2000 @@ -128,7 +128,8 @@ "*dialogWindow.translations: #override \\n\ : SelectStart() SelectWord() \\n\ Shift: SelectEnd() PrintSelection() \\n\ - : SelectEnd() \\n", + : SelectEnd() \\n\ + Return: newline() Dispatch()\\n", "*commandWindow.preferredPaneSize: 106", "*commandWindow.skipAdjust: True", "*commandWindow.hSpace: 14", @@ -155,7 +156,7 @@ {"-i", "dbxopt_i", XrmoptionNoArg, "True"}, {"-I", "includeDir", XrmoptionSepArg, NULL}, {"-k", "dbxopt_k", XrmoptionNoArg, "True"}, -#ifdef BSD /* Berkeley dbx */ +#if defined(BSD) || defined(sgi) /* Berkeley dbx */ {"-c", "cfile", XrmoptionSepArg, NULL}, #else /* Sun dbx */ {"-kbd", "dbxopt_kbd", XrmoptionNoArg, "True"}, @@ -185,6 +186,7 @@ fprintf(stderr, "Usage: %s [-toolkitoptions] [-dbxoptions] [objfile [corefile]]\n", call); + fprintf(stderr, "exited in Syntax\n"); exit(1); } @@ -221,6 +223,7 @@ xdbxprompt = app_resources.prompt; else xdbxprompt = XtNewString(XDBXPROMPT); + printf("xdbxprompt = *%s*\n", xdbxprompt); debug = app_resources.debug; DisableWindowResize(fileWindow); @@ -248,9 +251,10 @@ char **dbxargv; char *temp = "xdbx.XXXXXX"; int i=0; - + int j; + dbxargv = (char **) XtMalloc (MAXARGS * sizeof(char *)); - for (i=0; i < *argc; i++) + for (i=0; i < 1; i++) /* add argv[0] first, ( changed later) */ dbxargv[i] = argv[i]; if (app_resources->dbxopt_r) @@ -264,8 +268,12 @@ if (app_resources->dbxopt_k) dbxargv[i++] = "-k"; if (app_resources->cfile) { +#if 0 + /* should be passed by xdbx, not used by dbx directly */ dbxargv[i++] = "-c"; dbxargv[i++] = app_resources->cfile; +#endif + strncpy(xdbxinit, app_resources->cfile, sizeof(xdbxinit)); } if (app_resources->dbxopt_kbd) dbxargv[i++] = "-kbd"; @@ -279,8 +287,9 @@ * initialization file. Xdbx will read each line and pass it to dbx * instead. */ - if (strcmp(xdbxinit, "")) { /* .dbxinit or ~/.dbxinit exists */ -#ifdef BSD + if (strcmp(xdbxinit, "")) { /* .dbxinit or ~/.dbxinit exists + or other has been used*/ +#if defined(BSD) || defined(sgi) dbxargv[i++] = "-c"; #else dbxargv[i++] = "-s"; @@ -300,7 +309,13 @@ dbxargv[i++] = "-pixie"; } #endif + + /* add the rest of the arguments, added by kevin dalley */ + for (j=1; j < *argc; j++) + dbxargv[i++] = argv[j]; + dbxargv[i] = NULL; + *argc = i; return dbxargv; } @@ -315,9 +330,9 @@ trap_signals(); toplevel = XtAppInitialize(&app_context, "XDbx", options, XtNumber(options), - &argc, argv, fallback_resources, NULL, 0); + (Cardinal *)&argc, argv, fallback_resources, NULL, 0); if (argc > 3) Syntax(argv[0]); - XtGetApplicationResources(toplevel, &app_resources, resources, + XtGetApplicationResources(toplevel, (XtPointer)&app_resources, resources, XtNumber(resources), NULL, 0); XtAppAddActions(app_context, xdbx_actions, XtNumber(xdbx_actions)); CreateSubWindows(toplevel); --- ./dbx.c Fri Aug 24 03:26:30 1990 +++ ../src/./dbx.c Tue May 9 14:40:36 2000 @@ -1,33 +1,12 @@ +static char rcsid[] = "$Id: dbx.c,v 1.2 92/10/27 02:02:36 kevin Exp $"; + /***************************************************************************** * - * xdbx - X Window System interface to the dbx debugger - * * Copyright 1989 The University of Texas at Austin * Copyright 1990 Microelectronics and Computer Technology Corporation - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of The University of Texas - * and Microelectronics and Computer Technology Corporation (MCC) not be - * used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The - * University of Texas and MCC makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright 1990 Thomson Consumer Electronics, Inc. + * Copyright 1991 Bull HN Worldwide Info Systems, Inc. * - * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Po Cheung - * Created: March 10, 1989 - * *****************************************************************************/ /* @@ -36,16 +15,21 @@ * Handle dbx command initialization file (.dbxinit) and communication * between dbx and xdbx. * - * dbx_init(): Handle .dbxinit + * dbx_init(): Handle .dbxinit (static). * debug_init(): - * read_dbx(): Read dbx output, parse and filter it before displaying - * onto the dialog window. - * write_dbx(): Send a command to dbx. - * query_dbx(): Send a command to dbx and process it. + * read_from_dbx(): Read dbx output, parse and filter it before + * displaying onto the dialog window. + * write_dbx(): Send a command to dbx. + * query_dbx(): Send a command to dbx and process it. + * ReadDbxCallback(): An Xt input callback to handle input from dbx. + * freadline(): reads a line from a stream, a character at a time. */ +#include #include "global.h" +static void dbx_init(char*); + Boolean Prompt; /* True when dbx prompt arrives */ char *concat(); char *dbxprompt; @@ -52,26 +36,34 @@ char *xdbxprompt; /* Given a dbx command initialization file, this routine executes each dbx - * command in the file. It sends the command to dbx, and calls read_dbx() - * directly to process output returned from dbx. + * command in the file. It sends the command to dbx, and calls + * read_from_dbx() to process output returned from dbx. */ + static void dbx_init(xdbxinit) char *xdbxinit; { - FILE *fp; - char s[LINESIZ]; - - if (strcmp(xdbxinit, "") == NULL) - return; - if (fp = fopen(xdbxinit, "r")) { - while (fgets(s, LINESIZ, fp)) { - send_command(s); - AppendDialogText(s); - Prompt = False; - while (!Prompt) - read_dbx(); + FILE *fp; + char s[LINESIZ]; + + if (!strcmp(xdbxinit, "")) + return; + if (fp = fopen(xdbxinit, "r")) + { + while (fgets(s, LINESIZ, fp)) + { + if ((*s != '#') && strcmp(s,"\n")) + { + write_dbx(s); + insert_command(s); + AppendDialogText(s); + + Prompt = False; + while (!Prompt) + read_from_dbx(); + } } - close(fp); + close((int)fp); } } @@ -93,6 +85,9 @@ if (Tstartup) unlink(xdbxinit); strcpy(xdbxinit, ""); + LoadCurrentFile(); + query_dbx("list\n"); + AdjustText(Token.line); } } @@ -108,74 +103,96 @@ * o once the dbx prompt is read, calls parse() to analyse the dbx output * and take appropriate action. */ -/* ARGSUSED */ -void read_dbx(master, source, id) -XtPointer master; -int *source; -XtInputId *id; -{ - static char *output = NULL; /* buffer for dbx output */ - static char *next_string = NULL; - static char *command; - char *string = NULL; - char s[LINESIZ]; - Boolean more; - - more = True; - while (more) { - Prompt = False; - /* keep reading until no more or until prompt arrives */ - while (more = fgets(s, LINESIZ, dbxfp) && !Prompt) { - if (debug) - fprintf(stderr, "=>%s", s); - /* receive prompt? */ - if (strncmp(s, dbxprompt, strlen(dbxprompt)) == NULL) { - Prompt = True; - /* more stuff behind prompt? */ - if (s[strlen(dbxprompt)]) - /* remember it */ - next_string = XtNewString(s+strlen(dbxprompt)); - /* destroy contents */ - strcpy(s, ""); +void ReadDbxCallback(master, source, id) + XtPointer master; + int *source; + XtInputId *id; +{ + read_from_dbx(); +} + +void read_from_dbx() +{ + static char *output = NULL; /* buffer for dbx output */ + static char *next_string = NULL; + static char *command; + char *string = NULL; + char s[LINESIZ]; + Boolean more; + + more = True; + while (more) + { + Prompt = False; + /* keep reading until no more or until prompt arrives */ +#ifdef GETS_PROBLEM + while (more = freadline(s, LINESIZ, dbxfp) && !Prompt) +#else + while (more = fgets(s, LINESIZ, dbxfp) && !Prompt) +#endif + { +#ifdef DEBUG + if (debug) + fprintf(stderr, "=>%s", s); +#endif + /* receive prompt? */ + if (!strncmp(s, dbxprompt, strlen(dbxprompt))) + { + Prompt = True; + /* more stuff behind prompt? */ + if (s[strlen(dbxprompt)]) + /* remember it */ + next_string = XtNewString(s+strlen(xdbxprompt)); + /* destroy contents */ + strcpy(s, ""); } - string = concat(string, s); - strcpy(s, ""); + string = concat(string, s); + strcpy(s, ""); } - output = concat(output, string); - command = get_command(); - if (Echo) { - filter(string, output, command); - if (Prompt) AppendDialogText(xdbxprompt); - } - if (string) { - XtFree(string); - string = NULL; - } - if (next_string) { - string = concat(string, next_string); - XtFree(next_string); - next_string = NULL; - } - if (Prompt) { - parse(output, command); - delete_command(); - XtFree(output); - output = NULL; + output = concat(output, string); + command = get_command(); + + if (Echo) + { + filter(string, output, command); + if (Prompt) AppendDialogText(xdbxprompt); + } + if (string) + { + XtFree(string); + string = NULL; + } + if (next_string) + { + string = concat(string, next_string); + XtFree(next_string); + next_string = NULL; + } + if (Prompt) + { + parse(output, command); + delete_command(); + XtFree(output); + output = NULL; } } } /* Write string s to dbx, and flush the output. */ - void write_dbx(s) char *s; { +#ifdef DEBUG + if (debug) + fprintf(stderr, ">>%s", s); +#endif + fputs(s, dbxfp); - fflush(dbxfp); + fflush(dbxfp); } -/* Sends a command to dbx and read the corresponding output, directly - * invoking the Xt input procedure, read_dbx(). +/* Sends a command to dbx and read the corresponding output through + * read_from_dbx(). */ void query_dbx(command) char *command; @@ -186,8 +203,42 @@ Echo = False; Prompt = False; while (!Prompt) - read_dbx(); + read_from_dbx(); Parse = True; /* Always reset Parse and Echo to True */ Echo = True; } + +/* reads a line from a stream, one character at a time, + * looking for the newline. This is necessary for reading sockets + * and ptys (at least on some machines) to avoid interactions of the + * standard I/O library with the socket or pty + */ +char *freadline(char *s, int maxlen, FILE *stream) +{ + int fd = fileno(stream); + int n, rc; + char c; + char *ptr = s; + + for (n = 1; n < maxlen; n++) + { + if ( (rc = read(fd, &c, 1)) == 1) + { + *ptr++ = c; + if (c == '\n') + break; + } + else if ( (rc == 0) || (rc == -1 && errno == EAGAIN)) + { + if (n == 1) + return(NULL); + else break; + } + else return(NULL); + } + + *ptr = 0; + return(s); +} + --- ./iris4d_regex.h Tue May 9 15:07:48 2000 +++ ../src/./iris4d_regex.h Tue May 9 15:03:39 2000 @@ -0,0 +1,165 @@ +/***************************************************************************** + * + * xdbx - X Window System interface to the dbx debugger + * + * Copyright 1989 The University of Texas at Austin + * Copyright 1990 Microelectronics and Computer Technology Corporation + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of The University of Texas + * and Microelectronics and Computer Technology Corporation (MCC) not be + * used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. The + * University of Texas and MCC makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Po Cheung + * Created: November 24, 1989 + * + *****************************************************************************/ + +/* mips_regex.h: + * + * Regular expression pattern matching for dbx on DECStation. + * + * The reg_token array indicates the register no. for each token type. + * reg_token[0] : message + * reg_token[1] : stop number + * reg_token[2] : function name + * reg_token[3] : line number + * reg_token[4] : file name + * reg_token[5] : display command output + */ + +#define TK_MESG 0 +#define TK_STOP 1 +#define TK_FUNC 2 +#define TK_LINE 3 +#define TK_FILE 4 +#define TK_DISP 5 + +#define O_EXEC 0 +#define O_DONE 1 +#define O_STOPAT 2 +#define O_STOPIN 3 +#define O_UPDOWN 4 +#define O_FUNC 5 +#define O_BELL 6 +#define O_LIST 7 +#define O_FILE 8 +#define O_SEARCH 9 +#define O_PRINT 10 +#define O_DEBUG 11 + +#define C_ANY -1 +#define C_EXEC 0 +#define C_STOPAT 1 +#define C_STOPIN 2 +#define C_UPDOWN 3 +#define C_DELETE 4 +#define C_FUNC 5 +#define C_FILE 6 +#define C_USE 7 +#define C_LIST 8 +#define C_SEARCH 9 +#define C_PRINT 10 +#define C_STATUS 11 + +static PatternRec output_pattern[] = { + /* exec */ + {"\\(.*\n\\)*\\(\\(\\(\\(\\[[0-9]+\\] \\)?\\(Process *[0-9]+ .* stopped at \\)?\\)\\|Bus error \ +\\|Segmentation fault \\|Interrupt \\)?\\[\\([^ ]+\\):\\([0-9]+\\).*\\]\\).*\n", + NULL, + {2, -1, 7, 8, -1, -1} + }, + /* done */ + {"\\(.*\n\\)*Process *[0-9]+ *[^ ]* *finished\n", + NULL, + {-1, -1, -1, -1, -1, -1} + }, + /* stop at ok */ + {"Process *[0-9]+: \\[\\([0-9]+\\)\\] stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n", + NULL, + {-1, 1, -1, 4, 3, -1} + }, + /* stop in ok */ + {"\\(\\[.*\\]\n\\)*Process *[0-9]+: \\[\\([0-9]+\\)\\] stop in \\([^ ]+\\)\n", + NULL, + {-1, 2, 3, -1, -1, -1} + }, + /* up, down */ + {"\\(.*\\)\\[\"\\([^\"]+\\)\":[ ]*\\([0-9]+\\).*\n", + NULL, + {2, -1, 1, 3, 2, -1} + }, + /* func */ + {"\\(.*\\):\\([0-9]+\\).*\n", + NULL, + {-1, -1, 1, 2, -1, -1} + }, + /* bell */ + {"\n\\(not that many levels\\|program not active\\|program is not active\\|\ +cannot read register unless program is active\\|cannot dump unless program is \ +active\\|no active process\\|process must be stopped\\|\ +\\(Could not find process with event [0-9]+\\)\\|\ +delete\n ^ syntax error\\|process must be stopped...\\)\n", + NULL, + {-1, -1, -1, -1, -1, -1} + }, + /* list */ + {"[ ]*\\([0-9]+\\).*\n", + NULL, + {-1, -1, -1, 1, -1, -1} + }, + /* file */ + {"\\([^ ]+\\)\n", + NULL, + {-1, -1, -1, -1, 1, -1} + }, + /* search */ + {"[ ]*\\([0-9]+\\).*\n", + NULL, + {-1, -1, -1, 1, -1, -1} + }, + /* print */ + {"\\(.+\n\\(.*\n\\)*\\)", + NULL, + { 1, -1, -1, -1, -1, -1} + }, + /* dbx init */ + {"\\(.*\n\\)*.*\\(dbx version .*\nType 'help' for help.\nreading symbolic \ +information ...\n\\)\\(\nwarning: .*\n\\)?\\([^ ]+\\):[ ]*\\([0-9]+\\).*\n", + NULL, + {-1, -1, 4, 5, -1, -1} + }, + NULL +}; + +static PatternRec command_pattern[] = { + {"[ ]*\\(run\\|rerun\\|r\\|cont\\|c\\|next\\|n\\|S\\|nexti\\|Si\\|step\\|s\\|return\\)\\( \\|\n\\)", + NULL, {-1, -1, -1, -1, -1, -1}}, + {"[ ]*\\(\\(\\(stop\\)[ ]+at\\)\\|b\\)[ ]+\\(\"[^ ]+\":\\)?[0-9]+", NULL, {-1, -1, -1, -1, -1, -1}}, + {"[ ]*\\(\\(\\(stop\\)[ ]+in\\)\\|bp\\)[ ]+[^ ]+", NULL, {-1, -1, -1, -1, -1, -1}}, + {"[ ]*\\(up\\|down\\)", NULL, {-1, -1, -1, -1, -1, -1}}, + {"[ ]*\\(delete\\|d\\)[ ]+\\(all\\|[0-9]+\\)", NULL, {-1, -1, -1, 2, -1, -1}}, + {"[ ]*\\(func\\|f\\)\\([ ]+\\(\\([^ ]+\\)?\\)\\)?[ ]*", NULL, {-1, -1, 3, -1, -1, -1}}, + {"[ ]*\\(file\\|e\\)[ ]*", NULL, {-1, -1, -1, -1, 1, -1}}, + {"[ ]*use[ ]*", NULL, {-1, -1, -1, -1, 1, -1}}, + {"[ ]*\\(list\\|l\\)[ ]*", NULL, {-1, -1, -1, -1, 1, -1}}, + {"[ ]*\\(/\\|\?\\)", NULL, {-1, -1, -1, -1, -1, -1}}, + {"\\([ ]*\\(print\\|p\\)[ ]*[^ ]+\\)\\|dump", NULL, {-1, -1, -1, -1, -1, -1}}, + {"[ ]*\\(status\\|j\\)[ ]*", NULL, {-1, -1, -1, -1, 1, -1}}, + NULL +}; --- ./Makefile Fri Aug 24 03:26:28 1990 +++ ../src/./Makefile Tue May 9 15:03:54 2000 @@ -1,217 +1,434 @@ # Makefile generated by imake - do not edit! -# $XConsortium: imake.c,v 1.48 89/10/10 18:33:21 jim Exp $ -# -# The cpp used on this machine replaces all newlines and multiple tabs and -# spaces in a macro expansion with a single space. Imake tries to compensate -# for this, but is not always successful. -# +# $XConsortium: imake.c /main/90 1996/11/13 14:43:23 lehors $ -########################################################################### +# ---------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and -# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ -# -# Platform-specific parameters may be set in the appropriate .cf -# configuration files. Site-wide parameters may be set in the file -# site.def. Full rebuilds are recommended if any parameters are changed. -# -# If your C preprocessor doesn't define any unique symbols, you'll need -# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing -# "make Makefile", "make Makefiles", or "make World"). +# $XConsortium: Imake.tmpl,v 1.227 95/05/05 17:42:07 kaleb Exp $ # -# If you absolutely can't get imake to work, you'll need to set the -# variables at the top of each Makefile as well as the dependencies at the -# bottom (makedepend will do this automatically). -# + +.SUFFIXES: .i + +# $XConsortium: Imake.cf,v 1.19 95/01/05 19:24:32 kaleb Exp $ + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that need to come before +# the platform-specific parameters - edit site.def to change + +# site: $XConsortium: site.sample,v 1.9 94/04/08 17:02:06 rws Exp $ + +# ----------------------------------------------------------------------- +# platform-specific configuration parameters - edit sgi.cf to change + +# platform: $XConsortium: sgi.cf,v 1.43 94/06/03 21:38:45 matt Exp $ + +# operating system: IRIX + + OPTIMIZER = -O2 + + MANUSR = /usr/share/local + + CATMAN1DIR = $(MANUSR)/catman/u_man/cat1 + CATMAN3DIR = $(MANUSR)/catman/p_man/cat3 + MAN1DIR = $(MANUSR)/man/u_man/man1 + MAN3DIR = $(MANUSR)/man/p_man/man3 -########################################################################### -# platform-specific configuration parameters - edit sun.cf to change + MANPACKAGE = /X11 -# platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ -# operating system: SunOS 4.0.3 +# $XConsortium: sgiLib.rules,v 1.8 93/09/11 17:59:30 rws Exp $ -########################################################################### -# site-specific configuration parameters - edit site.def to change +# ----------------------------------------------------------------------- +# site-specific configuration parameters that go after +# the platform-specific parameters - edit site.def to change -# site: $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $ +# site: $XConsortium: site.sample,v 1.9 94/04/08 17:02:06 rws Exp $ - SHELL = /bin/sh +# --------------------------------------------------------------------- +# Imake rules for building libraries, programs, scripts, and data files +# rules: $XConsortium: Imake.rules,v 1.201 95/06/05 19:43:41 gildea Exp $ + + PATHSEP = / + SHELL = /bin/sh TOP = . CURRENT_DIR = . - AR = ar cq - BOOTSTRAPCFLAGS = - CC = cc + IMAKE = imake + DEPEND = makedepend + MKDIRHIER = mkdirhier + CONFIGSRC = $(TOP)/config + IMAKESRC = $(CONFIGSRC)/imake + DEPENDSRC = $(CONFIGSRC)/makedepend + IXXSRC = $(UNSUPPORTEDSRC)/programs/ixx + IXX = ixx + IXXFLAGS = -s BaseObject -m TypeObj -r RequestObj -p Xf + IXXINCLUDES = -i '' + + INCROOT = /usr/include + USRLIBDIR = /usr/lib + SHLIBDIR = /usr/lib32 + ISALIBDIR = /usr/lib32 + LINTLIBDIR = $(USRLIBDIR)/lint + MANPATH = /usr/share/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(CATMAN1DIR)$(MANPACKAGE) + LIBMANDIR = $(CATMAN3DIR)$(MANPACKAGE) + FILEMANDIR = $(MANSOURCEPATH)$(FILEMANSUFFIX) + + AR = $(TOOLROOT)/usr/bin/ar cq + BOOTSTRAPCFLAGS = $(OPTIMIZER) + CC = $(TOOLROOT)/usr/bin/cc + AS = $(TOOLROOT)/usr/bin/as + +.SUFFIXES: .cxx + + CXX = CC + CXXDEBUGFLAGS = $(OPTIMIZER) + CXXEXTRA_DEFINES = +CXXEXTRA_INCLUDES = + CXXIDL_INCLUDES = -I$(TOP)/include + CXXSTD_DEFINES = -DSYSV -DSVR4 -nostdinc -I$(ROOT)/usr/include + CXXOPTIONS = + CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) $(CXXIDL_INCLUDES) + CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(CXXEXTRA_DEFINES) + CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) - PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) - INSTALL = install - LD = ld + PREPROCESSCMD = $(TOOLROOT)/usr/bin/cc -E $(STD_CPP_DEFINES) + INSTALL = bsdinst + INSTALLFLAGS = -c + LD = $(TOOLROOT)/usr/bin/ld + LEX = lex + LEXLIB = -ll + YACC = yacc + CCYACC = yacc LINT = lint - LINTLIBFLAG = -C - LINTOPTS = -axz + LINTLIBFLAG = -o + LINTOPTS = -bh LN = ln -s - MAKE = make + MV = mv CP = cp - RANLIB = ranlib - RANLIBINSTFLAGS = + RM = rm -f - STD_INCLUDES = - STD_CPP_DEFINES = - STD_DEFINES = + MANSUFFIX = 1 + LIBMANSUFFIX = 3 + FILEMANSUFFIX = 4 + TROFF = psroff -t + MSMACROS = -ms + TBL = tbl + EQN = eqn + + DVIPS = dvips + LATEX = latex + + STD_INCLUDES = -nostdinc -I$(ROOT)/usr/include + STD_CPP_DEFINES = -DSYSV -DSVR4 + STD_DEFINES = -DSYSV -DSVR4 EXTRA_LOAD_FLAGS = + EXTRA_LDOPTIONS = EXTRA_LIBRARIES = TAGS = ctags - SHAREDCODEDEF = -DSHAREDCODE - SHLIBDEF = -DSUNSHLIB + SHAREDCODEDEF = + SHLIBDEF = - PROTO_DEFINES = + PROTO_DEFINES = -DFUNCPROTO=7 -DNARROWPROTO INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 - INSTLIBFLAGS = -m 0664 + INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 - INSTKMEMFLAGS = -m 4755 + INSTKMEMFLAGS = -m 2755 -g sys + + CDEBUGFLAGS = $(OPTIMIZER) + CCOPTIONS = -xansi -n32 -mips2 + + ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) + LDPRELIB = + LDPOSTLIB = -nostdlib -L$(ROOT)$(SHLIBDIR)/mips2 -L$(ROOT)$(SHLIBDIR) + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) + CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) - DESTDIR = + LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) - TOP_INCLUDES = -I$(INCROOT) + CCLINK = $(CC) - CDEBUGFLAGS = -O - CCOPTIONS = - COMPATFLAGS = - - ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) - ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) - CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) - LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) - LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) - LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) - LDCOMBINEFLAGS = -X -r + CXXLINK = $(CXX) - MACROFILE = sun.cf - RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut + LDSTRIPFLAGS = -x + LDCOMBINEFLAGS = -r + DEPENDFLAGS = + MACROFILE = sgi.cf + RM_CMD = $(RM) + IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) - ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ - $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ - $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) - -########################################################################### -# X Window System Build Parameters -# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ - -########################################################################### -# X Window System make variables; this need to be coordinated with rules -# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Project.tmpl \ + $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) \ + $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) + +# ----------------------------------------------------------------------- +# X Window System Build Parameters and Rules +# $XConsortium: Project.tmpl,v 1.248 95/01/06 19:12:51 gildea Exp $ - PATHSEP = / - USRLIBDIR = $(DESTDIR)/usr/lib - BINDIR = $(DESTDIR)/usr/bin/X11 - INCROOT = $(DESTDIR)/usr/include +# ----------------------------------------------------------------------- +# X Window System make variables; these need to be coordinated with rules + + BINDIR = /usr/bin/X11 BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. + BUILDLIBDIR = $(TOP)/usrlib + BUILDLIBTOP = .. INCDIR = $(INCROOT)/X11 - ADMDIR = $(DESTDIR)/usr/adm + ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 - CONFIGDIR = $(LIBDIR)/config - LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit - XDMDIR = $(LIBDIR)/xdm - AWMDIR = $(LIBDIR)/awm + XDMDIR = /var/X11/xdm TWMDIR = $(LIBDIR)/twm - GWMDIR = $(LIBDIR)/gwm - MANPATH = $(DESTDIR)/usr/local/man - MANSOURCEPATH = $(MANPATH)/man - MANDIR = $(MANSOURCEPATH)n - LIBMANDIR = $(MANSOURCEPATH)3 + NLSDIR = $(LIBDIR)/nls + XLOCALEDIR = $(LIBDIR)/locale + PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults - - SOXLIBREV = 4.2 - SOXTREV = 4.0 - SOXAWREV = 4.0 - SOOLDXREV = 4.0 - SOXMUREV = 4.0 - SOXEXTREV = 4.0 - FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) - IMAKE = imake - DEPEND = makedepend RGB = rgb - FONTC = bdftosnf + FONTC = bdftopcf MKFONTDIR = mkfontdir - MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh - CONFIGSRC = $(TOP)/config - CLIENTSRC = $(TOP)/clients - DEMOSRC = $(TOP)/demos + DOCUTILSRC = $(TOP)/doc/util + XDOCMACROS = $(DOCUTILSRC)/macros.t + XIDXMACROS = $(DOCUTILSRC)/indexmacros.t + PROGRAMSRC = $(TOP)/programs LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 - SERVERSRC = $(TOP)/server - UTILSRC = $(TOP)/util - SCRIPTSRC = $(UTILSRC)/scripts - EXAMPLESRC = $(TOP)/examples + SERVERSRC = $(TOP)/programs/Xserver CONTRIBSRC = $(TOP)/../contrib + UNSUPPORTEDSRC = $(TOP)/unsupported DOCSRC = $(TOP)/doc - RGBSRC = $(TOP)/rgb - DEPENDSRC = $(UTILSRC)/makedepend - IMAKESRC = $(CONFIGSRC) + RGBSRC = $(TOP)/programs/rgb + BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf + MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir + FONTSERVERSRC = $(PROGRAMSRC)/xfs + FONTINCSRC = $(TOP)/include/fonts + EXTINCSRC = $(TOP)/include/extensions + TRANSCOMMSRC = $(LIBSRC)/xtrans + TRANS_INCLUDES = -I$(TRANSCOMMSRC) + +# Supporting dynamic shared object libraries for IRIX 5.0 + +# These defines mimic what is in /usr/include/make/commondefs +# (Should be in sync with Revision 1.99) + + DSOREGFILE = $$ROOT$(SHLIBDIR)/so_locations + DSOSTARTOPT = -update_registry $(DSOREGFILE) + DSONAMEOPT = -soname $@ + DSOVERSION = sgi1.0 + DSOVERSIONOPT = -set_version $(DSOVERSION) + LDDSOOPTS = -n32 -mips2 -shared -no_unresolved $(VLDDSOOPTS) \ + $(LLDDSOOPTS) $(GLDDSOOPTS) + GLDDSOOPTS = -all $(DSOSTARTOPT) $(DSONAMEOPT) $(DSOVERSIONOPT) + + LIBSRC = $(TOP)/libN32 + + XLIBSRC = $(LIBSRC)/X11 + +SOXLIBREV = .1 +DEPXONLYLIB = $(ROOT)$(SHLIBDIR)/libX11.so$(SOXLIBREV) +XONLYLIB = -lX11 + +LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln + + XLIBONLY = $(XONLYLIB) + + XEXTLIBSRC = $(LIBSRC)/Xext + +SOXEXTREV = +DEPEXTENSIONLIB = $(ROOT)$(SHLIBDIR)/libXext.so$(SOXEXTREV) +EXTENSIONLIB = -lXext + +LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln + +LINTEXTENSIONLIB = $(LINTEXTENSION) + DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) + XLIB = $(EXTENSIONLIB) $(XONLYLIB) + LINTXLIB = $(LINTXONLYLIB) + XAUTHSRC = $(LIBSRC)/Xau - XLIBSRC = $(LIBSRC)/X + +DEPXAUTHLIB = $(ROOT)$(SHLIBDIR)/libXau.a +XAUTHLIB = -lXau + +LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln + + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + +DEPXDMCPLIB = $(ROOT)$(SHLIBDIR)/libXdmcp.a +XDMCPLIB = -lXdmcp + +LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln + XMUSRC = $(LIBSRC)/Xmu + +SOXMUREV = +DEPXMULIB = $(ROOT)$(SHLIBDIR)/libXmu.so$(SOXMUREV) +XMULIB = -lXmu + +LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln + + OLDXLIBSRC = $(LIBSRC)/oldX + +DEPOLDXLIB = $(ROOT)$(SHLIBDIR)/liboldX.a +OLDXLIB = -loldX + +LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln + TOOLKITSRC = $(LIBSRC)/Xt + +SOXTREV = +DEPXTOOLONLYLIB = $(ROOT)$(SHLIBDIR)/libXt.so$(SOXTREV) +XTOOLONLYLIB = -lXt + +LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln + + DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) + XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) + LINTXTOOLLIB = $(LINTXTOOLONLYLIB) + AWIDGETSRC = $(LIBSRC)/Xaw - OLDXLIBSRC = $(LIBSRC)/oldX - XDMCPLIBSRC = $(LIBSRC)/Xdmcp - BDFTOSNFSRC = $(FONTSRC)/bdftosnf - MKFONTDIRSRC = $(FONTSRC)/mkfontdir - EXTENSIONSRC = $(TOP)/extensions + +SOXAWREV = .2 +DEPXAWLIB = $(ROOT)$(SHLIBDIR)/libXaw.so$(SOXAWREV) +XAWLIB = -lXaw + +LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln + + XTFSRC = $(TOP)/workInProgress/Xtf + +SOXTFREV = 0.7 +DEPXTFLIB = $(ROOT)$(SHLIBDIR)/libXtf.so$(SOXTFREV) +XTFLIB = -lXtf + +LINTXTF = $(LINTLIBDIR)/llib-lXtf.ln + + FRESCOSRC = $(TOP)/workInProgress/Fresco + +SOFRESCOREV = 0.7 +DEPFRESCOLIB = $(ROOT)$(SHLIBDIR)/libFresco.so$(SOFRESCOREV) +FRESCOLIB = -lFresco + +LINTFRESCO = $(LINTLIBDIR)/llib-lFresco.ln + + XILIBSRC = $(LIBSRC)/Xi + +SOXINPUTREV = +DEPXILIB = $(ROOT)$(SHLIBDIR)/libXi.so$(SOXINPUTREV) +XILIB = -lXi + +LINTXI = $(LINTLIBDIR)/llib-lXi.ln + + XTESTLIBSRC = $(LIBSRC)/Xtst + +DEPXTESTLIB = $(ROOT)$(SHLIBDIR)/libXtst.a +XTESTLIB = -lXtst + +LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln + + PEXLIBSRC = $(LIBSRC)/PEX5 + +DEPPEXLIB = $(ROOT)$(SHLIBDIR)/libPEX5.a +PEXLIB = -lPEX5 + +LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln + + XNMBXLIBSRC = $(LIBSRC)/nmbx + +SONMBXREV = +DEPXNMBXLIB = $(ROOT)$(SHLIBDIR)/libXnmbx.so$(SONMBXREV) +XNMBXLIB = -lXnmbx + +LINTXNMBX = $(LINTLIBDIR)/llib-lXnmbx.ln - DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a - EXTENSIONLIB = -lXext + XTRAPLIBSRC = $(LIBSRC)/xtrap - DEPXLIB = $(DEPEXTENSIONLIB) - XLIB = $(EXTENSIONLIB) -lX11 +DEPXTRAPLIB = $(ROOT)$(SHLIBDIR)/libxtrap.a +XTRAPLIB = -lxtrap - DEPXAUTHLIB = $(USRLIBDIR)/libXau.a - XAUTHLIB = -lXau +LINTXTRAP = $(LINTLIBDIR)/llib-lxtrap.ln - DEPXMULIB = - XMULIB = -lXmu + XIELIBSRC = $(LIBSRC)/XIE - DEPOLDXLIB = - OLDXLIB = -loldX +DEPXIELIB = $(ROOT)$(SHLIBDIR)/libXIE.a +XIELIB = -lXIE - DEPXTOOLLIB = - XTOOLLIB = -lXt +LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln - DEPXAWLIB = - XAWLIB = -lXaw + PHIGSLIBSRC = $(LIBSRC)/PHIGS - LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln - LINTXLIB = $(USRLIBDIR)/llib-lX11.ln - LINTXMU = $(USRLIBDIR)/llib-lXmu.ln - LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln - LINTXAW = $(USRLIBDIR)/llib-lXaw.ln +DEPPHIGSLIB = $(ROOT)$(SHLIBDIR)/libphigs.a +PHIGSLIB = -lphigs +LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln + +DEPXBSDLIB = $(ROOT)$(SHLIBDIR)/libXbsd.a +XBSDLIB = -lXbsd + +LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln + + ICESRC = $(LIBSRC)/ICE + +SOICEREV = +DEPICELIB = $(ROOT)$(SHLIBDIR)/libICE.so$(SOICEREV) +ICELIB = -lICE + +LINTICE = $(LINTLIBDIR)/llib-lICE.ln + + SMSRC = $(LIBSRC)/SM + +SOSMREV = +DEPSMLIB = $(ROOT)$(SHLIBDIR)/libSM.so$(SOSMREV) +SMLIB = -lSM + +LINTSM = $(LINTLIBDIR)/llib-lSM.ln + + FSLIBSRC = $(LIBSRC)/FS + +DEPFSLIB = $(ROOT)$(SHLIBDIR)/libFS.a +FSLIB = -lFS + +LINTFS = $(LINTLIBDIR)/llib-lFS.ln + + FONTLIBSRC = $(LIBSRC)/font + +DEPFONTLIB = $(ROOT)$(SHLIBDIR)/libfont.a +FONTLIB = -lfont + +LINTFONT = $(LINTLIBDIR)/llib-lfont.ln + + XKBFILELIBSRC = $(LIBSRC)/xkbfile + +DEPXKBFILELIB = $(ROOT)$(SHLIBDIR)/libxkbfile.a +XKBFILELIB = -lxkbfile + +LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) @@ -218,15 +435,11 @@ DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) -########################################################################### -# Imake rules for building libraries, programs, scripts, and data files -# rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ + CONFIGDIR = $(LIBDIR)/config -########################################################################### +# ----------------------------------------------------------------------- # start of Imakefile - DEFINES = -DSUNOS4 - DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) @@ -238,28 +451,39 @@ handler.o parser.o regex.o signs.o signals.o source.o \ utils.o windows.o xdbx.o - PROGRAM = xdbx + PROGRAM = xdbx all:: xdbx xdbx: $(OBJS) $(DEPLIBS) - $(RM) $@ - $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) - -saber_xdbx: - #load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + $(RM) $@ + $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) -osaber_xdbx: - #load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) - install:: xdbx - $(INSTALL) -c $(INSTPGMFLAGS) xdbx $(BINDIR) + -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ + else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi + $(INSTALL) $(INSTALLFLAGS) $(INSTPGMFLAGS) xdbx $(DESTDIR)$(BINDIR)/xdbx + +xdbx.nr.z : xdbx.man + @if [ -f xdbx.man ]; then \ + $(RM) xdbx.nr xdbx.nr.z && \ + tbl xdbx.man | eqn | nroff -man - > xdbx.nr && \ + pack -f xdbx.nr; \ + fi + +install.man:: xdbx.nr.z + -@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ + else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi; \ + if [ -f xdbx.man ]; then \ + $(INSTALL) -c $(INSTMANFLAGS) \ + xdbx.nr.z $(DESTDIR)$(MANDIR)/xdbx.z; \ + fi -install.man:: xdbx.man - $(INSTALL) -c $(INSTMANFLAGS) xdbx.man $(MANDIR)/xdbx.n +clean:: + $(RM) xdbx.nr xdbx.nr.z depend:: - $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) + $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) @@ -267,23 +491,28 @@ $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: - $(RM) $(PROGRAM) + $(RM) xdbx install:: XDbx.ad - $(INSTALL) -c $(INSTAPPFLAGS) XDbx.ad $(XAPPLOADDIR)/XDbx + -@if [ -d $(DESTDIR)$(XAPPLOADDIR) ]; then set +x; \ + else (set -x; $(MKDIRHIER) $(DESTDIR)$(XAPPLOADDIR)); fi + $(INSTALL) $(INSTALLFLAGS) $(INSTAPPFLAGS) XDbx.ad $(DESTDIR)$(XAPPLOADDIR)/XDbx -########################################################################### +# ----------------------------------------------------------------------- # common rules for all Makefiles - do not edit +.c.i: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ + emptyrule:: clean:: - $(RM_CMD) \#* + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* Makefile:: - -@if [ -f Makefile ]; then \ - echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ - $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + -@if [ -f Makefile ]; then set -x; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) @@ -291,13 +520,9 @@ $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS -saber: - #load $(ALLDEFINES) $(SRCS) - -osaber: - #load $(ALLDEFINES) $(OBJS) +man_keywords:: -########################################################################### +# ---------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @@ -306,10 +531,15 @@ install.man:: @echo "install.man in $(CURRENT_DIR) done" +install.linkkit:: + @echo "install.linkkit in $(CURRENT_DIR) done" + Makefiles:: includes:: -########################################################################### +depend:: + +# ----------------------------------------------------------------------- # dependencies generated by makedepend --- ./defs.h Fri Aug 24 03:26:30 1990 +++ ../src/./defs.h Tue May 9 14:40:36 2000 @@ -59,11 +59,24 @@ #include #include +#ifdef SYSV +#ifndef sgi +# define MAX(a,b) ((a)>(b)?(a):(b)) +# define MIN(a,b) ((a)>(b)?(b):(a)) +#endif /* sgi */ +# define HAVE_TERMIO +#else +# define sigset signal +# define getcwd getwd +#endif + +#if (XtSpecificationRelease < 4) /* incompatibility of header file with X11R4 documentation */ #define XawChainTop XtChainTop #define XawChainBottom XtChainBottom #define XawChainLeft XtChainLeft #define XawChainRight XtChainRight +#endif #ifndef AssignMax #define AssignMax(x, y) if ((y) > (x)) x = (y) --- ./signals.c Fri Aug 24 03:26:32 1990 +++ ../src/./signals.c Tue May 9 14:40:37 2000 @@ -73,11 +73,16 @@ static void quit_handler() { union wait status; - + int retvalue; + /* wait for the child to report its status; if the child has died, * exit gracefully. */ - wait3(&status, WNOHANG|WUNTRACED, NULL); + retvalue = wait3(&status, WNOHANG|WUNTRACED, NULL); + if (retvalue == -1) + { + exit(1); + } if ((WIFEXITED(status) || WIFSIGNALED(status)) && !WIFSTOPPED(status)) { exit(1); } --- ./regex.h Fri Aug 24 03:26:32 1990 +++ ../src/./regex.h Tue May 9 14:40:37 2000 @@ -1,3 +1,5 @@ +/* $Id: regex.h,v 1.2 92/10/27 02:14:56 kevin Exp $ */ + /* Definitions for data structures callers pass the regex library. Copyright (C) 1985 Free Software Foundation, Inc. --- ./regex.c Fri Aug 24 03:26:32 1990 +++ ../src/./regex.c Tue May 9 14:40:36 2000 @@ -1,3 +1,5 @@ +static char rcsid[] = "$Id: regex.c,v 1.2 92/10/27 02:14:20 kevin Exp $"; + /* Extended regular expression matching and search. Copyright (C) 1985 Free Software Foundation, Inc. @@ -113,11 +115,15 @@ * By : Po Cheung, po@cerc.utexas.edu * Date : July 27, 1990 */ -#ifdef sparc +#if defined(sparc) || defined(sgi) #include #endif #define FAILURE_STACK 20000 /* max failure stack size */ +#ifdef __GNUC__ +#define alloca __builtin_alloca +#endif + #ifdef emacs /* The `emacs' switch turns on certain special matching commands @@ -1510,7 +1516,7 @@ return -1; /* Failure to match */ } -static int +int bcmp_translate (s1, s2, len, translate) unsigned char *s1, *s2; register int len; --- ./command.c Fri Aug 24 03:26:29 1990 +++ ../src/./command.c Tue May 9 14:40:36 2000 @@ -245,9 +245,15 @@ { union wait status; +#ifdef sgi + kill(dbxpid, SIGINT); write_dbx("quit\n"); XtDestroyApplicationContext(app_context); +#else + write_dbx("quit\n"); + XtDestroyApplicationContext(app_context); kill(dbxpid, SIGKILL); +#endif /* sgi */ wait3(&status, WNOHANG, NULL); exit(0); } @@ -484,7 +490,7 @@ XtPointer client_data; XtPointer call_data; { - XtPopdown(client_data); + XtPopdown((Widget)client_data); } /* ARGSUSED */ @@ -582,7 +588,7 @@ button[i++] = AddButton (parent, "cont", DoIt, "cont\n"); button[i++] = AddButton (parent, "next", DoIt, "next\n"); button[i++] = AddButton (parent, "step", DoIt, "step\n"); -#ifdef BSD +#if defined(BSD) || defined(sgi) button[i++] = AddButton (parent, "return", Return, "return\n"); #endif button[i++] = AddButton (parent, "stop at", Stop_at, NULL); @@ -597,9 +603,11 @@ button[i++] = AddButton (parent, "file", File, NULL); button[i++] = AddButton (parent, "status", DoIt, "status\n"); #ifndef BSD +#ifndef sgi button[i++] = AddButton (parent, "display", Display_, NULL); button[i++] = AddButton (parent, "undisplay", Undisplay, NULL); #endif +#endif button[i++] = AddButton (parent, "dump", Dump, NULL); button[i++] = AddButton (parent, "search", PopupSearch, NULL); button[i++] = AddButton (parent, "quit", Quit, NULL); @@ -679,7 +687,7 @@ if (p = commandQueue) { commandQueue = p->next; XtFree(p->command); - XtFree(p); + XtFree((char *)p); } } --- ./handler.c Fri Aug 24 03:26:31 1990 +++ ../src/./handler.c Tue May 9 14:40:36 2000 @@ -57,7 +57,11 @@ #ifdef BSD #define BRACKET "[%d]" #else +#ifdef sgi +#define BRACKET "Process %d: [%d]" +#else #define BRACKET "(%d)" +#endif /* sgi */ #endif Boolean Echo = True; /* display dbx output if true */ @@ -143,7 +147,7 @@ line = Token.line; func = XtNewString(Token.func); mesg = XtNewString(Token.mesg); -#ifdef MIPS +#if defined(MIPS) || defined(sgi) status = LoadCurrentFile(); #else if (Token.file) @@ -203,6 +207,26 @@ */ void stop_at_handler() { +#ifdef sgi + Tokens tempToken; + if (Token.stop == 0 || Token.line == 0 ) + return; + if (Token.file == NULL) + { + if (displayedFile == NULL) + return; + stops[Token.stop].file = displayedFile->pathname; + } + else + { + /* GetPathname changes Token, protect it for a while */ + tempToken = Token; + stops[tempToken.stop].file = GetPathname(tempToken.file); + Token = tempToken; + if (LoadFile(stops[Token.stop].file)) + return; + } +#else if (Token.stop == 0 || Token.line == 0 || displayedFile == NULL) return; if (Token.file == NULL) @@ -209,6 +233,7 @@ stops[Token.stop].file = displayedFile->pathname; else stops[Token.stop].file = GetPathname(Token.file); +#endif DisplayStop(displayedFile, Token.line); stops[Token.stop].line = Token.line; stops[Token.stop].tag = 0; @@ -332,16 +357,32 @@ char s[LINESIZ]; int i; int line; +#ifdef sgi + int garbage; +#endif write_dbx("status\n"); +#ifdef GETS_PROBLEM + while (freadline(s, LINESIZ, dbxfp) == NULL); +#else while (fgets(s, LINESIZ, dbxfp) == NULL); +#endif do { if (strcmp(s, dbxprompt) || strcmp(s, "")) { +#ifdef sgi + sscanf(s, BRACKET, &garbage, &i); +#else sscanf(s, BRACKET, &i); +#endif if (i > 0 && i <= nstops && stops[i].line > 0) stops[i].tag = 1; } - } while (fgets(s, LINESIZ, dbxfp)); + } +#ifdef GETS_PROBLEM + while (freadline(s, LINESIZ, dbxfp)); +#else + while (fgets(s, LINESIZ, dbxfp)); +#endif for (i=1; i<=nstops; i++) if (stops[i].line > 0) { @@ -392,6 +433,7 @@ strcpy(CurrentFile, Token.file); else strcpy(CurrentFile, ""); + LoadFile(CurrentFile); } /* ARGSUSED */