#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
static bool isReservedName(const char *path) {
static const char *reserved[] = {
"nul", "con", "prn", "aux", "com1", "com2", "com3",
"com4", "com5", "com6", "com7", "com8", "com9",
"lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6",
"lpt7", "lpt8", "lpt9"
};
bool ret = false;
if (!path || 0 == strncmp(path, "\\\\.\\", 4)) {
return true;
}
for (size_t i = 0; !ret &&
i < sizeof(reserved) / sizeof(*reserved); ++i) {
if (0 == _stricmp(path, reserved[i])) {
ret = true;
}
}
return ret;
}