Diff for /embedaddon/rsync/options.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2013/10/14 07:51:14 version 1.1.1.3, 2016/11/01 09:54:32
Line 3 Line 3
  *   *
  * Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>   * Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
  * Copyright (C) 2000, 2001, 2002 Martin Pool <mbp@samba.org>   * Copyright (C) 2000, 2001, 2002 Martin Pool <mbp@samba.org>
 * Copyright (C) 2002-2013 Wayne Davison * Copyright (C) 2002-2015 Wayne Davison
  *   *
  * This program is free software; you can redistribute it and/or modify   * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by   * it under the terms of the GNU General Public License as published by
Line 32  extern unsigned int module_dirlen; Line 32  extern unsigned int module_dirlen;
 extern filter_rule_list filter_list;  extern filter_rule_list filter_list;
 extern filter_rule_list daemon_filter_list;  extern filter_rule_list daemon_filter_list;
   
   #define NOT_SPECIFIED (-42)
   
 int make_backups = 0;  int make_backups = 0;
   
 /**  /**
Line 75  int protocol_version = PROTOCOL_VERSION; Line 77  int protocol_version = PROTOCOL_VERSION;
 int sparse_files = 0;  int sparse_files = 0;
 int preallocate_files = 0;  int preallocate_files = 0;
 int do_compression = 0;  int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;int def_compress_level = NOT_SPECIFIED;
 int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */  int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
 int am_server = 0;  int am_server = 0;
 int am_sender = 0;  int am_sender = 0;
Line 409  static void parse_output_words(struct output_struct *w Line 411  static void parse_output_words(struct output_struct *w
         const char *s;          const char *s;
         int j, len, lev;          int j, len, lev;
   
        if (!str)        for ( ; str; str = s) {
                return; 
 
        while (*str) { 
                 if ((s = strchr(str, ',')) != NULL)                  if ((s = strchr(str, ',')) != NULL)
                         len = s++ - str;                          len = s++ - str;
                 else                  else
                         len = strlen(str);                          len = strlen(str);
                while (len && isDigit(str+len-1))                if (!len)
                        len--;                        continue;
                 if (!isDigit(str)) {
                         while (len && isDigit(str+len-1))
                                 len--;
                 }
                 lev = isDigit(str+len) ? atoi(str+len) : 1;                  lev = isDigit(str+len) ? atoi(str+len) : 1;
                 if (lev > MAX_OUT_LEVEL)                  if (lev > MAX_OUT_LEVEL)
                         lev = MAX_OUT_LEVEL;                          lev = MAX_OUT_LEVEL;
Line 446  static void parse_output_words(struct output_struct *w Line 449  static void parse_output_words(struct output_struct *w
                                 words[j].help, len, str);                                  words[j].help, len, str);
                         exit_cleanup(RERR_SYNTAX);                          exit_cleanup(RERR_SYNTAX);
                 }                  }
                 if (!s)  
                         break;  
                 str = s;  
         }          }
 }  }
   
Line 611  static void print_rsync_version(enum logcode f) Line 611  static void print_rsync_version(enum logcode f)
   
         rprintf(f, "%s  version %s  protocol version %d%s\n",          rprintf(f, "%s  version %s  protocol version %d%s\n",
                 RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);                  RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
        rprintf(f, "Copyright (C) 1996-2013 by Andrew Tridgell, Wayne Davison, and others.\n");        rprintf(f, "Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.\n");
         rprintf(f, "Web site: http://rsync.samba.org/\n");          rprintf(f, "Web site: http://rsync.samba.org/\n");
         rprintf(f, "Capabilities:\n");          rprintf(f, "Capabilities:\n");
         rprintf(f, "    %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",          rprintf(f, "    %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
Line 965  static struct poptOption long_options[] = { Line 965  static struct poptOption long_options[] = {
   {"no-fuzzy",         0,  POPT_ARG_VAL,    &fuzzy_basis, 0, 0, 0 },    {"no-fuzzy",         0,  POPT_ARG_VAL,    &fuzzy_basis, 0, 0, 0 },
   {"no-y",             0,  POPT_ARG_VAL,    &fuzzy_basis, 0, 0, 0 },    {"no-y",             0,  POPT_ARG_VAL,    &fuzzy_basis, 0, 0, 0 },
   {"compress",        'z', POPT_ARG_NONE,   0, 'z', 0, 0 },    {"compress",        'z', POPT_ARG_NONE,   0, 'z', 0, 0 },
     {"old-compress",     0,  POPT_ARG_VAL,    &do_compression, 1, 0, 0 },
     {"new-compress",     0,  POPT_ARG_VAL,    &do_compression, 2, 0, 0 },
   {"no-compress",      0,  POPT_ARG_VAL,    &do_compression, 0, 0, 0 },    {"no-compress",      0,  POPT_ARG_VAL,    &do_compression, 0, 0, 0 },
   {"no-z",             0,  POPT_ARG_VAL,    &do_compression, 0, 0, 0 },    {"no-z",             0,  POPT_ARG_VAL,    &do_compression, 0, 0, 0 },
   {"skip-compress",    0,  POPT_ARG_STRING, &skip_compress, 0, 0, 0 },    {"skip-compress",    0,  POPT_ARG_STRING, &skip_compress, 0, 0, 0 },
  {"compress-level",   0,  POPT_ARG_INT,    &def_compress_level, 'z', 0, 0 },  {"compress-level",   0,  POPT_ARG_INT,    &def_compress_level, 0, 0, 0 },
   {0,                 'P', POPT_ARG_NONE,   0, 'P', 0, 0 },    {0,                 'P', POPT_ARG_NONE,   0, 'P', 0, 0 },
   {"progress",         0,  POPT_ARG_VAL,    &do_progress, 1, 0, 0 },    {"progress",         0,  POPT_ARG_VAL,    &do_progress, 1, 0, 0 },
   {"no-progress",      0,  POPT_ARG_VAL,    &do_progress, 0, 0, 0 },    {"no-progress",      0,  POPT_ARG_VAL,    &do_progress, 0, 0, 0 },
Line 1543  int parse_arguments(int *argc_p, const char ***argv_p) Line 1545  int parse_arguments(int *argc_p, const char ***argv_p)
                         break;                          break;
   
                 case 'z':                  case 'z':
                        if (def_compress_level < Z_DEFAULT_COMPRESSION                        do_compression++;
                         || def_compress_level > Z_BEST_COMPRESSION) { 
                                snprintf(err_buf, sizeof err_buf, 
                                        "--compress-level value is invalid: %d\n", 
                                        def_compress_level); 
                                return 0; 
                        } 
                        do_compression = def_compress_level != Z_NO_COMPRESSION; 
                        if (do_compression && refused_compress) { 
                                create_refuse_error(refused_compress); 
                                return 0; 
                        } 
                         break;                          break;
   
                 case 'M':                  case 'M':
Line 1829  int parse_arguments(int *argc_p, const char ***argv_p) Line 1820  int parse_arguments(int *argc_p, const char ***argv_p)
                 exit_cleanup(0);                  exit_cleanup(0);
         }          }
   
           if (do_compression || def_compress_level != NOT_SPECIFIED) {
                   if (def_compress_level == NOT_SPECIFIED)
                           def_compress_level = Z_DEFAULT_COMPRESSION;
                   else if (def_compress_level < Z_DEFAULT_COMPRESSION || def_compress_level > Z_BEST_COMPRESSION) {
                           snprintf(err_buf, sizeof err_buf, "--compress-level value is invalid: %d\n",
                                    def_compress_level);
                           return 0;
                   } else if (def_compress_level == Z_NO_COMPRESSION)
                           do_compression = 0;
                   else if (!do_compression)
                           do_compression = 1;
                   if (do_compression && refused_compress) {
                           create_refuse_error(refused_compress);
                           return 0;
                   }
   #ifdef EXTERNAL_ZLIB
                   if (do_compression == 1) {
                           snprintf(err_buf, sizeof err_buf,
                                   "This rsync lacks old-style --compress due to its external zlib.  Try -zz.\n");
                           if (am_server)
                                   return 0;
                           fprintf(stderr, "%s" "Continuing without compression.\n\n", err_buf);
                           do_compression = 0;
                   }
   #endif
           }
   
 #ifdef HAVE_SETVBUF  #ifdef HAVE_SETVBUF
         if (outbuf_mode && !am_server) {          if (outbuf_mode && !am_server) {
                 int mode = *(uchar *)outbuf_mode;                  int mode = *(uchar *)outbuf_mode;
Line 2451  void server_options(char **args, int *argc_p) Line 2469  void server_options(char **args, int *argc_p)
         }          }
         if (sparse_files)          if (sparse_files)
                 argstr[x++] = 'S';                  argstr[x++] = 'S';
        if (do_compression)        if (do_compression == 1)
                 argstr[x++] = 'z';                  argstr[x++] = 'z';
   
         set_allow_inc_recurse();          set_allow_inc_recurse();
   
        /* Checking the pre-negotiated value allows --protocol=29 override. */        /* We don't really know the actual protocol_version at this point,
          * but checking the pre-negotiated value allows the user to use a
          * --protocol=29 override to avoid the use of this -eFLAGS opt. */
         if (protocol_version >= 30) {          if (protocol_version >= 30) {
                   /* Use "eFlags" alias so that cull_options doesn't think that these are no-arg option letters. */
   #define eFlags argstr
                 /* We make use of the -e option to let the server know about                  /* We make use of the -e option to let the server know about
                  * any pre-release protocol version && some behavior flags. */                   * any pre-release protocol version && some behavior flags. */
                argstr[x++] = 'e';                eFlags[x++] = 'e';
 #if SUBPROTOCOL_VERSION != 0  #if SUBPROTOCOL_VERSION != 0
                 if (protocol_version == PROTOCOL_VERSION) {                  if (protocol_version == PROTOCOL_VERSION) {
                         x += snprintf(argstr+x, sizeof argstr - x,                          x += snprintf(argstr+x, sizeof argstr - x,
Line 2468  void server_options(char **args, int *argc_p) Line 2490  void server_options(char **args, int *argc_p)
                                       PROTOCOL_VERSION, SUBPROTOCOL_VERSION);                                        PROTOCOL_VERSION, SUBPROTOCOL_VERSION);
                 } else                  } else
 #endif  #endif
                        argstr[x++] = '.';                        eFlags[x++] = '.';
                 if (allow_inc_recurse)                  if (allow_inc_recurse)
                        argstr[x++] = 'i';                        eFlags[x++] = 'i';
 #ifdef CAN_SET_SYMLINK_TIMES  #ifdef CAN_SET_SYMLINK_TIMES
                argstr[x++] = 'L';                eFlags[x++] = 'L'; /* symlink time-setting support */
 #endif  #endif
 #ifdef ICONV_OPTION  #ifdef ICONV_OPTION
                argstr[x++] = 's';                eFlags[x++] = 's'; /* symlink iconv translation support */
 #endif  #endif
                   eFlags[x++] = 'f'; /* flist I/O-error safety support */
                   eFlags[x++] = 'x'; /* xattr hardlink optimization not desired */
                   eFlags[x++] = 'C'; /* support checksum seed order fix */
   #undef eFlags
         }          }
   
         if (x >= (int)sizeof argstr) { /* Not possible... */          if (x >= (int)sizeof argstr) { /* Not possible... */
Line 2743  void server_options(char **args, int *argc_p) Line 2769  void server_options(char **args, int *argc_p)
                 rprintf(FERROR, "argc overflow in server_options().\n");                  rprintf(FERROR, "argc overflow in server_options().\n");
                 exit_cleanup(RERR_MALLOC);                  exit_cleanup(RERR_MALLOC);
         }          }
   
           if (do_compression > 1)
                   args[ac++] = "--new-compress";
   
         if (remote_option_cnt) {          if (remote_option_cnt) {
                 int j;                  int j;

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>