Browse Source

Restore the -s option for backward compatibility

Enable back the -s option (without advertising it in the
documentation), so that callers relying on the former syntax
do not break.
master
Damien Goutte-Gattat 5 years ago
parent
commit
58c9af555e
  1. 15
      src/gfsec-split.c

15
src/gfsec-split.c

@ -51,7 +51,8 @@ Split the specified file for later use with gfsec-use.\n");
puts("\
-n, --threshold N Specify the minimal number of shares\n\
required to re-assemble the secret.\n\
Default is 2.\n");
Default is 2.\n\
-s, --share URI Add a share.\n");
puts("\
-c, --config FILE Write configuration to the specified\n\
@ -110,6 +111,7 @@ main(int argc, char **argv)
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'v' },
{ "treshold", 1, NULL, 'n' },
{ "share", 1, NULL, 's' },
{ "config", 1, NULL, 'c' },
{ "keep", 0, NULL, 'k' },
{ "list-supports", 0, NULL, 'l' },
@ -123,7 +125,9 @@ main(int argc, char **argv)
srandom(time(NULL));
while ( (c = getopt_long(argc, argv, "hvn:c:kl",
cfg = gfsec_secret_new();
while ( (c = getopt_long(argc, argv, "hvn:s:c:kl",
options, NULL)) != -1 ) {
switch ( c ) {
case 'h':
@ -142,6 +146,11 @@ main(int argc, char **argv)
threshold = get_uinteger_or_die(optarg);
break;
case 's':
if ( (c = gfsec_parse_uri(optarg, cfg, 1)) != 0 )
errx(EXIT_FAILURE, "Cannot add share: %s", gfsec_error_string(c));
break;
case 'c':
config_path = optarg;
break;
@ -182,8 +191,6 @@ main(int argc, char **argv)
free(base);
}
cfg = gfsec_secret_new();
if ( (c = gfsec_secret_set_secret_file(cfg, argv[optind++])) != 0 )
errx(EXIT_FAILURE, "Cannot set secret: %s", gfsec_error_string(c));

Loading…
Cancel
Save