@@ -34,6 +34,7 @@ void safe_exit(int code) {
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
endwin();
|
||||
|
||||
exit(code);
|
||||
}
|
||||
@@ -109,4 +110,21 @@ void print_in_middle(WINDOW *win, int starty, int startx, int width,
|
||||
mvwprintw(win, y, x, "%s", string);
|
||||
wattroff(win, color);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
const std::string WHITESPACE = " \n\r\t\f\v";
|
||||
|
||||
std::string ltrim(const std::string &s) {
|
||||
size_t start = s.find_first_not_of(WHITESPACE);
|
||||
return (start == std::string::npos) ? "" : s.substr(start);
|
||||
}
|
||||
|
||||
std::string rtrim(const std::string &s) {
|
||||
size_t end = s.find_last_not_of(WHITESPACE);
|
||||
return (end == std::string::npos) ? "" : s.substr(0, end + 1);
|
||||
}
|
||||
|
||||
std::string rm_tr_le_whitespace(const std::string &s) {
|
||||
return rtrim(ltrim(s));
|
||||
}
|
||||
Reference in New Issue
Block a user