xref: /dflybsd-src/lib/libc/stdio/ungetwc.3 (revision 0d5acd7467c4e95f792ef49fceb3ab8e917ce86b)
1*0d5acd74SJohn Marino.\"	$NetBSD: ungetwc.3,v 1.3 2002/02/07 07:00:27 ross Exp $
262f08720SJoerg Sonnenberger.\"
362f08720SJoerg Sonnenberger.\" Copyright (c) 1990, 1991, 1993
462f08720SJoerg Sonnenberger.\"	The Regents of the University of California.  All rights reserved.
562f08720SJoerg Sonnenberger.\"
662f08720SJoerg Sonnenberger.\" This code is derived from software contributed to Berkeley by
762f08720SJoerg Sonnenberger.\" Chris Torek and the American National Standards Committee X3,
862f08720SJoerg Sonnenberger.\" on Information Processing Systems.
962f08720SJoerg Sonnenberger.\"
1062f08720SJoerg Sonnenberger.\" Redistribution and use in source and binary forms, with or without
1162f08720SJoerg Sonnenberger.\" modification, are permitted provided that the following conditions
1262f08720SJoerg Sonnenberger.\" are met:
1362f08720SJoerg Sonnenberger.\" 1. Redistributions of source code must retain the above copyright
1462f08720SJoerg Sonnenberger.\"    notice, this list of conditions and the following disclaimer.
1562f08720SJoerg Sonnenberger.\" 2. Redistributions in binary form must reproduce the above copyright
1662f08720SJoerg Sonnenberger.\"    notice, this list of conditions and the following disclaimer in the
1762f08720SJoerg Sonnenberger.\"    documentation and/or other materials provided with the distribution.
1862f08720SJoerg Sonnenberger.\" 3. Neither the name of the University nor the names of its contributors
1962f08720SJoerg Sonnenberger.\"    may be used to endorse or promote products derived from this software
2062f08720SJoerg Sonnenberger.\"    without specific prior written permission.
2162f08720SJoerg Sonnenberger.\"
2262f08720SJoerg Sonnenberger.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2362f08720SJoerg Sonnenberger.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2462f08720SJoerg Sonnenberger.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2562f08720SJoerg Sonnenberger.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2662f08720SJoerg Sonnenberger.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2762f08720SJoerg Sonnenberger.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2862f08720SJoerg Sonnenberger.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2962f08720SJoerg Sonnenberger.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3062f08720SJoerg Sonnenberger.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3162f08720SJoerg Sonnenberger.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3262f08720SJoerg Sonnenberger.\" SUCH DAMAGE.
3362f08720SJoerg Sonnenberger.\"
3462f08720SJoerg Sonnenberger.\"     @(#)ungetc.3	8.1 (Berkeley) 6/4/93
35*0d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/stdio/ungetwc.3 165903 2007-01-09 00:28:16Z imp $
3662f08720SJoerg Sonnenberger.\"
37*0d5acd74SJohn Marino.Dd March 3, 2004
3862f08720SJoerg Sonnenberger.Dt UNGETWC 3
3962f08720SJoerg Sonnenberger.Os
4062f08720SJoerg Sonnenberger.Sh NAME
4162f08720SJoerg Sonnenberger.Nm ungetwc
42*0d5acd74SJohn Marino.Nd un-get wide character from input stream
4362f08720SJoerg Sonnenberger.Sh LIBRARY
4462f08720SJoerg Sonnenberger.Lb libc
4562f08720SJoerg Sonnenberger.Sh SYNOPSIS
4662f08720SJoerg Sonnenberger.In stdio.h
4762f08720SJoerg Sonnenberger.In wchar.h
4862f08720SJoerg Sonnenberger.Ft wint_t
4962f08720SJoerg Sonnenberger.Fn ungetwc "wint_t wc" "FILE *stream"
5062f08720SJoerg Sonnenberger.Sh DESCRIPTION
5162f08720SJoerg SonnenbergerThe
5262f08720SJoerg Sonnenberger.Fn ungetwc
53*0d5acd74SJohn Marinofunction pushes the wide character
5462f08720SJoerg Sonnenberger.Fa wc
55*0d5acd74SJohn Marino(converted to an
56*0d5acd74SJohn Marino.Vt wchar_t )
5762f08720SJoerg Sonnenbergerback onto the input stream pointed to by
5862f08720SJoerg Sonnenberger.Fa stream .
59*0d5acd74SJohn MarinoThe pushed-backed wide characters will be returned by subsequent reads on the
6062f08720SJoerg Sonnenbergerstream (in reverse order).
6162f08720SJoerg SonnenbergerA successful intervening call, using the same stream, to one of the file
6262f08720SJoerg Sonnenbergerpositioning functions
6362f08720SJoerg Sonnenberger.Xr fseek 3 ,
6462f08720SJoerg Sonnenberger.Xr fsetpos 3 ,
6562f08720SJoerg Sonnenbergeror
6662f08720SJoerg Sonnenberger.Xr rewind 3
67*0d5acd74SJohn Marinowill discard the pushed back wide characters.
6862f08720SJoerg Sonnenberger.Pp
69*0d5acd74SJohn MarinoOne wide character of push-back is guaranteed,
7062f08720SJoerg Sonnenbergerbut as long as there is
7162f08720SJoerg Sonnenbergersufficient memory, an effectively infinite amount of pushback is allowed.
7262f08720SJoerg Sonnenberger.Pp
7362f08720SJoerg SonnenbergerIf a character is successfully pushed-back,
7462f08720SJoerg Sonnenbergerthe end-of-file indicator for the stream is cleared.
7562f08720SJoerg Sonnenberger.Sh RETURN VALUES
7662f08720SJoerg SonnenbergerThe
7762f08720SJoerg Sonnenberger.Fn ungetwc
7862f08720SJoerg Sonnenbergerfunction
7962f08720SJoerg Sonnenbergerreturns
80*0d5acd74SJohn Marinothe wide character pushed-back after the conversion, or
8162f08720SJoerg Sonnenberger.Dv WEOF
8262f08720SJoerg Sonnenbergerif the operation fails.
8362f08720SJoerg SonnenbergerIf the value of the argument
8462f08720SJoerg Sonnenberger.Fa c
8562f08720SJoerg Sonnenbergercharacter equals
8662f08720SJoerg Sonnenberger.Dv WEOF ,
8762f08720SJoerg Sonnenbergerthe operation will fail and the stream will remain unchanged.
8862f08720SJoerg Sonnenberger.Sh SEE ALSO
8962f08720SJoerg Sonnenberger.Xr fseek 3 ,
9062f08720SJoerg Sonnenberger.Xr getwc 3
9162f08720SJoerg Sonnenberger.Sh STANDARDS
9262f08720SJoerg SonnenbergerThe
9362f08720SJoerg Sonnenberger.Fn ungetwc
9462f08720SJoerg Sonnenbergerfunction conforms to
9562f08720SJoerg Sonnenberger.St -isoC-99 .
96