os-workshop

same materials and sample source for RV32 OS projects
git clone http://frotz.net/git/os-workshop.git
Log | Files | Refs

strpbrk.c (643B)


      1 /*
      2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
      3 ** Distributed under the terms of the NewOS License.
      4 */
      5 /*
      6  * Copyright (c) 2008 Travis Geiselbrecht
      7  *
      8  * Use of this source code is governed by a MIT-style
      9  * license that can be found in the LICENSE file or at
     10  * https://opensource.org/licenses/MIT
     11  */
     12 #include <string.h>
     13 #include <stdint.h>
     14 
     15 char *
     16 strpbrk(char const *cs, char const *ct) {
     17     const char *sc1;
     18     const char *sc2;
     19 
     20     for (sc1 = cs; *sc1 != '\0'; ++sc1) {
     21         for (sc2 = ct; *sc2 != '\0'; ++sc2) {
     22             if (*sc1 == *sc2)
     23                 return (char *)sc1;
     24         }
     25     }
     26 
     27     return NULL;
     28 }