Changeset 59958992 in mainline
- Timestamp:
- 2017-12-22T15:08:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e16454
- Parents:
- acb9aa7
- Location:
- uspace/app/tmon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tmon/burst_tests.c
racb9aa7 r59958992 40 40 #include <getopt.h> 41 41 #include <usbdiag_iface.h> 42 #include <macros.h> 42 43 #include "commands.h" 43 44 #include "tf.h" … … 115 116 { .prefix = 'G', .factor = 1ul << 30 }, 116 117 { .prefix = 'M', .factor = 1ul << 20 }, 117 { .prefix = 'k', .factor = 1ul << 10 }, 118 { /* NULL-terminated */ } 118 { .prefix = 'k', .factor = 1ul << 10 } 119 119 }; 120 120 121 121 static char * format_size(double size, const char *fmt) 122 122 { 123 inti;124 for (i = 0; units[i].prefix; ++i) {123 unsigned i; 124 for (i = 0; i < ARRAY_SIZE(units); ++i) { 125 125 if (units[i].factor <= size) 126 126 break; 127 127 } 128 128 129 char prefix[ 2] = { '\0', '\0' };129 char prefix[] = { '\0', '\0' }; 130 130 double factor = 1; 131 131 132 if ( units[i].prefix) {132 if (i < ARRAY_SIZE(units)) { 133 133 prefix[0] = units[i].prefix; 134 134 factor = units[i].factor; -
uspace/app/tmon/main.c
racb9aa7 r59958992 36 36 37 37 #include <stdio.h> 38 #include <macros.h> 38 39 #include "commands.h" 39 40 … … 82 83 .description = "Write to isochronous endpoint as fast as possible.", 83 84 .action = tmon_burst_isoch_out, 84 }, 85 { /* NULL-terminated */ } 85 } 86 86 }; 87 87 … … 102 102 .short_name = 's', 103 103 .description = "Set the data size transferred in a single cycle." 104 }, 105 { /* NULL-terminated */ } 104 } 106 105 }; 107 106 … … 111 110 printf("Usage: %s command [device] [options]\n\n", app_name); 112 111 113 for ( int i = 0; commands[i].name; ++i) {112 for (unsigned i = 0; i < ARRAY_SIZE(commands); ++i) { 114 113 printf(INDENT "%s - %s\n", commands[i].name, commands[i].description); 115 114 } 116 115 117 116 puts("\n"); 118 for ( int i = 0; options[i].long_name; ++i) {117 for (unsigned i = 0; i < ARRAY_SIZE(options); ++i) { 119 118 printf(INDENT "-%c --%s\n" INDENT INDENT "%s\n", options[i].short_name, options[i].long_name, options[i].description); 120 119 } … … 127 126 // Find a command to execute. 128 127 tmon_cmd_t *cmd = NULL; 129 for ( int i = 0; argc > 1 && commands[i].name; ++i) {128 for (unsigned i = 0; argc > 1 && i < ARRAY_SIZE(commands); ++i) { 130 129 if (str_cmp(argv[1], commands[i].name) == 0) { 131 130 cmd = commands + i;
Note:
See TracChangeset
for help on using the changeset viewer.