Main Page | Modules | Data Structures | File List | Data Fields | Globals

bstring.c File Reference


Detailed Description

Provides basic string functions.

Definition in file bstring.c.

#include "../include/beeos.h"
#include "../include/bstring.h"

Include dependency graph for bstring.c:

Include dependency graph

Go to the source code of this file.

Functions

ushort bstrlen (char *pString)
 POSIX strlen() look-alike. Returns length of a NULL-term'd string.

ushort bstrncpy (char *pDst, char *pSrc, ushort maxn)
 POSIX strncpy() look-alike. Copies between two strings.

void bmemset (char *pDst, char pattern, ushort len)
 POSIX memset() look-alike. Initialises memory.

void bmemcpy (char *pDst, char *pSrc, ushort len)
 POSIX memcpy() look-alike. Copies from one address to another.


Function Documentation

void bmemcpy char *  pDst,
char *  pSrc,
ushort  len
 

POSIX memcpy() look-alike. Copies from one address to another.

Parameters:
pDst char pointer to destination of copy operation.
pSrc char pointer to source of copy operation.
len Number of bytes to copy.

Definition at line 84 of file bstring.c.

References ushort.

Referenced by bremalloc(), bubblesort(), context_restore2(), and context_save2().

00085 {
00086     while (len-- > 0) {
00087         *pDst++ = *pSrc++;
00088     }
00089         
00090     return;
00091 }

void bmemset char *  pDst,
char  pattern,
ushort  len
 

POSIX memset() look-alike. Initialises memory.

Parameters:
pDst char pointer to memory to be filled.
pattern char byte to use for fill operation.
len Number of bytes to fill, starting at pDst.

Definition at line 69 of file bstring.c.

References ushort.

Referenced by bmallocinit(), bremalloc(), btnscan_chk(), and execprep().

00070 {
00071     while (len-- > 0) {
00072         *pDst++ = pattern;
00073     };
00074     
00075     return;
00076 }

ushort bstrlen char *  pString  ) 
 

POSIX strlen() look-alike. Returns length of a NULL-term'd string.

Parameters:
pString char pointer to the NULL terminated ASCII string.
Return values:
i The position of the last non-NULL character in the string.

Definition at line 35 of file bstring.c.

References ushort.

00036 {
00037     ushort i = 0;
00038     
00039     while (*pString++ != '\0') i++;
00040         
00041     return i;
00042 }

ushort bstrncpy char *  pDst,
char *  pSrc,
ushort  maxn
 

POSIX strncpy() look-alike. Copies between two strings.

Parameters:
pDst char pointer to pre-allocated destination ASCII string.
pSrc char pointer to NULL-terminated ASCII string to be copied.
maxn int value specifying max. number of chars to be copied.
Return values:
i Number of chars that were actually copied.

Warning:
Unlike the POSIX strncpy(), bstrncpy returns the no. bytes copied into the destination string.

Definition at line 51 of file bstring.c.

References ushort.

Referenced by bvsnprintf().

00052 {   
00055     ushort i = 0;
00056     
00057     while ((*pSrc != '\0') && (i++ < maxn)) *pDst++ = *pSrc++;
00058     *pDst = '\0';
00059         
00060     return i;
00061 }


Generated on Sat Apr 10 17:08:10 2004 for BeeOS by doxygen 1.3.6-20040222