Codebase list squidview / 65c1dd4
Imported Upstream version 0.67 Willi Mann 11 years ago
8 changed file(s) with 137 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
00 >> Squidview history:
1
2 v0.67: 5 March 2004
3 - endwin() goes back in
4
5 v0.66: 4 March 2004:
6 - tries to guess squid log file location (at first run)
7 - disabled endwin(3) in RunProgram because a report said it messed up a
8 terminal
9 - Debian provided man page added - thanks Willi Mann
110
211 v0.65: 29 February 2004:
312 - faster runs of external programs - help here from Willi Mann of
00 bin_PROGRAMS = squidview
11 squidview_SOURCES = squidview.cpp squidview.h
22 pkgdata_DATA = HOWTO BUGS users words aliases example.log
3 EXTRA_DIST = Makefile.old HOWTO BUGS users words aliases example.log
3 man_MANS = squidview.1
4 EXTRA_DIST = Makefile.old HOWTO BUGS $(man_MANS) users words aliases example.log
6464 bin_PROGRAMS = squidview
6565 squidview_SOURCES = squidview.cpp squidview.h
6666 pkgdata_DATA = HOWTO BUGS users words aliases example.log
67 EXTRA_DIST = Makefile.old HOWTO BUGS users words aliases example.log
67 man_MANS = squidview.1
68 EXTRA_DIST = Makefile.old HOWTO BUGS $(man_MANS) users words aliases example.log
6869 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
6970 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
7071 CONFIG_HEADER = config.h
8889 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
8990 CCLD = $(CC)
9091 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
92 man1dir = $(mandir)/man1
93 MANS = $(man_MANS)
94
95 NROFF = nroff
9196 DATA = $(pkgdata_DATA)
9297
9398 DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
197202 $(CXXLINK) $(squidview_LDFLAGS) $(squidview_OBJECTS) $(squidview_LDADD) $(LIBS)
198203 .cpp.o:
199204 $(CXXCOMPILE) -c $<
205
206 install-man1:
207 $(mkinstalldirs) $(DESTDIR)$(man1dir)
208 @list='$(man1_MANS)'; \
209 l2='$(man_MANS)'; for i in $$l2; do \
210 case "$$i" in \
211 *.1*) list="$$list $$i" ;; \
212 esac; \
213 done; \
214 for i in $$list; do \
215 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
216 else file=$$i; fi; \
217 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
218 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
219 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
220 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
221 $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
222 done
223
224 uninstall-man1:
225 @list='$(man1_MANS)'; \
226 l2='$(man_MANS)'; for i in $$l2; do \
227 case "$$i" in \
228 *.1*) list="$$list $$i" ;; \
229 esac; \
230 done; \
231 for i in $$list; do \
232 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
233 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
234 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
235 echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
236 rm -f $(DESTDIR)$(man1dir)/$$inst; \
237 done
238 install-man: $(MANS)
239 @$(NORMAL_INSTALL)
240 $(MAKE) $(AM_MAKEFLAGS) install-man1
241 uninstall-man:
242 @$(NORMAL_UNINSTALL)
243 $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
200244
201245 install-pkgdataDATA: $(pkgdata_DATA)
202246 @$(NORMAL_INSTALL)
310354 install-exec-am: install-binPROGRAMS
311355 install-exec: install-exec-am
312356
313 install-data-am: install-pkgdataDATA
357 install-data-am: install-man install-pkgdataDATA
314358 install-data: install-data-am
315359
316360 install-am: all-am
317361 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
318362 install: install-am
319 uninstall-am: uninstall-binPROGRAMS uninstall-pkgdataDATA
363 uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-pkgdataDATA
320364 uninstall: uninstall-am
321 all-am: Makefile $(PROGRAMS) $(DATA) config.h
365 all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
322366 all-redirect: all-am
323367 install-strip:
324368 $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
325369 installdirs:
326 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir)
370 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \
371 $(DESTDIR)$(pkgdatadir)
327372
328373
329374 mostlyclean-generic:
365410 mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
366411 maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
367412 mostlyclean-compile distclean-compile clean-compile \
368 maintainer-clean-compile uninstall-pkgdataDATA install-pkgdataDATA tags \
413 maintainer-clean-compile install-man1 uninstall-man1 install-man \
414 uninstall-man uninstall-pkgdataDATA install-pkgdataDATA tags \
369415 mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
370416 distdir info-am info dvi-am dvi check check-am installcheck-am \
371417 installcheck all-recursive-am install-exec-am install-exec \
693693
694694 PACKAGE=squidview
695695
696 VERSION=0.65
696 VERSION=0.67
697697
698698 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
699699 { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
00 AC_INIT(squidview.cpp)
11 AM_CONFIG_HEADER(config.h)
2 AM_INIT_AUTOMAKE(squidview,0.65)
2 AM_INIT_AUTOMAKE(squidview,0.67)
33 AC_PROG_CXX
44 AC_PROG_INSTALL
55
0 .\" Hey, EMACS: -*- nroff -*-
1 .\" First parameter, NAME, should be all caps
2 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
3 .\" other parameters are allowed: see man(7), man(1)
4 .TH SQUIDVIEW 1 "Feber 18, 2004"
5 .\" Please adjust this date whenever revising the manpage.
6 .\"
7 .\" Some roff macros, for reference:
8 .\" .nh disable hyphenation
9 .\" .hy enable hyphenation
10 .\" .ad l left justify
11 .\" .ad b justify to both left and right margins
12 .\" .nf disable filling
13 .\" .fi enable filling
14 .\" .br insert line break
15 .\" .sp <n> insert n+1 empty lines
16 .\" for manpage-specific macros, see man(7)
17 .SH NAME
18 squidview \- program to monitor your squid's access.log
19 .SH SYNOPSIS
20 .B squidview
21 .\".RI [ options ] " files" ...
22 .SH DESCRIPTION
23 This manual page documents briefly the
24 .B squidview
25 application.
26 This manual page was written for the Debian distribution
27 because the original program does not have a manual page.
28 Instead, it has a brief online help (Press "h").
29 .PP
30 .B squidview
31 is a ncurses-based application which allows you to view
32 and monitor your squid's access.log in a very comfortable way.
33 Additionally you can create reports and statistics.
34 .SH NOTES
35 .PP
36 .B Squidview
37 is configured by the contents of the directory ~/.squidview/.
38 On first execution it creates the neccessary files. The Debian-version has been
39 modified to match the default log-path of Debian's
40 .B squid
41 package
42 /var/log/squid/access.log). If you have the permission to read this file
43 (ie be in group proxy), squidview should work out of the box. If not, file a bug
44 against this package (squidview, obviously :-)).
45 .SH OPTIONS
46 This program ignores any command-line parameters.
47 .SH AUTHOR
48 This manual page was written by Willi Mann <willi@wm1.at>,
49 for the Debian GNU/Linux system (but may be used by others).
174174 /// execute a shell command
175175 void RunProgram(const string& sCommand)
176176 {
177 //Debian - Notes: 1) "reset -Q" resets the size of my terminal (konsole).
178 //2) I don't believe "clear" is a proper way for this sort of
179 //terminal-cleaning.
180 //solution: use endwin() + refresh() + optionally (iWait) standard c++
181 //for waiting.
182 //This messes up the output in some rare cases with iErase == 0.
183 //Still readable, just not as intended. Additional note: In the
184 //original code first call of n,l didn't show anything
185 //reason not clear.
186 //Implementation of iWait was neccessary to keep the non-curses
187 //code in one function. Seems that any call to the curses library
188 //returns to curses mode, what would make it hard to keep the
189 //"Press any" key in the original place.
190
191 // clear(1) clears the user's bash console (squidview's parent), but this
192 // isn't necessary. And yes, MyCls() is much faster so now used. This bit
193 // of code has been simplified, and if all goes well these comments will
194 // be deleted.
195
196177 MyCls();
197178 curs_set (1);
198179 echo();
199180 nocbreak();
200 if (wTemp)
201 endwin(); // suggested by endwin(3)
181 endwin(); // suggested by endwin(3)
202182 system (sCommand.c_str());
203183 keypad (stdscr, TRUE);
204184 curs_set (0);
406386 string sTemp;
407387
408388 CalcPercentage (iPos, iMax, sTemp);
409 sTemp += string (" ") + szText + " | <s> to abort";
389 sTemp += string (" ") + szText + " | <s> to stop";
410390 ShowHighLightMessage (sTemp);
411391 }
412392
31243104
31253105 case 'l':
31263106 sTemp = "( cd " + sPathToFiles + " ; " +
3127 "echo -e \"Current reports:-\n\" ; " +
3107 "echo -e \"Current reports:\n\" ; " +
31283108 "ls -l *" + sReportExt + " ) | " + sViewer;
31293109 RunProgram (sTemp);
31303110 break;
32323212 if (bGood)
32333213 {
32343214 sRepFilter = sDest;
3235 con << "\n\nReport " + sDest + " made: view?";
3215 con << "\n\nReport " + sDest + " made: view (y/n)?";
32363216 if (getch() == 'y')
32373217 {
32383218 sTemp = sViewer + " " + sPathToFiles + "/" + sDest;
54095389 struct stat sStatTable;
54105390 char* szTemp;
54115391 int iTemp;
5412 string sLog1, sLog2, sLog3, sHowToFile;
5392 string sLog1, sLog2, sLog3, sHowToFile, sLogLocation;
54135393
54145394 szTemp = getenv ("HOME");
54155395 if (szTemp == 0)
54355415 return;
54365416
54375417 printf ("Making .squidview directory and links....\n");
5418
5419 sLogLocation = "";
5420 for (iTemp = 0; iTemp < int (sizeof (sLogLocations)); iTemp++)
5421 if (GetFileSize (sLogLocations [iTemp]) > 0)
5422 {
5423 sLogLocation = sLogLocations [iTemp];
5424 break;
5425 }
5426 if (sLogLocation == "")
5427 sLogLocation = sLogLocations [0];
5428
54385429 iTemp = 0;
54395430 for (;;)
54405431 {
54415432 if (mkdir (sPathToFiles.c_str(), 0755)) break;
5442 if (symlink (szMainLog, sLogFile1.c_str())) break;
5433 if (symlink (sLogLocation.c_str(), sLogFile1.c_str())) break;
54435434 if (symlink (szLog1, sLogFile2.c_str())) break;
54445435 if (symlink (szLog1, sLogFile3.c_str())) break;
54455436 if (symlink (sHowToFile.c_str(), sHowToLink.c_str())) break;
54545445 if (GetFileSize (sLogFile1) <= 0)
54555446 {
54565447 printf ("The squid log file doesn't exist or is of zero size.\n");
5457 printf ("You may need to manually adjust the symlinks in .squidview\n");
5448 printf ("You may need to manually adjust the symlinks in ~/.squidview\n");
54585449 exit (1);
54595450 }
54605451 }
1212 * along with this program; if not, write to the Free Software
1313 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1414
15 squidview 0.51
15 squidview 0.6
1616
1717 A program to nicely browse your squid log
1818
6262 string sHomeDir;
6363 const char szSquidHome[] = ".squidview";
6464 string sPathToFiles;
65 const char szMainLog[] = "/usr/local/squid/var/logs/access.log";
65 const string sLogLocations[] = {"/var/log/squid/access.log",
66 "/usr/local/squid/var/logs/access.log"};
67 // disribution builders: put your log location first in the list
6668
6769 const char szLog1[] = "log1";
6870 const char szLog2[] = "log2";