mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
memfs: memfs-main.c
This commit is contained in:
parent
59347cd00d
commit
9f6bbe4a63
@ -18,9 +18,6 @@ static void vwarn(const char *format, va_list ap)
|
|||||||
wvsprintfA(buf, format, ap);
|
wvsprintfA(buf, format, ap);
|
||||||
buf[sizeof buf - 1] = '\0';
|
buf[sizeof buf - 1] = '\0';
|
||||||
|
|
||||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE),
|
|
||||||
"memfs: ", 7,
|
|
||||||
&BytesTransferred, 0);
|
|
||||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE),
|
WriteFile(GetStdHandle(STD_ERROR_HANDLE),
|
||||||
buf, (DWORD)strlen(buf),
|
buf, (DWORD)strlen(buf),
|
||||||
&BytesTransferred, 0);
|
&BytesTransferred, 0);
|
||||||
@ -64,13 +61,13 @@ static void usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
ULONG argul(wchar_t **argp, ULONG deflt)
|
ULONG argtol(wchar_t **argp, ULONG deflt)
|
||||||
{
|
{
|
||||||
if (0 == argp[0])
|
if (0 == argp[0])
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
wchar_t *endp;
|
wchar_t *endp;
|
||||||
ULONG ul = wcstoul(argp[0], &endp, 10);
|
ULONG ul = wcstol(argp[0], &endp, 10);
|
||||||
return 0 != ul ? ul : deflt;
|
return 0 != ul ? ul : deflt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,13 +97,13 @@ int wmain(int argc, wchar_t **argv)
|
|||||||
switch (argp[0][1])
|
switch (argp[0][1])
|
||||||
{
|
{
|
||||||
case L'n':
|
case L'n':
|
||||||
MaxFileNodes = argul(++argp, MaxFileNodes);
|
MaxFileNodes = argtol(++argp, MaxFileNodes);
|
||||||
break;
|
break;
|
||||||
case L's':
|
case L's':
|
||||||
MaxFileSize = argul(++argp, MaxFileSize);
|
MaxFileSize = argtol(++argp, MaxFileSize);
|
||||||
break;
|
break;
|
||||||
case L't':
|
case L't':
|
||||||
FileInfoTimeout = argul(++argp, FileInfoTimeout);
|
FileInfoTimeout = argtol(++argp, FileInfoTimeout);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
@ -132,6 +129,8 @@ int wmain(int argc, wchar_t **argv)
|
|||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
fail("error: cannot mount MEMFS");
|
fail("error: cannot mount MEMFS");
|
||||||
|
|
||||||
|
warn("%s -t %ld -n %ld -s %ld %s",
|
||||||
|
PROGNAME, FileInfoTimeout, MaxFileNodes, MaxFileSize, MountPoint);
|
||||||
SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE);
|
SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE);
|
||||||
if (WAIT_OBJECT_0 != WaitForSingleObject(MainEvent, INFINITE))
|
if (WAIT_OBJECT_0 != WaitForSingleObject(MainEvent, INFINITE))
|
||||||
fail("error: cannot wait on MainEvent");
|
fail("error: cannot wait on MainEvent");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user