vlmcsd-svn1031-2016-10-06-Hotbird64

This commit is contained in:
Wind4
2016-10-08 13:35:48 +08:00
parent 0b2c216c06
commit d413afbadf
54 changed files with 2404 additions and 737 deletions
+45 -10
View File
@@ -1,5 +1,7 @@
/* Multi-Call Binary for vlmcs and vlmcsd */
#define _CRT_SECURE_NO_WARNINGS
#ifndef CONFIG
#define CONFIG "config.h"
#endif // CONFIG
@@ -9,9 +11,15 @@
#error "Please define MULTI_CALL_BINARY=1 when compiling this file."
#endif
#include <libgen.h>
#include <stdio.h>
#if !_MSC_VER
#include <libgen.h>
#else // _MSC_VER
#include <stdlib.h>
#include "helpers.h"
#endif // _MSC_VER
#include "vlmcs.h"
#include "vlmcsd.h"
#include "types.h"
@@ -24,6 +32,33 @@
#define compare strcmp // for case-sensitive filesystems
#endif // native Unix
#if _MSC_VER
static char* basename(const char* fullname)
{
size_t len = strlen(fullname);
char* filename = (char*)vlmcsd_malloc(len + 1);
char* extension = (char*)vlmcsd_malloc(len + 1);
static char result[64];
_splitpath(fullname, NULL, NULL, filename, extension);
if (strlen(filename) + strlen(extension) > 63)
{
*result = 0;
goto finally;
}
strcpy(result, filename);
strcat(result, extension);
finally:
free(filename);
free(extension);
return result;
}
#endif // _MSC_VER
int main(int argc, CARGV argv)
{
multi_argv = argv;
@@ -35,29 +70,29 @@ int main(int argc, CARGV argv)
if (!compare(basename((char*)*argv), "vlmcs"))
return client_main(argc, argv);
#ifdef _WIN32
#ifdef _WIN32
if (!compare(basename((char*)*argv), "vlmcsd.exe"))
return server_main(argc, argv);
if (!compare(basename((char*)*argv), "vlmcs.exe"))
return client_main(argc, argv);
#endif // _WIN32
#endif // _WIN32
if (argc > 1)
{
if (!strcmp((char*)argv[1],"vlmcsd"))
if (!strcmp((char*)argv[1], "vlmcsd"))
return server_main(argc - 1, argv + 1);
if (!strcmp((char*)argv[1],"vlmcs"))
if (!strcmp((char*)argv[1], "vlmcs"))
return client_main(argc - 1, argv + 1);
}
errorout(
"vlmcsdmulti %s\n\n"
"Usage:\n"
"\t%s vlmcsd [<vlmcsd command line>]\n"
"\t%s vlmcs [<vlmcs command line>]\n\n",
Version, *argv, *argv
"vlmcsdmulti %s\n\n"
"Usage:\n"
"\t%s vlmcsd [<vlmcsd command line>]\n"
"\t%s vlmcs [<vlmcs command line>]\n\n",
Version, *argv, *argv
);
return !0;