29 #define NORETURN __declspec(noreturn)
31 #define NORETURN __attribute__((noreturn))
38 void Warning(
const char* msg, ...);
41 void Error(
const char* msg, ...);
51 int ReadFile(
const string& path,
string* contents,
string* err);
59 const vector<const char*>& words);
77 string ElideMiddle(
const string& str,
size_t width);
80 bool Truncate(
const string& path,
size_t size,
string* err);
83 #define snprintf _snprintf
84 #define fileno _fileno
85 #define unlink _unlink
87 #define strtoull _strtoui64
88 #define getcwd _getcwd
89 #define PATH_MAX _MAX_PATH
94 string GetLastErrorString();
97 NORETURN void Win32Fatal(
const char*
function);
100 #endif // NINJA_UTIL_H_
const char * SpellcheckString(const char *text,...)
Like SpellcheckStringV, but takes a NULL-terminated list.
void Error(const char *msg,...)
Log an error message.
NORETURN void Fatal(const char *msg,...)
Log a fatal message and exit.
const char * SpellcheckStringV(const string &text, const vector< const char * > &words)
Given a misspelled string and a list of correct spellings, returns the closest match or NULL if there...
bool CanonicalizePath(string *path, string *err)
Canonicalize a path like "foo/../bar.h" into just "bar.h".
bool Truncate(const string &path, size_t size, string *err)
Truncates a file to the given size.
void Warning(const char *msg,...)
Log a warning message.
int ReadFile(const string &path, string *contents, string *err)
Read a file to a string (in text mode: with CRLF conversion on Windows).
string StripAnsiEscapeCodes(const string &in)
Removes all Ansi escape codes (http://www.termsys.demon.co.uk/vtansi.htm).
void SetCloseOnExec(int fd)
Mark a file descriptor to not be inherited on exec()s.
string ElideMiddle(const string &str, size_t width)
Elide the given string str with '...' in the middle if the length exceeds width.