Welcome to mirror list, hosted at ThFree Co, Russian Federation.

string.h « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb0375ccbd72a02a320e0fbc3c0441df3d67bcdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* string.h: Extra string defs

   Copyright 2001, 2007, 2008, 2011 Red Hat, Inc.

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

#ifndef _CYGWIN_STRING_H
#define _CYGWIN_STRING_H

#include_next <string.h>

#ifdef __cplusplus
extern "C" {
#endif

#undef strchrnul
#define strchrnul cygwin_strchrnul
static inline __stdcall char *
strchrnul (const char *s, int c)
{
  while (*s != (char) c && *s != 0)
    ++s;
  return (char *) s;
}

#ifdef __INSIDE_CYGWIN__

extern const char isalpha_array[];

static inline int
ascii_strcasematch (const char *cs, const char *ct)
{
  register const unsigned char *us, *ut;

  us = (const unsigned char *) cs;
  ut = (const unsigned char *) ct;

  while (us[0] == ut[0] || (us[0] ^ isalpha_array[us[0]]) == ut[0])
    {
      if (us[0] == 0)
	return 1;
      ++us, ++ut;
    }
  return 0;
}

static inline int
ascii_strncasematch (const char *cs, const char *ct, size_t n)
{
  register const unsigned char *us, *ut;

  if (!n)
   return 1;
  us = (const unsigned char *) cs;
  ut = (const unsigned char *) ct;

  while (us[0] == ut[0] || (us[0] ^ isalpha_array[us[0]]) == ut[0])
    {
      --n;
      if (!n || us[0] == 0)
        return 1;
      ++us, ++ut;
    }
  return 0;
}

#undef strcasecmp
#define strcasecmp cygwin_strcasecmp
int __stdcall cygwin_strcasecmp (const char *, const char *);

#undef strncasecmp
#define strncasecmp cygwin_strncasecmp
int __stdcall cygwin_strncasecmp (const char *, const char *, size_t);

#define strcasematch(s1,s2)	(!cygwin_strcasecmp ((s1),(s2)))
#define strncasematch(s1,s2,n)	(!cygwin_strncasecmp ((s1),(s2),(n)))

#undef strlwr
#define strlwr cygwin_strlwr
char * __stdcall cygwin_strlwr (char *);

#undef strupr
#define strupr cygwin_strupr
char * __stdcall cygwin_strupr (char *);

#endif /* __INSIDE_CYGWIN__ */

char *__stdcall strccpy (char *s1, const char **s2, char c);

#ifdef __cplusplus
}
#endif

#endif /* _CYGWIN_STRING_H */