Graphviz  2.41.20170921.2350
strncasecmp.c
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #include "config.h"
15 
16 
17 #include <string.h>
18 #include <ctype.h>
19 
20 int strncasecmp(const char *s1, const char *s2, unsigned int n)
21 {
22  if (n == 0)
23  return 0;
24 
25  while ((n-- != 0)
26  && (tolower(*(unsigned char *) s1) ==
27  tolower(*(unsigned char *) s2))) {
28  if (n == 0 || *s1 == '\0' || *s2 == '\0')
29  return 0;
30  s1++;
31  s2++;
32  }
33 
34  return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
35 }
36 
void s1(graph_t *, node_t *)
Definition: stuff.c:686
int strncasecmp(const char *s1, const char *s2, unsigned int n)
Definition: strncasecmp.c:20