+static void write_key_space_svalue(FILE * file, char * key, int32_t value)
+{
+ write_key_space(file, key);
+ char * line = try_malloc(11, __func__);
+ exit_trouble(-1 == sprintf(line, "%d", value), __func__, s[S_FCN_SPRINTF]);
+ try_fwrite(line, strlen(line), 1, file, __func__);
+ free(line);
+ try_fputc('\n', file, __func__);
+}
+
+
+
+static void write_key_space_string(FILE * file, char * key, char * string)
+{
+ write_key_space(file, key);
+ write_string(file, string);
+ try_fputc('\n', file, __func__);
+}
+
+
+
+static void write_mem_map(FILE * file, char * map, char * command)
+{
+ if (map)
+ {
+ uint32_t map_size = world.map.length * world.map.length;/* snprintf() */
+ char * map_copy = try_malloc(map_size + 1, __func__); /* reads one */
+ memcpy(map_copy, map, map_size); /* byte beyond map_size */
+ map_copy[map_size] = '\0'; /* if string is not \0-terminated. */
+ uint16_t y;
+ char string[UINT8_MAX + 1 + 1];
+ for (y = 0; y < world.map.length; y++)
+ {
+ int test = snprintf(string, world.map.length + 1, "%s",
+ map_copy + (y * world.map.length));
+ exit_trouble(test < 0, __func__, "snprintf()");
+ write_key_space(file, command);
+ write_uvalue(file, y);
+ try_fputc(' ', file, __func__);
+ write_string(file, string);
+ try_fputc('\n', file, __func__);
+ }
+ free(map_copy);
+ }
+}
+
+
+