/** * パス セパレータを削除 * @param[in,out] lpPathName パス */ void DOSIOCALL file_cutseparator(OEMCHAR* lpPathName) { const int pos = OEMSTRLEN(lpPathName) - 1; if ((pos > 0) && // 2文字以上でー (lpPathName[pos] == '\\') && // ケツが \ でー (!milstr_kanji2nd(lpPathName, pos)) && // 漢字の2バイト目ぢゃなくてー ((pos != 1) || (lpPathName[0] != '\\')) && // '\\' ではなくてー ((pos != 2) || (lpPathName[1] != ':'))) // '?:\' ではなかったら { lpPathName[pos] = '\0'; } }
/** * パス セパレータを追加 * @param[in,out] lpPathName パス * @param[in] cchPathName バッファ長 */ void DOSIOCALL file_setseparator(OEMCHAR* lpPathName, int cchPathName) { const int pos = OEMSTRLEN(lpPathName) - 1; if ((pos < 0) || ((pos == 1) && (lpPathName[1] == ':')) || ((lpPathName[pos] == '\\') && (!milstr_kanji2nd(lpPathName, pos))) || ((pos + 2) >= cchPathName)) { return; } lpPathName[pos + 1] = '\\'; lpPathName[pos + 2] = '\0'; }
void DOSIOCALL file_cutseparator(OEMCHAR *path) { int pos; pos = OEMSTRLEN(path) - 1; if ((pos > 0) && // 2文字以上でー (path[pos] == '\\') && // ケツが \ でー (!milstr_kanji2nd(path, pos)) && // 漢字の2バイト目ぢゃなくてー ((pos != 1) || (path[0] != '\\')) && // '\\' ではなくてー ((pos != 2) || (path[1] != ':'))) { // '?:\' ではなかったら path[pos] = '\0'; } }
void DOSIOCALL file_setseparator(OEMCHAR *path, int maxlen) { int pos; pos = OEMSTRLEN(path) - 1; if ((pos < 0) || ((pos == 1) && (path[1] == ':')) || ((path[pos] == '\\') && (!milstr_kanji2nd(path, pos))) || ((pos + 2) >= maxlen)) { return; } path[++pos] = '\\'; path[++pos] = '\0'; }