prevent null pointer access crashes/memory trashing.
[AROS.git] / compiler / stdc / stcd_l.c
blob895fc59fe77353efd4a47a6b4b1433897abaf48c
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 SAS/C function stcd_l().
6 */
8 #include <stdlib.h>
10 /*****************************************************************************
12 NAME */
13 #include <string.h>
15 int stcd_l (
17 /* SYNOPSIS */
18 const char * in,
19 long * lvalue)
21 /* FUNCTION
22 Convert decimal string to a long integer
24 INPUTS
25 in - The decimal string to be converted
26 lvalue - Pointer to long where the result is saved
28 RESULT
29 length of characters converted.
30 >= 1 means success. 0 means failure.
32 NOTES
33 SAS/C specific
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 ******************************************************************************/
45 char *s;
46 long l;
48 l = strtol(in, &s, 10);
50 if (s != in)
52 *lvalue = l;
55 return (s - in);
56 } /* stcd_l */