xref: /netbsd/lib/libc/termios/cfsetspeed.c (revision 90275da6)
1*90275da6Sabs /*	$NetBSD: cfsetspeed.c,v 1.8 2012/06/25 22:32:46 abs Exp $	*/
25f11a56cSjtc 
35f11a56cSjtc /*-
45f11a56cSjtc  * Copyright (c) 1989, 1993
55f11a56cSjtc  *	The Regents of the University of California.  All rights reserved.
65f11a56cSjtc  *
75f11a56cSjtc  * Redistribution and use in source and binary forms, with or without
85f11a56cSjtc  * modification, are permitted provided that the following conditions
95f11a56cSjtc  * are met:
105f11a56cSjtc  * 1. Redistributions of source code must retain the above copyright
115f11a56cSjtc  *    notice, this list of conditions and the following disclaimer.
125f11a56cSjtc  * 2. Redistributions in binary form must reproduce the above copyright
135f11a56cSjtc  *    notice, this list of conditions and the following disclaimer in the
145f11a56cSjtc  *    documentation and/or other materials provided with the distribution.
15eb7c1594Sagc  * 3. Neither the name of the University nor the names of its contributors
165f11a56cSjtc  *    may be used to endorse or promote products derived from this software
175f11a56cSjtc  *    without specific prior written permission.
185f11a56cSjtc  *
195f11a56cSjtc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
205f11a56cSjtc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
215f11a56cSjtc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225f11a56cSjtc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
235f11a56cSjtc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
245f11a56cSjtc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255f11a56cSjtc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
265f11a56cSjtc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
275f11a56cSjtc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
285f11a56cSjtc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
295f11a56cSjtc  * SUCH DAMAGE.
305f11a56cSjtc  */
315f11a56cSjtc 
323ad08ca2Schristos #include <sys/cdefs.h>
335f11a56cSjtc #if defined(LIBC_SCCS) && !defined(lint)
345f11a56cSjtc #if 0
355f11a56cSjtc static char sccsid[] = "@(#)termios.c	8.2 (Berkeley) 2/21/94";
365f11a56cSjtc #else
37*90275da6Sabs __RCSID("$NetBSD: cfsetspeed.c,v 1.8 2012/06/25 22:32:46 abs Exp $");
385f11a56cSjtc #endif
395f11a56cSjtc #endif /* LIBC_SCCS and not lint */
405f11a56cSjtc 
4143fa6fe3Sjtc #include "namespace.h"
42b48252f3Slukem 
43b48252f3Slukem #include <assert.h>
44b48252f3Slukem #include <stdio.h>
455f11a56cSjtc #include <termios.h>
465f11a56cSjtc 
4743fa6fe3Sjtc #ifdef __weak_alias
__weak_alias(cfsetspeed,_cfsetspeed)4860549036Smycroft __weak_alias(cfsetspeed,_cfsetspeed)
4943fa6fe3Sjtc #endif
5043fa6fe3Sjtc 
515f11a56cSjtc int
52*90275da6Sabs cfsetspeed(struct termios *t, speed_t speed)
535f11a56cSjtc {
54b48252f3Slukem 
55b48252f3Slukem 	_DIAGASSERT(t != NULL);
56b48252f3Slukem 
575f11a56cSjtc 	t->c_ispeed = t->c_ospeed = speed;
585f11a56cSjtc 	return (0);
595f11a56cSjtc }
60