diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-11-08 08:27:11 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-11-08 08:27:11 +0000 |
| commit | f8490e6ea6355d4f3fb67b3cb5bb706edf795e3f (patch) | |
| tree | 6b5f215f803f21802a9ba92978cee307f03208ef /src/base | |
| parent | edf33b8a5bab51115062626a6fb6a0320b3694ba (diff) | |
| download | zcatch-f8490e6ea6355d4f3fb67b3cb5bb706edf795e3f.tar.gz zcatch-f8490e6ea6355d4f3fb67b3cb5bb706edf795e3f.zip | |
added str_isspace and str_length functions to system
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/system.c | 6 | ||||
| -rw-r--r-- | src/base/system.h | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/base/system.c b/src/base/system.c index c89b54ff..dc5faf62 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -1037,6 +1037,11 @@ void str_copy(char *dst, const char *src, int dst_size) dst[dst_size-1] = 0; /* assure null termination */ } +int str_length(const char *str) +{ + return (int)strlen(str); +} + void str_format(char *buffer, int buffer_size, const char *format, ...) { #if defined(CONF_FAMILY_WINDOWS) @@ -1179,6 +1184,7 @@ void gui_messagebox(const char *title, const char *message) #endif } +int str_isspace(char c) { return c == ' ' || c == '\n' || c == '\t'; } #if defined(__cplusplus) diff --git a/src/base/system.h b/src/base/system.h index b220810e..3aa01cab 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -691,6 +691,18 @@ void str_append(char *dst, const char *src, int dst_size); void str_copy(char *dst, const char *src, int dst_size); /* + Function: str_length + Returns the length of a zero terminated string. + + Parameters: + str - Pointer to the string. + + Returns: + Length of string in bytes excluding the zero termination. +*/ +int str_length(const char *str); + +/* Function: str_format Performs printf formating into a buffer. @@ -922,6 +934,9 @@ typedef struct void net_stats(NETSTATS *stats); +int str_isspace(char c); + + /* Function: gui_messagebox Display plain OS-dependent message box |