Windows: the qt GUI builds with Qt/MinGW. No link.
This commit is contained in:
@@ -190,6 +190,14 @@ void ExecCmd::zapChild()
|
||||
(void)wait();
|
||||
}
|
||||
|
||||
bool ExecCmd::requestChildExit()
|
||||
{
|
||||
if (m->m_pid > 0) {
|
||||
if (kill(m->m_pid, SIGTERM) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* From FreeBSD's which command */
|
||||
static bool exec_is_there(const char *candidate)
|
||||
|
||||
+13
-4
@@ -157,17 +157,26 @@ class ExecCmd {
|
||||
|
||||
/**
|
||||
* Cancel/kill command. This can be called from another thread or
|
||||
* from the advise callback, which could also raise an exception to
|
||||
* accomplish the same thing
|
||||
* from the advise callback, which could also raise an exception
|
||||
* to accomplish the same thing. In the owner thread, any I/O loop
|
||||
* will exit at the next iteration, and the process will be waited for.
|
||||
*/
|
||||
void setKill();
|
||||
|
||||
/**
|
||||
* Get rid of current process (become ready for start).
|
||||
* Get rid of current process (become ready for start). This will signal
|
||||
* politely the process to stop, wait a moment, then terminate it. This
|
||||
* is a blocking call.
|
||||
*/
|
||||
void zapChild();
|
||||
|
||||
ExecCmd();
|
||||
/**
|
||||
* Request process termination (SIGTERM or equivalent). This returns
|
||||
* immediately
|
||||
*/
|
||||
bool requestChildExit();
|
||||
|
||||
ExecCmd();
|
||||
~ExecCmd();
|
||||
|
||||
/**
|
||||
|
||||
@@ -616,6 +616,77 @@ bool pcSubst(const string& in, string& out, const map<string, string>& subs)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
inline static int ulltorbuf(unsigned long long val, char *rbuf)
|
||||
{
|
||||
int idx;
|
||||
for (idx = 0; val; idx++) {
|
||||
rbuf[idx] = '0' + val % 10;
|
||||
val /= 10;
|
||||
} while (val);
|
||||
rbuf[idx] = 0;
|
||||
return idx;
|
||||
}
|
||||
|
||||
inline static void ullcopyreverse(const char *rbuf, string& buf, int idx)
|
||||
{
|
||||
buf.reserve(idx+1);
|
||||
for (int i = idx - 1; i >= 0; i--) {
|
||||
buf.push_back(rbuf[i]);
|
||||
}
|
||||
buf.push_back(0);
|
||||
}
|
||||
|
||||
void ulltodecstr(unsigned long long val, string& buf)
|
||||
{
|
||||
buf.clear();
|
||||
if (val == 0) {
|
||||
buf = "0";
|
||||
return;
|
||||
}
|
||||
|
||||
char rbuf[30];
|
||||
int idx = ulltorbuf(val, rbuf);
|
||||
|
||||
ullcopyreverse(rbuf, buf, idx);
|
||||
return;
|
||||
}
|
||||
|
||||
void lltodecstr(long long val, string& buf)
|
||||
{
|
||||
buf.clear();
|
||||
if (val == 0) {
|
||||
buf = "0";
|
||||
return;
|
||||
}
|
||||
|
||||
bool neg = val < 0;
|
||||
if (neg)
|
||||
val = -val;
|
||||
|
||||
char rbuf[30];
|
||||
int idx = ulltorbuf(val, rbuf);
|
||||
|
||||
if (neg)
|
||||
rbuf[idx++] = '-';
|
||||
rbuf[idx] = 0;
|
||||
|
||||
ullcopyreverse(rbuf, buf, idx);
|
||||
return;
|
||||
}
|
||||
|
||||
string lltodecstr(long long val)
|
||||
{
|
||||
string buf;
|
||||
lltodecstr(val, buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
string ulltodecstr(unsigned long long val)
|
||||
{
|
||||
string buf;
|
||||
ulltodecstr(val, buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
// Convert byte count into unit (KB/MB...) appropriate for display
|
||||
string displayableBytes(off_t size)
|
||||
|
||||
@@ -134,6 +134,11 @@ extern string truncate_to_word(const string &input, string::size_type maxlen);
|
||||
/** Truncate in place in an utf8-legal way */
|
||||
extern void utf8truncate(string &s, int maxlen);
|
||||
|
||||
void ulltodecstr(unsigned long long val, string& buf);
|
||||
void lltodecstr(long long val, string& buf);
|
||||
string lltodecstr(long long val);
|
||||
string ulltodecstr(unsigned long long val);
|
||||
|
||||
/** Convert byte count into unit (KB/MB...) appropriate for display */
|
||||
string displayableBytes(off_t size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user