aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ubi-utils/src/bin2nand.c6
-rw-r--r--ubi-utils/src/mkbootenv.c6
-rw-r--r--ubi-utils/src/nand2bin.c14
-rw-r--r--ubi-utils/src/pddcustomize.c10
-rw-r--r--ubi-utils/src/pfi2bin.c8
-rw-r--r--ubi-utils/src/pfiflash.c8
-rw-r--r--ubi-utils/src/ubigen.c8
-rw-r--r--ubi-utils/src/ubimirror.c6
-rw-r--r--ubi-utils/src/ubimkvol.c35
-rw-r--r--ubi-utils/src/ubirmvol.c25
-rw-r--r--ubi-utils/src/ubiupdatevol.c7
-rw-r--r--ubi-utils/src/unubi.c19
12 files changed, 63 insertions, 89 deletions
diff --git a/ubi-utils/src/bin2nand.c b/ubi-utils/src/bin2nand.c
index 4bab1ad..20fc90a 100644
--- a/ubi-utils/src/bin2nand.c
+++ b/ubi-utils/src/bin2nand.c
@@ -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"
diff --git a/ubi-utils/src/mkbootenv.c b/ubi-utils/src/mkbootenv.c
index c05f4e2..4a8cc6a 100644
--- a/ubi-utils/src/mkbootenv.c
+++ b/ubi-utils/src/mkbootenv.c
@@ -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>
@@ -34,10 +35,7 @@
#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"
diff --git a/ubi-utils/src/nand2bin.c b/ubi-utils/src/nand2bin.c
index 34cce40..636ee6f 100644
--- a/ubi-utils/src/nand2bin.c
+++ b/ubi-utils/src/nand2bin.c
@@ -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>
@@ -39,14 +40,11 @@
#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)
diff --git a/ubi-utils/src/pddcustomize.c b/ubi-utils/src/pddcustomize.c
index 5c2a5f0..764f2e7 100644
--- a/ubi-utils/src/pddcustomize.c
+++ b/ubi-utils/src/pddcustomize.c
@@ -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);
diff --git a/ubi-utils/src/pfi2bin.c b/ubi-utils/src/pfi2bin.c
index 9265fd5..57c4ea5 100644
--- a/ubi-utils/src/pfi2bin.c
+++ b/ubi-utils/src/pfi2bin.c
@@ -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";
diff --git a/ubi-utils/src/pfiflash.c b/ubi-utils/src/pfiflash.c
index 63487b9..0b0da56 100644
--- a/ubi-utils/src/pfiflash.c
+++ b/ubi-utils/src/pfiflash.c
@@ -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>
@@ -41,10 +42,7 @@
#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";
diff --git a/ubi-utils/src/ubigen.c b/ubi-utils/src/ubigen.c
index 877f469..d99ba2d 100644
--- a/ubi-utils/src/ubigen.c
+++ b/ubi-utils/src/ubigen.c
@@ -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>
@@ -35,16 +36,13 @@
#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"
diff --git a/ubi-utils/src/ubimirror.c b/ubi-utils/src/ubimirror.c
index 533a0ee..eeedb3a 100644
--- a/ubi-utils/src/ubimirror.c
+++ b/ubi-utils/src/ubimirror.c
@@ -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"
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index e878d70..879dcb6 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -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>
@@ -39,10 +40,7 @@
#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",
diff --git a/ubi-utils/src/ubirmvol.c b/ubi-utils/src/ubirmvol.c
index 04ec085..f458e8a 100644
--- a/ubi-utils/src/ubirmvol.c
+++ b/ubi-utils/src/ubirmvol.c
@@ -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>
@@ -36,10 +37,7 @@
#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",
diff --git a/ubi-utils/src/ubiupdatevol.c b/ubi-utils/src/ubiupdatevol.c
index 011d532..b3c4bf1 100644
--- a/ubi-utils/src/ubiupdatevol.c
+++ b/ubi-utils/src/ubiupdatevol.c
@@ -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>
@@ -42,16 +43,12 @@
#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;
diff --git a/ubi-utils/src/unubi.c b/ubi-utils/src/unubi.c
index 0f8945f..cade1e1 100644
--- a/ubi-utils/src/unubi.c
+++ b/ubi-utils/src/unubi.c
@@ -21,6 +21,7 @@
* Drake Dowsett, dowsett@de.ibm.com
*
* 1.2 Removed argp because we want to use uClibc.
+ * 1.3 Minor cleanups
*/
/*
@@ -53,10 +54,7 @@
#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':