Select update variant. Returns 0=standard, 1=ui, -1=error. */
| 4278 | |
| 4279 | /* Select update variant. Returns 0=standard, 1=ui, -1=error. */ |
| 4280 | static int select_update_variant(int variant_flag) { |
| 4281 | if (variant_flag == VARIANT_A) { |
| 4282 | return 0; |
| 4283 | } |
| 4284 | if (variant_flag == VARIANT_B) { |
| 4285 | return CLI_TRUE; |
| 4286 | } |
| 4287 | #ifndef _WIN32 |
| 4288 | if (!isatty(fileno(stdin))) { |
| 4289 | (void)fprintf(stderr, "error: variant selection requires a terminal. " |
| 4290 | "Use --standard or --ui flag.\n"); |
| 4291 | return CLI_ERR; |
| 4292 | } |
| 4293 | #endif |
| 4294 | printf("Which binary variant do you want?\n"); |
| 4295 | printf(" 1) standard — MCP server only\n"); |
| 4296 | printf(" 2) ui — MCP server + embedded graph visualization\n"); |
| 4297 | printf("Choose (1/2): "); |
| 4298 | (void)fflush(stdout); |
| 4299 | char choice[CLI_BUF_16]; |
| 4300 | if (!fgets(choice, sizeof(choice), stdin)) { |
| 4301 | (void)fprintf(stderr, "error: failed to read input\n"); |
| 4302 | return CLI_ERR; |
| 4303 | } |
| 4304 | return (choice[0] == '2') ? CLI_TRUE : 0; |
| 4305 | } |
| 4306 | |
| 4307 | /* Case-insensitive prefix match (portable — no strncasecmp dependency). */ |
| 4308 | static bool prefix_icase(const char *s, const char *prefix) { |