diff options
-rw-r--r-- | archival/tar.c | 14 | ||||
-rw-r--r-- | editors/diff.c | 9 | ||||
-rw-r--r-- | editors/patch.c | 3 | ||||
-rw-r--r-- | include/usage.h | 13 | ||||
-rw-r--r-- | libbb/unicode.c | 3 |
5 files changed, 23 insertions, 19 deletions
diff --git a/archival/tar.c b/archival/tar.c index f16b4d6..3a94012 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -770,8 +770,8 @@ enum { OPT_INCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z - OPT_NOPRESERVE_TIME = IF_FEATURE_TAR_NOPRESERVE_TIME((1 << OPTBIT_NOPRESERVE_TIME)) + 0, // m OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z + OPT_NOPRESERVE_TIME = IF_FEATURE_TAR_NOPRESERVE_TIME((1 << OPTBIT_NOPRESERVE_TIME)) + 0, // m OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions OPT_OVERWRITE = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_OVERWRITE )) + 0, // overwrite @@ -951,14 +951,12 @@ int tar_main(int argc UNUSED_PARAM, char **argv) if (opt & OPT_COMPRESS) get_header_ptr = get_header_tar_Z; -#if ENABLE_FEATURE_TAR_NOPRESERVE_TIME if (opt & OPT_NOPRESERVE_TIME) tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE; -#endif #if ENABLE_FEATURE_TAR_FROM tar_handle->reject = append_file_list_to_list(tar_handle->reject); -#if ENABLE_FEATURE_TAR_LONG_OPTIONS +# if ENABLE_FEATURE_TAR_LONG_OPTIONS /* Append excludes to reject */ while (excludes) { llist_t *next = excludes->link; @@ -966,12 +964,12 @@ int tar_main(int argc UNUSED_PARAM, char **argv) tar_handle->reject = excludes; excludes = next; } -#endif +# endif tar_handle->accept = append_file_list_to_list(tar_handle->accept); #endif /* Setup an array of filenames to work with */ - /* TODO: This is the same as in ar, separate function ? */ + /* TODO: This is the same as in ar, make a separate function? */ while (*argv) { /* kill trailing '/' unless the string is just "/" */ char *cp = last_char_is(*argv, '/'); @@ -990,7 +988,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) int flags = O_RDONLY; if (opt & OPT_CREATE) { - /* Make sure there is at least one file to tar up. */ + /* Make sure there is at least one file to tar up */ if (tar_handle->accept == NULL) bb_error_msg_and_die("empty archive"); @@ -1022,7 +1020,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) signal(SIGCHLD, handle_SIGCHLD); #endif - /* create an archive */ + /* Create an archive */ if (opt & OPT_CREATE) { #if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 int zipMode = 0; diff --git a/editors/diff.c b/editors/diff.c index 9110982..2e3a455 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -432,7 +432,8 @@ static NOINLINE int *create_J(FILE_and_pos_t ft[2], int nlen[2], off_t *ix[2]) token_t tok; size_t sz = 100; nfile[i] = xmalloc((sz + 3) * sizeof(nfile[i][0])); - fseeko(ft[i].ft_fp, 0, SEEK_SET); /* ft gets here without the correct position */ + /* ft gets here without the correct position, cant use seek_ft */ + fseeko(ft[i].ft_fp, 0, SEEK_SET); nlen[i] = 0; /* We could zalloc nfile, but then zalloc starts showing in gprof at ~1% */ @@ -625,7 +626,7 @@ static bool diff(FILE* fp[2], char *file[2]) } if (idx < 0) continue; - if (!(option_mask32 & FLAG(q)) && !((option_mask32 & FLAG(B)) && !nonempty)) { + if (!(option_mask32 & (FLAG(q)+FLAG(B))) && !nonempty) { struct context_vec *cvp = vec; int lowa = MAX(1, cvp->a - opt_U_context); int upb = MIN(nlen[0], vec[idx].b + opt_U_context); @@ -634,8 +635,8 @@ static bool diff(FILE* fp[2], char *file[2]) if (!anychange) { /* Print the context/unidiff header first time through */ - printf("--- %s\n", label[0] ?: file[0]); - printf("+++ %s\n", label[1] ?: file[1]); + printf("--- %s\n", label[0] ? label[0] : file[0]); + printf("+++ %s\n", label[1] ? label[1] : file[1]); } printf("@@ -"); diff --git a/editors/patch.c b/editors/patch.c index ab3af3c..b36980f 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -85,7 +85,6 @@ int patch_main(int argc UNUSED_PARAM, char **argv) { const char *p = "-1"; const char *i = "-"; /* compat */ - const char *g; /* unimplemented, default is "0" */ #if ENABLE_LONG_OPTS static const char patch_longopts[] ALIGN1 = "strip\0" Required_argument "p" @@ -97,7 +96,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) ; applet_long_options = patch_longopts; #endif - opt = getopt32(argv, "p:i:RNg:", &p, &i, &g); + opt = getopt32(argv, "p:i:RNg:", &p, &i, NULL); if (opt & OPT_R) plus = '-'; patch_level = xatoi(p); /* can be negative! */ diff --git a/include/usage.h b/include/usage.h index 77b7b99..44cc834 100644 --- a/include/usage.h +++ b/include/usage.h @@ -4406,9 +4406,9 @@ "nameserver 10.0.0.1\n" #define tar_trivial_usage \ - "-[" IF_FEATURE_TAR_CREATE("c") IF_FEATURE_SEAMLESS_GZ("z") \ + "-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \ IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \ - IF_FEATURE_SEAMLESS_Z("Z") IF_FEATURE_TAR_NOPRESERVE_TIME("m") "xtvO] " \ + IF_FEATURE_SEAMLESS_Z("Z") IF_FEATURE_TAR_NOPRESERVE_TIME("m") "vO] " \ IF_FEATURE_TAR_FROM("[-X FILE] ") \ "[-f TARFILE] [-C DIR] [FILE]..." #define tar_full_usage "\n\n" \ @@ -4417,7 +4417,8 @@ "or list files from a tar file\n" \ "\nOptions:" \ IF_FEATURE_TAR_CREATE( \ - "\n c Create") \ + "\n c Create" \ + ) \ "\n x Extract" \ "\n t List" \ "\nArchive format selection:" \ @@ -4434,16 +4435,18 @@ "\n Z Filter the archive through compress" \ ) \ IF_FEATURE_TAR_NOPRESERVE_TIME( \ - "\n m Do not extract files modified time" \ + "\n m Do not restore mtime" \ ) \ "\nFile selection:" \ "\n f Name of TARFILE or \"-\" for stdin" \ "\n O Extract to stdout" \ IF_FEATURE_TAR_FROM( \ + IF_FEATURE_TAR_LONG_OPTIONS( \ "\n exclude File to exclude" \ + ) \ "\n X File with names to exclude" \ ) \ - "\n C Change to directory DIR before operation" \ + "\n C Change to DIR before operation" \ "\n v Verbose" \ #define tar_example_usage \ diff --git a/libbb/unicode.c b/libbb/unicode.c index 9d316df..8004295 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c @@ -9,7 +9,10 @@ #include "libbb.h" #include "unicode.h" +/* If it's not a constant... */ +#ifndef unicode_status uint8_t unicode_status; +#endif size_t FAST_FUNC bb_mbstrlen(const char *string) { |