+#define CTX_TEST (1 << 0)
+#define CTX_EXTRACT (1 << 1)
+#define TAR_OPT_BASEDIR (1 << 2)
+#define TAR_OPT_TARNAME (1 << 3)
+#define TAR_OPT_2STDOUT (1 << 4)
+#define TAR_OPT_P (1 << 5)
+#define TAR_OPT_VERBOSE (1 << 6)
+#define TAR_OPT_KEEP_OLD (1 << 7)
+
+#ifdef CONFIG_FEATURE_TAR_CREATE
+# define CTX_CREATE (1 << 8)
+# define TAR_OPT_STR_CREATE "c"
+# define TAR_OPT_FLAG_CREATE 1
+#else
+//# define CTX_CREATE 0
+# define TAR_OPT_STR_CREATE ""
+# define TAR_OPT_FLAG_CREATE 0
+#endif
+
+#ifdef CONFIG_FEATURE_TAR_BZIP2
+# define TAR_OPT_BZIP2 (1 << (8 + TAR_OPT_FLAG_CREATE))
+# define TAR_OPT_STR_BZIP2 "j"
+# define TAR_OPT_FLAG_BZIP2 1
+#else
+# define TAR_OPT_STR_BZIP2 ""
+# define TAR_OPT_FLAG_BZIP2 0
+#endif
+
+#ifdef CONFIG_FEATURE_TAR_FROM
+# define TAR_OPT_FROM_FILE (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2))
+# define TAR_OPT_EXCLUDE_FROM (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + 1))
+# define TAR_OPT_STR_FROM "T:X:"
+# define TAR_OPT_FLAG_FROM 2
+#else
+# define TAR_OPT_STR_FROM ""
+# define TAR_OPT_FLAG_FROM 0
+#endif
+
+#ifdef CONFIG_FEATURE_TAR_GZIP
+# define TAR_OPT_GZIP (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM))
+# define TAR_OPT_STR_GZIP "z"
+# define TAR_OPT_FLAG_GZIP 1
+#else
+# define TAR_OPT_STR_GZIP ""
+# define TAR_OPT_FLAG_GZIP 0
+#endif
+
+#ifdef CONFIG_FEATURE_TAR_COMPRESS
+# define TAR_OPT_UNCOMPRESS (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM + TAR_OPT_FLAG_GZIP))
+# define TAR_OPT_STR_COMPRESS "Z"
+#else
+# define TAR_OPT_STR_COMPRESS ""
+#endif
+
+static const char tar_options[]="txC:f:Opvk" \
+ TAR_OPT_STR_CREATE \
+ TAR_OPT_STR_BZIP2 \
+ TAR_OPT_STR_FROM \
+ TAR_OPT_STR_GZIP \
+ TAR_OPT_STR_COMPRESS;
+
+#ifdef CONFIG_FEATURE_TAR_LONG_OPTIONS
+static const struct option tar_long_options[] = {
+ { "list", 0, NULL, 't' },
+ { "extract", 0, NULL, 'x' },
+ { "directory", 1, NULL, 'C' },
+ { "file", 1, NULL, 'f' },
+ { "to-stdout", 0, NULL, 'O' },
+ { "same-permissions", 0, NULL, 'p' },
+ { "verbose", 0, NULL, 'v' },
+ { "keep-old", 0, NULL, 'k' },
+# ifdef CONFIG_FEATURE_TAR_CREATE
+ { "create", 0, NULL, 'c' },
+# endif
+# ifdef CONFIG_FEATURE_TAR_BZIP2
+ { "bzip2", 0, NULL, 'j' },
+# endif
+# ifdef CONFIG_FEATURE_TAR_FROM
+ { "from-file", 1, NULL, 'T' },
+ { "exclude-from", 1, NULL, 'X' },
+# endif
+# ifdef CONFIG_FEATURE_TAR_GZIP
+ { "gzip", 0, NULL, 'z' },
+# endif
+# ifdef CONFIG_FEATURE_TAR_COMPRESS
+ { "compress", 0, NULL, 'Z' },
+# endif
+ { 0, 0, 0, 0 }
+};
+#endif