1 /* proj.c file for GNU Fortran
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 strtoul (const char *nptr
, char **endptr
, int base
)
29 unsigned long int number
= 0;
30 unsigned long int old_number
= 0;
33 assert (endptr
== NULL
);
35 while (ISDIGIT (*nptr
))
37 number
= old_number
* 10 + (*(nptr
++) - '0');
38 if ((number
<= old_number
) && (old_number
!= 0))
49 bsearch (const void *key
, const void *base
, size_t nmemb
, size_t size
,
50 int (*compar
) (const void *, const void *))
55 /* We do a dumb incremental search, not a binary search, for now. */
57 for (i
= 0; i
< nmemb
; ++i
)
59 if ((cmp
= (*compar
) (key
, base
)) == 0)