indent
This commit is contained in:
parent
f1c45fdb01
commit
05dc72b497
1 changed files with 27 additions and 27 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbRun.cc,v 1.15 2003/07/25 11:17:41 rathnor Exp $
|
// $Id: FbRun.cc,v 1.16 2003/08/24 23:47:31 fluxgen Exp $
|
||||||
|
|
||||||
#include "FbRun.hh"
|
#include "FbRun.hh"
|
||||||
|
|
||||||
|
@ -87,34 +87,34 @@ void FbRun::run(const std::string &command) {
|
||||||
// save command history to file
|
// save command history to file
|
||||||
if (m_runtext.size() != 0) { // no need to save empty command
|
if (m_runtext.size() != 0) { // no need to save empty command
|
||||||
|
|
||||||
// don't allow duplicates into the history file, first
|
// don't allow duplicates into the history file, first
|
||||||
// look for a duplicate
|
// look for a duplicate
|
||||||
if (m_current_history_item < m_history.size()
|
if (m_current_history_item < m_history.size()
|
||||||
&& m_runtext == m_history[m_current_history_item]) {
|
&& m_runtext == m_history[m_current_history_item]) {
|
||||||
// m_current_history_item is the duplicate
|
// m_current_history_item is the duplicate
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_history.size(); i++)
|
for (i = 0; i < m_history.size(); i++)
|
||||||
if (m_runtext == m_history[i]) break;
|
if (m_runtext == m_history[i]) break;
|
||||||
m_current_history_item = i;
|
m_current_history_item = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now m_current_history_item points at the duplicate, or
|
// now m_current_history_item points at the duplicate, or
|
||||||
// at m_history.size() if no duplicate
|
// at m_history.size() if no duplicate
|
||||||
fstream inoutfile(m_history_file.c_str(), ios::in|ios::out);
|
fstream inoutfile(m_history_file.c_str(), ios::in|ios::out);
|
||||||
if (inoutfile) {
|
if (inoutfile) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// read past history items before current
|
// read past history items before current
|
||||||
for (string line; !inoutfile.eof() && i < m_current_history_item; i++)
|
for (string line; !inoutfile.eof() && i < m_current_history_item; i++)
|
||||||
getline(inoutfile, line);
|
getline(inoutfile, line);
|
||||||
// write the history items that come after current
|
// write the history items that come after current
|
||||||
for (i++; i < m_history.size(); i++)
|
for (i++; i < m_history.size(); i++)
|
||||||
inoutfile<<m_history[i]<<endl;
|
inoutfile<<m_history[i]<<endl;
|
||||||
// and append the current one back to the end
|
// and append the current one back to the end
|
||||||
inoutfile<<m_runtext<<endl;
|
inoutfile<<m_runtext<<endl;
|
||||||
inoutfile.close();
|
inoutfile.close();
|
||||||
} else
|
} else
|
||||||
cerr<<"FbRun Warning: Can't write command history to file: "<<m_history_file<<endl;
|
cerr<<"FbRun Warning: Can't write command history to file: "<<m_history_file<<endl;
|
||||||
}
|
}
|
||||||
FbTk::App::instance()->end(); // end application
|
FbTk::App::instance()->end(); // end application
|
||||||
m_end = true; // mark end of processing
|
m_end = true; // mark end of processing
|
||||||
|
|
Loading…
Reference in a new issue