Fix trivial_test

Apparently the non-w64 mingw32 does not have an swprintf function, though
it does have an snwprintf function.  In any case, the function takes a
second argument which is a buffer size.

Also include cwchar and cctype.

Print a message when building the test.
This commit is contained in:
Ryan Prichard 2015-08-23 23:07:33 -05:00
parent 6e696f8828
commit 0c1e064172
2 changed files with 8 additions and 4 deletions

View File

@ -24,6 +24,7 @@ include ../config-mingw.mk
LDFLAGS += -static-libgcc -static-libstdc++
../build/%.exe : %.cc
@echo Building $@
@$(CXX) $(CXXFLAGS) -std=c++11 -o $@ $^ $(LDFLAGS) ../build/winpty.dll
TEST_PROGRAMS := \

View File

@ -19,11 +19,13 @@
// IN THE SOFTWARE.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cwchar>
#include <vector>
#include "../include/winpty.h"
#include "../shared/DebugClient.h"
@ -86,7 +88,8 @@ static void parentTest() {
wchar_t program[1024];
wchar_t cmdline[1024];
GetModuleFileNameW(NULL, program, 1024);
swprintf(cmdline, L"\"%s\" CHILD", program);
snwprintf(cmdline, sizeof(cmdline) / sizeof(cmdline[0]),
L"\"%s\" CHILD", program);
winpty_t *pty = winpty_open(80, 25);
assert(pty != NULL);