blob: 0c4bf23e9f6580578736462a044cc52e7c8f5714 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "compat.h"
#include "defaults.h"
#include "progname.h"
#include <cctype>
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <cstdlib>
#include <util/generic/string.h>
#ifdef _win_
#include "winint.h"
#include <io.h>
#endif
#ifndef HAVE_NATIVE_GETPROGNAME
const char* getprogname() {
return GetProgramName().data();
}
#endif
#ifdef _win_
void sleep(i64 len) {
Sleep((unsigned long)len * 1000);
}
void usleep(i64 len) {
Sleep((unsigned long)len / 1000);
}
#include <fcntl.h>
int ftruncate(int fd, i64 length) {
return _chsize_s(fd, length);
}
int truncate(const char* name, i64 length) {
int fd = ::_open(name, _O_WRONLY);
int ret = ftruncate(fd, length);
::close(fd);
return ret;
}
#endif
|