| 1085 | COMMANDF(concatword, "w", (const char *s) { result(s); }); |
| 1086 | |
| 1087 | void format(char **args, int numargs) |
| 1088 | { |
| 1089 | vector<char> s; |
| 1090 | const char *f = numargs > 0 ? args[0] : ""; |
| 1091 | while(*f) |
| 1092 | { |
| 1093 | int c = *f++; |
| 1094 | if(c == '%') |
| 1095 | { |
| 1096 | int i = *f++; |
| 1097 | bool twodigit = i == '0' && isdigit(f[0]) && isdigit(f[1]); |
| 1098 | if((i >= '1' && i <= '9') || twodigit) |
| 1099 | { |
| 1100 | if(twodigit) i = (f[0] - '0') * 10 + f[1] - '0', f += 2; |
| 1101 | else i -= '0'; |
| 1102 | const char *sub = i < numargs ? args[i] : ""; |
| 1103 | while(*sub) s.add(*sub++); |
| 1104 | } |
| 1105 | else s.add(i); |
| 1106 | } |
| 1107 | else s.add(c); |
| 1108 | } |
| 1109 | resultcharvector(s, 0); |
| 1110 | } |
| 1111 | COMMAND(format, "v"); |
| 1112 | |
| 1113 | void format2(char **args, int numargs) |
no test coverage detected