[BACK]Return to main.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rsync

Diff for /src/usr.bin/rsync/main.c between version 1.59 and 1.59.2.1

version 1.59, 2021/09/01 09:48:08 version 1.59.2.1, 2021/11/09 13:40:41
Line 26 
Line 26 
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   #include <util.h>
   
 #include "extern.h"  #include "extern.h"
   
Line 280 
Line 281 
 #define OP_INCLUDE      1006  #define OP_INCLUDE      1006
 #define OP_EXCLUDE_FROM 1007  #define OP_EXCLUDE_FROM 1007
 #define OP_INCLUDE_FROM 1008  #define OP_INCLUDE_FROM 1008
   #define OP_COMP_DEST    1009
   #define OP_COPY_DEST    1010
   #define OP_LINK_DEST    1011
   #define OP_MAX_SIZE     1012
   #define OP_MIN_SIZE     1013
   
 const struct option      lopts[] = {  const struct option      lopts[] = {
     { "address",        required_argument, NULL,                OP_ADDRESS },      { "address",        required_argument, NULL,                OP_ADDRESS },
     { "archive",        no_argument,    NULL,                   'a' },      { "archive",        no_argument,    NULL,                   'a' },
       { "compare-dest",   required_argument, NULL,                OP_COMP_DEST },
   #if 0
       { "copy-dest",      required_argument, NULL,                OP_COPY_DEST },
       { "link-dest",      required_argument, NULL,                OP_LINK_DEST },
   #endif
     { "compress",       no_argument,    NULL,                   'z' },      { "compress",       no_argument,    NULL,                   'z' },
     { "del",            no_argument,    &opts.del,              1 },      { "del",            no_argument,    &opts.del,              1 },
     { "delete",         no_argument,    &opts.del,              1 },      { "delete",         no_argument,    &opts.del,              1 },
     { "devices",        no_argument,    &opts.devices,          1 },      { "devices",        no_argument,    &opts.devices,          1 },
     { "no-devices",     no_argument,    &opts.devices,          0 },      { "no-devices",     no_argument,    &opts.devices,          0 },
     { "dry-run",        no_argument,    &opts.dry_run,          1 },      { "dry-run",        no_argument,    &opts.dry_run,          1 },
     { "exclude",        required_argument, NULL,                OP_EXCLUDE },      { "exclude",        required_argument, NULL,                OP_EXCLUDE },
     { "exclude-from",   required_argument, NULL,                OP_EXCLUDE_FROM },      { "exclude-from",   required_argument, NULL,                OP_EXCLUDE_FROM },
     { "group",          no_argument,    &opts.preserve_gids,    1 },      { "group",          no_argument,    &opts.preserve_gids,    1 },
     { "no-group",       no_argument,    &opts.preserve_gids,    0 },      { "no-group",       no_argument,    &opts.preserve_gids,    0 },
     { "help",           no_argument,    NULL,                   'h' },      { "help",           no_argument,    NULL,                   'h' },
     { "include",        required_argument, NULL,                OP_INCLUDE },      { "include",        required_argument, NULL,                OP_INCLUDE },
     { "include-from",   required_argument, NULL,                OP_INCLUDE_FROM },      { "include-from",   required_argument, NULL,                OP_INCLUDE_FROM },
     { "links",          no_argument,    &opts.preserve_links,   1 },      { "links",          no_argument,    &opts.preserve_links,   1 },
       { "max-size",       required_argument, NULL,                OP_MAX_SIZE },
       { "min-size",       required_argument, NULL,                OP_MIN_SIZE },
     { "no-links",       no_argument,    &opts.preserve_links,   0 },      { "no-links",       no_argument,    &opts.preserve_links,   0 },
     { "no-motd",        no_argument,    &opts.no_motd,          1 },      { "no-motd",        no_argument,    &opts.no_motd,          1 },
     { "numeric-ids",    no_argument,    &opts.numeric_ids,      1 },      { "numeric-ids",    no_argument,    &opts.numeric_ids,      1 },
Line 327 
Line 340 
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         pid_t            child;          pid_t            child;
         int              fds[2], sd = -1, rc, c, st, i;          int              fds[2], sd = -1, rc, c, st, i, lidx;
         struct sess       sess;          size_t           basedir_cnt = 0;
           struct sess      sess;
         struct fargs    *fargs;          struct fargs    *fargs;
         char            **args;          char            **args;
         const char      *errstr;          const char      *errstr;
   
         /* Global pledge. */          /* Global pledge. */
   
Line 339 
Line 353 
             NULL) == -1)              NULL) == -1)
                 err(ERR_IPC, "pledge");                  err(ERR_IPC, "pledge");
   
         while ((c = getopt_long(argc, argv, "Dae:ghlnoprtvxz", lopts, NULL))          opts.max_size = opts.min_size = -1;
   
           while ((c = getopt_long(argc, argv, "Dae:ghlnoprtvxz", lopts, &lidx))
             != -1) {              != -1) {
                 switch (c) {                  switch (c) {
                 case 'D':                  case 'D':
Line 423 
Line 439 
                 case OP_INCLUDE_FROM:                  case OP_INCLUDE_FROM:
                         parse_file(optarg, RULE_INCLUDE);                          parse_file(optarg, RULE_INCLUDE);
                         break;                          break;
                   case OP_COMP_DEST:
                           if (opts.alt_base_mode !=0 &&
                               opts.alt_base_mode != BASE_MODE_COMPARE) {
                                   errx(1, "option --%s conflicts with %s",
                                       lopts[lidx].name,
                                       alt_base_mode(opts.alt_base_mode));
                           }
                           opts.alt_base_mode = BASE_MODE_COMPARE;
   #if 0
                           goto basedir;
                   case OP_COPY_DEST:
                           if (opts.alt_base_mode !=0 &&
                               opts.alt_base_mode != BASE_MODE_COPY) {
                                   errx(1, "option --%s conflicts with %s",
                                       lopts[lidx].name,
                                       alt_base_mode(opts.alt_base_mode));
                           }
                           opts.alt_base_mode = BASE_MODE_COPY;
                           goto basedir;
                   case OP_LINK_DEST:
                           if (opts.alt_base_mode !=0 &&
                               opts.alt_base_mode != BASE_MODE_LINK) {
                                   errx(1, "option --%s conflicts with %s",
                                       lopts[lidx].name,
                                       alt_base_mode(opts.alt_base_mode));
                           }
                           opts.alt_base_mode = BASE_MODE_LINK;
   
   basedir:
   #endif
                           if (basedir_cnt >= MAX_BASEDIR)
                                   errx(1, "too many --%s directories specified",
                                       lopts[lidx].name);
                           opts.basedir[basedir_cnt++] = optarg;
                           break;
                   case OP_MAX_SIZE:
                           if (scan_scaled(optarg, &opts.max_size) == -1)
                                   err(1, "bad max-size");
                           break;
                   case OP_MIN_SIZE:
                           if (scan_scaled(optarg, &opts.min_size) == -1)
                                   err(1, "bad min-size");
                           break;
                 case OP_VERSION:                  case OP_VERSION:
                         fprintf(stderr, "openrsync: protocol version %u\n",                          fprintf(stderr, "openrsync: protocol version %u\n",
                             RSYNC_PROTOCOL);                              RSYNC_PROTOCOL);
Line 554 
Line 613 
         exit(rc);          exit(rc);
 usage:  usage:
         fprintf(stderr, "usage: %s"          fprintf(stderr, "usage: %s"
             " [-aDglnoprtvx] [-e program] [--address=sourceaddr] [--del]\n"              " [-aDglnoprtvx] [-e program] [--address=sourceaddr]\n"
             "\t[--exclude] [--exclude-from=file] [--include] "              "\t[--compare-dest=dir] [--del] [--exclude] [--exclude-from=file]\n"
             "[--include-from=file]\n"              "\t[--include] [--include-from=file] [--no-motd] [--numeric-ids]\n"
             "\t[--no-motd] [--numeric-ids] [--port=portnumber] "              "\t[--port=portnumber] [--rsync-path=program] [--timeout=seconds]\n"
             "[--rsync-path=program]\n\t[--timeout=seconds] [--version] "              "\t[--version] source ... directory\n",
             "source ... directory\n",  
             getprogname());              getprogname());
         exit(ERR_SYNTAX);          exit(ERR_SYNTAX);
 }  }

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.59.2.1