diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-10-13 21:35:39 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-10-13 21:35:39 +0000 |
commit | d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285 (patch) | |
tree | 51df6ee380158ffb9c50d9dd7801b26411f645c7 /termios/cfsetspeed.c | |
parent | 31c95122ee73661bacd2b3f35140937e5950a7f5 (diff) | |
download | glibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.tar glibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.tar.gz glibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.tar.bz2 glibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.zip |
update from main archvie 961013cvs/libc-961015cvs/libc-961014
Sun Oct 13 22:52:56 1996 Ulrich Drepper <drepper@cygnus.com>
* shlib-versions: Add version number/name for ld.so.
* Makeconfig: Move definition of rtld-installed-name after
inclusion of soversions.mk.
Don't add . before version number from shlib-versions file when
when name does not start with digit. This is needed for ld.so.
Sat Oct 12 20:31:58 1996 Richard Henderson <rth@tamu.edu>
* libio/iogets.c: Warn when gets used.
* stdio/gets.c: Strengthen the warning.
Sat Oct 12 23:10:43 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/Makefile [_LIBC_REENTRANT] (routines): Add peekc.
* libio/libio.h: Add prototypes for _IO_getc, _IO_putc, _IO_feof,
_IO_ferror, _IO_peekc_locked, and _IO_ftrylockfile.
Remove prototypes for _IO_getc_locked and _IO_putc_locked.
[_IO_MTSAFE_IO]: Add weak aliases for _IO_flockfile and
_IO_funlockfile.
[! _IO_MTSAFE_IO]: Define _IO_ftrylockfile as empty.
Define _IO_getc, _IO_peekc, _IO_putc, _IO_feof, _IO_ferror to
appropriate values according to __USE_REENTRANT.
* libio/stdio.h: Add prototype for ftrylockfile.
[!_LIBC]: Define getc_locked, getchar_locked, putchar_locked,
getc, getchar, putc, and putchar using _IO_* names.
* libio/feof.c: Rename to _IO_feof and make feof weak alias.
* libio/ferror.c: Rename to _IO_ferror and make ferror weak alias.
* libio/getc.c: Rename to _IO_getc and make getc weak alias.
* libio/putc.c: Rename to _IO_putc and make putc weak alias.
* libio/putc_u.c: Don't define alias _IO_putc_unlocked.
* libio/peekc.c: New file.
* stdio-common/vfprintf.c (vfprintf): Unconditionally call
__flockfile.
* sysdeps/stub/locfile.c [USE_IN_LIBIO]: Also define _IO_* names.
* crypt/Makefile (tests): Add md5test and md5c-test.
* crypt/md5-crypt.c: Correct various error. Now md5_process_bytes
is called, the buffer limit is honoured and a loop in a inner
loop is corrected.
* crypt/md5.h (struct md5_ctx): Add new fields.
Add prototypes for new functions.
* crypt/md5.c (md5_init_ctx): Initialize new fields.
(md5_finish_ctx): New function. Like md5_read_ctx but before
perform correct finalization.
(md5_process_bytes): New function. Similar to md5_proces_block,
but does not require input size to be multiple of 64.
(md5_stream): Rewrite using md5_process_bytes and md5_finish_ctx.
(md5_buffer): Likewise.
(md5_process_block): Count number of bytes.
* crypt/md5test.c: New file. Test program for MD5 functions.
* crypt/md5c-test.c: New file: Test program for MD5 crypt
function.
* po/fr.po: Update.
* time/strptime.c: Recognize %s, %u, %g, and %G format.
* posix/getopt.c: Add some more casts and initializations to
prevent warnings.
Sat Oct 12 16:15:29 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/speed.c (speeds): Removed. We provide
an extra function to provide this functionality.
(cfgetospeed): Simply return masked value.
(cfsetospeed): Don't use speeds array and so we can simply test
the value of SPEED for illegal values.
* termios/cfsetspeed.c: Rewrite. We convert here between the
real values and the B* constants.
Changes suggested by Uwe Ohse <uwe@tirka.gun.de>.
Fri Oct 11 21:45:34 1996 Andreas Jaeger <aj@arthur.pfalz.de>
* locale/programs/xstrdup.c: Define prototypes.
* locale/programs/xmalloc.c: Likewise.
* stdio-common/xbug.c (main): Change definition to avoid warning.
Fri Oct 11 23:36:31 1996 Miles Bader <miles@gnu.ai.mit.edu>
* db/hash/hash.c (__hash_open): Correctly test for a read-write db.
Diffstat (limited to 'termios/cfsetspeed.c')
-rw-r--r-- | termios/cfsetspeed.c | 100 |
1 files changed, 94 insertions, 6 deletions
diff --git a/termios/cfsetspeed.c b/termios/cfsetspeed.c index a4a205b52f..5f22eade4b 100644 --- a/termios/cfsetspeed.c +++ b/termios/cfsetspeed.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1993 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1993, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,16 +16,104 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> #include <termios.h> #include <errno.h> #include <stddef.h> +static struct speed_struct +{ + speed_t value; + speed_t internal; +} speeds[] = + { +#ifdef B0 + { 0, B0 }, +#endif +#ifdef B50 + { 50, B50 }, +#endif +#ifdef B75 + { 75, B75 }, +#endif +#ifdef B110 + { 110, B110 }, +#endif +#ifdef B134 + { 134, B134 }, +#endif +#ifdef B150 + { 150, B150 }, +#endif +#ifdef B200 + { 200, B200 }, +#endif +#ifdef B300 + { 300, B300 }, +#endif +#ifdef B600 + { 600, B600 }, +#endif +#ifdef B1200 + { 1200, B1200 }, +#endif +#ifdef B1200 + { 1200, B1200 }, +#endif +#ifdef B1800 + { 1800, B1800 }, +#endif +#ifdef B2400 + { 2400, B2400 }, +#endif +#ifdef B4800 + { 4800, B4800 }, +#endif +#ifdef B9600 + { 9600, B9600 }, +#endif +#ifdef B19200 + { 19200, B19200 }, +#endif +#ifdef B38400 + { 38400, B38400 }, +#endif +#ifdef B57600 + { 57600, B57600 }, +#endif +#ifdef B76800 + { 76800, B76800 }, +#endif +#ifdef B115200 + { 115200, B115200 }, +#endif +#ifdef B153600 + { 153600, B153600 }, +#endif +#ifdef B230400 + { 230400, B230400 }, +#endif +#ifdef B307200 + { 307200, B307200 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif + }; + + /* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */ void -DEFUN(cfsetspeed, (termios_p, speed), - struct termios *termios_p AND speed_t speed) +cfsetspeed (struct termios *termios_p, speed_t speed) { - cfsetispeed (termios_p, speed); - cfsetospeed (termios_p, speed); + size_t cnt; + + for (cnt = 0; cnt < sizeof (speeds); ++cnt) + if (speed == speeds[cnt].value) + { + cfsetispeed (termios_p, speed); + cfsetospeed (termios_p, speed); + return; + } + + __set_errno (EINVAL); } |