X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f15c8583198c3d6c26ca0c0a5b6fb019f98d6c3c..02ca5db040b57ca4a36c317fcb3fb56f43ab371e:/src/msdos.c diff --git a/src/msdos.c b/src/msdos.c index 8b05b34795..73d755ae64 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1,13 +1,13 @@ /* MS-DOS specific C utilities. -*- coding: cp850 -*- -Copyright (C) 1993-1997, 1999-2015 Free Software Foundation, Inc. +Copyright (C) 1993-1997, 1999-2016 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -59,6 +59,12 @@ along with GNU Emacs. If not, see . */ #include /* for _USE_LFN */ #include /* for cputs */ +#if (__DJGPP__ + (__DJGPP_MINOR__ > 3)) >= 3 +#define SYS_ENVIRON _environ +#else +#define SYS_ENVIRON environ +#endif + #include "msdos.h" #include "systime.h" #include "frame.h" @@ -422,8 +428,6 @@ static unsigned long screen_old_address = 0; /* Segment and offset of the virtual screen. If 0, DOS/V is NOT loaded. */ static unsigned short screen_virtual_segment = 0; static unsigned short screen_virtual_offset = 0; -extern Lisp_Object Qcursor_type; -extern Lisp_Object Qbar, Qhbar; /* The screen colors of the current frame, which serve as the default colors for newly-created frames. */ @@ -791,8 +795,8 @@ static void IT_set_face (int face) { struct frame *sf = SELECTED_FRAME (); - struct face *fp = FACE_FROM_ID (sf, face); - struct face *dfp = FACE_FROM_ID (sf, DEFAULT_FACE_ID); + struct face *fp = FACE_FROM_ID_OR_NULL (sf, face); + struct face *dfp = FACE_FROM_ID_OR_NULL (sf, DEFAULT_FACE_ID); unsigned long fg, bg, dflt_fg, dflt_bg; struct tty_display_info *tty = FRAME_TTY (sf); @@ -1072,7 +1076,7 @@ IT_clear_screen (struct frame *f) any valid faces and will abort. Instead, use the initial screen colors; that should mimic what a Unix tty does, which simply clears the screen with whatever default colors are in use. */ - if (FACE_FROM_ID (SELECTED_FRAME (), DEFAULT_FACE_ID) == NULL) + if (FACE_FROM_ID_OR_NULL (SELECTED_FRAME (), DEFAULT_FACE_ID) == NULL) ScreenAttrib = (initial_screen_colors[0] << 4) | initial_screen_colors[1]; else IT_set_face (0); @@ -1384,11 +1388,6 @@ IT_delete_glyphs (struct frame *f, int n) /* This was copied from xfaces.c */ -extern Lisp_Object Qbackground_color; -extern Lisp_Object Qforeground_color; -Lisp_Object Qreverse; -extern Lisp_Object Qtitle; - /* IT_set_terminal_modes is called when emacs is started, resumed, and whenever the screen is redrawn! */ @@ -3710,7 +3709,7 @@ dos_ttcooked (void) file TEMPOUT and stderr to TEMPERR. */ int -run_msdos_command (unsigned char **argv, const char *working_dir, +run_msdos_command (char **argv, const char *working_dir, int tempin, int tempout, int temperr, char **envv) { char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl; @@ -3796,8 +3795,8 @@ run_msdos_command (unsigned char **argv, const char *working_dir, ; if (*cmnd) { - extern char **environ; - char **save_env = environ; + extern char **SYS_ENVIRON; + char **save_env = SYS_ENVIRON; int save_system_flags = __system_flags; /* Request the most powerful version of `system'. We need @@ -3809,16 +3808,16 @@ run_msdos_command (unsigned char **argv, const char *working_dir, | __system_handle_null_commands | __system_emulate_chdir); - environ = envv; + SYS_ENVIRON = envv; result = system (cmnd); __system_flags = save_system_flags; - environ = save_env; + SYS_ENVIRON = save_env; } else result = 0; /* emulate Unixy shell behavior with empty cmd line */ } else - result = spawnve (P_WAIT, argv[0], (char **)argv, envv); + result = spawnve (P_WAIT, argv[0], argv, envv); dup2 (inbak, 0); dup2 (outbak, 1); @@ -4085,11 +4084,14 @@ sys_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, gettime (&t); clnow = make_timespec (t.tv_sec, t.tv_nsec); cldiff = timespec_sub (clnow, cllast); + /* Stop when timeout value is about to cross zero. */ + if (timespec_cmp (*timeout, cldiff) <= 0) + { + timeout->tv_sec = 0; + timeout->tv_nsec = 0; + return 0; + } *timeout = timespec_sub (*timeout, cldiff); - - /* Stop when timeout value crosses zero. */ - if (timespec_sign (*timeout) <= 0) - return 0; cllast = clnow; dos_yield_time_slice (); }