Last change
on this file was
cfe8f7a,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/27/20 at 14:14:06
|
doxygen: Switch @brief and @ingroup
This order change fixes the Latex documentation build via Doxygen.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[148e3de6] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup libmisc_conv_help Conversion Helpers |
---|
[cfe8f7a] | 5 | * |
---|
| 6 | * @brief Convert String to Unsigned Long Long (with validation) |
---|
[148e3de6] | 7 | */ |
---|
| 8 | |
---|
[e8d59ca] | 9 | /* |
---|
| 10 | * COPYRIGHT (c) 2009. |
---|
| 11 | * On-Line Applications Research Corporation (OAR). |
---|
| 12 | * |
---|
[2f8f4950] | 13 | * Copyright (c) 2011 Ralf Corsépius, Ulm, Germany. |
---|
| 14 | * |
---|
[e8d59ca] | 15 | * The license and distribution terms for this file may be |
---|
| 16 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 17 | * http://www.rtems.org/license/LICENSE. |
---|
[e8d59ca] | 18 | */ |
---|
| 19 | |
---|
[56f61c7d] | 20 | #ifdef HAVE_CONFIG_H |
---|
| 21 | #include "config.h" |
---|
| 22 | #endif |
---|
| 23 | |
---|
[2f8f4950] | 24 | #include <errno.h> |
---|
| 25 | #include <stdlib.h> |
---|
| 26 | #include <limits.h> |
---|
| 27 | |
---|
| 28 | #include <rtems/stringto.h> |
---|
| 29 | |
---|
[e8d59ca] | 30 | /* |
---|
| 31 | * Instantiate an error checking wrapper for strtoul (unsigned long) |
---|
| 32 | */ |
---|
[2f8f4950] | 33 | |
---|
| 34 | rtems_status_code rtems_string_to_unsigned_long ( |
---|
| 35 | const char *s, |
---|
| 36 | unsigned long *n, |
---|
| 37 | char **endptr, |
---|
| 38 | int base |
---|
| 39 | ) |
---|
| 40 | { |
---|
| 41 | unsigned long result; |
---|
| 42 | char *end; |
---|
| 43 | |
---|
| 44 | if ( !n ) |
---|
| 45 | return RTEMS_INVALID_ADDRESS; |
---|
| 46 | |
---|
| 47 | errno = 0; |
---|
| 48 | *n = 0; |
---|
| 49 | |
---|
| 50 | result = strtoul( s, &end, base ); |
---|
| 51 | |
---|
| 52 | if ( endptr ) |
---|
| 53 | *endptr = end; |
---|
| 54 | |
---|
| 55 | if ( end == s ) |
---|
| 56 | return RTEMS_NOT_DEFINED; |
---|
| 57 | |
---|
[148e3de6] | 58 | if ( ( errno == ERANGE ) && |
---|
[37ecff5c] | 59 | (( result == 0 ) || ( result == ULONG_MAX ))) |
---|
| 60 | return RTEMS_INVALID_NUMBER; |
---|
[2f8f4950] | 61 | |
---|
| 62 | *n = result; |
---|
| 63 | |
---|
| 64 | return RTEMS_SUCCESSFUL; |
---|
| 65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.