Index: Makefile
===================================================================
RCS file: /cvs/ports/www/sqtop/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile 7 Dec 2017 13:12:44 -0000 1.9
+++ Makefile 9 Apr 2018 07:51:55 -0000
@@ -2,23 +2,22 @@
COMMENT= top-like monitor for Squid
-DISTNAME= sqtop-2011-11-01
-PKGNAME= sqtop-2011.11.01
-REVISION= 2
+PKGNAME= sqtop-2015.02.08
+GH_ACCOUNT= paleg
+GH_PROJECT= sqtop
+GH_TAGNAME= v2015-02-08
+
CATEGORIES= www
FIX_EXTRACT_PERMISSIONS=Yes
MAINTAINER= Gonzalo L. R. <[email protected]>
-HOMEPAGE= https://code.google.com/p/sqtop/
-EXTRACT_SUFX= .tar.bz2
+HOMEPAGE= https://github.com/paleg/sqtop
# GPLv2
PERMIT_PACKAGE_CDROM= Yes
-WANTLIB += c m ncurses pthread ${COMPILER_LIBCXX}
-
-MASTER_SITES= ${MASTER_SITE_GOOGLECODE:=sqtop/}
+WANTLIB += ${COMPILER_LIBCXX} c curses m
CONFIGURE_STYLE= gnu
Index: distinfo
===================================================================
RCS file: /cvs/ports/www/sqtop/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- distinfo 18 Jan 2015 03:15:50 -0000 1.2
+++ distinfo 9 Apr 2018 07:51:55 -0000
@@ -1,2 +1,2 @@
-SHA256 (sqtop-2011-11-01.tar.bz2) =
GCPv6rmcEYxwc2KoIFOALQiaGKCUD9Kg2hmxI+Sy0OI=
-SIZE (sqtop-2011-11-01.tar.bz2) = 116110
+SHA256 (sqtop-2015-02-08.tar.gz) = 6uTIvBbb/nDHdtmQ7PFDKKyrDtc28L870WR6OsL16L8=
+SIZE (sqtop-2015-02-08.tar.gz) = 154535
Index: patches/patch-src_Utils_cpp
===================================================================
RCS file: patches/patch-src_Utils_cpp
diff -N patches/patch-src_Utils_cpp
--- patches/patch-src_Utils_cpp 30 Jun 2013 03:17:43 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-$OpenBSD: patch-src_Utils_cpp,v 1.1 2013/06/30 03:17:43 william Exp $
-
-Revision: 8ce6ee3cad09: print errors in more convenient way
-Revision: 502a2c7e81bf: renamed (Gb, Mb, Kb) -> (GB, MB, KB) as bytes
-Revision: f04cf1d965bc: sqstat: reworked parsing peer info to properly handle
ipv6 addresses
-Revision: 50c930f74dc7: Utils: bugfix - replaced size_t with
std::string::size_type for find_last_of result
-
-
---- src/Utils.cpp.orig Fri Nov 4 16:10:30 2011
-+++ src/Utils.cpp Wed Jun 26 21:30:44 2013
-@@ -35,6 +35,16 @@ vector<string> Utils::SplitString(string str, string d
- return result;
- }
-
-+std::pair <string, string> Utils::SplitIPPort(string ipport) {
-+ std::pair <string, string> result;
-+ std::string::size_type found = ipport.find_last_of(":");
-+ if (found != string::npos) {
-+ result.first = ipport.substr(0, found);
-+ result.second = ipport.substr(found+1);
-+ }
-+ return result;
-+}
-+
- string Utils::JoinVector(vector<string> inv, string delim) {
- string result = "";
- for (vector<string>::iterator it = inv.begin(); it != inv.end(); ++it)
-@@ -105,12 +115,12 @@ string Utils::ConvertSize(long long esize) {
- long long mb = esize/1024/1024 - gb*1024;
- long long kb = (esize/1024) % 1024;
- if (gb != 0) {
-- result += itos(gb) + "Gb ";
-+ result += itos(gb) + "GB ";
- }
- if (mb != 0) {
-- result += itos(mb) + "Mb ";
-+ result += itos(mb) + "MB ";
- }
-- result += itos(kb) + "Kb";
-+ result += itos(kb) + "KB";
- return result;
- }
-
-@@ -120,17 +130,17 @@ std::pair <string, string> Utils::ConvertSpeedPair(lon
- //long kb = speed/1024;
- if (mb != 0) {
- result.first = ftos(speed/1024.0/1024.0, 2);
-- result.second = "Mb/s";
-+ result.second = "MB/s";
- } else {
- result.first = ftos(speed/1024.0, 1);
-- result.second = "Kb/s";
-+ result.second = "KB/s";
- }
- return result;
- }
-
- string Utils::ConvertSpeed(long long speed) {
- std::pair <string, string> result = Utils::ConvertSpeedPair(speed);
-- return result.first+result.second;
-+ return result.first+" "+result.second;
- }
-
- bool Utils::VectorFindSubstr(vector<string>& v, string& str) {
-@@ -192,6 +202,17 @@ bool Utils::UserMemberOf(vector<string>& v, vector<str
- return true;
- }
- return false;
-+}
-+
-+string Utils::replace(string text, string s, string d)
-+{
-+ for(std::string::size_type index=0; index=text.find(s, index),
index!=std::string::npos;)
-+ {
-+ text.erase(index, s.length());
-+ text.insert(index, d);
-+ index+=d.length();
-+ }
-+ return text;
- }
-
- // vim: ai ts=3 sts=3 et sw=3 expandtab
Index: patches/patch-src_Utils_hpp
===================================================================
RCS file: patches/patch-src_Utils_hpp
diff -N patches/patch-src_Utils_hpp
--- patches/patch-src_Utils_hpp 30 Jun 2013 03:17:43 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-$OpenBSD: patch-src_Utils_hpp,v 1.1 2013/06/30 03:17:43 william Exp $
-
-Revision: 8ce6ee3cad09: print errors in more convenient way
-Revision: f04cf1d965bc: sqstat: reworked parsing peer info to properly handle
ipv6 addresses
-
-
---- src/Utils.hpp.orig Fri Nov 4 16:10:30 2011
-+++ src/Utils.hpp Wed Jun 26 21:30:44 2013
-@@ -11,6 +11,7 @@
-
- namespace Utils {
- extern std::vector<std::string> SplitString(std::string str, std::string
delim);
-+ extern std::pair <std::string, std::string> SplitIPPort(std::string
ipport);
- extern std::string JoinVector(std::vector<std::string> inv, std::string
delim);
- extern std::string itos(long long num);
- extern long int stol(std::string s);
-@@ -26,6 +27,7 @@ namespace Utils {
- extern bool IPMemberOf(std::vector<std::string>& v, std::string& ip_in);
- extern void ToLower(std::string& rData);
- extern bool UserMemberOf(std::vector<std::string>& v,
std::vector<std::string>& users);
-+ extern std::string replace(std::string text, std::string s, std::string d);
- };
-
- #endif /* __UTILS_H */
Index: patches/patch-src_ncui_cpp
===================================================================
RCS file: /cvs/ports/www/sqtop/patches/patch-src_ncui_cpp,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_ncui_cpp
--- patches/patch-src_ncui_cpp 30 Jun 2013 03:17:43 -0000 1.1
+++ patches/patch-src_ncui_cpp 9 Apr 2018 07:51:55 -0000
@@ -3,252 +3,253 @@ $OpenBSD: patch-src_ncui_cpp,v 1.1 2013/
Revision: 8ce6ee3cad09: print errors in more convenient way
---- src/ncui.cpp.orig Fri Nov 4 16:10:30 2011
-+++ src/ncui.cpp Wed Jun 26 21:30:44 2013
-@@ -413,35 +413,33 @@ void ncui::Print() {
+Index: src/ncui.cpp
+--- src/ncui.cpp.orig
++++ src/ncui.cpp
+@@ -420,33 +420,35 @@ void ncui::Print() {
pOpts->CopyFrom(pGlobalOpts);
// FormatConnections can set helphintmsg so it should run before header
formatting
-- if (error.empty()) {
-- if (pGlobalOpts->Hosts.size() != 0) {
-- string hosts = "Filtering by: " + Utils::JoinVector(pGlobalOpts->Hosts,
", ");
-- int coef = CompactLongLine(hosts);
-- int x = COLS/2 - hosts.size()/2;
-- if (coef > 1) x = 0;
-- mvaddstr(offset-2, x, hosts.c_str());
-- offset += coef;
-- }
-- if (pGlobalOpts->Users.size() != 0) {
-- string users = "Filtering by users: " + Utils::JoinVector(pGlobalOpts->Users,
", ");
-- int coef = CompactLongLine(users);
-- int x = COLS/2 - users.size()/2;
-- if (coef > 1) x = 0;
-- mvaddstr(offset-2, x, users.c_str());
-- offset += coef;
-- }
-- if (!pGlobalOpts->do_refresh) {
-- string msg = "Statistics refreshing disabled";
-- mvaddstr(offset-2, COLS/2 - msg.size()/2, msg.c_str());
-- offset++;
-- }
-+ if (pGlobalOpts->Hosts.size() != 0) {
-+ string hosts = "Filtering by: " + Utils::JoinVector(pGlobalOpts->Hosts, ",
");
-+ int coef = CompactLongLine(hosts);
-+ int x = COLS/2 - hosts.size()/2;
-+ if (coef > 1) x = 0;
-+ mvaddstr(offset-2, x, hosts.c_str());
-+ offset += coef;
-+ }
-+ if (pGlobalOpts->Users.size() != 0) {
-+ string users = "Filtering by users: " + Utils::JoinVector(pGlobalOpts->Users,
", ");
-+ int coef = CompactLongLine(users);
-+ int x = COLS/2 - users.size()/2;
-+ if (coef > 1) x = 0;
-+ mvaddstr(offset-2, x, users.c_str());
-+ offset += coef;
-+ }
-+ if (!pGlobalOpts->do_refresh) {
-+ string msg = "Statistics refreshing disabled";
-+ mvaddstr(offset-2, COLS/2 - msg.size()/2, msg.c_str());
-+ offset++;
-+ }
-
-- vector<SQUID_Connection> sqconns_filtered = FilterConns(sqconns);
-+ vector<SQUID_Connection> sqconns_filtered = FilterConns(sqconns);
-
-- if (pGlobalOpts->compactsameurls)
-- sqstat::CompactSameUrls(sqconns_filtered);
-- to_print = FormatConnections(sqconns_filtered, offset);
+- if (pGlobalOpts->Hosts.size() != 0) {
+- string hosts = "Filtering by: " + Utils::JoinVector(pGlobalOpts->Hosts, ",
");
+- int coef = CompactLongLine(hosts);
+- int x = COLS/2 - hosts.size()/2;
+- if (coef > 1) x = 0;
+- mvaddstr(offset-2, x, hosts.c_str());
+- offset += coef;
+- }
+- if (pGlobalOpts->Users.size() != 0) {
+- string users = "Filtering by users: " + Utils::JoinVector(pGlobalOpts->Users,
", ");
+- int coef = CompactLongLine(users);
+- int x = COLS/2 - users.size()/2;
+- if (coef > 1) x = 0;
+- mvaddstr(offset-2, x, users.c_str());
+- offset += coef;
- }
-+ if (pGlobalOpts->compactsameurls)
-+ sqstat::CompactSameUrls(sqconns_filtered);
-+ to_print = FormatConnections(sqconns_filtered, offset);
+- if (!pGlobalOpts->do_refresh) {
+- string msg = "Statistics refreshing disabled";
+- mvaddstr(offset-2, COLS/2 - msg.size()/2, msg.c_str());
+- offset++;
+- }
++ if (error.empty()) {
++ if (pGlobalOpts->Hosts.size() != 0) {
++ string hosts = "Filtering by: " + Utils::JoinVector(pGlobalOpts->Hosts,
", ");
++ int coef = CompactLongLine(hosts);
++ int x = COLS/2 - hosts.size()/2;
++ if (coef > 1) x = 0;
++ mvaddstr(offset-2, x, hosts.c_str());
++ offset += coef;
++ }
++ if (pGlobalOpts->Users.size() != 0) {
++ string users = "Filtering by users: " + Utils::JoinVector(pGlobalOpts->Users,
", ");
++ int coef = CompactLongLine(users);
++ int x = COLS/2 - users.size()/2;
++ if (coef > 1) x = 0;
++ mvaddstr(offset-2, x, users.c_str());
++ offset += coef;
++ }
++ if (!pGlobalOpts->do_refresh) {
++ string msg = "Statistics refreshing disabled";
++ mvaddstr(offset-2, COLS/2 - msg.size()/2, msg.c_str());
++ offset++;
++ }
+
+- vector<SQUID_Connection> sqconns_filtered = FilterConns(sqconns);
++ vector<SQUID_Connection> sqconns_filtered = FilterConns(sqconns);
+
+- if (pGlobalOpts->compactsameurls)
+- sqstat::CompactSameUrls(sqconns_filtered);
+- to_print = FormatConnections(sqconns_filtered, offset);
++ if (pGlobalOpts->compactsameurls)
++ sqstat::CompactSameUrls(sqconns_filtered);
++ to_print = FormatConnections(sqconns_filtered, offset);
++ }
// HEADER: print help hint
if (pGlobalOpts->showhelphint) {
-@@ -451,8 +449,9 @@ void ncui::Print() {
+@@ -456,9 +458,8 @@ void ncui::Print() {
mvchgat(0, 0, helpstr.str().size(), A_REVERSE, 0, NULL);
// or print any error
} else if (!error.empty()) {
-- mvaddstr(0, 0, error.c_str());
-- return;
-+ error = Utils::replace(error, "\n", " ");
-+ mvaddstr(0, COLS/2 - error.size()/2, error.c_str());
-+ mvchgat(0, COLS/2 - error.size()/2, error.size(), A_REVERSE, 0, NULL);
+- error = Utils::replace(error, "\n", " ");
+- mvaddstr(0, COLS/2 - error.size()/2, error.c_str());
+- mvchgat(0, COLS/2 - error.size()/2, error.size(), A_REVERSE, 0, NULL);
++ mvaddstr(0, 0, error.c_str());
++ return;
// or print some info
} else {
header_r << "Connected to " << pGlobalOpts->host << ":" <<
pGlobalOpts->port;
-@@ -463,85 +462,84 @@ void ncui::Print() {
+@@ -469,84 +470,85 @@ void ncui::Print() {
mvhline(offset - 2, 0, 0, COLS);
-- if (error.empty()) {
-- unsigned int max_y = LINES - 1; // screen height
-+ unsigned int max_y = LINES - 1; // screen height
-
-- // Connections list
-- if (!pGlobalOpts->showhelp) {
-- if (to_print.size() > 0) {
-- // some magic to determine visible part of connections according
to selected line
-- if (((to_print[selected_index].y) < (y_coef + offset)) && (increment
< 0)) {
-- start = selected_index;
-- y_coef = to_print[selected_index].y - offset;
-- } else if ((((to_print[selected_index].y + to_print[selected_index].coef) >
(max_y + y_coef - 2)) && (increment>0)) ||
-- (start > to_print.size())) {
-- if (to_print[selected_index].y + to_print[selected_index].coef +
2 > max_y) {
-- y_coef = to_print[selected_index].y +
to_print[selected_index].coef - max_y + 2;
-- }
-- else {
-- y_coef = 0;
-- }
-- for (start=0; start < selected_index; start++) {
-- if (to_print[start].new_line) continue;
-- if (to_print[start].y > y_coef+offset-1) break;
-- }
-+ // Connections list
-+ if (!pGlobalOpts->showhelp) {
-+ if (to_print.size() > 0) {
-+ // some magic to determine visible part of connections according to
selected line
-+ if (((to_print[selected_index].y) < (y_coef + offset)) && (increment
< 0)) {
-+ start = selected_index;
-+ y_coef = to_print[selected_index].y - offset;
-+ } else if ((((to_print[selected_index].y + to_print[selected_index].coef) >
(max_y + y_coef - 2)) && (increment>0)) ||
-+ (start > to_print.size())) {
-+ if (to_print[selected_index].y + to_print[selected_index].coef + 2
> max_y) {
-+ y_coef = to_print[selected_index].y +
to_print[selected_index].coef - max_y + 2;
+- unsigned int max_y = LINES - 1; // screen height
++ if (error.empty()) {
++ unsigned int max_y = LINES - 1; // screen height
+
+- // Connections list
+- if (!pGlobalOpts->showhelp) {
+- if (to_print.size() > 0) {
+- // some magic to determine visible part of connections according to
selected line
+- if (((to_print[selected_index].y) < (y_coef + offset)) && (increment
< 0)) {
+- start = selected_index;
+- y_coef = to_print[selected_index].y - offset;
+- } else if ((((to_print[selected_index].y + to_print[selected_index].coef) >
(max_y + y_coef - 2)) && (increment>0)) ||
+- (start > to_print.size())) {
+- if (to_print[selected_index].y + to_print[selected_index].coef + 2
> max_y) {
+- y_coef = to_print[selected_index].y +
to_print[selected_index].coef - max_y + 2;
++ // Connections list
++ if (!pGlobalOpts->showhelp) {
++ if (to_print.size() > 0) {
++ // some magic to determine visible part of connections according
to selected line
++ if (((to_print[selected_index].y) < (y_coef + offset)) && (increment
< 0)) {
++ start = selected_index;
++ y_coef = to_print[selected_index].y - offset;
++ } else if ((((to_print[selected_index].y + to_print[selected_index].coef) >
(max_y + y_coef - 2)) && (increment>0)) ||
++ (start > to_print.size())) {
++ if (to_print[selected_index].y + to_print[selected_index].coef +
2 > max_y) {
++ y_coef = to_print[selected_index].y +
to_print[selected_index].coef - max_y + 2;
++ }
++ else {
++ y_coef = 0;
++ }
++ for (start=0; start < selected_index; start++) {
++ if (to_print[start].new_line) continue;
++ if (to_print[start].y > y_coef+offset-1) break;
++ }
}
-+ else {
-+ y_coef = 0;
-+ }
-+ for (start=0; start < selected_index; start++) {
-+ if (to_print[start].new_line) continue;
-+ if (to_print[start].y > y_coef+offset-1) break;
-+ }
-+ }
-
-- unsigned int y;
-- for (vector<formattedline_t>::iterator it =
to_print.begin()+start; it != to_print.end(); ++it) {
-- formattedline_t fline = *it;
-- if (fline.new_line) {
-- continue;
-- }
-+ unsigned int y;
-+ for (vector<formattedline_t>::iterator it = to_print.begin()+start;
it != to_print.end(); ++it) {
-+ formattedline_t fline = *it;
-+ if (fline.new_line) {
-+ continue;
-+ }
-
-- y = fline.y - y_coef;
-+ y = fline.y - y_coef;
-
-- if ((y + fline.coef - 1) > (max_y - 2)) break;
-+ if ((y + fline.coef - 1) > (max_y - 2)) break;
-
-- mvaddstr(y, 0, fline.str.c_str());
-+ mvaddstr(y, 0, fline.str.c_str());
-
-- if (fline.highlighted) {
-- //AddWatch("id", fline.id);
-- //AddWatch("peer", fline.sconn.peer);
-- std::string::size_type found;
-- string temps;
-- for (unsigned int st = 0; st < fline.coef; st++) {
-- temps = fline.str.substr(st*COLS, st*COLS + COLS);
-- found = temps.find_first_not_of(" ");
-- mvchgat(y+st, found, temps.size()-found, A_REVERSE, 0,
NULL);
-- }
-- /*AddWatch("found", Utils::itos(found));
-- AddWatch("size", Utils::itos(fline.str.size()));
-- AddWatch("h_coef", Utils::itos(fline.coef));*/
-- selected_t = fline;
-+ if (fline.highlighted) {
-+ //AddWatch("id", fline.id);
-+ //AddWatch("peer", fline.sconn.peer);
-+ std::string::size_type found;
-+ string temps;
-+ for (unsigned int st = 0; st < fline.coef; st++) {
-+ temps = fline.str.substr(st*COLS, st*COLS + COLS);
-+ found = temps.find_first_not_of(" ");
-+ mvchgat(y+st, found, temps.size()-found, A_REVERSE, 0,
NULL);
+- else {
+- y_coef = 0;
+- }
+- for (start=0; start < selected_index; start++) {
+- if (to_print[start].new_line) continue;
+- if (to_print[start].y > y_coef+offset-1) break;
+- }
+- }
+
+- unsigned int y;
+- for (vector<formattedline_t>::iterator it = to_print.begin()+start;
it != to_print.end(); ++it) {
+- formattedline_t fline = *it;
+- if (fline.new_line) {
+- continue;
+- }
++ unsigned int y;
++ for (vector<formattedline_t>::iterator it =
to_print.begin()+start; it != to_print.end(); ++it) {
++ formattedline_t fline = *it;
++ if (fline.new_line) {
++ continue;
++ }
+
+- y = fline.y - y_coef;
++ y = fline.y - y_coef;
+
+- if ((y + fline.coef - 1) > (max_y - 2)) break;
++ if ((y + fline.coef - 1) > (max_y - 2)) break;
+
+- mvaddstr(y, 0, fline.str.c_str());
++ mvaddstr(y, 0, fline.str.c_str());
+
+- if (fline.highlighted) {
+- //AddWatch("id", fline.id);
+- //AddWatch("peer", fline.sconn.peer);
+- std::string::size_type found;
+- string temps;
+- for (unsigned int st = 0; st < fline.coef; st++) {
+- temps = fline.str.substr(st*COLS, st*COLS + COLS);
+- found = temps.find_first_not_of(" ");
+- mvchgat(y+st, found, temps.size()-found, A_REVERSE, 0,
NULL);
++ if (fline.highlighted) {
++ //AddWatch("id", fline.id);
++ //AddWatch("peer", fline.sconn.peer);
++ std::string::size_type found;
++ string temps;
++ for (unsigned int st = 0; st < fline.coef; st++) {
++ temps = fline.str.substr(st*COLS, st*COLS + COLS);
++ found = temps.find_first_not_of(" ");
++ mvchgat(y+st, found, temps.size()-found, A_REVERSE, 0,
NULL);
++ }
++ /*AddWatch("found", Utils::itos(found));
++ AddWatch("size", Utils::itos(fline.str.size()));
++ AddWatch("h_coef", Utils::itos(fline.coef));*/
++ selected_t = fline;
}
-+ /*AddWatch("found", Utils::itos(found));
-+ AddWatch("size", Utils::itos(fline.str.size()));
-+ AddWatch("h_coef", Utils::itos(fline.coef));*/
-+ selected_t = fline;
+- /*AddWatch("found", Utils::itos(found));
+- AddWatch("size", Utils::itos(fline.str.size()));
+- AddWatch("h_coef", Utils::itos(fline.coef));*/
+- selected_t = fline;
}
-- /*AddWatch("incr", Utils::itos(increment));
-- AddWatch("max_y", Utils::itos(max_y));
-- AddWatch("y_coef", Utils::itos(y_coef));
-- AddWatch("start", Utils::itos(start));
-- AddWatch("selec_idx", Utils::itos(selected_index));
-- AddWatch("h_y", Utils::itos(to_print[selected_index].y));
-- AddWatch("to_p[start].y", Utils::itos(to_print[start].y));*/
++ /*AddWatch("incr", Utils::itos(increment));
++ AddWatch("max_y", Utils::itos(max_y));
++ AddWatch("y_coef", Utils::itos(y_coef));
++ AddWatch("start", Utils::itos(start));
++ AddWatch("selec_idx", Utils::itos(selected_index));
++ AddWatch("h_y", Utils::itos(to_print[selected_index].y));
++ AddWatch("to_p[start].y", Utils::itos(to_print[start].y));*/
}
-- } else {
-- mvaddstr(offset, 0, helpmsg().c_str());
-+ /*AddWatch("incr", Utils::itos(increment));
-+ AddWatch("max_y", Utils::itos(max_y));
-+ AddWatch("y_coef", Utils::itos(y_coef));
-+ AddWatch("start", Utils::itos(start));
-+ AddWatch("selec_idx", Utils::itos(selected_index));
-+ AddWatch("h_y", Utils::itos(to_print[selected_index].y));
-+ AddWatch("to_p[start].y", Utils::itos(to_print[start].y));*/
+- /*AddWatch("incr", Utils::itos(increment));
+- AddWatch("max_y", Utils::itos(max_y));
+- AddWatch("y_coef", Utils::itos(y_coef));
+- AddWatch("start", Utils::itos(start));
+- AddWatch("selec_idx", Utils::itos(selected_index));
+- AddWatch("h_y", Utils::itos(to_print[selected_index].y));
+- AddWatch("to_p[start].y", Utils::itos(to_print[start].y));*/
++ } else {
++ mvaddstr(offset, 0, helpmsg().c_str());
}
-+ } else {
-+ mvaddstr(offset, 0, helpmsg().c_str());
-+ }
-
-- // FOOTER
-- string speed = sqstat::SpeedsFormat(pGlobalOpts->speed_mode, av_speed,
curr_speed);
-- speed[0] = toupper(speed[0]);
-- status << speed << "\t\t";
-- status << "Active hosts: " << sqconns.size() << "\t\t";
-- status << "Active connections: " << act_conn << "\t\t";
-+ // FOOTER
-+ string speed = sqstat::SpeedsFormat(pGlobalOpts->speed_mode, av_speed,
curr_speed);
-+ speed[0] = toupper(speed[0]);
-+ status << speed << "\t\t";
-+ status << "Active hosts: " << sqconns.size() << "\t\t";
-+ status << "Active connections: " << act_conn << "\t\t";
-
-- mvhline(max_y-1, 0, 0, COLS);
-+ mvhline(max_y-1, 0, 0, COLS);
-
-- if (debug.empty())
-- mvaddstr(max_y, 0, status.str().c_str());
-- else
-- mvaddstr(max_y, COLS - 1 - debug.size(), debug.c_str());
+- } else {
+- mvaddstr(offset, 0, helpmsg().c_str());
- }
-+ if (debug.empty())
-+ mvaddstr(max_y, 0, status.str().c_str());
-+ else
-+ mvaddstr(max_y, COLS - 1 - debug.size(), debug.c_str());
-+
+
+- // FOOTER
+- string speed = sqstat::SpeedsFormat(pGlobalOpts->speed_mode, av_speed,
curr_speed);
+- speed[0] = toupper(speed[0]);
+- status << speed << "\t\t";
+- status << "Active hosts: " << sqconns.size() << "\t\t";
+- status << "Active connections: " << act_conn << "\t\t";
++ // FOOTER
++ string speed = sqstat::SpeedsFormat(pGlobalOpts->speed_mode, av_speed,
curr_speed);
++ speed[0] = toupper(speed[0]);
++ status << speed << "\t\t";
++ status << "Active hosts: " << sqconns.size() << "\t\t";
++ status << "Active connections: " << act_conn << "\t\t";
+
+- mvhline(max_y-1, 0, 0, COLS);
++ mvhline(max_y-1, 0, 0, COLS);
+
+- if (debug.empty())
+- mvaddstr(max_y, 0, status.str().c_str());
+- else
+- mvaddstr(max_y, COLS - 1 - debug.size(), debug.c_str());
+-
++ if (debug.empty())
++ mvaddstr(max_y, 0, status.str().c_str());
++ else
++ mvaddstr(max_y, COLS - 1 - debug.size(), debug.c_str());
++ }
move(LINES - 1, COLS - 1);
refresh();
}
-@@ -605,6 +603,7 @@ void ncui::Loop() {
+@@ -610,7 +612,6 @@ void ncui::Loop() {
catch (string &s) {
ShowHelpHint(s);
}
-+ sqconns.clear();
+- sqconns.clear();
pGlobalOpts->freeze = false;
break;
case 'H':
-@@ -707,6 +706,7 @@ void ncui::Loop() {
+@@ -713,7 +714,6 @@ void ncui::Loop() {
catch (string &s) {
ShowHelpHint(s);
}
-+ sqconns.clear();
+- sqconns.clear();
pGlobalOpts->freeze = false;
break;
case '/':
-@@ -732,6 +732,7 @@ void ncui::Loop() {
+@@ -739,7 +739,6 @@ void ncui::Loop() {
catch(string &s) {
ShowHelpHint(s);
}
-+ sqconns.clear();
+- sqconns.clear();
pGlobalOpts->freeze = false;
break;
case 'r':
Index: patches/patch-src_sqstat_cpp
===================================================================
RCS file: /cvs/ports/www/sqtop/patches/patch-src_sqstat_cpp,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_sqstat_cpp
--- patches/patch-src_sqstat_cpp 30 Jun 2013 03:17:43 -0000 1.1
+++ patches/patch-src_sqstat_cpp 9 Apr 2018 07:51:55 -0000
@@ -7,14 +7,15 @@ Revision: 9cafb9feb080: sqstat: added su
Revision: dc33d36f6c17: fixed to work with squid3.3.5
---- src/sqstat.cpp.orig Fri Nov 4 16:10:30 2011
-+++ src/sqstat.cpp Wed Jun 26 21:30:44 2013
+Index: src/sqstat.cpp
+--- src/sqstat.cpp.orig
++++ src/sqstat.cpp
@@ -195,7 +195,7 @@ string sqstat::SpeedsFormat(Options::SPEED_MODE mode,
break;
}
case Options::SPEED_AVERAGE:
-- result << "average speed: " + av_speed_pair.first +
av_speed_pair.second;
-+ result << "average speed: " + av_speed_pair.first + " " +
av_speed_pair.second;
+- result << "average speed: " + av_speed_pair.first + " " +
av_speed_pair.second;
++ result << "average speed: " + av_speed_pair.first +
av_speed_pair.second;
break;
};
return result.str();
@@ -22,77 +23,77 @@ Revision: dc33d36f6c17: fixed to work wi
void sqstat::FormatChanged(string line) {
std::stringstream result;
result << "Warning!!! Please send bug report.";
-- result << " active_requests format changed - \'" << line << "\'." << endl;
-- result << squid_version << endl;
-- result << PACKAGE_NAME << "-" << VERSION;
-+ result << " active_requests format changed - \'" << line << "\'.";
-+ result << " " << squid_version << ".";
-+ result << " " << PACKAGE_NAME << "-" << VERSION;
+- result << " active_requests format changed - \'" << line << "\'.";
+- result << " " << squid_version << ".";
+- result << " " << PACKAGE_NAME << "-" << VERSION;
++ result << " active_requests format changed - \'" << line << "\'." << endl;
++ result << squid_version << endl;
++ result << PACKAGE_NAME << "-" << VERSION;
throw sqstatException(result.str(), FORMAT_CHANGED);
}
-@@ -311,9 +311,9 @@ vector<SQUID_Connection> sqstat::GetInfo(Options* pOpt
+@@ -312,9 +312,9 @@ vector<SQUID_Connection> sqstat::GetInfo(Options* pOpt
while ((con >> temp_str) != 0) {
if (connections.size()==0) {
if (n==0) {
-- if (temp_str != "HTTP/1.0 200 OK") {
-+ if (temp_str != "HTTP/1.0 200 OK" && temp_str != "HTTP/1.1 200
OK") {
+- if (temp_str != "HTTP/1.0 200 OK" && temp_str != "HTTP/1.1 200
OK") {
++ if (temp_str != "HTTP/1.0 200 OK") {
std::stringstream error;
-- error << "Access to squid statistic denied: " << temp_str << endl
<< endl;
-+ error << "Access to squid statistic denied: " << temp_str;
+- error << "Access to squid statistic denied: " << temp_str;
++ error << "Access to squid statistic denied: " << temp_str << endl
<< endl;
/*string ip;
try {
ip = get_ip();
-@@ -321,10 +321,10 @@ vector<SQUID_Connection> sqstat::GetInfo(Options* pOpt
+@@ -322,10 +322,10 @@ vector<SQUID_Connection> sqstat::GetInfo(Options* pOpt
catch (string) {
ip = "<your_host_ip>";
}*/
-- error << "You must enable access to squid statistic in squid.conf by adding
strings like:" << endl << endl;
-+ /*error << "You must enable access to squid statistic in squid.conf by
adding strings like:" << endl << endl;
+- /*error << "You must enable access to squid statistic in squid.conf by
adding strings like:" << endl << endl;
++ error << "You must enable access to squid statistic in squid.conf by adding
strings like:" << endl << endl;
error << "\tacl adminhost src
<admin_host_ip_here>/255.255.255.255" << endl;
error << "\thttp_access allow manager adminhost" << endl;
-- error << "\thttp_access deny manager";
-+ error << "\thttp_access deny manager";*/
+- error << "\thttp_access deny manager";*/
++ error << "\thttp_access deny manager";
throw sqstatException(error.str(), ACCESS_DENIED);
} else {
n=1;
-@@ -353,23 +353,25 @@ vector<SQUID_Connection> sqstat::GetInfo(Options* pOpt
+@@ -355,25 +355,23 @@ vector<SQUID_Connection> sqstat::GetInfo(Options* pOpt
newStats.etime = 0;
newStats.delay_pool = -1;
} else { FormatChanged(temp_str); }
-- } else if (temp_str.substr(0,6) == "peer: ") {
-- result = Utils::SplitString(temp_str, ":");
-- if (result.size() == 3) {
-- string peer = result[1].substr(1);
-- Conn_it = std::find_if( connections.begin(),
connections.end(), std::bind2nd( std::ptr_fun(ConnByPeer) , peer) );
-- // if it is new peer, create new SQUID_Connection
-- if (Conn_it == connections.end()) {
-- SQUID_Connection connection;
-- connection.peer = peer;
-+ } else if ((temp_str.substr(0,6) == "peer: ") or (temp_str.substr(0,8) ==
"remote: ")) {
-+ result = Utils::SplitString(temp_str, " ");
-+ if (result.size() == 2) {
-+ std::pair <string, string> peer =
Utils::SplitIPPort(result[1]);
-+ if (!peer.first.empty()) {
-+ Conn_it = std::find_if( connections.begin(),
connections.end(), std::bind2nd( std::ptr_fun(ConnByPeer) , peer.first) );
-+ // if it is new peer, create new SQUID_Connection
-+ if (Conn_it == connections.end()) {
-+ SQUID_Connection connection;
-+ connection.peer = peer.first;
+- } else if ((temp_str.substr(0,6) == "peer: ") or (temp_str.substr(0,8) ==
"remote: ")) {
+- result = Utils::SplitString(temp_str, " ");
+- if (result.size() == 2) {
+- std::pair <string, string> peer =
Utils::SplitIPPort(result[1]);
+- if (!peer.first.empty()) {
+- Conn_it = std::find_if( connections.begin(),
connections.end(), std::bind2nd( std::ptr_fun(ConnByPeer) , peer.first) );
+- // if it is new peer, create new SQUID_Connection
+- if (Conn_it == connections.end()) {
+- SQUID_Connection connection;
+- connection.peer = peer.first;
++ } else if (temp_str.substr(0,6) == "peer: ") {
++ result = Utils::SplitString(temp_str, ":");
++ if (result.size() == 3) {
++ string peer = result[1].substr(1);
++ Conn_it = std::find_if( connections.begin(),
connections.end(), std::bind2nd( std::ptr_fun(ConnByPeer) , peer) );
++ // if it is new peer, create new SQUID_Connection
++ if (Conn_it == connections.end()) {
++ SQUID_Connection connection;
++ connection.peer = peer;
#ifdef WITH_RESOLVER
-- connection.hostname = DoResolve(pOpts, peer);
-+ connection.hostname = DoResolve(pOpts, peer.first);
+- connection.hostname = DoResolve(pOpts, peer.first);
++ connection.hostname = DoResolve(pOpts, peer);
#endif
-- connections.push_back(connection);
-- Conn_it = connections.end() - 1;
-+ connections.push_back(connection);
-+ Conn_it = connections.end() - 1;
-+ }
-+ Conn_it->stats.push_back(newStats);
-+ Stat_it = Conn_it->stats.end() - 1;
+- connections.push_back(connection);
+- Conn_it = connections.end() - 1;
+- }
+- Conn_it->stats.push_back(newStats);
+- Stat_it = Conn_it->stats.end() - 1;
++ connections.push_back(connection);
++ Conn_it = connections.end() - 1;
}
-- Conn_it->stats.push_back(newStats);
-- Stat_it = Conn_it->stats.end() - 1;
++ Conn_it->stats.push_back(newStats);
++ Stat_it = Conn_it->stats.end() - 1;
} else { FormatChanged(temp_str); }
} else if (temp_str.substr(0,4) == "uri ") {
result = Utils::SplitString(temp_str, " ");
Index: patches/patch-src_sqtop_cpp
===================================================================
RCS file: patches/patch-src_sqtop_cpp
diff -N patches/patch-src_sqtop_cpp
--- patches/patch-src_sqtop_cpp 8 Apr 2018 19:38:07 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-$OpenBSD: patch-src_sqtop_cpp,v 1.2 2018/04/08 19:38:07 jasper Exp $
-
-- error: cannot initialize a member subobject of type 'int' with an rvalue of
type 'nullptr_t'
-- Revision: 21859c656dbc: sqtop: set resolving opts before getting info from
squid
-
-Index: src/sqtop.cpp
---- src/sqtop.cpp.orig
-+++ src/sqtop.cpp
-@@ -35,7 +35,7 @@ static struct option longopts[] = {
- { "hosts", required_argument, NULL, 'H' },
- { "users", required_argument, NULL, 'u' },
- { "pass", required_argument, NULL, 'P' },
-- { "help", no_argument, NULL, NULL},
-+ { "help", no_argument, NULL, 0 },
- { "brief", no_argument, NULL, 'b' },
- { "full", no_argument, NULL, 'f' },
- { "zero", no_argument, NULL, 'z' },
-@@ -266,6 +266,10 @@ int main(int argc, char **argv) {
- #endif
- sqstat sqs;
- std::vector<SQUID_Connection> stat;
-+#ifdef WITH_RESOLVER
-+ pOpts->pResolver->resolve_mode = Resolver::RESOLVE_SYNC;
-+#endif
-+ pOpts->speed_mode = Options::SPEED_AVERAGE;
- try {
- stat = sqs.GetInfo(pOpts);
- }
-@@ -273,11 +277,7 @@ int main(int argc, char **argv) {
- cerr << e.what() << endl;
- exit(1);
- }
-- pOpts->speed_mode = Options::SPEED_AVERAGE;
- cout << sqstat::HeadFormat(pOpts, sqs.active_conn, stat.size(), sqs.av_speed)
<< endl;
--#ifdef WITH_RESOLVER
-- pOpts->pResolver->resolve_mode = Resolver::RESOLVE_SYNC;
--#endif
- cout << conns_format(pOpts, stat) << endl;
- #ifdef ENABLE_UI
- }