[CRT] Improve the FILE header section. Brought to you by Adam Stachowicz. CORE-10114
[reactos.git] / reactos / lib / sdk / crt / stdlib / _set_abort_behavior.c
1 /*
2 * PROJECT: ReactOS C runtime library
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: lib/sdk/crt/stdlib/_set_abort_behavior.c
5 * PURPOSE: _set_abort_behavior implementation
6 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9 extern unsigned int __abort_behavior;
10
11 /*!
12 * \brief Specifies the behavior of the abort() function.
13 *
14 * \param flags - Value of the new flags.
15 * \param mask - Mask that specifies which flags to update.
16 * \return The old flags value.
17 */
18 unsigned int
19 _cdecl
20 _set_abort_behavior(
21 unsigned int flags,
22 unsigned int mask)
23 {
24 unsigned int old_flags;
25
26 /* Save the old flags */
27 old_flags = __abort_behavior;
28
29 /* Reset all flags that are not in the mask */
30 flags &= mask;
31
32 /* Update the flags in the mask to the new flags value */
33 __abort_behavior &= ~mask;
34 __abort_behavior |= flags;
35
36 /* Return the old flags */
37 return old_flags;
38 }
39