1N/Atst note{ check for win32 .exe botches }end output{
1N/A cp(const char* from, const char* to)
1N/A if ((fd = _open(from, O_RDONLY|O_BINARY)) < 0)
1N/A if (_fstat(fd, &fs) || (td = _open(to, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY,
fs.st_mode & 0777)) < 0)
1N/A while ((n = _read(fd, buf, sizeof(buf))) > 0 && _write(td, buf, n) == n);
1N/A main(int argc, char** argv)
1N/A snprintf(buf, sizeof(buf), "rm -rf
/tmp/iff-%d", getpid());
1N/A if (_mkdir(buf+7, 0755))
1N/A if (_access("foo", X_OK))
1N/A fix++,printf("#define _win32_botch_access 1\n");
1N/A if (_chmod("foo", 0755))
1N/A fix++,printf("#define _win32_botch_chmod 1\n");
1N/A fix++,printf("#define _win32_botch_copy 1\n");
1N/A if (_getpagesize() != 64 * 1024)
1N/A fix++,printf("#define _win32_botch_getpagesize 1\n");
1N/A if (_link("foo", "bar") || _access("
bar.exe", X_OK))
1N/A fix++,printf("#define _win32_botch_link 1\n");
1N/A if ((fd = _open("foo", O_RDONLY)) < 0)
1N/A fix++,printf("#define _win32_botch_open 1\n");
1N/A if (_pathconf("huh", _PC_NAME_MAX) >= 0)
1N/A fix++,printf("#define _win32_botch_pathconf 1\n");
1N/A if (_rename("foo", "aha") || _access("
aha.exe", X_OK))
1N/A fix++,printf("#define _win32_botch_rename 1\n");
1N/A if (_stat("bar", &st))
1N/A fix++,printf("#define _win32_botch_stat 1\n");
1N/A printf("#define _stat _stat64\n");
1N/A if (_truncate("aha", 0))
1N/A fix++,printf("#define _win32_botch_truncate 1\n");
1N/A fix++,printf("#define _win32_botch_unlink 1\n");
1N/A if (_utime("aha", 0))
1N/A fix++,printf("#define _win32_botch_utime 1\n");
1N/A printf("#define _win32_botch_execve 1\n");
1N/A printf("#define _win32_botch 1\n");
1N/Atst win32_botch_alarm note{ win32 alarm(2) return botched }end noexecute{
1N/A static int sigalrm = 0;
1N/A main(int argc, char** argv)
1N/A signal(SIGALRM, handler);
1N/A return sigalrm != 1 || alarm(0) != 0;