/* 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
#include <libc/dosio.h> /* for _USE_LFN */
#include <conio.h> /* 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"
/* 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. */
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);
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);
/* 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! */
if (redraw)
{
- face_change_count++; /* forces xdisp.c to recompute basic faces */
+ face_change = true; /* forces xdisp.c to recompute basic faces */
if (f == SELECTED_FRAME ())
redraw_frame (f);
}
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;
;
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
| __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);
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 ();
}