X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=b36de76d6bf69df3f72e7c0dc2de29ba9513303c;hb=89715454c083aaeb4dc73340f2d0ab9a3d9503e0;hp=04fbdd5238b0166e7b36998972568efe9b85bed3;hpb=268e3ffca7b45cfc736e1bc9bec7a113c6c45701;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 04fbdd52..b36de76d 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -106,6 +106,7 @@ static void usage(bool status) { " -c, --config=DIR Read configuration options from DIR.\n" " -n, --net=NETNAME Connect to net NETNAME.\n" " --pidfile=FILENAME Read control cookie from FILENAME.\n" + " --force Force some commands to work despite warnings.\n" " --help Display this help and exit.\n" " --version Output version information and exit.\n" "\n" @@ -145,9 +146,9 @@ static void usage(bool status) { " log [level] Dump log output [up to the specified level]\n" " export Export host configuration of local node to standard output\n" " export-all Export all host configuration files to standard output\n" - " import [--force] Import host configuration file(s) from standard input\n" - " exchange [--force] Same as export followed by import\n" - " exchange-all [--force] Same as export-all followed by import\n" + " import Import host configuration file(s) from standard input\n" + " exchange Same as export followed by import\n" + " exchange-all Same as export-all followed by import\n" " invite NODE [...] Generate an invitation for NODE\n" " join INVITATION Join a VPN using an INVITIATION\n" " network [NETNAME] List all known networks, or switch to the one named NETNAME.\n" @@ -1610,6 +1611,11 @@ static int cmd_config(int argc, char *argv[]) { } set = true; continue; + // Add + } else if(action > 0) { + // Check if we've already seen this variable with the same value + if(!strcasecmp(bvalue, value)) + found = true; } } @@ -1642,7 +1648,7 @@ static int cmd_config(int argc, char *argv[]) { } // Add new variable if necessary. - if(action > 0 || (action == 0 && !set)) { + if((action > 0 && !found)|| (action == 0 && !set)) { if(fprintf(tf, "%s = %s\n", variable, value) < 0) { fprintf(stderr, "Error writing to temporary file %s: %s\n", tmpfile, strerror(errno)); return 1;