nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions

C Library 에서 문자열 처리 함수들을 정의한다. More...

Collaboration diagram for 표준 문자열 처리 함수:

Functions

int memcmp (void *dest, void *src, size_t size)
 두 메모리 버퍼를 비교한다. More...
 
void memcpy (void *dest, void *src, size_t size)
 특정 메모리영역의 데이터를 주어진 크기만큼 복사한다. More...
 
void memset (void *buffer, int data, size_t size)
 특정 메모리 영역을 데이터로 채워 넣는다. More...
 
int strcmp (const char *str1, const char *str2)
 두 문자열을 비교한다. More...
 
char * strcpy (char *dest, const char *src)
 문자열을 복사한다. More...
 
char * strdup (const char *s)
 문자열을 위한 공간을 할당하고 복사한다. More...
 
char * strdupa (const char *s)
 문자열을 복사하되, alloca 를 써서 메모리를 할당한다. More...
 
int strlen (const char *str)
 문자열의 길이를 구한다. More...
 
int strncmp (const char *s1, const char *s2, size_t n)
 문자열을 지정된 길이만큼 비교한다 More...
 
char * strncpy (char *dest, char *src, size_t n)
 문자열을 지정된 길이만큼 복사한다. More...
 
char * strndup (const char *s, size_t n)
 
char * strndupa (const char *s, size_t n)
 문자열을 길이만큼 복사하되, alloca 를 써서 메모리를 할당한다. More...
 

Detailed Description

C Library 에서 문자열 처리 함수들을 정의한다.

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2011-7-20

최대한 POSIX 표준을 따르도록 노력하였으며, 구현체는 아키텍쳐와는 독립적으로 재사용 될 수 있도록 구현하였다.

Function Documentation

int memcmp ( void *  dest,
void *  src,
size_t  size 
)

두 메모리 버퍼를 비교한다.

Parameters
[in]dest대상 메모리 버퍼의 주소
[in]src원본 데이터가 저장된 메모리 주소
[in]size비교할 데이터의 크기
Returns
int 같으면 0, 다르면 그 차이를 반환한다.
See Also
strcmp()

Definition at line 5 of file memcmp.c.

void memcpy ( void *  dest,
void *  src,
size_t  size 
)

특정 메모리영역의 데이터를 주어진 크기만큼 복사한다.

Parameters
[in]dest저장될 대상 버퍼의 주소
[in]src복사할 원본 데이터의 메모리 주소
[in]size복사할 크기
Returns
없음
See Also
strcpy()

Definition at line 5 of file memcpy.c.

Referenced by fat_load(), fdc_read(), fdc_write(), object_copy(), object_init(), pthread_attr_init(), pthread_create(), and ston_init().

Here is the caller graph for this function:

void memset ( void *  buffer,
int  data,
size_t  size 
)

특정 메모리 영역을 데이터로 채워 넣는다.

Parameters
[in]buffer대상 메모리 영역
[in]data채워질 데이터
[in]size채울 크기
Returns
없음
See Also

Definition at line 7 of file memset.c.

References buffer.

Referenced by calloc(), initm_init(), interrupt_init(), keyboard_open(), onetime_map_init(), segment_init(), vm_init(), and vm_init_done().

Here is the caller graph for this function:

int strcmp ( const char *  str1,
const char *  str2 
)

두 문자열을 비교한다.

Parameters
[in]str1원본 문자열
[in]str2비교할 대상 문자열
Returns
같으면 0을 반환한다.

Definition at line 5 of file strcmp.c.

char* strcpy ( char *  dest,
const char *  src 
)

문자열을 복사한다.

Parameters
[out]dest출력 버퍼
[in]src입력 문자열
Returns
복사된 문자열이 저장된 버퍼의 주소
See Also
strncpy()

Definition at line 5 of file strcpy.c.

Referenced by basename(), and strdup().

Here is the caller graph for this function:

char* strdup ( const char *  s)

문자열을 위한 공간을 할당하고 복사한다.

Parameters
[in]s복사할 문자열
Returns
char* 할당된 메모리 영역, 실패시 NULL
See Also
bootm_free()

Definition at line 7 of file strdup.c.

References malloc(), NULL, strcpy(), and strlen().

Referenced by fat_load(), vfs_new_dev_ninfo(), and vfs_new_ninfo().

Here is the call graph for this function:

Here is the caller graph for this function:

char* strdupa ( const char *  s)

문자열을 복사하되, alloca 를 써서 메모리를 할당한다.

Parameters
[in]s복사할 문자열
Returns
char* alloca 를 이용해 할당된 메모리에 복사된 문자열
See Also
strdup()

Definition at line 38 of file strdup.c.

References NULL.

int strlen ( const char *  str)

문자열의 길이를 구한다.

Parameters
[in]str문자열
Returns
문자열의 길이

Definition at line 5 of file strlen.c.

Referenced by basename(), getenv(), strdup(), and strndup().

Here is the caller graph for this function:

int strncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

문자열을 지정된 길이만큼 비교한다

Parameters
[in]s1비교 문자열 1
[in]s2비교 문자열 2
[in]n비교 할 문자열의 길이
Returns
일치하면 0, s1 > s2 이면 양수, s1 < s2 이면 음수
See Also
strcmp()

Definition at line 5 of file strncmp.c.

Referenced by getenv(), pthread_self(), and vfs_get_ninfo().

Here is the caller graph for this function:

char* strncpy ( char *  dest,
char *  src,
size_t  n 
)

문자열을 지정된 길이만큼 복사한다.

Parameters
[in]dest출력 버퍼
[in]src입력 문자열
[in]n복사할 문자열의 길이
Returns
복사된 문자열이 저장된 버퍼의 시작주소
See Also
strcpy()

Definition at line 5 of file strncpy.c.

Referenced by strndup().

Here is the caller graph for this function:

char* strndup ( const char *  s,
size_t  n 
)
Parameters
[in]s복사할 문자열
[in]n복사할 문자열의 길이
Returns
char* 메모리를 할당하여 복사된 문자열
See Also
bootm_free()

Definition at line 20 of file strdup.c.

References malloc(), NULL, strlen(), and strncpy().

Here is the call graph for this function:

char* strndupa ( const char *  s,
size_t  n 
)

문자열을 길이만큼 복사하되, alloca 를 써서 메모리를 할당한다.

Parameters
[in]s복사할 문자열
[in]n복사할 문자열의 길이
Returns
char* alloca 를 이용해 할당된 메모리에 복사된 문자열
See Also
strdup()

Definition at line 43 of file strdup.c.

References NULL.