From 068f0e750bed52bfbe63a9fe39e332b1a0ef151a Mon Sep 17 00:00:00 2001 From: xchaos Date: Mon, 14 Jan 2013 22:58:46 +0000 Subject: [PATCH] Major rewrite of leading comments git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@208 251d49ef-1d17-4917-a970-b30cf55b089b --- Makefile | 2 +- help.c | 24 ++++++++++++++++++++ prometheus.c | 62 +++++++++++++++++++++------------------------------- 3 files changed, 50 insertions(+), 38 deletions(-) create mode 100644 help.c diff --git a/Makefile b/Makefile index a47818e..2f89465 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ prefix=/usr mandir=$(prefix)/share/man sbindir=$(prefix)/sbin sysconfdir=/etc -OBJECTS=parsehosts.o parselogs.o ipv4subnets.o json.o htmlandlogs.o prometheus.o +OBJECTS=parsehosts.o parselogs.o ipv4subnets.o json.o htmlandlogs.o help.o prometheus.o HEADERS=cll1-0.6.2.h ipstruct.h main: prometheus diff --git a/help.c b/help.c new file mode 100644 index 0000000..23c71b4 --- /dev/null +++ b/help.c @@ -0,0 +1,24 @@ +/* Modified by: xChaos, 20130114 */ + +#include "cll1-0.6.2.h" + +void help(void) +{ + puts("Command line switches:\n\ +\n\ +-d Dry run (preview tc and iptables commands on stdout)\n\ +-r Run (reset all statistics and start shaping - daily usage)\n\ +-p just generate Preview of data transfer statistics and exit (after -r)\n\ +-s start Shaping FUP limits (keeps data transfer stat like -p) (after -r)\n\ +-n run Now (like -r delay - overrides qos-free-delay keyword, after boot)\n\ +-f just Flush iptables and tc classes and exit (stop shaping, no QiS)\n\ +-9 emergency iptables flush (like -f, but dumps data transfer statistics)\n\ +\n\ +-c filename force alternative /etc/prometheus/prometheus.conf filename\n\ +-h filename force alternative /etc/hosts filename (overrides hosts keyword)\n\ +-l Mmm YYYY generate HTML summary of Logged traffic (Mmm=Jan-Dec) (and exit)\n\ +-m generate HTML summary of traffic for yesterday's Month (and exit)\n\ +-y generate HTML summary of traffic for yesterday's Year (and exit)\n\ +-? --help show this help scree (and exit)\n\ +-v --version show Version number of this utility (and exit)\n"); +} diff --git a/prometheus.c b/prometheus.c index 0940087..9743b30 100644 --- a/prometheus.c +++ b/prometheus.c @@ -1,13 +1,13 @@ - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - /* Prometheus QoS - you can "steal fire" from your ISP */ -/* "fair-per-IP" quality of service (QoS) utility */ -/* requires Linux 2.4.x or 2.6.x with HTB support */ -/* Copyright(C) 2005-2013 Michael Polak, Arachne Labs */ -/* iptables-restore support Copyright(C) 2007-2008 ludva */ -/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* Modified by: xChaos, 20130107 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* Prometheus QoS - you can "steal fire" from your ISP */ +/* "fair-per-IP" quality of service (QoS) utility */ +/* requires Linux 2.4.x or 2.6.x with HTB support */ +/* Copyright(C) 2005-2013 Michael Polak, Arachne Aerospace */ +/* iptables-restore support Copyright(C) 2007-2008 ludva */ +/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/* Modified by: xChaos, 20130114 ludva, 20080415 Prometheus QoS is free software; you can redistribute it and/or @@ -26,43 +26,27 @@ GNU General Public License is located in file COPYING */ -#define STRLEN 512 -#undef DEBUG - #include "cll1-0.6.2.h" #include "ipstruct.h" const char *version = "0.8.3-g"; -/* Version numbers: 0.8.3 is development releases ("beta"), 0.8.4 will be "stable" */ -/* Debian(RPM) package versions/patchlevels: 0.7.9-2, 0.8.0-1, 0.8.0-2, etc. */ -/* C source code development versions ("beta"): 0.7.9-a, 0.8.1-b, etc. */ -/* C source code release versions: 0.8.0, 0.8.2, 0.8.4, etc. */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* Versions: 0.8.3 is development release, 0.8.4 will be "stable" */ +/* Official Trac URL: https://dev.arachne.cz/svn/prometheus */ +/* Official SVN URL: https://dev.arachne.cz/repos/prometheus */ +/* BTC donations account: 19rriLx8vR19wGefPaMhakqnCYNYwjLvxq */ +/* CZK donations account: 2900242944/2010 (transparent account) */ +/* Warning: unofficial Github mirror is not supported by author! */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2013 Michael Polak, Arachne Labs
\n"; +#define STRLEN 512 +#undef DEBUG + /* ======= Help screen is hopefuly self-documenting part of code :-) ======= */ -void help(void) -{ - puts("Command line switches:\n\ -\n\ --d Dry run (preview tc and iptables commands on stdout)\n\ --r Run (reset all statistics and start shaping - daily usage)\n\ --p just generate Preview of data transfer statistics and exit (after -r)\n\ --s start Shaping FUP limits (keeps data transfer stat like -p) (after -r)\n\ --n run Now (like -r delay - overrides qos-free-delay keyword, after boot)\n\ --f just Flush iptables and tc classes and exit (stop shaping, no QiS)\n\ --9 emergency iptables flush (like -f, but dumps data transfer statistics)\n\ -\n\ --c filename force alternative /etc/prometheus/prometheus.conf filename\n\ --h filename force alternative /etc/hosts filename (overrides hosts keyword)\n\ --l Mmm YYYY generate HTML summary of Logged traffic (Mmm=Jan-Dec) (and exit)\n\ --m generate HTML summary of traffic for yesterday's Month (and exit)\n\ --y generate HTML summary of traffic for yesterday's Year (and exit)\n\ --? --help show this help scree (and exit)\n\ --v --version show Version number of this utility (and exit)\n"); -} /* ======= All path names are defined here (for RPM patch) ======= */ @@ -148,6 +132,9 @@ struct IP *ips = NULL, *ip, *sharedip; struct Group *groups = NULL, *group; struct Keyword *keyword, *defaultkeyword=NULL, *keywords=NULL; +void help(void); +/* implemented in help.c */ + void parse_ip_log(int argc, char **argv); /* implemented in parselog.c */ @@ -174,6 +161,7 @@ const char *tr_odd_even(void) } /* ==== This is C<<1 stuff - learn C<<1 first! https://dev.arachne.cz/svn/cll1h ==== */ +/* (except that this code uses obsolete, archaic version of this header file...) */ struct Index { -- 2.30.2