xref: /netbsd-src/lib/libc/compat/gen/compat_unvis.c (revision 2d8f83e77be83d892ae914d558b6c7b331828421)
1*2d8f83e7Schristos /*	$NetBSD: compat_unvis.c,v 1.3 2011/03/12 19:52:47 christos Exp $	*/
25b84b398Schristos 
35b84b398Schristos /*-
45b84b398Schristos  * Copyright (c) 1989, 1993
55b84b398Schristos  *	The Regents of the University of California.  All rights reserved.
65b84b398Schristos  *
75b84b398Schristos  * Redistribution and use in source and binary forms, with or without
85b84b398Schristos  * modification, are permitted provided that the following conditions
95b84b398Schristos  * are met:
105b84b398Schristos  * 1. Redistributions of source code must retain the above copyright
115b84b398Schristos  *    notice, this list of conditions and the following disclaimer.
125b84b398Schristos  * 2. Redistributions in binary form must reproduce the above copyright
135b84b398Schristos  *    notice, this list of conditions and the following disclaimer in the
145b84b398Schristos  *    documentation and/or other materials provided with the distribution.
155b84b398Schristos  * 3. Neither the name of the University nor the names of its contributors
165b84b398Schristos  *    may be used to endorse or promote products derived from this software
175b84b398Schristos  *    without specific prior written permission.
185b84b398Schristos  *
195b84b398Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
205b84b398Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
215b84b398Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225b84b398Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
235b84b398Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
245b84b398Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255b84b398Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
265b84b398Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
275b84b398Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
285b84b398Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
295b84b398Schristos  * SUCH DAMAGE.
305b84b398Schristos  */
315b84b398Schristos 
325b84b398Schristos #include <sys/cdefs.h>
335b84b398Schristos #if defined(LIBC_SCCS) && !defined(lint)
345b84b398Schristos #if 0
355b84b398Schristos static char sccsid[] = "@(#)unvis.c	8.1 (Berkeley) 6/4/93";
365b84b398Schristos #else
37*2d8f83e7Schristos __RCSID("$NetBSD: compat_unvis.c,v 1.3 2011/03/12 19:52:47 christos Exp $");
385b84b398Schristos #endif
395b84b398Schristos #endif /* LIBC_SCCS and not lint */
405b84b398Schristos 
415b84b398Schristos #define __LIBC12_SOURCE__
425b84b398Schristos 
435b84b398Schristos #include "namespace.h"
445b84b398Schristos #include <sys/types.h>
455b84b398Schristos 
465b84b398Schristos #include <assert.h>
475b84b398Schristos #include <stdio.h>
485b84b398Schristos #include <vis.h>
495b84b398Schristos #include <compat/include/vis.h>
505b84b398Schristos 
515b84b398Schristos #ifdef __warn_references
525b84b398Schristos __warn_references(unvis,
535b84b398Schristos     "warning: reference to compatibility unvis(); include <vis.h> for correct reference")
545b84b398Schristos #endif
555b84b398Schristos 
565b84b398Schristos int
unvis(char * cp,int c,int * astate,int flag)579fa07b05Shubertf unvis(char *cp, int c, int *astate, int flag)
585b84b398Schristos {
59*2d8f83e7Schristos 	flag = (flag & ~1) | ((flag & 1) ? UNVIS_END : 0);
60*2d8f83e7Schristos 	return __unvis50(cp, c, astate, flag);
615b84b398Schristos }
62