Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6536 serge 1
/*
2
 * Copyright (c) 1990 The Regents of the University of California.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms are permitted
6
 * provided that the above copyright notice and this paragraph are
7
 * duplicated in all such forms and that any documentation,
8
 * advertising materials, and other materials related to such
9
 * distribution and use acknowledge that the software was developed
10
 * by the University of California, Berkeley.  The name of the
11
 * University may not be used to endorse or promote products derived
12
 * from this software without specific prior written permission.
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
 
18
/*
19
FUNCTION
20
<>---non-thread-safe version of getchar (macro)
21
 
22
INDEX
23
	getchar_unlocked
24
INDEX
25
	_getchar_unlocked_r
26
 
27
SYNOPSIS
28
	#include 
29
	int getchar_unlocked(void);
30
 
31
	#include 
32
	int _getchar_unlocked_r(struct _reent *<[ptr]>);
33
 
34
DESCRIPTION
35
<> is a non-thread-safe version of <>
36
declared in <>.  <> may only safely be used
37
within a scope protected by flockfile() (or ftrylockfile()) and
38
funlockfile().  These functions may safely be used in a multi-threaded
39
program if and only if they are called while the invoking thread owns
40
the ( FILE *) object, as is the case after a successful call to the
41
flockfile() or ftrylockfile() functions.  If threads are disabled,
42
then <> is equivalent to <>.
43
 
44
The <<_getchar_unlocked_r>> function is simply the reentrant version of
45
<> which passes an addtional reentrancy structure pointer
46
argument: <[ptr]>.
47
 
48
RETURNS
49
See <>.
50
 
51
PORTABILITY
52
POSIX 1003.1 requires <>.  <> may
53
be implemented as a macro.
54
 
55
Supporting OS subroutines required: <>, <>, <>,
56
<>, <>, <>, <>.  */
57
 
58
#if defined(LIBC_SCCS) && !defined(lint)
59
static char sccsid[] = "%W% (Berkeley) %G%";
60
#endif /* LIBC_SCCS and not lint */
61
 
62
/*
63
 * A subroutine version of the macro getchar_unlocked.
64
 */
65
 
66
#include <_ansi.h>
67
#include 
68
#include 
69
 
70
#undef getchar_unlocked
71
 
72
int
73
_DEFUN(_getchar_unlocked_r, (ptr),
74
       struct _reent *ptr)
75
{
76
  return _getc_unlocked_r (ptr, _stdin_r (ptr));
77
}
78
 
79
#ifndef _REENT_ONLY
80
 
81
int
82
_DEFUN_VOID(getchar_unlocked)
83
{
84
  /* CHECK_INIT is called (eventually) by __srefill_r.  */
85
 
86
  return _getc_unlocked_r (_REENT, _stdin_r (_REENT));
87
}
88
 
89
#endif