1 /* Implementation of the UMASK intrinsic.
2 Copyright (C) 2004 Free Software Foundation, Inc.
3 Contributed by Steven G. Kargl <kargls@comcast.net>.
5 This file is part of the GNU Fortran 95 runtime library (libgfortran).
7 Libgfortran is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 In addition to the permissions in the GNU General Public License, the
13 Free Software Foundation gives you unlimited permission to link the
14 compiled version of this file into combinations with other programs,
15 and to distribute those combinations without any restriction coming
16 from the use of this file. (The General Public License restrictions
17 do apply in other respects; for example, they cover modification of
18 the file, and distribution when not linked into a combine
21 Libgfortran is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public
27 License along with libgfortran; see the file COPYING. If not,
28 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
29 Boston, MA 02110-1301, USA. */
33 #include "libgfortran.h"
39 #ifdef HAVE_SYS_STAT_H
43 /* SUBROUTINE UMASK(MASK, OLD)
44 INTEGER, INTENT(IN) :: MASK
45 INTEGER, INTENT(OUT), OPTIONAL :: OLD */
47 extern void umask_i4_sub (GFC_INTEGER_4
*, GFC_INTEGER_4
*);
48 iexport_proto(umask_i4_sub
);
51 umask_i4_sub (GFC_INTEGER_4
*mask
, GFC_INTEGER_4
*old
)
53 mode_t val
= umask((mode_t
) *mask
);
55 *old
= (GFC_INTEGER_4
) val
;
57 iexport(umask_i4_sub
);
59 extern void umask_i8_sub (GFC_INTEGER_8
*, GFC_INTEGER_8
*);
60 iexport_proto(umask_i8_sub
);
63 umask_i8_sub (GFC_INTEGER_8
*mask
, GFC_INTEGER_8
*old
)
65 mode_t val
= umask((mode_t
) *mask
);
67 *old
= (GFC_INTEGER_8
) val
;
69 iexport(umask_i8_sub
);
71 /* INTEGER FUNCTION UMASK(MASK)
72 INTEGER, INTENT(IN) :: MASK */
74 extern GFC_INTEGER_4
umask_i4 (GFC_INTEGER_4
*);
75 export_proto(umask_i4
);
78 umask_i4 (GFC_INTEGER_4
*mask
)
81 umask_i4_sub (mask
, &old
);
85 extern GFC_INTEGER_8
umask_i8 (GFC_INTEGER_8
*);
86 export_proto(umask_i8
);
89 umask_i8 (GFC_INTEGER_8
*mask
)
92 umask_i8_sub (mask
, &old
);