]> code.delx.au - gnu-emacs/blobdiff - src/process.c
(Fmove_to_column): Remove unused local variable `end_byte'.
[gnu-emacs] / src / process.c
index 33a4c2109d72aad8dd865cf5cd39ee67741db8e5..06e931af9b6dcc5354ee48d7771973f62c51be5c 100644 (file)
@@ -307,7 +307,7 @@ struct sockaddr_and_len {
   int len;
 } datagram_address[MAXDESC];
 #define DATAGRAM_CHAN_P(chan)  (datagram_address[chan].sa != 0)
-#define DATAGRAM_CONN_P(proc)  (datagram_address[XPROCESS (proc)->infd].sa != 0)
+#define DATAGRAM_CONN_P(proc)  (PROCESSP (proc) && datagram_address[XINT (XPROCESS (proc)->infd)].sa != 0)
 #else
 #define DATAGRAM_CHAN_P(chan)  (0)
 #define DATAGRAM_CONN_P(proc)  (0)
@@ -1200,7 +1200,7 @@ list_processes_1 (query_only)
          if (INTEGERP (port))
            port = Fnumber_to_string (port);
          sprintf (tembuf, "(network %s server on %s)\n",
-                  (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
+                  (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"),
                   XSTRING (port)->data);
          insert_string (tembuf);
        }
@@ -1216,7 +1216,7 @@ list_processes_1 (query_only)
                host = Fnumber_to_string (host);
            }
          sprintf (tembuf, "(network %s connection to %s)\n",
-                  (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
+                  (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"),
                   XSTRING (host)->data);
          insert_string (tembuf);
         }
@@ -1273,6 +1273,7 @@ BUFFER is the buffer or (buffer-name) to associate with the process.
  with any buffer.
 Third arg is program file name.  It is searched for in PATH.
 Remaining arguments are strings to give program as arguments.
+
 usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
      (nargs, args)
      int nargs;
@@ -2118,7 +2119,7 @@ DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_
   if (!DATAGRAM_CONN_P (process))
     return Qnil;
 
-  channel = XPROCESS (process)->infd;
+  channel = XINT (XPROCESS (process)->infd);
   return conv_sockaddr_to_lisp (datagram_address[channel].sa,
                                datagram_address[channel].len);
 }
@@ -2138,7 +2139,7 @@ Returns nil upon error setting address, ADDRESS otherwise.  */)
   if (!DATAGRAM_CONN_P (process))
     return Qnil;
 
-  channel = XPROCESS (process)->infd;
+  channel = XINT (XPROCESS (process)->infd);
 
   len = get_lisp_to_sockaddr_size (address, &family);
   if (datagram_address[channel].len != len)
@@ -2348,7 +2349,6 @@ DEFUN ("set-network-process-options",
        Fset_network_process_options, Sset_network_process_options,
        1, MANY, 0, 
        doc: /* Set one or more options for network process PROCESS.
-Arguments are PROCESS &rest OPTIONS.
 Each option is either a string "OPT=VALUE" or a cons (OPT . VALUE).
 A boolean value is false if it either zero or nil, true otherwise.
 
@@ -2362,7 +2362,9 @@ keepalive=BOOL -- Send keep-alive messages on network stream.
 linger=BOOL or TIMEOUT -- Send queued messages before closing.
 oobinline=BOOL -- Place out-of-band data in receive data stream. 
 priority=INT -- Set protocol defined priority for sent packets.
-reuseaddr=BOOL -- Allow reusing a recently used address.  */)
+reuseaddr=BOOL -- Allow reusing a recently used address.
+
+usage: (set-network-process-options PROCESS &rest OPTIONS)  */)
      (nargs, args)
      int nargs;
      Lisp_Object *args;
@@ -2372,10 +2374,10 @@ reuseaddr=BOOL -- Allow reusing a recently used address.  */)
 
   process = args[0];
   CHECK_PROCESS (process);
-  if (nargs > 1 && XPROCESS (process)->infd >= 0)
+  if (nargs > 1 && XINT (XPROCESS (process)->infd) >= 0)
     {
       opts = Flist (nargs, args);
-      set_socket_options (XPROCESS (process)->infd, opts, 0);
+      set_socket_options (XINT (XPROCESS (process)->infd), opts, 0);
     }
   return process;
 }
@@ -2461,7 +2463,7 @@ defined constants, data sizes, and data structure alignment.
 :coding CODING -- CODING is coding system for this process.
 
 :options OPTIONS -- Set the specified options for the network process.
-See `set-process-options' for details.
+See `set-network-process-options' for details.
 
 :nowait BOOL -- If BOOL is non-nil for a stream type client process,
 return without waiting for the connection to complete; instead, the
@@ -3526,7 +3528,7 @@ server_accept_connection (server, channel)
                      (STRINGP (host) ? host : build_string ("-")),
                      build_string ("\n")));
 
-  if (p->sentinel)
+  if (!NILP (p->sentinel))
     exec_sentinel (proc, 
                   concat3 (build_string ("open from "),
                            (STRINGP (host) ? host : build_string ("-")),
@@ -5786,7 +5788,8 @@ exec_sentinel (proc, reason)
 
 /* Report all recent events of a change in process status
    (either run the sentinel or output a message).
-   This is done while Emacs is waiting for keyboard input.  */
+   This is usually done while Emacs is waiting for keyboard input
+   but can be done at other times.  */
 
 void
 status_notify ()
@@ -6011,7 +6014,6 @@ void
 init_process ()
 {
   register int i;
-  Lisp_Object subfeatures;
 
 #ifdef SIGCHLD
 #ifndef CANNOT_DUMP
@@ -6039,50 +6041,54 @@ init_process ()
   bzero (datagram_address, sizeof datagram_address);
 #endif
 
+#ifdef HAVE_SOCKETS
+ {
+   Lisp_Object subfeatures = Qnil;
 #define ADD_SUBFEATURE(key, val) \
   subfeatures = Fcons (Fcons (key, Fcons (val, Qnil)), subfeatures)
 
-  subfeatures = Qnil;
 #ifdef NON_BLOCKING_CONNECT
-  ADD_SUBFEATURE (QCnowait, Qt);
+   ADD_SUBFEATURE (QCnowait, Qt);
 #endif
 #ifdef DATAGRAM_SOCKETS
-  ADD_SUBFEATURE (QCtype, Qdatagram);
+   ADD_SUBFEATURE (QCtype, Qdatagram);
 #endif
 #ifdef HAVE_LOCAL_SOCKETS
-  ADD_SUBFEATURE (QCfamily, Qlocal);
+   ADD_SUBFEATURE (QCfamily, Qlocal);
 #endif
 #ifdef HAVE_GETSOCKNAME
-  ADD_SUBFEATURE (QCservice, Qt);
+   ADD_SUBFEATURE (QCservice, Qt);
 #endif
 #ifndef TERM
-  ADD_SUBFEATURE (QCserver, Qt);
+   ADD_SUBFEATURE (QCserver, Qt);
 #endif
 #ifdef SO_BINDTODEVICE
-  ADD_SUBFEATURE (QCoptions, intern ("bindtodevice"));
+   ADD_SUBFEATURE (QCoptions, intern ("bindtodevice"));
 #endif
 #ifdef SO_BROADCAST
-  ADD_SUBFEATURE (QCoptions, intern ("broadcast"));
+   ADD_SUBFEATURE (QCoptions, intern ("broadcast"));
 #endif
 #ifdef SO_DONTROUTE
-  ADD_SUBFEATURE (QCoptions, intern ("dontroute"));
+   ADD_SUBFEATURE (QCoptions, intern ("dontroute"));
 #endif
 #ifdef SO_KEEPALIVE
-  ADD_SUBFEATURE (QCoptions, intern ("keepalive"));
+   ADD_SUBFEATURE (QCoptions, intern ("keepalive"));
 #endif
 #ifdef SO_LINGER
-  ADD_SUBFEATURE (QCoptions, intern ("linger"));
+   ADD_SUBFEATURE (QCoptions, intern ("linger"));
 #endif
 #ifdef SO_OOBINLINE
-  ADD_SUBFEATURE (QCoptions, intern ("oobinline"));
+   ADD_SUBFEATURE (QCoptions, intern ("oobinline"));
 #endif
 #ifdef SO_PRIORITY
-  ADD_SUBFEATURE (QCoptions, intern ("priority"));
+   ADD_SUBFEATURE (QCoptions, intern ("priority"));
 #endif
 #ifdef SO_REUSEADDR
-  ADD_SUBFEATURE (QCoptions, intern ("reuseaddr"));
+   ADD_SUBFEATURE (QCoptions, intern ("reuseaddr"));
 #endif
-  Fprovide (intern ("make-network-process"), subfeatures);
+   Fprovide (intern ("make-network-process"), subfeatures);
+ }
+#endif /* HAVE_SOCKETS */
 }
 
 void