gui_hwnd = (HWND) atoi(arg);
}
+char *get_ttymode(void *frontend, const char *mode) { return NULL; }
+
/* ----------------------------------------------------------------------
* File access abstraction.
*/
char *read_filename(DirHandle *dir)
{
- while (!dir->name) {
- WIN32_FIND_DATA fdat;
- int ok = FindNextFile(dir->h, &fdat);
+ do {
- if (!ok)
- return NULL;
+ if (!dir->name) {
+ WIN32_FIND_DATA fdat;
+ int ok = FindNextFile(dir->h, &fdat);
+ if (!ok)
+ return NULL;
+ else
+ dir->name = dupstr(fdat.cFileName);
+ }
- if (fdat.cFileName[0] == '.' &&
- (fdat.cFileName[1] == '\0' ||
- (fdat.cFileName[1] == '.' && fdat.cFileName[2] == '\0')))
+ assert(dir->name);
+ if (dir->name[0] == '.' &&
+ (dir->name[1] == '\0' ||
+ (dir->name[1] == '.' && dir->name[2] == '\0'))) {
+ sfree(dir->name);
dir->name = NULL;
- else
- dir->name = dupstr(fdat.cFileName);
- }
+ }
+
+ } while (!dir->name);
if (dir->name) {
char *ret = dir->name;
sfree(dir);
}
+int vet_filename(char *name)
+{
+ if (strchr(name, '/') || strchr(name, '\\') || strchr(name, ':'))
+ return FALSE;
+
+ if (!name[strspn(name, ".")]) /* entirely composed of dots */
+ return FALSE;
+
+ return TRUE;
+}
+
int create_directory(char *name)
{
return CreateDirectory(name, NULL) != 0;