diff -cr gdb-4.11/command.c d:gdb-4.11/command.c *** gdb-4.11/command.c Fri Oct 29 06:31:36 1993 --- d:gdb-4.11/command.c Thu Nov 04 15:35:20 1993 *************** *** 1,3 **** --- 1,5 ---- + /* command.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Handle lists of commands, their decoding and documentation, for GDB. Copyright 1986, 1989, 1990, 1991 Free Software Foundation, Inc. *************** *** 1200,1205 **** --- 1202,1211 ---- int rc, status, pid; char *p, *user_shell; + #if defined (__EMX__) + if (system ((arg == NULL ? "" : arg)) < 0) + error ("system() failed"); + #else if ((user_shell = (char *) getenv ("SHELL")) == NULL) user_shell = "/bin/sh"; *************** *** 1225,1230 **** --- 1231,1237 ---- ; else error ("Fork failed"); + #endif /* !defined (__EMX__) */ #endif /* Can fork. */ } diff -cr gdb-4.11/corelow.c d:gdb-4.11/corelow.c *** gdb-4.11/corelow.c Fri Oct 29 06:31:48 1993 --- d:gdb-4.11/corelow.c Thu Nov 04 15:35:20 1993 *************** *** 1,3 **** --- 1,5 ---- + /* corelow.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Core dump and executable file functions below target vector, for GDB. Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. *************** *** 129,143 **** --- 131,162 ---- } filename = tilde_expand (filename); + #if defined (__EMX__) + { + char tmp[512]; + if (_fullpath (tmp, filename, sizeof (tmp)) == 0) + { + strlwr (tmp); + filename = strsave (tmp); + } + else + filename = strsave (filename); + } + #else if (filename[0] != '/') { temp = concat (current_directory, "/", filename, NULL); free (filename); filename = temp; } + #endif old_chain = make_cleanup (free, filename); + #if defined (__EMX__) + scratch_chan = open (filename, (write_files? O_RDWR: O_RDONLY) | O_BINARY, 0); + #else scratch_chan = open (filename, write_files? O_RDWR: O_RDONLY, 0); + #endif if (scratch_chan < 0) perror_with_name (filename); diff -cr gdb-4.11/dbxread.c d:gdb-4.11/dbxread.c *** gdb-4.11/dbxread.c Fri Oct 29 06:31:50 1993 --- d:gdb-4.11/dbxread.c Thu Nov 04 15:35:22 1993 *************** *** 1,3 **** --- 1,5 ---- + /* dbxread.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Read dbx symbol tables and convert to internal format, for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. *************** *** 1038,1044 **** --- 1040,1048 ---- for this source file out of the ELF symbol table, to compensate for Sun brain death. This replaces the section_offsets in this psymtab, if successful. */ + #if !defined (__EMX__) elfstab_offset_sections (objfile, result); + #endif /* Deduce the source language from the filename for this psymtab. */ psymtab_language = deduce_language_from_filename (filename); diff -cr gdb-4.11/i386v-na.c d:gdb-4.11/i386v-na.c *** gdb-4.11/i386v-na.c Fri Oct 29 06:32:02 1993 --- d:gdb-4.11/i386v-na.c Thu Nov 04 15:35:22 1993 *************** *** 1,3 **** --- 1,5 ---- + /* i386v-na.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Intel 386 native support for SYSV systems (pre-SVR4). Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc. *************** *** 85,91 **** } ! #if 0 /* using FLOAT_INFO as is would be a problem. FLOAT_INFO is called via a command xxx and eventually calls ptrace without ever having traversed the target vector. This would be terribly impolite --- 87,185 ---- } ! ! #if defined (__EMX__) ! ! /* Taken from i386-xdep.c of GDB 4.6 */ ! /* and modified by Eberhard Mattes */ ! ! struct env387 ! { ! unsigned short control; ! unsigned short r0; ! unsigned short status; ! unsigned short r1; ! unsigned short tag; ! unsigned short r2; ! unsigned long eip; ! unsigned short code_seg; ! unsigned short opcode; ! unsigned long operand; ! unsigned short operand_seg; ! unsigned short r3; ! unsigned char regs[8][10]; ! }; ! ! static ! print_387_status (status, ep) ! unsigned short status; ! struct env387 *ep; ! { ! int i; ! int bothstatus; ! int top; ! int fpreg; ! unsigned char *p; ! ! bothstatus = ((status != 0) && (ep->status != 0)); ! if (status != 0) ! { ! if (bothstatus) ! printf ("u: "); ! print_387_status_word (status); ! } ! ! if (ep->status != 0) ! { ! if (bothstatus) ! printf ("e: "); ! print_387_status_word (ep->status); ! } ! ! print_387_control_word (ep->control); ! printf ("last exception: "); ! printf ("opcode %s; ", local_hex_string(ep->opcode)); ! printf ("pc %s:", local_hex_string(ep->code_seg)); ! printf ("%s; ", local_hex_string(ep->eip)); ! printf ("operand %s", local_hex_string(ep->operand_seg)); ! printf (":%s\n", local_hex_string(ep->operand)); ! ! top = (ep->status >> 11) & 7; ! ! printf ("reg tag msb lsb value\n"); ! for (fpreg = 7; fpreg >= 0; fpreg--) ! { ! double val; ! ! printf ("st(%d): ", fpreg); ! ! switch ((ep->tag >> (((top + fpreg) & 7) * 2)) & 3) ! { ! case 0: printf ("valid "); break; ! case 1: printf ("zero "); break; ! case 2: printf ("trap "); break; ! case 3: printf ("empty "); break; ! } ! for (i = 9; i >= 0; i--) ! printf ("%02x", ep->regs[fpreg][i]); ! ! ieee_extended_to_double (&ext_format_i387, (char *)ep->regs[fpreg], ! &val); ! printf (" %g\n", val); ! } ! if (ep->r0) ! warning ("reserved0 is %s\n", local_hex_string(ep->r0)); ! if (ep->r1) ! warning ("reserved1 is %s\n", local_hex_string(ep->r1)); ! if (ep->r2) ! warning ("reserved2 is %s\n", local_hex_string(ep->r2)); ! if (ep->r3) ! warning ("reserved3 is %s\n", local_hex_string(ep->r3)); ! } ! ! #define U_FPSTATE(u) u.u_fpstate ! ! /* __EMX__ #if 0 */ /* using FLOAT_INFO as is would be a problem. FLOAT_INFO is called via a command xxx and eventually calls ptrace without ever having traversed the target vector. This would be terribly impolite *************** *** 104,110 **** --- 198,206 ---- char fpvalid = 0; unsigned int rounded_addr; unsigned int rounded_size; + #if !defined (__EMX__) extern int corechan; + #endif int skip; uaddr = (char *)&u.u_fpvalid - (char *)&u; diff -cr gdb-4.11/inflow.c d:gdb-4.11/inflow.c *** gdb-4.11/inflow.c Fri Oct 29 06:32:02 1993 --- d:gdb-4.11/inflow.c Thu Nov 04 15:41:56 1993 *************** *** 1,3 **** --- 1,5 ---- + /* inflow.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Low level interface to ptrace, for GDB when running under Unix. Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. *************** *** 25,30 **** --- 27,35 ---- #include "serial.h" #include "terminal.h" #include "target.h" + #if defined (__EMX__) + #include "gdbcmd.h" + #endif #include #include *************** *** 108,113 **** --- 113,122 ---- enum {yes, no, have_not_checked} gdb_has_a_terminal_flag = have_not_checked; + #if defined (__EMX__) + int switch_sessions = 1; + #endif + /* Does GDB have a terminal (on stdin)? */ int gdb_has_a_terminal () *************** *** 193,198 **** --- 202,211 ---- { int result; + #ifdef __EMX__ + if (switch_sessions) + ptrace (10, inferior_pid, 0, 2); + #endif /* __EMX__ */ #ifdef F_GETFL /* Is there a reason this is being done twice? It happens both places we use F_SETFL, so I'm inclined to think perhaps there *************** *** 293,298 **** --- 306,315 ---- terminal_is_ours = 1; + #ifdef __EMX__ + if (switch_sessions) + ptrace (10, inferior_pid, 0, 0); + #endif /* __EMX__ */ #ifdef SIGTTOU if (job_control) osigttou = (void (*) ()) signal (SIGTTOU, SIG_IGN); *************** *** 634,639 **** --- 651,666 ---- add_com ("kill", class_run, kill_command, "Kill execution of program being debugged."); + + #ifdef __EMX__ + add_show_from_set + (add_set_cmd ("switch", class_run, var_boolean, + (char *)&switch_sessions, + "Set whether to switch to the child session when running " + "the inferior.", + &setlist), + &showlist); + #endif /* __EMX__ */ inferior_pid = 0; diff -cr gdb-4.11/infptrac.c d:gdb-4.11/infptrac.c *** gdb-4.11/infptrac.c Fri Oct 29 06:32:04 1993 --- d:gdb-4.11/infptrac.c Thu Nov 04 15:45:46 1993 *************** *** 1,3 **** --- 1,5 ---- + /* infptrac.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Low level Unix child interface to ptrace, for GDB when running under Unix. Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. *************** *** 423,433 **** --- 425,443 ---- buffer[i] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0); if (errno) + #ifdef __EMX__ + break; + #else return 0; + #endif QUIT; } /* Copy appropriate bytes out of the buffer. */ + #ifdef __EMX__ + if (i < count) + len = i * sizeof (int); + #endif memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), len); diff -cr gdb-4.11/infrun.c d:gdb-4.11/infrun.c *** gdb-4.11/infrun.c Fri Oct 29 06:32:04 1993 --- d:gdb-4.11/infrun.c Thu Nov 04 15:35:26 1993 *************** *** 1,3 **** --- 1,5 ---- + /* infrun.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Target-struct-independent code to start (run) and stop an inferior process. Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. *************** *** 39,44 **** --- 41,52 ---- #include #endif + #if defined (__EMX__) + #include "gdbcmd.h" + + int close_sessions = 0; + #endif + /* Prototypes for local functions */ static void *************** *** 1772,1777 **** --- 1780,1793 ---- register int i; register int numsigs; + #if defined (__EMX__) + add_show_from_set + (add_set_cmd ("close", class_run, var_boolean, + (char *)&close_sessions, + "Set whether to automatically close the next child session.", + &setlist), + &showlist); + #endif add_info ("signals", signals_info, "What debugger does when program gets various signals.\n\ Specify a signal number as argument to print info on that signal only."); diff -cr gdb-4.11/inftarg.c d:gdb-4.11/inftarg.c *** gdb-4.11/inftarg.c Fri Oct 29 06:32:04 1993 --- d:gdb-4.11/inftarg.c Thu Nov 04 15:35:26 1993 *************** *** 1,3 **** --- 1,5 ---- + /* inftarg.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Target-vector operations for controlling Unix child processes, for GDB. Copyright 1990, 1991, 1992 Free Software Foundation, Inc. Contributed by Cygnus Support. *************** *** 209,215 **** --- 211,221 ---- char *arg; int from_tty; { + #if defined (__EMX__) + error ("Use the \"run\" command to start an emx child process."); + #else error ("Use the \"run\" command to start a Unix child process."); + #endif } /* Stub function which causes the inferior that runs it, to be ptrace-able *************** *** 264,271 **** --- 270,282 ---- struct target_ops child_ops = { "child", /* to_shortname */ + #if defined (__EMX__) + "emx child process", /* to_longname */ + "emx child process (started by the \"run\" command).", /* to_doc */ + #else "Unix child process", /* to_longname */ "Unix child process (started by the \"run\" command).", /* to_doc */ + #endif child_open, /* to_open */ 0, /* to_close */ child_attach, /* to_attach */ diff -cr gdb-4.11/main.c d:gdb-4.11/main.c *** gdb-4.11/main.c Fri Oct 29 06:31:58 1993 --- d:gdb-4.11/main.c Thu Nov 04 15:35:30 1993 *************** *** 1,3 **** --- 1,5 ---- + /* main.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Top level `main' program for GDB, the GNU debugger. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. *************** *** 61,66 **** --- 63,72 ---- int original_stack_limit; #endif + #if defined (__EMX__) + #include + #endif + /* Prototypes for local functions */ static char * *************** *** 69,75 **** static void command_loop PARAMS ((void)); ! static void command_loop_marker PARAMS ((int)); static void --- 75,81 ---- static void command_loop PARAMS ((void)); ! void command_loop_marker PARAMS ((int)); static void *************** *** 535,540 **** --- 541,550 ---- alloca (4 - i); #endif + #if defined (__EMX__) + (void)setvbuf (stdout, NULL, _IOLBF, BUFSIZ); + #endif + /* If error() is called from initialization code, just exit */ if (SET_TOP_LEVEL ()) { exit(1); *************** *** 553,558 **** --- 563,571 ---- instream = stdin; getcwd (dirbuf, sizeof (dirbuf)); + #if defined (__EMX__) + strlwr (dirbuf); + #endif current_directory = dirbuf; #ifdef SET_STACK_LIMIT_HUGE *************** *** 1051,1057 **** } /* ARGSUSED */ ! static void command_loop_marker (foo) int foo; { --- 1064,1070 ---- } /* ARGSUSED */ ! void command_loop_marker (foo) int foo; { *************** *** 2238,2243 **** --- 2251,2259 ---- { if (args) error ("The \"pwd\" command does not take an argument: %s", args); getcwd (dirbuf, sizeof (dirbuf)); + #if defined (__EMX__) + strlwr (dirbuf); + #endif if (!STREQ (dirbuf, current_directory)) printf ("Working directory %s\n (canonically %s).\n", *************** *** 2270,2275 **** --- 2286,2294 ---- perror_with_name (dir); len = strlen (dir); + #if defined (__EMX__) + dir = current_directory = absfname ("."); + #else dir = savestring (dir, len - (len > 1 && dir[len-1] == '/')); if (dir[0] == '/') current_directory = dir; *************** *** 2321,2326 **** --- 2340,2346 ---- ++p; } } + #endif forget_cached_source_info (); *************** *** 2551,2557 **** --- 2571,2583 ---- int batch_mode () { + #if defined (__EMX__) + int ht; + return !(instream == stdin && ioctl (fileno (stdin), FGETHTYPE, &ht) >= 0 + && ht != HT_FILE); + #else return !(instream == stdin && ISATTY (stdin)); + #endif } *************** *** 2607,2613 **** --- 2633,2643 ---- /* We include the current directory so that if the user changes directories the file written will be the same as the one that was read. */ + #if defined (__EMX__) + history_filename = absfname ("!gdb_history"); + #else history_filename = concat (current_directory, "/.gdb_history", NULL); + #endif } read_history (history_filename); } diff -cr gdb-4.11/ser-unix.c d:gdb-4.11/ser-unix.c *** gdb-4.11/ser-unix.c Fri Oct 29 06:32:22 1993 --- d:gdb-4.11/ser-unix.c Thu Nov 18 14:13:12 1993 *************** *** 1,3 **** --- 1,5 ---- + /* ser-unix.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Serial interface for local (hardwired) serial ports on Un*x like systems Copyright 1992, 1993 Free Software Foundation, Inc. *************** *** 324,332 **** --- 326,336 ---- return tcsendbreak (scb->fd, 0); #endif + #ifndef __EMX__ #ifdef HAVE_TERMIO return ioctl (scb->fd, TCSBRK, 0); #endif + #endif /* !__EMX__ */ #ifdef HAVE_SGTTY { diff -cr gdb-4.11/source.c d:gdb-4.11/source.c *** gdb-4.11/source.c Fri Oct 29 06:32:22 1993 --- d:gdb-4.11/source.c Thu Nov 04 15:43:54 1993 *************** *** 1,3 **** --- 1,5 ---- + /* source.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* List lines of source files for GDB, the GNU debugger. Copyright (C) 1986, 1987, 1988, 1989, 1991 Free Software Foundation, Inc. *************** *** 38,43 **** --- 40,51 ---- #include "symfile.h" #include "objfiles.h" + #if defined (__EMX__) + /* fseek() doesn't work with "rt". */ + #undef FOPEN_RT + #define FOPEN_RT "rb" + #endif + /* Prototypes for local functions. */ static int *************** *** 237,243 **** --- 245,255 ---- void init_source_path () { + #if defined (__EMX__) + source_path = savestring ("$cdir;$cwd", /* strlen of it */ 10); + #else source_path = savestring ("$cdir:$cwd", /* strlen of it */ 10); + #endif forget_cached_source_info (); } *************** *** 288,294 **** --- 300,310 ---- struct stat st; { + #if defined (__EMX__) + char *colon = strchr (name, ';'); + #else char *colon = strchr (name, ':'); + #endif char *space = strchr (name, ' '); char *tab = strchr (name, '\t'); if (colon == 0 && space == 0 && tab == 0) *************** *** 303,314 **** --- 319,338 ---- if (tab != 0 && (p == 0 || tab < p)) p = tab; dirname = p + 1; + #if defined (__EMX__) + while (*dirname == ';' || *dirname == ' ' || *dirname == '\t') + #else while (*dirname == ':' || *dirname == ' ' || *dirname == '\t') + #endif ++dirname; } } + #if defined (__EMX__) + if (PATHSEP (p[-1])) + #else if (p[-1] == '/') + #endif /* Sigh. "foo/" => "foo" */ --p; *p = '\0'; *************** *** 321,327 **** --- 345,355 ---- name = current_directory; goto append; } + #if defined (__EMX__) + else if (PATHSEP (p[-2])) + #else else if (p[-2] == '/') + #endif { if (p - name == 2) { *************** *** 343,350 **** --- 371,383 ---- if (name[0] == '~') name = tilde_expand (name); + #if defined (__EMX__) + else if (name[0] != '$') + name = absfname (name); + #else else if (name[0] != '/' && name[0] != '$') name = concat (current_directory, "/", name, NULL); + #endif else name = savestring (name, p - name); make_cleanup (free, name); *************** *** 378,384 **** --- 411,421 ---- while (1) { if (!strncmp (p, name, len) + #if defined (__EMX__) + && (p[len] == '\0' || p[len] == ';')) + #else && (p[len] == '\0' || p[len] == ':')) + #endif { /* Found it in the search path, remove old copy */ if (p > *which_path) *************** *** 387,393 **** --- 424,434 ---- goto skip_dup; /* Same dir twice in one cmd */ strcpy (p, &p[len+1]); /* Copy from next \0 or : */ } + #if defined (__EMX_) + p = strchr (p, ';'); + #else p = strchr (p, ':'); + #endif if (p != 0) ++p; else *************** *** 402,408 **** --- 443,453 ---- c = old[prefix]; old[prefix] = '\0'; + #if defined (__EMX__) + temp = concat (old, ";", name, NULL); + #else temp = concat (old, ":", name, NULL); + #endif old[prefix] = c; *which_path = concat (temp, "", &old[prefix], NULL); prefix = strlen (temp); *************** *** 410,416 **** --- 455,465 ---- } else { + #if defined (__EMX__) + *which_path = concat (name, (old[0]? ";" : old), old, NULL); + #else *which_path = concat (name, (old[0]? ":" : old), old, NULL); + #endif prefix = strlen (name); } free (old); *************** *** 503,509 **** --- 552,562 ---- fd = -1; for (p = path; p; p = p1 ? p1 + 1 : 0) { + #if defined (__EMX__) + p1 = (char *) strchr (p, ';'); + #else p1 = (char *) strchr (p, ':'); + #endif if (p1) len = p1 - p; else *************** *** 529,535 **** --- 582,592 ---- } /* Remove trailing slashes */ + #if defined (__EMX__) + while (len > 1 && PATHSEP (filename[len-1])) + #else while (len > 0 && filename[len-1] == '/') + #endif filename[--len] = 0; strcat (filename+len, "/"); *************** *** 543,551 **** --- 600,615 ---- if (filename_opened) if (fd < 0) *filename_opened = (char *) 0; + #if defined (__EMX__) + else if (ABSPATH (filename)) + #else else if (filename[0] == '/') + #endif *filename_opened = savestring (filename, strlen (filename)); else + #if defined (__EMX__) + *filename_opened = absfname (filename); + #else { /* Beware the // my son, the Emacs barfs, the botch that catch... */ *************** *** 553,558 **** --- 617,623 ---- '/' == current_directory[strlen(current_directory)-1]? "": "/", filename, NULL); } + #endif return fd; } *************** *** 572,578 **** --- 637,647 ---- /* Quick way out if we already know its full name */ if (s->fullname) { + #if defined (__EMX__) + result = open (s->fullname, O_RDONLY | O_BINARY); + #else result = open (s->fullname, O_RDONLY); + #endif if (result >= 0) return result; /* Didn't work -- free old one, try again. */ *************** *** 587,594 **** --- 656,668 ---- /* We cast strstr's result in case an ANSIhole has made it const, which produces a "required warning" when assigned to a nonconst. */ p = (char *)strstr (source_path, "$cdir"); + #if defined (__EMX_) + if (p && (p == path || p[-1] == ';') + && (p[cdir_len] == ';' || p[cdir_len] == '\0')) { + #else if (p && (p == path || p[-1] == ':') && (p[cdir_len] == ':' || p[cdir_len] == '\0')) { + #endif int len; path = (char *) *************** *** 600,612 **** --- 674,694 ---- } } + #if defined (__EMX__) + result = openp (path, 0, s->filename, O_RDONLY | O_BINARY, 0, &s->fullname); + #else result = openp (path, 0, s->filename, O_RDONLY, 0, &s->fullname); + #endif if (result < 0) { /* Didn't work. Try using just the basename. */ p = basename (s->filename); if (p != s->filename) + #if defined (__EMX__) + result = openp(path, 0, p, O_RDONLY|O_BINARY,0, &s->fullname); + #else result = openp(path, 0, p, O_RDONLY,0, &s->fullname); + #endif } if (result >= 0) { *************** *** 804,810 **** --- 886,896 ---- if (line > s->nlines) /* Don't index off the end of the line_charpos array. */ return 0; + #ifdef __EMX__ + printf ("\032\032%s;%d;%d;%s:0x%lx\n", s->fullname, + #else printf ("\032\032%s:%d:%d:%s:0x%lx\n", s->fullname, + #endif line, s->line_charpos[line - 1], mid_statement ? "middle" : "beg", (unsigned long) pc); *************** *** 872,877 **** --- 958,967 ---- printf_filtered ("%d\t", current_source_line++); do { + #if defined (__EMX__) + if (c == '\r') + ; else + #endif if (c < 040 && c != '\t' && c != '\n' && c != '\r') printf_filtered ("^%c", c + 0100); else if (c == 0177) *************** *** 1224,1229 **** --- 1314,1322 ---- if (c == EOF) break; do { + #if defined (__EMX__) + if (c != '\r') + #endif *p++ = c; } while (c != '\n' && (c = getc (stream)) >= 0); *************** *** 1297,1302 **** --- 1390,1398 ---- if (c == EOF) break; do { + #if defined (__EMX__) + if (c != '\r') + #endif *p++ = c; } while (c != '\n' && (c = getc (stream)) >= 0); diff -cr gdb-4.11/symtab.c d:gdb-4.11/symtab.c *** gdb-4.11/symtab.c Fri Oct 29 06:32:28 1993 --- d:gdb-4.11/symtab.c Thu Nov 04 15:35:34 1993 *************** *** 1,3 **** --- 1,5 ---- + /* symtab.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Symbol table lookup for the GNU debugger, GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. *************** *** 1727,1732 **** --- 1729,1747 ---- if (p[0] == ':' || p[0] == ' ' || p[0] == '\t') break; } + #if defined (__EMX__) + if (p == *argptr + 1 && p[0] == ':' && p[1] != ':' + && isascii (p[-1]) && isalpha (p[-1])) + { + int i; + + for (i = 1; p[i] != 0; ++i) + if (p[i] == ' ' || p[i] == '\t' || p[i] == ':') + break; + if (p[i] == ':') + p = p + i; + } + #endif while (p[0] == ' ' || p[0] == '\t') p++; if ((p[0] == ':') && !is_quoted) diff -cr gdb-4.11/terminal.h d:gdb-4.11/terminal.h *** gdb-4.11/terminal.h Fri Oct 29 06:32:28 1993 --- d:gdb-4.11/terminal.h Thu Nov 04 15:35:34 1993 *************** *** 1,3 **** --- 1,5 ---- + /* terminal.h -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Terminal interface definitions for GDB, the GNU Debugger. Copyright 1986, 1989, 1991, 1992 Free Software Foundation, Inc. *************** *** 36,42 **** --- 38,48 ---- #undef TIOCSETN #define TIOCSETN TCSETA #undef TIOCSETP + #if defined (__EMX__) + #define TIOCSETP TCSETA + #else #define TIOCSETP TCSETAF + #endif #define TERMINAL struct termio #else /* sgtty */ diff -cr gdb-4.11/utils.c d:gdb-4.11/utils.c *** gdb-4.11/utils.c Fri Oct 29 06:32:30 1993 --- d:gdb-4.11/utils.c Thu Nov 04 15:35:36 1993 *************** *** 1,3 **** --- 1,5 ---- + /* utils.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* General utility routines for GDB, the GNU debugger. Copyright 1986, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. *************** *** 62,67 **** --- 64,73 ---- #define ISATTY(FP) (isatty (fileno (FP))) #endif + #if defined (__EMX__) + extern FILE *gdbrxStream; + #endif + /* Chain of cleanup actions established with make_cleanup, to be executed if an error happens. */ *************** *** 464,469 **** --- 470,478 ---- { quit_flag = 1; + #if defined (__EMX__) + signal (SIGINT, SIG_ACK); + #endif #ifdef USG /* Restore the signal handler. */ signal (signo, request_quit); *************** *** 956,968 **** --- 965,984 ---- prompt_for_continue () { char *ignore; + #if defined (__EMX__) + int old_quit; + #endif /* We must do this *before* we call gdb_readline, else it will eventually call us -- thinking that we're trying to print beyond the end of the screen. */ reinitialize_more_filter (); + #if defined (__EMX__) + old_quit = immediate_quit; immediate_quit = 0; + #else immediate_quit++; + #endif /* On a real operating system, the user can quit with SIGINT. But not on GO32. *************** *** 981,987 **** --- 997,1007 ---- request_quit (SIGINT); free (ignore); } + #if defined (__EMX__) + immediate_quit = old_quit; + #else immediate_quit--; + #endif /* Now we have to do this again, so that GDB will know that it doesn't need to save the ---Type --- line at the top of the screen. */ *************** *** 1085,1090 **** --- 1105,1118 ---- if (linebuffer == 0) return; + + #if defined (__EMX__) + if ((stream == stdout || stream == stderr) && gdbrxStream != NULL) + { + fputs (linebuffer, gdbrxStream); + return; + } + #endif /* Don't do any filtering if it is disabled. */ if (stream != stdout *************** *** 1538,1543 **** --- 1566,1596 ---- &setprintlist), &showprintlist); } + + #if defined (__EMX__) + + char * + absfname (filename) + char *filename; + { + char tmp[512]; + + if (_fullpath (tmp, filename, sizeof (tmp)) == 0) + { + strlwr (tmp); + filename = tmp; + } + return strsave (filename); + } + + char * + tilde_expand (filename) + char *filename; + { + return (strsave (filename)); + } + + #endif /* Machine specific function to handle SIGWINCH signal. */ diff -cr bfd/emx-aout.c d:bfd/emx-aout.c *** bfd/emx-aout.c Fri Oct 29 06:37:00 1993 --- d:bfd/emx-aout.c Sat Jun 19 17:30:02 1993 *************** *** 1,4 **** ! /* BFD back-end for i386 a.out binaries. Copyright 1990, 1991, 1992 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. --- 1,4 ---- ! /* BFD back-end for emx a.out binaries, derived from i386aout.c and aout-target.h Copyright 1990, 1991, 1992 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. *************** *** 28,56 **** #define BYTES_IN_WORD 4 #define ARCH 32 ! #define N_TXTOFF(x) 0x20 ! #define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) ! #define N_TXTSIZE(x) ((x).a_text) ! #if 0 ! #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) ! #define NOSUBEXECB ! ! #endif ! #define PAGE_SIZE 4096 ! #define SEGMENT_SIZE 0x400000 ! #define DEFAULT_ARCH bfd_arch_i386 ! ! #define MY(OP) CAT(i386aout_,OP) ! #define TARGETNAME "a.out-i386" #define NO_WRITE_HEADER_KLUDGE 1 #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "libaout.h" ! static boolean MY(set_sizes)(); #define MY_backend_data &MY(backend_data) static CONST struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ --- 28,57 ---- #define BYTES_IN_WORD 4 #define ARCH 32 ! #define PAGE_SIZE 0x1000 ! #define SEGMENT_SIZE 0x10000 ! #define TEXT_START_ADDR 0x10000 ! #define DEFAULT_ARCH bfd_arch_i386 ! #define MY(OP) CAT(emx_aout_,OP) ! #define TARGETNAME "a.out-emx" #define NO_WRITE_HEADER_KLUDGE 1 + #define MY_object_p MY(object_p) + #include "bfd.h" + + static PROTO (bfd_target *, MY(callback), (bfd *abfd)); + static PROTO (bfd_target *, MY(object_p), (bfd *abfd)); + #include "sysdep.h" #include "libbfd.h" #include "libaout.h" ! #define MY_backend_data &MY(backend_data) + static boolean MY(set_sizes)(); + + static CONST struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ *************** *** 60,62 **** --- 61,93 ---- }; #include "aout-target.h" + + /* Finish up the reading of an a.out file header */ + + static bfd_target * + DEFUN(MY(object_p),(abfd), + bfd *abfd) + { + struct external_exec exec_bytes; /* Raw exec header from file */ + struct internal_exec exec; /* Cleaned-up exec header */ + bfd_target *target; + long org_pos, add; + + org_pos = bfd_tell (abfd); + (void)_fseek_hdr(bfd_cache_lookup(abfd)); + add = bfd_tell (abfd) - org_pos; + if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) + != EXEC_BYTES_SIZE) { + bfd_error = wrong_format; + return 0; + } + + exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); + + if (N_BADMAG (exec)) return 0; + + NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec); + exec.emx_add = add; + target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback)); + return target; + } diff -cr bfd/libaout.h d:bfd/libaout.h *** bfd/libaout.h Fri Oct 29 06:37:02 1993 --- d:bfd/libaout.h Thu Nov 04 15:35:36 1993 *************** *** 1,3 **** --- 1,5 ---- + /* libaout.h -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* BFD back-end data structures for a.out (and similar) files. Copyright 1990, 1991, 1992 Free Software Foundation, Inc. Written by Cygnus Support. *************** *** 90,95 **** --- 92,100 ---- struct internal_exec { long a_info; /* Magic number and flags, packed */ + #if defined (__EMX__) + long emx_add; + #endif bfd_vma a_text; /* length of text, in bytes */ bfd_vma a_data; /* length of data, in bytes */ bfd_vma a_bss; /* length of uninitialized data area in mem */ diff -cr bfd/targets.c d:bfd/targets.c *** bfd/targets.c Fri Oct 29 06:40:24 1993 --- d:bfd/targets.c Thu Nov 18 14:13:56 1993 *************** *** 1,3 **** --- 1,5 ---- + /* targets.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Generic target-file-type support for the BFD library. Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Written by Cygnus Support. *************** *** 345,350 **** --- 347,355 ---- extern bfd_target ecoff_big_vec; extern bfd_target ecoff_little_vec; extern bfd_target ecoffalpha_little_vec; + #ifdef __EMX__ + extern bfd_target emx_aout_vec; + #endif extern bfd_target h8300coff_vec; extern bfd_target h8500coff_vec; extern bfd_target host_aout_vec; diff -cr bfd/trad-cor.c d:bfd/trad-cor.c *** bfd/trad-cor.c Fri Oct 29 06:37:10 1993 --- d:bfd/trad-cor.c Thu Nov 04 17:03:38 1993 *************** *** 1,3 **** --- 1,5 ---- + /* trad-cor.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* BFD back end for traditional Unix core files (U-area and raw sections) Copyright 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. Written by John Gilmore of Cygnus Support. *************** *** 51,56 **** --- 53,61 ---- struct trad_core_struct { asection *data_section; + #ifdef __EMX__ + asection *heap_section; + #endif /* __EMX__ */ asection *stack_section; asection *reg_section; struct user u; *************** *** 58,63 **** --- 63,71 ---- #define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u)) #define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section) + #ifdef __EMX__ + #define core_heapsec(bfd) ((bfd)->tdata.trad_core_data->heap_section) + #endif /* __EMX__ */ #define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section) #define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section) *************** *** 95,100 **** --- 103,112 ---- } /* Sanity check perhaps??? */ + #ifdef __EMX__ + if (u.u_magic != UMAGIC) + return 0; + #else /* !__EMX__ */ if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */ { bfd_error = wrong_format; *************** *** 135,140 **** --- 147,153 ---- return 0; } } + #endif /* !__EMX__ */ /* OK, we believe you. You're a core file (sure, sure). */ *************** *** 169,192 **** } core_regsec (abfd) = (asection *) zalloc (sizeof (asection)); if (core_regsec (abfd) == NULL) { free ((void *)core_datasec (abfd)); goto loser1; } core_stacksec (abfd)->name = ".stack"; core_datasec (abfd)->name = ".data"; core_regsec (abfd)->name = ".reg"; core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS; ! core_datasec (abfd)->_raw_size = NBPG * u.u_dsize; core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize; core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */ /* What a hack... we'd like to steal it from the exec file, since the upage does not seem to provide it. FIXME. */ #ifdef HOST_DATA_START_ADDR core_datasec (abfd)->vma = HOST_DATA_START_ADDR; #else --- 182,233 ---- } core_regsec (abfd) = (asection *) zalloc (sizeof (asection)); if (core_regsec (abfd) == NULL) { + #ifdef __EMX__ + loser2: + #endif /* __EMX__ */ free ((void *)core_datasec (abfd)); goto loser1; } + #ifdef __EMX__ + core_heapsec (abfd) = (asection *) zalloc (sizeof (asection)); + if (core_heapsec (abfd) == NULL) { + free ((void *)core_regsec (abfd)); + goto loser2; + } + #endif /* __EMX__ */ core_stacksec (abfd)->name = ".stack"; core_datasec (abfd)->name = ".data"; + #ifdef __EMX__ + core_heapsec (abfd)->name = ".heap"; + #endif /* __EMX__ */ core_regsec (abfd)->name = ".reg"; core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS; ! #ifdef __EMX__ ! core_heapsec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; ! #endif /* __EMX__ */ ! ! #ifdef __EMX__ ! core_datasec (abfd)->_raw_size = u.u_data_end - u.u_data_base; ! core_heapsec (abfd)->_raw_size = u.u_heap_brk - u.u_heap_base; ! core_stacksec (abfd)->_raw_size = u.u_stack_end - u.u_stack_low; ! core_regsec (abfd)->_raw_size = sizeof (struct user); ! #else /* !__EMX__ */ core_datasec (abfd)->_raw_size = NBPG * u.u_dsize; core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize; core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */ + #endif /* !__EMX__ */ /* What a hack... we'd like to steal it from the exec file, since the upage does not seem to provide it. FIXME. */ + #ifdef __EMX__ + core_datasec (abfd)->vma = u.u_data_base; + core_heapsec (abfd)->vma = u.u_heap_base; + core_stacksec (abfd)->vma = u.u_stack_low; + #else /* !__EMX__ */ #ifdef HOST_DATA_START_ADDR core_datasec (abfd)->vma = HOST_DATA_START_ADDR; #else *************** *** 198,203 **** --- 239,245 ---- #else core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize); #endif + #endif /* !__EMX__*/ /* This is tricky. As the "register section", we give them the entire upage and stack. u.u_ar0 points to where "register 0" is stored. *************** *** 215,237 **** --- 257,293 ---- using minor trickery to get around the offset-or-absolute-addr problem. */ core_regsec (abfd)->vma = 0 - (int) u.u_ar0; + #ifdef __EMX__ + core_datasec (abfd)->filepos = u.u_data_off; + core_heapsec (abfd)->filepos = u.u_heap_off; + core_stacksec (abfd)->filepos = u.u_stack_off; + #else /* !__EMX__ */ core_datasec (abfd)->filepos = NBPG * UPAGES; #ifdef TRAD_CORE_STACK_FILEPOS core_stacksec (abfd)->filepos = TRAD_CORE_STACK_FILEPOS; #else core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize; #endif + #endif /* !__EMX__ */ core_regsec (abfd)->filepos = 0; /* Register segment is the upage */ /* Align to word at least */ core_stacksec (abfd)->alignment_power = 2; core_datasec (abfd)->alignment_power = 2; + #ifdef __EMX__ + core_heapsec (abfd)->alignment_power = 2; + #endif /* __EMX__ */ core_regsec (abfd)->alignment_power = 2; abfd->sections = core_stacksec (abfd); core_stacksec (abfd)->next = core_datasec (abfd); core_datasec (abfd)->next = core_regsec (abfd); + #ifdef __EMX__ + core_regsec (abfd)->next = core_heapsec (abfd); + abfd->section_count = 4; + #else /* !__EMX__ */ abfd->section_count = 3; + #endif /* !__EMX__ */ return abfd->xvec; } diff -cr libibert/argv.c d:libibert/argv.c *** libibert/argv.c Fri Oct 29 06:37:56 1993 --- d:libibert/argv.c Thu Nov 04 15:35:38 1993 *************** *** 1,3 **** --- 1,5 ---- + /* argv.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Create and destroy argument vectors (argv's) Copyright (C) 1992 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support *************** *** 40,46 **** --- 42,50 ---- #define isspace(ch) ((ch) == ' ' || (ch) == '\t') + #if !defined (__EMX__) #include "alloca-conf.h" + #endif /* Routines imported from standard C runtime libraries. */ diff -cr libibert/strsigna.c d:libibert/strsigna.c *** libibert/strsigna.c Fri Oct 29 06:38:02 1993 --- d:libibert/strsigna.c Thu Nov 04 15:47:26 1993 *************** *** 1,3 **** --- 1,5 ---- + /* strsigna.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* Extended support for using signal values. Copyright (C) 1992 Free Software Foundation, Inc. Written by Fred Fish. fnf@cygnus.com *************** *** 20,26 **** --- 22,30 ---- #include + #if !defined (__EMX__) #include "config.h" + #endif #ifdef LOSING_SYS_SIGLIST #define sys_siglist no_such_symbol *************** *** 220,225 **** --- 224,234 ---- #endif #if defined (SIGSAK) {SIGSAK, "SIGSAK", "Secure attention"}, + #endif + #if defined (__EMX__) + #if defined (SIGBREAK) + {SIGBREAK, "BREAK", "Break"}, + #endif #endif {0, NULL, NULL} }; diff -cr readline/emacs_ke.c d:readline/emacs_ke.c *** readline/emacs_ke.c Fri Oct 29 06:37:38 1993 --- d:readline/emacs_ke.c Thu Nov 04 15:35:38 1993 *************** *** 1,3 **** --- 1,5 ---- + /* emacs_ke.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* emacs_keymap.c -- the keymap for emacs_mode in readline (). */ /* Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. *************** *** 26,32 **** --- 28,38 ---- KEYMAP_ENTRY_ARRAY emacs_standard_keymap = { /* Control keys. */ + #if defined (__EMX__) + { ISKMAP, (Function *)emacs_emx_keymap }, /* Control-@ */ + #else { ISFUNC, (Function *)0x0 }, /* Control-@ */ + #endif { ISFUNC, rl_beg_of_line }, /* Control-a */ { ISFUNC, rl_backward }, /* Control-b */ { ISFUNC, (Function *)0x0 }, /* Control-c */ *************** *** 464,466 **** --- 470,607 ---- { ISFUNC, (Function *)0x0 }, /* ~ */ { ISFUNC, rl_backward_kill_line } /* RUBOUT */ }; + + #if defined (__EMX__) + + KEYMAP_ENTRY_ARRAY emacs_emx_keymap = { + { ISFUNC, (Function *)0x0 }, /* 0 */ + { ISFUNC, (Function *)0x0 }, /* 1 */ + { ISFUNC, (Function *)0x0 }, /* 2 */ + { ISFUNC, (Function *)0x0 }, /* 3 */ + { ISFUNC, (Function *)0x0 }, /* 4 */ + { ISFUNC, (Function *)0x0 }, /* 5 */ + { ISFUNC, (Function *)0x0 }, /* 6 */ + { ISFUNC, (Function *)0x0 }, /* 7 */ + { ISFUNC, (Function *)0x0 }, /* 8 */ + { ISFUNC, (Function *)0x0 }, /* 9 */ + { ISFUNC, (Function *)0x0 }, /* 10 */ + { ISFUNC, (Function *)0x0 }, /* 11 */ + { ISFUNC, (Function *)0x0 }, /* 12 */ + { ISFUNC, (Function *)0x0 }, /* 13 */ + { ISFUNC, (Function *)0x0 }, /* 14 */ + { ISFUNC, (Function *)0x0 }, /* 15 */ + { ISFUNC, (Function *)0x0 }, /* 16 */ + { ISFUNC, (Function *)0x0 }, /* 17 */ + { ISFUNC, (Function *)0x0 }, /* 18 */ + { ISFUNC, (Function *)0x0 }, /* 19 */ + { ISFUNC, (Function *)0x0 }, /* 20 */ + { ISFUNC, (Function *)0x0 }, /* 21 */ + { ISFUNC, (Function *)0x0 }, /* 22 */ + { ISFUNC, (Function *)0x0 }, /* 23 */ + { ISFUNC, (Function *)0x0 }, /* 24 */ + { ISFUNC, (Function *)0x0 }, /* 25 */ + { ISFUNC, (Function *)0x0 }, /* 26 */ + { ISFUNC, (Function *)0x0 }, /* 27 */ + { ISFUNC, (Function *)0x0 }, /* 28 */ + { ISFUNC, (Function *)0x0 }, /* 29 */ + { ISFUNC, (Function *)0x0 }, /* 30 */ + { ISFUNC, (Function *)0x0 }, /* 31 */ + { ISFUNC, (Function *)0x0 }, /* 32 */ + { ISFUNC, (Function *)0x0 }, /* 33 */ + { ISFUNC, (Function *)0x0 }, /* 34 */ + { ISFUNC, (Function *)0x0 }, /* 35 */ + { ISFUNC, (Function *)0x0 }, /* 36 */ + { ISFUNC, (Function *)0x0 }, /* 37 */ + { ISFUNC, (Function *)0x0 }, /* 38 */ + { ISFUNC, (Function *)0x0 }, /* 39 */ + { ISFUNC, (Function *)0x0 }, /* 40 */ + { ISFUNC, (Function *)0x0 }, /* 41 */ + { ISFUNC, (Function *)0x0 }, /* 42 */ + { ISFUNC, (Function *)0x0 }, /* 43 */ + { ISFUNC, (Function *)0x0 }, /* 44 */ + { ISFUNC, (Function *)0x0 }, /* 45 */ + { ISFUNC, (Function *)0x0 }, /* 46 */ + { ISFUNC, (Function *)0x0 }, /* 47 */ + { ISFUNC, (Function *)0x0 }, /* 48 */ + { ISFUNC, (Function *)0x0 }, /* 49 */ + { ISFUNC, (Function *)0x0 }, /* 50 */ + { ISFUNC, (Function *)0x0 }, /* 51 */ + { ISFUNC, (Function *)0x0 }, /* 52 */ + { ISFUNC, (Function *)0x0 }, /* 53 */ + { ISFUNC, (Function *)0x0 }, /* 54 */ + { ISFUNC, (Function *)0x0 }, /* 55 */ + { ISFUNC, (Function *)0x0 }, /* 56 */ + { ISFUNC, (Function *)0x0 }, /* 57 */ + { ISFUNC, (Function *)0x0 }, /* 58 */ + { ISFUNC, (Function *)0x0 }, /* 59 */ + { ISFUNC, (Function *)0x0 }, /* 60 */ + { ISFUNC, (Function *)0x0 }, /* 61 */ + { ISFUNC, (Function *)0x0 }, /* 62 */ + { ISFUNC, (Function *)0x0 }, /* 63 */ + { ISFUNC, (Function *)0x0 }, /* 64 */ + { ISFUNC, (Function *)0x0 }, /* 65 */ + { ISFUNC, (Function *)0x0 }, /* 66 */ + { ISFUNC, (Function *)0x0 }, /* 67 */ + { ISFUNC, (Function *)0x0 }, /* 68 */ + { ISFUNC, (Function *)0x0 }, /* 69 */ + { ISFUNC, (Function *)0x0 }, /* 70 */ + { ISFUNC, rl_beg_of_line }, /* 71: home */ + { ISFUNC, rl_get_previous_history }, /* 72: cursor up */ + { ISFUNC, rl_beginning_of_history }, /* 73: page up */ + { ISFUNC, (Function *)0x0 }, /* 74 */ + { ISFUNC, rl_backward }, /* 75: cursor left */ + { ISFUNC, (Function *)0x0 }, /* 76: center cursor */ + { ISFUNC, rl_forward }, /* 77: cursor right */ + { ISFUNC, (Function *)0x0 }, /* 78 */ + { ISFUNC, rl_end_of_line }, /* 79: end */ + { ISFUNC, rl_get_next_history }, /* 80: cursor down */ + { ISFUNC, rl_end_of_history }, /* 81: page down */ + { ISFUNC, (Function *)0x0 }, /* 82: ins */ + { ISFUNC, rl_delete }, /* 83: del */ + { ISFUNC, (Function *)0x0 }, /* 84 */ + { ISFUNC, (Function *)0x0 }, /* 85 */ + { ISFUNC, (Function *)0x0 }, /* 86 */ + { ISFUNC, (Function *)0x0 }, /* 87 */ + { ISFUNC, (Function *)0x0 }, /* 88 */ + { ISFUNC, (Function *)0x0 }, /* 89 */ + { ISFUNC, (Function *)0x0 }, /* 90 */ + { ISFUNC, (Function *)0x0 }, /* 91 */ + { ISFUNC, (Function *)0x0 }, /* 92 */ + { ISFUNC, (Function *)0x0 }, /* 93 */ + { ISFUNC, (Function *)0x0 }, /* 94 */ + { ISFUNC, (Function *)0x0 }, /* 95 */ + { ISFUNC, (Function *)0x0 }, /* 96 */ + { ISFUNC, (Function *)0x0 }, /* 97 */ + { ISFUNC, (Function *)0x0 }, /* 98 */ + { ISFUNC, (Function *)0x0 }, /* 99 */ + { ISFUNC, (Function *)0x0 }, /* 100 */ + { ISFUNC, (Function *)0x0 }, /* 101 */ + { ISFUNC, (Function *)0x0 }, /* 102 */ + { ISFUNC, (Function *)0x0 }, /* 103 */ + { ISFUNC, (Function *)0x0 }, /* 104 */ + { ISFUNC, (Function *)0x0 }, /* 105 */ + { ISFUNC, (Function *)0x0 }, /* 106 */ + { ISFUNC, (Function *)0x0 }, /* 107 */ + { ISFUNC, (Function *)0x0 }, /* 108 */ + { ISFUNC, (Function *)0x0 }, /* 109 */ + { ISFUNC, (Function *)0x0 }, /* 110 */ + { ISFUNC, (Function *)0x0 }, /* 111 */ + { ISFUNC, (Function *)0x0 }, /* 112 */ + { ISFUNC, (Function *)0x0 }, /* 113 */ + { ISFUNC, (Function *)0x0 }, /* 114 */ + { ISFUNC, rl_backward_word }, /* 115: ctrl cursor left */ + { ISFUNC, rl_forward_word }, /* 116: ctrl cursor right */ + { ISFUNC, rl_kill_line }, /* 117: ctrl end */ + { ISFUNC, (Function *)0x0 }, /* 118: ctrl page down */ + { ISFUNC, rl_backward_kill_line },/* 119: ctrl home */ + { ISFUNC, (Function *)0x0 }, /* 120: alt 1 */ + { ISFUNC, (Function *)0x0 }, /* 121 */ + { ISFUNC, (Function *)0x0 }, /* 122 */ + { ISFUNC, (Function *)0x0 }, /* 123 */ + { ISFUNC, (Function *)0x0 }, /* 124 */ + { ISFUNC, (Function *)0x0 }, /* 125 */ + { ISFUNC, (Function *)0x0 }, /* 126 */ + { ISFUNC, (Function *)0x0 }, /* 127 */ + }; + + #endif diff -cr readline/history.c d:readline/history.c *** readline/history.c Fri Oct 29 06:37:38 1993 --- d:readline/history.c Thu Nov 04 15:35:40 1993 *************** *** 1,3 **** --- 1,5 ---- + /* history.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* History.c -- standalone history library */ /* Copyright (C) 1989, 1991 Free Software Foundation, Inc. *************** *** 420,427 **** --- 422,434 ---- { char *home = (char *)getenv ("HOME"); if (!home) home = "."; + #if defined (__EMX__) + return_val = (char *)xmalloc (2 + strlen (home) + strlen ("!history")); + sprintf (return_val, "%s/!history", home); + #else return_val = (char *)xmalloc (2 + strlen (home) + strlen (".history")); sprintf (return_val, "%s/.history", home); + #endif } return (return_val); } diff -cr readline/keymaps.h d:readline/keymaps.h *** readline/keymaps.h Fri Oct 29 06:37:38 1993 --- d:readline/keymaps.h Sat Jun 19 17:30:08 1993 *************** *** 1,3 **** --- 1,5 ---- + /* keymaps.h -- changed for emx by Eberhard Mattes -- Nov 1992 */ + /* keymaps.h -- Manipulation of readline keymaps. */ #ifndef _KEYMAPS_H_ *************** *** 34,39 **** --- 36,44 ---- #define ISMACR 2 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; + #if defined (__EMX__) + extern KEYMAP_ENTRY_ARRAY emacs_emx_keymap; + #endif extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; /* Return a new, empty keymap. diff -cr readline/readline.c d:readline/readline.c *** readline/readline.c Fri Oct 29 06:37:40 1993 --- d:readline/readline.c Thu Nov 04 15:35:48 1993 *************** *** 1,3 **** --- 1,5 ---- + /* readline.c -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* readline.c -- a general facility for reading lines of input with emacs style editing and completion. */ *************** *** 23,33 **** --- 25,39 ---- /* Remove these declarations when we have a complete libgnu.a. */ /* #define STATIC_MALLOC */ + #if defined (TEST) + char *xmalloc(), *xrealloc(); + #else #if !defined (STATIC_MALLOC) extern char *xmalloc (), *xrealloc (); #else static char *xmalloc (), *xrealloc (); #endif /* STATIC_MALLOC */ + #endif #include "sysdep.h" #include *************** *** 41,48 **** --- 47,60 ---- # include #endif + #if defined (__EMX__) + #include + #else #define NEW_TTY_DRIVER + #endif + #if !defined (__EMX__) #define HAVE_BSD_SIGNALS + #endif /* #define USE_XON_XOFF */ #ifdef __MSDOS__ *************** *** 603,609 **** rl_deprep_terminal (); rl_clear_signals (); rl_pending_input = 0; ! kill (getpid (), sig); SIGNALS_UNBLOCK; --- 615,623 ---- rl_deprep_terminal (); rl_clear_signals (); rl_pending_input = 0; ! #if defined (__EMX__) ! signal (sig, SIG_ACK); ! #endif kill (getpid (), sig); SIGNALS_UNBLOCK; *************** *** 2463,2468 **** --- 2477,2483 ---- static void rl_deprep_terminal () { + #if !defined (__EMX__) #ifndef __GO32__ int tty = fileno (rl_instream); SIGNALS_DECLARE_SAVED (saved_signals); *************** *** 2491,2496 **** --- 2506,2512 ---- SIGNALS_RESTORE (saved_signals); #endif /* !__GO32 */ + #endif } #else /* !defined (NEW_TTY_DRIVER) */ *************** *** 2541,2546 **** --- 2557,2565 ---- readline_echoing_p = (tio.c_lflag & ECHO); + #if defined (__EMX__) + tio.c_lflag &= ~IDEFAULT; + #endif tio.c_lflag &= ~(ICANON|ECHO); if (otio.c_cc[VEOF] != _POSIX_VDISABLE) *************** *** 2591,2597 **** --- 2610,2618 ---- tcflow (tty, TCOON); /* Simulate a ^Q. */ #else ioctl (tty, TCSETAW, &tio); + #if !defined (__EMX__) ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */ + #endif #endif /* !TERMIOS_TTY_DRIVER */ terminal_prepped = 1; *************** *** 2620,2626 **** --- 2641,2649 ---- tcflow (tty, TCOON); /* Simulate a ^Q. */ #else /* TERMIOS_TTY_DRIVER */ ioctl (tty, TCSETAW, &otio); + #if !defined (__EMX__) ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */ + #endif #endif /* !TERMIOS_TTY_DRIVER */ terminal_prepped = 0; *************** *** 6542,6548 **** } } ! #if defined (STATIC_MALLOC) /* **************************************************************** */ /* */ --- 6565,6571 ---- } } ! #if defined (STATIC_MALLOC) || defined (TEST) /* **************************************************************** */ /* */ *************** *** 6552,6558 **** static void memory_error_and_abort (); ! static char * xmalloc (bytes) int bytes; { --- 6575,6584 ---- static void memory_error_and_abort (); ! #if defined (STATIC_MALLOC) ! static ! #endif ! char * xmalloc (bytes) int bytes; { *************** *** 6563,6569 **** return (temp); } ! static char * xrealloc (pointer, bytes) char *pointer; int bytes; --- 6589,6598 ---- return (temp); } ! #if defined (STATIC_MALLOC) ! static ! #endif ! char * xrealloc (pointer, bytes) char *pointer; int bytes; *************** *** 6587,6593 **** fprintf (stderr, "readline: Out of virtual memory!\n"); abort (); } ! #endif /* STATIC_MALLOC */ /* **************************************************************** */ --- 6616,6622 ---- fprintf (stderr, "readline: Out of virtual memory!\n"); abort (); } ! #endif /* STATIC_MALLOC || TEST*/ /* **************************************************************** */ diff -cr readline/sysdep.h d:readline/sysdep.h *** readline/sysdep.h Fri Oct 29 06:37:40 1993 --- d:readline/sysdep.h Thu Nov 04 15:35:50 1993 *************** *** 1,3 **** --- 1,5 ---- + /* sysdep.h -- changed for emx by Eberhard Mattes -- Nov 1993 */ + /* System-dependent stuff, for ``normal'' systems */ /* If you think you need to change this file, then you are wrong. In order to avoid a huge ugly mass of nested #ifdefs, you should create a new file just *************** *** 28,33 **** --- 30,42 ---- #include typedef struct dirent dirent; + + #include + + #if !defined (__EMX__) + #define __EMX__ + #endif + #define _POSIX_VDISABLE 0 /* SVR4 systems should use rather than . */