1. using C++ implements the terminal state without echo input, like login when asking for the password
參考資料
https://www.svbug.com/documentation/comp.unix.programmer-FAQ/faq_4.html
1. CmdParser cmd
初始化_readBufPtr(_readBuf), _readBufEnd(_readBuf),_historyIdx(0), _tempCmdStored(false)
2. cmd.readCmd()
呼叫另一個成員函式readCmdInt(cin) {
(1) 呼叫另一個成員函式resetBufAndPrintPrompt() {
初始化_readBufPtr = _readBufEnd = _readBuf;*_readBufPtr = 0;
呼叫另一個成員函式printPrompt()印出cmd> (初始化和cout可以寫在.h)
}
(2) while (1) {
(a) ParseChar pch = getChar(istr)
(i) getChar(istream& istr)是一個global function回傳型態是enum
(ii) 呼叫mygetc(istr)是一個global function回傳型態是ch
() char mygetc(istream& istr)
(ii) enum回傳LINE_BEGIN_KEY等字串
(b) pch == INPUT_END_KEY 離開
(c) switch (pch)
}
}