comparison src/process.c @ 112434:9de5a68b57e1

Promote SSDATA macro from gtkutil.c and xsmfns.c to lisp.h.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 18:56:06 -0800
parents 42e22c4f06b7
children
comparison
equal deleted inserted replaced
112433:7b649f6eac4f 112434:9de5a68b57e1
409 if (FD_ISSET (fd, &input_wait_mask) || FD_ISSET (fd, &write_mask)) 409 if (FD_ISSET (fd, &input_wait_mask) || FD_ISSET (fd, &write_mask))
410 { 410 {
411 max_input_desc = fd; 411 max_input_desc = fd;
412 break; 412 break;
413 } 413 }
414 414
415 } 415 }
416 } 416 }
417 417
418 418
419 /* Compute the Lisp form of the process status, p->status, from 419 /* Compute the Lisp form of the process status, p->status, from
496 496
497 string = make_unibyte_string (signame, strlen (signame)); 497 string = make_unibyte_string (signame, strlen (signame));
498 if (! NILP (Vlocale_coding_system)) 498 if (! NILP (Vlocale_coding_system))
499 string = (code_convert_string_norecord 499 string = (code_convert_string_norecord
500 (string, Vlocale_coding_system, 0)); 500 (string, Vlocale_coding_system, 0));
501 c1 = STRING_CHAR ((char *) SDATA (string)); 501 c1 = STRING_CHAR (SSDATA (string));
502 c2 = DOWNCASE (c1); 502 c2 = DOWNCASE (c1);
503 if (c1 != c2) 503 if (c1 != c2)
504 Faset (string, make_number (0), make_number (c2)); 504 Faset (string, make_number (0), make_number (c2));
505 } 505 }
506 string2 = build_string (coredump ? " (core dumped)\n" : "\n"); 506 string2 = build_string (coredump ? " (core dumped)\n" : "\n");
1418 port = Fnumber_to_string (port); 1418 port = Fnumber_to_string (port);
1419 if (NILP (port)) 1419 if (NILP (port))
1420 port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil); 1420 port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil);
1421 sprintf (tembuf, "(network %s server on %s)\n", 1421 sprintf (tembuf, "(network %s server on %s)\n",
1422 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), 1422 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
1423 (STRINGP (port) ? (char *)SDATA (port) : "?")); 1423 (STRINGP (port) ? SSDATA (port) : "?"));
1424 insert_string (tembuf); 1424 insert_string (tembuf);
1425 } 1425 }
1426 else if (NETCONN1_P (p)) 1426 else if (NETCONN1_P (p))
1427 { 1427 {
1428 /* For a local socket, there is no host name, 1428 /* For a local socket, there is no host name,
1436 } 1436 }
1437 if (NILP (host)) 1437 if (NILP (host))
1438 host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil); 1438 host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil);
1439 sprintf (tembuf, "(network %s connection to %s)\n", 1439 sprintf (tembuf, "(network %s connection to %s)\n",
1440 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), 1440 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
1441 (STRINGP (host) ? (char *)SDATA (host) : "?")); 1441 (STRINGP (host) ? SSDATA (host) : "?"));
1442 insert_string (tembuf); 1442 insert_string (tembuf);
1443 } 1443 }
1444 else if (SERIALCONN1_P (p)) 1444 else if (SERIALCONN1_P (p))
1445 { 1445 {
1446 Lisp_Object port = Fplist_get (p->childp, QCport); 1446 Lisp_Object port = Fplist_get (p->childp, QCport);
2515 const struct socket_options *sopt; 2515 const struct socket_options *sopt;
2516 int ret = 0; 2516 int ret = 0;
2517 2517
2518 CHECK_SYMBOL (opt); 2518 CHECK_SYMBOL (opt);
2519 2519
2520 name = (char *) SDATA (SYMBOL_NAME (opt)); 2520 name = SSDATA (SYMBOL_NAME (opt));
2521 for (sopt = socket_options; sopt->name; sopt++) 2521 for (sopt = socket_options; sopt->name; sopt++)
2522 if (strcmp (name, sopt->name) == 0) 2522 if (strcmp (name, sopt->name) == 0)
2523 break; 2523 break;
2524 2524
2525 switch (sopt->opttype) 2525 switch (sopt->opttype)
2554 To unbind, the arg must be a zero integer, not the empty string. 2554 To unbind, the arg must be a zero integer, not the empty string.
2555 This should work on all systems. KFS. 2003-09-23. */ 2555 This should work on all systems. KFS. 2003-09-23. */
2556 memset (devname, 0, sizeof devname); 2556 memset (devname, 0, sizeof devname);
2557 if (STRINGP (val)) 2557 if (STRINGP (val))
2558 { 2558 {
2559 char *arg = (char *) SDATA (val); 2559 char *arg = SSDATA (val);
2560 int len = min (strlen (arg), IFNAMSIZ); 2560 int len = min (strlen (arg), IFNAMSIZ);
2561 memcpy (devname, arg, len); 2561 memcpy (devname, arg, len);
2562 } 2562 }
2563 else if (!NILP (val)) 2563 else if (!NILP (val))
2564 error ("Bad option value for %s", name); 2564 error ("Bad option value for %s", name);
2839 proc = make_process (name); 2839 proc = make_process (name);
2840 specpdl_count = SPECPDL_INDEX (); 2840 specpdl_count = SPECPDL_INDEX ();
2841 record_unwind_protect (make_serial_process_unwind, proc); 2841 record_unwind_protect (make_serial_process_unwind, proc);
2842 p = XPROCESS (proc); 2842 p = XPROCESS (proc);
2843 2843
2844 fd = serial_open ((char*) SDATA (port)); 2844 fd = serial_open (SSDATA (port));
2845 p->infd = fd; 2845 p->infd = fd;
2846 p->outfd = fd; 2846 p->outfd = fd;
2847 if (fd > max_process_desc) 2847 if (fd > max_process_desc)
2848 max_process_desc = fd; 2848 max_process_desc = fd;
2849 chan_process[fd] = proc; 2849 chan_process[fd] = proc;
3375 } 3375 }
3376 else 3376 else
3377 /* Attempt to interpret host as numeric inet address */ 3377 /* Attempt to interpret host as numeric inet address */
3378 { 3378 {
3379 unsigned long numeric_addr; 3379 unsigned long numeric_addr;
3380 numeric_addr = inet_addr ((char *) SDATA (host)); 3380 numeric_addr = inet_addr (SSDATA (host));
3381 if (numeric_addr == -1) 3381 if (numeric_addr == -1)
3382 error ("Unknown host \"%s\"", SDATA (host)); 3382 error ("Unknown host \"%s\"", SDATA (host));
3383 3383
3384 memcpy (&address_in.sin_addr, &numeric_addr, 3384 memcpy (&address_in.sin_addr, &numeric_addr,
3385 sizeof (address_in.sin_addr)); 3385 sizeof (address_in.sin_addr));
5643 #endif 5643 #endif
5644 { 5644 {
5645 #ifdef HAVE_GNUTLS 5645 #ifdef HAVE_GNUTLS
5646 if (XPROCESS (proc)->gnutls_p) 5646 if (XPROCESS (proc)->gnutls_p)
5647 rv = emacs_gnutls_write (outfd, 5647 rv = emacs_gnutls_write (outfd,
5648 XPROCESS (proc), 5648 XPROCESS (proc),
5649 (char *) buf, this); 5649 (char *) buf, this);
5650 else 5650 else
5651 #endif 5651 #endif
5652 rv = emacs_write (outfd, (char *) buf, this); 5652 rv = emacs_write (outfd, (char *) buf, this);
5653 #ifdef ADAPTIVE_READ_BUFFERING 5653 #ifdef ADAPTIVE_READ_BUFFERING
7725 defsubr (&Sget_buffer_process); 7725 defsubr (&Sget_buffer_process);
7726 defsubr (&Sprocess_inherit_coding_system_flag); 7726 defsubr (&Sprocess_inherit_coding_system_flag);
7727 defsubr (&Slist_system_processes); 7727 defsubr (&Slist_system_processes);
7728 defsubr (&Sprocess_attributes); 7728 defsubr (&Sprocess_attributes);
7729 } 7729 }
7730