From 221883a5707615d010e34c527e413c2492727016 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 27 Mar 2004 05:34:23 +0000 Subject: move to include --- Makefile | 2 +- include/tgeb.h | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/tgebup.h | 18 ++++++ src/Makefile | 4 +- src/main.c | 4 +- 5 files changed, 191 insertions(+), 5 deletions(-) create mode 100644 include/tgeb.h create mode 100644 include/tgebup.h diff --git a/Makefile b/Makefile index cfdf5da..a8f9ab5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # $Id$ -SUBDIR+= tgeb src +SUBDIR+= lib src #SUBDIR+= gui .include diff --git a/include/tgeb.h b/include/tgeb.h new file mode 100644 index 0000000..c0a3dfd --- /dev/null +++ b/include/tgeb.h @@ -0,0 +1,168 @@ +/* $Id$ */ +/* + * Copyright (c) 2004 demon + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#define TGEB_PATH "/.tgeb" + +/* + * anbieter.c + */ + +#define T_CC 0x00 /* calling card */ +#define T_CBC 0x01 /* call by call */ +#define T_CBCR 0x02 /* call by call with registration */ +#define T_RTR 0x03 /* router */ +#define T_PRES 0x04 /* preselection */ +#define T_TDA 0x05 /* deutsche telekom analog */ +#define T_TDI 0x06 /* deutsche telekom isdn */ +#define T_0190 0x08 /* 0190 */ + +typedef struct an_d { + struct an_hdr *h; /* back-pointer to header */ + char *serv; /* service (e.g. string "call by call") */ + char *pref; /* prefix */ + unsigned int id; /* ID */ + char *valf; /* valid from */ + char *valt; /* valid to */ + unsigned short type; /* type of service (int value) */ + float mvol; /* mindest volume (Euro) */ + float bfee; /* base fee (0.001 Euro) */ + float afee; /* arrangement fee (0.001 Euro) */ + char *url; + char *url2; + char *phone; + char *mail; + char *x; /* XXX */ + unsigned short reg; /* registration (TRUE/FALSE) */ + char *rurl; /* registration url */ + char *rfax; /* registration fax */ +} AN_D; + +typedef struct an_hdr { + unsigned int off; /* offset */ + unsigned short q; /* entry quantity */ + char *name; /* name */ + char *mail; /* e-mail */ + char *url; /* url */ + struct an_d *d; +} AN_HDR; + +typedef struct an { + unsigned short q; /* provider quantity */ + struct an_hdr *h; /* header */ + unsigned short e_q; /* entries qantity */ + struct an_d *e; /* entries (id-sorted) */ +} AN; + +AN *tgeb_read_an(char *file); +void tgeb_free_an(AN *); + +/* + * ausland.c + */ + +typedef struct au_d { + unsigned short *id; + char *land; + char *dial; +} AU_D; + +typedef struct au_hdr { + struct an_d *d; + char *land; + char *dial; +} AU_HDR; + +typedef struct au { + unsigned short q; /* quantity */ + unsigned short l; + struct au_d *d; + unsigned short *max; +} AU; + +AU *tgeb_read_au(char *file); +void tgeb_free_au(AU *); + +/* + * tarife.c + */ + +#define NAH_W 0x00 +#define NAH_E 0x01 +#define REG_W 0x02 +#define REG_E 0x03 +#define FERN_W 0x04 +#define FERN_E 0x05 +#define ORT_W 0x06 +#define ORT_E 0x07 +#define D1_W 0x08 +#define D1_E 0x09 +#define D2_W 0x0A +#define D2_E 0x0B +#define EP_W 0x0C +#define EP_E 0x0D +#define O2_W 0x0E +#define O2_E 0x0F + +#define AUS_W 0x00 +#define AUS_E 0x01 +#define Q_IN 16 + +typedef struct ta_d { + unsigned short time; /* valid till */ + float dfee; /* dial-in fee */ + float fee; /* fee (Brutto) */ + unsigned short t1; /* timing 1 */ + unsigned short t2; /* timing 2 */ + struct ta_d *next; /* next data block in chain */ + struct ta_d *prev; /* prevision data block in chain */ +} TA_D; + +typedef struct ta_idx { + unsigned int off; /* region / day-of-week offset */ + struct ta_d *data; +} TA_IDX; + +typedef struct ta_hdr { + struct ta_idx *in; + unsigned int off_in; + struct ta_idx *aus; + unsigned int off_aus; +} TA_HDR; + +typedef struct ta { /* file offset 0 */ + unsigned short q; /* quantity provider */ + unsigned short *q_aus; /* entrys quantity per provider */ + struct ta_hdr *h; +} TA; + +TA *tgeb_read_ta(char *file, struct au *); +void tgeb_free_ta(TA *); + +/* + *common.c + */ + +typedef struct sorted { + int q; + int *id; + struct ta_d **data; +} SORTED; + +void _tgeb_sread(char **, FILE *); /* read string */ +SORTED *tgeb_select(TA *, AN *, int reg, int flags, int time); +void tgeb_free_mem(AN *, AU *, TA *); +void tgeb_free_sd(SORTED *); diff --git a/include/tgebup.h b/include/tgebup.h new file mode 100644 index 0000000..74fbf96 --- /dev/null +++ b/include/tgebup.h @@ -0,0 +1,18 @@ +/* $Id$ */ +/* + * Copyright (c) 2004 demon + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +void tgeb_update(struct tm *); diff --git a/src/Makefile b/src/Makefile index 318328e..76e3bfe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,8 +2,8 @@ PROG= tgeb SRCS= main.c -CFLAGS+= -Wall -I.. -LDADD+= -L../tgeb -ltgeb -lz +CFLAGS+= -Wall -I${.CURDIR}/../include +LDADD+= -L${.CURDIR}/../lib -L${.CURDIR}/../lib/obj -ltgeb -lz NOMAN= . include diff --git a/src/main.c b/src/main.c index 3b2fcc0..3f84b82 100644 --- a/src/main.c +++ b/src/main.c @@ -21,8 +21,8 @@ #include #include #include -#include -#include +#include +#include extern char *__progname; const char *copyright = "$ TGeb parasite 0.2 -" \ -- cgit v1.2.3