synchronize_system_messages_locale ();
signame = strsignal (code);
if (signame == 0)
- signame = "unknown";
- string = build_string (signame);
+ string = build_string ("unknown");
+ else
+ {
+ int c1, c2;
+
+ string = make_unibyte_string (signame, strlen (signame));
+ if (! NILP (Vlocale_coding_system))
+ string = (code_convert_string_norecord
+ (string, Vlocale_coding_system, 0));
+ c1 = STRING_CHAR ((char *) SDATA (string), 0);
+ c2 = DOWNCASE (c1);
+ if (c1 != c2)
+ Faset (string, make_number (0), make_number (c2));
+ }
string2 = build_string (coredump ? " (core dumped)\n" : "\n");
- SSET (string, 0, DOWNCASE (SREF (string, 0)));
return concat2 (string, string2);
}
else if (EQ (symbol, Qexit))
XPROCESS (proc)->encode_coding_system = val;
}
- new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
-
/* If program file name is not absolute, search our path for it.
Put the name we will really use in TEM. */
if (!IS_DIRECTORY_SEP (SREF (program, 0))
&& SREF (tem, 1) == ':')
tem = Fsubstring (tem, make_number (2), Qnil);
- /* Encode the file name and put it in NEW_ARGV.
- That's where the child will use it to execute the program. */
- tem = ENCODE_FILE (tem);
- new_argv[0] = SDATA (tem);
+ {
+ struct gcpro gcpro1;
+ GCPRO1 (tem);
+
+ /* Encode the file name and put it in NEW_ARGV.
+ That's where the child will use it to execute the program. */
+ tem = Fcons (ENCODE_FILE (tem), Qnil);
+
+ /* Here we encode arguments by the coding system used for sending
+ data to the process. We don't support using different coding
+ systems for encoding arguments and for encoding data sent to the
+ process. */
- /* Here we encode arguments by the coding system used for sending
- data to the process. We don't support using different coding
- systems for encoding arguments and for encoding data sent to the
- process. */
+ for (i = 3; i < nargs; i++)
+ {
+ tem = Fcons (args[i], tem);
+ CHECK_STRING (XCAR (tem));
+ if (STRING_MULTIBYTE (XCAR (tem)))
+ XSETCAR (tem,
+ code_convert_string_norecord
+ (XCAR (tem), XPROCESS (proc)->encode_coding_system, 1));
+ }
- for (i = 3; i < nargs; i++)
+ UNGCPRO;
+ }
+
+ /* Now that everything is encoded we can collect the strings into
+ NEW_ARGV. */
+ new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
+ new_argv[nargs - 2] = 0;
+
+ for (i = nargs - 3; i >= 0; i--)
{
- tem = args[i];
- CHECK_STRING (tem);
- if (STRING_MULTIBYTE (tem))
- tem = (code_convert_string_norecord
- (tem, XPROCESS (proc)->encode_coding_system, 1));
- new_argv[i - 2] = SDATA (tem);
+ new_argv[i] = SDATA (XCAR (tem));
+ tem = XCDR (tem);
}
- new_argv[i - 2] = 0;
XPROCESS (proc)->decoding_buf = make_uninit_string (0);
XPROCESS (proc)->decoding_carryover = 0;
#endif
if (forkin < 0)
report_file_error ("Opening pty", Qnil);
-#if defined (DONT_REOPEN_PTY)
- /* In the case that vfork is defined as fork, the parent process
- (Emacs) may send some data before the child process completes
- tty options setup. So we setup tty before forking. */
- child_setup_tty (forkout);
-#endif /* DONT_REOPEN_PTY */
#else
forkin = forkout = -1;
#endif /* not USG, or USG_SUBTTY_WORKS */
#endif /* SIGCHLD */
#endif /* !POSIX_SIGNALS */
-#if !defined (DONT_REOPEN_PTY)
if (pty_flag)
child_setup_tty (xforkout);
-#endif /* not DONT_REOPEN_PTY */
#ifdef WINDOWSNT
pid = child_setup (xforkin, xforkout, xforkout,
new_argv, 1, current_dir);
register int nbytes;
char *chars;
register Lisp_Object outstream;
- register struct buffer *old = current_buffer;
register struct Lisp_Process *p = XPROCESS (proc);
register int opoint;
struct coding_system *coding = proc_decode_coding_system[channel];
int opoint_byte;
Lisp_Object text;
struct buffer *b;
+ int count = SPECPDL_INDEX ();
odeactivate = Vdeactivate_mark;
+ record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
Fset_buffer (p->buffer);
opoint = PT;
opoint_byte = PT_BYTE;
current_buffer->read_only = old_read_only;
SET_PT_BOTH (opoint, opoint_byte);
- set_buffer_internal (old);
+ unbind_to (count, Qnil);
}
return nbytes;
}
}
len = coding->produced;
- buf = SDATA (coding->dst_object);
+ object = coding->dst_object;
+ buf = SDATA (object);
}
if (pty_max_bytes == 0)
/* Running filters might relocate buffers or strings.
Arrange to relocate BUF. */
- if (CODING_REQUIRE_ENCODING (coding))
- offset = buf - SDATA (coding->dst_object);
- else if (BUFFERP (object))
+ if (BUFFERP (object))
offset = BUF_PTR_BYTE_POS (XBUFFER (object), buf);
else if (STRINGP (object))
offset = buf - SDATA (object);
wait_reading_process_output (1, 0, 0, 0, Qnil, NULL, 0);
#endif
- if (CODING_REQUIRE_ENCODING (coding))
- buf = offset + SDATA (coding->dst_object);
- else if (BUFFERP (object))
+ if (BUFFERP (object))
buf = BUF_BYTE_ADDRESS (XBUFFER (object), offset);
else if (STRINGP (object))
buf = offset + SDATA (object);