vlmcsdmulti.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Multi-Call Binary for vlmcs and vlmcsd */
  2. #ifndef CONFIG
  3. #define CONFIG "config.h"
  4. #endif // CONFIG
  5. #include CONFIG
  6. #if MULTI_CALL_BINARY < 1
  7. #error "Please define MULTI_CALL_BINARY=1 when compiling this file."
  8. #endif
  9. #include <libgen.h>
  10. #include <stdio.h>
  11. #include "vlmcs.h"
  12. #include "vlmcsd.h"
  13. #include "types.h"
  14. #include "shared_globals.h"
  15. #include "output.h"
  16. #if (defined(_WIN32) || defined(__CYGWIN__))
  17. #define compare strcasecmp // Best for case-preserving (but otherwise case-insensitive) filesystems
  18. #else // native Unix
  19. #define compare strcmp // for case-sensitive filesystems
  20. #endif // native Unix
  21. int main(int argc, CARGV argv)
  22. {
  23. multi_argv = argv;
  24. multi_argc = argc;
  25. if (!compare(basename((char*)*argv), "vlmcsd"))
  26. return server_main(argc, argv);
  27. if (!compare(basename((char*)*argv), "vlmcs"))
  28. return client_main(argc, argv);
  29. #ifdef _WIN32
  30. if (!compare(basename((char*)*argv), "vlmcsd.exe"))
  31. return server_main(argc, argv);
  32. if (!compare(basename((char*)*argv), "vlmcs.exe"))
  33. return client_main(argc, argv);
  34. #endif // _WIN32
  35. if (argc > 1)
  36. {
  37. if (!strcmp((char*)argv[1],"vlmcsd"))
  38. return server_main(argc - 1, argv + 1);
  39. if (!strcmp((char*)argv[1],"vlmcs"))
  40. return client_main(argc - 1, argv + 1);
  41. }
  42. errorout(
  43. "vlmcsdmulti %s\n\n"
  44. "Usage:\n"
  45. "\t%s vlmcsd [<vlmcsd command line>]\n"
  46. "\t%s vlmcs [<vlmcs command line>]\n\n",
  47. Version, *argv, *argv
  48. );
  49. return !0;
  50. }