29 #define NORETURN __declspec(noreturn)
31 #define NORETURN __attribute__((noreturn))
38 void Warning(
const char* msg, ...);
41 void Error(
const char* msg, ...);
58 int ReadFile(
const string& path,
string* contents,
string* err);
66 const vector<const char*>& words);
84 string ElideMiddle(
const string& str,
size_t width);
87 bool Truncate(
const string& path,
size_t size,
string* err);
90 #define snprintf _snprintf
91 #define fileno _fileno
92 #define unlink _unlink
94 #define strtoull _strtoui64
95 #define getcwd _getcwd
96 #define PATH_MAX _MAX_PATH
101 string GetLastErrorString();
104 NORETURN void Win32Fatal(
const char*
function);
107 #endif // NINJA_UTIL_H_
void GetWin32EscapedString(const string &input, string *result)
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.
void GetShellEscapedString(const string &input, string *result)
Appends |input| to |*result|, escaping according to the whims of either Bash, or Win32's CommandLineT...
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.