/* }}} */
#include "minimal/stdlib.h"
-#include "minimal/string.h"
#include "minimal/mapping.h"
#include <cstring>
_foreach (file, files) try {
const char *path(file.c_str());
const char *base = strrchr(path, '/');
- char *temp(NULL), *dir;
+ std::string dir;
if (base != NULL)
- dir = strndup_(path, base++ - path + 1);
- else {
- dir = strdup("");
+ dir.assign(path, base++ - path + 1);
+ else
base = path;
- }
const char *name(flag_I ?: base);
+ char *temp(NULL);
if (flag_r) {
uint32_t clip(0); {
}
}
- asprintf(&temp, "%s.%s.cs", dir, base);
+ asprintf(&temp, "%s.%s.cs", dir.c_str(), base);
fclose(fopen(temp, "w+"));
_syscall(truncate(temp, offset));
size_t size = fat_header.GetSize();
char *copy;
- asprintf(©, "%s.%s.cp", dir, base);
+ asprintf(©, "%s.%s.cp", dir.c_str(), base);
FILE *file = fopen(copy, "w+");
size_t writ = fwrite(top, 1, size, file);
_assert(writ == size);
free(temp);
}
- free(dir);
++filei;
} catch (const char *) {
++filee;