summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2009-11-04 03:16:26 (GMT)
committerChristian Pointner <equinox@helsinki.at>2009-11-04 03:16:26 (GMT)
commit1f1a372856ff1efe9d1ea5333bb1e7f2f1d56281 (patch)
tree12e9924f6a2389a83784b01888632e101ea794c0
parent354c66dec29bf626d1c088cf12cb9296e1d82619 (diff)
options parse post with return code
-rw-r--r--options.c6
-rw-r--r--options.h2
-rw-r--r--switchctl.c6
3 files changed, 10 insertions, 4 deletions
diff --git a/options.c b/options.c
index dcd52ca..3f907e9 100644
--- a/options.c
+++ b/options.c
@@ -181,11 +181,13 @@ int options_parse(options_t* opt, int argc, char* argv[])
return 0;
}
-void options_parse_post(options_t* opt)
+int options_parse_post(options_t* opt)
{
if(!opt)
- return;
+ return -1;
// nothing to do
+
+ return 0;
}
void options_default(options_t* opt)
diff --git a/options.h b/options.h
index fb33c24..5283258 100644
--- a/options.h
+++ b/options.h
@@ -42,7 +42,7 @@ typedef struct options_struct options_t;
int options_parse_hex_string(const char* hex, buffer_t* buffer);
int options_parse(options_t* opt, int argc, char* argv[]);
-void options_parse_post(options_t* opt);
+int options_parse_post(options_t* opt);
void options_default(options_t* opt);
void options_clear(options_t* opt);
void options_print_usage();
diff --git a/switchctl.c b/switchctl.c
index 1f119bc..b3150d5 100644
--- a/switchctl.c
+++ b/switchctl.c
@@ -342,7 +342,11 @@ int main(int argc, char* argv[])
}
}
log_printf(NOTICE, "just started...");
- options_parse_post(&opt);
+ if(options_parse_post(&opt)) {
+ options_clear(&opt);
+ log_close();
+ exit(-1);
+ }
priv_info_t priv;
if(opt.username_)