fix: clarify secluded args compatibility semantics
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 38s
CI / sanitizers (undefined) (pull_request) Successful in 37s
CI / fuzz-build (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 31s
CI / build-and-test (pull_request) Successful in 1m15s
CI / valgrind (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 38s
CI / sanitizers (undefined) (pull_request) Successful in 37s
CI / fuzz-build (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 31s
CI / build-and-test (pull_request) Successful in 1m15s
CI / valgrind (pull_request) Successful in 33s
This commit is contained in:
@@ -121,6 +121,7 @@ static int config_add_pattern(char*** patterns, int* count, const char* value,
|
||||
|
||||
typedef enum {
|
||||
OPT_FLAG,
|
||||
OPT_NOOP,
|
||||
OPT_STRING,
|
||||
OPT_POS_INT,
|
||||
OPT_NONNEG_INT,
|
||||
@@ -131,10 +132,10 @@ typedef struct {
|
||||
const char* name;
|
||||
const char* alias;
|
||||
OptKind kind;
|
||||
size_t offset; /* offsetof of the target field in Config */
|
||||
size_t offset; /* offsetof of the target field in Config, or 0 for OPT_NOOP */
|
||||
} OptionEntry;
|
||||
|
||||
/* Options that map directly onto a Config field with no side effects. */
|
||||
/* Options parsed directly into Config, plus compatibility options with no effect. */
|
||||
static const OptionEntry OPTION_TABLE[] = {
|
||||
{"--dry-run", "-n", OPT_FLAG, offsetof(Config, dry_run)},
|
||||
{"--delete", NULL, OPT_FLAG, offsetof(Config, use_delete)},
|
||||
@@ -146,7 +147,7 @@ static const OptionEntry OPTION_TABLE[] = {
|
||||
{"--backup", NULL, OPT_FLAG, offsetof(Config, backup)},
|
||||
{"--stats", NULL, OPT_FLAG, offsetof(Config, stats)},
|
||||
{"--partial", NULL, OPT_FLAG, offsetof(Config, partial)},
|
||||
{"--secluded-args", NULL, OPT_FLAG, offsetof(Config, use_secluded_args)},
|
||||
{"--secluded-args", NULL, OPT_NOOP, 0},
|
||||
{"--links", "-l", OPT_FLAG, offsetof(Config, follow_symlinks)},
|
||||
{"--copy-links", NULL, OPT_FLAG, offsetof(Config, copy_links)},
|
||||
{"--safe-links", NULL, OPT_FLAG, offsetof(Config, safe_links)},
|
||||
@@ -186,11 +187,16 @@ static const OptionEntry* find_table_option(const char* arg) {
|
||||
}
|
||||
|
||||
static int apply_table_option(Config* config, const OptionEntry* entry, const char* value) {
|
||||
if (entry->kind == OPT_NOOP)
|
||||
return 0;
|
||||
|
||||
void* field = (char*)config + entry->offset;
|
||||
switch (entry->kind) {
|
||||
case OPT_FLAG:
|
||||
*(bool*)field = true;
|
||||
return 0;
|
||||
case OPT_NOOP:
|
||||
return 0;
|
||||
case OPT_STRING:
|
||||
return set_string_option((char**)field, value, entry->name);
|
||||
case OPT_POS_INT:
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ void print_usage(void) {
|
||||
DELTA_MAX_FILE_SIZE);
|
||||
printf(" -m Enable multithreading\n");
|
||||
printf(" -s Enable chunk serialization\n");
|
||||
printf(" --secluded-args Send transfer arguments through the protocol (SSH)\n");
|
||||
printf(" --secluded-args Accept rsync compatibility option (no effect)\n");
|
||||
printf(" -f Enable sendfile (TCP only, not with -c or -s)\n");
|
||||
printf(" -v, --verbose Enable debug logging\n");
|
||||
printf(" -M, --preserve Preserve file metadata\n");
|
||||
|
||||
@@ -82,7 +82,6 @@ static void config_set_defaults(Config* config) {
|
||||
config->relative = false;
|
||||
config->rsh_command = NULL;
|
||||
config->rsync_path = NULL;
|
||||
config->use_secluded_args = false;
|
||||
config->temp_dir = NULL;
|
||||
config->compare_dest = NULL;
|
||||
config->copy_dest = NULL;
|
||||
|
||||
@@ -96,7 +96,6 @@ typedef struct Config {
|
||||
// Issue #130: Remote shell/connection options
|
||||
char* rsh_command;
|
||||
char* rsync_path;
|
||||
bool use_secluded_args;
|
||||
char* temp_dir;
|
||||
char* compare_dest;
|
||||
char* copy_dest;
|
||||
|
||||
Reference in New Issue
Block a user