blob: 18fbfa296a73330c5a8b1ef29784cc0cdbda0f2d (
plain) (
tree)
|
|
#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
|