Select update variant. Returns 0=standard, 1=ui, -1=error. */
| 11398 | |
| 11399 | /* Select update variant. Returns 0=standard, 1=ui, -1=error. */ |
| 11400 | static int select_update_variant(int variant_flag) { |
| 11401 | if (variant_flag == VARIANT_A) { |
| 11402 | return 0; |
| 11403 | } |
| 11404 | if (variant_flag == VARIANT_B) { |
| 11405 | return CLI_TRUE; |
| 11406 | } |
| 11407 | #ifndef _WIN32 |
| 11408 | if (!isatty(fileno(stdin))) { |
| 11409 | (void)fprintf(stderr, "error: variant selection requires a terminal. " |
| 11410 | "Use --standard or --ui flag.\n"); |
| 11411 | return CLI_ERR; |
| 11412 | } |
| 11413 | #endif |
| 11414 | printf("Which binary variant do you want?\n"); |
| 11415 | printf(" 1) standard — MCP server only\n"); |
| 11416 | printf(" 2) ui — MCP server + embedded graph visualization\n"); |
| 11417 | printf("Choose (1/2): "); |
| 11418 | (void)fflush(stdout); |
| 11419 | char choice[CLI_BUF_16]; |
| 11420 | if (!fgets(choice, sizeof(choice), stdin)) { |
| 11421 | (void)fprintf(stderr, "error: failed to read input\n"); |
| 11422 | return CLI_ERR; |
| 11423 | } |
| 11424 | return (choice[0] == '2') ? CLI_TRUE : 0; |
| 11425 | } |
| 11426 | |
| 11427 | /* Case-insensitive prefix match (portable — no strncasecmp dependency). */ |
| 11428 | static bool prefix_icase(const char *s, const char *prefix) { |