KBaba7/llama.cpp
0
1// Warns users that this filename was deprecated, and provides a link for more information.2 3#include <cstdio>4#include <string>5#include <unordered_map>6 7// Main8int main(int argc, char** argv) {9 std::string filename = "main";10 if (argc >= 1) {11 filename = argv[0];12 }13 14 // Get only the program name from the full path15 auto pos = filename.find_last_of("/\\");16 if (pos != std::string::npos) {17 filename = filename.substr(pos+1);18 }19 20 // Append "llama-" to the beginning of filename to get the replacemnt filename21 auto replacement_filename = "llama-" + filename;22 23 // The exception is if the filename is "main", then our replacement filename is "llama-cli"24 if (filename == "main") {25 replacement_filename = "llama-cli";26 }27 28 fprintf(stdout, "\n");29 fprintf(stdout, "WARNING: The binary '%s' is deprecated.\n", filename.c_str());30 fprintf(stdout, " Please use '%s' instead.\n", replacement_filename.c_str());31 fprintf(stdout, " See https://github.com/ggerganov/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.\n");32 fprintf(stdout, "\n");33 34 return EXIT_FAILURE;35}36 