diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-08-12 13:32:56 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-08-12 13:32:56 +0000 |
commit | 3382bc9bd00cc8ab61f0bca35e48cefaa49ebb25 (patch) | |
tree | 07d03ad8b91541f09b13ac709ef85e93cbc339ca /flashrom.c | |
parent | 0f1df3eab7ba830563167518230d82729dd64e26 (diff) | |
download | flashrom-3382bc9bd00cc8ab61f0bca35e48cefaa49ebb25.zip flashrom-3382bc9bd00cc8ab61f0bca35e48cefaa49ebb25.tar.gz |
Use a common parameter variable for all programmers
This allows us to reduce #ifdef clauses a lot if we compile out some
programmers completely.
Corresponding to flashrom svn r679.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -34,6 +34,7 @@ const char *flashrom_version = FLASHROM_VERSION; char *chip_to_probe = NULL; int verbose = 0; enum programmer programmer = PROGRAMMER_INTERNAL; +char *programmer_param = NULL; const struct programmer_entry programmer_table[] = { { @@ -642,30 +643,32 @@ int main(int argc, char *argv[]) case 'p': if (strncmp(optarg, "internal", 8) == 0) { programmer = PROGRAMMER_INTERNAL; + if (optarg[8] == '=') + programmer_param = strdup(optarg + 9); } else if (strncmp(optarg, "dummy", 5) == 0) { programmer = PROGRAMMER_DUMMY; if (optarg[5] == '=') - dummytype = strdup(optarg + 6); + programmer_param = strdup(optarg + 6); } else if (strncmp(optarg, "nic3com", 7) == 0) { programmer = PROGRAMMER_NIC3COM; if (optarg[7] == '=') - pcidev_bdf = strdup(optarg + 8); + programmer_param = strdup(optarg + 8); } else if (strncmp(optarg, "satasii", 7) == 0) { programmer = PROGRAMMER_SATASII; if (optarg[7] == '=') - pcidev_bdf = strdup(optarg + 8); + programmer_param = strdup(optarg + 8); } else if (strncmp(optarg, "it87spi", 7) == 0) { programmer = PROGRAMMER_IT87SPI; if (optarg[7] == '=') - it87opts = strdup(optarg + 8); + programmer_param = strdup(optarg + 8); } else if (strncmp(optarg, "ft2232spi", 9) == 0) { programmer = PROGRAMMER_FT2232SPI; if (optarg[9] == '=') - ft2232spi_param = strdup(optarg + 10); + programmer_param = strdup(optarg + 10); } else if (strncmp(optarg, "serprog", 7) == 0) { programmer = PROGRAMMER_SERPROG; if (optarg[7] == '=') - serprog_param = strdup(optarg + 8); + programmer_param = strdup(optarg + 8); } else { printf("Error: Unknown programmer.\n"); exit(1); |