* class.c (create_vtable_ptr): Put the vtable at the beginning of
[official-gcc.git] / texinfo / info / clib.c
blob57813967ad02aa23bd7e3709c551bc30258ff929
1 /* clib.c: Functions which we normally expect to find in the C library.
2 $Id: clib.c,v 1.1.1.1 1997/08/21 22:57:59 jason Exp $
4 This file is part of GNU Info, a program for reading online documentation
5 stored in Info format.
7 Copyright (C) 1995 Free Software Foundation, Inc.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Written by Brian Fox (bfox@ai.mit.edu). */
25 #include <stdio.h>
27 #if defined (HAVE_UNISTD_H)
28 #include <unistd.h>
29 #endif
31 #if defined (HAVE_STDLIB_H)
32 #include <stdlib.h>
33 #endif
35 #if defined (HAVE_STRING_H)
36 #include <string.h>
37 #endif
39 #include <sys/errno.h>
41 extern void *xmalloc (), *xrealloc ();
42 #include "general.h"
44 #if !defined (errno)
45 extern int errno;
46 #endif
48 #if !defined (HAVE_STRERROR)
49 extern char *sys_errlist[];
50 extern int sys_nerr;
52 char *
53 strerror (num)
54 int num;
56 if (num >= sys_nerr)
57 return ("");
58 else
59 return (sys_errlist[num]);
61 #endif /* !HAVE_STRERROR */
63 #if !defined (HAVE_STRCASECMP)
64 /* This Unix doesn't have the strcasecmp () function. */
65 int
66 strcasecmp (string1, string2)
67 char *string1, *string2;
69 char ch1, ch2;
71 for (;;)
73 ch1 = *string1++;
74 ch2 = *string2++;
76 if (!(ch1 | ch2))
77 return (0);
79 ch1 = info_toupper (ch1);
80 ch2 = info_toupper (ch2);
82 if (ch1 != ch2)
83 return (ch1 - ch2);
87 /* Compare at most COUNT characters from string1 to string2. Case
88 doesn't matter. */
89 int
90 strncasecmp (string1, string2, count)
91 char *string1, *string2;
92 int count;
94 register char ch1, ch2;
96 while (count)
98 ch1 = *string1++;
99 ch2 = *string2++;
101 ch1 = info_toupper (ch1);
102 ch2 = info_toupper (ch2);
104 if (ch1 == ch2)
105 count--;
106 else
107 break;
109 return (count);
111 #endif /* !STRCASECMP */