call getopt_reset only once
instead of calling getopt_reset in each command, call it only once before calling the command. Signed-off-by: Sascha Hauer <sha@pengutronix.de>
This commit is contained in:
parent
87e01f28cc
commit
63e01b4969
|
@ -8,8 +8,6 @@ static int do_clko (cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
{
|
||||
int opt, div = 0, src = -2, ret;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "d:s:")) > 0) {
|
||||
switch(opt) {
|
||||
case 'd':
|
||||
|
|
|
@ -45,8 +45,6 @@ static int do_bmp(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
int offscreen = 0;
|
||||
void *adr, *buf;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "f:x:y:o")) > 0) {
|
||||
switch(opt) {
|
||||
case 'f':
|
||||
|
|
|
@ -377,8 +377,6 @@ static int do_bootm (cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
memset(&data, 0, sizeof(struct image_data));
|
||||
data.verify = 1;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
/* Collect options from registered handlers */
|
||||
strcpy(options, "nh");
|
||||
list_for_each_entry(handler, &handler_list, list) {
|
||||
|
|
|
@ -38,8 +38,6 @@ static int do_crc (cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
char *buf;
|
||||
int fd, opt, err = 0, filegiven = 0, verify = 0, now;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "f:v:")) > 0) {
|
||||
switch(opt) {
|
||||
case 'f':
|
||||
|
|
|
@ -105,7 +105,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
char *productname = CONFIG_BOARDINFO;
|
||||
u16 idVendor = 0, idProduct = 0;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "m:p:V:P:")) > 0) {
|
||||
switch(opt) {
|
||||
|
|
|
@ -699,8 +699,6 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
char *output_file = NULL;
|
||||
struct console_device *cdev = NULL;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while ((opt = getopt(argc, argv, "f:b:o:c")) > 0) {
|
||||
switch (opt) {
|
||||
case 'f':
|
||||
|
|
|
@ -118,8 +118,6 @@ static int do_ls (cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
ulong flags = LS_COLUMN;
|
||||
struct string_list sl;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "RCl")) > 0) {
|
||||
switch(opt) {
|
||||
case 'R':
|
||||
|
|
|
@ -138,8 +138,6 @@ static int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
|
|||
{
|
||||
int opt;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, optstr)) > 0) {
|
||||
switch(opt) {
|
||||
case 'b':
|
||||
|
|
|
@ -30,8 +30,6 @@ static int do_mkdir (cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
{
|
||||
int opt, parent = 0, ret;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "p")) > 0) {
|
||||
switch(opt) {
|
||||
case 'p':
|
||||
|
|
|
@ -271,8 +271,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
struct nand_bb *bb;
|
||||
int command = 0, badblock = 0;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "adb:")) > 0) {
|
||||
if (command) {
|
||||
printf("only one command may be given\n");
|
||||
|
|
|
@ -37,8 +37,6 @@ static int do_timeout(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
|||
int flags = 0, opt, countdown;
|
||||
uint64_t start, second;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
while((opt = getopt(argc, argv, "t:crsa")) > 0) {
|
||||
switch(opt) {
|
||||
case 'r':
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <init.h>
|
||||
#include <complete.h>
|
||||
#include <linux/utsrelease.h>
|
||||
#include <getopt.h>
|
||||
|
||||
const char version_string[] =
|
||||
"U-Boot " UTS_RELEASE " (" __DATE__ " - " __TIME__ ")";
|
||||
|
@ -96,6 +97,8 @@ int execute_command(int argc, char **argv)
|
|||
cmd_tbl_t *cmdtp;
|
||||
int ret;
|
||||
|
||||
getopt_reset();
|
||||
|
||||
/* Look up command in command table */
|
||||
if ((cmdtp = find_cmd(argv[0]))) {
|
||||
/* found - check max args */
|
||||
|
|
Loading…
Reference in New Issue