Skip to content

Commit

Permalink
remove unused param to arg parser
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Oct 1, 2023
1 parent acc6edd commit c71b1da
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 120 deletions.
14 changes: 7 additions & 7 deletions src/ebusd/knxhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ using std::dec;

/** the definition of the KNX arguments. */
static const argDef g_knx_argDefs[] = {
{nullptr, 0, nullptr, 0, "KNX options:", 1 },
{nullptr, 0, nullptr, 0, "KNX options:"},
{"knxurl", O_URL, "URL", af_optional, "URL to open (i.e. \"[multicast][@interface]\" for KNXnet/IP"
#ifdef HAVE_KNXD
" or \"ip:host[:port]\" / \"local:/socketpath\" for knxd"
#endif
") (no default)", 0 },
") (no default)"},
{"knxrage", O_AGR, "SEC", 0, "Maximum age in seconds for using the last value of read messages (0=disable)"
" [5]", 0 },
" [5]"},
{"knxwage", O_AGW, "SEC", 0, "Maximum age in seconds for using the last value for reads on write messages"
" (0=disable), [99999999]", 0 },
{"knxint", O_INT, "FILE", 0, "Read KNX integration settings from FILE [/etc/ebusd/knx.cfg]", 0 },
{"knxvar", O_VAR, "NAME=VALUE[,...]", 0, "Add variable(s) to the read KNX integration settings", 0 },
" (0=disable), [99999999]"},
{"knxint", O_INT, "FILE", 0, "Read KNX integration settings from FILE [/etc/ebusd/knx.cfg]"},
{"knxvar", O_VAR, "NAME=VALUE[,...]", 0, "Add variable(s) to the read KNX integration settings"},

{nullptr, 0, nullptr, 0, nullptr, 0 },
{nullptr, 0, nullptr, 0, nullptr},
};

static const char* g_url = nullptr; //!< URL of KNX daemon
Expand Down
112 changes: 56 additions & 56 deletions src/ebusd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,91 +177,91 @@ static bool s_scanConfigOrPathSet = false;

/** the definition of the known program arguments. */
static const argDef argDefs[] = {
{nullptr, 0, nullptr, 0, "Device options:", 1 },
{nullptr, 0, nullptr, 0, "Device options:"},
{"device", 'd', "DEV", 0, "Use DEV as eBUS device ("
"prefix \"ens:\" for enhanced high speed device or "
"\"enh:\" for enhanced device, with "
"\"IP:PORT\" for network device or "
"\"DEVICE\" for serial device"
") [/dev/ttyUSB0]", 0 },
{"nodevicecheck", 'n', nullptr, 0, "Skip serial eBUS device test", 0 },
{"readonly", 'r', nullptr, 0, "Only read from device, never write to it", 0 },
{"initsend", O_INISND, nullptr, 0, "Send an initial escape symbol after connecting device", 0 },
{"latency", O_DEVLAT, "MSEC", 0, "Extra transfer latency in ms [0]", 0 },
") [/dev/ttyUSB0]"},
{"nodevicecheck", 'n', nullptr, 0, "Skip serial eBUS device test"},
{"readonly", 'r', nullptr, 0, "Only read from device, never write to it"},
{"initsend", O_INISND, nullptr, 0, "Send an initial escape symbol after connecting device"},
{"latency", O_DEVLAT, "MSEC", 0, "Extra transfer latency in ms [0]"},

{nullptr, 0, nullptr, 0, "Message configuration options:", 2 },
{nullptr, 0, nullptr, 0, "Message configuration options:"},
{"configpath", 'c', "PATH", 0, "Read CSV config files from PATH (local folder or HTTPS URL) ["
CONFIG_PATH "]", 0 },
CONFIG_PATH "]"},
{"scanconfig", 's', "ADDR", af_optional, "Pick CSV config files matching initial scan ADDR: "
"empty for broadcast ident message (default when configpath is not given), "
"\"none\" for no initial scan message, "
"\"full\" for full scan, "
"a single hex address to scan, or "
"\"off\" for not picking CSV files by scan result (default when configpath is given).\n"
"If combined with --checkconfig, you can add scan message data as "
"arguments for checking a particular scan configuration, e.g. \"FF08070400/0AB5454850303003277201\".", 0 },
{"scanretries", O_SCNRET, "COUNT", 0, "Retry scanning devices COUNT times [5]", 0 },
"arguments for checking a particular scan configuration, e.g. \"FF08070400/0AB5454850303003277201\"."},
{"scanretries", O_SCNRET, "COUNT", 0, "Retry scanning devices COUNT times [5]"},
{"configlang", O_CFGLNG, "LANG", 0,
"Prefer LANG in multilingual configuration files [system default language]", 0 },
{"checkconfig", O_CHKCFG, nullptr, 0, "Check config files, then stop", 0 },
"Prefer LANG in multilingual configuration files [system default language]"},
{"checkconfig", O_CHKCFG, nullptr, 0, "Check config files, then stop"},
{"dumpconfig", O_DMPCFG, "FORMAT", af_optional,
"Check and dump config files in FORMAT (\"json\" or \"csv\"), then stop", 0 },
{"dumpconfigto", O_DMPCTO, "FILE", 0, "Dump config files to FILE", 0 },
{"pollinterval", O_POLINT, "SEC", 0, "Poll for data every SEC seconds (0=disable) [5]", 0 },
"Check and dump config files in FORMAT (\"json\" or \"csv\"), then stop"},
{"dumpconfigto", O_DMPCTO, "FILE", 0, "Dump config files to FILE"},
{"pollinterval", O_POLINT, "SEC", 0, "Poll for data every SEC seconds (0=disable) [5]"},
{"inject", 'i', "stop", af_optional, "Inject remaining arguments as already seen messages (e.g. "
"\"FF08070400/0AB5454850303003277201\"), optionally stop afterwards", 0 },
"\"FF08070400/0AB5454850303003277201\"), optionally stop afterwards"},
#ifdef HAVE_SSL
{"cafile", O_CAFILE, "FILE", 0, "Use CA FILE for checking certificates (uses defaults,"
" \"#\" for insecure)", 0 },
{"capath", O_CAPATH, "PATH", 0, "Use CA PATH for checking certificates (uses defaults)", 0 },
" \"#\" for insecure)"},
{"capath", O_CAPATH, "PATH", 0, "Use CA PATH for checking certificates (uses defaults)"},
#endif // HAVE_SSL

{nullptr, 0, nullptr, 0, "eBUS options:", 3 },
{"address", 'a', "ADDR", 0, "Use hex ADDR as own master bus address [31]", 0 },
{"answer", O_ANSWER, nullptr, 0, "Actively answer to requests from other masters", 0 },
{"acquiretimeout", O_ACQTIM, "MSEC", 0, "Stop bus acquisition after MSEC ms [10]", 0 },
{"acquireretries", O_ACQRET, "COUNT", 0, "Retry bus acquisition COUNT times [3]", 0 },
{"sendretries", O_SNDRET, "COUNT", 0, "Repeat failed sends COUNT times [2]", 0 },
{"receivetimeout", O_RCVTIM, "MSEC", 0, "Expect a slave to answer within MSEC ms [25]", 0 },
{"numbermasters", O_MASCNT, "COUNT", 0, "Expect COUNT masters on the bus, 0 for auto detection [0]", 0 },
{"generatesyn", O_GENSYN, nullptr, 0, "Enable AUTO-SYN symbol generation", 0 },

{nullptr, 0, nullptr, 0, "Daemon options:", 4 },
{"accesslevel", O_ACLDEF, "LEVEL", 0, "Set default access level to LEVEL (\"*\" for everything) [\"\"]", 0 },
{"aclfile", O_ACLFIL, "FILE", 0, "Read access control list from FILE", 0 },
{"foreground", 'f', nullptr, 0, "Run in foreground", 0 },
{"enablehex", O_HEXCMD, nullptr, 0, "Enable hex command", 0 },
{"enabledefine", O_DEFCMD, nullptr, 0, "Enable define command", 0 },
{"pidfile", O_PIDFIL, "FILE", 0, "PID file name (only for daemon) [" PACKAGE_PIDFILE "]", 0 },
{"port", 'p', "PORT", 0, "Listen for command line connections on PORT [8888]", 0 },
{"localhost", O_LOCAL, nullptr, 0, "Listen for command line connections on 127.0.0.1 interface only", 0 },
{"httpport", O_HTTPPT, "PORT", 0, "Listen for HTTP connections on PORT, 0 to disable [0]", 0 },
{"htmlpath", O_HTMLPA, "PATH", 0, "Path for HTML files served by HTTP port [/var/ebusd/html]", 0 },
{"updatecheck", O_UPDCHK, "MODE", 0, "Set automatic update check to MODE (on|off) [on]", 0 },

{nullptr, 0, nullptr, 0, "Log options:", 5 },
{nullptr, 0, nullptr, 0, "eBUS options:"},
{"address", 'a', "ADDR", 0, "Use hex ADDR as own master bus address [31]"},
{"answer", O_ANSWER, nullptr, 0, "Actively answer to requests from other masters"},
{"acquiretimeout", O_ACQTIM, "MSEC", 0, "Stop bus acquisition after MSEC ms [10]"},
{"acquireretries", O_ACQRET, "COUNT", 0, "Retry bus acquisition COUNT times [3]"},
{"sendretries", O_SNDRET, "COUNT", 0, "Repeat failed sends COUNT times [2]"},
{"receivetimeout", O_RCVTIM, "MSEC", 0, "Expect a slave to answer within MSEC ms [25]"},
{"numbermasters", O_MASCNT, "COUNT", 0, "Expect COUNT masters on the bus, 0 for auto detection [0]"},
{"generatesyn", O_GENSYN, nullptr, 0, "Enable AUTO-SYN symbol generation"},

{nullptr, 0, nullptr, 0, "Daemon options:"},
{"accesslevel", O_ACLDEF, "LEVEL", 0, "Set default access level to LEVEL (\"*\" for everything) [\"\"]"},
{"aclfile", O_ACLFIL, "FILE", 0, "Read access control list from FILE"},
{"foreground", 'f', nullptr, 0, "Run in foreground"},
{"enablehex", O_HEXCMD, nullptr, 0, "Enable hex command"},
{"enabledefine", O_DEFCMD, nullptr, 0, "Enable define command"},
{"pidfile", O_PIDFIL, "FILE", 0, "PID file name (only for daemon) [" PACKAGE_PIDFILE "]"},
{"port", 'p', "PORT", 0, "Listen for command line connections on PORT [8888]"},
{"localhost", O_LOCAL, nullptr, 0, "Listen for command line connections on 127.0.0.1 interface only"},
{"httpport", O_HTTPPT, "PORT", 0, "Listen for HTTP connections on PORT, 0 to disable [0]"},
{"htmlpath", O_HTMLPA, "PATH", 0, "Path for HTML files served by HTTP port [/var/ebusd/html]"},
{"updatecheck", O_UPDCHK, "MODE", 0, "Set automatic update check to MODE (on|off) [on]"},

{nullptr, 0, nullptr, 0, "Log options:"},
{"logfile", 'l', "FILE", 0, "Write log to FILE (only for daemon, empty string for using syslog) ["
PACKAGE_LOGFILE "]", 0 },
PACKAGE_LOGFILE "]"},
{"log", O_LOG, "AREAS:LEVEL", 0, "Only write log for matching AREA(S) below or equal to LEVEL"
" (alternative to --logareas/--logevel, may be used multiple times) [all:notice]", 0 },
" (alternative to --logareas/--logevel, may be used multiple times) [all:notice]"},
{"logareas", O_LOGARE, "AREAS", 0, "Only write log for matching AREA(S): main|network|bus|update|other"
"|all [all]", 0 },
"|all [all]"},
{"loglevel", O_LOGLEV, "LEVEL", 0, "Only write log below or equal to LEVEL: error|notice|info|debug"
" [notice]", 0 },
" [notice]"},

{nullptr, 0, nullptr, 0, "Raw logging options:", 6 },
{nullptr, 0, nullptr, 0, "Raw logging options:"},
{"lograwdata", O_RAW, "bytes", af_optional,
"Log messages or all received/sent bytes on the bus", 0 },
{"lograwdatafile", O_RAWFIL, "FILE", 0, "Write raw log to FILE [" PACKAGE_LOGFILE "]", 0 },
{"lograwdatasize", O_RAWSIZ, "SIZE", 0, "Make raw log file no larger than SIZE kB [100]", 0 },
"Log messages or all received/sent bytes on the bus"},
{"lograwdatafile", O_RAWFIL, "FILE", 0, "Write raw log to FILE [" PACKAGE_LOGFILE "]"},
{"lograwdatasize", O_RAWSIZ, "SIZE", 0, "Make raw log file no larger than SIZE kB [100]"},

{nullptr, 0, nullptr, 0, "Binary dump options:", 7 },
{"dump", 'D', nullptr, 0, "Enable binary dump of received bytes", 0 },
{"dumpfile", O_DMPFIL, "FILE", 0, "Dump received bytes to FILE [/tmp/" PACKAGE "_dump.bin]", 0 },
{"dumpsize", O_DMPSIZ, "SIZE", 0, "Make dump file no larger than SIZE kB [100]", 0 },
{"dumpflush", O_DMPFLU, nullptr, 0, "Flush each byte", 0 },
{nullptr, 0, nullptr, 0, "Binary dump options:"},
{"dump", 'D', nullptr, 0, "Enable binary dump of received bytes"},
{"dumpfile", O_DMPFIL, "FILE", 0, "Dump received bytes to FILE [/tmp/" PACKAGE "_dump.bin]"},
{"dumpsize", O_DMPSIZ, "SIZE", 0, "Make dump file no larger than SIZE kB [100]"},
{"dumpflush", O_DMPFLU, nullptr, 0, "Flush each byte"},

{nullptr, 0, nullptr, 0, nullptr, 0 },
{nullptr, 0, nullptr, 0, nullptr},
};

/**
Expand Down
48 changes: 24 additions & 24 deletions src/ebusd/mqtthandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,43 @@ using std::dec;

/** the definition of the MQTT arguments. */
static const argDef g_mqtt_argDefs[] = {
{nullptr, 0, nullptr, 0, "MQTT options:", 1 },
{"mqtthost", O_HOST, "HOST", 0, "Connect to MQTT broker on HOST [localhost]", 0 },
{"mqttport", O_PORT, "PORT", 0, "Connect to MQTT broker on PORT (usually 1883), 0 to disable [0]", 0 },
{nullptr, 0, nullptr, 0, "MQTT options:"},
{"mqtthost", O_HOST, "HOST", 0, "Connect to MQTT broker on HOST [localhost]"},
{"mqttport", O_PORT, "PORT", 0, "Connect to MQTT broker on PORT (usually 1883), 0 to disable [0]"},
{"mqttclientid", O_CLID, "ID", 0, "Set client ID for connection to MQTT broker [" PACKAGE_NAME "_"
PACKAGE_VERSION "_<pid>]", 0 },
{"mqttuser", O_USER, "USER", 0, "Connect as USER to MQTT broker (no default)", 0 },
{"mqttpass", O_PASS, "PASSWORD", 0, "Use PASSWORD when connecting to MQTT broker (no default)", 0 },
PACKAGE_VERSION "_<pid>]"},
{"mqttuser", O_USER, "USER", 0, "Connect as USER to MQTT broker (no default)"},
{"mqttpass", O_PASS, "PASSWORD", 0, "Use PASSWORD when connecting to MQTT broker (no default)"},
{"mqtttopic", O_TOPI, "TOPIC", 0,
"Use MQTT TOPIC (prefix before /%circuit/%name or complete format) [ebusd]", 0 },
"Use MQTT TOPIC (prefix before /%circuit/%name or complete format) [ebusd]"},
{"mqttglobal", O_GTOP, "TOPIC", 0,
"Use TOPIC for global data (default is \"global/\" suffix to mqtttopic prefix)", 0 },
{"mqttretain", O_RETA, nullptr, 0, "Retain all topics instead of only selected global ones", 0 },
{"mqttqos", O_PQOS, "QOS", 0, "Set the QoS value for all topics (0-2) [0]", 0 },
{"mqttint", O_INTF, "FILE", 0, "Read MQTT integration settings from FILE (no default)", 0 },
{"mqttvar", O_IVAR, "NAME=VALUE[,...]", 0, "Add variable(s) to the read MQTT integration settings", 0 },
"Use TOPIC for global data (default is \"global/\" suffix to mqtttopic prefix)"},
{"mqttretain", O_RETA, nullptr, 0, "Retain all topics instead of only selected global ones"},
{"mqttqos", O_PQOS, "QOS", 0, "Set the QoS value for all topics (0-2) [0]"},
{"mqttint", O_INTF, "FILE", 0, "Read MQTT integration settings from FILE (no default)"},
{"mqttvar", O_IVAR, "NAME=VALUE[,...]", 0, "Add variable(s) to the read MQTT integration settings"},
{"mqttjson", O_JSON, "short", af_optional,
"Publish in JSON format instead of strings, optionally in short (value directly below field key)", 0 },
{"mqttverbose", O_VERB, nullptr, 0, "Publish all available attributes", 0 },
"Publish in JSON format instead of strings, optionally in short (value directly below field key)"},
{"mqttverbose", O_VERB, nullptr, 0, "Publish all available attributes"},
#if (LIBMOSQUITTO_VERSION_NUMBER >= 1003001)
{"mqttlog", O_LOGL, nullptr, 0, "Log library events", 0 },
{"mqttlog", O_LOGL, nullptr, 0, "Log library events"},
#endif
#if (LIBMOSQUITTO_VERSION_NUMBER >= 1004001)
{"mqttversion", O_VERS, "VERSION", 0, "Use protocol VERSION [3.1]", 0 },
{"mqttversion", O_VERS, "VERSION", 0, "Use protocol VERSION [3.1]"},
#endif
{"mqttignoreinvalid", O_IGIN, nullptr, 0,
"Ignore invalid parameters during init (e.g. for DNS not resolvable yet)", 0 },
{"mqttchanges", O_CHGS, nullptr, 0, "Whether to only publish changed messages instead of all received", 0 },
"Ignore invalid parameters during init (e.g. for DNS not resolvable yet)"},
{"mqttchanges", O_CHGS, nullptr, 0, "Whether to only publish changed messages instead of all received"},

#if (LIBMOSQUITTO_MAJOR >= 1)
{"mqttca", O_CAFI, "CA", 0, "Use CA file or dir (ending with '/') for MQTT TLS (no default)", 0 },
{"mqttcert", O_CERT, "CERTFILE", 0, "Use CERTFILE for MQTT TLS client certificate (no default)", 0 },
{"mqttkey", O_KEYF, "KEYFILE", 0, "Use KEYFILE for MQTT TLS client certificate (no default)", 0 },
{"mqttkeypass", O_KEPA, "PASSWORD", 0, "Use PASSWORD for the encrypted KEYFILE (no default)", 0 },
{"mqttinsecure", O_INSE, nullptr, 0, "Allow insecure TLS connection (e.g. using a self signed certificate)", 0 },
{"mqttca", O_CAFI, "CA", 0, "Use CA file or dir (ending with '/') for MQTT TLS (no default)"},
{"mqttcert", O_CERT, "CERTFILE", 0, "Use CERTFILE for MQTT TLS client certificate (no default)"},
{"mqttkey", O_KEYF, "KEYFILE", 0, "Use KEYFILE for MQTT TLS client certificate (no default)"},
{"mqttkeypass", O_KEPA, "PASSWORD", 0, "Use PASSWORD for the encrypted KEYFILE (no default)"},
{"mqttinsecure", O_INSE, nullptr, 0, "Allow insecure TLS connection (e.g. using a self signed certificate)"},
#endif

{nullptr, 0, nullptr, 0, nullptr, 0 },
{nullptr, 0, nullptr, 0, nullptr},
};

static const char* g_host = "localhost"; //!< host name of MQTT broker [localhost]
Expand Down
6 changes: 3 additions & 3 deletions src/lib/utils/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ void buildOpts(const argDef *argDefs, int &count, int &shortCharsCount, int &sho
}
}

static const argDef endArgDef = {nullptr, 0, nullptr, 0, nullptr, 0 };
static const argDef helpArgDef = {"help", '?', nullptr, 0, "Give this help list", 0 };
static const argDef endArgDef = {nullptr, 0, nullptr, 0, nullptr};
static const argDef helpArgDef = {"help", '?', nullptr, 0, "Give this help list"};
static const argDef helpArgDefs[] = {
helpArgDef,
endArgDef
};
static const argDef versionArgDef = {"version", 'V', nullptr, 0, "Print program version", 0 };
static const argDef versionArgDef = {"version", 'V', nullptr, 0, "Print program version"};
static const argDef versionArgDefs[] = {
versionArgDef,
endArgDef
Expand Down
1 change: 0 additions & 1 deletion src/lib/utils/arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ typedef struct argDef {
const char* valueName; //!< the optional argument value name
int flags; //!< flags for the argument, bit combination of @a ArgFlag
const char* help; //!< help text (mandatory)
int unused; //!< currently unused (kept for compatibility to argp)
} argDef;

struct argParseOpt;
Expand Down
3 changes: 2 additions & 1 deletion src/tools/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
AM_CXXFLAGS = -I$(top_srcdir)/src \
-isystem$(top_srcdir)
-isystem$(top_srcdir) \
-Wno-unused-parameter

bin_PROGRAMS = ebusctl \
ebuspicloader
Expand Down
12 changes: 6 additions & 6 deletions src/tools/ebusctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ static struct options opt = {

/** the definition of the known program arguments. */
static const argDef argDefs[] = {
{nullptr, 0, nullptr, 0, "Options:", 1 },
{"server", 's', "HOST", 0, "Connect to " PACKAGE " on HOST (name or IP) [localhost]", 0 },
{"port", 'p', "PORT", 0, "Connect to " PACKAGE " on PORT [8888]", 0 },
{nullptr, 0, nullptr, 0, "Options:"},
{"server", 's', "HOST", 0, "Connect to " PACKAGE " on HOST (name or IP) [localhost]"},
{"port", 'p', "PORT", 0, "Connect to " PACKAGE " on PORT [8888]"},
{"timeout", 't', "SECS", 0, "Timeout for connecting to/receiving from " PACKAGE
", 0 for none [60]", 0 },
{"error", 'e', nullptr, 0, "Exit non-zero if the connection was fine but the response indicates non-success", 0},
", 0 for none [60]"},
{"error", 'e', nullptr, 0, "Exit non-zero if the connection was fine but the response indicates non-success"},

{nullptr, 0, nullptr, 0, nullptr, 0 },
{nullptr, 0, nullptr, 0, nullptr},
};

/**
Expand Down
Loading

0 comments on commit c71b1da

Please sign in to comment.