Rivendellaudio/lib/rdcmd_switch.cpp
Deltec Enterprises 4a3106c8dc
Master (#6)
* Fixed bug where wrong ID was used for local maintenance

* Updated ChangeLog

* Added ability to run macros from cart list with "Run Macro" button

* Updated ChangeLog

* Updated translations

* 2018-10-18 Fred Gleason <fredg@paravelsystems.com>
	* Tweaked the position of buttons on the bottom row of the main
	screen of rdlibrary(1).
	* Changed the minimum size of the main screen of rdlibrary to
	850x600.

* 2018-10-18 Fred Gleason <fredg@paravelsystems.com>
	* Fixed a regression in rdmaint(8) that broke cut rehashing.

* 2018-10-19 Fred Gleason <fredg@paravelsystems.com>
	* Added code in the %post and %preun rules in 'rivendell.spec.in'
	to enable and disable the 'rivendell' service.

* 2018-10-19 Fred Gleason <fredg@paravelsystems.com>
	* Modified rdservice(8) to log errors to syslog.
	* Added an rdservice(8) man page.
	* Modified 'systemd/rivendell.service.in' to enable automatic
	start retries.

* 2018-10-19 Fred Gleason <fredg@paravelsystems.com>
	* Fixed a typo that broke generation of the rmlsend(1) man page.

* 2018-10-19 Fred Gleason <fredg@paravelsystems.com>
	* Removed 'build_win32.bat'.
	* Removed all conditional compilation based on 'WIN32'.

* 2018-10-19 Fred Gleason <fredg@paravelsystems.com>
	* Removed check for Win32 installer from 'configure.ac'.
	* Removed win32 clauses from '.pro' files.
2018-10-19 16:52:56 -07:00

114 lines
2.4 KiB
C++

// rdcmd_switch.cpp
//
// Process Rivendell Command-Line Switches
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdio.h>
#include <syslog.h>
#include <stdlib.h>
#include <qmessagebox.h>
#include <rdcmd_switch.h>
RDCmdSwitch::RDCmdSwitch(int argc,char *argv[],const char *modname,
const char *usage)
{
bool debug=false;
for(int i=1;i<argc;i++) {
QString value=QString::fromUtf8(argv[i]);
if(value=="--version") {
printf("Rivendell v%s [%s]\n",VERSION,modname);
exit(0);
}
if(value=="--help") {
printf("\n%s %s\n",modname,usage);
exit(0);
}
if(value=="-d") {
debug=true;
}
QStringList f0=value.split("=");
if(f0.size()>=2) {
switch_keys.push_back(f0[0]);
for(int i=2;i<f0.size();i++) {
f0[1]+="="+f0[i];
}
switch_values.push_back(f0[1]);
switch_processed.push_back(false);
}
else {
switch_keys.push_back(value);
switch_values.push_back("");
switch_processed.push_back(false);
}
}
//
// Initialize Logging
//
if(debug) {
openlog(modname,LOG_PERROR,LOG_USER);
}
else {
openlog(modname,0,LOG_USER);
}
}
unsigned RDCmdSwitch::keys() const
{
return switch_keys.size();
}
QString RDCmdSwitch::key(unsigned n) const
{
return switch_keys[n];
}
QString RDCmdSwitch::value(unsigned n) const
{
return switch_values[n];
}
bool RDCmdSwitch::processed(unsigned n) const
{
return switch_processed[n];
}
void RDCmdSwitch::setProcessed(unsigned n,bool state)
{
switch_processed[n]=state;
}
bool RDCmdSwitch::allProcessed() const
{
for(unsigned i=0;i<switch_processed.size();i++) {
if(!switch_processed[i]) {
return false;
}
}
return true;
}