svnversion.cpp 751 B

123456789101112131415161718192021222324252627282930313233
  1. #include <string.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #define FROM_IMPL
  5. #include "svnversion.h"
  6. #include <util/generic/strbuf.h>
  7. extern "C" void PrintProgramSvnVersion() {
  8. puts(GetProgramSvnVersion());
  9. }
  10. extern "C" void PrintSvnVersionAndExit0() {
  11. PrintProgramSvnVersion();
  12. exit(0);
  13. }
  14. extern "C" void PrintSvnVersionAndExitEx(int argc, char* argv[], const char* opts) {
  15. if (2 == argc) {
  16. for (TStringBuf all = opts, versionOpt; all.NextTok(';', versionOpt);) {
  17. if (versionOpt == argv[1]) {
  18. PrintSvnVersionAndExit0();
  19. }
  20. }
  21. }
  22. }
  23. extern "C" void PrintSvnVersionAndExit(int argc, char* argv[]) {
  24. PrintSvnVersionAndExitEx(argc, argv, "--version");
  25. }
  26. #undef FROM_IMPL