summaryrefslogtreecommitdiff
path: root/build/misc.c
blob: e14f75d8dc083c6570fc04e299f75ee53d5523a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/** \ingroup rpmbuild
 * \file build/misc.c
 */
#include "system.h"

#include "rpmbuild.h"
#include "debug.h"

/*@-boundswrite@*/
int parseNum(const char * line, int * res)
{
    char * s1 = NULL;
    unsigned long rc;

    if (line == NULL) return 1;
    rc = strtoul(line, &s1, 10);
    if (res) *res = rc;
    return (((*s1) || (s1 == line) || (rc == ULONG_MAX)) ? 1 : 0);
}
/*@=boundswrite@*/