2016-07-20 Fred Gleason <fredg@paravelsystems.com>

* Added a 'remove' command to rdclilogedit(1) in
	'utils/rdclilogedit/rdclilogedit.cpp' and
	'utils/rdclilogedit/rdclilogedit.h'.
This commit is contained in:
Fred Gleason 2016-07-20 18:40:10 -04:00
parent 27e3113f27
commit a166e4f731
4 changed files with 37 additions and 2 deletions

View File

@ -15322,3 +15322,7 @@
* Added an 'addcart' command to rdclilogedit(1) in
'utils/rdclilogedit/rdclilogedit.cpp' and
'utils/rdclilogedit/rdclilogedit.h'.
2016-07-20 Fred Gleason <fredg@paravelsystems.com>
* Added a 'remove' command to rdclilogedit(1) in
'utils/rdclilogedit/rdclilogedit.cpp' and
'utils/rdclilogedit/rdclilogedit.h'.

View File

@ -27,8 +27,8 @@ void MainObject::Help(const QStringList &cmds) const
if(cmds.size()==1) {
printf("\n");
printf("The following commands are available:\n");
printf("?, bye, exit, help, list, listlogs, load, quit, save, saveas,\n");
printf("setcart, unload\n");
printf("?, addcart, bye, exit, help, list, listlogs, load, quit, remove,\n");
printf("save, saveas, setcart, unload\n");
printf("\n");
printf("Enter \"? <cmd-name>\" for specific help.\n");
printf("\n");
@ -76,6 +76,14 @@ void MainObject::Help(const QStringList &cmds) const
printf("\n");
processed=true;
}
if(verb=="remove") {
printf("\n");
printf(" remove <line>\n");
printf("\n");
printf("Remove the log event at line <line>.\n");
printf("\n");
processed=true;
}
if(verb=="save") {
printf("\n");
printf(" save\n");

View File

@ -214,6 +214,12 @@ void MainObject::List()
}
void MainObject::Remove(int line)
{
edit_log_event->remove(line,1);
}
void MainObject::Save()
{
if(edit_log_event==NULL) {
@ -371,6 +377,22 @@ void MainObject::DispatchCommand(const QString &cmd)
processed=true;
}
if(verb=="remove") {
if(cmds.size()==2) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {
Remove(line);
}
else {
fprintf(stderr,"remove: invalid line number\n");
}
}
else {
fprintf(stderr,"remove: invalid command arguments\n");
}
processed=true;
}
if(verb=="save") {
Save();
processed=true;

View File

@ -51,6 +51,7 @@ class MainObject : public QObject
void ListLogs() const;
void Load(const QString &logname);
void List();
void Remove(int line);
void Save();
void Saveas(const QString &logname);
void Setcart(int line,unsigned cartnum);