comparison src/process-unix.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 84762348c6f9
children b0c24ea6a2a8
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
204 204
205 /* The file name of the (slave) pty opened by allocate_pty(). */ 205 /* The file name of the (slave) pty opened by allocate_pty(). */
206 #ifndef MAX_PTYNAME_LEN 206 #ifndef MAX_PTYNAME_LEN
207 #define MAX_PTYNAME_LEN 64 207 #define MAX_PTYNAME_LEN 64
208 #endif 208 #endif
209 static Intbyte pty_name[MAX_PTYNAME_LEN]; 209 static Ibyte pty_name[MAX_PTYNAME_LEN];
210 210
211 /* Open an available pty, returning a file descriptor. 211 /* Open an available pty, returning a file descriptor.
212 Return -1 on failure. 212 Return -1 on failure.
213 The file name of the terminal corresponding to the pty 213 The file name of the terminal corresponding to the pty
214 is left in the variable `pty_name'. */ 214 is left in the variable `pty_name'. */
226 allocate_pty() tries all the different known easy ways of opening 226 allocate_pty() tries all the different known easy ways of opening
227 a pty. In case of failure, we resort to the old BSD-style pty 227 a pty. In case of failure, we resort to the old BSD-style pty
228 grovelling code in allocate_pty_the_old_fashioned_way(). */ 228 grovelling code in allocate_pty_the_old_fashioned_way(). */
229 int master_fd = -1; 229 int master_fd = -1;
230 const Extbyte *slave_name = NULL; 230 const Extbyte *slave_name = NULL;
231 const CIntbyte *clone = NULL; 231 const CIbyte *clone = NULL;
232 static const CIntbyte * const clones[] = 232 static const CIbyte * const clones[] =
233 /* Different pty master clone devices */ 233 /* Different pty master clone devices */
234 { 234 {
235 "/dev/ptmx", /* Various systems */ 235 "/dev/ptmx", /* Various systems */
236 "/dev/ptm/clone", /* HPUX */ 236 "/dev/ptm/clone", /* HPUX */
237 "/dev/ptc", /* AIX */ 237 "/dev/ptc", /* AIX */
281 { 281 {
282 int i; 282 int i;
283 for (i = 0; i < countof (clones); i++) 283 for (i = 0; i < countof (clones); i++)
284 { 284 {
285 clone = clones[i]; 285 clone = clones[i];
286 master_fd = qxe_open ((Intbyte *) clone, 286 master_fd = qxe_open ((Ibyte *) clone,
287 O_RDWR | O_NONBLOCK | OPEN_BINARY, 0); 287 O_RDWR | O_NONBLOCK | OPEN_BINARY, 0);
288 if (master_fd >= 0) 288 if (master_fd >= 0)
289 goto have_master; 289 goto have_master;
290 } 290 }
291 clone = NULL; 291 clone = NULL;
309 309
310 goto lose; 310 goto lose;
311 311
312 have_slave_name: 312 have_slave_name:
313 { 313 {
314 Intbyte *slaveint; 314 Ibyte *slaveint;
315 315
316 EXTERNAL_TO_C_STRING (slave_name, slaveint, Qfile_name); 316 EXTERNAL_TO_C_STRING (slave_name, slaveint, Qfile_name);
317 qxestrncpy (pty_name, slaveint, sizeof (pty_name)); 317 qxestrncpy (pty_name, slaveint, sizeof (pty_name));
318 } 318 }
319 319
867 else 867 else
868 { 868 {
869 int newfd = dup (fd); 869 int newfd = dup (fd);
870 if (newfd == -1) 870 if (newfd == -1)
871 { 871 {
872 Intbyte *errmess; 872 Ibyte *errmess;
873 GET_STRERROR (errmess, errno); 873 GET_STRERROR (errmess, errno);
874 stderr_out ("Error while setting up child: %s\n", errmess); 874 stderr_out ("Error while setting up child: %s\n", errmess);
875 _exit (1); 875 _exit (1);
876 } 876 }
877 return relocate_fd (newfd, min); 877 return relocate_fd (newfd, min);
892 a decent error from within the child (#### not quite correct in 892 a decent error from within the child (#### not quite correct in
893 XEmacs?), this should be verified as an executable directory by the 893 XEmacs?), this should be verified as an executable directory by the
894 parent. */ 894 parent. */
895 895
896 static void 896 static void
897 child_setup (int in, int out, int err, Intbyte **new_argv, 897 child_setup (int in, int out, int err, Ibyte **new_argv,
898 Lisp_Object current_dir) 898 Lisp_Object current_dir)
899 { 899 {
900 Intbyte **env; 900 Ibyte **env;
901 Intbyte *pwd; 901 Ibyte *pwd;
902 902
903 #ifdef SET_EMACS_PRIORITY 903 #ifdef SET_EMACS_PRIORITY
904 if (emacs_priority != 0) 904 if (emacs_priority != 0)
905 nice (- emacs_priority); 905 nice (- emacs_priority);
906 #endif 906 #endif
919 XEmacs does not use vfork. */ 919 XEmacs does not use vfork. */
920 { 920 {
921 REGISTER Bytecount i; 921 REGISTER Bytecount i;
922 922
923 i = XSTRING_LENGTH (current_dir); 923 i = XSTRING_LENGTH (current_dir);
924 pwd = alloca_array (Intbyte, i + 6); 924 pwd = alloca_array (Ibyte, i + 6);
925 memcpy (pwd, "PWD=", 4); 925 memcpy (pwd, "PWD=", 4);
926 memcpy (pwd + 4, XSTRING_DATA (current_dir), i); 926 memcpy (pwd + 4, XSTRING_DATA (current_dir), i);
927 i += 4; 927 i += 4;
928 if (!IS_DIRECTORY_SEP (pwd[i - 1])) 928 if (!IS_DIRECTORY_SEP (pwd[i - 1]))
929 pwd[i++] = DIRECTORY_SEP; 929 pwd[i++] = DIRECTORY_SEP;
949 } 949 }
950 } 950 }
951 951
952 /* Set `env' to a vector of the strings in Vprocess_environment. */ 952 /* Set `env' to a vector of the strings in Vprocess_environment. */
953 /* + 2 to include PWD and terminating 0. */ 953 /* + 2 to include PWD and terminating 0. */
954 env = alloca_array (Intbyte *, XINT (Flength (Vprocess_environment)) + 2); 954 env = alloca_array (Ibyte *, XINT (Flength (Vprocess_environment)) + 2);
955 { 955 {
956 REGISTER Lisp_Object tail; 956 REGISTER Lisp_Object tail;
957 Intbyte **new_env = env; 957 Ibyte **new_env = env;
958 958
959 /* If we have a PWD envvar and we know the real current directory, 959 /* If we have a PWD envvar and we know the real current directory,
960 pass one down, but with corrected value. */ 960 pass one down, but with corrected value. */
961 if (pwd && egetenv ("PWD")) 961 if (pwd && egetenv ("PWD"))
962 *new_env++ = pwd; 962 *new_env++ = pwd;
964 /* Copy the Vprocess_environment strings into new_env. */ 964 /* Copy the Vprocess_environment strings into new_env. */
965 for (tail = Vprocess_environment; 965 for (tail = Vprocess_environment;
966 CONSP (tail) && STRINGP (XCAR (tail)); 966 CONSP (tail) && STRINGP (XCAR (tail));
967 tail = XCDR (tail)) 967 tail = XCDR (tail))
968 { 968 {
969 Intbyte **ep = env; 969 Ibyte **ep = env;
970 Intbyte *envvar = XSTRING_DATA (XCAR (tail)); 970 Ibyte *envvar = XSTRING_DATA (XCAR (tail));
971 971
972 /* See if envvar duplicates any string already in the env. 972 /* See if envvar duplicates any string already in the env.
973 If so, don't put it in. 973 If so, don't put it in.
974 When an env var has multiple definitions, 974 When an env var has multiple definitions,
975 we keep the definition that comes first in process-environment. */ 975 we keep the definition that comes first in process-environment. */
976 for (; ep != new_env; ep++) 976 for (; ep != new_env; ep++)
977 { 977 {
978 Intbyte *p = *ep, *q = envvar; 978 Ibyte *p = *ep, *q = envvar;
979 while (1) 979 while (1)
980 { 980 {
981 if (*q == 0) 981 if (*q == 0)
982 /* The string is malformed; might as well drop it. */ 982 /* The string is malformed; might as well drop it. */
983 goto duplicate; 983 goto duplicate;
986 if (*q == '=') 986 if (*q == '=')
987 goto duplicate; 987 goto duplicate;
988 p++, q++; 988 p++, q++;
989 } 989 }
990 } 990 }
991 if (pwd && !qxestrncmp ((Intbyte *) "PWD=", envvar, 4)) 991 if (pwd && !qxestrncmp ((Ibyte *) "PWD=", envvar, 4))
992 { 992 {
993 *new_env++ = pwd; 993 *new_env++ = pwd;
994 pwd = 0; 994 pwd = 0;
995 } 995 }
996 else 996 else
1270 1270
1271 EMACS_SIGNAL (SIGINT, SIG_DFL); 1271 EMACS_SIGNAL (SIGINT, SIG_DFL);
1272 EMACS_SIGNAL (SIGQUIT, SIG_DFL); 1272 EMACS_SIGNAL (SIGQUIT, SIG_DFL);
1273 1273
1274 { 1274 {
1275 Intbyte **new_argv = alloca_array (Intbyte *, nargv + 2); 1275 Ibyte **new_argv = alloca_array (Ibyte *, nargv + 2);
1276 int i; 1276 int i;
1277 1277
1278 /* Nothing below here GCs so our string pointers shouldn't move. */ 1278 /* Nothing below here GCs so our string pointers shouldn't move. */
1279 new_argv[0] = XSTRING_DATA (program); 1279 new_argv[0] = XSTRING_DATA (program);
1280 for (i = 0; i < nargv; i++) 1280 for (i = 0; i < nargv; i++)
1507 if (!SETJMP (send_process_frame)) 1507 if (!SETJMP (send_process_frame))
1508 { 1508 {
1509 /* use a reasonable-sized buffer (somewhere around the size of the 1509 /* use a reasonable-sized buffer (somewhere around the size of the
1510 stream buffer) so as to avoid inundating the stream with blocked 1510 stream buffer) so as to avoid inundating the stream with blocked
1511 data. */ 1511 data. */
1512 Intbyte chunkbuf[512]; 1512 Ibyte chunkbuf[512];
1513 Bytecount chunklen; 1513 Bytecount chunklen;
1514 1514
1515 while (1) 1515 while (1)
1516 { 1516 {
1517 int writeret; 1517 int writeret;
1589 /* #### get_eof_char simply doesn't return the correct character 1589 /* #### get_eof_char simply doesn't return the correct character
1590 here. Maybe it is needed to determine the right eof 1590 here. Maybe it is needed to determine the right eof
1591 character in init_process_io_handles but here it simply screws 1591 character in init_process_io_handles but here it simply screws
1592 things up. */ 1592 things up. */
1593 #if 0 1593 #if 0
1594 Intbyte eof_char = get_eof_char (XPROCESS (proc)); 1594 Ibyte eof_char = get_eof_char (XPROCESS (proc));
1595 send_process (proc, Qnil, &eof_char, 0, 1); 1595 send_process (proc, Qnil, &eof_char, 0, 1);
1596 #else 1596 #else
1597 send_process (proc, Qnil, (const Intbyte *) "\004", 0, 1); 1597 send_process (proc, Qnil, (const Ibyte *) "\004", 0, 1);
1598 #endif 1598 #endif
1599 return 1; 1599 return 1;
1600 } 1600 }
1601 1601
1602 /* 1602 /*
1730 1730
1731 #ifdef SIGNALS_VIA_CHARACTERS 1731 #ifdef SIGNALS_VIA_CHARACTERS
1732 /* If possible, send signals to the entire pgrp 1732 /* If possible, send signals to the entire pgrp
1733 by sending an input character to it. */ 1733 by sending an input character to it. */
1734 { 1734 {
1735 Intbyte sigchar = process_signal_char (d->subtty, signo); 1735 Ibyte sigchar = process_signal_char (d->subtty, signo);
1736 if (sigchar) 1736 if (sigchar)
1737 { 1737 {
1738 send_process (proc, Qnil, &sigchar, 0, 1); 1738 send_process (proc, Qnil, &sigchar, 0, 1);
1739 return; 1739 return;
1740 } 1740 }
1831 hints.ai_protocol = 0; 1831 hints.ai_protocol = 0;
1832 LISP_STRING_TO_EXTERNAL (host, ext_host, Qnative); 1832 LISP_STRING_TO_EXTERNAL (host, ext_host, Qnative);
1833 retval = getaddrinfo (ext_host, NULL, &hints, &res); 1833 retval = getaddrinfo (ext_host, NULL, &hints, &res);
1834 if (retval != 0) 1834 if (retval != 0)
1835 { 1835 {
1836 CIntbyte *gai_err; 1836 CIbyte *gai_err;
1837 1837
1838 EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, 1838 EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err,
1839 Qstrerror_encoding); 1839 Qstrerror_encoding);
1840 maybe_signal_error (Qio_error, gai_err, host, 1840 maybe_signal_error (Qio_error, gai_err, host,
1841 Qprocess, ERROR_ME_DEBUG_WARN); 1841 Qprocess, ERROR_ME_DEBUG_WARN);
1927 hints.ai_protocol = 0; 1927 hints.ai_protocol = 0;
1928 LISP_STRING_TO_EXTERNAL (host, ext_host, Qunix_host_name_encoding); 1928 LISP_STRING_TO_EXTERNAL (host, ext_host, Qunix_host_name_encoding);
1929 retval = getaddrinfo (ext_host, portstring, &hints, &res); 1929 retval = getaddrinfo (ext_host, portstring, &hints, &res);
1930 if (retval != 0) 1930 if (retval != 0)
1931 { 1931 {
1932 CIntbyte *gai_err; 1932 CIbyte *gai_err;
1933 1933
1934 EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, 1934 EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err,
1935 Qstrerror_encoding); 1935 Qstrerror_encoding);
1936 signal_error (Qio_error, gai_err, list2 (host, service)); 1936 signal_error (Qio_error, gai_err, list2 (host, service));
1937 } 1937 }