Changeset b828907 in mainline for uspace/app
- Timestamp:
- 2012-07-20T20:29:54Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34bc2fe
- Parents:
- 4cdac68 (diff), 6de2d766 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/app
- Files:
-
- 4 edited
- 1 moved
-
bdsh/cmds/modules/cat/cat.c (modified) (4 diffs)
-
usbinfo/Makefile (modified) (1 diff)
-
usbinfo/list.c (moved) (moved from uspace/app/lsusb/main.c ) (5 diffs)
-
usbinfo/main.c (modified) (7 diffs)
-
usbinfo/usbinfo.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r4cdac68 rb828907 176 176 177 177 bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0); 178 178 179 179 if (reading_stdin) { 180 180 fd = fileno(stdin); 181 181 /* Allow storing the whole UTF-8 character. */ 182 182 blen = STR_BOUNDS(1); 183 } else {183 } else 184 184 fd = open(fname, O_RDONLY); 185 }185 186 186 if (fd < 0) { 187 187 printf("Unable to open %s\n", fname); … … 222 222 bytes_to_read = 1; 223 223 } else { 224 if ((length != CAT_FULL_FILE) 225 &&(length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {224 if ((length != CAT_FULL_FILE) && 225 (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) { 226 226 bytes_to_read = (size_t) (length - count); 227 227 } else { … … 229 229 } 230 230 } 231 231 232 bytes = read(fd, buff + copied_bytes, bytes_to_read); 232 233 bytes += copied_bytes; … … 261 262 reads++; 262 263 } 263 264 if (reading_stdin) {264 265 if (reading_stdin) 265 266 fflush(stdout); 266 }267 267 } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 268 268 -
uspace/app/usbinfo/Makefile
r4cdac68 rb828907 47 47 hid.c \ 48 48 info.c \ 49 list.c \ 49 50 main.c 50 51 -
uspace/app/usbinfo/list.c
r4cdac68 rb828907 47 47 #include <usb/hc.h> 48 48 49 # define NAME "lsusb"49 #include "usbinfo.h" 50 50 51 51 #define MAX_USB_ADDRESS USB11_ADDRESS_MAX … … 90 90 } 91 91 92 int main(int argc, char *argv[])92 void list(void) 93 93 { 94 94 category_id_t usbhc_cat; … … 102 102 printf(NAME ": Error resolving category '%s'", 103 103 USB_HC_CATEGORY); 104 return 1;104 return; 105 105 } 106 106 … … 108 108 if (rc != EOK) { 109 109 printf(NAME ": Error getting list of host controllers.\n"); 110 return 1;110 return; 111 111 } 112 112 … … 131 131 132 132 free(svcs); 133 134 return 0;135 133 } 136 134 -
uspace/app/usbinfo/main.c
r4cdac68 rb828907 62 62 63 63 _OPTION("-h --help", "Print this help and exit."); 64 _OPTION("-l --list", "Print a list of host controllers and devices."); 64 65 _OPTION("-i --identification", "Brief device identification."); 65 66 _OPTION("-m --match-ids", "Print match ids generated for the device."); … … 82 83 {"help", no_argument, NULL, 'h'}, 83 84 {"identification", no_argument, NULL, 'i'}, 85 {"list", no_argument, NULL, 'l'}, 84 86 {"match-ids", no_argument, NULL, 'm'}, 85 87 {"descriptor-tree", no_argument, NULL, 't'}, … … 91 93 {0, 0, NULL, 0} 92 94 }; 93 static const char *short_options = "hi mtTsSrR";95 static const char *short_options = "hilmtTsSrR"; 94 96 95 97 static usbinfo_action_t actions[] = { … … 146 148 } 147 149 150 bool something_active = false; 148 151 /* 149 152 * Process command-line options. They determine what shall be … … 156 159 switch (opt) { 157 160 case -1: 161 break; 162 case 'l': 163 list(); 158 164 break; 159 165 case '?': … … 168 174 if (actions[idx].opt == opt) { 169 175 actions[idx].active = true; 176 something_active = true; 170 177 break; 171 178 } … … 178 185 179 186 /* Set the default action. */ 180 int idx = 0;181 bool something_active = false;182 while (actions[idx].opt != 0) {183 if (actions[idx].active) {184 something_active = true;185 break;186 }187 idx++;188 }189 187 if (!something_active) { 190 188 actions[0].active = true; -
uspace/app/usbinfo/usbinfo.h
r4cdac68 rb828907 79 79 dump_descriptor_in_tree_t, size_t, void *); 80 80 81 void list(void); 81 82 82 83 void dump_short_device_identification(usbinfo_device_t *);
Note:
See TracChangeset
for help on using the changeset viewer.
