mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
options: return true if we created new directory.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
038ef0250a
commit
93471e06c1
2 changed files with 9 additions and 3 deletions
|
@ -447,8 +447,10 @@ static void opt_parse_from_config(struct lightningd_state *dstate)
|
|||
tal_free(contents);
|
||||
}
|
||||
|
||||
void handle_opts(struct lightningd_state *dstate, int argc, char *argv[])
|
||||
bool handle_opts(struct lightningd_state *dstate, int argc, char *argv[])
|
||||
{
|
||||
bool newdir = false;
|
||||
|
||||
opt_set_alloc(opt_allocfn, tal_reallocfn, tal_freefn);
|
||||
|
||||
opt_register_noarg("--help|-h", opt_usage_and_exit,
|
||||
|
@ -482,6 +484,7 @@ void handle_opts(struct lightningd_state *dstate, int argc, char *argv[])
|
|||
if (chdir(dstate->config_dir) != 0)
|
||||
fatal("Could not change directory %s: %s",
|
||||
dstate->config_dir, strerror(errno));
|
||||
newdir = true;
|
||||
}
|
||||
|
||||
/* Now look for config file */
|
||||
|
@ -492,4 +495,5 @@ void handle_opts(struct lightningd_state *dstate, int argc, char *argv[])
|
|||
errx(1, "no arguments accepted");
|
||||
|
||||
check_config(dstate);
|
||||
return newdir;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
struct lightningd_state;
|
||||
|
||||
/* After this, we're in the .lightning dir, config file parsed. */
|
||||
void handle_opts(struct lightningd_state *dstate, int argc, char *argv[]);
|
||||
/* After this, we're in the .lightning dir, config file parsed.
|
||||
* If we just created the dir, returns true.
|
||||
*/
|
||||
bool handle_opts(struct lightningd_state *dstate, int argc, char *argv[]);
|
||||
|
||||
#endif /* LIGHTNING_DAEMON_OPTIONS_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue