| 34 | } |
| 35 | |
| 36 | static int GetLine(char *buf, int size, char *str) { |
| 37 | uint8_t ch = 0; |
| 38 | int n = 0; |
| 39 | int i = 0; |
| 40 | uint8_t *s = (uint8_t *)str; |
| 41 | |
| 42 | while (1) { |
| 43 | if (i >= size) |
| 44 | break; |
| 45 | |
| 46 | ch = ((uint8_t *)buf)[i]; |
| 47 | |
| 48 | if (ch < 0x20 && ch != '\t') { |
| 49 | if (n != 0) { |
| 50 | i++; |
| 51 | break; |
| 52 | } |
| 53 | } else { |
| 54 | *str++ = ch; |
| 55 | n++; |
| 56 | } |
| 57 | |
| 58 | i++; |
| 59 | } |
| 60 | |
| 61 | trim((char *)s); |
| 62 | |
| 63 | return i; |
| 64 | } |
| 65 | |
| 66 | static int getDecimal(const char *str) { |
| 67 | return strtol(str, NULL, 0); |
no test coverage detected