diff options
author | Myles Watson <mylesgw@gmail.com> | 2009-05-08 19:39:15 +0000 |
---|---|---|
committer | Myles Watson <mylesgw@gmail.com> | 2009-05-08 19:39:15 +0000 |
commit | 475aeda9d6d62d0249276bff657adc67d206ff31 (patch) | |
tree | 6b3d9371ce61197417ed308faca8cc36691ac58e /util/cbfstool/add.c | |
parent | 83b8f0c48550bb1b2cb1a6610b1f0010bf8533a4 (diff) | |
download | coreboot-475aeda9d6d62d0249276bff657adc67d206ff31.tar.xz |
Add -Werror to help us keep the code clean.
Change sizes from unsigned int to int.
Clean up some usage and parameter checking.
Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4262 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/add.c')
-rw-r--r-- | util/cbfstool/add.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/util/cbfstool/add.c b/util/cbfstool/add.c index aadb68d841..83f8d29462 100644 --- a/util/cbfstool/add.c +++ b/util/cbfstool/add.c @@ -205,25 +205,25 @@ static int add_blob(struct rom *rom, const char *filename, void add_usage(void) { - printf("add [FILE] [NAME] [TYPE]\tAdd a component\n"); + printf("add FILE NAME TYPE\tAdd a component\n"); } void add_stage_usage(void) { - printf("add-stage [FILE] [NAME] [OPTIONS]\tAdd a stage to the ROM\n"); + printf("add-stage FILE NAME [OPTIONS]\tAdd a stage to the ROM\n"); } void add_payload_usage(void) { printf - ("add-payload [FILE] [NAME] [OPTIONS]\tAdd a payload to the ROM\n"); + ("add-payload FILE NAME [OPTIONS]\tAdd a payload to the ROM\n"); } int add_handler(struct rom *rom, int argc, char **argv) { unsigned int type = CBFS_COMPONENT_NULL; - if (argc < 2) { + if (argc != 3) { add_usage(); return -1; } @@ -235,15 +235,13 @@ int add_handler(struct rom *rom, int argc, char **argv) /* There are two ways to specify the type - a string or a number */ - if (argc == 3) { - if (isdigit(*(argv[2]))) - type = strtoul(argv[2], 0, 0); + if (isdigit(*(argv[2]))) + type = strtoul(argv[2], 0, 0); + else { + ERROR("String types (%s) aren't implemented yet.\n", argv[2]); + return -1; } - if (type == CBFS_COMPONENT_NULL) - WARN("No file type was given for %s - using default\n", - argv[0]); - return add_blob(rom, argv[0], argv[1], type); } |