My Project
Loading...
Searching...
No Matches
C_lib
include_printf
az_strchr.c
Go to the documentation of this file.
1
// kernel_lib_printf_functions
2
/*
3
* Kernel Lib Printf Functions
4
*
5
* Maintainer: Park Jiwoo
6
*
7
* Copyright (C) 2024 Park-Jiwoo
8
*
9
*/
10
#include "
kernel_pr_he.h
"
11
#include <stdlib.h>
12
13
char
*
az_strchr
(
const
char
*s,
int
c)
14
{
15
char
*tmp;
16
int
i;
17
int
track;
18
19
tmp = (
char
*)malloc(
sizeof
(
char
) *
az_strlen
(s));
20
i = 0;
21
track = 0;
22
if
((
char
)s[i] ==
'\0'
)
23
return
(NULL);
24
while
(s[i] !=
'\0'
&& s[i] != c)
25
i++;
26
if
(s[i] !=
'\0'
)
27
i = i - 1;
28
while
(s[i] !=
'\0'
)
29
{
30
tmp[track] = (char)s[i];
31
i++;
32
track++;
33
}
34
tmp[track] =
'\0'
;
35
if
(track == 0)
36
return
(NULL);
37
return
(tmp);
38
}
az_strchr
char * az_strchr(const char *s, int c)
Definition
az_strchr.c:13
az_strlen
size_t az_strlen(const char *s)
Definition
az_strlen.c:12
kernel_pr_he.h
Generated by
1.12.0