Changeset 1483 for trunk/cbtable.c
- Timestamp:
- 01/04/12 01:48:27 (5 months ago)
- File:
-
- 1 edited
-
trunk/cbtable.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/cbtable.c
r1284 r1483 34 34 int partvendor_from_cbtable = 0; 35 35 36 void lb_vendor_dev_from_string(char *boardstring) 37 { 36 /* Parse the [<vendor>:]<board> string specified by the user as part of 37 * -p internal:mainboard=[<vendor>:]<board> and set lb_vendor and lb_part 38 * to the extracted values. 39 * Note: strtok modifies the original string, so we work on a copy and allocate 40 * memory for lb_vendor and lb_part with strdup. 41 */ 42 void lb_vendor_dev_from_string(const char *boardstring) 43 { 44 /* strtok may modify the original string. */ 45 char *tempstr = strdup(boardstring); 38 46 char *tempstr2 = NULL; 39 strtok( boardstring, ":");47 strtok(tempstr, ":"); 40 48 tempstr2 = strtok(NULL, ":"); 41 49 if (tempstr2) { 42 lb_vendor = boardstring;43 lb_part = tempstr2;50 lb_vendor = strdup(tempstr); 51 lb_part = strdup(tempstr2); 44 52 } else { 45 53 lb_vendor = NULL; 46 lb_part = boardstring; 47 } 54 lb_part = strdup(tempstr); 55 } 56 free(tempstr); 48 57 } 49 58
Note: See TracChangeset
for help on using the changeset viewer.
