cleanup
This commit is contained in:
17
src/cui.cpp
17
src/cui.cpp
@@ -121,23 +121,6 @@ std::string uid2username(uid_t uid) {
|
|||||||
return std::string(pwd->pw_name);
|
return std::string(pwd->pw_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Render the provided text at the specified location, truncating if the length
|
|
||||||
* of the text exceeds a maximum. If the
|
|
||||||
* text must be truncated, the string ".." will be rendered, followed by max_len
|
|
||||||
* - 2 characters of the provided text.
|
|
||||||
*/
|
|
||||||
static void mvaddstr_truncate_leading(int row, int col, const char *str,
|
|
||||||
std::size_t str_len,
|
|
||||||
std::size_t max_len) {
|
|
||||||
if (str_len < max_len) {
|
|
||||||
mvaddstr(row, col, str);
|
|
||||||
} else {
|
|
||||||
mvaddstr(row, col, "..");
|
|
||||||
addnstr(str + 2, max_len - 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the provided text at the specified location, truncating if the length
|
* Render the provided text at the specified location, truncating if the length
|
||||||
* of the text exceeds a maximum. If the
|
* of the text exceeds a maximum. If the
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ std::string getcmdline(pid_t pid) {
|
|||||||
std::string cmdline = read_file(filename);
|
std::string cmdline = read_file(filename);
|
||||||
|
|
||||||
// join parameters, keep prgname separate, don't overwrite trailing null
|
// join parameters, keep prgname separate, don't overwrite trailing null
|
||||||
for (int idx = 0; idx < (cmdline.length() - 1); idx++) {
|
for (size_t idx = 0; idx < (cmdline.length() - 1); idx++) {
|
||||||
if (cmdline[idx] == 0x00) {
|
if (cmdline[idx] == 0x00) {
|
||||||
if (replace_null) {
|
if (replace_null) {
|
||||||
cmdline[idx] = ' ';
|
cmdline[idx] = ' ';
|
||||||
|
|||||||
Reference in New Issue
Block a user