X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=ao-tools%2Fao-test-flash%2Fao-test-flash.c;h=dc5d8ebcded8835f9b273b09bb7cf904ab52c12d;hb=3703aef1b8b043697e8b99df24b987ba696909bc;hp=cf44ae69c500e8595b2d0e3441013cceaec982b5;hpb=fc3364de2b6cdfff53f5c38b3ae52ae5601ff3b7;p=fw%2Faltos diff --git a/ao-tools/ao-test-flash/ao-test-flash.c b/ao-tools/ao-test-flash/ao-test-flash.c index cf44ae69..dc5d8ebc 100644 --- a/ao-tools/ao-test-flash/ao-test-flash.c +++ b/ao-tools/ao-test-flash/ao-test-flash.c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -46,35 +47,13 @@ static void usage(char *program) exit(1); } -void +static void done(struct cc_usb *cc, int code) { cc_usb_close(cc); exit (code); } -static int -ends_with(char *whole, char *suffix) -{ - int whole_len = strlen(whole); - int suffix_len = strlen(suffix); - - if (suffix_len > whole_len) - return 0; - return strcmp(whole + whole_len - suffix_len, suffix) == 0; -} - -static int -starts_with(char *whole, char *prefix) -{ - int whole_len = strlen(whole); - int prefix_len = strlen(prefix); - - if (prefix_len > whole_len) - return 0; - return strncmp(whole, prefix, prefix_len) == 0; -} - static char ** tok(char *line) { char **strs = malloc (sizeof (char *)), *str; @@ -140,9 +119,8 @@ free_flash(struct flash *b) { } } -char ** +static char ** find_flash(struct flash *b, char *word0) { - int i; for (;b; b = b->next) { if (strstr(b->line, word0)) return b->strs; @@ -150,7 +128,7 @@ find_flash(struct flash *b, char *word0) { return NULL; } -int +static int do_flash(struct cc_usb *usb, int expected_size) { struct flash *b = flash(usb); char **size = find_flash(b, "Storage size:"); @@ -187,18 +165,11 @@ int main (int argc, char **argv) { char *device = NULL; - char *filename; - Elf *e; - unsigned int s; - int i; int c; - int tries; struct cc_usb *cc = NULL; char *tty = NULL; - int success; int verbose = 0; int ret = 0; - int expected_size; while ((c = getopt_long(argc, argv, "rT:D:c:s:v:", options, NULL)) != -1) { switch (c) {