]> code.delx.au - gnu-emacs/blobdiff - src/sysdep.c
(Fnext_property_change): Properly offset interval
[gnu-emacs] / src / sysdep.c
index 978e7f0f622b48ba9c82395c05e759b9053f3df3..4fad9bc1ed90b410a16aa03ac583f1b9d788094b 100644 (file)
@@ -27,10 +27,6 @@ Boston, MA 02111-1307, USA.  */
 #include "blockinput.h"
 #undef NULL
 
-#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#endif
-
 #define min(x,y) ((x) > (y) ? (y) : (x))
 
 /* In this file, open, read and write refer to the system calls,
@@ -151,7 +147,7 @@ extern int errno;
 #undef TIOCSWINSZ
 #endif
 
-#ifdef USG
+#if defined(USG) || defined(DGUX)
 #include <sys/utsname.h>
 #include <string.h>
 #ifndef MEMORY_IN_STRING_H
@@ -166,7 +162,7 @@ extern int errno;
 #include <sys/ptem.h>
 #endif
 #endif /* TIOCGWINSZ or ISC4_0 */
-#endif /* USG */
+#endif /* USG or DGUX */
 
 extern int quit_char;
 
@@ -230,16 +226,27 @@ static int baud_convert[] =
   };
 #endif
 
-#ifdef HAVE_TERMIOS_H
+#if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T)
+extern short ospeed;
+#else
+#if defined (HAVE_TERMIOS_H) && defined (LINUX)
+#include <termios.h>
+/* HJL's version of libc is said to need this on the Alpha.
+   On the other hand, DEC OSF1 on the Alpha needs ospeed to be a short.  */
 extern speed_t ospeed;
 #else
 extern short ospeed;
 #endif
+#endif
 
 /* The file descriptor for Emacs's input terminal.
    Under Unix, this is normally zero except when using X;
    under VMS, we place the input channel number here.  */
 int input_fd;
+
+void croak P_ ((char *));
+
+
 \f
 /* Specify a different file descriptor for further input operations.  */
 
@@ -252,6 +259,7 @@ change_input_fd (fd)
 
 /* Discard pending input on descriptor input_fd.  */
 
+void
 discard_tty_input ()
 {
 #ifndef WINDOWSNT
@@ -294,6 +302,7 @@ discard_tty_input ()
 /* Arrange for character C to be read as the next input from
    the terminal.  */
 
+void
 stuff_char (c)
      char c;
 {
@@ -310,6 +319,7 @@ stuff_char (c)
 
 #endif /* SIGTSTP */
 \f
+void
 init_baud_rate ()
 {
   if (noninteractive)
@@ -372,6 +382,7 @@ init_baud_rate ()
 }
 
 /*ARGSUSED*/
+void
 set_exclusive_use (fd)
      int fd;
 {
@@ -405,6 +416,7 @@ wait_for_termination_signal ()
 /* Wait for subprocess with process id `pid' to terminate and
    make sure it will get eliminated (not remain forever as a zombie) */
 
+void
 wait_for_termination (pid)
      int pid;
 {
@@ -502,6 +514,7 @@ wait_for_termination (pid)
  *      (may flush input as well; it does not matter the way we use it)
  */
  
+void
 flush_pending_output (channel)
      int channel;
 {
@@ -529,6 +542,7 @@ flush_pending_output (channel)
     It should not echo or do line-editing, since that is done
     in Emacs.  No padding needed for insertion into an Emacs buffer.  */
 
+void
 child_setup_tty (out)
      int out;
 {
@@ -634,11 +648,15 @@ child_setup_tty (out)
 struct save_signal
 {
   int code;
-  SIGTYPE (*handler) ();
+  SIGTYPE (*handler) P_ ((int));
 };
 
+static void save_signal_handlers P_ ((struct save_signal *));
+static void restore_signal_handlers P_ ((struct save_signal *));
+
 /* Suspend the Emacs process; give terminal to its superior.  */
 
+void
 sys_suspend ()
 {
 #ifdef VMS
@@ -708,10 +726,11 @@ sys_suspend ()
 
 /* Fork a subshell.  */
 
+void
 sys_subshell ()
 {
 #ifndef VMS
-#ifdef MSDOS   /* Demacs 1.1.2 91/10/20 Manabu Higashida */
+#ifdef DOS_NT  /* Demacs 1.1.2 91/10/20 Manabu Higashida */
   int st;
   char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS.  */
 #endif
@@ -749,11 +768,7 @@ sys_subshell ()
   str[len] = 0;
  xyzzy:
 
-#ifdef WINDOWSNT
-  pid = -1;
-#else /* not WINDOWSNT */
-
-#ifdef MSDOS
+#ifdef DOS_NT
   pid = 0;
 #if __DJGPP__ > 1
   save_signal_handlers (saved_handlers);
@@ -766,11 +781,10 @@ sys_subshell ()
 #endif
 
   if (pid == 0)
-#endif /* not WINDOWSNT */
     {
       char *sh = 0;
 
-#ifdef MSDOS    /* MW, Aug 1993 */
+#ifdef DOS_NT    /* MW, Aug 1993 */
       getwd (oldwd);
       if (sh == 0)
        sh = (char *) egetenv ("SUSPEND");      /* KFS, 1994-12-14 */
@@ -808,10 +822,9 @@ sys_subshell ()
 #ifdef  WINDOWSNT
       /* Waits for process completion */
       pid = _spawnlp (_P_WAIT, sh, sh, NULL);
+      chdir (oldwd);
       if (pid == -1)
        write (1, "Can't execute subshell", 22);
-
-      take_console ();
 #else   /* not WINDOWSNT */
       execlp (sh, sh, 0);
       write (1, "Can't execute subshell", 22);
@@ -826,7 +839,7 @@ sys_subshell ()
   synch_process_alive = 1;
 #endif
 
-#ifndef MSDOS
+#ifndef DOS_NT
   wait_for_termination (pid);
 #endif
   restore_signal_handlers (saved_handlers);
@@ -834,17 +847,19 @@ sys_subshell ()
 #endif /* !VMS */
 }
 
+static void
 save_signal_handlers (saved_handlers)
      struct save_signal *saved_handlers;
 {
   while (saved_handlers->code)
     {
       saved_handlers->handler
-       = (SIGTYPE (*) ()) signal (saved_handlers->code, SIG_IGN);
+       = (SIGTYPE (*) P_ ((int))) signal (saved_handlers->code, SIG_IGN);
       saved_handlers++;
     }
 }
 
+static void
 restore_signal_handlers (saved_handlers)
      struct save_signal *saved_handlers;
 {
@@ -859,6 +874,7 @@ restore_signal_handlers (saved_handlers)
 
 int old_fcntl_flags;
 
+void
 init_sigio (fd)
      int fd;
 {
@@ -869,6 +885,7 @@ init_sigio (fd)
   interrupts_deferred = 0;
 }
 
+void
 reset_sigio ()
 {
   unrequest_sigio ();
@@ -876,6 +893,7 @@ reset_sigio ()
 
 #ifdef FASYNC          /* F_SETFL does not imply existence of FASYNC */
 
+void
 request_sigio ()
 {
   if (read_socket_hook)
@@ -889,6 +907,7 @@ request_sigio ()
   interrupts_deferred = 0;
 }
 
+void
 unrequest_sigio ()
 {
   if (read_socket_hook)
@@ -904,6 +923,7 @@ unrequest_sigio ()
 #else /* no FASYNC */
 #ifdef STRIDE          /* Stride doesn't have FASYNC - use FIOASYNC */
 
+void
 request_sigio ()
 {
   int on = 1;
@@ -915,6 +935,7 @@ request_sigio ()
   interrupts_deferred = 0;
 }
 
+void
 unrequest_sigio ()
 {
   int off = 0;
@@ -932,6 +953,7 @@ unrequest_sigio ()
 
 #include <termios.h>
 
+void
 request_sigio ()
 {
   int on = 1;
@@ -947,6 +969,7 @@ request_sigio ()
   sigprocmask(SIG_UNBLOCK, &st, (sigset_t *)0);
 }
 
+void
 unrequest_sigio ()
 {
   int off = 0;
@@ -960,6 +983,7 @@ unrequest_sigio ()
 
 #else /* ! _CX_UX */
 
+void
 request_sigio ()
 {
   if (read_socket_hook)
@@ -968,6 +992,7 @@ request_sigio ()
   croak ("request_sigio");
 }
  
+void
 unrequest_sigio ()
 {
   if (read_socket_hook)
@@ -1009,6 +1034,7 @@ int inherited_pgroup;
    When we are in the foreground, but not started in our own process
    group, redirect the TTY to point to our own process group.  We need
    to be in our own process group to receive SIGIO properly.  */
+void
 narrow_foreground_group ()
 {
   int me = getpid ();
@@ -1020,6 +1046,7 @@ narrow_foreground_group ()
 }
 
 /* Set the tty to our original foreground group.  */
+void
 widen_foreground_group ()
 {
   if (inherited_pgroup != getpid ())
@@ -1042,6 +1069,7 @@ emacs_get_tty (fd, settings)
   /* Retrieve the primary parameters - baud rate, character size, etcetera.  */
 #ifdef HAVE_TCATTR
   /* We have those nifty POSIX tcmumbleattr functions.  */
+  bzero (&settings->main, sizeof (settings->main));
   if (tcgetattr (fd, &settings->main) < 0)
     return -1;
 
@@ -1120,6 +1148,7 @@ emacs_set_tty (fd, settings, flushp)
       {
        struct termios new;
 
+       bzero (&new, sizeof (new));
        /* Get the current settings, and see if they're what we asked for.  */
        tcgetattr (fd, &new);
        /* We cannot use memcmp on the whole structure here because under
@@ -1217,6 +1246,7 @@ static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
 static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
 #endif 
 
+void
 init_sys_modes ()
 {
   struct emacs_tty tty;
@@ -1283,7 +1313,7 @@ init_sys_modes ()
       tty = old_tty;
 
 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
-      Vtty_erase_char = old_tty.main.c_cc[VERASE];
+      XSETINT (Vtty_erase_char, old_tty.main.c_cc[VERASE]);
 
 #ifdef DGUX
       /* This allows meta to be sent on 8th bit.  */
@@ -1334,6 +1364,7 @@ init_sys_modes ()
       tty.main.c_cc[VSWTCH] = CDISABLE;        /* Turn off shell layering use
                                           of C-z */
 #endif /* VSWTCH */
+
 #if defined (mips) || defined (HAVE_TCATTR)
 #ifdef VSUSP
       tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z.  */
@@ -1356,13 +1387,27 @@ init_sys_modes ()
 #ifdef VDISCARD
       tty.main.c_cc[VDISCARD] = CDISABLE;
 #endif /* VDISCARD */
+
+      if (flow_control)
+       {
+#ifdef VSTART
+         tty.main.c_cc[VSTART] = '\021';
+#endif /* VSTART */
+#ifdef VSTOP
+         tty.main.c_cc[VSTOP] = '\023';
+#endif /* VSTOP */
+       }
+      else
+       {
 #ifdef VSTART
-      tty.main.c_cc[VSTART] = CDISABLE;
+         tty.main.c_cc[VSTART] = CDISABLE;
 #endif /* VSTART */
 #ifdef VSTOP
-      tty.main.c_cc[VSTOP] = CDISABLE;
+         tty.main.c_cc[VSTOP] = CDISABLE;
 #endif /* VSTOP */
+       }
 #endif /* mips or HAVE_TCATTR */
+
 #ifdef SET_LINE_DISCIPLINE
       /* Need to explicitly request TERMIODISC line discipline or
          Ultrix's termios does not work correctly.  */
@@ -1407,7 +1452,7 @@ init_sys_modes ()
       tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
 #else /* not VMS (BSD, that is) */
 #ifndef DOS_NT
-      Vtty_erase_char = tty.main.sg_erase;
+      XSETINT (Vtty_erase_char, tty.main.sg_erase);
       tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
       if (meta_key)
        tty.main.sg_flags |= ANYP;
@@ -1532,7 +1577,13 @@ init_sys_modes ()
 #ifdef HAVE_WINDOW_SYSTEM
   /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
      needs the initialization code below.  */
-  if (! read_socket_hook && EQ (Vwindow_system, Qnil))
+  if (EQ (Vwindow_system, Qnil)
+#ifndef WINDOWSNT
+      /* When running in tty mode on NT/Win95, we have a read_socket
+        hook, but still need the rest of the initialization code below.  */
+      && (! read_socket_hook)
+#endif
+      )
 #endif
     set_terminal_modes ();
 
@@ -1554,6 +1605,7 @@ init_sys_modes ()
 /* Return nonzero if safe to use tabs in output.
    At the time this is called, init_sys_modes has not been done yet.  */
    
+int
 tabs_safe_p ()
 {
   struct emacs_tty tty;
@@ -1566,6 +1618,7 @@ tabs_safe_p ()
    Store number of lines into *HEIGHTP and width into *WIDTHP.
    We store 0 if there's no valid information.  */
 
+void
 get_frame_size (widthp, heightp)
      int *widthp, *heightp;
 {
@@ -1661,6 +1714,7 @@ set_window_size (fd, height, width)
 \f
 /* Prepare the terminal for exiting Emacs; move the cursor to the
    bottom of the frame, turn off interrupt-driven I/O, etc.  */
+void
 reset_sys_modes ()
 {
   if (noninteractive)
@@ -1673,7 +1727,13 @@ reset_sys_modes ()
 #ifdef HAVE_WINDOW_SYSTEM
   /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
      needs the clean-up code below.  */
-  if (read_socket_hook || !EQ (Vwindow_system, Qnil))
+  if (!EQ (Vwindow_system, Qnil)
+#ifndef WINDOWSNT
+      /* When running in tty mode on NT/Win95, we have a read_socket
+        hook, but still need the rest of the clean-up code below.  */
+      || read_socket_hook
+#endif
+      )
     return;
 #endif
   cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
@@ -1747,6 +1807,7 @@ reset_sys_modes ()
 
 /* Set up the proper status flags for use of a pty.  */
 
+void
 setup_pty (fd)
      int fd;
 {
@@ -1798,6 +1859,7 @@ setup_pty (fd)
    This is called each time Emacs is resumed, also, but does nothing
    because input_chain is no longer zero.  */
 
+void
 init_vms_input ()
 {
   int status;
@@ -1812,6 +1874,7 @@ init_vms_input ()
 
 /* Deassigning the input channel is done before exiting.  */
 
+void
 stop_vms_input ()
 {
   return SYS$DASSGN (input_fd);
@@ -1822,6 +1885,7 @@ short input_buffer;
 /* Request reading one character into the keyboard buffer.
    This is done as soon as the buffer becomes empty.  */
 
+void
 queue_kbd_input ()
 {
   int status;
@@ -1839,6 +1903,7 @@ int input_count;
 /* Ast routine that is called when keyboard input comes in
    in accord with the SYS$QIO above.  */
 
+void
 kbd_input_ast ()
 {
   register int c = -1;
@@ -1886,6 +1951,7 @@ kbd_input_ast ()
 
 /* Wait until there is something in kbd_buffer.  */
 
+void
 wait_for_kbd_input ()
 {
   extern int have_process_input, process_exited;
@@ -1932,6 +1998,7 @@ wait_for_kbd_input ()
    and therefore there is no I/O request queued when we return.
    SYS$SETAST is used to avoid a timing error.  */
 
+void
 end_kbd_input ()
 {
 #ifdef ASTDEBUG
@@ -1958,6 +2025,7 @@ end_kbd_input ()
 
 /* Wait for either input available or time interval expiry.  */
 
+void
 input_wait_timeout (timeval)
      int timeval;              /* Time to wait, in seconds */
 {
@@ -2004,6 +2072,7 @@ sys_sleep (timeval)
     SYS$WAITFR (timer_ef);       /* Wait for timer expiry only */
 }
 
+void
 init_sigio (fd)
      int fd;
 {
@@ -2015,11 +2084,13 @@ reset_sigio ()
   unrequest_sigio ();
 }
 
+void
 request_sigio ()
 {
   croak ("request sigio");
 }
 
+void
 unrequest_sigio ()
 {
   croak ("unrequest sigio");
@@ -2217,55 +2288,62 @@ init_system_name ()
 #ifndef CANNOT_DUMP
   if (initialized)
 #endif /* not CANNOT_DUMP */
-    {
-      struct hostent *hp;
-      int count;
-      for (count = 0;; count++)
-       {
+    if (! index (hostname, '.'))
+      {
+       struct hostent *hp;
+       int count;
+       for (count = 0;; count++)
+         {
 #ifdef TRY_AGAIN
-         h_errno = 0;
+           h_errno = 0;
 #endif
-         hp = gethostbyname (hostname);
+           hp = gethostbyname (hostname);
 #ifdef TRY_AGAIN
-         if (! (hp == 0 && h_errno == TRY_AGAIN))
+           if (! (hp == 0 && h_errno == TRY_AGAIN))
 #endif
-           break;
-         if (count >= 5)
-           break;
-         Fsleep_for (make_number (1), Qnil);
-       }
-      if (hp)
-       {
-         char *fqdn = (char *) hp->h_name;
-         char *p;
-
-         if (!index (fqdn, '.'))
-           {
-             /* We still don't have a fully qualified domain name.
-                Try to find one in the list of alternate names */
-             char **alias = hp->h_aliases;
-             while (*alias && !index (*alias, '.'))
-               alias++;
-             if (*alias)
-               fqdn = *alias;
-           }
-         hostname = fqdn;
+             break;
+           if (count >= 5)
+             break;
+           Fsleep_for (make_number (1), Qnil);
+         }
+       if (hp)
+         {
+           char *fqdn = (char *) hp->h_name;
+           char *p;
+
+           if (!index (fqdn, '.'))
+             {
+               /* We still don't have a fully qualified domain name.
+                  Try to find one in the list of alternate names */
+               char **alias = hp->h_aliases;
+               while (*alias && !index (*alias, '.'))
+                 alias++;
+               if (*alias)
+                 fqdn = *alias;
+             }
+           hostname = fqdn;
 #if 0
-         /* Convert the host name to lower case.  */
-         /* Using ctype.h here would introduce a possible locale
-            dependence that is probably wrong for hostnames.  */
-         p = hostname;
-         while (*p)
-           {
-             if (*p >= 'A' && *p <= 'Z')
-               *p += 'a' - 'A';
-             p++;
-           }
+           /* Convert the host name to lower case.  */
+           /* Using ctype.h here would introduce a possible locale
+              dependence that is probably wrong for hostnames.  */
+           p = hostname;
+           while (*p)
+             {
+               if (*p >= 'A' && *p <= 'Z')
+                 *p += 'a' - 'A';
+               p++;
+             }
 #endif
-       }
-    }
+         }
+      }
 #endif /* HAVE_SOCKETS */
-#if (HAVE_SYSINFO && defined (SI_SRPC_DOMAIN)) || HAVE_GETDOMAINNAME
+  /* We used to try using getdomainname here,
+     but NIIBE Yutaka <gniibe@etl.go.jp> says that
+     getdomainname gets the NIS/YP domain which often is not the same
+     as in Internet domain name.  */
+#if 0 /* Turned off because sysinfo is not really likely to return the
+        correct Internet domain.  */
+#if (HAVE_SYSINFO && defined (SI_SRPC_DOMAIN))
   if (! index (hostname, '.'))
     {
       /* The hostname is not fully qualified.  Append the domain name.  */
@@ -2275,9 +2353,8 @@ init_system_name ()
 
       for (;;)
        {
-         char *fqdn = (char *) alloca (hostlen + 1 + domain_size);
-         char *domain = fqdn + hostlen + 1;
-#if HAVE_SYSINFO && defined (SI_SRPC_DOMAIN)
+         char *domain = (char *) alloca (domain_size + 1);
+         char *fqdn = (char *) alloca (hostlen + 1 + domain_size + 1);
          int sys_domain_size = sysinfo (SI_SRPC_DOMAIN, domain, domain_size);
          if (sys_domain_size <= 0)
            break;
@@ -2286,30 +2363,20 @@ init_system_name ()
              domain_size = sys_domain_size;
              continue;
            }
-#else /* HAVE_GETDOMAINNAME */
-         if (getdomainname (domain, domain_size - 1) != 0 || ! *domain)
-           break;
-         domain[domain_size - 1] = '\0';
-         if (strlen (domain) == domain_size - 1)
-           {
-             domain_size *= 2;
-             continue;
-           }
-         /* If we get an answer which means "domain unknown",
-            don't use a domain.  */
-         if (!strcmp (domain, "(none)"))
+         strcpy (fqdn, hostname);
+         if (domain[0] == '.')
+           strcpy (fqdn + hostlen, domain);
+         else if (domain[0] != 0)
            {
-             *domain = 0;
-             break;
+             fqdn[hostlen] = '.';
+             strcpy (fqdn + hostlen + 1, domain);
            }
-#endif /* HAVE_GETDOMAINNAME */
-         strcpy (fqdn, hostname);
-         fqdn[hostlen] = '.';
          hostname = fqdn;
          break;
        }
     }
-#endif /*! ((HAVE_SYSINFO && defined (SI_SRPC_DOMAIN)) || HAVE_GETDOMAINNAME)*/
+#endif /* HAVE_SYSINFO && defined (SI_SRPC_DOMAIN) */
+#endif /* 0 */
   Vsystem_name = build_string (hostname);
 #endif /* HAVE_GETHOSTNAME */
 #endif /* VMS */
@@ -2515,6 +2582,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
 #define BUFFER_SIZE_FACTOR 1
 #endif
 
+void
 read_input_waiting ()
 {
   struct input_event e;
@@ -2598,6 +2666,7 @@ sys_open (path, oflag, mode)
     return open (path, oflag);
 }
 
+void
 init_sigio (fd)
      int fd;
 {
@@ -2607,6 +2676,7 @@ init_sigio (fd)
   ioctl (fd, TIOCLSET, &lmode);
 }
 
+void
 reset_sigio ()
 {
   if (noninteractive)
@@ -2615,6 +2685,7 @@ reset_sigio ()
   ioctl (0, TIOCLSET, &lmode);
 }
 
+void
 request_sigio ()
 {
   sigrelse (SIGTINT);
@@ -2622,6 +2693,7 @@ request_sigio ()
   interrupts_deferred = 0;
 }
 
+void
 unrequest_sigio ()
 {
   sighold (SIGTINT);
@@ -2634,6 +2706,7 @@ unrequest_sigio ()
 
 int sigheld; /* Mask of held signals */
 
+void
 sigholdx (signum)
      int signum;
 {
@@ -2641,12 +2714,14 @@ sigholdx (signum)
   sighold (signum);
 }
 
+void
 sigisheld (signum)
      int signum;
 {
   sigheld |= sigbit (signum);
 }
 
+void
 sigunhold (signum)
      int signum;
 {
@@ -2654,6 +2729,7 @@ sigunhold (signum)
   sigrelse (signum);
 }
 
+void
 sigfree ()    /* Free all held signals */
 {
   int i;
@@ -2663,6 +2739,7 @@ sigfree ()    /* Free all held signals */
   sigheld = 0;
 }
 
+int
 sigbit (i)
 {
   return 1 << (i - 1);
@@ -2675,9 +2752,9 @@ sigbit (i)
 
 #ifdef POSIX_SIGNALS
 
-sigset_t old_mask, empty_mask, full_mask, temp_mask;
-static struct sigaction new_action, old_action;
+sigset_t empty_mask, full_mask;
 
+void
 init_signals ()
 {
   sigemptyset (&empty_mask);
@@ -2687,6 +2764,7 @@ init_signals ()
 signal_handler_t
 sys_signal (int signal_number, signal_handler_t action)
 {
+  struct sigaction new_action, old_action;
   sigemptyset (&new_action.sa_mask);
   new_action.sa_handler = action;
 #ifdef SA_RESTART
@@ -2714,14 +2792,6 @@ sys_sigmask (int sig)
 }
 #endif
 
-int
-sys_sigpause (sigset_t new_mask)
-{
-  /* pause emulating berk sigpause... */
-  sigsuspend (&new_mask);
-  return (EINTR);
-}
-
 /* I'd like to have these guys return pointers to the mask storage in here,
    but there'd be trouble if the code was saving multiple masks.  I'll be
    safe and pass the structure.  It normally won't be more than 2 bytes
@@ -2979,6 +3049,7 @@ sys_open (path, oflag, mode)
 
 #ifdef INTERRUPTIBLE_CLOSE
 
+int
 sys_close (fd)
      int fd;
 {
@@ -3282,6 +3353,7 @@ dup2 (oldd, newd)
 #ifdef HAVE_TIMEVAL
  
 /* ARGSUSED */
+int
 gettimeofday (tp, tzp)
      struct timeval *tp;
      struct timezone *tzp;
@@ -3292,6 +3364,7 @@ gettimeofday (tp, tzp)
   tp->tv_usec = 0;
   if (tzp != 0)
     tzp->tz_minuteswest = -1;
+  return 0;
 }
  
 #endif
@@ -3303,6 +3376,7 @@ gettimeofday (tp, tzp)
  *     This function will go away as soon as all the stubs fixed. (fnf)
  */
 
+void
 croak (badfunc)
      char *badfunc;
 {
@@ -3827,6 +3901,7 @@ static unsigned int uic;
 
 /* Called from init_sys_modes, so it happens not very often
    but at least each time Emacs is loaded.  */
+void
 sys_access_reinit ()
 {
   uic = 0;
@@ -4079,6 +4154,7 @@ getwd (pathname)
  return pathname;
 }
 
+int
 getppid ()
 {
   long item_code = JPI$_OWNER;
@@ -4274,6 +4350,7 @@ creat_copy_attrs (old, new)
 #endif
 #endif
 
+int
 sys_creat (va_alist)
      va_dcl
 {
@@ -4390,6 +4467,7 @@ sys_creat (va_alist)
 #endif /* creat */
 
 /* fwrite to stdout is S L O W.  Speed it up by using fputc...*/
+int
 sys_fwrite (ptr, size, num, fp)
      register char * ptr;
      FILE * fp;
@@ -4398,6 +4476,7 @@ sys_fwrite (ptr, size, num, fp)
 
   while (tot--)
     fputc (*ptr++, fp);
+  return num;
 }
 
 /*
@@ -4685,6 +4764,7 @@ getpwuid (uid)
 /* return total address space available to the current process.  This is
    the sum of the current p0 size, p1 size and free page table entries
    available. */
+int
 vlimit ()
 {
   int item_code;
@@ -4720,6 +4800,7 @@ vlimit ()
   return free_pages + frep0va + (0x7fffffff - frep1va);
 }
 
+int
 define_logical_name (varname, string)
      char *varname;
      char *string;
@@ -4734,6 +4815,7 @@ define_logical_name (varname, string)
   return LIB$SET_LOGICAL (&envdsc, &strdsc, &lnmdsc, 0, 0);
 }
 
+int
 delete_logical_name (varname)
      char *varname;
 {
@@ -4745,15 +4827,23 @@ delete_logical_name (varname)
   return LIB$DELETE_LOGICAL (&envdsc, &lnmdsc);
 }
 
+int
 ulimit ()
-{}
+{
+  return 0;
+}
 
+int
 setpgrp ()
-{}
+{
+  return 0;
+}
 
+int
 execvp ()
 {
   error ("execvp system call not implemented");
+  return -1;
 }
 
 int
@@ -4876,6 +4966,7 @@ rename_sans_version (from,to)
   return 0;
 }
 
+int
 link (file, new)
      char * file, * new;
 {
@@ -4943,6 +5034,7 @@ link (file, new)
   return 0;
 }
 
+void
 croak (badfunc)
      char *badfunc;
 {
@@ -4958,6 +5050,7 @@ random ()
   return rand () - (1 << 30);
 }
 
+void
 srandom (seed)
 {
   srand (seed);
@@ -4967,6 +5060,7 @@ srandom (seed)
 #ifdef AIXHFT
 
 /* Called from init_sys_modes.  */
+void
 hft_init ()
 {
   int junk;
@@ -5020,6 +5114,7 @@ hft_init ()
 
 /* Reset the rubout key to backspace. */
 
+void
 hft_reset ()
 {
   struct hfbuf buf;
@@ -5139,7 +5234,7 @@ bcopy (b1, b2, length)
     *b2++ = *b1++;
 #endif /* not VMS */
 }
-#endif /* (defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */
+#endif /* (!defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */
 
 #ifndef BSTRING
 #ifndef bcmp