echodict/llama.cpp
version https://git-lfs.github.com/spec/v1 oid sha256:cfc44b7ba25614df70e6b65e3341cae0310163bd32fd31a6b928a542df433faf size 30786
0479
1// Warns users that this filename was deprecated, and provides a link for more information.2 3#include <clocale>4#include <cstdio>5#include <string>6#include <unordered_map>7 8// Main9int main(int argc, char** argv) {10 std::setlocale(LC_NUMERIC, "C");11 12 std::string filename = "main";13 if (argc >= 1) {14 filename = argv[0];15 }16 17 // Get only the program name from the full path18 auto pos = filename.find_last_of("/\\");19 if (pos != std::string::npos) {20 filename = filename.substr(pos+1);21 }22 23 // Append "llama-" to the beginning of filename to get the replacemnt filename24 auto replacement_filename = "llama-" + filename;25 26 // The exception is if the filename is "main", then our replacement filename is "llama-cli"27 if (filename == "main") {28 replacement_filename = "llama-cli";29 }30 31 fprintf(stdout, "\n");32 fprintf(stdout, "WARNING: The binary '%s' is deprecated.\n", filename.c_str());33 fprintf(stdout, " Please use '%s' instead.\n", replacement_filename.c_str());34 fprintf(stdout, " See https://github.com/ggml-org/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.\n");35 fprintf(stdout, "\n");36 37 return EXIT_FAILURE;38}39 