aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-23 17:14:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-23 17:14:14 +0000
commitbdc88fdc6844ee6890e31ba4cf56800becc8c682 (patch)
tree69301e47c6493ad275d72e57ce96467ee13d7ecc /archival
parent9fe9c1a6d8e66032a9783f98606167764e8ab296 (diff)
downloadbusybox-w32-bdc88fdc6844ee6890e31ba4cf56800becc8c682.tar.gz
busybox-w32-bdc88fdc6844ee6890e31ba4cf56800becc8c682.tar.bz2
busybox-w32-bdc88fdc6844ee6890e31ba4cf56800becc8c682.zip
rework long option handling. saves ~1.2k
function old new delta tar_longopts - 222 +222 static.udhcpc_longopts - 192 +192 start_stop_daemon_longopts - 150 +150 getopt32 1045 1185 +140 static.wget_longopts - 111 +111 static.od_longopts - 105 +105 getopt_longopts - 96 +96 install_longopts - 67 +67 ipcalc_longopts - 63 +63 static.hwclock_longopts - 54 +54 ftpgetput_longopts - 52 +52 static.dumpleases_longopts - 32 +32 env_longopts - 31 +31 runparts_longopts - 30 +30 mv_longopts - 24 +24 mkdir_longopts - 19 +19 find_pair 164 180 +16 bb_null_long_options - 16 +16 setconsole_longopts - 10 +10 display_speed 91 98 +7 collect_blk 467 474 +7 show_color 4 1 -3 ls_main 913 904 -9 bb_default_long_options 16 - -16 ls_color_opt 32 10 -22 setconsole_long_options 32 - -32 arith 2077 2030 -47 mv_long_options 48 - -48 mkdir_long_options 48 - -48 env_long_options 48 - -48 static.options 248 184 -64 runparts_long_options 80 - -80 ftpgetput_long_options 96 - -96 static.hwclock_long_options 112 - -112 install_long_options 112 - -112 static.long_options 144 - -144 static.wget_long_options 160 - -160 longopts 160 - -160 static.arg_options 304 - -304 tar_long_options 320 - -320 long_options 384 - -384 ------------------------------------------------------------------------------ (add/remove: 17/15 grow/shrink: 4/5 up/down: 1444/-2209) Total: -765 bytes text data bss dec hex filename 782618 1328 11900 795846 c24c6 busybox_old 781354 1328 11900 794582 c1fd6 busybox_unstripped
Diffstat (limited to 'archival')
-rw-r--r--archival/tar.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/archival/tar.c b/archival/tar.c
index bcbb7a994..d03b18b9c 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -715,45 +715,44 @@ enum {
715 OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions 715 OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions
716}; 716};
717#if ENABLE_FEATURE_TAR_LONG_OPTIONS 717#if ENABLE_FEATURE_TAR_LONG_OPTIONS
718static const struct option tar_long_options[] = { 718static const char tar_longopts[] =
719 { "list", 0, NULL, 't' }, 719 "list\0" No_argument "t"
720 { "extract", 0, NULL, 'x' }, 720 "extract\0" No_argument "x"
721 { "directory", 1, NULL, 'C' }, 721 "directory\0" Required_argument "C"
722 { "file", 1, NULL, 'f' }, 722 "file\0" Required_argument "f"
723 { "to-stdout", 0, NULL, 'O' }, 723 "to-stdout\0" No_argument "O"
724 { "same-permissions", 0, NULL, 'p' }, 724 "same-permissions\0" No_argument "p"
725 { "verbose", 0, NULL, 'v' }, 725 "verbose\0" No_argument "v"
726 { "keep-old", 0, NULL, 'k' }, 726 "keep-old\0" No_argument "k"
727# if ENABLE_FEATURE_TAR_CREATE 727# if ENABLE_FEATURE_TAR_CREATE
728 { "create", 0, NULL, 'c' }, 728 "create\0" No_argument "c"
729 { "dereference", 0, NULL, 'h' }, 729 "dereference\0" No_argument "h"
730# endif 730# endif
731# if ENABLE_FEATURE_TAR_BZIP2 731# if ENABLE_FEATURE_TAR_BZIP2
732 { "bzip2", 0, NULL, 'j' }, 732 "bzip2\0" No_argument "j"
733# endif 733# endif
734# if ENABLE_FEATURE_TAR_LZMA 734# if ENABLE_FEATURE_TAR_LZMA
735 { "lzma", 0, NULL, 'a' }, 735 "lzma\0" No_argument "a"
736# endif 736# endif
737# if ENABLE_FEATURE_TAR_FROM 737# if ENABLE_FEATURE_TAR_FROM
738 { "files-from", 1, NULL, 'T' }, 738 "files-from\0" Required_argument "T"
739 { "exclude-from", 1, NULL, 'X' }, 739 "exclude-from\0" Required_argument "X"
740# endif 740# endif
741# if ENABLE_FEATURE_TAR_GZIP 741# if ENABLE_FEATURE_TAR_GZIP
742 { "gzip", 0, NULL, 'z' }, 742 "gzip\0" No_argument "z"
743# endif 743# endif
744# if ENABLE_FEATURE_TAR_COMPRESS 744# if ENABLE_FEATURE_TAR_COMPRESS
745 { "compress", 0, NULL, 'Z' }, 745 "compress\0" No_argument "Z"
746# endif 746# endif
747 { "no-same-owner", 0, NULL, 0xfd }, 747 "no-same-owner\0" No_argument "\xfd"
748 { "no-same-permissions",0, NULL, 0xfe }, 748 "no-same-permissions\0" No_argument "\xfe"
749 /* --exclude takes next bit position in option mask, */ 749 /* --exclude takes next bit position in option mask, */
750 /* therefore we have to either put it _after_ --no-same-perm */ 750 /* therefore we have to either put it _after_ --no-same-perm */
751 /* or add OPT[BIT]_EXCLUDE before OPT[BIT]_NOPRESERVE_OWN */ 751 /* or add OPT[BIT]_EXCLUDE before OPT[BIT]_NOPRESERVE_OWN */
752# if ENABLE_FEATURE_TAR_FROM 752# if ENABLE_FEATURE_TAR_FROM
753 { "exclude", 1, NULL, 0xff }, 753 "exclude\0" Required_argument "\xff"
754# endif 754# endif
755 { 0, 0, 0, 0 } 755 "\0";
756};
757#endif 756#endif
758 757
759int tar_main(int argc, char **argv); 758int tar_main(int argc, char **argv);
@@ -787,7 +786,7 @@ int tar_main(int argc, char **argv)
787 USE_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive 786 USE_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
788 SKIP_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive 787 SKIP_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
789#if ENABLE_FEATURE_TAR_LONG_OPTIONS 788#if ENABLE_FEATURE_TAR_LONG_OPTIONS
790 applet_long_options = tar_long_options; 789 applet_long_options = tar_longopts;
791#endif 790#endif
792 opt = getopt32(argc, argv, 791 opt = getopt32(argc, argv,
793 "txC:f:Opvk" 792 "txC:f:Opvk"