int YMODEMCLASS::WaitFirstChar (void) { int result ; int rVal ; result = GetFirstChar () ; switch (result) { case NAK: case INIT_C: fltr_state = WAIT_ACK ; rVal = WriteHeaderBlock() ; if (rVal==FT_FILEEND) { rVal = FT_SUCCESS ; fltr_state = WAIT_FINAL_ACK ; } RestartTimerEvent (oiFT, maxTimeout) ; break ; case FT_LOCALCANCEL: rVal = result ; LocalCancel () ; break ; case FT_REMOTECANCEL: rVal = result ; RemoteCancel () ; break ; } return rVal; }
CFilePath &CFilePath::Unquote() { if (GetFirstChar(msPath) == '"' && GetLastChar(msPath) == '"') msPath = msPath.Mid(1, msPath.GetLength() - 2); return *this; }
void CFilePath::Trim(CString &sString) { if (_istspace(GetFirstChar(sString))) sString.TrimLeft(); if (_istspace(GetLastChar(sString))) sString.TrimRight(); }
CString CFilePath::SplitRoot(ERootType *pRootType) { CString sHead; if (!msPath.GetLength()) return sHead; int nRootLen = 0; ERootType RootType = GetRootType(msPath, &nRootLen, FALSE); if (pRootType) *pRootType = RootType; if (RootType == rtNoRoot) { int nStart = 0; if (GetFirstChar(msPath) == '\\') ++ nStart; int nPos = msPath.Find('\\', nStart); if (nPos < 0) { sHead = nStart ? msPath.Mid(nStart) : msPath; msPath.Empty(); } else { sHead = msPath.Mid(nStart, nPos-nStart); msPath = msPath.Mid(nPos+1); } } else { sHead = msPath.Left(nRootLen); if (nRootLen < msPath.GetLength() && msPath[nRootLen] == '\\') ++nRootLen; msPath = msPath.Mid(nRootLen); } return sHead; }