OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [string/] [wcsrchr.c] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
FUNCTION
3
        <<wcsrchr>>---wide-character string scanning operation
4
 
5
ANSI_SYNOPSIS
6
        #include <wchar.h>
7
        wchar_t *wcsrchr(const wchar_t *<[s]>, wchar_t <[c]>);
8
 
9
TRAD_SYNOPSIS
10
        #include <wchar.h>
11
        wchar_t *wcsrchr(<[s]>, <[c]>
12
        const wchar_t *<[s]>;
13
        wchar_t <[c]>;
14
 
15
DESCRIPTION
16
        The <<wcsrchr>> function locates the last occurrence of <[c]> in the
17
        wide-character string pointed to by <[s]>. The value of <[c]> must be a
18
        character representable as a type wchar_t and must be a wide-character
19
        code corresponding to a valid character in the current locale.
20
        The terminating null wide-character code is considered to be part of
21
        the wide-character string.
22
 
23
RETURNS
24
        Upon successful completion, <<wcsrchr>> returns a pointer to the
25
        wide-character code or a null pointer if <[c]> does not occur in the
26
        wide-character string.
27
 
28
PORTABILITY
29
<<wcsrchr>> is ISO/IEC 9899/AMD1:1995 (ISO C).
30
 
31
No supporting OS subroutines are required.
32
*/
33
 
34
/*      $NetBSD: wcsrchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $       */
35
 
36
/*-
37
 * Copyright (c)1999 Citrus Project,
38
 * All rights reserved.
39
 *
40
 * Redistribution and use in source and binary forms, with or without
41
 * modification, are permitted provided that the following conditions
42
 * are met:
43
 * 1. Redistributions of source code must retain the above copyright
44
 *    notice, this list of conditions and the following disclaimer.
45
 * 2. Redistributions in binary form must reproduce the above copyright
46
 *    notice, this list of conditions and the following disclaimer in the
47
 *    documentation and/or other materials provided with the distribution.
48
 *
49
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
50
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
53
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59
 * SUCH DAMAGE.
60
 *
61
 *      citrus Id: wcsrchr.c,v 1.2 2000/12/21 05:07:25 itojun Exp
62
 */
63
 
64
#include <_ansi.h>
65
#include <stddef.h>
66
#include <wchar.h>
67
 
68
wchar_t *
69
_DEFUN (wcsrchr, (s, c),
70
        _CONST wchar_t * s _AND
71
        wchar_t c)
72
{
73
  _CONST wchar_t *p;
74
 
75
  p = s;
76
  while (*p)
77
    p++;
78
  while (s <= p)
79
    {
80
      if (*p == c)
81
        {
82
          /* LINTED interface specification */
83
          return (wchar_t *) p;
84
        }
85
      p--;
86
    }
87
  return NULL;
88
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.