* coding.c, sysdep.c: Convert some more functions to standard C.

This commit is contained in:
Juanma Barranquero 2010-07-07 11:38:03 +02:00
parent 1a4990fb03
commit cf84bb5356
3 changed files with 124 additions and 107 deletions

View file

@ -1,3 +1,7 @@
2010-07-07 Juanma Barranquero <lekktu@gmail.com>
* coding.c, sysdep.c: Convert some more functions to standard C.
2010-07-07 Juanma Barranquero <lekktu@gmail.com> 2010-07-07 Juanma Barranquero <lekktu@gmail.com>
* coding.c (decode_coding_gap, encode_coding_gap, decode_coding_object) * coding.c (decode_coding_gap, encode_coding_gap, decode_coding_object)

View file

@ -154,9 +154,8 @@ STRUCT CODING_SYSTEM
#if 0 #if 0
static int static int
detect_coding_XXX (coding, detect_info) detect_coding_XXX (struct coding_system *coding,
struct coding_system *coding; struct coding_detection_info *detect_info)
struct coding_detection_info *detect_info;
{ {
const unsigned char *src = coding->source; const unsigned char *src = coding->source;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -203,8 +202,7 @@ detect_coding_XXX (coding, detect_info)
#if 0 #if 0
static void static void
decode_coding_XXXX (coding) decode_coding_XXXX (struct coding_system *coding)
struct coding_system *coding;
{ {
const unsigned char *src = coding->source + coding->consumed; const unsigned char *src = coding->source + coding->consumed;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -261,8 +259,7 @@ decode_coding_XXXX (coding)
Below is a template of these functions. */ Below is a template of these functions. */
#if 0 #if 0
static void static void
encode_coding_XXX (coding) encode_coding_XXX (struct coding_system *coding)
struct coding_system *coding;
{ {
int multibytep = coding->dst_multibyte; int multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf; int *charbuf = coding->charbuf;
@ -1165,7 +1162,8 @@ coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes)
} }
static void static void
coding_alloc_by_making_gap (struct coding_system *coding, EMACS_INT gap_head_used, EMACS_INT bytes) coding_alloc_by_making_gap (struct coding_system *coding,
EMACS_INT gap_head_used, EMACS_INT bytes)
{ {
if (EQ (coding->src_object, coding->dst_object)) if (EQ (coding->src_object, coding->dst_object))
{ {
@ -1194,7 +1192,8 @@ coding_alloc_by_making_gap (struct coding_system *coding, EMACS_INT gap_head_use
static unsigned char * static unsigned char *
alloc_destination (struct coding_system *coding, EMACS_INT nbytes, unsigned char *dst) alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
unsigned char *dst)
{ {
EMACS_INT offset = dst - coding->destination; EMACS_INT offset = dst - coding->destination;
@ -1292,7 +1291,8 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes, unsigned char
#define UTF_8_BOM_3 0xBF #define UTF_8_BOM_3 0xBF
static int static int
detect_coding_utf_8 (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_utf_8 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base; const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -1423,8 +1423,6 @@ decode_coding_utf_8 (struct coding_system *coding)
} }
CODING_UTF_8_BOM (coding) = utf_without_bom; CODING_UTF_8_BOM (coding) = utf_without_bom;
while (1) while (1)
{ {
int c, c1, c2, c3, c4, c5; int c, c1, c2, c3, c4, c5;
@ -1610,7 +1608,8 @@ encode_coding_utf_8 (struct coding_system *coding)
static int static int
detect_coding_utf_16 (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_utf_16 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base = src; const unsigned char *src = coding->source, *src_base = src;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -1962,7 +1961,8 @@ char emacs_mule_bytes[256];
else return 0. */ else return 0. */
static int static int
detect_coding_emacs_mule (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_emacs_mule (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base; const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -2050,7 +2050,9 @@ detect_coding_emacs_mule (struct coding_system *coding, struct coding_detection_
-1. If SRC is too short, return -2. */ -1. If SRC is too short, return -2. */
int int
emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nbytes, int *nchars, int *id, struct composition_status *cmp_status) emacs_mule_char (struct coding_system *coding, const unsigned char *src,
int *nbytes, int *nchars, int *id,
struct composition_status *cmp_status)
{ {
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base = src; const unsigned char *src_base = src;
@ -2368,7 +2370,8 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nb
static int static int
emacs_mule_finish_composition (int *charbuf, struct composition_status *cmp_status) emacs_mule_finish_composition (int *charbuf,
struct composition_status *cmp_status)
{ {
int idx = - cmp_status->length; int idx = - cmp_status->length;
int new_chars; int new_chars;
@ -3048,7 +3051,8 @@ setup_iso_safe_charsets (Lisp_Object attrs)
If it is, return 1, else return 0. */ If it is, return 1, else return 0. */
static int static int
detect_coding_iso_2022 (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_iso_2022 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base = src; const unsigned char *src = coding->source, *src_base = src;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -4298,7 +4302,9 @@ decode_coding_iso_2022 (struct coding_system *coding)
Return new DST. */ Return new DST. */
unsigned char * unsigned char *
encode_invocation_designation (struct charset *charset, struct coding_system *coding, unsigned char *dst, int *p_nchars) encode_invocation_designation (struct charset *charset,
struct coding_system *coding,
unsigned char *dst, int *p_nchars)
{ {
int multibytep = coding->dst_multibyte; int multibytep = coding->dst_multibyte;
int produced_chars = *p_nchars; int produced_chars = *p_nchars;
@ -4410,7 +4416,8 @@ encode_invocation_designation (struct charset *charset, struct coding_system *co
find all the necessary designations. */ find all the necessary designations. */
static unsigned char * static unsigned char *
encode_designation_at_bol (struct coding_system *coding, int *charbuf, int *charbuf_end, unsigned char *dst) encode_designation_at_bol (struct coding_system *coding, int *charbuf,
int *charbuf_end, unsigned char *dst)
{ {
struct charset *charset; struct charset *charset;
/* Table of charsets to be designated to each graphic register. */ /* Table of charsets to be designated to each graphic register. */
@ -4650,7 +4657,8 @@ encode_coding_iso_2022 (struct coding_system *coding)
CATEGORY_MASK_SJIS, else return 0. */ CATEGORY_MASK_SJIS, else return 0. */
static int static int
detect_coding_sjis (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_sjis (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base; const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -4706,7 +4714,8 @@ detect_coding_sjis (struct coding_system *coding, struct coding_detection_info *
CATEGORY_MASK_BIG5, else return 0. */ CATEGORY_MASK_BIG5, else return 0. */
static int static int
detect_coding_big5 (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_big5 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base; const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -5144,7 +5153,8 @@ encode_coding_big5 (struct coding_system *coding)
CATEGORY_MASK_CCL, else return 0. */ CATEGORY_MASK_CCL, else return 0. */
static int static int
detect_coding_ccl (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_ccl (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base; const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -5423,7 +5433,8 @@ encode_coding_raw_text (struct coding_system *coding)
is, return 1, else return 0. */ is, return 1, else return 0. */
static int static int
detect_coding_charset (struct coding_system *coding, struct coding_detection_info *detect_info) detect_coding_charset (struct coding_system *coding,
struct coding_detection_info *detect_info)
{ {
const unsigned char *src = coding->source, *src_base; const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_end = coding->source + coding->src_bytes;
@ -6168,7 +6179,8 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
#define MAX_EOL_CHECK_COUNT 3 #define MAX_EOL_CHECK_COUNT 3
static int static int
detect_eol (const unsigned char *source, EMACS_INT src_bytes, enum coding_category category) detect_eol (const unsigned char *source, EMACS_INT src_bytes,
enum coding_category category)
{ {
const unsigned char *src = source, *src_end = src + src_bytes; const unsigned char *src = source, *src_end = src + src_bytes;
unsigned char c; unsigned char c;
@ -6704,7 +6716,8 @@ get_translation (Lisp_Object trans, int *buf, int *buf_end)
static int static int
produce_chars (struct coding_system *coding, Lisp_Object translation_table, int last_block) produce_chars (struct coding_system *coding, Lisp_Object translation_table,
int last_block)
{ {
unsigned char *dst = coding->destination + coding->produced; unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes; unsigned char *dst_end = coding->destination + coding->dst_bytes;
@ -7174,7 +7187,9 @@ decode_coding (struct coding_system *coding)
return BUF. */ return BUF. */
static INLINE int * static INLINE int *
handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system *coding, int *buf, EMACS_INT *stop) handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
struct coding_system *coding, int *buf,
EMACS_INT *stop)
{ {
EMACS_INT start, end; EMACS_INT start, end;
Lisp_Object prop; Lisp_Object prop;
@ -7255,7 +7270,9 @@ handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_sys
property value is non-nil (limiting by LIMIT), and return BUF. */ property value is non-nil (limiting by LIMIT), and return BUF. */
static INLINE int * static INLINE int *
handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system *coding, int *buf, EMACS_INT *stop) handle_charset_annotation (EMACS_INT pos, EMACS_INT limit,
struct coding_system *coding, int *buf,
EMACS_INT *stop)
{ {
Lisp_Object val, next; Lisp_Object val, next;
int id; int id;
@ -7275,7 +7292,8 @@ handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system
static void static void
consume_chars (struct coding_system *coding, Lisp_Object translation_table, int max_lookup) consume_chars (struct coding_system *coding, Lisp_Object translation_table,
int max_lookup)
{ {
int *buf = coding->charbuf; int *buf = coding->charbuf;
int *buf_end = coding->charbuf + coding->charbuf_size; int *buf_end = coding->charbuf + coding->charbuf_size;
@ -7560,7 +7578,8 @@ code_conversion_save (int with_work_buf, int multibyte)
} }
int int
decode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT bytes) decode_coding_gap (struct coding_system *coding,
EMACS_INT chars, EMACS_INT bytes)
{ {
int count = SPECPDL_INDEX (); int count = SPECPDL_INDEX ();
Lisp_Object attrs; Lisp_Object attrs;
@ -7605,7 +7624,8 @@ decode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT byte
} }
int int
encode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT bytes) encode_coding_gap (struct coding_system *coding,
EMACS_INT chars, EMACS_INT bytes)
{ {
int count = SPECPDL_INDEX (); int count = SPECPDL_INDEX ();
@ -7658,12 +7678,11 @@ encode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT byte
*/ */
void void
decode_coding_object (coding, src_object, from, from_byte, to, to_byte, decode_coding_object (struct coding_system *coding,
dst_object) Lisp_Object src_object,
struct coding_system *coding; EMACS_INT from, EMACS_INT from_byte,
Lisp_Object src_object; EMACS_INT to, EMACS_INT to_byte,
EMACS_INT from, from_byte, to, to_byte; Lisp_Object dst_object)
Lisp_Object dst_object;
{ {
int count = SPECPDL_INDEX (); int count = SPECPDL_INDEX ();
unsigned char *destination; unsigned char *destination;
@ -7849,12 +7868,11 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
void void
encode_coding_object (coding, src_object, from, from_byte, to, to_byte, encode_coding_object (struct coding_system *coding,
dst_object) Lisp_Object src_object,
struct coding_system *coding; EMACS_INT from, EMACS_INT from_byte,
Lisp_Object src_object; EMACS_INT to, EMACS_INT to_byte,
EMACS_INT from, from_byte, to, to_byte; Lisp_Object dst_object)
Lisp_Object dst_object;
{ {
int count = SPECPDL_INDEX (); int count = SPECPDL_INDEX ();
EMACS_INT chars = to - from; EMACS_INT chars = to - from;
@ -8162,13 +8180,10 @@ function `define-coding-system'. */)
detect only text-format. */ detect only text-format. */
Lisp_Object Lisp_Object
detect_coding_system (src, src_chars, src_bytes, highest, multibytep, detect_coding_system (const unsigned char *src,
coding_system) EMACS_INT src_chars, EMACS_INT src_bytes,
const unsigned char *src; int highest, int multibytep,
EMACS_INT src_chars, src_bytes; Lisp_Object coding_system)
int highest;
int multibytep;
Lisp_Object coding_system;
{ {
const unsigned char *src_end = src + src_bytes; const unsigned char *src_end = src + src_bytes;
Lisp_Object attrs, eol_type; Lisp_Object attrs, eol_type;
@ -8922,7 +8937,9 @@ is nil. */)
Lisp_Object Lisp_Object
code_convert_region (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object dst_object, int encodep, int norecord) code_convert_region (Lisp_Object start, Lisp_Object end,
Lisp_Object coding_system, Lisp_Object dst_object,
int encodep, int norecord)
{ {
struct coding_system coding; struct coding_system coding;
EMACS_INT from, from_byte, to, to_byte; EMACS_INT from, from_byte, to, to_byte;
@ -9061,7 +9078,8 @@ code_convert_string (string, coding_system, dst_object,
ENCODE_FILE, thus we ignore character composition. */ ENCODE_FILE, thus we ignore character composition. */
Lisp_Object Lisp_Object
code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system, int encodep) code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
int encodep)
{ {
return code_convert_string (string, coding_system, Qt, encodep, 0, 1); return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
} }

View file

@ -182,7 +182,7 @@ SIGMASKTYPE sigprocmask_set;
Any other returned value must be freed with free. This is used Any other returned value must be freed with free. This is used
only when get_current_dir_name is not defined on the system. */ only when get_current_dir_name is not defined on the system. */
char* char*
get_current_dir_name () get_current_dir_name (void)
{ {
char *buf; char *buf;
char *pwd; char *pwd;
@ -363,7 +363,8 @@ set_exclusive_use (int fd)
#ifndef subprocesses #ifndef subprocesses
wait_without_blocking () void
wait_without_blocking (void)
{ {
croak ("wait_without_blocking"); croak ("wait_without_blocking");
synch_process_alive = 0; synch_process_alive = 0;
@ -820,7 +821,7 @@ unrequest_sigio (void)
#ifndef MSDOS #ifndef MSDOS
void void
request_sigio () request_sigio (void)
{ {
if (noninteractive || read_socket_hook) if (noninteractive || read_socket_hook)
return; return;
@ -829,7 +830,7 @@ request_sigio ()
} }
void void
unrequest_sigio () unrequest_sigio (void)
{ {
if (noninteractive || read_socket_hook) if (noninteractive || read_socket_hook)
return; return;
@ -1645,7 +1646,7 @@ init_system_name (void)
struct addrinfo hints; struct addrinfo hints;
int ret; int ret;
memset (&hints, 0, sizeof(hints)); memset (&hints, 0, sizeof (hints));
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME; hints.ai_flags = AI_CANONNAME;
@ -1757,8 +1758,8 @@ jmp_buf read_alarm_throw;
int read_alarm_should_throw; int read_alarm_should_throw;
SIGTYPE void
select_alarm () select_alarm (int ignore)
{ {
select_alarmed = 1; select_alarmed = 1;
signal (SIGALRM, SIG_IGN); signal (SIGALRM, SIG_IGN);
@ -1770,10 +1771,9 @@ select_alarm ()
#ifndef WINDOWSNT #ifndef WINDOWSNT
/* Only rfds are checked. */ /* Only rfds are checked. */
int int
sys_select (nfds, rfds, wfds, efds, timeout) sys_select (int nfds,
int nfds; SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
SELECT_TYPE *rfds, *wfds, *efds; EMACS_TIME *timeout)
EMACS_TIME *timeout;
{ {
/* XXX This needs to be updated for multi-tty support. Is there /* XXX This needs to be updated for multi-tty support. Is there
anybody who needs to emulate select these days? */ anybody who needs to emulate select these days? */
@ -1907,7 +1907,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
waiting for at least one character. */ waiting for at least one character. */
void void
read_input_waiting () read_input_waiting (void)
{ {
/* XXX This needs to be updated for multi-tty support. Is there /* XXX This needs to be updated for multi-tty support. Is there
anybody who needs to emulate select these days? */ anybody who needs to emulate select these days? */
@ -2421,11 +2421,10 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte)
#ifndef HAVE_GETWD #ifndef HAVE_GETWD
char * char *
getwd (pathname) getwd (char *pathname)
char *pathname;
{ {
char *npath, *spath; char *npath, *spath;
extern char *getcwd (); extern char *getcwd (char *, size_t);
BLOCK_INPUT; /* getcwd uses malloc */ BLOCK_INPUT; /* getcwd uses malloc */
spath = npath = getcwd ((char *) 0, MAXPATHLEN); spath = npath = getcwd ((char *) 0, MAXPATHLEN);
@ -2454,9 +2453,8 @@ getwd (pathname)
#ifndef HAVE_RENAME #ifndef HAVE_RENAME
rename (from, to) int
const char *from; rename (const char *from, const char *to)
const char *to;
{ {
if (access (from, 0) == 0) if (access (from, 0) == 0)
{ {
@ -2476,7 +2474,8 @@ rename (from, to)
/* HPUX curses library references perror, but as far as we know /* HPUX curses library references perror, but as far as we know
it won't be called. Anyway this definition will do for now. */ it won't be called. Anyway this definition will do for now. */
perror () void
perror (void)
{ {
} }
#endif /* HPUX and not HAVE_PERROR */ #endif /* HPUX and not HAVE_PERROR */
@ -2489,9 +2488,8 @@ perror ()
* until we are, then close the unsuccessful ones. * until we are, then close the unsuccessful ones.
*/ */
dup2 (oldd, newd) int
int oldd; dup2 (int oldd, int newd)
int newd;
{ {
register int fd, ret; register int fd, ret;
@ -2525,11 +2523,9 @@ dup2 (oldd, newd)
/* ARGSUSED */ /* ARGSUSED */
int int
gettimeofday (tp, tzp) gettimeofday (struct timeval *tp, struct timezone *tzp)
struct timeval *tp;
struct timezone *tzp;
{ {
extern long time (); extern long time (long);
tp->tv_sec = time ((long *)0); tp->tv_sec = time ((long *)0);
tp->tv_usec = 0; tp->tv_usec = 0;
@ -2616,9 +2612,7 @@ set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime)
* Make a directory. * Make a directory.
*/ */
int int
mkdir (dpath, dmode) mkdir (char *dpath, int dmode)
char *dpath;
int dmode;
{ {
int cpid, status, fd; int cpid, status, fd;
struct stat statbuf; struct stat statbuf;
@ -2676,8 +2670,7 @@ mkdir (dpath, dmode)
#ifndef HAVE_RMDIR #ifndef HAVE_RMDIR
int int
rmdir (dpath) rmdir (char *dpath)
char *dpath;
{ {
int cpid, status, fd; int cpid, status, fd;
struct stat statbuf; struct stat statbuf;
@ -2724,8 +2717,7 @@ rmdir (dpath)
#ifndef HAVE_STRSIGNAL #ifndef HAVE_STRSIGNAL
char * char *
strsignal (code) strsignal (int code)
int code;
{ {
char *signame = 0; char *signame = 0;
@ -2741,7 +2733,8 @@ strsignal (code)
#ifdef HAVE_TERMIOS #ifdef HAVE_TERMIOS
/* For make-serial-process */ /* For make-serial-process */
int serial_open (char *port) int
serial_open (char *port)
{ {
int fd = -1; int fd = -1;
@ -2774,7 +2767,8 @@ int serial_open (char *port)
#if !defined (HAVE_CFMAKERAW) #if !defined (HAVE_CFMAKERAW)
/* Workaround for targets which are missing cfmakeraw. */ /* Workaround for targets which are missing cfmakeraw. */
/* Pasted from man page. */ /* Pasted from man page. */
static void cfmakeraw (struct termios *termios_p) static void
cfmakeraw (struct termios *termios_p)
{ {
termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
termios_p->c_oflag &= ~OPOST; termios_p->c_oflag &= ~OPOST;
@ -2786,7 +2780,8 @@ static void cfmakeraw (struct termios *termios_p)
#if !defined (HAVE_CFSETSPEED) #if !defined (HAVE_CFSETSPEED)
/* Workaround for targets which are missing cfsetspeed. */ /* Workaround for targets which are missing cfsetspeed. */
static int cfsetspeed (struct termios *termios_p, speed_t vitesse) static int
cfsetspeed (struct termios *termios_p, speed_t vitesse)
{ {
return (cfsetispeed (termios_p, vitesse) return (cfsetispeed (termios_p, vitesse)
+ cfsetospeed (termios_p, vitesse)); + cfsetospeed (termios_p, vitesse));
@ -2839,7 +2834,7 @@ serial_configure (struct Lisp_Process *p,
CHECK_NUMBER (tem); CHECK_NUMBER (tem);
if (XINT (tem) != 7 && XINT (tem) != 8) if (XINT (tem) != 7 && XINT (tem) != 8)
error (":bytesize must be nil (8), 7, or 8"); error (":bytesize must be nil (8), 7, or 8");
summary[0] = XINT(tem) + '0'; summary[0] = XINT (tem) + '0';
#if defined (CSIZE) && defined (CS7) && defined (CS8) #if defined (CSIZE) && defined (CS7) && defined (CS8)
attr.c_cflag &= ~CSIZE; attr.c_cflag &= ~CSIZE;
attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8); attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8);
@ -2997,7 +2992,7 @@ list_system_processes (void)
#elif !defined (WINDOWSNT) && !defined (MSDOS) #elif !defined (WINDOWSNT) && !defined (MSDOS)
Lisp_Object Lisp_Object
list_system_processes () list_system_processes (void)
{ {
return Qnil; return Qnil;
} }
@ -3196,7 +3191,7 @@ system_process_attributes (Lisp_Object pid)
procfn_end = fn + strlen (fn); procfn_end = fn + strlen (fn);
strcpy (procfn_end, "/stat"); strcpy (procfn_end, "/stat");
fd = emacs_open (fn, O_RDONLY, 0); fd = emacs_open (fn, O_RDONLY, 0);
if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof(procbuf) - 1)) > 0) if (fd >= 0 && (nread = emacs_read (fd, procbuf, sizeof (procbuf) - 1)) > 0)
{ {
procbuf[nread] = '\0'; procbuf[nread] = '\0';
p = procbuf; p = procbuf;
@ -3457,7 +3452,7 @@ system_process_attributes (Lisp_Object pid)
strcpy (procfn_end, "/psinfo"); strcpy (procfn_end, "/psinfo");
fd = emacs_open (fn, O_RDONLY, 0); fd = emacs_open (fn, O_RDONLY, 0);
if (fd >= 0 if (fd >= 0
&& (nread = read (fd, (char*)&pinfo, sizeof(struct psinfo)) > 0)) && (nread = read (fd, (char*)&pinfo, sizeof (struct psinfo)) > 0))
{ {
attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs);
attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs);