aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-03-17 11:39:25 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-03-17 11:39:25 +0100
commitb0d938b609b645b0353e95b7e5c6313f20811da9 (patch)
tree5704384aa1dc3d8cb466095f52b1ccb03be25698
parent7192018f97f6406ccc6711fc5d76cea63ec080ec (diff)
main: change location of AFB_options definition
The definition of AFB_options is not of interest other places than main.c. Change-Id: Id0af73a749554c02d7578db518e41628e2793008 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--include/local-def.h8
-rw-r--r--src/main.c11
2 files changed, 9 insertions, 10 deletions
diff --git a/include/local-def.h b/include/local-def.h
index c87fb508..360e0b0b 100644
--- a/include/local-def.h
+++ b/include/local-def.h
@@ -153,14 +153,6 @@ typedef struct {
size_t len;
} AFB_aliasdir;
-// Command line structure hold cli --command + help text
-typedef struct {
- int val; // command number within application
- int has_arg; // command number within application
- char *name; // command as used in --xxxx cli
- char *help; // help text
-} AFB_options;
-
// main config structure
typedef struct {
char *logname; // logfile path for info & error log
diff --git a/src/main.c b/src/main.c
index 9769f526..af90eaec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -84,6 +84,14 @@ static sigjmp_buf exitPoint; // context save for set/longjmp
#define SET_MODE 160
#define SET_READYFD 161
+// Command line structure hold cli --command + help text
+typedef struct {
+ int val; // command number within application
+ int has_arg; // command number within application
+ char *name; // command as used in --xxxx cli
+ char *help; // help text
+} AFB_options;
+
// Supported option
static AFB_options cliOptions [] = {
@@ -279,7 +287,6 @@ int main(int argc, char *argv[]) {
cliconfig.aliasdir = aliasdir;
// GNU CLI getopts nterface.
- struct option ggcOption;
struct option *gnuOptions;
// ------------------ Process Command Line -----------------------
@@ -292,7 +299,7 @@ int main(int argc, char *argv[]) {
// build GNU getopt info from cliOptions
nbcmd = sizeof (cliOptions) / sizeof (AFB_options);
- gnuOptions = malloc (sizeof (ggcOption) * (unsigned)nbcmd);
+ gnuOptions = malloc (sizeof (*gnuOptions) * (unsigned)nbcmd);
for (ind=0; ind < nbcmd;ind++) {
gnuOptions [ind].name = cliOptions[ind].name;
gnuOptions [ind].has_arg = cliOptions[ind].has_arg;