1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-22 19:15:20 +02:00

tools/antorcha.c (usage): explain options and show parameter names and defaults

This commit is contained in:
Werner Almesberger 2012-06-28 01:21:47 -03:00
parent 00f0b4e692
commit 69ee8dfec7

View File

@ -488,15 +488,37 @@ quit:
/* ----- Command-line processing ------------------------------------------- */ /* ----- Command-line processing ------------------------------------------- */
static unsigned get_int(uint8_t *p, int n)
{
unsigned v = 0;
int i;
for (i = 0; i != n; i++)
v |= *p++ << (i*8);
return v;
}
static void usage(const char *name) static void usage(const char *name)
{ {
const struct map *m;
fprintf(stderr, fprintf(stderr,
"usage: %s [-d] [param=value ...] image_file\n" "usage: %s [-d] [param=value ...] image_file\n"
"%6s %s [-d] -F firmware_file\n" "%6s %s [-d] -F firmware_file\n"
"%6s %s [-d] -P\n" "%6s %s [-d] -P\n"
"%6s %s [-d] -R\n" "%6s %s [-d] -R\n"
"%6s %s [-d] -S [-S]\n" "%6s %s [-d] -S [-S]\n\n"
" -F file firmware upload\n"
" -P ping (version query)\n"
" -R reset\n"
" -S sample with output on stdout. Exit with ^C.\n"
" -S -S sample with graphical output. Exit with Q.\n\n"
"Parameters:\n"
, name, "", name, "", name, "", name, "", name); , name, "", name, "", name, "", name, "", name);
for (m = map; m->name; m++)
fprintf(stderr, " %s\t(default %u)\n",
m->name, get_int(m->p, m->bytes));
exit(1); exit(1);
} }