xref: /dflybsd-src/lib/libc/stdio/ungetwc.3 (revision 7d3de48c6627bb72c991c76cd5d8a010211db77a)
10d5acd74SJohn 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
350d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/stdio/ungetwc.3 165903 2007-01-09 00:28:16Z imp $
3662f08720SJoerg Sonnenberger.\"
37*7d3de48cSSascha Wildner.Dd December 26, 2013
3862f08720SJoerg Sonnenberger.Dt UNGETWC 3
3962f08720SJoerg Sonnenberger.Os
4062f08720SJoerg Sonnenberger.Sh NAME
41*7d3de48cSSascha Wildner.Nm ungetwc ,
42*7d3de48cSSascha Wildner.Nm ungetwc_l
430d5acd74SJohn Marino.Nd un-get wide character from input stream
4462f08720SJoerg Sonnenberger.Sh LIBRARY
4562f08720SJoerg Sonnenberger.Lb libc
4662f08720SJoerg Sonnenberger.Sh SYNOPSIS
4762f08720SJoerg Sonnenberger.In stdio.h
4862f08720SJoerg Sonnenberger.In wchar.h
4962f08720SJoerg Sonnenberger.Ft wint_t
5062f08720SJoerg Sonnenberger.Fn ungetwc "wint_t wc" "FILE *stream"
51*7d3de48cSSascha Wildner.In xlocale.h
52*7d3de48cSSascha Wildner.Ft wint_t
53*7d3de48cSSascha Wildner.Fn ungetwc_l "wint_t wc" "FILE *stream" "locale_t locale"
5462f08720SJoerg Sonnenberger.Sh DESCRIPTION
5562f08720SJoerg SonnenbergerThe
5662f08720SJoerg Sonnenberger.Fn ungetwc
57*7d3de48cSSascha Wildnerand
58*7d3de48cSSascha Wildner.Fn ungetwc_l
59*7d3de48cSSascha Wildnerfunctions push the wide character
6062f08720SJoerg Sonnenberger.Fa wc
610d5acd74SJohn Marino(converted to an
620d5acd74SJohn Marino.Vt wchar_t )
6362f08720SJoerg Sonnenbergerback onto the input stream pointed to by
6462f08720SJoerg Sonnenberger.Fa stream .
650d5acd74SJohn MarinoThe pushed-backed wide characters will be returned by subsequent reads on the
6662f08720SJoerg Sonnenbergerstream (in reverse order).
6762f08720SJoerg SonnenbergerA successful intervening call, using the same stream, to one of the file
6862f08720SJoerg Sonnenbergerpositioning functions
6962f08720SJoerg Sonnenberger.Xr fseek 3 ,
7062f08720SJoerg Sonnenberger.Xr fsetpos 3 ,
7162f08720SJoerg Sonnenbergeror
7262f08720SJoerg Sonnenberger.Xr rewind 3
730d5acd74SJohn Marinowill discard the pushed back wide characters.
7462f08720SJoerg Sonnenberger.Pp
750d5acd74SJohn MarinoOne wide character of push-back is guaranteed,
7662f08720SJoerg Sonnenbergerbut as long as there is
7762f08720SJoerg Sonnenbergersufficient memory, an effectively infinite amount of pushback is allowed.
7862f08720SJoerg Sonnenberger.Pp
7962f08720SJoerg SonnenbergerIf a character is successfully pushed-back,
8062f08720SJoerg Sonnenbergerthe end-of-file indicator for the stream is cleared.
81*7d3de48cSSascha Wildner.Pp
82*7d3de48cSSascha WildnerThe
83*7d3de48cSSascha Wildner.Fn ungetwc_l
84*7d3de48cSSascha Wildnerfunction takes an explicit
85*7d3de48cSSascha Wildner.Fa locale
86*7d3de48cSSascha Wildnerargument, whereas the
87*7d3de48cSSascha Wildner.Fn ungetwc
88*7d3de48cSSascha Wildnerfunction uses the current global or per-thread locale.
8962f08720SJoerg Sonnenberger.Sh RETURN VALUES
9062f08720SJoerg SonnenbergerThe
9162f08720SJoerg Sonnenberger.Fn ungetwc
92*7d3de48cSSascha Wildnerand
93*7d3de48cSSascha Wildner.Fn ungetwc_l
94*7d3de48cSSascha Wildnerfunctions return the wide character pushed-back after the conversion, or
9562f08720SJoerg Sonnenberger.Dv WEOF
9662f08720SJoerg Sonnenbergerif the operation fails.
9762f08720SJoerg SonnenbergerIf the value of the argument
9862f08720SJoerg Sonnenberger.Fa c
9962f08720SJoerg Sonnenbergercharacter equals
10062f08720SJoerg Sonnenberger.Dv WEOF ,
10162f08720SJoerg Sonnenbergerthe operation will fail and the stream will remain unchanged.
10262f08720SJoerg Sonnenberger.Sh SEE ALSO
10362f08720SJoerg Sonnenberger.Xr fseek 3 ,
104*7d3de48cSSascha Wildner.Xr getwc 3 ,
105*7d3de48cSSascha Wildner.Xr xlocale 3
10662f08720SJoerg Sonnenberger.Sh STANDARDS
10762f08720SJoerg SonnenbergerThe
10862f08720SJoerg Sonnenberger.Fn ungetwc
10962f08720SJoerg Sonnenbergerfunction conforms to
11062f08720SJoerg Sonnenberger.St -isoC-99 .
111