X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-test-igniter%2Fao-test-igniter.c;h=62e6c702c1c14d80a0d67327d90df1bca7e5ee5c;hp=419c89482c84d721af51bf6e26f91d3a7652312a;hb=6f729ff46b2f4531db68f0af85e7e9fe0f6d1969;hpb=e0077866138a1e29ede7181e39f04860b866543a diff --git a/ao-tools/ao-test-igniter/ao-test-igniter.c b/ao-tools/ao-test-igniter/ao-test-igniter.c index 419c8948..62e6c702 100644 --- a/ao-tools/ao-test-igniter/ao-test-igniter.c +++ b/ao-tools/ao-test-igniter/ao-test-igniter.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,7 +47,7 @@ static void usage(char *program) exit(1); } -void +static void done(struct cc_usb *cc, int code) { /* cc_usb_printf(cc, "a\n"); */ @@ -54,28 +55,6 @@ done(struct cc_usb *cc, int code) 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; -} - struct igniter { struct igniter *next; char name[512]; @@ -95,7 +74,7 @@ igniters(struct cc_usb *usb) cc_usb_getline(usb, line, sizeof (line)); if (strstr(line, "software-version")) break; - if (sscanf(line, "Igniter: %s Status: %s", &name, &status) == 2) { + if (sscanf(line, "Igniter: %s Status: %s", name, status) == 2) { struct igniter *i = malloc (sizeof (struct igniter)); strcpy(i->name, name); strcpy(i->status, status); @@ -124,6 +103,7 @@ find_igniter(struct igniter *i, char *name) for (; i; i = i->next) if (strcmp(i->name, name) == 0) return i; + return NULL; } static int @@ -133,7 +113,7 @@ do_igniter(struct cc_usb *usb, char *name) struct igniter *this = find_igniter(all, name); if (!this) { struct igniter *i; - printf("no igniter %s found in"); + printf("no igniter %s found in", name); for (i = all; i; i = i->next) printf(" %s", i->name); printf("\n"); @@ -156,15 +136,10 @@ 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;