mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-18 08:31:16 +02:00
2017-12-20 Fred Gleason <fredg@paravelsystems.com>
* Added log locking logic to rdclilogedit(1).
This commit is contained in:
@@ -44,6 +44,7 @@ MainObject::MainObject(QObject *parent)
|
||||
edit_log_event=NULL;
|
||||
edit_modified=false;
|
||||
edit_new_log=false;
|
||||
edit_log_lock=NULL;
|
||||
|
||||
//
|
||||
// Read Command Options
|
||||
@@ -137,10 +138,32 @@ void MainObject::userData()
|
||||
if(!edit_quiet_option) {
|
||||
printf("\n");
|
||||
}
|
||||
if(edit_log_lock!=NULL) {
|
||||
delete edit_log_lock;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
bool MainObject::TryLock(RDLogLock *lock,const QString &logname)
|
||||
{
|
||||
QString username;
|
||||
QString stationname;
|
||||
QHostAddress addr;
|
||||
bool ret;
|
||||
|
||||
ret=lock->tryLock(&username,&stationname,&addr);
|
||||
if(!ret) {
|
||||
fprintf(stderr,"log \"%s\" in use by %s@%s [%s]\n",
|
||||
(const char *)logname,
|
||||
(const char *)username,
|
||||
(const char *)stationname,
|
||||
(const char *)addr.toString());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void MainObject::OverwriteError(const QString &cmd) const
|
||||
{
|
||||
fprintf(stderr,"%s: buffer not saved (append \"!\" to override)\n",
|
||||
|
Reference in New Issue
Block a user