aboutsummaryrefslogtreecommitdiff
path: root/Linux_C_12/util_121.c
diff options
context:
space:
mode:
Diffstat (limited to 'Linux_C_12/util_121.c')
-rw-r--r--Linux_C_12/util_121.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/Linux_C_12/util_121.c b/Linux_C_12/util_121.c
index f0a3de7..544cff6 100644
--- a/Linux_C_12/util_121.c
+++ b/Linux_C_12/util_121.c
@@ -9,6 +9,7 @@
Generally applicable utility routines.
********************************************************************************************/
#include "util_121.h"
+#include "Clean.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -206,14 +207,22 @@ void WinGetCStringAndFree (PSTR cs, OS ios, CLEAN_STRING * cls, OS * oos)
void WinMakeCString (CLEAN_STRING s, OS ios, PSTR * cs, OS * oos)
{
+ char* chars = rmalloc(CleanStringLength(s) + 1);
rprintf("(MCS: \"");
- *cs = (char *) rmalloc ((s->length) + 1);
+ *cs = (char*) rmalloc (CleanStringLength(s) + 1 + sizeof(int));
- rsncopy (*cs, s->characters, s->length);
- (*cs)[s->length] = 0;
+ rprintf("length: %d\n", CleanStringLength(s));
+
+ int i;
+ for (i = 0; i < CleanStringLength(s); i++)
+ chars[i] = CleanStringCharacters(s)[i];
+ chars[i] = 0;
+
+ rsncopy (*cs, chars, CleanStringLength(s) + 1);
+ (*cs)[CleanStringLength(s) + 1] = CleanStringLength(s);
*oos = ios;
- rprintf("\"%s)\n",*cs);
+ rprintf("\"%s)\n",chars);
} /* WinMakeCString */