ash: builtin: Mark more regular built-ins
[oweals/busybox.git] / mailutils / reformime.c
index aa5e3b1c0f59621a3879db4a96ecb5faa0c8c3d4..321729e0a352a840a32c848eda79f0ec736529a8 100644 (file)
@@ -1,12 +1,26 @@
 /* vi: set sw=4 ts=4: */
 /*
- * makemime: create MIME-encoded message
  * reformime: parse MIME-encoded message
  *
  * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
+//config:config REFORMIME
+//config:      bool "reformime (7.5 kb)"
+//config:      default y
+//config:      help
+//config:      Parse MIME-formatted messages.
+//config:
+//config:config FEATURE_REFORMIME_COMPAT
+//config:      bool "Accept and ignore options other than -x and -X"
+//config:      default y
+//config:      depends on REFORMIME
+//config:      help
+//config:      Accept (for compatibility only) and ignore options
+//config:      other than -x and -X.
+
+//applet:IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP))
 
 //kbuild:lib-$(CONFIG_REFORMIME) += reformime.o mail.o
 
@@ -135,7 +149,6 @@ static int parse(const char *boundary, char **argv)
                        if (strcasecmp(type + 10, "mixed") != 0)
                                bb_error_msg_and_die("no support of content type '%s'", type);
                        parse(xfind_token(tokens, "boundary"), argv);
-
                } else {
                        /* No, process one non-multipart section */
                        char *end;
@@ -234,7 +247,6 @@ static int parse(const char *boundary, char **argv)
 //usage:       "[OPTIONS]"
 //usage:#define reformime_full_usage "\n\n"
 //usage:       "Parse MIME-encoded message on stdin\n"
-//usage:     "\nOptions:"
 //usage:     "\n       -x PREFIX       Extract content of MIME sections to files"
 //usage:     "\n       -X PROG ARGS    Filter content of MIME sections through PROG"
 //usage:     "\n                       Must be the last option"
@@ -268,9 +280,9 @@ int reformime_main(int argc UNUSED_PARAM, char **argv)
 
        // parse options
        // N.B. only -x and -X are supported so far
-       opt_complementary = "x--X:X--x" IF_FEATURE_REFORMIME_COMPAT(":m::");
-       opts = getopt32(argv,
-               "x:X" IF_FEATURE_REFORMIME_COMPAT("deis:r:c:m:h:o:O:"),
+       opts = getopt32(argv, "^"
+               "x:X" IF_FEATURE_REFORMIME_COMPAT("deis:r:c:m:*h:o:O:")
+               "\0" "x--X:X--x",
                &opt_prefix
                IF_FEATURE_REFORMIME_COMPAT(, NULL, NULL, &G.opt_charset, NULL, NULL, NULL, NULL)
        );