diff --git a/GNUmakefile b/GNUmakefile index 0511b56..01241ed 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -32,7 +32,7 @@ L_CFLAGS = $(DEPINC) $(CFLAGS) -fPIC -D_MILSKO L_LDFLAGS = $(LDFLAGS) L_LIBS = $(LIBS) -L_OBJS = src/core.o src/default.o src/draw.o src/lowlevel.o src/font.o src/boldfont.o src/error.o src/unicode.o src/color.o src/messagebox.o src/directory.o +L_OBJS = src/core.o src/default.o src/draw.o src/lowlevel.o src/font.o src/boldfont.o src/error.o src/unicode.o src/color.o src/messagebox.o src/directory.o src/string.o L_OBJS += external/ds.o external/image.o L_OBJS += src/widget/window.o src/widget/button.o src/widget/frame.o src/widget/menu.o src/widget/submenu.o src/widget/image.o src/widget/scrollbar.o src/widget/checkbox.o src/widget/label.o src/widget/entry.o src/widget/numberentry.o src/widget/viewport.o src/widget/listbox.o L_OBJS += src/cursor/default.o src/cursor/cross.o src/cursor/text.o diff --git a/include/Mw/Milsko.h b/include/Mw/Milsko.h index a79ddfd..56f2b0c 100644 --- a/include/Mw/Milsko.h +++ b/include/Mw/Milsko.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/include/Mw/String.h b/include/Mw/String.h new file mode 100644 index 0000000..9190b16 --- /dev/null +++ b/include/Mw/String.h @@ -0,0 +1,34 @@ +/* $Id$ */ +/*! + * %file Mw/String.h + * %brief String utilities + */ +#ifndef __MW_STRING_H__ +#define __MW_STRING_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * %brief Duplicates a string + * %param str String + * %return String + */ +MWDECL char* MwStringDupliacte(const char* str); + +/*! + * %brief Concatenates 2 strings + * %param str1 String + * %param str2 String + * %return String + */ +MWDECL char* MwStringConcat(const char* str1, const char* str2); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/string.c b/src/string.c new file mode 100644 index 0000000..7d07505 --- /dev/null +++ b/src/string.c @@ -0,0 +1,17 @@ +/* $Id$ */ +#include + +char* MwStringDupliacte(const char* str) { + char* r = malloc(strlen(str) + 1); + strcpy(r, str); + + return r; +} + +char* MwStringConcat(const char* str1, const char* str2) { + char* r = malloc(strlen(str1) + strlen(str2) + 1); + strcpy(r, str1); + strcat(r, str2); + + return r; +}