Mercurial > emacs
diff src/msdos.c @ 14974:b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
(_crt0_startup_flags): Initialize it.
(internal_terminal_init): Change handling of EMACSCOLORS.
(init_environment): Call tzset, not init_gettimeofday.
(ctrl_break_vector, ctrl_break_regs): Don't define if DJGPP v2.
(ctrl_break_func, install_ctrl_break_check): Don't define if DJGPP v2.
(dos_ttraw) [DJGPP v2]: Don't call install_ctrl_break_check.
Call setmode at the end and exit.
(dos_ttcooked): Call setmode at the end and exit.
(gethostname, gettimeofday): Don't define if DJGPP v2.
(alarm, fork, kill, nicr, pause, sigsetask): Don't define if DJGPP v2.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 10 Apr 1996 04:13:40 +0000 |
parents | e7b489e4f25d |
children | 3bafb8029b86 |
line wrap: on
line diff
--- a/src/msdos.c Wed Apr 10 04:10:47 1996 +0000 +++ b/src/msdos.c Wed Apr 10 04:13:40 1996 +0000 @@ -32,6 +32,10 @@ #include <sys/param.h> #include <sys/time.h> #include <dos.h> +#if __DJGPP__ >= 2 +#include <fcntl.h> +#endif + #include "dosfns.h" #include "msdos.h" #include "systime.h" @@ -47,6 +51,27 @@ /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ #define P_WAIT 1 +#if __DJGPP__ > 1 + +#ifndef SYSTEM_MALLOC + +#ifdef GNU_MALLOC + +/* If other `malloc' than ours is used, force our `sbrk' behave like + Unix programs expect (resize memory blocks to keep them contiguous). + If `sbrk' from `ralloc.c' is NOT used, also zero-out sbrk'ed memory, + because that's what `gmalloc' expects to get. */ +#include <crt0.h> + +#ifdef REL_ALLOC +int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK; +#else /* not REL_ALLOC */ +int _crt0_startup_flags = (_CRT0_FLAG_UNIX_SBRK | _CRT0_FLAG_FILL_SBRK_MEMORY); +#endif /* not REL_ALLOC */ +#endif /* GNU_MALLOC */ + +#endif /* not SYSTEM_MALLOC */ +#endif /* __DJGPP__ > 1 */ static unsigned long event_timestamp () @@ -862,8 +887,13 @@ colors = getenv ("EMACSCOLORS"); if (colors && strlen (colors) >= 2) { - the_only_x_display.foreground_pixel = colors[0] & 0x07; - the_only_x_display.background_pixel = colors[1] & 0x07; + /* Foreground colrs use 4 bits, background only 3. */ + if (isxdigit (colors[0]) && !isdigit (colors[0])) + colors[0] += 10 - (isupper (colors[0]) ? 'A' : 'a'); + if (colors[0] >= 0 && colors[0] < 16) + the_only_x_display.foreground_pixel = colors[0]; + if (colors[1] >= 0 && colors[1] < 8) + the_only_x_display.background_pixel = colors[1]; } the_only_x_display.line_height = 1; the_only_frame.output_data.x = &the_only_x_display; @@ -2226,7 +2256,7 @@ setenv ("TZ", "IST-02IDT-03,M4.1.6/00:00,M9.5.6/01:00", 0); break; } - init_gettimeofday (); + tzset (); } @@ -2234,6 +2264,8 @@ static int break_stat; /* BREAK check mode status. */ static int stdin_stat; /* stdin IOCTL status. */ +#if __DJGPP__ < 2 + /* These must be global. */ static _go32_dpmi_seginfo ctrl_break_vector; static _go32_dpmi_registers ctrl_break_regs; @@ -2263,6 +2295,8 @@ } } +#endif /* __DJGPP__ < 2 */ + /* Turn off Dos' Ctrl-C checking and inhibit interpretation of control chars by DOS. Determine the keyboard type. */ @@ -2274,7 +2308,9 @@ break_stat = getcbrk (); setcbrk (0); +#if __DJGPP__ < 2 install_ctrl_break_check (); +#endif if (first_time) { @@ -2325,9 +2361,24 @@ mouse_init (); } } - + first_time = 0; + +#if __DJGPP__ >= 2 + + stdin_stat = setmode (fileno (stdin), O_BINARY); + return (stdin_stat != -1); } + else + return (setmode (fileno (stdin), O_BINARY) != -1); + +#else /* __DJGPP__ < 2 */ + + } + + /* I think it is wrong to overwrite `stdin_stat' every time + but the first one this function is called, but I don't + want to change the way it used to work in v1.x.--EZ */ inregs.x.ax = 0x4400; /* Get IOCTL status. */ inregs.x.bx = 0x00; /* 0 = stdin. */ @@ -2338,6 +2389,8 @@ inregs.x.ax = 0x4401; /* Set IOCTL status */ intdos (&inregs, &outregs); return !outregs.x.cflag; + +#endif /* __DJGPP__ < 2 */ } /* Restore status of standard input and Ctrl-C checking. */ @@ -2350,11 +2403,19 @@ setcbrk (break_stat); mouse_off (); +#if __DJGPP__ >= 2 + + return (setmode (fileno (stdin), stdin_stat) != -1); + +#else /* not __DJGPP__ >= 2 */ + inregs.x.ax = 0x4401; /* Set IOCTL status. */ inregs.x.bx = 0x00; /* 0 = stdin. */ inregs.x.dx = stdin_stat; intdos (&inregs, &outregs); return !outregs.x.cflag; + +#endif /* not __DJGPP__ >= 2 */ } @@ -2473,6 +2534,8 @@ exit (1); } +#if __DJGPP__ < 2 + /* ------------------------- Compatibility functions ------------------- * gethostname * gettimeofday @@ -2532,20 +2595,24 @@ return 0; } +#endif /* __DJGPP__ < 2 */ /* * A list of unimplemented functions that we silently ignore. */ +#if __DJGPP__ < 2 unsigned alarm (s) unsigned s; {} fork () { return 0; } int kill (x, y) int x, y; { return -1; } nice (p) int p; {} void volatile pause () {} +sigsetmask (x) int x; { return 0; } +#endif + request_sigio () {} setpgrp () {return 0; } setpriority (x,y,z) int x,y,z; { return 0; } -sigsetmask (x) int x; { return 0; } sigblock (mask) int mask; { return 0; } unrequest_sigio () {}