]> git.saurik.com Git - bison.git/blob - lib/get-errno.c
2007-02-07 Paolo Bonzini <bonzini@gnu.org>
[bison.git] / lib / get-errno.c
1 /* get-errno.c - get and set errno.
2
3 Copyright (C) 2002, 2006 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19 /* Written by Paul Eggert. */
20
21 #include <config.h>
22
23 #include "get-errno.h"
24
25 #include <errno.h>
26
27 /* Get and set errno. A source file that needs to set or get errno,
28 but doesn't need to test for specific errno values, can use these
29 functions to avoid namespace pollution. For example, a file that
30 defines EQUAL should not include <errno.h>, since <errno.h> might
31 define EQUAL; such a file can include <get-errno.h> instead. */
32
33 int
34 get_errno (void)
35 {
36 return errno;
37 }
38
39 void
40 set_errno (int e)
41 {
42 errno = e;
43 }