mingw-w64/mingw-w64-crt/testcases/t_stat_slash.c
Jonathan Yong 128ba9dc93 Abort in case of failure, more automake friendly.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@3839 4407c894-4637-0410-b4f5-ada5f102cad1
2010-12-01 14:57:43 +00:00

54 lines
884 B
C

#include <windows.h>
#include <stdio.h>
#include <sys/stat.h>
void
test (char *path)
{
struct stat buf;
if (stat(path, &buf) == 0)
printf ("OK [%s]\n", path);
else {
printf ("ERROR [%s]\n", path);
abort();
}
}
void
wtest (wchar_t *path)
{
struct stat buf;
if (wstat(path, &buf) == 0)
wprintf (L"OK [%s]\n", path);
else {
wprintf (L"ERROR [%s]\n", path);
abort();
}
}
int
main (int argc, char **argv)
{
wchar_t windir_wbuf[MAX_PATH + 1];
char windir_abuf[MAX_PATH + 1];
if (GetWindowsDirectoryA(&windir_abuf[0], MAX_PATH))
{
strcat (&windir_abuf[0], "\\");
test (&windir_abuf[0]);
}
test ("c:\\");
test ("\\");
test ("/");
if (GetWindowsDirectoryW(&windir_wbuf[0], MAX_PATH))
{
wcscat (&windir_wbuf[0], L"\\");
wtest (windir_wbuf);
}
wtest (L"c:\\");
wtest (L"\\");
wtest (L"/");
return 0;
}