pppcosts - novy tarif i2000 od zari
Martin Mačok
martin.macok na underground.cz
Čtvrtek Srpen 31 17:00:24 CEST 2000
Zajemcum posilam muj (presne 42-sekundovy :) patch na pppcosts, aby
zvladal novy tarif i2000 platny od 1. zari.
K emailu prikladam PATCH i2000new.patch na pppcosts-0.6[67] od Vladimira
Michla (viz Cc:) ze stranky http://www.penguin.cz/~michlv/software/
(konkretne soubor pppcosts-0.66my-1.i2000.tgz, tato verze ovsem o sobe
tvrdi, ze je 0.67, ale to je ted jedno ...) a jeste muj pppcosts.spec
soubor pro vytvoreni RPM balicku.
Navod k vytvoreni RPM balicku pro nezletile Red Hateisty:
<ulozte do aktualniho adresare obe prilohy tohoto emailu - patch a spec)
$ wget http://www.penguin.cz/~michlv/software/<najdete_si_to_tam.tgz>
$ cp pppcosts*tgz i2000new.patch /usr/src/redhat/SOURCES/
$ cp pppcosts.spec /usr/src/redhat/SPECS/
$ rpm -ba /usr/src/redhat/SPECS/pppcosts.spec
...
# rpm -Uvh /usr/src/redhat/RPMS/i386/pppcosts*rpm
...
Vetsi dobu jsem stravil psanim tohoto emailu nez psanim toho patche a
testovanim, takze to radsi prekontrolujte, zda jsem to nezvoral ...
Doporucuji precist README* soubory, zmerit si dobu mezi piskanim modemu
a zapocitanim casu 0:00 pppcosts (muze byt kladna i zaporna, podle toho,
kterym programem se na inet pripojujete) a odpovidajici hodnotu (radsi
o par sekund zmensenou) zapsat do pppcosts.h jako DIALTIME. Potom je
treba pppcosts prekompilovat!
(pro nezletile: tgz rozbalte, konstantu upravte, zase ho zabalte a
potom vytvorte RPM balik podle predchazejici navodu).
Ja pouzivam wvdial/pppd (na worldonline) a vychazi mi to na 20-ti
sekundove zpozdeni casu 0:00 po pocatku piskani modemu. V pppcosts.h mam
#define DIAL_TIME -25
Pokud jsem vyrobil neco, co uz nekdo vyrobil prede mnou, tak jsme se
aspon zasmali, ne? ;-]
bye
P.S. Nejsem v konferenci momentalne prihlasen, takze pripadne nadavky,
ovace, nabidky k snatku a tak podobne kopirujte i na mou adresu ...
--
< Martin Mačok .-= martin.macok na underground.cz =-. < iso-8859-2 >
\\. http://kocour.ms.mff.cuni.cz/~macok/ http://underground.cz/ .//
\\\.. `-= t.r.u.s.t n.0 o.n.e =-' ..///
------------- další část ---------------
diff -ur -N pppcosts.orig/Makefile.config pppcosts/Makefile.config
--- pppcosts.orig/Makefile.config Mon Jul 10 19:26:10 2000
+++ pppcosts/Makefile.config Thu Aug 31 16:25:11 2000
@@ -10,4 +10,4 @@
# You don't have to change this, if there allready is
# a costs.so link or file in your INSTDIR
-DEFAULT=cz.telecom.i2000-costs.so
+DEFAULT=cz.telecom.i2000.2-costs.so
diff -ur -N pppcosts.orig/src/telecom/Makefile pppcosts/src/telecom/Makefile
--- pppcosts.orig/src/telecom/Makefile Wed Feb 9 14:23:04 2000
+++ pppcosts/src/telecom/Makefile Thu Aug 31 16:23:57 2000
@@ -18,6 +18,7 @@
cz.telecom-costs.so \
cz.telecom.i99-costs.so \
cz.telecom.i2000-costs.so \
+ cz.telecom.i2000.2-costs.so \
de-costs.so \
de.mobilcom.internet-costs.so \
de.viag.planet-costs.so \
diff -ur -N pppcosts.orig/src/telecom/cz.telecom.i2000.2-costs.c pppcosts/src/telecom/cz.telecom.i2000.2-costs.c
--- pppcosts.orig/src/telecom/cz.telecom.i2000.2-costs.c Thu Jan 1 01:00:00 1970
+++ pppcosts/src/telecom/cz.telecom.i2000.2-costs.c Thu Aug 31 16:23:22 2000
@@ -0,0 +1,86 @@
+/*
+ This file is part of PPPCOSTS.
+ Copyright (c) 1996,97 Tillmann Steinbrecher.
+ May be distributed according to the terms of the GNU
+ General Public License version 2. No warranty.
+
+ Phone costs for the Czech TELECOM, a.s.
+ Local Area ("mistni.i2000.2") prices as of 1. Sep 2000.
+ (Weekends: 2.60 Kc / 12.5-minute impulse,
+ Weekdays 7:00-16:59: 2.60 Kc / 3-minute impulse,
+ Weekdays 17.00-18:59: 2.60 Kc / 6.5-minute impulse)
+ Weekdays 19.00- 6:59: 2.60 Kc / 12.5-minute impulse
+ plus some impulses counted during connection)
+ Copyright (c) 1999 Vladimir Michl <Vladimir.Michl na seznam.cz>
+
+ Please modify this file for your phone company's prices
+ and send it to tst na bigfoot.com. Thanks a lot!
+*/
+/* Definition of length of impulses */
+
+#define TARIF_DAY 1
+#define TARIF_DAY1 2
+#define TARIF_HOLIDAY 4
+
+#include "costs.h"
+#include "cz.holidays.h"
+#include "easter.h"
+
+char DECIMALS= '2';
+float INITIAL_COST=0;
+char CURRENCY_AFTER_COST=1;
+char CURRENCY[10]="CZK";
+float COSTS_PER_UNIT=2.60;
+
+#define DAY_SUNDAY 0
+#define DAY_SATURDAY 6
+
+int getunitlength(time_t tt, time_t last, int nunits) {
+ int tarif, unitsecs;
+
+ int easter_sun = get_easter(tt); /* Computing of easter must be before localtime */
+ struct tm* ct = localtime(&tt);
+
+ /* Phone unit lengths for SPT TELECOM, a.s. - hardcoded. */
+
+/* printf(" It's %u o'clock.\n", ct->tm_hour);*/
+ if(ct->tm_wday == DAY_SUNDAY || ct->tm_wday == DAY_SATURDAY /* Weekend */
+ || is_holiday(cz_holidays, ct)
+ || ct->tm_yday == easter_sun+1 /* Easter monday - velikonocni pondeli */
+ ){
+ tarif=TARIF_HOLIDAY;
+ } else {
+ if(ct->tm_hour >= 7 && ct->tm_hour < 17)
+ tarif=TARIF_DAY;
+ if(ct->tm_hour >= 17 && ct->tm_hour < 19)
+ tarif=TARIF_DAY1;
+ if(ct->tm_hour >= 19 || ct->tm_hour < 7)
+ tarif=TARIF_HOLIDAY;
+ }
+
+ switch (tarif){
+ case TARIF_DAY:
+ if (last < 6*60){
+ unitsecs = 120;
+ } else {
+ unitsecs = 180;
+ };
+ break;
+ case TARIF_DAY1:
+ if (last < 120){
+ unitsecs = 120;
+ } else {
+ unitsecs = 390;
+ };
+ break;
+ case TARIF_HOLIDAY:
+ if (last < 290){
+ unitsecs = 290;
+ } else {
+ unitsecs = 750;
+ };
+ };
+
+ return unitsecs;
+ }
+
------------- další část ---------------
Summary: pppcosts does what you expect.
Name: pppcosts
Version: 0.67
Release: 3
Copyright: GPL
Group: Network/Traffic
Packager: martin.macok na underground.cz
Source0: pppcosts-0.66my-1.i2000.tgz
Patch0: i2000new.patch
Buildroot: /var/tmp/pppcosts-root
%changelog
%description
pppcosts does what you expect. (i'm too lazy to write it ;-] )
this is version modified for i2000 and i2000.2 (valid after September 1 2000).
%prep
%setup -q -n pppcosts
%patch0 -p1 -b .old
%build
make
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/bin $RPM_BUILD_ROOT/usr/lib
make install BINDIR=$RPM_BUILD_ROOT/usr/bin INSTDIR=$RPM_BUILD_ROOT/usr/lib/pppcosts
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc README contrib/* TELECOMS README.X src/pppcost.h
/usr/bin/*
/usr/lib/pppcosts
------------- další část ---------------
A non-text attachment was scrubbed...
Name: [žádný popis není k dispozici]
Type: application/pgp-signature
Size: 232 bytes
Desc: [žádný popis není k dispozici]
URL: <http://www.linux.cz/pipermail/linux/attachments/20000831/fde04df6/attachment.sig>
Další informace o konferenci Linux