]> www.infradead.org Git - mtd-utils.git/commitdiff
[PATCH] Minor ubi utils cleanups
authorJosh Boyer <jwboyer@linux.ibm.com>
Tue, 12 Dec 2006 08:22:48 +0000 (09:22 +0100)
committerFrank Haverkamp <haver@vnet.ibm.com>
Tue, 12 Dec 2006 08:22:48 +0000 (09:22 +0100)
Remove getopt extern declarations

Minor whitespace cleanups

Remove incorrect program names that snuck in during getopt rewrite

Change comments to match reality

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: Frank Haverkamp <haver@vnet.ibm.com>
12 files changed:
ubi-utils/src/bin2nand.c
ubi-utils/src/mkbootenv.c
ubi-utils/src/nand2bin.c
ubi-utils/src/pddcustomize.c
ubi-utils/src/pfi2bin.c
ubi-utils/src/pfiflash.c
ubi-utils/src/ubigen.c
ubi-utils/src/ubimirror.c
ubi-utils/src/ubimkvol.c
ubi-utils/src/ubirmvol.c
ubi-utils/src/ubiupdatevol.c
ubi-utils/src/unubi.c

index 4bab1adea2d360a29ab8280129cab8d5a88cf926..20fc90af2ce368d3f72cdd49dd42cf3cc0a9591a 100644 (file)
@@ -27,6 +27,7 @@
  * 1.2 Generates separated OOB data, if needed. (oloh)
  * 1.3 Padds data/oob to a given size. (oloh)
  * 1.4 Removed argp because we want to use uClibc.
+ * 1.5 Minor cleanup
  */
 
 #include <unistd.h>
@@ -45,7 +46,7 @@
 #include "config.h"
 #include "nandecc.h"
 
-#define PROGRAM_VERSION "1.4"
+#define PROGRAM_VERSION "1.5"
 
 #define CHECK_ENDP(option, endp) do {                  \
        if (*endp) {                                    \
@@ -65,9 +66,6 @@ typedef enum action_t {
 #define PADDING                   0 /* 0 means, do not adjust anything */
 #define BUFSIZE                4096
 
-extern char *optarg;
-extern int optind;
-
 static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
        BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
        "\n"
index c05f4e2d5c16406036b2c365316ef7c531cf35af..4a8cc6a97b2a9462078b52593fd50b090979afe3 100644 (file)
@@ -20,6 +20,7 @@
  * Create boot-parameter/pdd data from an ASCII-text input file.
  *
  * 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanup
  */
 
 #include <stdio.h>
 #include "bootenv.h"
 #include "error.h"
 
-#define PROGRAM_VERSION "1.2"
-
-extern char *optarg;
-extern int optind;
+#define PROGRAM_VERSION "1.3"
 
 static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
        BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
index 34cce40a5f2ec7894d2b87e48a59ef5946017b64..636ee6f6f9dcff62da2de40dfc2b380bd016ff1a 100644 (file)
@@ -20,6 +20,7 @@
  * An utility to decompose NAND images and strip OOB off. Not yet finished ...
  *
  * 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanup
  */
 
 #include <config.h>
 #include "config.h"
 #include "nandecc.h"
 
-#define PROGRAM_VERSION "1.2"
+#define PROGRAM_VERSION "1.3"
 
 #define MAXPATH                1024
 #define MIN(x,y)       ((x)<(y)?(x):(y))
 
-extern char *optarg;
-extern int optind;
-
 struct args {
        const char *oob_file;
        const char *output_file;
@@ -116,14 +114,12 @@ uint32_t str_to_num(char *str)
 /*
  * @brief Parse the arguments passed into the test case.
  *
- * @param key            The parameter.
- * @param arg            Argument passed to parameter.
- * @param state          Location to put information on parameters.
+ * @param argc           The number of arguments
+ * @param argv           The argument list
+ * @param args           Pointer to program args structure
  *
  * @return error
  *
- * Get the `input' argument from `argp_parse', which we know is a
- * pointer to our arguments structure.
  */
 static int
 parse_opt(int argc, char **argv, struct args *args)
index 5c2a5f0dcf865a21a1c1c662ff34edea9c787032..764f2e76073375924e55d5beec7d3b752ae231a9 100644 (file)
@@ -25,6 +25,7 @@
  * PDD modification.
  *
  * 1.3 Removed argp because we want to use uClibc.
+ * 1.4 Minor cleanups
  */
 
 #include <stdio.h>
@@ -43,7 +44,7 @@
 #include "libubi.h"
 #include "ubimirror.h"
 
-#define PROGRAM_VERSION "1.3"
+#define PROGRAM_VERSION "1.4"
 
 typedef enum action_t {
        ACT_NORMAL   = 0,
@@ -60,9 +61,6 @@ typedef enum action_t {
        args->action = ACT_ARGP_ERR;    \
 } while (0)
 
-extern char *optarg;
-extern int optind;
-
 static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
        BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
        "\n"
@@ -81,7 +79,7 @@ static const char *optionsstr =
 "  -V, --version              Print program version\n";
 
 static const char *usage =
-"Usage: pddcustomize.orig [-bclx?V] [-i <input>] [-o <output>] [-s <seqnum>]\n"
+"Usage: pddcustomize [-bclx?V] [-i <input>] [-o <output>] [-s <seqnum>]\n"
 "           [--both] [--copyright] [--input=<input>] [--list]\n"
 "           [--output=<output>] [--side=<seqnum>] [--host] [--help] [--usage]\n"
 "           [--version] [key=value] [...]\n";
@@ -200,7 +198,7 @@ parse_opt(int argc, char **argv, myargs *args)
                                args->file_out = optarg;
                                break;
                        case '?': /* help */
-                               err_msg("Usage: pddcustomize.orig [OPTION...] "
+                               err_msg("Usage: pddcustomize [OPTION...] "
                                        "[key=value] [...]");
                                err_msg("%s", doc);
                                err_msg("%s", optionsstr);
index 9265fd5f95f21f7846fbb422eb008f1c2e8e1068..57c4ea5c5d11b411c33c8c4114d6f3e8d9e48d93 100644 (file)
@@ -24,6 +24,7 @@
  * required to add the right OOB data to the binary image.
  *
  * 1.3 Removed argp because we want to use uClibc.
+ * 1.4 Minor cleanups
  */
 
 #include <stdlib.h>
@@ -44,7 +45,7 @@
 #include "peb.h"
 #include "crc32.h"
 
-#define PROGRAM_VERSION "1.3"
+#define PROGRAM_VERSION "1.4"
 
 #define MAX_FNAME 255
 #define DEFAULT_ERASE_COUNT  0 /* Hmmm.... Perhaps */
@@ -52,9 +53,6 @@
 
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 
-extern char *optarg;
-extern int optind;
-
 static uint32_t crc32_table[256];
 static char err_buf[ERR_BUF_SIZE];
 
@@ -92,7 +90,7 @@ static const char *optionsstr =
 "  -V, --version              Print program version\n";
 
 static const char *usage =
-"Usage: pfi2bin.orig [-cv?V] [-j pdd-file] [-o filename] [--copyright]\n"
+"Usage: pfi2bin [-cv?V] [-j pdd-file] [-o filename] [--copyright]\n"
 "            [--verbose] [--platform=pdd-file] [--output=filename] [--help]\n"
 "            [--usage] [--version] pfifile\n";
 
index 63487b9704e13b89ac7129e959173a99297af398..0b0da560f050f1ad56b87ed32e4190fa79d92a2b 100644 (file)
@@ -25,6 +25,7 @@
  * 1.1 fixed output to stderr and stdout in logfile mode.
  * 1.2 updated.
  * 1.3 removed argp parsing to be able to use uClib.
+ * 1.4 Minor cleanups
  */
 
 #include <unistd.h>
 #include "error.h"
 #include "config.h"
 
-#define PROGRAM_VERSION  "1.3"
-
-extern char *optarg;
-extern int optind;
+#define PROGRAM_VERSION  "1.4"
 
 static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
        BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
@@ -70,7 +68,7 @@ static const char *optionsstr =
 "  -V, --version              Print program version\n";
 
 static const char *usage =
-"Usage: pfiflash.orig [-cvC?V] [-l <file>] [-p <type>] [-r <dev>] [-s <seqnum>]\n"
+"Usage: pfiflash [-cvC?V] [-l <file>] [-p <type>] [-r <dev>] [-s <seqnum>]\n"
 "            [--copyright] [--logfile=<file>] [--verbose] [--complete]\n"
 "            [--pdd-update=<type>] [--raw-flash=<dev>] [--side=<seqnum>]\n"
 "            [--help] [--usage] [--version] [pfifile]\n";
index 877f46967a33f4781a279ec2b34d8ffc287ef709..d99ba2d59909786d18c56bb4f7c4a2e1abca61a8 100644 (file)
@@ -22,6 +22,7 @@
  * 1.0 Initial version
  * 1.1 Different CRC32 start value
  * 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanups
  */
 
 #include <stdlib.h>
 #include "ubigen.h"
 #include "config.h"
 
-#define PROGRAM_VERSION "1.2"
+#define PROGRAM_VERSION "1.3"
 
 typedef enum action_t {
        ACT_NORMAL           = 0x00000001,
        ACT_BROKEN_UPDATE    = 0x00000002,
 } action_t;
 
-extern char *optarg;
-extern int optind;
-
 static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
        BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
        "\n"
@@ -85,7 +83,7 @@ static const char *optionsstr =
 "  -V, --version              Print program version\n";
 
 static const char *usage =
-"Usage: ubigen.orig [-cdv?V] [-A <num>] [-B <num>] [-E <num>] [-I <num>]\n"
+"Usage: ubigen [-cdv?V] [-A <num>] [-B <num>] [-E <num>] [-I <num>]\n"
 "          [-O <num>] [-T <num>] [-X <num>] [-i <filename>] [-o <filename>]\n"
 "          [-U <leb>] [--copyright] [--debug] [--verbose] [--alignment=<num>]\n"
 "          [--blocksize=<num>] [--erasecount=<num>] [--id=<num>]\n"
index 533a0eef9c677ccdfe43b1f1ff9dae319783b6f8..eeedb3a20a8c08d3e89d5c385fd157baaf8319da 100644 (file)
@@ -18,6 +18,7 @@
  * Author: Oliver Lohmann
  *
  * 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanups
  */
 
 #include <stdio.h>
@@ -34,7 +35,7 @@
 #include "example_ubi.h"
 #include "ubimirror.h"
 
-#define PROGRAM_VERSION "1.2"
+#define PROGRAM_VERSION "1.3"
 
 typedef enum action_t {
        ACT_NORMAL = 0,
@@ -52,9 +53,6 @@ typedef enum action_t {
 
 #define VOL_ARGS_MAX 2
 
-extern char *optarg;
-extern int optind;
-
 static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
        BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
        "\n"
index e878d70c4c5025820eb836893d45639a74268e19..879dcb60f87e21c5a1a96b227a4c5945e05f0fef 100644 (file)
@@ -27,6 +27,7 @@
  *     the number of bytes.
  * 1.2 Reworked the user-interface to use argp.
  * 1.3 Removed argp because we want to use uClibc.
+ * 1.4 Minor cleanups
  */
 
 #include <stdio.h>
 #include <config.h>
 #include <libubi.h>
 
-#define PROGRAM_VERSION "1.3"
-
-extern char *optarg;
-extern int optind;
+#define PROGRAM_VERSION "1.4"
 
 /*
  * The variables below are set by command line arguments.
@@ -114,14 +112,12 @@ struct option long_options[] = {
 /*
  * @brief Parse the arguments passed into the test case.
  *
- * @param key           The parameter.
- * @param arg           Argument passed to parameter.
- * @param state                 Location to put information on parameters.
+ * @param argc          The number of arguments
+ * @param argv          The list of arguments
+ * @param args          Pointer to argument structure
  *
  * @return error
  *
- * Get the `input' argument from `argp_parse', which we know is a
- * pointer to our arguments structure.
  */
 static int
 parse_opt(int argc, char **argv, struct args *args)
@@ -142,16 +138,18 @@ parse_opt(int argc, char **argv, struct args *args)
                                else if (!strcmp(optarg, "static"))
                                        args->vol_type = UBI_STATIC_VOLUME;
                                else {
-                                       fprintf(stderr, "Bad volume type: \"%s\"\n",
-                                                       optarg);
+                                       fprintf(stderr,
+                                               "Bad volume type: \"%s\"\n",
+                                               optarg);
                                        goto out;
                                }
                                break;
                        case 's':
                                args->bytes = strtoull(optarg, &endp, 0);
                                if (endp == optarg || args->bytes < 0) {
-                                       fprintf(stderr, "Bad volume size: \"%s\"\n",
-                                                       optarg);
+                                       fprintf(stderr,
+                                               "Bad volume size: \"%s\"\n",
+                                               optarg);
                                        goto out;
                                }
                                if (endp != '\0') {
@@ -172,9 +170,11 @@ parse_opt(int argc, char **argv, struct args *args)
                                break;
                        case 'd': /* --devn=<device number> */
                                args->devn = strtoul(optarg, &endp, 0);
-                               if (*endp != '\0' || endp == optarg || args->devn < 0) {
-                                       fprintf(stderr, "Bad UBI device number: "
-                                                       "\"%s\"\n", optarg);
+                               if (*endp != '\0' || endp == optarg ||
+                                       args->devn < 0) {
+                                       fprintf(stderr,
+                                               "Bad UBI device number: "
+                                               "\"%s\"\n", optarg);
                                        goto out;
                                }
                                break;
@@ -199,7 +199,8 @@ parse_opt(int argc, char **argv, struct args *args)
                                goto out;
 
                        case '?': /* help */
-                               fprintf(stderr, "Usage: ubimkvol [OPTION...]\n");
+                               fprintf(stderr,
+                                       "Usage: ubimkvol [OPTION...]\n");
                                fprintf(stderr, "%s", doc);
                                fprintf(stderr, "%s", optionsstr);
                                fprintf(stderr, "\nReport bugs to %s\n",
index 04ec08540d1f641e434890e3602cb188ee8ccd51..f458e8a64653b849cf10d0f9a416dcfb1e7805c7 100644 (file)
@@ -24,6 +24,7 @@
  *
  * 1.1 Reworked the userinterface to use argp.
  * 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanups
  */
 
 #include <stdio.h>
 #include <config.h>
 #include <libubi.h>
 
-#define PROGRAM_VERSION "1.2"
-
-extern char *optarg;
-extern int optind;
+#define PROGRAM_VERSION "1.3"
 
 /*
  * The below variables are set by command line options.
@@ -91,14 +89,12 @@ struct option long_options[] = {
 /*
  * @brief Parse the arguments passed into the test case.
  *
- * @param key           The parameter.
- * @param arg           Argument passed to parameter.
- * @param state                 Location to put information on parameters.
+ * @param argc          The number of arguments
+ * @param argv          The list of arguments
+ * @param args          Pointer to argument structure
  *
  * @return error
  *
- * Get the `input' argument from `argp_parse', which we know is a
- * pointer to our arguments structure.
  */
 static int
 parse_opt(int argc, char **argv, struct args *args)
@@ -115,9 +111,11 @@ parse_opt(int argc, char **argv, struct args *args)
                switch (key) {
                        case 'd': /* --devn=<device number> */
                                args->devn = strtoul(optarg, &endp, 0);
-                               if (*endp != '\0' || endp == optarg || args->devn < 0) {
-                                       fprintf(stderr, "Bad UBI device number: "
-                                                       "\"%s\"\n", optarg);
+                               if (*endp != '\0' || endp == optarg ||
+                                       args->devn < 0) {
+                                       fprintf(stderr,
+                                               "Bad UBI device number: "
+                                               "\"%s\"\n", optarg);
                                        goto out;
                                }
                                break;
@@ -135,7 +133,8 @@ parse_opt(int argc, char **argv, struct args *args)
                                fprintf(stderr, "Parameter is missing\n");
                                goto out;
                        case '?': /* help */
-                               fprintf(stderr, "Usage: ubirmvol [OPTION...]\n");
+                               fprintf(stderr,
+                                       "Usage: ubirmvol [OPTION...]\n");
                                fprintf(stderr, "%s", doc);
                                fprintf(stderr, "%s", optionsstr);
                                fprintf(stderr, "\nReport bugs to %s\n",
index 011d5327ad24ab220b5fa85e938f01d9516ee957..b3c4bf1136304e03beb94dcf92e7f5ef34707109 100644 (file)
@@ -24,6 +24,7 @@
  *
  * 1.0 Reworked the userinterface to use argp.
  * 1.1 Removed argp parsing because we want to use uClib.
+ * 1.2 Minor cleanups
  */
 
 #include <errno.h>
 #include <config.h>
 #include <libubi.h>
 
-#define PROGRAM_VERSION "1.1"
+#define PROGRAM_VERSION "1.2"
 
 #define MAXPATH                1024
 #define BUFSIZE                128 * 1024
 #define MIN(x,y)       ((x)<(y)?(x):(y))
 
-/* FIXME is this not covered by including getopt.h? */
-extern char *optarg;
-extern int optind;
-
 struct args {
        int devn;
        int vol_id;
index 0f8945f952a82aa1b0317babe585848f4e4e4c03..cade1e109fbe9b09cc072339bd6c3051a6f48935 100644 (file)
@@ -21,6 +21,7 @@
  *         Drake Dowsett, dowsett@de.ibm.com
  *
  * 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanups
  */
 
 /*
 
 #define EXEC           "unubi"
 #define CONTACT                "haver@vnet.ibm.com"
-#define VERSION                "1.0"
-
-extern char *optarg;
-extern int optind;
+#define VERSION                "1.3"
 
 static char doc[] = "\nVersion: " VERSION "\n\t"
        BUILD_OS" "BUILD_CPU" at "__DATE__" "__TIME__"\n"
@@ -177,12 +175,6 @@ str_to_num(char *str)
        return num;
 }
 
-
-/**
- * parses the arguments passed into the program
- * get the input argument from argp_parse, which we know is a
- * pointer to our arguments structure;
- **/
 static int
 parse_opt(int argc, char **argv, struct args *args)
 {
@@ -225,10 +217,13 @@ parse_opt(int argc, char **argv, struct args *args)
                                args->vol_split = SPLIT_RAW;
                                break;
                        case '?': /* help */
-                               fprintf(stderr, "Usage: unubi [OPTION...] image-file\n");
+                               fprintf(stderr,
+                                       "Usage: unubi [OPTION...] "
+                                       "image-file\n");
                                fprintf(stderr, "%s", doc);
                                fprintf(stderr, "%s", optionsstr);
-                               fprintf(stderr, "\nReport bugs to %s\n", CONTACT);
+                               fprintf(stderr,
+                                       "\nReport bugs to %s\n", CONTACT);
                                exit(0);
                                break;
                        case 'J':