Changeset 1484


Ignore:
Timestamp:
01/11/12 03:10:11 (4 months ago)
Author:
hailfinger
Message:

Postpone layout file reading

Layout file reading should happen after option parsing like all other
file accesses.
Guard against multiple --layout parameters.

Followup fix for r1483: Remove -m short option from getopt.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Stefan Tauner <stefan.tauner@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli_classic.c

    r1483 r1484  
    178178        int ret = 0; 
    179179 
    180         static const char optstring[] = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; 
     180        static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzh"; 
    181181        static const struct option long_options[] = { 
    182182                {"read",                1, NULL, 'r'}, 
     
    199199 
    200200        char *filename = NULL; 
     201        char *layoutfile = NULL; 
    201202        char *tempstr = NULL; 
    202203        char *pparam = NULL; 
     
    274275                        break; 
    275276                case 'l': 
    276                         tempstr = strdup(optarg); 
    277                         if (read_romlayout(tempstr)) 
    278                                 cli_classic_abort_usage(); 
     277                        if (layoutfile) { 
     278                                fprintf(stderr, "Error: --layout specified " 
     279                                        "more than once. Aborting.\n"); 
     280                                cli_classic_abort_usage(); 
     281                        } 
     282                        layoutfile = strdup(optarg); 
    279283                        break; 
    280284                case 'i': 
     
    374378        } 
    375379 
    376         if (process_include_args()) 
    377                 cli_classic_abort_usage(); 
    378  
    379380        /* FIXME: Print the actions flashrom will take. */ 
    380381 
     
    390391        } 
    391392#endif 
     393 
     394        if (layoutfile && read_romlayout(layoutfile)) 
     395                cli_classic_abort_usage(); 
     396        if (process_include_args()) 
     397                cli_classic_abort_usage(); 
    392398 
    393399        /* Does a chip with the requested name exist in the flashchips array? */ 
Note: See TracChangeset for help on using the changeset viewer.